@billgangcom/theme-lib 1.101.3 → 1.101.4
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/builder.cjs.js +1 -1
- package/dist/builder.es.js +1 -1
- package/package.json +1 -1
package/dist/builder.cjs.js
CHANGED
|
@@ -101,4 +101,4 @@
|
|
|
101
101
|
`,o+="}",o},Rn=t=>{const n=document.getElementById("dynamic-styles");if(n)n.innerHTML=t;else{const o=document.createElement("style");o.id="dynamic-styles",o.innerHTML=t,document.head.appendChild(o)}},Et=new Set,En=t=>{const n=new Map;return Object.entries(t).forEach(([o,s])=>{typeof s=="object"&&Object.entries(s).forEach(([i,r])=>{var a,c;if(r&&r.font){const u=r.font.replace(/\s+/g,"+");n.has(u)||n.set(u,new Set),(a=n.get(u))==null||a.add(r.weight),(c=n.get(u))==null||c.add(r.boldWeight)}})}),n},yn=t=>{const n=new Map;return Object.entries(t).forEach(([o,s])=>{typeof s=="object"&&Object.keys(s).forEach(i=>{var r;if(i==="font"&&s[i]){const a=s[i].replace(/\s+/g,"+");n.has(a)||n.set(a,new Set),(r=n.get(a))==null||r.add("400")}})}),n},bn=t=>{Et.forEach(n=>{if(!t.has(n)){const o=document.querySelector(`link[data-font="${n}"]`);o&&o.remove(),Et.delete(n)}})},wn=t=>{const n=new Set;t.forEach((o,s)=>{const i=Array.from(o).join(";"),r=`${s}:wght@${i}`;if(n.add(r),!Et.has(r)){const a=document.createElement("link");a.rel="stylesheet",a.href=`https://fonts.googleapis.com/css2?family=${r}&display=swap`,a.setAttribute("data-font",r),document.head.appendChild(a),Et.add(r)}}),bn(n)},kn=t=>{if(t.fonts){const n=En(t.fonts.desktop),o=yn(t.buttons),s=new Map(n);o.forEach((i,r)=>{if(s.has(r)){const a=s.get(r);i.forEach(c=>a==null?void 0:a.add(c))}else s.set(r,new Set(i))}),wn(s)}};function Nn(){if(window.location.pathname.includes("/admin/builder"))try{const{editBlock:t,currentBlock:n,blocks:o,setHeader:s,setFooter:i,setAnnouncement:r}=e.useLayersStore.getState(),{currentPage:a,pages:c}=e.usePagesStore.getState(),{currentInstance:u,settingsInstance:h}=e.useBlocksStore.getState(),{setSettings:d}=e.useSettingsStore.getState();if(n||d(h.blockSettings),u&&n){if(n==="header")s(u);else if(n==="footer")i(u);else if(n==="announcement")r(u);else if(n==="header"||n==="footer"||n==="announcement")throw new Error(`Missing ${n} data.`)}if(u&&c&&n&&!["header","footer","announcement"].includes(n)){const g={blockSettings:{}};if(!u.blockSettings)throw new Error("currentInstance.blockSettings is undefined.");if(Object.keys(u.blockSettings).filter(m=>!["displayName","isAddable"].includes(m)).forEach(m=>{g.blockSettings[m]=u.blockSettings[m]}),!c[a])throw new Error(`Page "${a}" does not exist.`);if(!o[c[a].path].data||!o[c[a].path].data[n])throw new Error(`Layer or block for page "${c[a].path}" and block "${n}" does not exist.`);t(c[a].path,n,{name:o[c[a].path].data[n].name,value:g})}}catch(t){console.error("Error in hotReload function:",t)}}const Tn=()=>{const t=e.useApiStore.getState().apiUrls,n=e.useNavigate(),{notifications:o,setNotifications:s}=e.useNotificationStore(),{isAntistock:i}=e.useGeneralStore();return async(r,a,c,u,h)=>{const d=e.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,g=`${t.slApi}/v1/public/${d}/tickets`;try{const m=await e.request({method:"post",url:g,body:{title:r,firstMessage:a,email:u,recaptcha:c,tsId:e.getTsId(),orderId:h},withToken:!1});return s([...o,{id:e.v4(),message:i?"Support ticket successfully created. You can expect to hear from us soon.":"Ticket created successfully. We will contact you by mail",status:"success"}]),n(`/ticket/${m.data.id}/${m.data.accessToken}`),m}catch(m){s([...o,{id:e.v4(),message:`Error: ${m}. Please try again later.`,status:"error"}])}}},Ln=()=>{const{pages:t}=e.usePagesStore(),[n,o]=p.useState(t);return p.useEffect(()=>{o(t)},[t]),n},Pn="_tooltip_4hruj_1",An={tooltip:Pn},Je=t=>{const{text:n}=t,{setShowTooltip:o}=e.useTooltipStore();return p.useEffect(()=>(o(!0),()=>{o(!1)}),[]),e.jsxRuntimeExports.jsx("div",{className:An.tooltip,children:n})},Bn=()=>{const{undo:t,redo:n,past:o,future:s}=e.useHistoryStore(),[i,r]=p.useState(!1),[a,c]=p.useState(!1),[u,h]=p.useState(!1),[d,g]=p.useState(!1),[m,f]=p.useState(null),{notifications:j,setNotifications:l}=e.useNotificationStore();return p.useEffect(()=>{r(o.length===0)},[o]),p.useEffect(()=>{c(s.length===0)},[s]),e.jsxRuntimeExports.jsxs("div",{className:Qe.buttons,children:[e.jsxRuntimeExports.jsxs("div",{className:e.clx(Qe.button,{[Qe.disabled]:i}),onMouseEnter:()=>{const S=setTimeout(()=>{g(!0),h(!1)},200);f(S)},onMouseLeave:()=>{m&&clearTimeout(m),g(!1),h(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowUUpLeft",width:20,height:20,onClick:()=>{i||(t(),l([...j,{id:e.v4(),message:"Changes undone",status:"success"}]))},fill:i?"#757575":"#252525"}),d&&e.jsxRuntimeExports.jsx(Je,{text:i?"Nothing to undo":"Click to undo changes"})]}),e.jsxRuntimeExports.jsxs("div",{className:e.clx(Qe.button,{[Qe.disabled]:a}),onMouseEnter:()=>{const S=setTimeout(()=>{h(!0),g(!1)},200);f(S)},onMouseLeave:()=>{m&&clearTimeout(m),h(!1),g(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowUUpRight",width:20,height:20,onClick:()=>{a||(n(),l([...j,{id:e.v4(),message:"Changes redone",status:"success"}]))},fill:a?"#757575":"#252525"}),u&&e.jsxRuntimeExports.jsx(Je,{text:a?"Nothing to redo":"Click to redo changes"})]})]})},Mn="_devices_ls6k9_1",$n="_device_ls6k9_1",Fn="_active_ls6k9_27",Gt={devices:Mn,device:$n,active:Fn},Dn=()=>e.jsxRuntimeExports.jsx("div",{className:Gt.devices,children:No.map(t=>e.jsxRuntimeExports.jsx(Hn,{device:t}))}),Hn=t=>{const{device:n}=t,{currentDevice:o,setCurrentDevice:s}=e.useDeviceStore(),[i,r]=p.useState(!1),[a,c]=p.useState(null);return e.jsxRuntimeExports.jsxs("div",{className:e.clx(Gt.device,{[Gt.active]:o.value===n.value}),onClick:()=>s(n),onMouseEnter:()=>{const u=setTimeout(()=>{r(!0)},200);c(u)},onMouseLeave:()=>{a&&clearTimeout(a),r(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:n.icon,fill:o.value===n.value?"#252525":"#757575",width:20,height:20}),i&&e.jsxRuntimeExports.jsx(Je,{text:`Switch to ${n.value} view`})]},n.value)},On="_preview_1x3m8_2",Un="_active_1x3m8_19",Nt={preview:On,active:Un},Wn=()=>{const{onPreview:t}=e.usePreviewStore(),[n,o]=p.useState(!1),[s,i]=p.useState(null);return e.jsxRuntimeExports.jsxs("a",{href:"/",className:e.clx(Nt.preview,{[Nt.active]:t}),target:"_blank",onMouseEnter:()=>{const r=setTimeout(()=>{o(!0)},200);i(r)},onMouseLeave:()=>{s&&clearTimeout(s),o(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowUpRight",width:20,height:20}),e.jsxRuntimeExports.jsx("span",{className:Nt.text,children:"Preview"}),n&&e.jsxRuntimeExports.jsx(Je,{text:"Open draft theme in new tab"})]})},Gn="_settings_u4cv4_1",qn={settings:Gn},Vn="_pages_167qp_1",zn="_text_167qp_21",Zn="_modal_167qp_27",Xn="_open_167qp_46",Yn="_page_167qp_1",Kn="_hoverable_167qp_61",Jn="_separator_167qp_65",Qn="_button_167qp_70",es="_items_167qp_85",ge={pages:Vn,default:"_default_167qp_5",text:zn,modal:Zn,open:Xn,page:Yn,hoverable:Kn,separator:Jn,button:Qn,items:es},go=async t=>{const n=localStorage.getItem("shopId")||void 0,o=localStorage.getItem("draftId"),i=`${e.useApiStore.getState().apiUrls.api}/v2/builder/shops/${n}/drafts/${o}/pages/${encodeURIComponent(t)}`;return await e.request({url:i,withToken:!0,method:"delete"})},ts=()=>{const{currentPage:t,setCurrentPage:n,setIsOpenModal:o,pages:s,setIsEdit:i,setEditedPage:r,deletePage:a,setIsOpenSelectModal:c}=e.usePagesStore(),{deletePage:u,setCurrentBlock:h}=e.useLayersStore(),[d,g]=p.useState(null),{setTitle:m,setDescription:f,setOnConfirm:j}=e.useConfirmationModalStore(),[l,S]=p.useState(!1),x=p.useRef(null);e.useOnClickOutside(x,()=>{l&&S(!1)}),p.useEffect(()=>{l?c(!0):setTimeout(()=>{c(!1)},300)},[l]);const C=I=>I?I.replace(/_/g," ").split(" ").map(R=>R.charAt(0).toUpperCase()+R.slice(1)).join(" "):"";return e.jsxRuntimeExports.jsxs("div",{className:ge.pages,ref:x,children:[e.jsxRuntimeExports.jsxs("div",{className:ge.default,onClick:I=>{I.stopPropagation(),S(R=>!R)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:s&&s[t]&&s[t].icon||"File",fill:"#252525",width:20,height:20}),e.jsxRuntimeExports.jsx("span",{className:ge.text,children:s&&s[t]&&e.defaultPagePaths.includes(s[t].path)?`${C(s[t].name)} page`:s&&s[t]&&s[t].name}),e.jsxRuntimeExports.jsx("div",{style:{transform:l?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.3s ease",display:"flex"},children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretDown",width:20,height:20})})]}),e.jsxRuntimeExports.jsxs("div",{className:e.clx(ge.modal,{[ge.open]:l}),onClick:I=>I.stopPropagation(),children:[s&&e.jsxRuntimeExports.jsx("div",{className:ge.items,children:Object.keys(s).map(I=>{const R=s[I];return e.jsxRuntimeExports.jsxs("div",{className:e.clx(ge.page,{[ge.hoverable]:d===I}),onMouseEnter:()=>g(I),onMouseLeave:()=>g(null),onClick:()=>{g(null),i(!1),h(null),n(I),S(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:R.icon,fill:"#252525"}),e.jsxRuntimeExports.jsx("span",{className:ge.text,children:e.defaultPagePaths.includes(R.path)?`${C(R.name)} page`:R.name}),d===I&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Gear",fill:"#757575",onClick:_=>{_.stopPropagation(),i(!0),r(I),o(!0)}}),!e.defaultPagePaths.includes(R.path)&&e.jsxRuntimeExports.jsx(e.Icon,{name:"Trash",fill:"#C12A2A",onClick:_=>{_.stopPropagation(),m("Delete Page"),f(`Are you sure you want to delete ${R.name||"this"} page? Once you delete this page, any content visible will also be deleted. This is irreversible.`),j(()=>{_.stopPropagation(),s[t].path===R.path&&n(Object.keys(s)[0]),a(I),u(R.name),go(R.path)})}})]}),s[t]&&s[t].name===R.name&&e.jsxRuntimeExports.jsx(e.Icon,{name:"Check",fill:"#FF3F19"})]},I)})}),e.jsxRuntimeExports.jsx("div",{className:ge.separator}),e.jsxRuntimeExports.jsxs(e.Button,{className:ge.button,onClick:I=>{I.stopPropagation(),o(!0)},size:"l",children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Plus",fill:"#ff3f19"}),e.jsxRuntimeExports.jsx("span",{children:"Create New Page"})]})]})]})},os="_zoom_fu0hj_1",no={zoom:os},ns=()=>{const{zoomLevel:t,setZoomLevel:n}=e.usePreviewStore();return e.jsxRuntimeExports.jsxs("label",{htmlFor:"zoom",className:no.zoom,children:[e.jsxRuntimeExports.jsx("label",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center"},htmlFor:"zoom",children:e.jsxRuntimeExports.jsx(e.Icon,{name:"MagnifyingGlassMinus",width:20,height:20})}),e.jsxRuntimeExports.jsx("input",{id:"zoom",type:"number",min:25,max:250,value:(t*100).toFixed(0),onChange:o=>{const s=Number(o.target.value);n(s/100)},className:no.input}),e.jsxRuntimeExports.jsx("span",{children:"%"})]})},ss=()=>e.jsxRuntimeExports.jsxs("div",{className:qn.settings,children:[e.jsxRuntimeExports.jsx(ts,{}),e.jsxRuntimeExports.jsx(ns,{})]}),rs="_theme_1e5wq_1",is="_text_1e5wq_13",so={theme:rs,text:is},as=()=>e.jsxRuntimeExports.jsx("div",{className:so.theme,children:e.jsxRuntimeExports.jsx("div",{className:so.text,children:"Live Theme"})}),cs=async(t,n,o)=>{const s=localStorage.getItem("shopId")||void 0,i=localStorage.getItem("draftId"),a=`${e.useApiStore.getState().apiUrls.api}/v2/builder/shops/${s}/drafts/${i}/${n}`;return await e.request({url:a,withToken:!0,method:t,body:o})};function tt(t,n){try{return n.map(s=>{if(!s.value||!s.value.blockSettings){console.error("block.value or block.value.blockSettings is undefined.");return}return Object.values(s.value.blockSettings).filter(r=>r&&r.type===t).map(r=>{if(r.value===void 0)throw new Error("item.value is undefined.");return r.value}).flat()}).flat().filter(s=>s).map(s=>t==="ListingIds"?s.listingId:s)}catch(o){return console.error("Error in getValues function:",o),[]}}function ls(t,n,o){return us(t,n)?(o.reviews||[]).length*3:0}function us(t,n){return n.map(s=>{if(!s.value||!s.value.blockSettings){console.error("block.value or block.value.blockSettings is undefined.");return}return Object.values(s.value.blockSettings).filter(r=>r&&r.type===t).map(r=>{if(r.value===void 0)throw new Error("item.value is undefined.");return r.value}).flat()}).flat().filter(s=>s).length>0}function ds(t,n){if(n){const o=Object.keys(n).find(s=>n[s].path===t);if(o)return n[o]}return null}const ps=({setIsLoading:t,isLoading:n})=>{const{themeSettings:o}=e.useThemeSettingsStore(),{settings:s}=e.useSettingsStore(),[i,r]=p.useState(null),[a,c]=p.useState(!1),{setNotifications:u,notifications:h}=e.useNotificationStore(),{header:d,footer:g,announcement:m,blocks:f}=e.useLayersStore(),{pageContext:j}=e.usePagesStore(),{pages:l}=e.usePagesStore(),S=async()=>{if(a)i&&clearTimeout(i);else{t(!0);const C=Object.keys(f).map(_=>{const v=ds(_,l);return f[_]&&f[_].data&&(v!=null&&v.path)?{id:v?v.id:_,name:v?v.name:_,path:v.path,layout:{...f[_]},neededProductIds:[...tt("ProductId",Object.values(f[_].data))],neededCategoryIds:[...tt("CategoryId",Object.values(f[_].data))],neededAnnouncementIds:[...tt("AnnouncementId",Object.values(f[_].data))],neededListingIds:[...tt("ListingIds",Object.values(f[_].data))],neededFaqIds:[...tt("FaqsIds",Object.values(f[_].data))],neededReviewCount:ls("ReviewCount",Object.values(f[_].data),j),seo:{pageTitle:v&&v.seo&&v.seo.pageTitle?v.seo.pageTitle:"",pageDescription:v&&v.seo&&v.seo.pageDescription?v.seo.pageDescription:""},isPrivate:!!(v&&v.visibility==="private")}:null}).filter(_=>_),I={settings:{...s},header:d,footer:g,announcement:m},{status:R}=await cs("post","save",{themeSettings:o,settings:I,updatedPages:C});u([...h,{id:e.v4(),message:R===200?"Settings saved":"Error",status:R===200?"success":"error"}]),t(!1)}c(!0);const x=setTimeout(()=>{c(!1)},2e3);r(x)};return e.jsxRuntimeExports.jsx(e.Button,{onClick:S,disabled:n,children:e.jsxRuntimeExports.jsx("span",{style:{userSelect:"none"},children:"Save"})})},ms=()=>{const{isOpenSelectModal:t}=e.usePagesStore(),[n,o]=p.useState(!1),{showTooltip:s}=e.useTooltipStore();return e.jsxRuntimeExports.jsxs("div",{className:pt.header,style:{zIndex:t?5e4:s?501:50},children:[e.jsxRuntimeExports.jsxs("div",{className:pt.left,children:[e.jsxRuntimeExports.jsx(Dn,{}),e.jsxRuntimeExports.jsx(Wn,{})]}),e.jsxRuntimeExports.jsx("div",{className:pt.center,children:e.jsxRuntimeExports.jsx(ss,{})}),e.jsxRuntimeExports.jsxs("div",{className:pt.right,children:[e.jsxRuntimeExports.jsx(as,{}),e.jsxRuntimeExports.jsx(Bn,{}),e.jsxRuntimeExports.jsx(ps,{setIsLoading:o,isLoading:n}),n&&e.jsxRuntimeExports.jsx($e,{})]})]})},xs="_exit_ovvox_1",hs="_text_ovvox_11",gs="_exitLink_ovvox_16",Tt={exit:xs,text:hs,exitLink:gs},js=()=>e.jsxRuntimeExports.jsx("div",{className:Tt.exit,children:e.jsxRuntimeExports.jsxs("a",{href:"https://dash.billgang.com/",className:Tt.exitLink,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"SignOut",width:20,height:20}),e.jsxRuntimeExports.jsx("span",{className:Tt.text,children:"Exit"})]})}),Is="_navbar_1podc_1",fs="_main_1podc_6",Ss="_block_1podc_13",_s="_active_1podc_29",mt={navbar:Is,main:fs,block:Ss,active:_s},Cs=()=>{const{activeBlock:t}=e.useNavbarStore(),{setActiveBlock:n}=e.useBlocksStore(),{setCurrentBlock:o}=e.useLayersStore(),{setActiveBlock:s}=e.useThemeSettingsStore(),{setActiveBlock:i}=e.usePreviewStore(),r=e.useNavigate();function a(c){switch(n(null),o(null),s(null),i({id:null,neededScroll:!1}),c.name){case"Layers":r("/admin/builder");break;case"Add":r("/admin/builder/add");break;case"Theme":r("/admin/builder/theme");break;case"Settings":r("/admin/builder/settings");break}}return e.jsxRuntimeExports.jsxs("div",{className:mt.navbar,children:[e.jsxRuntimeExports.jsx(js,{}),e.jsxRuntimeExports.jsx("div",{className:mt.main,children:e.navbarBlocks.map(c=>e.jsxRuntimeExports.jsxs("div",{className:e.clx(mt.block,{[mt.active]:t.icon===c.icon}),onClick:()=>a(c),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:c.icon,fill:t.icon===c.icon?"#252525":"#757575"}),e.jsxRuntimeExports.jsx("span",{children:c.name})]},c.icon))})]})},vs="_preview_gb2ye_1",Rs="_main_gb2ye_15",Es="_content_gb2ye_25",ys="_loading_gb2ye_34",bs="_previewLoading_gb2ye_65",ot={preview:vs,main:Rs,content:Es,loading:ys,previewLoading:bs},ws="_header_11zku_2",ks="_circles_11zku_16",Ns="_circle_11zku_16",Ts="_red_11zku_32",Ls="_green_11zku_36",Ps="_yellow_11zku_40",As="_input_11zku_44",Bs="_main_11zku_55",Ms="_text_11zku_63",$s="_copy_11zku_75",Re={header:ws,circles:ks,circle:Ns,red:Ts,green:Ls,yellow:Ps,input:As,main:Bs,text:Ms,copy:$s},Fs=["red","yellow","green"],Ds=()=>{const{currentDevice:t}=e.useDeviceStore(),n=(i,r)=>i.length>r?i.slice(0,r)+"...":i,{notifications:o,setNotifications:s}=e.useNotificationStore();return e.jsxRuntimeExports.jsxs("div",{className:Re.header,children:[e.jsxRuntimeExports.jsx("div",{className:Re.circles,children:Fs.map(i=>e.jsxRuntimeExports.jsx("div",{className:e.clx(Re.circle,{[Re.red]:i==="red",[Re.yellow]:i==="yellow",[Re.green]:i==="green"})},i))}),e.jsxRuntimeExports.jsx("div",{className:Re.input,children:e.jsxRuntimeExports.jsxs("div",{className:Re.main,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Lock",fill:"#757575",width:15,height:16}),e.jsxRuntimeExports.jsx("span",{className:Re.text,children:t.value==="mobile"?n(window.location.origin,35):t.value==="desktop"?n(window.location.origin,200):n(window.location.origin,100)})]})}),e.jsxRuntimeExports.jsx(e.Button,{type:"Secondary",style:{padding:"8px"},onClick:()=>{navigator.clipboard.writeText(window.location.origin),s([...o,{id:e.v4(),status:"success",message:"Domain copied to clipboard"}])},className:Re.copy,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Copy",width:20,height:20,fill:"#252525"})})]})},we=t=>t?t.replace(/_/g," ").split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" and "):"",jo=(t,n,o,s,i,r,a)=>{const c=t.currentTarget.getBoundingClientRect(),u=window.innerHeight-c.bottom,h=c.top,d=window.innerWidth-c.right,g=c.left;let m,f;return m=c.bottom+s+window.scrollY,f=c.left,(u<n||u<i)&&(h>=n+a?m=c.top-n-s+window.scrollY:m=window.scrollY+a),m-window.scrollY<a&&(m=window.scrollY+a),(d<o||d<r)&&(g>=o?f=c.right-o:f=(window.innerWidth-o)/2),f<c.right+r&&(f=c.right+r),f<c.right&&f+o>c.left&&m<c.bottom&&m+n>c.top&&(d>=o+r?f=c.right+s+r:u>=n?m=c.bottom+s+window.scrollY:(m=window.scrollY+a,f=(window.innerWidth-o)/2)),{top:m,left:f}},Hs="_results_1pahy_1",ro={results:Hs};function Os(t,n){return n?new n[t]().blockSettings.isAddable:!1}function io(t,n){return t?Object.keys(t||{}).reduce((o,s)=>(Os(s,n)&&o.push({name:s,displayName:e.getDisplayName(s,n)}),o),[]):[]}const Us="_product_yggw5_1",Ws="_name_yggw5_15",ao={product:Us,name:Ws},Gs=t=>{const{blockId:n,setSearchValue:o}=t,{sourceBlocks:s,setActiveBlock:i}=e.useBlocksStore(),{hideModal:r,hoverBlockId:a,isModalVisible:c,showPreview:u,hidePreview:h,clearHideTimeout:d,startHideTimeout:g,setHoverBlockTopPosition:m}=e.useSubmodalStore();function f(S){o(""),i(S),r("keyBlock")}function j(S,x){const C=window.innerHeight,I=400,R=10;let _=x.clientY-120;_+I>C&&(_=C-I-R),_<R&&(_=R),a||r("keyBlock"),u(S,"keyBlock"),d(),m(_)}function l(){c?g("keyBlock"):h("keyBlock"),m(null)}return e.jsxRuntimeExports.jsxs("div",{className:ao.product,onClick:()=>f(n),onMouseEnter:S=>j(n,S),onMouseLeave:l,children:[at[n]?e.jsxRuntimeExports.jsx("img",{src:at[n]}):e.jsxRuntimeExports.jsx(e.Icon,{name:"Cards"}),e.jsxRuntimeExports.jsx("span",{className:ao.name,children:e.getDisplayName(n,s)}),e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretRight",width:20,height:20})]},n)},Io=()=>{const{blocks:t,sourceBlocks:n}=e.useBlocksStore(),[o,s]=p.useState(""),[i,r]=p.useState([]),a=p.useMemo(()=>io(t,n),[t,n]),c=p.useMemo(()=>new e.Fuse(a,{keys:["displayName"],threshold:.4}),[a]);return p.useEffect(()=>{if(o.trim()==="")r(io(t,n));else{const u=c.search(o);r(u.map(h=>h.item))}},[o,c]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(e.Input,{type:"text",placeholder:"Search for sections",isSearch:!0,onChange:s,value:o,style:{marginBottom:10}}),e.jsxRuntimeExports.jsx("div",{className:ro.results,children:i.length>0?i.map(u=>e.jsxRuntimeExports.jsx(Gs,{blockId:u.name,setSearchValue:s})):e.jsxRuntimeExports.jsx("div",{className:ro.noResults,children:"No sections found"})})]})},qs="_wrapper_1k1cr_1",Vs="_submodal_1k1cr_14",qt={wrapper:qs,submodal:Vs},zs=({children:t,positionTop:n,positionLeft:o})=>{const{keyBlock:s,startHideTimeout:i,clearHideTimeout:r,setMouseOverModal:a}=e.useSubmodalStore();return s?e.jsxRuntimeExports.jsx("div",{className:qt.wrapper,style:n?{top:n,left:o||void 0}:{},onMouseEnter:()=>{r(),a(!0)},onMouseLeave:()=>{a(!1),i()},children:t}):null},Zs=({children:t})=>{const{hoverBlockId:n,startHideTimeout:o,clearHideTimeout:s,setMouseOverModal:i}=e.useSubmodalStore();return n?e.jsxRuntimeExports.jsx("div",{className:e.clx(qt.wrapper,qt.submodal),onMouseEnter:()=>{s(),i(!0)},onMouseLeave:()=>{i(!1),o()},children:t}):null},Xs="_applyButton_1a9kh_2",Ys="_content_1a9kh_7",Ks="_title_1a9kh_14",Js="_label_1a9kh_21",Qs="_colorValue_1a9kh_40",er="_colorMap_1a9kh_48",tr="_indicator_1a9kh_57",or="_hueSlider_1a9kh_66",nr="_slider_1a9kh_97",sr="_buttons_1a9kh_102",rr="_name_1a9kh_109",ir="_secondary_1a9kh_114",ar="_input_1a9kh_122",cr="_modal_1a9kh_160",lr="_alphaSlider_1a9kh_249",ur="_alphaBackground_1a9kh_257",dr="_alphaGradient_1a9kh_268",pr="_chargeTypes_1a9kh_297",mr="_charge_1a9kh_297",xr="_chargeActive_1a9kh_326",hr="_gradient_1a9kh_334",gr="_color_1a9kh_40",jr="_colorActive_1a9kh_355",Ir="_gradientWrapper_1a9kh_362",fr="_subtitle_1a9kh_368",Sr="_colorTypes_1a9kh_375",_r="_colorType_1a9kh_375",Cr="_colorTypeActive_1a9kh_399",vr="_colorsWrapper_1a9kh_404",Rr="_colors_1a9kh_404",P={applyButton:Xs,content:Ys,title:Ks,label:Js,colorValue:Qs,colorMap:er,indicator:tr,hueSlider:or,slider:nr,buttons:sr,name:rr,secondary:ir,input:ar,modal:cr,alphaSlider:lr,alphaBackground:ur,alphaGradient:dr,chargeTypes:pr,charge:mr,chargeActive:xr,gradient:hr,color:gr,colorActive:jr,gradientWrapper:Ir,subtitle:fr,colorTypes:Sr,colorType:_r,colorTypeActive:Cr,colorsWrapper:vr,colors:Rr};function Lt(t){return(t.includes("linear-gradient")||t.includes("radial-gradient"))&&/^linear-gradient\(\d+deg,\s*#[A-Fa-f0-9]{8}\s+\d+%,\s*#[A-Fa-f0-9]{8}\s+\d+%\)$/.test(t)?!0:/^#([A-Fa-f0-9]{3}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$/.test(t)}const he=t=>{const{initialColor:n,onChange:o,title:s,labelStyle:i="primary",isGradientActive:r=!0,isBlockSettings:a}=t,[c,u]=p.useState(n);p.useEffect(()=>{u(n)},[n]);const{setActiveLabel:h,setModalPosition:d,setInitialColor:g,setShowModal:m,setUpdate:f,setColor:j,setColorChange:l,setIsGradientActive:S,colorChange:x}=e.useColorPickerStore();p.useEffect(()=>{const _=()=>{m(!1),h(null),g(n),f(()=>{}),j(n),l(()=>{})};return document.body.addEventListener("click",_),()=>{document.body.removeEventListener("click",_)}},[n]);const C=_=>{_.stopPropagation(),m(!0),l(u),f(o),g(n),j(c),S(r);const{top:v,left:w}=jo(_,600,288,10,20,230,80);d({top:v,left:w})},I=_=>{const v=_.target.value;u(v),Lt(v)&&(o(v),j(v),l(x))},R=()=>{Lt(c)||u(n)};return e.jsxRuntimeExports.jsxs("div",{className:P.content,children:[e.jsxRuntimeExports.jsx("span",{className:e.clx(P.name,{[P.secondary]:i==="secondary"}),children:s}),e.jsxRuntimeExports.jsxs("label",{className:P.label,onClick:_=>_.stopPropagation(),children:[e.jsxRuntimeExports.jsx("div",{className:P.colorValue,style:{background:Lt(c)?c:n},onClick:a?void 0:C}),e.jsxRuntimeExports.jsx("input",{type:"text",value:c.includes("linear-gradient")?c:c.toUpperCase(),onChange:I,onBlur:R,className:P.input,style:{textTransform:c.includes("linear-gradient")?"none":"uppercase"}})]})]})},Er=()=>{const{modalPosition:t,color:n,initialColor:o,setShowModal:s,hue:i,saturation:r,brightness:a,alpha:c,dragging:u,setDragging:h,setHue:d,setSaturation:g,setBrightness:m,setAlpha:f,colorChange:j,setColor:l,update:S,isGradient:x,setIsGradient:C,gradientDirection:I,setGradientDirection:R,hue2:_,saturation2:v,brightness2:w,alpha2:F,setHue2:K,setSaturation2:Z,setBrightness2:M,setAlpha2:b,activeColorIndex:E,setActiveColorIndex:D,isGradientActive:J,isBlockSettings:U}=e.useColorPickerStore(),N=(L,k,V)=>{k/=100,V/=100;const B=ne=>(ne+L/60)%6,H=ne=>V*(1-k*Math.max(0,Math.min(B(ne),4-B(ne),1))),$=Math.round(255*H(5)),G=Math.round(255*H(3)),O=Math.round(255*H(1));return{r:$,g:G,b:O}},A=L=>L.toString(16).padStart(2,"0"),W=(L,k,V,B)=>{const{r:H,g:$,b:G}=N(L,k,V),O=Math.round(B/100*255);return`#${A(H)}${A($)}${A(G)}${A(O)}`},T=(L,k,V,B)=>{if(x)if(E===1){d(L),g(k),m(V),f(B);const H=W(L,k,V,B),$=W(_,v,w,F),O=`linear-gradient(${I==="vertical"?"0deg":"90deg"}, ${H} 0%, ${$} 100%)`;j(O),l(O)}else{K(L),Z(k),M(V),b(B);const H=W(L,k,V,B),$=W(i,r,a,c),O=`linear-gradient(${I==="vertical"?"0deg":"90deg"}, ${$} 0%, ${H} 100%)`;j(O),l(O)}else{const H=W(L,k,V,B);j(H),l(H)}},q=(L,k,V)=>{const{width:B,height:H}=V.getBoundingClientRect(),$=Math.max(0,Math.min(L/B*100,100)),G=Math.max(0,Math.min(100-k/H*100,100));x?E===1?(g($),m(G),T(i,$,G,c)):(Z($),M(G),T(_,$,G,F)):(g($),m(G),T(i,$,G,c))},ke=L=>{const{offsetX:k,offsetY:V}=L.nativeEvent;h(!0),q(k,V,L.currentTarget)},ve=L=>{if(u){const k=document.querySelector(`.${P.colorMap}`),{left:V,top:B}=k.getBoundingClientRect(),H=L.clientX-V,$=L.clientY-B;q(H,$,k)}},z=()=>{h(!1)};p.useEffect(()=>{function L(B){const H=/linear-gradient\((\d+deg),\s*(#[0-9a-fA-F]{8})\s*0%,\s*(#[0-9a-fA-F]{8})\s*100%\)/,$=B.match(H);if($){const G=$[1],O=$[2],ne=$[3];return{angle:G,col1:O,col2:ne}}return null}function k(B){const H=parseInt(B.slice(1,3),16),$=parseInt(B.slice(3,5),16),G=parseInt(B.slice(5,7),16),O=parseInt(B.slice(7,9),16)/255*100,{h:ne,s:Ge,b:yt}=V(H,$,G);return{h:ne,s:Ge,b:yt,a:O}}function V(B,H,$){B/=255,H/=255,$/=255;const G=Math.max(B,H,$),O=Math.min(B,H,$);let ne=0;const Ge=G-O,yt=(G===0?0:Ge/G)*100,ko=G*100;if(G===O)ne=0;else switch(G){case B:ne=((H-$)/Ge+(H<$?6:0))*60;break;case H:ne=(($-B)/Ge+2)*60;break;case $:ne=((B-H)/Ge+4)*60;break}return{h:ne,s:yt,b:ko}}if(o&&o.startsWith("linear-gradient")){const B=L(o);if(B){const{angle:H,col1:$,col2:G}=B,O=k($),ne=k(G);C(!0),R(H==="0deg"?"vertical":"horizontal"),d(O.h),g(O.s),m(O.b),f(O.a),K(ne.h),Z(ne.s),M(ne.b),b(ne.a),D(1)}}else if(o){const H=function(G){let O=G;return O.length===7?O+"ff":O.length===9?O:O.length===4?O[0]+O[1].repeat(2)+O[2].repeat(2)+O[3].repeat(2)+"ff":"#000000ff"}(o),$=k(H);C(!1),d($.h),g($.s),m($.b),f($.a)}},[o,C,R,d,g,m,f,K,Z,M,b,D]),p.useEffect(()=>{let L,k,V,B;x?E===1?(L=i,k=r,V=a,B=c):(L=_,k=v,V=w,B=F):(L=i,k=r,V=a,B=c),T(L,k,V,B)},[x,I,E,i,r,a,c,_,v,w,F]),p.useEffect(()=>{const L=V=>ve(V),k=()=>z();return u?(document.addEventListener("mousemove",L),document.addEventListener("mouseup",k)):(document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",k)),()=>{document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",k)}},[u,x,I]);function ue(){if(!x)S(n);else{const L=W(i,r,a,c),k=W(_,v,w,F),B=`linear-gradient(${I==="vertical"?"0deg":"90deg"}, ${L} 0%, ${k} 100%)`;S(B)}s(!1)}function X(){s(!1),j(o)}const de=x?E===1?i:_:i,Xt=x?E===1?r:v:r,Yt=x?E===1?a:w:a,bo=x?E===1?c:F:c,{r:Kt,g:Jt,b:Qt}=N(de,Xt,Yt),wo=`linear-gradient(to right, rgba(${Kt}, ${Jt}, ${Qt}, 0), rgba(${Kt}, ${Jt}, ${Qt}, 1))`,eo=W(i,r,a,c),to=W(_,v,w,F);return e.jsxRuntimeExports.jsxs("div",{className:P.modal,onClick:L=>L.stopPropagation(),style:{top:`${t.top}px`,left:`${t.left}px`},children:[e.jsxRuntimeExports.jsx("h2",{className:P.title,children:"Color"}),J&&e.jsxRuntimeExports.jsxs("div",{className:P.colorTypes,children:[e.jsxRuntimeExports.jsxs("div",{className:e.clx(P.colorType,{[P.colorTypeActive]:!x}),onClick:()=>C(!1),children:[e.jsxRuntimeExports.jsx("div",{style:{background:"#757575",width:"16px",height:"16px",borderRadius:"50%"}}),"Solid"]}),e.jsxRuntimeExports.jsxs("div",{className:e.clx(P.colorType,{[P.colorTypeActive]:x}),onClick:()=>C(!0),children:[e.jsxRuntimeExports.jsx("div",{style:{background:"linear-gradient(to bottom, #757575 0%, #DBDBDB 100%)",width:"16px",height:"16px",borderRadius:"50%"}}),"Linear"]})]}),x&&J&&e.jsxRuntimeExports.jsxs("div",{className:P.colorsWrapper,children:[e.jsxRuntimeExports.jsx("div",{className:P.colors,style:{background:`linear-gradient(90deg, ${eo} 0%, ${to} 100%)`}}),e.jsxRuntimeExports.jsx("div",{className:e.clx(P.color,{[P.colorActive]:E===1}),onClick:()=>D(1),style:{background:eo}}),e.jsxRuntimeExports.jsx("div",{className:e.clx(P.color,{[P.colorActive]:E===2}),onClick:()=>D(2),style:{background:to}})]}),e.jsxRuntimeExports.jsx("div",{className:P.colorMap,onMouseDown:ke,style:{background:`
|
|
102
102
|
linear-gradient(to top, black, transparent),
|
|
103
103
|
linear-gradient(to right, hsl(${de}, 100%, 100%), hsl(${de}, 100%, 50%))
|
|
104
|
-
`},children:e.jsxRuntimeExports.jsx("div",{className:P.indicator,style:{position:"absolute",left:`${Xt}%`,top:`${100-Yt}%`,transform:"translate(-50%, -50%)"}})}),e.jsxRuntimeExports.jsx("div",{className:P.hueSlider,style:{bottom:U?x?"225px":"150px":x?"175px":"100px"},children:e.jsxRuntimeExports.jsx("input",{type:"range",min:"0",max:"360",value:de,onChange:L=>{const k=Number(L.target.value);x?E===1?T(k,r,a,c):T(k,v,w,F):(d(k),T(k,r,a,c))},className:P.slider})}),e.jsxRuntimeExports.jsxs("div",{className:P.alphaSlider,style:{bottom:U?x?"200px":"125px":x?"150px":"75px"},children:[e.jsxRuntimeExports.jsx("div",{className:P.alphaBackground}),e.jsxRuntimeExports.jsx("div",{className:P.alphaGradient,style:{background:wo}}),e.jsxRuntimeExports.jsx("input",{type:"range",min:"0",max:"100",value:bo,onChange:L=>{const k=Number(L.target.value);x?E===1?T(i,r,a,k):T(_,v,w,k):(f(k),T(i,r,a,k))},className:P.slider})]}),x&&J&&e.jsxRuntimeExports.jsxs("div",{className:P.gradientWrapper,children:[e.jsxRuntimeExports.jsx("h3",{className:P.subtitle,children:"Rotation"}),e.jsxRuntimeExports.jsx("div",{className:P.gradient,children:e.jsxRuntimeExports.jsxs("div",{className:P.chargeTypes,children:[e.jsxRuntimeExports.jsxs("div",{className:e.clx(P.charge,{[P.chargeActive]:I==="horizontal"}),onClick:()=>R("horizontal"),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowsHorizontal",width:20,height:20}),"Horizontal"]}),e.jsxRuntimeExports.jsxs("div",{className:e.clx(P.charge,{[P.chargeActive]:I==="vertical"}),onClick:()=>R("vertical"),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowsVertical",width:20,height:20}),"Vertical"]})]})})]}),U&&e.jsxRuntimeExports.jsx(he,{initialColor:n,onChange:L=>l(L),title:"",isBlockSettings:U}),e.jsxRuntimeExports.jsxs("div",{className:P.buttons,children:[e.jsxRuntimeExports.jsx(e.Button,{onClick:X,className:e.clx(P.applyButton,P.cancelButton),type:"Secondary",children:"Cancel"}),e.jsxRuntimeExports.jsx(e.Button,{onClick:ue,className:P.applyButton,children:"Apply"})]})]})},yr=()=>{const{onPreview:t,zoomLevel:n}=e.usePreviewStore(),{keyBlock:o,hoverBlockId:s,isModalVisible:i,hoverBlockTopPosition:r}=e.useSubmodalStore(),{settings:a}=e.useSettingsStore(),{sourceBlocks:c}=e.useBlocksStore(),{pageContext:u}=e.usePagesStore(),{showModal:h}=e.useColorPickerStore(),{currentDevice:d}=e.useDeviceStore(),{isLoadingThemeSettings:g}=e.useThemeSettingsStore(),{isLoadingLayers:m}=e.useLayersStore(),f=I=>I?!c||!c[I]?e.jsxRuntimeExports.jsx(e.ErrorableBlock,{error:`Block "${I}" does not exist in blocks.`}):new c[I]().renderPreview(a,u):e.jsxRuntimeExports.jsx(e.ErrorableBlock,{error:"Block or block.name is undefined."});function j(){if(d.value==="desktop")return n>=1?"100%":`${(n*100).toFixed(2)}%`;{const I=d.value==="tablet"?768:425;return n>=1?`${I}px`:`${(I*n).toFixed(2)}px`}}function l(){switch(d.value){case"desktop":return"100%";case"tablet":return 768;case"mobile":return 425;default:return"100%"}}const{isOpenSelectModal:S}=e.usePagesStore(),x=p.useRef(null),C=I=>{x.current&&(x.current.scrollTop+=I.deltaY)};return e.jsxRuntimeExports.jsxs("div",{className:ot.preview,style:{zIndex:h&&!S?5e3:500},onWheel:I=>{I.stopPropagation(),C(I)},children:[i&&e.jsxRuntimeExports.jsx(Zs,{children:e.jsxRuntimeExports.jsx(Io,{})}),e.jsxRuntimeExports.jsxs(zs,{positionTop:r,positionLeft:!s&&o?void 0:250,children:[!g&&!m&&e.jsxRuntimeExports.jsx(e.RenderBlock,{render:f,block:o},o),(g||!o||m)&&e.jsxRuntimeExports.jsx("div",{className:ot.previewLoading,children:e.jsxRuntimeExports.jsx($e,{})})]}),h&&e.jsxRuntimeExports.jsx(Er,{}),t&&e.jsxRuntimeExports.jsxs("div",{className:ot.main,style:{width:l()},children:[e.jsxRuntimeExports.jsx(Ds,{}),e.jsxRuntimeExports.jsx("div",{style:{borderLeft:j()==="100%"?"none":"var(--default-border)",borderRight:j()==="100%"?"none":"var(--default-border)",width:"100%",display:"flex",flexDirection:"column",alignItems:"center",height:"calc(100vh - 160px)",overflowY:"scroll",overflowX:"hidden"},onScroll:I=>{I.stopPropagation()},onWheel:I=>{I.stopPropagation()},children:!g&&!m?e.jsxRuntimeExports.jsx("div",{className:ot.content,style:{width:j()},children:e.jsxRuntimeExports.jsx(e.PreviewContent,{scrollableRef:x})}):e.jsxRuntimeExports.jsx("div",{className:ot.loading,children:e.jsxRuntimeExports.jsx($e,{})})})]})]})},br="_sidebar_1xtkj_1",wr="_title_1xtkj_11",co={sidebar:br,title:wr},kr="_layers_1jhzw_1",Nr="_wrapper_1jhzw_9",Tr="_draggingWrapper_1jhzw_17",Lr="_block_1jhzw_21",Pr="_dragging_1jhzw_17",Ar="_active_1jhzw_56",Br="_add_1jhzw_63",Mr="_addTop_1jhzw_79",$r="_visible_1jhzw_95",Fr="_button_1jhzw_99",Dr="_nameBlock_1jhzw_158",Hr="_loader_1jhzw_162",Or="_actions_1jhzw_171",Ur="_deleteButton_1jhzw_179",re={layers:kr,wrapper:Nr,draggingWrapper:Tr,block:Lr,dragging:Pr,active:Ar,add:Br,addTop:Mr,visible:$r,button:Fr,nameBlock:Dr,loader:Hr,actions:Or,deleteButton:Ur},Wr="_block_sj4cc_1",Gr="_title_sj4cc_17",qr="_actions_sj4cc_21",Fe={block:Wr,title:Gr,actions:qr},Pt={header:"Header",footer:"Footer",announcement:"Announcement"},At=({id:t})=>{const{setCurrentBlock:n}=e.useLayersStore(),{activeBlock:o}=e.usePreviewStore(),[s,i]=p.useState(!1);function r(a){n(a)}return e.jsxRuntimeExports.jsxs("div",{className:e.clx(Fe.block,{[Fe.active]:o.id===t,[Fe.header]:t==="header",[Fe.footer]:t==="footer",[Fe.announcement]:t==="announcement"}),onClick:()=>r(t),onMouseOver:()=>i(!0),onMouseLeave:()=>i(!1),children:[at[Pt[t]]?e.jsxRuntimeExports.jsx("img",{src:at[Pt[t]],width:20,height:20}):e.jsxRuntimeExports.jsx(e.Icon,{name:"Cards",width:20,height:20}),e.jsxRuntimeExports.jsx("span",{className:Fe.title,children:Pt[t]}),e.jsxRuntimeExports.jsx("div",{className:Fe.actions,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"PushPin",hoverable:!0,width:20,height:20,fill:"#757575"})})]})},Vr=({id:t,name:n,onClick:o,isDragging:s,icon:i})=>{const{activeBlock:r,setActiveBlock:a}=e.usePreviewStore(),{showPreview:c,hidePreview:u,showModal:h,hideModal:d,clearHideTimeout:g,startHideTimeout:m,hoverBlockId:f,isModalVisible:j}=e.useSubmodalStore(),{setPositionBlock:l}=e.useLayersStore(),[S,x]=p.useState(!1),[C,I]=p.useState(!1),[R,_]=p.useState(!1),[v,w]=p.useState(!1),[F,K]=p.useState(null),Z=p.useRef(null),{attributes:M,listeners:b,setNodeRef:E,transform:D,transition:J}=e.useSortable({id:t}),U={transform:e.CSS.Transform.toString(D),transition:J},{setTitle:N,setDescription:A,setOnConfirm:W}=e.useConfirmationModalStore(),{pages:T,currentPage:q}=e.usePagesStore(),{removeBlock:ke}=e.useLayersStore(),ve=X=>{X.stopPropagation(),Z.current&&clearTimeout(Z.current),a({id:t,neededScroll:!0}),j&&d(),c(t),g()},z=(X,de=!0)=>{X.stopPropagation(),u(),h(t),g(),l(t,de)},ue=X=>{X.stopPropagation(),a({id:null,neededScroll:!1}),j?m():u()};return p.useEffect(()=>{_(!1),x(!1),I(!1),w(!1)},[s]),p.useEffect(()=>{j||(I(!1),x(!1))},[j]),e.jsxRuntimeExports.jsxs("div",{ref:E,style:U,className:e.clx(re.wrapper,{[re.draggingWrapper]:s&&r.id===t}),onClick:X=>{X.stopPropagation(),o(t)},onMouseEnter:ve,onMouseLeave:ue,...M,...b,children:[e.jsxRuntimeExports.jsxs("div",{className:e.clx(re.block,{[re.dragging]:s&&r.id===t,[re.active]:!s&&r.id===t}),children:[i?e.jsxRuntimeExports.jsx("img",{src:i,width:20,height:20}):e.jsxRuntimeExports.jsx(e.Icon,{name:"Cards",width:20,height:20}),e.jsxRuntimeExports.jsx("span",{className:re.nameBlock,children:n}),f===t&&!s&&e.jsxRuntimeExports.jsx("div",{className:e.clx(re.addTop,{[re.visible]:C}),onMouseEnter:()=>{I(!0)},onMouseLeave:()=>{I(!1)},children:e.jsxRuntimeExports.jsxs("button",{className:re.button,onClick:X=>z(X,!1),onMouseEnter:()=>{const X=setTimeout(()=>{s||w(!0)},200);K(X)},onMouseLeave:()=>{F&&clearTimeout(F),w(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Plus",fill:"#fff"}),v&&e.jsxRuntimeExports.jsx(Je,{text:"Click to add a section"})]})}),f===t&&!s&&e.jsxRuntimeExports.jsx("div",{className:e.clx(re.add,{[re.visible]:S}),onMouseEnter:()=>{x(!0)},onMouseLeave:()=>{x(!1)},children:e.jsxRuntimeExports.jsxs("button",{className:re.button,onClick:X=>z(X),onMouseEnter:()=>{const X=setTimeout(()=>{s||_(!0)},200);K(X)},onMouseLeave:()=>{F&&clearTimeout(F),_(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Plus",fill:"#fff"}),R&&e.jsxRuntimeExports.jsx(Je,{text:"Click to add a section"})]})})]}),f===t&&!s&&e.jsxRuntimeExports.jsxs("div",{className:re.actions,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20}),e.jsxRuntimeExports.jsx("div",{className:re.deleteButton,onClick:X=>{X.stopPropagation(),N("Remove Block"),A(`Are you sure you want to delete ${n||"this"} block? Once you delete this block, any content visible will also be deleted. This is irreversible.`),W(()=>{T&&ke(T[q].path,t)})},children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Trash",fill:"#C12A2A",hoverable:!0,width:20,height:20})})]})]})},zr=()=>{const{blocks:t,setCurrentBlock:n,currentBlock:o,moveBlock:s,isLoadingLayers:i,announcement:r}=e.useLayersStore(),{currentPage:a,pages:c}=e.usePagesStore(),{setMouseOverModal:u,setHoverBlockId:h}=e.useSubmodalStore(),{sourceBlocks:d}=e.useBlocksStore();function g(x){n(x),u(!1),h(null)}const m=e.useSensors(e.useSensor(e.PointerSensor,{activationConstraint:{distance:5}})),[f,j]=p.useState(!1),l=()=>{j(!0)},S=x=>{j(!1);const{active:C,over:I}=x;if(I&&C.id!==I.id&&c&&c[a]){const R=c[a].path,_=t[R].order,v=_.indexOf(C.id),w=_.indexOf(I.id);v!==-1&&w!==-1&&s(R,v,w)}};return e.jsxRuntimeExports.jsx("div",{className:re.layers,children:i?e.jsxRuntimeExports.jsx("div",{className:re.loader,children:e.jsxRuntimeExports.jsx($e,{})}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[r&&e.jsxRuntimeExports.jsx(At,{id:"announcement"}),e.jsxRuntimeExports.jsx(At,{id:"header"}),!o&&e.jsxRuntimeExports.jsx(e.DndContext,{sensors:m,onDragEnd:S,onDragStart:l,children:c&&c[a]&&t[c[a].path]&&e.jsxRuntimeExports.jsx(e.SortableContext,{items:t[c[a].path].order,strategy:e.verticalListSortingStrategy,children:t[c[a].path].order.map((x,C)=>e.jsxRuntimeExports.jsx(Vr,{id:x,name:e.getDisplayName(t[c[a].path].data[x].name,d),index:C,onClick:g,isDragging:f,icon:at[t[c[a].path].data[x].name]},x))})}),e.jsxRuntimeExports.jsx(At,{id:"footer"})]})})},Zr="_loader_eyvkk_1",Xr={loader:Zr},Yr=()=>{const{isLoadingSettings:t}=e.useSettingsStore();return t?e.jsxRuntimeExports.jsx("div",{className:Xr.loader,children:e.jsxRuntimeExports.jsx($e,{})}):e.jsxRuntimeExports.jsx(Kr,{})},Kr=()=>{const{settings:t}=e.useSettingsStore(),{settings:n,setSettingsInstance:o}=e.useBlocksStore();if(!t)return null;const{setError:s}=e.useErrorStore(),i=new n(t);p.useEffect(()=>{o(i)},[t]);try{return i.renderSettings()}catch(r){throw console.error("Error rendering settings:",r),s({message:"Error rendering settings",failedPageIds:[],failedThemeSettings:!1,failedSettings:!0}),r}},Jr="_theme_a1one_1",Qr="_block_a1one_8",ei="_name_a1one_23",ti="_loader_a1one_27",xt={theme:Jr,block:Qr,name:ei,loader:ti},oi=()=>{const t=e.useNavigate(),{isLoadingThemeSettings:n,setActiveBlock:o}=e.useThemeSettingsStore();function s(i){switch(i==null?void 0:i.name){case"Colors":t("/admin/builder/theme/colors"),o(Se[0]);break;case"Fonts":t("/admin/builder/theme/fonts"),o(Se[1]);break;case"Borders":t("/admin/builder/theme/borders"),o(Se[2]);break;case"Buttons":t("/admin/builder/theme/buttons"),o(Se[3]);break;case"Inputs":t("/admin/builder/theme/inputs"),o(Se[4]);break}}return e.jsxRuntimeExports.jsx("div",{className:xt.theme,children:n?e.jsxRuntimeExports.jsx("div",{className:xt.loader,children:e.jsxRuntimeExports.jsx($e,{})}):Se.map(i=>e.jsxRuntimeExports.jsxs("div",{onClick:()=>s(i),className:e.clx(xt.block),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:i.icon}),e.jsxRuntimeExports.jsx("span",{className:xt.name,children:i.name}),e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretRight"})]},i.icon))})},ni="_render_7e826_9",si="_open_7e826_24",ri="_close_7e826_51",ii="_clicked_7e826_55",ai="_loading_7e826_72",ci="_settings_7e826_76",qe={render:ni,open:si,close:ri,clicked:ii,loading:ai,settings:ci},li=({block:t})=>{const{pageContext:n}=e.usePagesStore(),{setError:o}=e.useErrorStore();try{return t.renderSettings(n)}catch(s){throw console.error("Error rendering settings:",s),o({message:"Error rendering block settings",failedPageIds:[],failedThemeSettings:!1,failedSettings:!0}),s}},ui="_wrapper_15ju8_1",di="_header_15ju8_8",pi="_title_15ju8_15",mi="_colorWrapper_15ju8_21",xi="_name_15ju8_35",hi="_color_15ju8_21",gi="_value_15ju8_47",ji="_length_15ju8_51",xe={wrapper:ui,header:di,title:pi,colorWrapper:mi,name:xi,color:hi,value:gi,length:ji},Ii=t=>{const{colors:n}=t,{themeSettings:o}=e.useThemeSettingsStore(),[s,i]=p.useState(!0);p.useEffect(()=>{n.length<=3&&i(!0)},[]);function r(a){const c=a.replace("--",""),[u,h]=c.split("-"),d=`${h.charAt(0).toUpperCase()+h.slice(1)} ${u.charAt(0).toUpperCase()+u.slice(1)}`,[g,m]=c.split("-");return{name:d,field:g,variable:m}}return e.jsxRuntimeExports.jsxs("div",{className:xe.wrapper,children:[e.jsxRuntimeExports.jsxs("div",{className:xe.header,children:[e.jsxRuntimeExports.jsx("div",{className:xe.title,children:"Section Colors"}),!s&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(xe.value,xe.length),onClick:()=>i(!0),children:["+",n.length]})]}),s&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:xe.colors,children:n.map(a=>{const c=r(a),{variable:u,name:h,field:d}=c;return e.jsxRuntimeExports.jsx(fi,{color:o.colors[d][u],name:h})})}),n.length>3&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(xe.value,xe.length),onClick:()=>i(!1),children:["Hide ",n.length," colors"]})]})]})},fi=t=>{const{name:n,color:o}=t,{setActiveLabel:s,setModalPosition:i,setInitialColor:r,setShowModal:a,setUpdate:c,setColor:u,setColorChange:h,colorChange:d,setIsGradientActive:g,setIsBlockSettings:m}=e.useColorPickerStore(),{updateColor:f}=e.useThemeSettingsStore(),j=(x,C)=>I=>{f(x,C,I)};p.useEffect(()=>{const x=()=>{a(!1),s(null),r(o),c(()=>{}),u(o),h(()=>{})};return document.body.addEventListener("click",x),()=>{document.body.removeEventListener("click",x)}},[]);const l=x=>{const C=n.split("/")[0],I=C.split(" ")[0].toLowerCase(),R=C.split(" ")[1].toLowerCase();x.stopPropagation(),a(!0),h(d),c(w=>j(R,I)(w)),r(o),u(o),m(!0),g(R==="surface");const{top:_,left:v}=jo(x,550,288,10,20,230,80);i({top:R==="surface"?_:_+125,left:v-200})};function S(x){return x.length>15?x.slice(0,15)+"...":x}return e.jsxRuntimeExports.jsxs("div",{className:xe.colorWrapper,onClick:l,children:[e.jsxRuntimeExports.jsx("div",{className:xe.color,style:{background:o}}),e.jsxRuntimeExports.jsx("div",{className:xe.name,children:n}),e.jsxRuntimeExports.jsx("div",{className:xe.value,children:S(o)})]})},Si="_back_1sznl_1",_i="_title_1sznl_9",Ci="_deleteButton_1sznl_17",vi="_backIcon_1sznl_30",ht={back:Si,title:_i,deleteButton:Ci,backIcon:vi},Ri=({onClick:t,setIsClicked:n,getDisplayName:o})=>{var m,f;const{activeBlock:s}=e.useBlocksStore(),{setTitle:i,setDescription:r,setOnConfirm:a}=e.useConfirmationModalStore(),{blocks:c,currentBlock:u,removeBlock:h}=e.useLayersStore(),{currentPage:d,pages:g}=e.usePagesStore();return e.jsxRuntimeExports.jsxs("div",{className:ht.back,children:[e.jsxRuntimeExports.jsx("div",{className:ht.backIcon,onClick:()=>t(),children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretLeft",hoverable:!0,width:20,height:20})}),e.jsxRuntimeExports.jsx("h3",{className:ht.title,children:s&&o(s)||g&&g[d]&&c[g[d].path]&&u&&o((m=c[g[d].path].data[u])==null?void 0:m.name)||u&&we(u)||"Loading"}),u&&g&&!["header","footer","announcement"].includes(u)&&c[g[d].path].data[u]&&o((f=c[g[d].path].data[u])==null?void 0:f.name)!=="unknown name"&&e.jsxRuntimeExports.jsx("button",{onClick:j=>{var l;j.stopPropagation(),i("Remove Block"),r(`Are you sure you want to delete ${o((l=c[g[d].path].data[u])==null?void 0:l.name)||"this"} block? Once you delete this block, any content visible will also be deleted. This is irreversible.`),a(()=>{n(!0),h(g[d].path,u),t(!0)})},className:ht.deleteButton,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A"})})]})},Ei=()=>{const t=e.useNavigate(),[n,o]=p.useState(!1),{header:s,footer:i,announcement:r,sourceBlocks:a,activeBlock:c,setActiveBlock:u,currentInstance:h,setCurrentInstance:d}=e.useBlocksStore(),{setActiveBlock:g}=e.usePreviewStore(),{blocks:m,addBlock:f,editBlock:j,currentBlock:l,setCurrentBlock:S,header:x,footer:C,announcement:I,isLoadingLayers:R}=e.useLayersStore(),{currentPage:_,pages:v}=e.usePagesStore(),{past:w,future:F}=e.useHistoryStore();function K(b=!1){if(v&&h&&l&&!["header","footer","announcement"].includes(l)&&!b){const E={blockSettings:{}};Object.keys(h.blockSettings).filter(D=>!["displayName","isAddable"].includes(D)).map(D=>{E.blockSettings[D]=h.blockSettings[D]}),j(v[_].path,l,{name:m[v[_].path].data[l].name,value:E})}u(null),S(null),g({id:null,neededScroll:!1}),setTimeout(()=>{o(!1)},150),d(null)}function Z(b){var U;if(!v||!_||!b)return null;if(b==="header"){const N=new s;return Object.keys(N.blockSettings).forEach(A=>{N.blockSettings[A]=x==null?void 0:x.blockSettings[A]}),Object.keys(N.blockColors).forEach(A=>{N.blockColors[A]=x==null?void 0:x.blockColors[A]}),N}if(b==="footer"){const N=new i;return Object.keys(N.blockSettings).forEach(A=>{N.blockSettings[A]=C==null?void 0:C.blockSettings[A]}),Object.keys(N.blockColors).forEach(A=>{N.blockColors[A]=C==null?void 0:C.blockColors[A]}),N}if(b==="announcement"){const N=new r;return Object.keys(N.blockSettings).forEach(A=>{N.blockSettings[A]=I==null?void 0:I.blockSettings[A]}),Object.keys(N.blockColors).forEach(A=>{N.blockColors[A]=I==null?void 0:I.blockColors[A]}),N}const E=m[v[_].path];if(!E||!E.data[b])return null;const D=E.data[b];return!D||!a[D.name]?null:new a[D.name]((U=D.value)==null?void 0:U.blockSettings)}p.useEffect(()=>{if(l){const b=Z(l);d(b)}else d(null)},[l,w,F,c]),p.useEffect(()=>{if(c&&v&&!l){const b={blockSettings:{},blockColors:{}},E=new a[c];d(E),Object.keys(E.blockSettings).filter(J=>!["displayName","isAddable"].includes(J)).map(J=>{b.blockSettings[J]=E.blockSettings[J]}),Object.keys(E.blockColors).filter(J=>!["displayName","isAddable"].includes(J)).map(J=>{b.blockColors[J]=E.blockColors[J]});const D=f(v[_].path,{name:c,value:b});g({id:D,neededScroll:!0}),S(D),t("/admin/builder")}},[c,w,F]);function M(b){if(!a)return"unknown name";if(!a[b])return l==="header"?x==null?void 0:x.blockSettings.displayName:l==="footer"?C==null?void 0:C.blockSettings.displayName:l==="announcement"?I==null?void 0:I.blockSettings.displayName:"unknown name";const E=new a[b];return!E.blockSettings||!E.blockSettings.displayName?"unknown name":E.blockSettings.displayName}return e.jsxRuntimeExports.jsxs("div",{className:e.clx(qe.render,{[qe.open]:l,[qe.close]:!l,[qe.clicked]:n}),onClick:b=>b.stopPropagation(),style:{opacity:R?0:1},children:[e.jsxRuntimeExports.jsx(Ri,{onClick:K,setIsClicked:o,getDisplayName:M}),e.jsxRuntimeExports.jsxs("div",{className:qe.settings,children:[h&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(li,{block:h}),e.jsxRuntimeExports.jsx(Ii,{colors:h.blockColors})]}),!c&&!l&&e.jsxRuntimeExports.jsx("div",{className:qe.loading,children:"Loading"})]})]})},yi="_header_9rrfr_1",bi="_title_9rrfr_9",wi="_backIcon_9rrfr_15",Bt={header:yi,title:bi,backIcon:wi},ct=({onClick:t,title:n})=>e.jsxRuntimeExports.jsxs("div",{className:Bt.header,children:[e.jsxRuntimeExports.jsx("div",{className:Bt.backIcon,onClick:t,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretLeft",hoverable:!0,width:20,height:20})}),e.jsxRuntimeExports.jsx("span",{className:Bt.title,children:n})]}),ki="_options_ymds7_1",Ni={options:ki},Ti="_wrapper_kzokw_1",Li="_open_kzokw_16",Pi="_close_kzokw_20",Mt={wrapper:Ti,open:Li,close:Pi},lt=t=>{const{isOpen:n,isClose:o,children:s}=t;return e.jsxRuntimeExports.jsx("div",{className:e.clx(Mt.wrapper,{[Mt.open]:n,[Mt.close]:o}),children:s})},Ai=()=>{var h,d;const{activeBlock:t,themeSettings:n,updateBorder:o,setActiveBlock:s}=e.useThemeSettingsStore();function i(g,m){o(m,g)}const r=e.useNavigate();function a(){s(null),r("/admin/builder/theme")}const c=p.useMemo(()=>n.borders,[n]),u=(t==null?void 0:t.name)==="Borders";return e.jsxRuntimeExports.jsxs(lt,{isOpen:u,isClose:!u,children:[e.jsxRuntimeExports.jsx(ct,{onClick:a,title:"Borders Style"}),e.jsxRuntimeExports.jsxs("div",{className:Ni.options,children:[e.jsxRuntimeExports.jsx(e.Select,{label:"Border Radius (px)",options:Object.keys(bt),value:((h=Object.entries(bt).find(([g,m])=>m===c.radius))==null?void 0:h[0])||"None",onChange:g=>i(bt[g],"radius")}),e.jsxRuntimeExports.jsx(e.Select,{label:"Border Thickness (px)",options:Object.keys(wt),value:((d=Object.entries(wt).find(([g,m])=>m===c.thickness))==null?void 0:d[0])||"None",onChange:g=>i(wt[g],"thickness")})]})]})},Bi="_options_jo38w_1",Mi="_alignments_jo38w_9",$i="_blocks_jo38w_15",Fi="_alignment_jo38w_9",Di="_active_jo38w_34",Hi="_chargeTypes_jo38w_41",Oi="_charge_jo38w_41",Ui="_chargeActive_jo38w_69",Wi="_sliderContainer_jo38w_83",Gi="_shadowInputs_jo38w_91",qi="_label_jo38w_102",Vi="_shadowInputsRow_jo38w_111",zi="_shadowInputsOpen_jo38w_119",ie={options:Bi,alignments:Mi,blocks:$i,alignment:Fi,active:Di,chargeTypes:Hi,charge:Oi,chargeActive:Ui,sliderContainer:Wi,shadowInputs:Gi,label:qi,shadowInputsRow:Vi,shadowInputsOpen:zi},Zi=["left","center","right"],Xi=()=>{const{activeBlock:t,themeSettings:n,updateButton:o,setActiveBlock:s}=e.useThemeSettingsStore(),{fonts:i}=e.useFontsStore(),[r,a]=p.useState("primary");function c(l,S){o(r,S,l)}const[u,h]=p.useState(!1),d=n.buttons[r],g=e.useNavigate();function m(){s(null),g("/admin/builder/theme")}const f=(t==null?void 0:t.name)==="Buttons";function j(l,S){c({...d.boxShadow,[l]:S},"boxShadow")}return e.jsxRuntimeExports.jsxs(lt,{isOpen:f,isClose:!f,children:[e.jsxRuntimeExports.jsx(ct,{onClick:m,title:"Buttons Style"}),e.jsxRuntimeExports.jsx("div",{className:ie.chargeTypes,style:{marginBottom:"10px"},children:["primary","secondary","tertiary"].map(l=>e.jsxRuntimeExports.jsx("div",{className:e.clx(ie.charge,{[ie.chargeActive]:r===l}),onClick:()=>a(l),children:l.charAt(0).toUpperCase()+l.slice(1)},l))}),d&&e.jsxRuntimeExports.jsxs("div",{className:ie.options,children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Height (px)",value:String(d.height),onChange:l=>c(Number(l),"height"),type:"number",min:0}),e.jsxRuntimeExports.jsx(e.Select,{label:"Font Size (px)",value:String(d.size),onChange:l=>c(Number(l),"size"),options:Rt}),e.jsxRuntimeExports.jsx(e.Input,{label:"Border Radius (px)",value:String(d.radius),onChange:l=>c(Number(l),"radius"),type:"number",min:0}),e.jsxRuntimeExports.jsx(e.Select,{label:"Font",value:d.font,onChange:l=>c(l,"font"),options:[...i.filter(l=>l.name!==d.font).map(l=>l.name)]}),e.jsxRuntimeExports.jsx(he,{initialColor:d.color,onChange:l=>c(l,"color"),title:"Text Color",labelStyle:"secondary",isGradientActive:!1}),e.jsxRuntimeExports.jsx(he,{initialColor:d.background,onChange:l=>c(l,"background"),title:"Background Color",labelStyle:"secondary",isGradientActive:!0}),e.jsxRuntimeExports.jsxs("div",{className:ie.sliderContainer,children:[e.jsxRuntimeExports.jsx("h4",{className:ie.label,children:"Shadow"}),e.jsxRuntimeExports.jsx(e.Button,{type:"Secondary",onClick:()=>h(!u),style:{padding:5,display:"flex"},children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretUp",style:{rotate:u?"0deg":"-180deg",transition:"0.3s rotate ease"}})})]}),e.jsxRuntimeExports.jsxs("div",{className:e.clx(ie.shadowInputs,{[ie.shadowInputsOpen]:u}),children:[e.jsxRuntimeExports.jsxs("div",{className:ie.shadowInputsRow,children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Left (px)",value:String(d.boxShadow.left),onChange:l=>j("left",Number(l)),type:"number"}),e.jsxRuntimeExports.jsx(e.Input,{label:"Top (px)",value:String(d.boxShadow.top),onChange:l=>j("top",Number(l)),type:"number"}),e.jsxRuntimeExports.jsx(e.Input,{label:"Blur (px)",value:String(d.boxShadow.blur),onChange:l=>j("blur",Number(l)),type:"number"}),e.jsxRuntimeExports.jsx("div",{style:{flex:1,whiteSpace:"nowrap"},children:e.jsxRuntimeExports.jsx(e.Input,{label:"Spread (px)",value:String(d.boxShadow.spread),onChange:l=>j("spread",Number(l)),type:"number"})})]}),e.jsxRuntimeExports.jsx(he,{initialColor:d.boxShadow.color,onChange:l=>j("color",l),title:"Color",labelStyle:"secondary",isGradientActive:!1})]}),e.jsxRuntimeExports.jsxs("div",{className:ie.alignments,children:[e.jsxRuntimeExports.jsx("h4",{className:ie.label,children:"Alignment Type"}),e.jsxRuntimeExports.jsx("div",{className:ie.blocks,children:Zi.map(l=>e.jsxRuntimeExports.jsx("div",{className:e.clx(ie.alignment,{[ie.active]:d.alignment===l}),onClick:()=>{c(l,"alignment")},children:e.jsxRuntimeExports.jsx(e.Icon,{name:l==="center"?"AlignCenterHorizontal":l==="left"?"AlignLeft":"AlignRight",fill:d.alignment===l?"#252525":"#757575"})},l))})]}),e.jsxRuntimeExports.jsx(e.Switch,{label:"Enable Hover",onChange:l=>c(l,"hover"),current:d.hover}),d.hover&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(he,{initialColor:d.colorHover,onChange:l=>c(l,"colorHover"),title:"Hover Text Color",labelStyle:"secondary",isGradientActive:!1}),e.jsxRuntimeExports.jsx(he,{initialColor:d.backgroundHover,onChange:l=>c(l,"backgroundHover"),title:"Hover Background Color",labelStyle:"secondary",isGradientActive:!0})]})]})]})},Yi="_category_hxy9u_1",Ki="_categoryTitle_hxy9u_19",$t={category:Yi,categoryTitle:Ki},Ji=()=>{const{themeSettings:t,setActiveColorCategory:n}=e.useThemeSettingsStore();function o(s){n(s)}return e.jsxRuntimeExports.jsx("div",{className:$t.wrapper,children:Object.keys(t.colors).map(s=>s==="icon"?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}):e.jsxRuntimeExports.jsxs("div",{className:$t.category,onClick:()=>o(s),children:[e.jsxRuntimeExports.jsxs("h2",{className:$t.categoryTitle,children:[s==="text"?"Text & Icon":we(s)," Colors"]}),e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretRight",width:24,height:24})]},s))})},Qi="_options_ikvjo_38",ea={options:Qi},ta=()=>{const{activeBlock:t,setActiveFont:n,activeFont:o,themeSettings:s,updateFont:i}=e.useThemeSettingsStore(),{fonts:r}=e.useFontsStore(),[a,c]=p.useState(null);function u(){n(null)}function h(l,S){a&&o&&i("desktop",a,o,S,l)}const[d,g]=p.useState([]),m=p.useMemo(()=>o?s.fonts.desktop.heading[o]?(c("heading"),s.fonts.desktop.heading[o]):s.fonts.desktop.body[o]?(c("body"),s.fonts.desktop.body[o]):(c(null),null):null,[o,s]);p.useEffect(()=>{if(m){const l=r.find(S=>S.name===m.font);l&&(g(l.weights),l.weights.includes(m.boldWeight)||h("400","boldWeight"),l.weights.includes(m.weight)||h("400","weight"))}},[m,o]);const f=!!((t==null?void 0:t.name)==="Fonts"&&o),j=(t==null?void 0:t.name)!=="Fonts"||!o;return e.jsxRuntimeExports.jsxs(lt,{isOpen:f,isClose:j,children:[e.jsxRuntimeExports.jsx(ct,{onClick:u,title:"Font Style"}),o&&m&&e.jsxRuntimeExports.jsxs("div",{className:ea.options,children:[e.jsxRuntimeExports.jsx(e.Select,{label:"Font",value:m.font,onChange:l=>h(l,"font"),options:[...r.filter(l=>l.name!==m.font).map(l=>l.name)]}),e.jsxRuntimeExports.jsx(e.Select,{label:"Size",value:String(m.size),onChange:l=>h(l,"size"),options:Rt}),e.jsxRuntimeExports.jsx(e.Select,{label:"Default Weight",value:String(m.weight),onChange:l=>h(l,"weight"),options:d}),e.jsxRuntimeExports.jsx(e.Select,{label:"Bold Weight",value:String(m.boldWeight),onChange:l=>h(l,"boldWeight"),options:d}),e.jsxRuntimeExports.jsx(e.Select,{label:"Case",value:String(m.case).charAt(0).toUpperCase()+String(m.case).slice(1),onChange:l=>h(l.toLowerCase(),"case"),options:["Normal","Uppercase","Lowercase","Capitalize"].filter(l=>l.toLowerCase()!==String(m.case))})]})]})},oa="_wrapper_mkmxa_1",na="_category_mkmxa_5",sa="_categoryTitle_mkmxa_11",ra="_font_mkmxa_17",ia="_content_mkmxa_32",aa="_icon_mkmxa_39",ca="_paragraph_mkmxa_50",Le={wrapper:oa,category:na,categoryTitle:sa,font:ra,content:ia,icon:aa,paragraph:ca},la={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",h7:"h7",lg:"large",md:"medium",sm:"small"},ua=t=>{const{font:n,size:o,id:s,category:i}=t,{setActiveFont:r}=e.useThemeSettingsStore();return e.jsxRuntimeExports.jsxs("div",{className:Le.font,onClick:()=>r(s),children:[e.jsxRuntimeExports.jsx("div",{className:e.clx(Le.icon,{[Le.paragraph]:i==="paragraph"}),children:e.jsxRuntimeExports.jsx(e.Icon,{name:i==="paragraph"?"TextB":"TextH"})}),e.jsxRuntimeExports.jsxs("div",{className:Le.content,children:[e.jsxRuntimeExports.jsx("h2",{className:Le.categoryTitle,children:we(la[s])}),e.jsxRuntimeExports.jsx("span",{className:Le.value,children:`${n}, ${o}px`})]})]})},da=()=>{const{themeSettings:t,setActiveFont:n,activeBlock:o}=e.useThemeSettingsStore();p.useEffect(()=>(s(),()=>{s()}),[]);function s(){n(null)}if(o!=null&&o.name)return e.jsxRuntimeExports.jsx("div",{className:Le.wrapper,children:Object.entries(t.fonts.desktop).sort(([i],[r])=>i==="heading"?-1:r==="heading"?1:0).map(([i,r])=>e.jsxRuntimeExports.jsxs("div",{className:Le.category,children:[e.jsxRuntimeExports.jsx("h2",{className:Le.categoryTitle,children:we(i)}),Object.entries(r).map(([a,c])=>e.jsxRuntimeExports.jsx(ua,{id:a,category:i,...c},a))]},i))})},pa="_wrapper_16ym0_2",ma="_categoryTitle_16ym0_12",xa="_title_16ym0_74",ha="_field_16ym0_82",ga="_alignments_16ym0_92",ja="_lineField_16ym0_98",Ia="_style_16ym0_106",fa="_header_16ym0_113",fe={wrapper:pa,categoryTitle:ma,title:xa,field:ha,alignments:ga,lineField:ja,style:Ia,header:fa},Sa="_blocks_emecf_1",_a="_block_emecf_1",Ca="_active_emecf_21",Ft={blocks:Sa,block:_a,active:Ca},lo=t=>{const{items:n,selectedItem:o,onSelect:s,getIconName:i}=t;return e.jsxRuntimeExports.jsx("div",{className:Ft.blocks,children:n.map(r=>e.jsxRuntimeExports.jsx("div",{className:e.clx(Ft.block,{[Ft.active]:o===r}),onClick:()=>s(r),children:e.jsxRuntimeExports.jsx(e.Icon,{name:i(r),fill:o===r?"#252525":"#757575"})},String(r)))})},va=["left","center","right"],Ra=["solid","dashed"],nt=t=>{const{title:n,children:o,rightAddon:s}=t;return e.jsxRuntimeExports.jsxs("div",{className:fe.field,children:[e.jsxRuntimeExports.jsxs("div",{className:fe.header,children:[e.jsxRuntimeExports.jsx("h4",{className:fe.categoryTitle,children:n}),s]}),o]})},Ea=()=>{const{themeSettings:t,updateInput:n}=e.useThemeSettingsStore(),o=p.useMemo(()=>t.inputs,[t]),s=(r,a,c)=>{n(r,a,c)},i=r=>a=>{n(r,a,"color")};return e.jsxRuntimeExports.jsxs("div",{className:fe.wrapper,children:[e.jsxRuntimeExports.jsxs(nt,{title:"General",children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Height (px)",value:String(o.general.height),onChange:r=>s("general",r,"height"),type:"number",min:0}),e.jsxRuntimeExports.jsx(e.Select,{label:"Font Size (px)",onChange:r=>s("general",r,"size"),value:String(o.general.size),options:Rt}),e.jsxRuntimeExports.jsx(he,{initialColor:we(o.general.color),onChange:i("general"),title:"Font Color",labelStyle:"secondary",isGradientActive:!1})]}),e.jsxRuntimeExports.jsx(nt,{title:"Field Fill",rightAddon:e.jsxRuntimeExports.jsx("div",{className:fe.switch,children:e.jsxRuntimeExports.jsx(e.Switch,{onChange:r=>s("field",r,"active"),current:o.field.active})}),children:e.jsxRuntimeExports.jsx(he,{initialColor:o.field.color,onChange:i("field"),title:"Color",labelStyle:"secondary"})}),e.jsxRuntimeExports.jsx(nt,{title:"Placeholder",children:e.jsxRuntimeExports.jsx(he,{initialColor:we(o.placeholder.color),onChange:i("placeholder"),title:"Font Color",labelStyle:"secondary",isGradientActive:!1})}),e.jsxRuntimeExports.jsxs(nt,{title:"Border",rightAddon:e.jsxRuntimeExports.jsx("div",{className:fe.switch,children:e.jsxRuntimeExports.jsx(e.Switch,{onChange:r=>s("border",r,"active"),current:o.border.active})}),children:[e.jsxRuntimeExports.jsxs("div",{className:fe.lineField,children:[e.jsxRuntimeExports.jsxs("div",{className:fe.style,children:[e.jsxRuntimeExports.jsx("span",{className:fe.title,children:"Style"}),e.jsxRuntimeExports.jsx(lo,{items:Ra,selectedItem:o.border.style,onSelect:r=>s("border",r,"style"),getIconName:r=>r==="solid"?"Minus":"Selection"})]}),e.jsxRuntimeExports.jsx(e.Input,{label:"Radius (px)",value:String(o.border.radius),onChange:r=>s("border",r,"radius"),type:"number",min:0})]}),e.jsxRuntimeExports.jsx(e.Input,{label:"Thickness (px)",value:String(o.border.thickness),onChange:r=>s("border",r,"thickness"),type:"number",min:0}),e.jsxRuntimeExports.jsx(he,{initialColor:we(o.border.color),onChange:i("border"),title:"Color",labelStyle:"secondary",isGradientActive:!1})]}),e.jsxRuntimeExports.jsxs(nt,{title:"Label",children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Line Height (px)",value:String(o.label.height),onChange:r=>s("label",r,"height"),type:"number",min:0}),e.jsxRuntimeExports.jsx(e.Select,{label:"Font Size (px)",onChange:r=>s("label",r,"size"),value:String(o.label.size),options:Rt}),e.jsxRuntimeExports.jsx(he,{initialColor:we(o.label.color),onChange:i("label"),title:"Color",labelStyle:"secondary",isGradientActive:!1}),e.jsxRuntimeExports.jsxs("div",{className:fe.alignments,children:[e.jsxRuntimeExports.jsx("h4",{className:fe.title,children:"Alignment Type"}),e.jsxRuntimeExports.jsx(lo,{items:va,selectedItem:o.label.alignment,onSelect:r=>s("label",r,"alignment"),getIconName:r=>r==="center"?"AlignCenterHorizontal":r==="left"?"AlignLeft":"AlignRight"})]})]})]})},ya="_wrapper_1yw63_2",ba="_color_1yw63_24",wa="_content_1yw63_33",ka="_preview_1yw63_42",Na="_container_1yw63_52",Ta="_buttonWrapper_1yw63_62",La="_button_1yw63_62",Pa="_buttonBorder_1yw63_80",Aa="_buttonBackground_1yw63_83",Ba="_text_1yw63_87",Ma="_textText_1yw63_93",$a="_icon_1yw63_97",Fa="_iconIcon_1yw63_100",Da="_annotation_1yw63_104",Ha="_annotationText_1yw63_111",Oa="_label_1yw63_116",Ua="_circle_1yw63_127",Wa="_line_1yw63_140",Ga="_circle1_1yw63_154",qa="_circle2_1yw63_159",Va="_annotationIcon_1yw63_164",za="_annotationBorder_1yw63_192",Za="_line1_1yw63_203",Xa="_line2_1yw63_210",Ya="_circle3_1yw63_227",Ka="_circle4_1yw63_232",Ja="_annotationSurface_1yw63_237",y={wrapper:ya,color:ba,content:wa,preview:ka,container:Na,buttonWrapper:Ta,button:La,buttonBorder:Pa,buttonBackground:Aa,text:Ba,textText:Ma,icon:$a,iconIcon:Fa,annotation:Da,annotationText:Ha,label:Oa,circle:Ua,line:Wa,circle1:Ga,circle2:qa,annotationIcon:Va,annotationBorder:za,line1:Za,line2:Xa,circle3:Ya,circle4:Ka,annotationSurface:Ja},Qa=()=>{const{activeColorCategory:t}=e.useThemeSettingsStore();return e.jsxRuntimeExports.jsx("div",{className:y.container,children:e.jsxRuntimeExports.jsxs("div",{className:y.buttonWrapper,children:[e.jsxRuntimeExports.jsxs("div",{className:e.clx(y.button,{[y.buttonBorder]:t==="border",[y.buttonBackground]:t==="surface"}),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Smiley",className:e.clx(y.icon,{[y.iconIcon]:t==="text"}),width:22,height:22,fill:"#757575"}),e.jsxRuntimeExports.jsx("span",{className:e.clx(y.text,{[y.textText]:t==="text"}),children:"Button Example"})]}),t==="text"&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(y.annotation,y.annotationText),children:[e.jsxRuntimeExports.jsx("div",{className:y.label,children:"Text Color"}),e.jsxRuntimeExports.jsx("div",{className:y.line}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle1)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle2)})]}),t==="text"&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(y.annotation,y.annotationIcon),children:[e.jsxRuntimeExports.jsx("div",{className:y.label,children:"Icon Color"}),e.jsxRuntimeExports.jsx("div",{className:y.line}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle1)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle2)})]}),t==="border"&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(y.annotation,y.annotationBorder),children:[e.jsxRuntimeExports.jsx("div",{className:y.label,children:"Border Color"}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.line,y.line1)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.line,y.line2)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle1)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle2)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle3)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle4)})]}),t==="surface"&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(y.annotation,y.annotationSurface),children:[e.jsxRuntimeExports.jsx("div",{className:y.label,children:"Surface Color"}),e.jsxRuntimeExports.jsx("div",{className:y.line}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle1)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle2)})]})]})})},ec={text:["primary","secondary","tertiary","inverted","action","action-hover","disabled","warning","error","success","information","link"],border:["primary","secondary","action","actionHover","disabled","warning","error","success","information","focus"],surface:["primary","secondary","action1","action1Hover","action2","action2Hover","disabled","warning","error","success","information","modal"]},tc=()=>{const{activeBlock:t,setActiveColorCategory:n,activeColorCategory:o,themeSettings:s,updateColor:i}=e.useThemeSettingsStore();function r(){n(null)}function a(d,g,m){i(d,g,m)}const c=!!((t==null?void 0:t.name)==="Colors"&&o),u=(t==null?void 0:t.name)!=="Colors"||!o,h=o?ec[o]:[];return e.jsxRuntimeExports.jsxs(lt,{isOpen:c,isClose:u,children:[e.jsxRuntimeExports.jsx(ct,{onClick:r,title:o==="text"?"Text & Icon Colors":`${we(o)} Colors`}),o&&e.jsxRuntimeExports.jsxs("div",{className:y.wrapper,children:[e.jsxRuntimeExports.jsx(Qa,{}),h.map(d=>{const g=s.colors[o][d];return typeof g!="string"?null:e.jsxRuntimeExports.jsx("div",{className:y.color,children:e.jsxRuntimeExports.jsxs("div",{className:y.content,children:[e.jsxRuntimeExports.jsx("div",{className:y.preview,style:{background:g}}),e.jsxRuntimeExports.jsx(he,{title:we(d),initialColor:g,onChange:m=>a(o,d,m),isGradientActive:o==="surface"})]})},d)})]})]})},oc="_loader_1p5lr_1",nc={loader:oc},sc=()=>{const{activeBlock:t,themeSettings:n,isLoadingThemeSettings:o}=e.useThemeSettingsStore();return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:o?e.jsxRuntimeExports.jsx("div",{className:nc.loader,children:e.jsxRuntimeExports.jsx($e,{})}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[(t==null?void 0:t.name)==="Fonts"&&n.fonts&&e.jsxRuntimeExports.jsx(da,{}),(t==null?void 0:t.name)==="Fonts"&&n.fonts&&e.jsxRuntimeExports.jsx(ta,{}),(t==null?void 0:t.name)==="Colors"&&n.colors&&e.jsxRuntimeExports.jsx(Ji,{}),(t==null?void 0:t.name)==="Colors"&&n.colors&&e.jsxRuntimeExports.jsx(tc,{}),(t==null?void 0:t.name)==="Inputs"&&n.inputs&&e.jsxRuntimeExports.jsx(Ea,{}),(t==null?void 0:t.name)==="Borders"&&n.borders&&e.jsxRuntimeExports.jsx(Ai,{}),(t==null?void 0:t.name)==="Buttons"&&n.buttons&&e.jsxRuntimeExports.jsx(Xi,{})]})})},rc=()=>{const{activeBlock:t,setActiveBlock:n}=e.useThemeSettingsStore(),{activeBlock:o}=e.useNavbarStore(),s=e.useNavigate();function i(){n(null),s("/admin/builder/theme")}const r=!!t,a=!t||o.name!=="Theme";return e.jsxRuntimeExports.jsxs(lt,{isOpen:r,isClose:a,children:[e.jsxRuntimeExports.jsx(ct,{onClick:i,title:(t==null?void 0:t.name)||""}),e.jsxRuntimeExports.jsx(sc,{})]})},ic=()=>{const{activeBlock:t}=e.useNavbarStore(),{showTooltip:n}=e.useTooltipStore();function o(){switch(t.name){case"Layers":return"Layers";case"Add":return"Add Sections";case"Theme":return"Theme Settings";case"Settings":return"Settings"}}return e.jsxRuntimeExports.jsxs("div",{className:co.sidebar,style:{zIndex:n?50:"auto"},children:[e.jsxRuntimeExports.jsx("h3",{className:co.title,children:o()}),t.name==="Layers"&&e.jsxRuntimeExports.jsx(zr,{}),t.name==="Add"&&e.jsxRuntimeExports.jsx(Io,{}),e.jsxRuntimeExports.jsx(Ei,{}),e.jsxRuntimeExports.jsx(rc,{}),t.name==="Theme"&&e.jsxRuntimeExports.jsx(oi,{}),t.name==="Settings"&&e.jsxRuntimeExports.jsx(Yr,{})]})},ac="_wrapper_no6if_1",cc="_header_no6if_12",lc="_content_no6if_23",uc="_buttons_no6if_44",dc="_label_no6if_51",pc="_description_no6if_52",mc="_preview_no6if_60",xc="_block_no6if_66",hc="_slug_no6if_75",gc="_title_no6if_81",jc="_closeIcon_no6if_87",je={wrapper:ac,header:cc,content:lc,buttons:uc,label:dc,description:pc,preview:mc,block:xc,slug:hc,title:gc,closeIcon:jc},Ic=()=>{var K,Z,M,b,E,D,J;const{setIsOpenModal:t,pages:n,createPage:o,updatePage:s,isEdit:i,setIsEdit:r,editedPage:a,setEditedPage:c,pageContext:u}=e.usePagesStore(),{setIsOpen:h}=e.useModalStore(),{createPage:d,updatePage:g}=e.useLayersStore(),[m,f]=p.useState(a?n&&((K=n[a])==null?void 0:K.path):""),[j,l]=p.useState(a?n&&((Z=n[a])==null?void 0:Z.name):""),[S,x]=p.useState(a?n&&((M=n[a])==null?void 0:M.seo)&&((E=(b=n[a])==null?void 0:b.seo)==null?void 0:E.pageDescription)||"":`${u.general.info.name} is powered by the Billgang.com platform which allows them to sell their digital products online for free.`),[C,I]=p.useState(a&&n&&(D=n[a])!=null&&D.isPrivate?"private":"public");function R(){f(""),l(""),x(""),I("public"),r(!1),c(null)}function _(){h(!1),setTimeout(()=>{R(),t(!1),h(!0)},300)}p.useEffect(()=>()=>{_()},[]);function v(U){return U[0]==="/"?U:"/"+U}function w(){o({path:v(m),name:j||m||"",icon:"File",seo:{pageTitle:j||"",pageDescription:S||""},visibility:C||"public"}),d(v(m)),_()}function F(){n&&(e.defaultPagePaths.includes(n[a].path)||go(n[a].path),g(n[a].path||"",m||""),s(a,{path:v(m),name:j||m,icon:n[a].icon||"File",seo:{pageTitle:j||"",pageDescription:S||""},visibility:C||"public"})),_()}return e.jsxRuntimeExports.jsxs("div",{className:je.wrapper,onClick:U=>U.stopPropagation(),children:[e.jsxRuntimeExports.jsxs("div",{className:je.header,children:[e.jsxRuntimeExports.jsx("h2",{children:i?"Edit Page":"Create New Page"}),e.jsxRuntimeExports.jsx("div",{className:je.closeIcon,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"X",fill:"#757575",hoverable:!0,onClick:_})})]}),e.jsxRuntimeExports.jsxs("div",{className:je.content,children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Page Slug",onChange:U=>f(U),value:m,placeholder:"path-to-page",disabled:!!(a&&n&&((J=n[a])!=null&&J.name)&&e.defaultPagePaths.includes(n[a].path)),required:!0,regex:"^.+$"}),e.jsxRuntimeExports.jsx(e.Input,{label:"Page Title",onChange:U=>{l(U)},value:j.charAt(0).toUpperCase()+j.slice(1),placeholder:"Contact us"}),e.jsxRuntimeExports.jsx(e.Textarea,{label:"Description",onChange:U=>x(U),value:S,placeholder:`${u.general.info.name} is powered by the Billgang.com platform which allows them to sell their digital products online for free.`,maxLength:150}),e.jsxRuntimeExports.jsxs("div",{className:je.preview,children:[e.jsxRuntimeExports.jsx("span",{className:je.label,children:"Preview"}),e.jsxRuntimeExports.jsxs("div",{className:je.block,children:[e.jsxRuntimeExports.jsx("span",{className:je.slug,children:m||"yoursite.url"}),e.jsxRuntimeExports.jsx("span",{className:je.title,children:j||"My Blank Page"}),e.jsxRuntimeExports.jsx("span",{className:je.description,children:S||"It is My Description"})]})]})]}),e.jsxRuntimeExports.jsxs("div",{className:je.buttons,children:[e.jsxRuntimeExports.jsx(e.Button,{onClick:_,type:"Secondary",children:"Cancel"}),e.jsxRuntimeExports.jsx(e.Button,{onClick:i?F:w,disabled:m.length===0,children:i?"Update":"Create"})]})]})},fc="_layout_1pjho_1",Sc="_main_1pjho_10",_c="_content_1pjho_18",Cc="_notifications_1pjho_26",gt={layout:fc,main:Sc,content:_c,notifications:Cc},vc="_notification_2jmah_1",Rc="_text_2jmah_22",Ec="_timer_2jmah_27",yc="_warning_2jmah_32",bc="_error_2jmah_37",wc="_success_2jmah_42",Ve={notification:vc,text:Rc,timer:Ec,warning:yc,error:bc,success:wc},uo={warning:"#C1972A",error:"#FF3F19",success:"#338B13"},fo=t=>{const{type:n,message:o,style:s,padding:i,timer:r,id:a,element:c}=t,[u,h]=p.useState(r),{setNotifications:d}=e.useNotificationStore();function g(){const f=e.useNotificationStore.getState().notifications.filter(j=>j.id!==a);d([...f])}return p.useEffect(()=>{const m=setTimeout(()=>{g()},r*1e3);return()=>clearTimeout(m)},[r]),p.useEffect(()=>{const m=setInterval(()=>h(f=>f-1),1e3);return()=>clearInterval(m)},[u]),c?c({type:n,message:o,style:s,padding:i,timer:r,id:a}):e.jsxRuntimeExports.jsx("div",{style:{padding:i,position:"relative"},children:e.jsxRuntimeExports.jsxs("div",{className:e.clx(Ve.notification,{[Ve.warning]:n==="warning",[Ve.error]:n==="error",[Ve.success]:n==="success"}),style:s,children:[e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Info",fill:uo[n],width:20,height:20})}),e.jsxRuntimeExports.jsx("div",{className:Ve.text,children:o}),r&&e.jsxRuntimeExports.jsx("div",{className:Ve.timer,children:u}),e.jsxRuntimeExports.jsx("div",{style:{display:"flex"},children:e.jsxRuntimeExports.jsx(e.Icon,{name:"X",fill:uo[n],width:20,height:20,hoverable:!0,onClick:()=>g()})})]})})},kc="_modal_1h74q_1",Nc="_title_1h74q_14",Tc="_buttons_1h74q_20",jt={modal:kc,title:Nc,buttons:Tc},So=()=>{const{title:t,description:n,onConfirm:o,setTitle:s,setDescription:i,setOnConfirm:r}=e.useConfirmationModalStore(),{setIsOpen:a}=e.useModalStore();function c(){a(!1),setTimeout(()=>{s(null),i(null),r(null),a(!0)},300)}return t&&n&&o&&e.jsxRuntimeExports.jsxs("div",{className:jt.modal,onClick:u=>u.stopPropagation(),children:[e.jsxRuntimeExports.jsx("div",{className:jt.title,children:t}),e.jsxRuntimeExports.jsx("div",{className:jt.description,children:n}),e.jsxRuntimeExports.jsxs("div",{className:jt.buttons,children:[e.jsxRuntimeExports.jsx(e.Button,{onClick:c,children:"Cancel"}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>{o(),c()},type:"Secondary",children:"Confirm"})]})]})},Lc="_modal_270ti_1",Pc="_padding_270ti_17",Ac="_content_270ti_21",Bc="_close_270ti_42",It={modal:Lc,padding:Pc,content:Ac,close:Bc},vt=t=>{const{close:n,children:o,withAnimation:s=!0,hasPadding:i=!0}=t,{isOpen:r,setIsOpen:a}=e.useModalStore();return p.useEffect(()=>{const c=()=>{a(!1),s?setTimeout(()=>{n(!1),a(!0)},300):(n(!1),a(!0))};return document.body.addEventListener("click",c),()=>{document.body.removeEventListener("click",c)}},[]),e.jsxRuntimeExports.jsx("div",{className:e.clx(It.modal,{[It.padding]:i}),children:s?e.jsxRuntimeExports.jsx("div",{className:e.clx(It.content,{[It.close]:!r}),children:o}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:o})})},Mc=()=>{const{isOpenModal:t,setIsOpenModal:n}=e.usePagesStore(),{openModal:o,setOpenModal:s}=e.useChooseImageStore(),{notifications:i}=e.useNotificationStore(),{title:r,description:a,setTitle:c,setDescription:u,setOnConfirm:h}=e.useConfirmationModalStore();return e.jsxRuntimeExports.jsxs("div",{id:"builder",children:[e.jsxRuntimeExports.jsxs("div",{className:gt.layout,children:[e.jsxRuntimeExports.jsx(Cs,{}),e.jsxRuntimeExports.jsxs("main",{className:gt.main,children:[e.jsxRuntimeExports.jsx(ms,{}),e.jsxRuntimeExports.jsxs("div",{className:gt.content,children:[e.jsxRuntimeExports.jsx(ic,{}),e.jsxRuntimeExports.jsx(yr,{})]})]})]}),r&&a&&e.jsxRuntimeExports.jsx(vt,{close:()=>{c(null),u(null),h(null)},children:e.jsxRuntimeExports.jsx(So,{})}),t&&e.jsxRuntimeExports.jsx(vt,{close:n,children:e.jsxRuntimeExports.jsx(Ic,{})}),o&&e.jsxRuntimeExports.jsx(vt,{close:s,children:e.jsxRuntimeExports.jsx(e.ChooseImageModal,{})}),i.length>0&&e.jsxRuntimeExports.jsx("div",{className:gt.notifications,children:i.map(d=>e.jsxRuntimeExports.jsx(fo,{type:d.status,message:d.message,timer:d.timer||10,id:d.id,element:d.component},d.id))})]})};async function ze(t,n){const o=localStorage.getItem("shopId")||void 0,i=`${e.useApiStore.getState().apiUrls.api}/${t}/builder/shops/${o}/${n}`;return(await e.request({url:i,withToken:!0,method:"get"})).data}async function $c(){try{const[t,n,o,s,i,r,a,c]=await Promise.allSettled([ze("v1","general"),ze("v1","faqs"),ze("v1","listings"),ze("v1","products"),ze("v1","reviews"),ze("v1","categories"),{data:null},{data:null}]);return{general:t,faqs:n,listings:o,products:s,reviews:i,categories:r,fullPosts:a,posts:c}}catch(t){throw console.error("Error fetching page data:",t),t}}async function Fc(){const t=e.useApiStore.getState().apiUrls;try{const{data:n}=await e.axios.get(`${t.googleFonts}?key=AIzaSyAEsTbjAPUz_TeuFCq4z4LPK9w_vst0Pfw`);return n.items}catch(n){throw console.error("Error fetching page data:",n),n}}async function Dc(){var i;const t=localStorage.getItem("shopId"),n=localStorage.getItem("draftId"),s=`${e.useApiStore.getState().apiUrls.api}/v2/builder/shops/${t}/drafts/${n}/pages`;try{return(await e.request({url:s,withToken:!0,method:"get"})).data}catch(r){return{data:[],status:(i=r.response)==null?void 0:i.status}}}async function Hc(){const t=localStorage.getItem("shopId")||void 0,n=localStorage.getItem("draftId")||void 0,s=`${e.useApiStore.getState().apiUrls.api}/v2/builder/shops/${t}/drafts/${n}/all`;return(await e.request({url:s,withToken:!0,method:"get"})).data}const Oc=t=>{const{blocks:n,settings:o,header:s,footer:i,announcement:r}=t,{setBlocks:a,setSourceBlocks:c,setHeader:u,setFooter:h,setAnnouncement:d,setSettings:g}=e.useBlocksStore(),{fonts:m,setFonts:f}=e.useFontsStore(),{setSettings:j}=e.useSettingsStore(),{setPageContext:l}=e.usePagesStore(),{setThemeSettings:S,setIsLoadingThemeSettings:x}=e.useThemeSettingsStore(),{setIsLoadingSettings:C}=e.useSettingsStore(),{notifications:I,setNotifications:R}=e.useNotificationStore(),{setBlocks:_,blocks:v,createPage:w,setIsLoadingLayers:F,setHeader:K,setAnnouncement:Z,setFooter:M}=e.useLayersStore(),{setPages:b,setCurrentPage:E}=e.usePagesStore();return p.useEffect(()=>{x(!0),F(!0),C(!0);const D={};Object.keys(n).forEach(U=>{D[U]=n[U]}),c(D),a(D),u(s),h(i),d(r),g(o),(async()=>{const U={listings:null,products:null,reviews:null,categories:null,faqs:null,general:null,fullPosts:null,posts:null},N=await $c();Object.keys(N).map(z=>{const ue=z;U[ue]=N[ue].value.data}),l(U);const{data:A}=await Hc(),{themeSettings:W,layers:T,settings:q}=A||{};if(q){if(q.settings){const z=new o;z.blockSettings={displayName:"Settings",isAddable:!1,...q.settings},j(z.blockSettings)}q.header&&K(q.header),q.footer&&M(q.footer),q.announcement&&Z(q.announcement)}else{const z=new o;j(z.blockSettings)}W&&S(W);const ke=await Dc(),ve={};if(ke.status>=400&&R([...I,{id:e.v4(),message:"Error fetching pages",status:"error"}]),ke.data.length>0?(ke.data.forEach(z=>{var ue,X;v[z.path]||w(z.path),ve[z.id||z.path]={...z,icon:e.pages[z.path]?e.pages[z.path].icon:"File",name:z.name||((ue=z.seo)==null?void 0:ue.pageTitle)||((X=e.pages[z.path])==null?void 0:X.name)||z.path}}),b(ve),E(Object.keys(ve)[0])):(b(e.pages),E(Object.keys(e.pages)[0])),m.length===0){const z=await Fc();f([...z.map(ue=>{const X=ue.variants.map(de=>{if(!de.includes("italic"))return de==="regular"?"400":de}).filter(de=>de!==void 0);return{name:ue.family,weights:X}})])}_(T),x(!1),F(!1),C(!1)})()},[]),e.jsxRuntimeExports.jsx(Mc,{})};function Uc(){const t=new URL(window.location.href);window.history.replaceState(null,"",t.pathname+t.hash)}function Wc(){const t=new URLSearchParams(document.location.search),n=t.get("shopId")||localStorage.getItem("shopId"),o=t.get("sellerAccessToken")||localStorage.getItem("sellerAccessToken"),s=t.get("draftId")||localStorage.getItem("draftId");return Uc(),o&&localStorage.setItem("sellerAccessToken",o),n&&localStorage.setItem("shopId",n),s&&localStorage.setItem("draftId",s),!!(o&&n&&s)}const Gc="data:image/svg+xml,%3csvg%20width='204'%20height='241'%20viewBox='0%200%20204%20241'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M204%200V118.282L154.174%20134.707V69.0074L49.7111%20102.77V43.5716L204%200Z'%20fill='%23FF3F19'/%3e%3cpath%20d='M154.174%20134.694V191.155L0%20241V117.471L49.7114%20102.757V169.597L154.174%20134.694Z'%20fill='%23FF3F19'/%3e%3c/svg%3e",qc=t=>{const{blocks:n,settings:o,header:s,footer:i,announcement:r}=t,[a,c]=p.useState(!0),u=e.useNavigate(),h=e.useLocation();return p.useEffect(()=>{const d=h.pathname;if(d.startsWith("/admin/builder")){d==="/admin/builder/add"?document.title="Add Section | Builder":d==="/admin/builder/theme"?document.title="Theme Settings | Builder":d==="/admin/builder/settings"?document.title="Settings | Builder":document.title="Builder | Billgang";let g=document.querySelector("link[rel~='icon']");g||(g=document.createElement("link"),g.rel="icon",document.head.appendChild(g)),g&&(g.href=Gc)}},[h]),p.useEffect(()=>{c(!0),Wc()?c(!1):u("/")},[]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:a?e.jsxRuntimeExports.jsx($e,{}):e.jsxRuntimeExports.jsx(Oc,{blocks:n,settings:o,header:s,footer:i,announcement:r})})},Vc="_wrapper_1yd2j_1",zc="_error_1yd2j_11",Zc="_title_1yd2j_21",Xc="_buttons_1yd2j_29",st={wrapper:Vc,error:zc,title:Zc,buttons:Xc},po=async t=>{const n=localStorage.getItem("shopId")||void 0,o=localStorage.getItem("draftId"),i=`${e.useApiStore.getState().apiUrls.api}/v2/builder/shops/${n}/drafts/${o}/reset`;return await e.request({url:i,withToken:!0,method:"post",body:t})},Yc=()=>{const{error:t,setError:n}=e.useErrorStore(),{pages:o}=e.usePagesStore(),{setIsOpen:s}=e.useModalStore(),{title:i,description:r,setOnConfirm:a,setTitle:c,setDescription:u}=e.useConfirmationModalStore(),{setBlocks:h}=e.useLayersStore();async function d(){await po({resetSettings:(t==null?void 0:t.failedSettings)??!1,resetThemeSettings:(t==null?void 0:t.failedThemeSettings)??!1,resetPageIds:(t==null?void 0:t.failedPageIds)??[]}),n(null),h({}),window.location.reload()}async function g(){const m=[];o&&Object.keys(o).map(f=>o[f].id).filter(f=>f!==void 0).map(f=>m.push(f)),await po({resetSettings:!0,resetThemeSettings:!0,resetPageIds:m}),n(null)}return e.jsxRuntimeExports.jsxs("div",{className:st.wrapper,children:[e.jsxRuntimeExports.jsxs("div",{className:st.error,children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("div",{className:st.title,children:"Oops! Something went wrong"}),e.jsxRuntimeExports.jsx("span",{className:st.message,children:(t==null?void 0:t.message)||""})]}),e.jsxRuntimeExports.jsxs("div",{className:st.buttons,children:[e.jsxRuntimeExports.jsx(e.Button,{type:"Primary",onClick:d,children:"Reset Settings"}),e.jsxRuntimeExports.jsx(e.Button,{type:"Secondary",onClick:m=>{m.stopPropagation(),c("Reset All Settings"),u("Are you sure you want to reset all settings? This is irreversible."),a(async()=>{await g()})},children:"Reset All Settings"})]})]}),i&&r&&e.jsxRuntimeExports.jsx(vt,{close:()=>{s(!1),setTimeout(()=>{c(null),u(null),a(null),s(!0)},300)},children:e.jsxRuntimeExports.jsx(So,{})})]})},Kc=t=>{const{children:n}=t,{pathname:o}=e.useLocation(),{setActiveBlock:s}=e.useNavbarStore(),{setActiveBlock:i}=e.useThemeSettingsStore(),{setActiveBlock:r}=e.usePreviewStore();return p.useEffect(()=>{switch(r({id:null,neededScroll:!1}),o){case"/admin/builder":s(e.navbarBlocks[0]);break;case"/admin/builder/add":s(e.navbarBlocks[1]);break;case"/admin/builder/theme":s(e.navbarBlocks[2]);break;case"/admin/builder/settings":s(e.navbarBlocks[3]);break;case"/admin/builder/theme/colors":s(e.navbarBlocks[2]),i(Se[0]);break;case"/admin/builder/theme/fonts":s(e.navbarBlocks[2]),i(Se[1]);break;case"/admin/builder/theme/borders":s(e.navbarBlocks[2]),i(Se[2]);break;case"/admin/builder/theme/buttons":s(e.navbarBlocks[2]),i(Se[3]);break;case"/admin/builder/theme/inputs":s(e.navbarBlocks[2]),i(Se[4]);break}},[o]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:n})},Jc="_lock_1mxa7_1",Qc="_wrapper_1mxa7_12",el="_content_1mxa7_22",tl="_info_1mxa7_31",ol="_buttons_1mxa7_38",nl="_button_1mxa7_38",sl="_input_1mxa7_50",rl="_error_1mxa7_57",Ee={lock:Jc,wrapper:Qc,content:el,info:tl,buttons:ol,button:nl,input:sl,error:rl},il=()=>{const[t,n]=p.useState(!1),[o,s]=p.useState(!1),[i,r]=p.useState(""),{general:a,setGeneral:c}=e.useGeneralStore(),{setShopPassword:u}=e.useStorefrontStore(),h=e.useLocation(),d=e.useNavigate();p.useEffect(()=>{if(a&&(!a.info.passwordProtected||a.isPasswordValid)){const m=h.state.from==="/validation"?"/":h.state.from;d(m)}},[a]),p.useEffect(()=>{a||(async()=>{var l;n(!0);const f=localStorage.getItem("shopPassword")||"",j=await Wt(f);if(j.isPasswordValid){const S=((l=h.state)==null?void 0:l.from)||"/";d(S)}j.info.passwordProtected||(localStorage.removeItem("shopPassword"),u("")),c(j),n(!1)})()},[a]);async function g(){var f;n(!0);const m=await Wt(i);if(!m.isPasswordValid)s(!0);else{localStorage.setItem("shopPassword",i),u(i);const j=((f=h.state)==null?void 0:f.from)||"/";d(j),m.info.passwordProtected||(localStorage.removeItem("shopPassword"),u("")),c(m)}n(!1)}return e.jsxRuntimeExports.jsxs("div",{className:Ee.wrapper,children:[!t&&e.jsxRuntimeExports.jsxs("div",{className:Ee.content,children:[e.jsxRuntimeExports.jsx("div",{className:Ee.lock,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Lock",fill:"var(--text-secondary)",width:64,height:64})}),e.jsxRuntimeExports.jsxs("div",{className:Ee.info,children:[e.jsxRuntimeExports.jsx("h2",{id:"h2",className:Ee.title,children:"The store is password protected"}),e.jsxRuntimeExports.jsx("p",{id:"p",className:Ee.description,children:"If you do not have a password, we recommend you to contact the technical support of the store or write to the mail"})]}),e.jsxRuntimeExports.jsxs("div",{className:Ee.input,children:[e.jsxRuntimeExports.jsx(e.Input$1,{type:"password",onChange:m=>{s(!1),r(m)},value:i,placeholder:"Password",required:!0}),e.jsxRuntimeExports.jsx("span",{className:Ee.error,children:o&&"Incorrect password"})]}),e.jsxRuntimeExports.jsx("div",{className:Ee.buttons,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",className:Ee.button,disabled:o,onClick:g,children:"Submit"})})]}),t&&e.jsxRuntimeExports.jsx(e.Loader,{})]})},al="_notifications_2ywhg_1",cl={notifications:al},ll=()=>(p.useEffect(()=>{document.title="Temporarily Unavailable"},[]),e.jsxRuntimeExports.jsx("div",{style:{display:"flex",flexDirection:"column",width:"100vw",height:"100vh",overflowY:"scroll",overflowX:"hidden",background:"var(--surface-primary)",color:"var(--text-primary)"},children:e.jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",flex:"1",justifyContent:"center",alignItems:"center",gap:"24px"},children:[e.jsxRuntimeExports.jsx("h2",{style:{color:"var(--text-primary)",fontSize:"var(--font-heading-h2-size)"},children:"Temporarily Unavailable"}),e.jsxRuntimeExports.jsx("span",{style:{color:"var(--text-secondary)",fontSize:"var(--font-heading-h3-size)",width:"85%",textAlign:"center"},children:"We're making some quick updates to improve your shopping experience. During this time, browsing and checkout are temporarily unavailable."})]})})),ul="_notification_o93uc_1",dl="_accent_o93uc_15",pl="_body_o93uc_23",ml="_label_o93uc_30",xl="_content_o93uc_36",hl="_timer_o93uc_41",gl="_warning_o93uc_48",jl="_error_o93uc_53",Il="_success_o93uc_58",De={notification:ul,accent:dl,body:pl,label:ml,content:xl,timer:hl,warning:gl,error:jl,success:Il},fl={warning:"Warning",error:"Error",success:"Success"},Sl=({type:t,message:n,style:o,padding:s=0,timer:i=0})=>{const[r,a]=p.useState(i);return p.useEffect(()=>{if(!i)return;const c=setInterval(()=>a(u=>u-1),1e3);return()=>clearInterval(c)},[]),e.jsxRuntimeExports.jsx("div",{style:{padding:s,position:"relative"},children:e.jsxRuntimeExports.jsxs("div",{className:e.clx(De.notification,De[t]),style:o,children:[e.jsxRuntimeExports.jsx("div",{className:De.accent}),e.jsxRuntimeExports.jsx("div",{className:De.body,children:e.jsxRuntimeExports.jsxs("div",{className:De.content,children:[e.jsxRuntimeExports.jsxs("span",{className:De.label,children:[fl[t],":"]})," ",n]})}),i>0&&e.jsxRuntimeExports.jsx("span",{className:De.timer,children:r})]})})},_l=({children:t})=>{const n=e.useLocation(),{token:o,setToken:s}=e.useStorefrontStore(),{dashInfo:i,setDashInfo:r}=e.useCustomerDashboardStore(),{shopPassword:a}=e.useStorefrontStore(),c=e.useNavigate(),[u,h]=e.useSearchParams(),{notifications:d}=e.useNotificationStore(),[g,m]=p.useState(!0),{setCustomerEmail:f}=e.useCartStore(),{setThemeSettings:j,themeSettings:l}=e.useThemeSettingsStore(),{settings:S,setSettings:x}=e.useSettingsStore(),{setHeader:C,setFooter:I,setAnnouncement:R}=e.useLayersStore(),{general:_,setGeneral:v,isAntistock:w}=e.useGeneralStore(),{pageContext:F,setPageContext:K}=e.usePagesStore();e.useTrackingAnalytics((_==null?void 0:_.info.id)||localStorage.getItem("shopId")||"");const Z=async()=>{const M=await e.getDynamicPage(encodeURIComponent("/products"),_==null?void 0:_.info.passwordProtected);if(M){const{data:b}=M;K({...F,listings:b.listings})}};return p.useEffect(()=>{const M=localStorage.getItem("token");if(M&&(!o||!i))try{const b=e.jwtDecode(M);r(b),s(M),f(b.email)}catch(b){console.error("Failed to decode token:",b),localStorage.removeItem("token"),s(""),r(null)}},[o,i]),p.useEffect(()=>{const M=u.get("r");M&&(localStorage.setItem("referralCode",M),u.delete("r"),h(u),c({pathname:n.pathname,search:u.toString()},{replace:!0}))},[u,n]),p.useEffect(()=>{!n.pathname.startsWith("/products")&&!n.pathname.startsWith("/admin/builder")&&_&&(_.info.passwordProtected&&a||_.isPasswordValid)&&Z()},[_,a]),p.useLayoutEffect(()=>{const M=async()=>{if(m(!0),!_){const E=await Wt(a);if(!E.isPasswordValid&&!n.pathname.includes("/admin/builder")){c("/validation",{state:{from:n.pathname}});return}if(!E.info.passwordProtected){localStorage.removeItem("shopPassword");const{setShopPassword:D}=e.useStorefrontStore.getState();D("")}v(E)}},b=async()=>{m(!0);const{settings:E,theme:D}=(await pn()).data;E?(E.settings&&x(E.settings),E.header&&C(JSON.parse(JSON.stringify(E.header))),E.footer&&I(JSON.parse(JSON.stringify(E.footer))),E.announcement&&R(JSON.parse(JSON.stringify(E.announcement)))):x(S),j(D||l),m(!1)};n.pathname.startsWith("/validation")||M(),b()},[]),w&&(_!=null&&_.info.onHold)?e.jsxRuntimeExports.jsx(ll,{}):n.pathname.startsWith("/admin/builder")?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:t}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:g?e.jsxRuntimeExports.jsx("div",{style:{width:"100vw",height:"100dvh",display:"flex",justifyContent:"center",alignItems:"center"},children:e.jsxRuntimeExports.jsx(e.Loader,{})}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[t,d.length>0&&e.jsxRuntimeExports.jsx("div",{className:cl.notifications,children:d.map(M=>e.jsxRuntimeExports.jsx(fo,{type:M.status,message:M.message,timer:M.timer||10,id:M.id,element:w?Sl:M.component},M.id))})]})})},Cl=()=>(p.useEffect(()=>{setTimeout(()=>{window.location.reload()},500)},[]),e.jsxRuntimeExports.jsx("div",{style:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},children:e.jsxRuntimeExports.jsx(e.Loader,{})})),vl="_wrapper_ej209_1",Rl="_content_ej209_12",El="_title_ej209_22",Dt={wrapper:vl,content:Rl,title:El},Ne=()=>{const t=e.useNavigate(),n=e.useRouteError();return console.error("ROUTE ERROR: ",n),e.jsxRuntimeExports.jsx("div",{className:Dt.wrapper,children:e.jsxRuntimeExports.jsxs("div",{className:Dt.content,children:[e.jsxRuntimeExports.jsx("h1",{className:Dt.title,children:"Something Went Wrong"}),e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",onClick:()=>{t("/")},children:"Go Home"})]})})},yl=({children:t,shopDomain:n,shopId:o,shopPassword:s,shopLogo:i})=>{const{setShopDomain:r,setShopId:a,setShopPassword:c,setShopTerms:u,setShopPrivacyPolicy:h,setShopRefundPolicy:d,setShopLogo:g}=e.useStorefrontStore();return p.useLayoutEffect(()=>{const m=async()=>{const{data:l}=await xn();u(l)},f=async()=>{const{data:l}=await gn();h(l)},j=async()=>{const{data:l}=await hn();d(l)};r(n),a(o),s&&c(s),i&&g(i),m(),f(),j()},[n,o,s]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:t})},bl="_checkoutItemsContainer_1kn61_2",wl="_innerContainer_1kn61_16",kl="_headerSection_1kn61_22",Nl="_header_1kn61_22",Tl="_productsContainer_1kn61_47",Ll="_couponContainer_1kn61_54",Pl="_checkoutFooter_1kn61_58",He={checkoutItemsContainer:bl,innerContainer:wl,headerSection:kl,header:Nl,productsContainer:Tl,couponContainer:Ll,checkoutFooter:Pl},Al="_checkoutFooter_sum4s_1",Bl="_antistock_sum4s_12",Ml="_footerBranding_sum4s_22",$l="_poweredText_sum4s_27",Fl="_antistockLink_sum4s_31",Dl="_footerNav_sum4s_39",Ze={checkoutFooter:Al,antistock:Bl,footerBranding:Ml,poweredText:$l,antistockLink:Fl,footerNav:Dl},Hl="data:image/svg+xml,%3csvg%20width='100'%20height='26'%20viewBox='0%200%20100%2026'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M20.3996%203.39999V12.8228L16.2964%2014.1313V8.89738L7.69363%2011.587V6.87107L20.3996%203.39999Z'%20fill='%23FF3F19'/%3e%3cpath%20d='M16.2964%2014.1313L16.2962%2018.6292L3.59961%2022.6V12.7592L7.69363%2011.587L7.69344%2016.9118L16.2964%2014.1313Z'%20fill='%23FF3F19'/%3e%3cpath%20d='M95.6308%2022C93.4931%2022%2091.8804%2020.882%2091.4678%2019.1776L93.118%2019.0676C93.4181%2019.984%2094.0931%2020.5338%2095.6308%2020.5338C97.4311%2020.5338%2098.4249%2019.8373%2098.4249%2018.4078V16.8316C97.9374%2017.858%2096.8122%2018.5178%2095.5183%2018.5178C92.9868%2018.5178%2091.1865%2016.575%2091.1865%2013.8076C91.1865%2011.0401%2092.9492%209.09737%2095.4433%209.09737C96.831%209.09737%2098.0499%209.77549%2098.5%2010.8568V9.3173H100V18.3711C100%2020.6438%2098.3687%2022%2095.6308%2022ZM95.5933%2017.0515C97.2998%2017.0515%2098.4062%2015.8053%2098.4249%2013.8076C98.4624%2011.8099%2097.3186%2010.5636%2095.5933%2010.5636C93.8494%2010.5636%2092.8367%2011.8099%2092.8367%2013.8076C92.8367%2015.8053%2093.8869%2017.0515%2095.5933%2017.0515Z'%20fill='%23252525'/%3e%3cpath%20d='M81.1836%2019.0309V9.3173H82.6275L82.665%2011.0584C83.1901%209.72051%2084.3527%209.09737%2085.7217%209.09737C87.9907%209.09737%2089.0783%2010.7285%2089.0783%2012.7812V19.0309H87.5031V13.2211C87.5031%2011.425%2086.8843%2010.4536%2085.3841%2010.4536C83.8464%2010.4536%2082.7588%2011.425%2082.7588%2013.2211V19.0309H81.1836Z'%20fill='%23252525'/%3e%3cpath%20d='M73.3176%2019.2509C71.2549%2019.2509%2069.9609%2018.2795%2069.9609%2016.6117C69.9609%2014.9622%2070.9173%2014.0458%2073.0926%2013.6426L76.618%2013.0011C76.618%2011.37%2075.8304%2010.5636%2074.2552%2010.5636C72.8676%2010.5636%2072.0987%2011.1867%2071.7987%2012.3047L70.1297%2012.1764C70.5048%2010.3436%2072.0049%209.09737%2074.2552%209.09737C76.8056%209.09737%2078.1932%2010.6002%2078.1932%2013.0561V17.0699C78.1932%2017.5097%2078.3433%2017.6747%2078.7183%2017.6747H79.1121V19.0309C78.9996%2019.0493%2078.7558%2019.0676%2078.512%2019.0676C77.3119%2019.0676%2076.7681%2018.6094%2076.6368%2017.5281C76.1492%2018.5361%2074.7803%2019.2509%2073.3176%2019.2509ZM73.4676%2017.8946C75.4554%2017.8946%2076.618%2016.6483%2076.618%2015.0355V14.3391L73.3926%2014.9255C72.0425%2015.1638%2071.6111%2015.6586%2071.6111%2016.4651C71.6111%2017.3814%2072.305%2017.8946%2073.4676%2017.8946Z'%20fill='%23252525'/%3e%3cpath%20d='M63.2168%2022C61.079%2022%2059.4663%2020.882%2059.0537%2019.1776L60.704%2019.0676C61.004%2019.984%2061.6791%2020.5338%2063.2168%2020.5338C65.017%2020.5338%2066.0109%2019.8373%2066.0109%2018.4078V16.8316C65.5233%2017.858%2064.3982%2018.5178%2063.1043%2018.5178C60.5727%2018.5178%2058.7725%2016.575%2058.7725%2013.8076C58.7725%2011.0401%2060.5352%209.09737%2063.0293%209.09737C64.4169%209.09737%2065.6358%209.77549%2066.0859%2010.8568V9.3173H67.5861V18.3711C67.5861%2020.6438%2065.9546%2022%2063.2168%2022ZM63.1793%2017.0515C64.8857%2017.0515%2065.9921%2015.8053%2066.0109%2013.8076C66.0484%2011.8099%2064.9045%2010.5636%2063.1793%2010.5636C61.4353%2010.5636%2060.4227%2011.8099%2060.4227%2013.8076C60.4227%2015.8053%2061.4728%2017.0515%2063.1793%2017.0515Z'%20fill='%23252525'/%3e%3cpath%20d='M56.2141%2019.0309C55.0515%2019.0309%2054.2451%2018.4811%2054.2451%2017.1982L54.2639%206.01834H55.8391V17.0699C55.8391%2017.4731%2056.0453%2017.6747%2056.4579%2017.6747H57.3205V19.0309H56.2141Z'%20fill='%23252525'/%3e%3cpath%20d='M51.0686%2019.0309C49.906%2019.0309%2049.0996%2018.4811%2049.0996%2017.1982L49.1184%206.01834H50.6936V17.0699C50.6936%2017.4731%2050.8998%2017.6747%2051.3124%2017.6747H52.175V19.0309H51.0686Z'%20fill='%23252525'/%3e%3cpath%20d='M44.5209%2019.0309V9.3173H46.0961V19.0309H44.5209ZM44.4834%207.79611V6H46.1336V7.79611H44.4834Z'%20fill='%23252525'/%3e%3cpath%20d='M32%2019.0309V6.01834H36.5756C39.726%206.01834%2041.3012%207.09967%2041.3012%209.51891C41.3012%2010.9851%2040.4198%2012.0481%2038.9384%2012.3047C40.7574%2012.5613%2041.8638%2013.7709%2041.8638%2015.4571C41.8638%2017.8213%2040.2323%2019.0309%2037.3257%2019.0309H32ZM37.3257%2017.4914C39.1447%2017.4914%2040.176%2016.74%2040.176%2015.3654C40.176%2013.9908%2039.1447%2013.1844%2037.3257%2013.1844H33.6127V17.4914H37.3257ZM36.5756%2011.6449C38.5258%2011.6449%2039.6135%2010.8935%2039.6135%209.59222C39.6135%208.21765%2038.6008%207.55786%2036.5756%207.55786H33.6127V11.6449H36.5756Z'%20fill='%23252525'/%3e%3c/svg%3e",Ce=({className:t})=>{const{shopTerms:n,shopPrivacyPolicy:o,shopRefundPolicy:s,shopLogo:i}=e.useStorefrontStore(),{isAntistock:r}=e.useGeneralStore();return e.jsxRuntimeExports.jsxs("footer",{className:`${Ze.checkoutFooter} ${t} ${r?Ze.antistock:""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:Ze.footerBranding,children:[e.jsxRuntimeExports.jsx("p",{className:Ze.poweredText,id:"md",style:r?{color:"var(--text-action)"}:void 0,children:"Powered by"}),r?e.jsxRuntimeExports.jsxs("a",{className:Ze.antistockLink,href:"https://antistock.io",target:"_blank",rel:"noopener noreferrer",children:[e.jsxRuntimeExports.jsx(e.SvgMiniLogoAntistock,{width:14,height:18}),"Antistock"]}):i||e.jsxRuntimeExports.jsx("img",{src:Hl,alt:"Billgang"})]}),e.jsxRuntimeExports.jsx("nav",{children:e.jsxRuntimeExports.jsxs("ul",{className:Ze.footerNav,children:[(n==null?void 0:n.showTermsOfServiceOnProduct)&&!r&&e.jsxRuntimeExports.jsx("li",{children:e.jsxRuntimeExports.jsx("a",{href:n.termsOfService,target:"_blank",rel:"noopener noreferrer",children:"Terms"})}),(o==null?void 0:o.showPrivacyPolicyOnProduct)&&e.jsxRuntimeExports.jsx("li",{children:e.jsxRuntimeExports.jsx("a",{href:o.privacyPolicy,target:"_blank",rel:"noopener noreferrer",children:"Privacy"})}),(s==null?void 0:s.showRefundPolicyOnProduct)&&e.jsxRuntimeExports.jsx("li",{children:e.jsxRuntimeExports.jsx("a",{href:s.refundPolicy,target:"_blank",rel:"noopener noreferrer",children:"Refund"})})]})})]})},Ol="_checkoutHeader_1stm3_1",Ul="_leftContainer_1stm3_20",Wl="_backArrow_1stm3_26",Gl="_logoContainer_1stm3_38",ql="_logo_1stm3_38",Vl="_antistockLink_1stm3_48",Xe={checkoutHeader:Ol,leftContainer:Ul,backArrow:Wl,logoContainer:Gl,logo:ql,antistockLink:Vl},zl="_activeBadge_1yb5i_1",Zl="_activeBadgeText_1yb5i_12",mo={activeBadge:zl,activeBadgeText:Zl},Xl=({className:t})=>e.jsxRuntimeExports.jsxs("div",{className:e.clx(mo.activeBadge,t),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Check",width:20,height:20}),e.jsxRuntimeExports.jsx("p",{className:mo.activeBadgeText,children:"Active"})]}),Yl="_timerContainer_rh66p_2",Kl="_timerText_rh66p_12",Jl="_timerContainerAntistock_rh66p_16",Ht={timerContainer:Yl,timerText:Kl,timerContainerAntistock:Jl},Ql=({expiresAt:t})=>{const[n,o]=p.useState(i()),{isAntistock:s}=e.useGeneralStore();function i(){const r=new Date,a=new Date(t).getTime()-r.getTime();if(a<=0)return{hours:"00",minutes:"00",seconds:"00"};const c=Math.floor(a/(1e3*60*60)),u=Math.floor(a%(1e3*60*60)/(1e3*60)),h=Math.floor(a%(1e3*60)/1e3);return{hours:String(c).padStart(2,"0"),minutes:String(u).padStart(2,"0"),seconds:String(h).padStart(2,"0")}}return p.useEffect(()=>{const r=setInterval(()=>{o(i())},1e3);return()=>clearInterval(r)},[t]),n.hours==="00"&&n.minutes==="00"&&n.seconds==="00"?null:s?e.jsxRuntimeExports.jsxs("div",{className:Ht.timerContainerAntistock,children:[e.jsxRuntimeExports.jsxs("span",{children:[n.hours,":",n.minutes,":",n.seconds]}),e.jsxRuntimeExports.jsx("span",{children:"remaining"})]}):e.jsxRuntimeExports.jsxs("div",{className:Ht.timerContainer,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Clock"}),e.jsxRuntimeExports.jsxs("p",{className:Ht.timerText,id:"md",children:[n.hours,":",n.minutes,":",n.seconds]})]})},eu="_progressBar_mcabf_4",tu="_progressBarLabel_mcabf_12",ou="_progressBarTrack_mcabf_17",nu="_progressBarFill_mcabf_28",ft={progressBar:eu,progressBarLabel:tu,progressBarTrack:ou,progressBarFill:nu},_o=({color:t,percent:n,disablePercentLabel:o})=>e.jsxRuntimeExports.jsxs("div",{className:ft.progressBar,children:[!o&&e.jsxRuntimeExports.jsxs("p",{className:ft.progressBarLabel,children:[n,"%"]}),e.jsxRuntimeExports.jsx("div",{className:ft.progressBarTrack,children:e.jsxRuntimeExports.jsx("div",{style:{width:`${n}%`,background:t||void 0},className:ft.progressBarFill})})]}),su="_rating_1bpps_4",ru="_disabled_1bpps_9",iu="_ratingStar_1bpps_14",au="_inactive_1bpps_22",St={rating:su,disabled:ru,ratingStar:iu,inactive:au},cu=({setRating:t,rating:n,disabled:o})=>{const[s,i]=p.useState(0),r=c=>{o||i(+c.currentTarget.id)},a=c=>{o||t(c)};return e.jsxRuntimeExports.jsx("div",{className:e.clx(St.rating,{[St.disabled]:o}),onMouseLeave:()=>i(0),children:[1,2,3,4,5].map(c=>e.jsxRuntimeExports.jsx("div",{id:c.toString(),className:e.clx(St.ratingStar,{[St.inactive]:!(n>=c||s>=c)}),onMouseEnter:r,onClick:()=>a(c),children:n>=c||s>=c?e.jsxRuntimeExports.jsx(e.FilledStar,{}):e.jsxRuntimeExports.jsx(e.Icon,{name:"Star",fill:"var(--text-secondary)",width:22,height:21})},c))})},lu="_inputRange_iv6ow_4",uu="_inputRangeLabel_iv6ow_14",du="_progressBar_iv6ow_22",pu="_progressBarFill_iv6ow_29",mu="_stepsContainer_iv6ow_40",xu="_step_iv6ow_40",hu="_stepDot_iv6ow_57",gu="_current_iv6ow_61",ju="_active_iv6ow_69",Iu="_inactive_iv6ow_72",fu="_tooltip_iv6ow_77",pe={inputRange:lu,inputRangeLabel:uu,progressBar:du,progressBarFill:pu,stepsContainer:mu,step:xu,stepDot:hu,current:gu,default:"_default_iv6ow_65",active:ju,inactive:Iu,tooltip:fu},Su=({totalSteps:t,step:n,onStepChange:o,label:s})=>{const[i,r]=p.useState(n),a=i===1?0:(i-1)/(t-1)*100,c=u=>{r(u),o(u)};return e.jsxRuntimeExports.jsxs("div",{className:pe.inputRange,children:[s&&e.jsxRuntimeExports.jsx("div",{className:pe.inputRangeLabel,children:s}),e.jsxRuntimeExports.jsxs("div",{className:pe.progressBar,children:[e.jsxRuntimeExports.jsx("div",{className:pe.progressBarFill,style:{width:`${Math.ceil(a)}%`}}),e.jsxRuntimeExports.jsx("div",{className:pe.stepsContainer,children:[...Array(t)].map((u,h)=>{const d=h+1,g=d<=i,m=d===i;return e.jsxRuntimeExports.jsxs("div",{className:pe.step,onClick:()=>c(d),children:[e.jsxRuntimeExports.jsx("div",{className:e.clx(pe.stepDot,m?pe.current:pe.default,g?pe.active:pe.inactive)}),m&&e.jsxRuntimeExports.jsxs("div",{className:pe.tooltip,style:{transform:`translateX(calc(50% - ${a<99?"40px":"70px"}))`},children:[e.jsxRuntimeExports.jsx("span",{children:i}),e.jsxRuntimeExports.jsx("span",{children:i===1?"month":"months"})]})]},d)})})]})]})},ut=({className:t,expiresAt:n})=>{const{shopGeneral:o}=e.useStorefrontStore(),s=e.useNavigate(),{isAntistock:i}=e.useGeneralStore();return e.jsxRuntimeExports.jsxs("header",{className:`${Xe.checkoutHeader} ${t}`,children:[e.jsxRuntimeExports.jsxs("div",{className:Xe.leftContainer,children:[e.jsxRuntimeExports.jsx("div",{className:Xe.backArrow,onClick:()=>{window.history.length>2?s(-1):s("/")},children:e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowUp"})}),(o==null?void 0:o.info.logo)&&e.jsxRuntimeExports.jsx("div",{className:Xe.logoContainer,children:i?e.jsxRuntimeExports.jsx("a",{className:Xe.antistockLink,href:"https://antistock.io",target:"_blank",rel:"noopener noreferrer",children:"Antistock"}):e.jsxRuntimeExports.jsx("img",{className:Xe.logo,src:e.convertCfImageIdToUrl(o.info.logo.cfId)})})]}),n&&e.jsxRuntimeExports.jsx(Ql,{expiresAt:n})]})},_u="_checkoutPrices_vp75r_1",Cu="_priceRow_vp75r_12",vu="_label_vp75r_22",Ru="_totalRow_vp75r_26",Eu="_totalLabel_vp75r_37",yu="_totalValue_vp75r_42",ye={checkoutPrices:_u,priceRow:Cu,label:vu,totalRow:Ru,totalLabel:Eu,totalValue:yu},dt=({formatter:t,coupon:n,discount:o,totalWithDiscount:s,total:i,className:r,isShowSubtotal:a=!0,feeOrDiscount:c})=>{const u=Math.max(0,o),{priceAdjusment:h}=e.useCartStore(),{isAntistock:d}=e.useGeneralStore(),m=(()=>{const f=s!==void 0?s:i-u;return!h||c===null||c===void 0?Math.max(f,0):h.isDiscount?Math.max(f-c,0):Math.max(f+c,0)})();return e.jsxRuntimeExports.jsxs("div",{className:`${ye.checkoutPrices} ${r||""}`,style:{border:d?"1px solid var(--border-secondary)":void 0},children:[a&&e.jsxRuntimeExports.jsxs("div",{className:ye.priceRow,children:[e.jsxRuntimeExports.jsx("p",{className:ye.label,id:"md",children:"Subtotal"}),e.jsxRuntimeExports.jsx("p",{id:"md",children:t.format(i)})]}),(n||u>0)&&e.jsxRuntimeExports.jsxs("div",{className:ye.priceRow,children:[e.jsxRuntimeExports.jsxs("p",{className:ye.label,id:"md",children:["Discount ",n&&!(n!=null&&n.isFixed)&&`(${n==null?void 0:n.discount}%)`]}),e.jsxRuntimeExports.jsx("p",{id:"md",children:n&&!(n!=null&&n.isFixed)&&(n==null?void 0:n.discount)===100?`-${t.format(i)}`:`-${t.format(u)}`})]}),c!=null&&c!==0&&h&&(h.fixedAmount!==0||h.percentage!==0)&&e.jsxRuntimeExports.jsxs("div",{className:ye.priceRow,children:[e.jsxRuntimeExports.jsxs("p",{className:ye.label,id:"md-bold",children:[h.isDiscount?"Discount: ":"Fee: ",h.percentage!==0&&h.fixedAmount===0&&`(${h.percentage}%)`,h.fixedAmount!==0&&h.percentage===0&&`(${t.format(h.fixedAmount)})`,h.percentage!==0&&h.fixedAmount!==0&&`(${h.percentage}% + ${t.format(h.fixedAmount)})`]}),e.jsxRuntimeExports.jsx("p",{id:"md-bold",children:t.format(c)})]}),e.jsxRuntimeExports.jsxs("div",{className:ye.totalRow,children:[e.jsxRuntimeExports.jsx("p",{className:ye.totalLabel,id:"md-bold",children:"Total Due"}),e.jsxRuntimeExports.jsx("p",{className:ye.totalValue,id:"md-bold",children:t.format(m)})]})]})},bu="_checkoutProduct_kxeys_1",wu="_isOrder_kxeys_1",ku="_productDetails_kxeys_10",Nu="_productImage_kxeys_16",Tu="_isOrderImage_kxeys_26",Lu="_productImageAntistock_kxeys_30",Pu="_image_kxeys_35",Au="_productInfo_kxeys_40",Bu="_productInfoOverrodePrice_kxeys_47",Mu="_productHeader_kxeys_51",$u="_quantityBadge_kxeys_57",Fu="_productPrice_kxeys_75",Du="_priceContainer_kxeys_84",Hu="_originalPrice_kxeys_92",Ou="_overridePrice_kxeys_98",Uu="_deliveryCategories_kxeys_102",Wu="_customerNote_kxeys_110",Gu="_noteHeader_kxeys_117",qu="_logoContainer_kxeys_123",Vu="_shopName_kxeys_135",zu="_noteContent_kxeys_139",Zu="_productName_kxeys_145",Y={checkoutProduct:bu,isOrder:wu,productDetails:ku,productImage:Nu,isOrderImage:Tu,productImageAntistock:Lu,image:Pu,productInfo:Au,productInfoOverrodePrice:Bu,productHeader:Mu,quantityBadge:$u,productPrice:Fu,priceContainer:Du,originalPrice:Hu,overridePrice:Ou,deliveryCategories:Uu,customerNote:Wu,noteHeader:Gu,logoContainer:qu,shopName:Vu,noteContent:zu,productName:Zu},Zt=({isOrder:t,product:n})=>{var a;const{shopGeneral:o}=e.useStorefrontStore(),s=n.subscriptionSettings,{cart:i}=e.useCart(),{isAntistock:r}=e.useGeneralStore();return e.jsxRuntimeExports.jsxs("div",{className:`${Y.checkoutProduct} ${t?Y.isOrder:""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:Y.productDetails,children:[e.jsxRuntimeExports.jsx("div",{className:`${Y.productImage} ${t?Y.isOrderImage:""} ${r?Y.productImageAntistock:""}`,children:n!=null&&n.image?e.jsxRuntimeExports.jsx("img",{className:Y.image,src:e.convertCfImageIdToUrl(n.image.cfId)}):e.jsxRuntimeExports.jsx(e.Icon,{name:"Image",fill:"var(--text-secondary)"})}),e.jsxRuntimeExports.jsx("div",{className:e.clx(Y.productInfo,{[Y.productInfoOverrodePrice]:n.variantsGateways&&i.gateway&&n.variantsGateways.some(c=>c.name===i.gateway&&c.overrodePrice)}),children:e.jsxRuntimeExports.jsxs("div",{className:Y.productHeader,children:[e.jsxRuntimeExports.jsx("h2",{className:Y.productName,id:"h5",children:n.name}),e.jsxRuntimeExports.jsxs("span",{className:Y.quantityBadge,id:"md",children:[n.price.quantity,"x"]})]})}),n.chargeType==="RECURRING"&&e.jsxRuntimeExports.jsx("p",{className:Y.productPrice,id:"md",children:s&&`${e.formatPrice(s.price)} / ${e.normalizeInterval(s.recurringIntervalDays||0)}${s.entryFee?" + "+e.formatPrice(s.entryFee):""}`}),n.chargeType==="ONE_TIME"&&e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:n.variantsGateways&&i.gateway&&n.variantsGateways.some(c=>c.name===i.gateway&&c.overrodePrice)?e.jsxRuntimeExports.jsxs("div",{className:Y.priceContainer,children:[e.jsxRuntimeExports.jsx("span",{className:Y.originalPrice,id:"md",children:e.formatPrice(n.price)}),e.jsxRuntimeExports.jsx("span",{className:Y.overridePrice,id:"md",children:e.formatPrice(((a=n.variantsGateways.find(c=>c.name===i.gateway))==null?void 0:a.overrodePrice)||n.price)})]}):e.jsxRuntimeExports.jsx("p",{className:Y.productPrice,id:"md",children:e.formatPrice(n.price)})})]}),n.deliveryCategories&&e.jsxRuntimeExports.jsx("div",{className:Y.deliveryCategories,children:n.deliveryCategories.map(c=>e.jsxRuntimeExports.jsx(e.DeliveryItem,{deliveryConfiguration:c},c.id))}),n.customerNote&&e.jsxRuntimeExports.jsxs("div",{className:Y.customerNote,style:r?{border:"1px solid var(--border-secondary)"}:void 0,children:[e.jsxRuntimeExports.jsxs("div",{className:Y.noteHeader,children:[(o==null?void 0:o.info.logo)&&e.jsxRuntimeExports.jsx("div",{className:Y.logoContainer,children:e.jsxRuntimeExports.jsx("img",{src:e.convertCfImageIdToUrl(o==null?void 0:o.info.logo.cfId)})}),e.jsxRuntimeExports.jsx("p",{className:Y.shopName,id:"md",children:o==null?void 0:o.info.name})]}),e.jsxRuntimeExports.jsx("p",{className:Y.noteContent,id:"md",children:n.customerNote})]})]})},Xu="_coupon_dkjzv_1",Yu="_couponApplied_dkjzv_7",Ku="_discount_dkjzv_17",Ju="_removeButton_dkjzv_23",Qu="_removeButtonText_dkjzv_27",ed="_couponInput_dkjzv_31",td="_couponInputContainer_dkjzv_37",Pe={coupon:Xu,couponApplied:Yu,discount:Ku,removeButton:Ju,removeButtonText:Qu,couponInput:ed,couponInputContainer:td},od=({applyCoupon:t,couponData:n,discount:o,removeCoupon:s,gateway:i})=>{const[r,a]=p.useState(null),[c,u]=p.useState(!1),{isAntistock:h}=e.useGeneralStore();return e.jsxRuntimeExports.jsxs("div",{className:Pe.coupon,children:[c&&e.jsxRuntimeExports.jsx(e.ContentLoader,{speed:2,width:500,height:48,viewBox:"0 0 500 48",backgroundColor:"var(--surface-secondary)",foregroundColor:"var(--surface-disabled)",className:Pe.skeleton,style:{borderRadius:"var(--border-radius)"},children:e.jsxRuntimeExports.jsx("rect",{x:"0",y:"0",rx:"10",ry:"10",width:"100%",height:"48"})}),!c&&(n?e.jsxRuntimeExports.jsxs("div",{className:Pe.couponApplied,style:h?{border:"1px solid var(--border-secondary)"}:void 0,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Check",fill:"var(--text-success)"}),e.jsxRuntimeExports.jsxs("p",{id:"md",style:{color:h?"var(--text-primary)":void 0},children:[r," is applied"," ",e.jsxRuntimeExports.jsxs("span",{className:Pe.discount,children:["-",o," ",!n.isFixed&&`(${n.discount}%)`]})]}),e.jsxRuntimeExports.jsx("button",{className:Pe.removeButton,onClick:s,children:e.jsxRuntimeExports.jsx("span",{className:Pe.removeButtonText,children:"Remove"})})]}):e.jsxRuntimeExports.jsxs("div",{className:Pe.couponInput,children:[e.jsxRuntimeExports.jsxs("div",{className:Pe.couponInputContainer,children:[e.jsxRuntimeExports.jsx(e.Input$1,{placeholder:"Enter a discount code",value:r||"",onChange:d=>{a(d===""?null:d)}}),e.jsxRuntimeExports.jsx(e.Button$1,{onClick:async()=>{u(!0),r&&await t(r),u(!1)},disabled:!i||!r,type:"Primary",children:"Apply"})]}),!h&&!i&&e.jsxRuntimeExports.jsx(e.Tip,{type:"warning",message:"The discount is related to the method of payment. Select to enter.",id:"md"})]}))]})},nd=({cart:t,products:n,applyCoupon:o,applyCouponPending:s,coupon:i,totalAndDiscount:r,removeCoupon:a})=>{const{priceAdjusment:c}=e.useCartStore(),[u,h]=p.useState(!1),d=p.useMemo(()=>t.parts.map(l=>{const S=n.find(C=>C.id===l.productId),x=S==null?void 0:S.variants.find(C=>C.id===l.productVariantId);return l.chargeType==="RECURRING"&&h(!0),{id:(S==null?void 0:S.id)||0,image:S==null?void 0:S.images[0],name:(()=>{const C=(S==null?void 0:S.name)||"",I=(x==null?void 0:x.name)||"";return!C&&!I?"":!I||C===I?C:C?`${C} (${I})`:I})(),description:"",price:{quantity:l.quantity,amount:(x==null?void 0:x.price.amount)||0,currency:x==null?void 0:x.price.currency},subscriptionSettings:x==null?void 0:x.subscriptionSettings,chargeType:l.chargeType,variantsGateways:x==null?void 0:x.gateways}}),[t,n]),g=p.useMemo(()=>{const l=d[0];if(l!=null&&l.variantsGateways&&t.gateway){const S=l.variantsGateways.find(x=>x.name===t.gateway&&x.overrodePrice);if(S!=null&&S.overrodePrice)return S.overrodePrice.currency}return(l==null?void 0:l.price.currency)||"USD"},[d,t.gateway]);console.log("checkoutProducts",d);const m=new Intl.NumberFormat("en-US",{style:"currency",currency:g}),f=p.useMemo(()=>i&&!i.isFixed&&i.discount===100||i&&i.isFixed&&i.discount===r.total?r.total:r.totalWithDiscount?r.total-r.totalWithDiscount:0,[r,i]),j=c?(c==null?void 0:c.fixedAmount)+Math.round((r.totalWithDiscount!==void 0?r.totalWithDiscount:r.total-f)*((c==null?void 0:c.percentage)/100)):null;return e.jsxRuntimeExports.jsx("div",{className:He.checkoutItemsContainer,children:e.jsxRuntimeExports.jsxs("div",{className:He.innerContainer,children:[e.jsxRuntimeExports.jsx(ut,{}),e.jsxRuntimeExports.jsxs("div",{className:He.headerSection,children:[e.jsxRuntimeExports.jsx("header",{className:He.header,children:e.jsxRuntimeExports.jsx("h1",{id:"h3",children:"Checkout"})}),e.jsxRuntimeExports.jsx("div",{className:He.productsContainer,children:d.map(l=>e.jsxRuntimeExports.jsx(Zt,{product:l},l.id))}),e.jsxRuntimeExports.jsx("div",{className:He.couponContainer,children:e.jsxRuntimeExports.jsx(od,{applyCoupon:o,applyCouponPending:s,couponData:i,discount:m.format(f),removeCoupon:a,gateway:t.gateway})}),e.jsxRuntimeExports.jsx(dt,{formatter:m,coupon:i,total:r.total,discount:f,totalWithDiscount:r.totalWithDiscount,feeOrDiscount:u?null:j})]}),e.jsxRuntimeExports.jsx("div",{className:He.checkoutFooter,children:e.jsxRuntimeExports.jsx(Ce,{})})]})})},sd="_checkoutOperational_b62bq_1",rd="_innerContainer_b62bq_17",id="_innerContainerAntistock_b62bq_27",ad="_paymentMethodsSectionAntistock_b62bq_39",cd="_continueButtonAntistock_b62bq_49",ld="_checkoutFooterAntistock_b62bq_59",ud="_antistock_b62bq_70",dd="_paymentMethodsSection_b62bq_39",pd="_socialConnectSection_b62bq_81",md="_socialConnectLabel_b62bq_84",xd="_socialConnectContent_b62bq_88",hd="_continueButton_b62bq_49",gd="_button_b62bq_96",jd="_checkoutFooter_b62bq_59",ae={checkoutOperational:sd,innerContainer:rd,innerContainerAntistock:id,paymentMethodsSectionAntistock:ad,continueButtonAntistock:cd,checkoutFooterAntistock:ld,antistock:ud,paymentMethodsSection:dd,socialConnectSection:pd,socialConnectLabel:md,socialConnectContent:xd,continueButton:hd,button:gd,checkoutFooter:jd},Id="_customFields_uhcib_2",fd="_checkboxWrapper_uhcib_9",Sd="_textareaWrapper_uhcib_16",_d="_inputWrapper_uhcib_17",Cd="_requiredStar_uhcib_27",Ke={customFields:Id,checkboxWrapper:fd,textareaWrapper:Sd,inputWrapper:_d,requiredStar:Cd},vd=({customFields:t,setCustomFields:n})=>{if(t.length===0)return null;const o=t.map(s=>e.jsxRuntimeExports.jsx(Rd,{customField:s,setCustomFields:n},s.name));return e.jsxRuntimeExports.jsx("div",{className:Ke.customFields,children:o})},Rd=({customField:t,setCustomFields:n})=>{const o=s=>{n(i=>i.map(r=>r.name===t.name?{...r,value:s}:r))};return e.jsxRuntimeExports.jsx(Ed,{value:t.value??"",placeholder:t.placeholder,required:t.required,defaultValue:t.defaultValue,type:t.type,onValueChange:o,label:t.name,regex:t.regex})},Ed=({label:t,type:n,defaultValue:o,value:s,placeholder:i,regex:r,required:a,onValueChange:c})=>{if(p.useEffect(()=>{s===""&&o!==void 0&&c(String(o))},[]),n===e.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox)return e.jsxRuntimeExports.jsxs("label",{className:Ke.checkboxWrapper,children:[e.jsxRuntimeExports.jsx(e.Checkbox,{value:s==="true",onChange:h=>c(h?"true":"false")}),e.jsxRuntimeExports.jsxs("p",{className:Ke.checkboxLabel,children:[t,a&&e.jsxRuntimeExports.jsx("span",{className:Ke.requiredStar,children:"*"})]})]});if(n===e.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Hidden)return e.jsxRuntimeExports.jsx("input",{type:"hidden",value:String(o??""),required:a});const u=h=>{(n===e.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?/^\d*$/:r?new RegExp(r):/.*/).test(h)&&c(h)};return n===e.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Textarea?e.jsxRuntimeExports.jsx("div",{className:Ke.textareaWrapper,children:e.jsxRuntimeExports.jsx(e.Textarea$1,{label:t,value:s,placeholder:i,onChange:u,required:a})}):e.jsxRuntimeExports.jsx("div",{className:Ke.inputWrapper,children:e.jsxRuntimeExports.jsx(e.Input$1,{type:n===e.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?"number":"text",placeholder:n===e.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?"Type something number...":i,label:t,value:s,required:a,onChange:u})})},yd="_connectedContainer_1rxr8_1",bd="_userInfo_1rxr8_10",wd="_avatar_1rxr8_16",kd="_avatarImage_1rxr8_26",_t={connectedContainer:yd,userInfo:bd,avatar:wd,avatarImage:kd},Nd=({customerEmail:t})=>{const{discordInfo:n,setDiscordInfo:o}=e.useDiscordStore(),{notifications:s,setNotifications:i}=e.useNotificationStore(),[r,a]=p.useState(!1),[c,u]=p.useState(0),[h,d]=p.useState(null),g=20,m=l=>{var S,x,C,I;return(x=(S=l==null?void 0:l.response)==null?void 0:S.data)!=null&&x.error?l.response.data.error:(I=(C=l==null?void 0:l.response)==null?void 0:C.data)!=null&&I.message?l.response.data.message:l!=null&&l.message?l.message:"Failed to connect to Discord. Please try again later."},f=(l,S)=>{i([...s,{id:e.v4(),message:l,status:S}])};p.useEffect(()=>{if(h&&r){const l=setInterval(()=>{h.closed&&(clearInterval(l),a(!1),d(null))},1e3);return()=>clearInterval(l)}},[h,r]);const j=()=>{t.trim()!==""&&(a(!0),u(0),fn({customerEmail:t,tsId:e.getTsId()}).then(({data:l})=>{const S=window.open(l.redirectUrl);d(S),(!S||S.closed||typeof S.closed>"u")&&setTimeout(()=>{const I=document.createElement("a");I.href=l.redirectUrl,I.target="_blank",I.click()});let x;const C=()=>{if(u(I=>I+1),c>=g||S&&S.closed){c>=g&&f("Authorization timeout. Please try again.","error"),a(!1),clearTimeout(x);return}Sn({id:l.id,customerEmail:t}).then(({data:I})=>{o({authorized:!0,id:l.id,avatar:I.avatar,username:I.username}),S&&S.close(),a(!1),d(null),f("Discord successfully connected!","success"),clearTimeout(x)}).catch(I=>{var R;if(console.log("Waiting for authorization...",I,{newWindow:S}),S&&S.closed){a(!1),clearTimeout(x);return}if((R=I==null?void 0:I.response)!=null&&R.status&&I.response.status!==404&&I.response.status>=400){f(m(I),"error"),a(!1),clearTimeout(x);return}clearTimeout(x),x=setTimeout(C,1500)})};C()}).catch(l=>{console.log("Could not initiate Discord authorization",l),f(m(l),"error"),a(!1)}))};return n!=null&&n.authorized?e.jsxRuntimeExports.jsxs("div",{className:_t.connectedContainer,children:[e.jsxRuntimeExports.jsxs("div",{className:_t.userInfo,children:[e.jsxRuntimeExports.jsx("div",{className:_t.avatar,children:n.avatar?e.jsxRuntimeExports.jsx("img",{className:_t.avatarImage,src:`https://cdn.discordapp.com/avatars/${n.id}/${n.avatar}.png?size=256`}):e.jsxRuntimeExports.jsx(e.Icon,{name:"UserCircle"})}),e.jsxRuntimeExports.jsx("p",{children:n.username}),e.jsxRuntimeExports.jsx(Xl,{})]}),e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:j,children:"Reconnect"})]}):e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:j,style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",gap:"10px"},disabled:r,children:r?e.jsxRuntimeExports.jsx(e.Loader,{}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"DiscordLogo"}),e.jsxRuntimeExports.jsx(e.StableText,{children:"Connect Your Discord"})]})})},Td="_paymentMethodsContainer_1pfqr_2",Ld="_antistock_1pfqr_15",xo={paymentMethodsContainer:Td,antistock:Ld},Pd="_bottomSheet_1x8kc_1",Ad="_content_1x8kc_8",Bd="_description_1x8kc_11",Md="_title_1x8kc_15",$d="_buttonGroup_1x8kc_19",Fd="_buttonWrapper_1x8kc_29",Dd="_fullWidthButton_1x8kc_32",Hd="_modal_1x8kc_36",Od="_header_1x8kc_43",Te={bottomSheet:Pd,content:Ad,description:Bd,title:Md,buttonGroup:$d,buttonWrapper:Fd,fullWidthButton:Dd,modal:Hd,header:Od},Ud=({setIsOpen:t,balance:n})=>{const o=e.useNavigate(),{setIsOpen:s}=e.useModalStore(),i=()=>{o("/top-up?redirectRoute=checkout")};function r(){s(!1),setTimeout(()=>{t(!1)},300)}return e.jsxRuntimeExports.jsxs("div",{className:Te.modal,onClick:a=>a.stopPropagation(),children:[e.jsxRuntimeExports.jsxs("div",{className:Te.header,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",className:Te.title,children:"Insufficient Customer Balance"}),e.jsxRuntimeExports.jsx(e.Icon,{name:"X",hoverable:!0,onClick:r,fill:"var(--text-primary)"})]}),e.jsxRuntimeExports.jsxs("div",{className:Te.bottomSheet,children:[e.jsxRuntimeExports.jsx("div",{className:Te.content,children:e.jsxRuntimeExports.jsxs("p",{className:Te.description,children:["You currently have ",n&&e.formatPrice(n)," in your balance. After topping up the required amount, you can continue to checkout."]})}),e.jsxRuntimeExports.jsxs("div",{className:Te.buttonGroup,children:[e.jsxRuntimeExports.jsx("div",{className:Te.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:r,children:"Cancel"})}),e.jsxRuntimeExports.jsx("div",{className:Te.fullWidthButton,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",onClick:i,children:"Add Balance"})})]})]})]})},Co=({align:t,gateway:n,gatewayDisplayName:o,selected:s,onSelect:i,total:r,onSignInClick:a,reversed:c,isAntistock:u=!1})=>{const{token:h}=e.useStorefrontStore(),{balance:d}=e.useCustomerDashboardStore(),[g,m]=p.useState(!1),{setIsOpen:f}=e.useModalStore(),j=l=>{l.stopPropagation(),i==null||i(n),d&&d.amount<r&&(m(!0),f(!0))};return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:e.clx(e.styles$3.paymentMethod,{[e.styles$3.selected]:s,[e.styles$3.alignColumn]:t==="column",[e.styles$3.reversed]:c&&!u,[e.styles$3.antistock]:u}),onClick:j,children:u?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("p",{className:e.styles$3.paymentText,id:"md",children:[o," ",e.jsxRuntimeExports.jsxs("span",{className:e.styles$3.balanceText,id:"md",children:["(",h?d&&e.formatPrice(d):e.jsxRuntimeExports.jsx("a",{className:e.styles$3.signInLink,onClick:a,id:"md",children:"Sign in"}),")"]})]}),e.jsxRuntimeExports.jsx("div",{className:e.styles$3.iconContainer,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Wallet",fill:"var(--text-primary)",width:20,height:20})})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("p",{className:e.styles$3.paymentText,id:"md",children:[o," ",e.jsxRuntimeExports.jsxs("span",{className:e.styles$3.balanceText,id:"md",children:["(",h?d&&e.formatPrice(d):e.jsxRuntimeExports.jsx("a",{className:e.styles$3.signInLink,onClick:a,id:"md",children:"Sign in"}),")"]})]}),e.jsxRuntimeExports.jsx("div",{className:e.styles$3.iconContainer,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Wallet",fill:"var(--text-primary)",width:20,height:20})})]})}),g&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>m(!1),children:e.jsxRuntimeExports.jsx(Ud,{setIsOpen:m,balance:d})})]})},vo=({possibleGateways:t,setGateway:n,totalAndDiscount:o,onSignInClick:s,setPaymentMethod:i,isAntistock:r=!1})=>{const[a,c]=p.useState(),[u,h]=p.useState(),{setPriceAdjustment:d}=e.useCartStore(),[g,m]=p.useState(null),f=(j,l)=>{var S;u!==l&&(n(l),d(((S=g==null?void 0:g.find(x=>x.name===l))==null?void 0:S.priceAdjustment)||null)),i(j),c(j),h(l)};return p.useEffect(()=>{if(g&&g.length>0){const j=g[0];if(j.name==="Balance")h(j.name),n(j.name),d(j.priceAdjustment||null);else if(j.paymentMethods&&j.paymentMethods.length>0){const l=j.paymentMethods[0];c(l),h(j.name),n(j.name),i(l),d(j.priceAdjustment||null)}}},[g]),p.useEffect(()=>{const j=async()=>{const{data:l}=await e.fetchGatewaysDetail([...t.availableGateways,...t.requiresSignInGateways]);m(l)};t.availableGateways.length&&j()},[]),p.useLayoutEffect(()=>{d(null)},[]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:g&&e.jsxRuntimeExports.jsx("div",{className:e.clx(xo.paymentMethodsContainer,{[xo.antistock]:r}),children:g==null?void 0:g.map(j=>j.name==="Balance"?e.jsxRuntimeExports.jsx(Co,{gateway:j.name,gatewayDisplayName:j.displayName,onSelect:l=>{h(l),u!==l&&n(l)},selected:j.name===u,total:o.total,onSignInClick:s,reversed:!0,isAntistock:r},j.name):j.paymentMethods.map(l=>e.jsxRuntimeExports.jsx(e.CheckoutPaymentMethod,{paymentMethod:l,gateway:j.name,gatewayDisplayName:j.displayName,gatewayLogoCfId:j.logoCfImageId,poweredByLogoCfId:j.poweredByImageCfImageId,onSelect:S=>f(S,j.name),selected:a===l&&u===j.name,isAntistock:r},`${j.name}-${l}`)))})})},Wd="_modal_14r0b_1",Gd={modal:Wd},qd=({setIsOpen:t})=>{const{token:n}=e.useStorefrontStore(),{setIsOpen:o}=e.useModalStore();p.useEffect(()=>{n&&s()},[n]);const s=()=>{o(!1),setTimeout(()=>{t(!1)},300)};return e.jsxRuntimeExports.jsx("div",{className:Gd.modal,onClick:i=>i.stopPropagation(),children:e.jsxRuntimeExports.jsx(e.Auth,{inModal:!0})})},Vd=({getPossibleGateways:t,setGateway:n,getDiscordSettings:o,cart:s,products:i,submitCart:r,reset:a,setCustomFieldsToCart:c,totalAndDiscount:u,setDiscordSocialConnectId:h,setPaymentMethod:d,isAntistock:g})=>{const m=p.useMemo(()=>o(),[]),[f,j]=p.useState([]),{balance:l,setBalance:S}=e.useCustomerDashboardStore(),{token:x}=e.useStorefrontStore(),{executeRecaptcha:C}=e.useReCaptcha(),{discordInfo:I}=e.useDiscordStore(),{customerEmail:R,setCustomerEmail:_}=e.useCartStore(),v=I!=null&&I.authorized?I.id:void 0,w=e.useNavigate(),F=p.useMemo(()=>t(),[s.parts]),[K,Z]=p.useState(!1),{setIsOpen:M}=e.useModalStore(),{notifications:b,setNotifications:E}=e.useNotificationStore();p.useEffect(()=>{const A=e.getCommonCustomFields(s.parts,i).map(W=>W.type===e.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox?{...W,value:String(W.defaultValue)}:W);j([...A])},[]),p.useEffect(()=>{const N=e.getCommonCustomFields(s.parts,i);j(A=>{const W=new Map(A.map(T=>[T.name,T]));return N.map(T=>{const q=W.get(T.name);return q&&q.value?{...T,value:q.value}:T.type===e.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox?{...T,value:String(T.defaultValue)}:T})})},[s.parts,i]),p.useEffect(()=>{x&&(async()=>{const A=await e.getBalance();S(A)})()},[x]);function D(N){return N&&/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(N)}const J=()=>{const N=[];return f.forEach(A=>{var W;A.required&&!((W=A.value)!=null&&W.toString().trim())&&N.push({message:`Field "${A.name}" is required.`,status:"error",id:e.v4()})}),N.length>0?(E([...b,...N]),!1):!0},U=async N=>{if(N.stopPropagation(),s.gateway==="Balance"&&!x){M(!0),Z(!0);return}if(!J())return;const A=Object.fromEntries(f.map(T=>[T.name,T.value||""]));c({...A}),v&&m.isEnabled&&h(v);const W=await C();if(W){const T=await r(W),q=JSON.parse(localStorage.getItem("orders")||"{}");if(Object.keys(q).length>10){const ke=Date.now()-864e5;Object.keys(q).forEach(ve=>{q[ve].createdAt<=ke&&delete q[ve]})}"order"in T?q[T.order.id]={createdAt:Date.now(),fullAccessToken:T.order.fullAccessToken}:q[T.id]={createdAt:Date.now(),fullAccessToken:T.fullAccessToken},localStorage.setItem("orders",JSON.stringify(q)),w(`/orders/${"order"in T?T.order.id:T.id}/${"order"in T?T.order.fullAccessToken:T.fullAccessToken}`),setTimeout(()=>a(),2e3)}};return e.jsxRuntimeExports.jsxs("div",{className:ae.checkoutOperational,style:g?{borderLeft:"1px solid var(--border-secondary)"}:void 0,children:[e.jsxRuntimeExports.jsxs("div",{className:`${ae.innerContainer} ${g?ae.innerContainerAntistock:""}`,children:[g?e.jsxRuntimeExports.jsx("h4",{style:{fontSize:"var(--input-label-size)",color:"var(--text-secondary)",paddingBottom:"12px",fontWeight:"400"},children:"Select Payment Method"}):null,s.parts.length>0&&e.jsxRuntimeExports.jsx(vo,{possibleGateways:F,setGateway:n,setPaymentMethod:d,balance:l,totalAndDiscount:u,onSignInClick:()=>{Z(!0),M(!0)},isAntistock:g}),e.jsxRuntimeExports.jsx("div",{className:e.clx(ae.paymentMethodsSection,{[ae.antistock]:g,[ae.paymentMethodsSectionAntistock]:g}),children:e.jsxRuntimeExports.jsx(e.Input$1,{placeholder:"your@email.com",value:R||"",onChange:N=>_(N),disabled:!!x,label:"Email Address"})}),e.jsxRuntimeExports.jsx(vd,{customFields:f,setCustomFields:j}),m.isEnabled&&e.jsxRuntimeExports.jsxs("div",{className:ae.socialConnectSection,children:[e.jsxRuntimeExports.jsx("p",{className:ae.socialConnectLabel,id:"md",children:"Social Connect"}),e.jsxRuntimeExports.jsx("div",{className:ae.socialConnectContent,children:e.jsxRuntimeExports.jsx(Nd,{customerEmail:R||""})})]}),e.jsxRuntimeExports.jsxs("div",{className:`${ae.continueButton} ${g?ae.continueButtonAntistock:""}`,children:[e.jsxRuntimeExports.jsx(e.Button$1,{onClick:U,disabled:!s.gateway||!D(R||"")||m.isRequired&&!(I!=null&&I.authorized),className:ae.button,children:"Continue to Checkout"}),e.jsxRuntimeExports.jsx(e.TermsOfService,{}),e.jsxRuntimeExports.jsx(e.SecuredBySsl,{isAntistock:g})]}),e.jsxRuntimeExports.jsx(Ce,{className:`${ae.checkoutFooter} ${g?ae.checkoutFooterAntistock:""}`})]}),K&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>Z(!1),children:e.jsxRuntimeExports.jsx(qd,{setIsOpen:Z})})]})},zd="_mt1_1l62z_1",Zd="_notifyBlock_1l62z_13",Xd="_notifyHeader_1l62z_19",Yd="_notifyContent_1l62z_25",Kd="_buttonBlock_1l62z_30",Jd="_imageBlock_1l62z_34",Qd="_imageContainer_1l62z_42",ep="_sectionBlock_1l62z_54",tp="_sectionTitle_1l62z_61",op="_sectionSubtitle_1l62z_64",np="_inputContainer_1l62z_69",_e={mt1:zd,notifyBlock:Zd,notifyHeader:Xd,notifyContent:Yd,buttonBlock:Kd,imageBlock:Jd,imageContainer:Qd,sectionBlock:ep,sectionTitle:tp,sectionSubtitle:op,inputContainer:np},sp=({props:t})=>{const n=e.useCopy();return e.jsxRuntimeExports.jsx("div",{className:_e.mt1,children:e.jsxRuntimeExports.jsxs("div",{className:_e.inputContainer,children:[e.jsxRuntimeExports.jsx(e.Input$1,{value:t.text,disabled:!0,onChange:()=>{}}),t.shownCopyButton&&e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:()=>n(t.text),children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Copy"})})]})})},rp=({props:t})=>e.jsxRuntimeExports.jsx(e.Button$1,{className:_e.buttonBlock,onClick:()=>window.open(t.url,"_blank","noopener"),children:t.text}),ip=({props:t})=>e.jsxRuntimeExports.jsx("div",{className:_e.imageBlock,children:e.jsxRuntimeExports.jsx("div",{className:_e.imageContainer,children:e.jsxRuntimeExports.jsx("img",{src:t.src,alt:""})})}),ap=({props:t})=>e.jsxRuntimeExports.jsxs("div",{className:_e.notifyBlock,children:[e.jsxRuntimeExports.jsxs("div",{className:_e.notifyHeader,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Info",width:24,height:24,fill:"var(--text-secondary)"}),e.jsxRuntimeExports.jsx("p",{children:t.heading})]}),e.jsxRuntimeExports.jsx("p",{className:_e.notifyContent,children:t.content})]}),cp=({props:t})=>{var n;return e.jsxRuntimeExports.jsxs("div",{className:_e.sectionBlock,children:[e.jsxRuntimeExports.jsx("p",{className:_e.sectionTitle,children:t.title}),e.jsxRuntimeExports.jsx("span",{className:_e.sectionSubtitle,children:t.subTitle}),(n=t.children)==null?void 0:n.map((o,s)=>e.jsxRuntimeExports.jsx(Vt,{block:o},s))]})},Vt=({block:t})=>{switch(t.type){case"Section":return e.jsxRuntimeExports.jsx(cp,{...t});case"ReadOnlyTextInput":return e.jsxRuntimeExports.jsx(sp,{...t});case"Notify":return e.jsxRuntimeExports.jsx(ap,{...t});case"Button":return e.jsxRuntimeExports.jsx(rp,{...t});case"Image":return e.jsxRuntimeExports.jsx(ip,{...t});default:return null}},lp="_bottomSheet_1x4sq_1",up="_content_1x4sq_8",dp="_agreementList_1x4sq_11",pp="_agreementItem_1x4sq_16",mp="_warning_1x4sq_23",xp="_buttonGroup_1x4sq_31",hp="_buttonWrapper_1x4sq_41",gp="_fullWidthButton_1x4sq_44",jp="_modal_1x4sq_48",Ip="_header_1x4sq_55",me={bottomSheet:lp,content:up,agreementList:dp,agreementItem:pp,warning:mp,buttonGroup:xp,buttonWrapper:hp,fullWidthButton:gp,modal:jp,header:Ip},fp=({setIsOpen:t,price:n})=>{const[o,s]=p.useState({agreeToSendAsFF:!1,agreeToSend:!1,agreeToNotAddNote:!1}),{setIsOpen:i}=e.useModalStore(),r=()=>{i(!1),setTimeout(()=>{t(!1)},300)};return e.jsxRuntimeExports.jsxs("div",{className:me.modal,onClick:a=>a.stopPropagation(),children:[e.jsxRuntimeExports.jsxs("div",{className:me.header,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Note"}),e.jsxRuntimeExports.jsx(e.Icon,{name:"X",hoverable:!0,onClick:r,fill:"var(--text-primary)"})]}),e.jsxRuntimeExports.jsxs("div",{className:me.bottomSheet,children:[e.jsxRuntimeExports.jsxs("div",{className:me.content,children:[e.jsxRuntimeExports.jsxs("div",{className:me.agreementList,children:[e.jsxRuntimeExports.jsxs("label",{className:me.agreementItem,children:[e.jsxRuntimeExports.jsx(e.Checkbox,{value:o.agreeToSendAsFF,onChange:a=>s({...o,agreeToSendAsFF:a})}),e.jsxRuntimeExports.jsx("p",{children:"I agree to send the payment as friends & family"})]}),e.jsxRuntimeExports.jsxs("label",{className:me.agreementItem,children:[e.jsxRuntimeExports.jsx(e.Checkbox,{value:o.agreeToSend,onChange:a=>s({...o,agreeToSend:a})}),e.jsxRuntimeExports.jsxs("p",{children:["I agree to send the payment of ",e.formatPrice(n)," ",n.currency]})]}),e.jsxRuntimeExports.jsxs("label",{className:me.agreementItem,children:[e.jsxRuntimeExports.jsx(e.Checkbox,{value:o.agreeToNotAddNote,onChange:a=>s({...o,agreeToNotAddNote:a})}),e.jsxRuntimeExports.jsx("p",{children:"I agree to not add a note to this payment"})]})]}),e.jsxRuntimeExports.jsx("div",{className:me.warning,children:e.jsxRuntimeExports.jsxs("p",{children:["Please note that you are required to send the exact payment of ",e.formatPrice(n)," ",n.currency,". If you were to send any amount over or below, your funds will be lost."]})})]}),e.jsxRuntimeExports.jsxs("div",{className:me.buttonGroup,children:[e.jsxRuntimeExports.jsx("div",{className:me.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",children:e.jsxRuntimeExports.jsx("span",{className:"text-[var(--text-secondary)]",children:"Cancel"})})}),e.jsxRuntimeExports.jsx("div",{className:me.fullWidthButton,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",disabled:!(o.agreeToSendAsFF&&o.agreeToNotAddNote&&o.agreeToSend),onClick:r,children:"Continue to Payment"})})]})]})]})},Sp="_chargeItemsContainer_vynct_5",_p="_chargeItemsInner_vynct_18",Cp="_productsContainer_vynct_25",vp="_antistockLayout_vynct_40",Rp="_mainContentAntistock_vynct_53",Ep="_desktopTrackPayment_vynct_64",yp="_desktopFooter_vynct_73",bp="_footerContainerAntistock_vynct_94",wp="_chargeHeader_vynct_107",kp="_chargeTitle_vynct_115",Np="_chargeDescription_vynct_121",Tp="_copyButton_vynct_127",Lp="_productsList_vynct_139",Pp="_footerContainer_vynct_94",ce={chargeItemsContainer:Sp,chargeItemsInner:_p,productsContainer:Cp,antistockLayout:vp,mainContentAntistock:Rp,desktopTrackPayment:Ep,desktopFooter:yp,footerContainerAntistock:bp,chargeHeader:wp,chargeTitle:kp,chargeDescription:Np,copyButton:Tp,productsList:Lp,footerContainer:Pp},Ap=({charge:t})=>{var a;const n=e.useCopy(),{isAntistock:o}=e.useGeneralStore(),s=(t==null?void 0:t.price.currency)||"USD",i=new Intl.NumberFormat("en-US",{style:"currency",currency:s}),r=p.useMemo(()=>{var c;return((c=t==null?void 0:t.order)==null?void 0:c.partOrders.map(u=>{var h,d,g,m;return{id:(u==null?void 0:u.id)||0,image:u.productWithVariant.image,name:(()=>{var l,S;const f=((l=u.productWithVariant)==null?void 0:l.name)||"",j=((S=u.productWithVariant)==null?void 0:S.variantName)||"";return!f&&!j?"":!j||f===j?f:f?`${f} (${j})`:j})(),description:"",price:{quantity:u.quantity,amount:((h=u.productWithVariant)==null?void 0:h.price.amount)||0,currency:(d=u.productWithVariant)==null?void 0:d.price.currency},subscriptionSettings:(g=t.order)!=null&&g.subscriptionOrderId?(m=u.productWithVariant)==null?void 0:m.subscriptionSettings:null}}))||[]},[t]);return e.jsxRuntimeExports.jsx("div",{className:ce.chargeItemsContainer,children:e.jsxRuntimeExports.jsxs("div",{className:ce.chargeItemsInner,children:[e.jsxRuntimeExports.jsx(ut,{expiresAt:t==null?void 0:t.expiresAt}),e.jsxRuntimeExports.jsxs("div",{className:`${ce.productsContainer} ${o?ce.antistockLayout:""}`,children:[(t==null?void 0:t.name)&&e.jsxRuntimeExports.jsxs("header",{className:ce.chargeHeader,children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h1",{className:ce.chargeTitle,id:"h5",children:t.name}),t.description&&e.jsxRuntimeExports.jsx("p",{className:ce.chargeDescription,id:"md",children:t.description})]}),((a=t.order)==null?void 0:a.id)&&!o&&e.jsxRuntimeExports.jsxs(e.Button$1,{type:"Secondary",className:ce.copyButton,onClick:()=>{var c;return n(((c=t.order)==null?void 0:c.id)||"")},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Copy"}),"Copy Order ID"]})]}),e.jsxRuntimeExports.jsxs("div",{className:o?ce.mainContentAntistock:"",style:o?void 0:{flex:1},children:[!!r.length&&e.jsxRuntimeExports.jsx("div",{className:ce.productsList,children:r.map(c=>e.jsxRuntimeExports.jsx(Zt,{product:c},c.id))}),e.jsxRuntimeExports.jsx(dt,{formatter:i,coupon:null,total:(t==null?void 0:t.price.amount)||0,discount:0,totalWithDiscount:(t==null?void 0:t.price.amount)||0,isShowSubtotal:!1}),o&&t&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:ce.desktopTrackPayment,children:e.jsxRuntimeExports.jsx(e.TrackPayment,{timeline:t.timeline})}),e.jsxRuntimeExports.jsx(Ce,{className:ce.desktopFooter})]})]}),!o&&e.jsxRuntimeExports.jsx(Ce,{className:`${ce.footerContainer} ${o?ce.footerContainerAntistock:""}`})]})]})})},Bp="_checkoutOrderMainData_hqf60_1",Mp="_orderDetailRow_hqf60_6",$p="_chargeIdRow_hqf60_16",Fp="_detailLabel_hqf60_25",Dp="_detailValue_hqf60_29",Hp="_chargeIdContainer_hqf60_33",Op="_chargeId_hqf60_16",Up="_copyIcon_hqf60_51",oe={checkoutOrderMainData:Bp,orderDetailRow:Mp,chargeIdRow:$p,detailLabel:Fp,detailValue:Dp,chargeIdContainer:Hp,chargeId:Op,copyIcon:Up},Ro=({lastUpdate:t,invoiceId:n,email:o,paymentType:s,orderId:i})=>{const r=e.useCopy(),[a,c]=p.useState(null),u=a==null?void 0:a.find(d=>d.name===s);p.useEffect(()=>{a||(async()=>{if(!s)return;const g=[s],m=await e.getGatewaysDetail(g);c(m)})()},[s,a]);const h=d=>{const g=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],m=d.getDate().toString().padStart(2,"0"),f=g[d.getMonth()],j=d.getFullYear(),l=d.getHours(),S=d.getMinutes().toString().padStart(2,"0"),x=d.getSeconds().toString().padStart(2,"0"),C=l>=12?"PM":"AM",I=(l%12||12).toString().padStart(2,"0");return`${f} ${m}, ${j} at ${I}:${S}:${x} ${C}`};return e.jsxRuntimeExports.jsxs("div",{className:oe.checkoutOrderMainData,children:[e.jsxRuntimeExports.jsxs("div",{className:oe.orderDetailRow,children:[e.jsxRuntimeExports.jsx("p",{className:oe.detailLabel,id:"md",children:"Last Updated"}),e.jsxRuntimeExports.jsx("p",{className:oe.detailValue,id:"md",children:h(new Date(t))})]}),s&&e.jsxRuntimeExports.jsxs("div",{className:oe.orderDetailRow,children:[e.jsxRuntimeExports.jsx("p",{className:oe.detailLabel,id:"md",children:"Payment Type"}),e.jsxRuntimeExports.jsx("p",{className:oe.detailValue,id:"md",children:u==null?void 0:u.displayName})]}),e.jsxRuntimeExports.jsxs("div",{className:oe.orderDetailRow,children:[e.jsxRuntimeExports.jsx("p",{className:oe.detailLabel,id:"md",children:"Email"}),e.jsxRuntimeExports.jsx("p",{className:oe.detailValue,id:"md",children:o})]}),n&&e.jsxRuntimeExports.jsxs("div",{className:oe.chargeIdRow,children:[e.jsxRuntimeExports.jsx("p",{className:oe.detailLabel,id:"md",children:"Charge ID"}),e.jsxRuntimeExports.jsxs("div",{className:oe.chargeIdContainer,children:[e.jsxRuntimeExports.jsx("p",{className:oe.chargeId,id:"md",children:n}),e.jsxRuntimeExports.jsx("div",{className:oe.copyIcon,onClick:()=>r(n),children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Copy"})})]})]}),i&&e.jsxRuntimeExports.jsxs("div",{className:oe.chargeIdRow,children:[e.jsxRuntimeExports.jsx("p",{className:oe.detailLabel,id:"md",children:"Order ID"}),e.jsxRuntimeExports.jsxs("div",{className:oe.chargeIdContainer,children:[e.jsxRuntimeExports.jsx("p",{className:oe.chargeId,id:"md",children:i}),e.jsxRuntimeExports.jsx("div",{className:oe.copyIcon,onClick:()=>r(i),children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Copy"})})]})]})]})},Wp="_bottomSheet_1yai1_1",Gp="_formContainer_1yai1_8",qp="_error_1yai1_14",Vp="_buttonGroup_1yai1_18",zp="_buttonWrapper_1yai1_28",Zp="_fullWidthButton_1yai1_31",Xp="_modal_1yai1_41",Yp="_header_1yai1_48",Ae={bottomSheet:Wp,formContainer:Gp,error:qp,buttonGroup:Vp,buttonWrapper:zp,fullWidthButton:Zp,modal:Xp,header:Yp},Kp=({chargeId:t,setIsOpen:n})=>{const[o,s]=p.useState(""),[i,r]=p.useState(""),{setIsOpen:a}=e.useModalStore(),c=d=>{try{return new URL(d),!0}catch{return!1}},u=async d=>{if(d.preventDefault(),!o){r("The link field cannot be empty.");return}if(!c(o)){r("Please enter a valid URL");return}await mn({url:o},t)&&(alert("CashApp successfully verified"),n(!1))},h=()=>{a(!1),setTimeout(()=>{n(!1)},300)};return e.jsxRuntimeExports.jsxs("div",{className:Ae.modal,onClick:d=>d.stopPropagation(),children:[e.jsxRuntimeExports.jsxs("div",{className:Ae.header,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",children:"CashApp Verify"}),e.jsxRuntimeExports.jsx(e.Icon,{name:"X",hoverable:!0,onClick:h,fill:"var(--text-primary)"})]}),e.jsxRuntimeExports.jsx("form",{onSubmit:u,children:e.jsxRuntimeExports.jsxs("div",{className:Ae.bottomSheet,children:[e.jsxRuntimeExports.jsx("div",{className:Ae.formContainer,children:e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx(e.Input$1,{value:o,onChange:d=>{s(d),r("")},label:"Enter Cashapp Link",placeholder:"https://cash.app/payments/0000"}),i&&e.jsxRuntimeExports.jsx("p",{className:Ae.error,children:i})]})}),e.jsxRuntimeExports.jsxs("div",{className:Ae.buttonGroup,children:[e.jsxRuntimeExports.jsx("div",{className:Ae.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:h,children:"Cancel"})}),e.jsxRuntimeExports.jsx("div",{className:Ae.fullWidthButton,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",children:"Verify"})})]})]})})]})},Jp="_container_1opbn_1",Qp="_productDetails_1opbn_8",em="_imageContainer_1opbn_14",tm="_image_1opbn_14",om="_textContainer_1opbn_32",nm="_header_1opbn_40",sm="_title_1opbn_46",rm="_price_1opbn_53",im="_badgeContainer_1opbn_57",am="_description_1opbn_61",be={container:Jp,productDetails:Qp,imageContainer:em,image:tm,textContainer:om,header:nm,title:sm,price:rm,badgeContainer:im,description:am},cm=({subscription:t})=>e.jsxRuntimeExports.jsxs("div",{className:be.container,children:[e.jsxRuntimeExports.jsxs("div",{className:be.productDetails,children:[e.jsxRuntimeExports.jsx("div",{className:be.imageContainer,children:t!=null&&t.image?e.jsxRuntimeExports.jsx("img",{className:be.image,src:e.convertCfImageIdToUrl(t.image.cfId),alt:t==null?void 0:t.name}):e.jsxRuntimeExports.jsx(e.Icon,{name:"Image"})}),e.jsxRuntimeExports.jsxs("div",{className:be.textContainer,children:[e.jsxRuntimeExports.jsx("div",{className:be.header,children:e.jsxRuntimeExports.jsx("h2",{className:be.title,children:t.name})}),e.jsxRuntimeExports.jsxs("p",{className:be.price,children:[e.formatPrice(t.price)," / ",t.recurringInterval]})]}),e.jsxRuntimeExports.jsx("div",{className:be.badgeContainer,children:e.jsxRuntimeExports.jsx(e.SubscriptionStatusBadge,{status:t.status})})]}),t.description&&e.jsxRuntimeExports.jsx(e.Markdown,{className:be.description,children:t.description})]}),lm="_card_69liy_1",um="_price_69liy_10",dm="_interval_69liy_17",pm="_name_69liy_22",mm="_description_69liy_28",xm="_currentPlan_69liy_32",hm="_selectButton_69liy_45",gm="_progressSection_69liy_50",jm="_progressLabel_69liy_54",Im="_bottomSheet_69liy_60",fm="_title_69liy_69",Sm="_typeSelector_69liy_80",_m="_typeOption_69liy_90",Cm="_active_69liy_100",vm="_saveTag_69liy_108",Rm="_planSelector_69liy_117",Em="_modal_69liy_127",ym="_inactive_69liy_148",bm="_notMounted_69liy_151",wm="_closeButton_69liy_157",Q={card:lm,price:um,interval:dm,name:pm,description:mm,currentPlan:xm,selectButton:hm,progressSection:gm,progressLabel:jm,bottomSheet:Im,title:fm,typeSelector:Sm,typeOption:_m,active:Cm,saveTag:vm,planSelector:Rm,modal:Em,inactive:ym,notMounted:bm,closeButton:wm},km=({variant:t,onSelect:n,isCurrent:o})=>{const s=t.subscriptionSettings.recurringIntervalDays===30?"month":t.subscriptionSettings.recurringIntervalDays===365?"year":"period",i=t.subscriptionSettings.price.amount.toFixed(2),r=t.subscriptionSettings.recurringIntervalDays,a=10;return e.jsxRuntimeExports.jsxs("div",{className:Q.card,onClick:n,children:[e.jsxRuntimeExports.jsxs("h2",{className:Q.price,children:["$",i," ",e.jsxRuntimeExports.jsxs("span",{className:Q.interval,children:["/ ",s]})]}),e.jsxRuntimeExports.jsx("h3",{className:Q.name,children:t.name}),t.description&&e.jsxRuntimeExports.jsx("p",{className:Q.description,children:t.description}),o?e.jsxRuntimeExports.jsxs("div",{className:Q.currentPlan,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Check"}),"Your current Plan"]}):e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",className:Q.selectButton,children:"Select"}),o&&e.jsxRuntimeExports.jsxs("div",{className:Q.progressSection,children:[e.jsxRuntimeExports.jsx(_o,{percent:a/r*100,disablePercentLabel:!0}),e.jsxRuntimeExports.jsxs("p",{className:Q.progressLabel,children:["Used: ",a," of ",r," days"]})]})]})},Nm=({isOpen:t,setIsOpen:n,subscription:o})=>{const[s,i]=p.useState(null),[r,a]=p.useState(null),[c,u]=p.useState(null),{id:h,accessToken:d}=e.useParams(),[g,m]=p.useState(!1),[f,j]=p.useState(!1),{setIsOpen:l}=e.useModalStore();p.useEffect(()=>{t&&m(!0)},[t]);const S=()=>{n(!1)},[x,C]=p.useState(null);p.useEffect(()=>{h&&d&&(async()=>{if(h&&d){const{data:v}=await e.getSubscriptionUpgradePlans({id:h,accessToken:d});C(v)}})()},[h,d]),p.useEffect(()=>{var _;if(x!=null&&x.data.types[0]){const v=(_=x.data.types.flatMap(w=>w.productVariants).find(w=>w.data.id===(o==null?void 0:o.variantId)))==null?void 0:_.data;v&&(u(v),a(v))}},[x,o]),p.useEffect(()=>{x!=null&&x.data.types[0]&&i(x==null?void 0:x.data.types[0])},[x==null?void 0:x.data.types]);const I=_=>{i(_),a(null)},R=_=>{a(_),l(!0),j(!0)};return e.jsxRuntimeExports.jsxs("div",{className:e.clx(Q.modal,{[Q.active]:t,[Q.inactive]:!t&&g,[Q.notMounted]:!g}),onClick:_=>_.stopPropagation(),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"X",onClick:S,hoverable:!0,className:Q.closeButton,fill:"var(--text-primary)"}),e.jsxRuntimeExports.jsxs("div",{className:Q.bottomSheet,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",className:Q.title,children:"Change Plan"}),e.jsxRuntimeExports.jsx("p",{className:Q.description,children:x==null?void 0:x.data.description}),e.jsxRuntimeExports.jsx("div",{className:Q.typeSelector,children:x==null?void 0:x.data.types.map(_=>e.jsxRuntimeExports.jsxs("div",{className:e.clx(Q.typeOption,{[Q.active]:(s==null?void 0:s.id)===_.id}),onClick:()=>I(_),children:[_.name,_.name==="Yearly"&&e.jsxRuntimeExports.jsx("span",{className:Q.saveTag,children:"Save %"})]},_.id))}),s&&e.jsxRuntimeExports.jsx("div",{className:Q.planSelector,children:s.productVariants.map(_=>e.jsxRuntimeExports.jsx(km,{variant:_.data,isSelected:(r==null?void 0:r.id)===_.data.id,isCurrent:(c==null?void 0:c.id)===_.data.id,onSelect:()=>R(_.data)},_.data.id))})]}),f&&r&&o&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>{j(!1)},children:e.jsxRuntimeExports.jsx(Sx,{setIsOpen:j,selectedVariant:r,subscription:o})})]})},Tm="_container_nb625_1",Lm="_title_nb625_11",Pm="_subtitle_nb625_16",Am="_info_nb625_20",Ct={container:Tm,title:Lm,subtitle:Pm,info:Am},Bm=()=>{const{subscription:t}=e.useSubscriptionStore(),[n,o]=e.extractDateAndTime((t==null?void 0:t.activeTo)||""),[s,i]=p.useState(!1),{setIsOpen:r}=e.useModalStore();return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:Ct.container,children:[e.jsxRuntimeExports.jsxs("div",{className:Ct.info,children:[e.jsxRuntimeExports.jsx("p",{className:Ct.title,children:"Expiration Date"}),e.jsxRuntimeExports.jsxs("p",{className:Ct.subtitle,children:[n," at ",o]})]}),e.jsxRuntimeExports.jsx(e.Button$1,{type:"Special",onClick:a=>{a.stopPropagation(),r(!0),i(!0)},children:"Extend"})]}),s&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>i(!1),children:e.jsxRuntimeExports.jsx(Fx,{setIsOpen:i})})]})},Mm="_couponContainer_1sspa_1",$m="_iconWrapper_1sspa_10",Fm="_details_1sspa_21",Dm="_title_1sspa_25",Hm="_progress_1sspa_29",Om="_foreverText_1sspa_34",Ye={couponContainer:Mm,iconWrapper:$m,details:Fm,title:Dm,progress:Hm,foreverText:Om},Um=({coupon:t,currency:n})=>{const o=t.isFixed?e.formatPrice({amount:t.discount,currency:n}):`${t.discount}%`,s=t.initialCouponDurationForSubscriptions?e.percentageDifference(t.initialCouponDurationForSubscriptions,t.currentCouponDurationForSubscriptions||1):100;return e.jsxRuntimeExports.jsxs("div",{className:Ye.couponContainer,children:[e.jsxRuntimeExports.jsx("div",{className:Ye.iconWrapper,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CheckCircle"})}),e.jsxRuntimeExports.jsxs("div",{className:Ye.details,children:[e.jsxRuntimeExports.jsxs("p",{className:Ye.title,children:[t.name,", ",o," discount"]}),e.jsxRuntimeExports.jsx("div",{className:Ye.progress,children:e.jsxRuntimeExports.jsx(_o,{color:"#C2C2C2",percent:s,disablePercentLabel:!0})}),e.jsxRuntimeExports.jsx("p",{className:Ye.foreverText,children:"Forever discount code"})]})]})},Wm="_paymentMethodContainer_1g0da_4",Gm="_paymentMethodTitle_1g0da_15",qm="_activeMethod_1g0da_20",Vm="_noMethod_1g0da_28",zm="_activeMethodPaymentMethod_1g0da_37",Zm="_paymentMethodLogo_1g0da_47",Xm="_paymentMethodNumber_1g0da_57",Ym="_method_1g0da_61",Me={paymentMethodContainer:Wm,paymentMethodTitle:Gm,activeMethod:qm,noMethod:Vm,activeMethodPaymentMethod:zm,paymentMethodLogo:Zm,paymentMethodNumber:Xm,method:Ym},Km="_paymentMethods_1gev0_1",Jm="_modal_1gev0_14",Qm="_header_1gev0_28",ex="_content_1gev0_37",Oe={paymentMethods:Km,modal:Jm,header:Qm,content:ex},tx=t=>{const{setIsLoading:n,setIsOpen:o}=t,{subscription:s,setSubscription:i}=e.useSubscriptionStore();if(!s)return null;const{id:r}=e.useParams(),a=e.useNavigate(),{notifications:c,setNotifications:u}=e.useNotificationStore(),{setPaymentMethod:h,setGateway:d,cart:g}=e.useCart(),{setIsOpen:m}=e.useModalStore();async function f(){if(j(),n(!0),r&&s){const{data:l}=await e.changeSubscriptionGateway(r,g.gateway);l.isReconnectPaymentNeeded?a(`/charges/${l.chargeId}`):(u([...c,{status:"success",id:e.v4(),message:"Your action has been successfully completed"}]),i({...s,gatewayName:g.gateway}))}else u([...c,{status:"error",id:e.v4(),message:"Your action has been failed. Try again!"}]);n(!1)}function j(){m(!1),setTimeout(()=>{o(!1)},300)}return e.jsxRuntimeExports.jsxs("div",{className:Oe.modal,onClick:l=>{l.stopPropagation()},children:[e.jsxRuntimeExports.jsxs("div",{className:Oe.header,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",className:Oe.title,children:"Choose Payment Method"}),e.jsxRuntimeExports.jsx(e.Icon,{name:"X",onClick:j,hoverable:!0,fill:"var(--text-primary)"})]}),e.jsxRuntimeExports.jsxs("div",{className:Oe.content,children:[(s==null?void 0:s.availableGateways)&&e.jsxRuntimeExports.jsx(vo,{possibleGateways:{availableGateways:s.availableGateways,requiresSignInGateways:s.availableGateways},setGateway:d,setPaymentMethod:h,totalAndDiscount:{total:(s==null?void 0:s.price.amount)||0,totalWithDiscount:s==null?void 0:s.price.amount},onSignInClick:()=>a("/customer-dash")}),e.jsxRuntimeExports.jsxs("div",{className:Oe.paymentMethods,children:[e.jsxRuntimeExports.jsx("div",{className:Oe.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:j,children:"Cancel"})}),e.jsxRuntimeExports.jsx("div",{className:Oe.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",disabled:!g.gateway,onClick:()=>f(),children:"Continue"})})]})]})]})},ox="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20131.39%2086.9'%3e%3cdefs%3e%3cstyle%3e.a{opacity:0;}.b{fill:%23fff;}.c{fill:%23ff5f00;}.d{fill:%23eb001b;}.e{fill:%23f79e1b;}%3c/style%3e%3c/defs%3e%3ctitle%3eAsset%201%3c/title%3e%3cg%20class='a'%3e%3crect%20class='b'%20width='131.39'%20height='86.9'/%3e%3c/g%3e%3crect%20class='c'%20x='48.37'%20y='15.14'%20width='34.66'%20height='56.61'/%3e%3cpath%20class='d'%20d='M51.94,43.45a35.94,35.94,0,0,1,13.75-28.3,36,36,0,1,0,0,56.61A35.94,35.94,0,0,1,51.94,43.45Z'/%3e%3cpath%20class='e'%20d='M120.5,65.76V64.6H121v-.24h-1.19v.24h.47v1.16Zm2.31,0v-1.4h-.36l-.42,1-.42-1h-.36v1.4h.26V64.7l.39.91h.27l.39-.91v1.06Z'/%3e%3cpath%20class='e'%20d='M123.94,43.45a36,36,0,0,1-58.25,28.3,36,36,0,0,0,0-56.61,36,36,0,0,1,58.25,28.3Z'/%3e%3c/svg%3e",nx=()=>{var j,l,S;const{subscription:t}=e.useSubscriptionStore(),{cart:n,setPaymentMethod:o}=e.useCart(),s=e.useNavigate(),[i,r]=p.useState(null),[a,c]=p.useState(!1),[u,h]=p.useState(!1),{setIsOpen:d}=e.useModalStore();if(!t)return null;const[g,m]=p.useState(t.gatewayName||n.gateway),f=n.paymentMethod;return p.useEffect(()=>{(async()=>{const C=await e.getGatewaysDetail(t.availableGateways);r(C)})()},[]),p.useEffect(()=>{n.gateway!==g&&m(n.gateway)},[n.gateway]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:Me.paymentMethodContainer,children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("p",{className:Me.paymentMethodTitle,children:"Active Payment Method"}),t.gatewayInfo&&Object.keys(t.gatewayInfo).length>0&&e.jsxRuntimeExports.jsx(sx,{gatewayInfo:t.gatewayInfo}),(!t.gatewayInfo||Object.keys(t.gatewayInfo).length===0)&&g==="Balance"&&e.jsxRuntimeExports.jsx(Co,{gateway:g,gatewayDisplayName:g,total:(t==null?void 0:t.price.amount)||0,onSignInClick:()=>s("/customer-dash")}),(!t.gatewayInfo||Object.keys(t.gatewayInfo).length===0)&&!g&&e.jsxRuntimeExports.jsx("span",{className:Me.noMethod,children:"Payment method is not set"}),(!t.gatewayInfo||Object.keys(t.gatewayInfo).length===0)&&g&&e.jsxRuntimeExports.jsx("div",{className:Me.activeMethod,children:i&&e.jsxRuntimeExports.jsx(e.CheckoutPaymentMethod,{align:"row",gatewayLogoCfId:(j=i.find(x=>x.name===g))==null?void 0:j.logoCfImageId,gatewayDisplayName:(l=i.find(x=>x.name===g))==null?void 0:l.displayName,gateway:g,poweredByLogoCfId:(S=i.find(x=>x.name===g))==null?void 0:S.poweredByImageCfImageId,className:Me.activeMethodPaymentMethod,selected:f===g,onSelect:x=>{o(x)}},g)})]}),e.jsxRuntimeExports.jsx(e.Button$1,{type:"Special",onClick:x=>{x.stopPropagation(),d(!0),h(!0)},children:n.gateway?"Change":"Manage"})]}),u&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>h(!1),children:e.jsxRuntimeExports.jsx(tx,{setIsLoading:c,setIsOpen:h})})]})},sx=({gatewayInfo:t})=>{var n,o,s,i,r;return e.jsxRuntimeExports.jsxs("div",{className:Me.method,children:[e.jsxRuntimeExports.jsxs("div",{className:Me.paymentMethodLogo,children:[((n=t.card)==null?void 0:n.brand.toLowerCase())==="visa"&&e.jsxRuntimeExports.jsx(e.Visa,{}),((o=t.card)==null?void 0:o.brand.toLowerCase())==="mastercard"&&e.jsxRuntimeExports.jsx("img",{src:ox,alt:"",width:22}),((s=t.card)==null?void 0:s.brand.toLowerCase())!=="visa"&&((i=t.card)==null?void 0:i.brand.toLowerCase())!=="mastercard"&&e.jsxRuntimeExports.jsx(e.Icon,{name:"CreditCard",width:22})]}),e.jsxRuntimeExports.jsxs("p",{className:Me.paymentMethodNumber,children:["•••• •••• •••• ",(r=t.card)==null?void 0:r.last4]})]})},rx="_subscriptionProductContainer_83ibx_4",ix="_subscriptionProductImage_83ibx_15",ax="_subscriptionProductInfo_83ibx_32",cx="_name_83ibx_37",lx="_price_83ibx_40",rt={subscriptionProductContainer:rx,subscriptionProductImage:ix,subscriptionProductInfo:ax,name:cx,price:lx},ux=({subscription:t,id:n,accessToken:o})=>{const[s,i]=p.useState(!1),{setIsOpen:r}=e.useModalStore();return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:rt.subscriptionProductContainer,onClick:a=>a.stopPropagation(),children:[e.jsxRuntimeExports.jsx("div",{className:rt.subscriptionProductImage,children:t!=null&&t.image?e.jsxRuntimeExports.jsx("img",{src:e.convertCfImageIdToUrl(t.image.cfId)}):e.jsxRuntimeExports.jsx(e.Icon,{name:"Image"})}),e.jsxRuntimeExports.jsxs("div",{className:rt.subscriptionProductInfo,children:[e.jsxRuntimeExports.jsx("div",{className:"flex items-center gap-2",children:e.jsxRuntimeExports.jsx("h2",{className:rt.name,children:t.name})}),e.jsxRuntimeExports.jsxs("p",{className:rt.price,children:[e.formatPrice(t.price)," / ",t.recurringInterval]})]}),e.jsxRuntimeExports.jsx(e.Button$1,{type:"Special",onClick:a=>{a.preventDefault(),i(!0),r(!0)},children:"Cancel"})]}),s&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>i(!1),children:e.jsxRuntimeExports.jsx(Kx,{accessToken:o,id:n,isOpen:s,setIsOpen:i})})]})},dx="_content_5ctxw_1",px="_selectedPlan_5ctxw_37",mx="_planName_5ctxw_44",xx="_description_5ctxw_48",hx="_price_5ctxw_51",gx="_buttonGroup_5ctxw_79",jx="_buttonWrapper_5ctxw_84",Ix="_modal_5ctxw_88",fx="_header_5ctxw_95",Ie={content:dx,selectedPlan:px,planName:mx,description:xx,price:hx,buttonGroup:gx,buttonWrapper:jx,modal:Ix,header:fx},Sx=({setIsOpen:t,selectedVariant:n,subscription:o})=>{if(!n)return null;const{setIsOpen:s}=e.useModalStore(),i=()=>{r()},r=()=>{s(!1),setTimeout(()=>{t(!1)},300)},a=(n.subscriptionSettings.compareAtPrice||n.subscriptionSettings.price).amount,c=n.subscriptionSettings.compareAtPrice?n.subscriptionSettings.compareAtPrice.amount-n.subscriptionSettings.price.amount:n.subscriptionSettings.price.amount,u=a-c,h=new Intl.NumberFormat("en-US",{style:"currency",currency:o.price.currency});return e.jsxRuntimeExports.jsxs("div",{className:Ie.modal,children:[e.jsxRuntimeExports.jsxs("div",{className:Ie.header,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Choose upgrade method"}),e.jsxRuntimeExports.jsx(e.Icon,{name:"X",hoverable:!0,onClick:()=>r(),fill:"var(--text-primary)"})]}),e.jsxRuntimeExports.jsxs("div",{className:Ie.bottomSheet,children:[e.jsxRuntimeExports.jsxs("div",{className:Ie.content,children:[e.jsxRuntimeExports.jsxs("div",{className:Ie.selectedPlan,children:[e.jsxRuntimeExports.jsx("h2",{className:Ie.planName,children:n.name}),e.jsxRuntimeExports.jsx("p",{className:Ie.description,children:n.description}),e.jsxRuntimeExports.jsxs("p",{className:Ie.price,children:["$",n.subscriptionSettings.price.amount.toFixed(2)," /"," ",n.subscriptionSettings.recurringIntervalDays===30?"month":"year"]})]}),e.jsxRuntimeExports.jsx(dt,{formatter:h,coupon:null,total:u,discount:c})]}),e.jsxRuntimeExports.jsxs("div",{className:Ie.buttonGroup,children:[e.jsxRuntimeExports.jsx("div",{className:Ie.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:()=>r(),children:"Stay with us"})}),e.jsxRuntimeExports.jsx("div",{className:Ie.buttonWrapper,children:e.jsxRuntimeExports.jsxs(e.Button$1,{type:"Primary",onClick:i,children:["Upgrade for $",u.toFixed(2)]})})]})]})]})},_x="_reviewMessage_1t8u4_1",Cx="_leaveReviewContainer_1t8u4_11",vx="_leaveReviewTitle_1t8u4_20",Ot={reviewMessage:_x,leaveReviewContainer:Cx,leaveReviewTitle:vx},Rx=({review:t,orderId:n,className:o})=>{const[s,i]=p.useState((t==null?void 0:t.rating)||0),[r,a]=p.useState(!1),{setIsOpen:c}=e.useModalStore(),{notifications:u,setNotifications:h}=e.useNotificationStore(),d=async g=>{t&&"accessToken"in t&&(await jn({comment:g,rating:s,tsId:e.getTsId()},n,t.accessToken),h([...u,{status:"success",id:e.v4(),message:"Review left successfully"}]),a(!1))};return p.useEffect(()=>{t&&s&&"accessToken"in t&&!t.rating&&(c(!0),a(!0))},[s]),t?t.rating&&"accessToken"in t?e.jsxRuntimeExports.jsxs("div",{className:Ot.reviewMessage,children:["You left a ",t.rating," star rating"]}):e.jsxRuntimeExports.jsxs("div",{className:e.clx(Ot.leaveReviewContainer,o),children:[e.jsxRuntimeExports.jsx("p",{className:Ot.leaveReviewTitle,children:"Leave a review"}),e.jsxRuntimeExports.jsx(cu,{rating:s,setRating:i,disabled:!!t.rating||!("accessToken"in t)}),r&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>a(!1),children:e.jsxRuntimeExports.jsx(Lx,{setIsOpen:a,onSubmit:d})})]}):null},Ex="_bottomSheet_1bcyj_1",yx="_content_1bcyj_7",bx="_title_1bcyj_18",wx="_buttonGroup_1bcyj_22",kx="_buttonWrapper_1bcyj_33",Nx="_modal_1bcyj_37",Tx="_header_1bcyj_44",Be={bottomSheet:Ex,content:yx,title:bx,buttonGroup:wx,buttonWrapper:kx,modal:Nx,header:Tx},Lx=({setIsOpen:t,onSubmit:n})=>{const[o,s]=p.useState(""),{setIsOpen:i}=e.useModalStore(),r=()=>{i(!1),setTimeout(()=>{t(!1)},300)};return e.jsxRuntimeExports.jsxs("div",{className:Be.modal,onClick:a=>a.stopPropagation(),children:[e.jsxRuntimeExports.jsxs("div",{className:Be.header,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",className:Be.title,children:"Review Description"}),e.jsxRuntimeExports.jsx(e.Icon,{name:"X",hoverable:!0,onClick:r,fill:"var(--text-primary)"})]}),e.jsxRuntimeExports.jsxs("div",{className:Be.bottomSheet,children:[e.jsxRuntimeExports.jsx("div",{className:Be.content,children:e.jsxRuntimeExports.jsx(e.Textarea$1,{placeholder:"Great product and fast checkout...",value:o,onChange:a=>s(a),label:"Describe your review in detail below"})}),e.jsxRuntimeExports.jsxs("div",{className:Be.buttonGroup,children:[e.jsxRuntimeExports.jsx("div",{className:Be.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:r,children:"Cancel"})}),e.jsxRuntimeExports.jsx("div",{className:Be.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",disabled:!o,onClick:()=>{r(),n(o)},children:"Submit"})})]})]})]})},Px="_container_1idhv_1",Ax="_buttonGroup_1idhv_8",Bx="_buttonWrapper_1idhv_15",Mx="_header_1idhv_19",$x="_content_1idhv_28",Ue={container:Px,buttonGroup:Ax,buttonWrapper:Bx,header:Mx,content:$x},Fx=({setIsOpen:t})=>{const{subscription:n}=e.useSubscriptionStore(),{getTotalAndDiscount:o,cart:s,coupon:i}=e.useCart(),[r,a]=p.useState(1),c=e.useNavigate(),{setIsOpen:u}=e.useModalStore(),{setNotifications:h,notifications:d}=e.useNotificationStore(),[g,m]=p.useState(!1),f=p.useMemo(()=>o(),[i,s]),j=p.useMemo(()=>f.totalWithDiscount?f.total-f.totalWithDiscount:0,[f]);if(g)return e.jsxRuntimeExports.jsx(e.ProcessingPaymentModal,{});const l=(n==null?void 0:n.price.currency)||"USD",S=new Intl.NumberFormat("en-US",{style:"currency",currency:l});async function x(){var I;m(!0);try{const{data:R}=await e.extendSubscription((n==null?void 0:n.id)||"",{});h([{id:e.v4(),message:"Order created successfully",status:"success"}]),c(`/orders/${(I=R.data)==null?void 0:I.id}/${R.data.fullAccessToken}`)}catch(R){const _=R;h([...d,{id:e.v4(),message:`Order creation failed: ${_.message}`,status:"error"}]),C()}finally{m(!1)}}function C(){u(!1),setTimeout(()=>{t(!1)},300)}return e.jsxRuntimeExports.jsxs("div",{className:Ue.container,onClick:I=>I.stopPropagation(),children:[e.jsxRuntimeExports.jsxs("div",{className:Ue.header,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",className:Ue.title,children:"Extend Subscription"}),e.jsxRuntimeExports.jsx(e.Icon,{name:"X",onClick:C,hoverable:!0,fill:"var(--text-primary)"})]}),e.jsxRuntimeExports.jsxs("div",{className:Ue.content,children:[e.jsxRuntimeExports.jsx(Su,{step:r,totalSteps:12,onStepChange:a,label:"How long would you like to extend your subscription for?"}),e.jsxRuntimeExports.jsx(dt,{formatter:S,coupon:i,total:f.total,discount:j,totalWithDiscount:f.totalWithDiscount}),e.jsxRuntimeExports.jsxs("div",{className:Ue.buttonGroup,children:[e.jsxRuntimeExports.jsx("div",{className:Ue.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:C,children:"Cancel"})}),e.jsxRuntimeExports.jsx("div",{className:Ue.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",onClick:x,children:"Extend"})})]})]})]})},Dx="_bottomSheet_uw5jb_1",Hx="_content_uw5jb_7",Ox="_radioGroup_uw5jb_11",Ux="_confirmation_uw5jb_26",Wx="_iconWrapper_uw5jb_33",Gx="_title_uw5jb_42",qx="_message_uw5jb_48",Vx="_buttonGroup_uw5jb_54",zx="_buttonWrapper_uw5jb_64",Zx="_modal_uw5jb_68",Xx="_header_uw5jb_77",se={bottomSheet:Dx,content:Hx,radioGroup:Ox,confirmation:Ux,iconWrapper:Wx,title:Gx,message:qx,buttonGroup:Vx,buttonWrapper:zx,modal:Zx,header:Xx},Yx={0:"Are you sure?",1:"Just making sure",2:"We're sorry to see you go"},Kx=({isOpen:t,setIsOpen:n,id:o,accessToken:s})=>{const[i,r]=p.useState(0),[a,c]=p.useState(!1),[u,h]=p.useState(""),[d,g]=p.useState(""),{setIsOpen:m}=e.useModalStore(),f=async()=>{if(!u)return;c(!0);const l=await e.cancelSubscription(o,s,{reason:u==="Other reason"?d:u});c(!1),l&&r(2)};p.useEffect(()=>{t||(r(0),h(""),g(""))},[t]);const j=()=>{m(!1),setTimeout(()=>{n(!1)},300)};return e.jsxRuntimeExports.jsxs("div",{className:se.modal,onClick:l=>l.stopPropagation(),children:[e.jsxRuntimeExports.jsxs("div",{className:se.header,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",children:Yx[i]||""}),e.jsxRuntimeExports.jsx(e.Icon,{name:"X",onClick:j,hoverable:!0,fill:"var(--text-primary)"})]}),e.jsxRuntimeExports.jsxs("div",{className:se.content,children:[i===0&&e.jsxRuntimeExports.jsxs("div",{className:se.bottomSheet,children:[e.jsxRuntimeExports.jsx("p",{children:"Before you cancel your subscription can you tell us why?"}),e.jsxRuntimeExports.jsxs("div",{className:se.radioGroup,children:[e.jsxRuntimeExports.jsx(e.Radio,{defaultValue:u,onChange:l=>h(l),options:[{value:"Found another company",label:"Found another company"},{value:"Expensive",label:"Expensive"},{value:"Technical problems",label:"Technical problems"},{value:"Support problems",label:"Support problems"},{value:"Other reason",label:"Other reason"}],flexDirection:"column"}),u==="Other reason"&&e.jsxRuntimeExports.jsx(e.Textarea$1,{value:d,onChange:l=>g(l),placeholder:"Describe the reason..."})]}),e.jsxRuntimeExports.jsxs("div",{className:se.buttonGroup,children:[e.jsxRuntimeExports.jsx("div",{className:se.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:j,children:"Stay with us"})}),e.jsxRuntimeExports.jsx("div",{className:se.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",onClick:()=>u&&r(1),disabled:!u,children:"Continue"})})]})]}),i===1&&e.jsxRuntimeExports.jsxs("div",{className:se.bottomSheet,children:[e.jsxRuntimeExports.jsx("p",{children:"You'll lose access to all of the features and content available within this subscription."}),e.jsxRuntimeExports.jsxs("div",{className:se.buttonGroup,children:[e.jsxRuntimeExports.jsx("div",{className:se.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:j,children:"Stay with us"})}),e.jsxRuntimeExports.jsx("div",{className:se.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",onClick:f,disabled:a,children:"Cancel it anyway"})})]})]}),i===2&&e.jsxRuntimeExports.jsxs("div",{className:se.bottomSheet,children:[e.jsxRuntimeExports.jsxs("div",{className:`${se.confirmation}`,children:[e.jsxRuntimeExports.jsx("div",{className:se.iconWrapper,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Check",fill:"var(--text-success)"})}),e.jsxRuntimeExports.jsx("p",{className:se.title,children:"Subscription Cancelled"}),e.jsxRuntimeExports.jsx("p",{className:se.message,children:"You'll lose access to all of the features and content available within this subscription."})]}),e.jsxRuntimeExports.jsx("div",{className:se.buttonGroup,children:e.jsxRuntimeExports.jsx("div",{className:se.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:j,children:"Close"})})})]})]})]})},Jx="_checkoutContainer_thje1_1",Qx="_loaderContainer_thje1_20",Ut={checkoutContainer:Jx,loaderContainer:Qx},Eo=()=>{const{isAntistock:t}=e.useGeneralStore(),{cart:n,products:o,pending:s,getTotalAndDiscount:i,getPossibleGateways:r,submitCart:a,setGateway:c,applyCoupon:u,setDiscordSocialConnectId:h,setCustomFields:d,applyCouponPending:g,coupon:m,removeCoupon:f,getDiscordSettings:j,setPaymentMethod:l,reset:S}=e.useCart(),x=p.useMemo(()=>i(),[m,n]),C=e.useNavigate();return p.useEffect(()=>{if(n.parts.length===0){if(t){C("/");return}try{C(-1)}catch{C("/")}}},[n.parts]),s?e.jsxRuntimeExports.jsx("div",{className:Ut.checkoutContainer,children:e.jsxRuntimeExports.jsx("div",{className:Ut.loaderContainer,children:e.jsxRuntimeExports.jsx(e.Loader,{})})}):e.jsxRuntimeExports.jsxs("div",{className:Ut.checkoutContainer,children:[e.jsxRuntimeExports.jsx(nd,{cart:n,products:o,applyCoupon:u,applyCouponPending:g,coupon:m,removeCoupon:f,totalAndDiscount:x}),e.jsxRuntimeExports.jsx(Vd,{cart:n,getPossibleGateways:r,setGateway:c,getDiscordSettings:j,products:o,submitCart:a,totalAndDiscount:x,setCustomFieldsToCart:d,setDiscordSocialConnectId:h,setPaymentMethod:l,reset:S,isAntistock:t})]})},eh="_chargePageContainer_qeuie_1",th="_chargeItems_qeuie_14",oh="_mainContent_qeuie_25",nh="_contentWrapper_qeuie_44",sh="_antistockContent_qeuie_53",rh="_statusBlock_qeuie_58",ih="_statusBlockAntistock_qeuie_63",ah="_notPaidSection_qeuie_68",ch="_antistockPayNow_qeuie_82",lh="_antistockFooter_qeuie_86",uh="_antistockTrackPayment_qeuie_96",dh="_footer_qeuie_106",ph="_loaderContainer_qeuie_128",le={chargePageContainer:eh,chargeItems:th,mainContent:oh,contentWrapper:nh,antistockContent:sh,statusBlock:rh,statusBlockAntistock:ih,notPaidSection:ah,antistockPayNow:ch,antistockFooter:lh,antistockTrackPayment:uh,footer:dh,loaderContainer:ph},mh=()=>{const{id:t}=e.useParams(),[n,o]=e.useSearchParams(),[s,i]=p.useState(!1),[r,a]=p.useState(),[c,u]=p.useState(!0),h=e.useNavigate(),d=p.useRef(),g=p.useRef(!1),{setIsOpen:m}=e.useModalStore(),{isAntistock:f}=e.useGeneralStore();return p.useEffect(()=>{const j=async(S,x=!1)=>{x||i(!0);const{data:C}=await In(S);i(!1),a(C)},l=setInterval(()=>{t&&j(t,!0)},5e3);return t&&j(t),()=>{clearInterval(l)}},[]),p.useEffect(()=>{const j=setTimeout(()=>{var S;console.log("charge timeout",r);const l=n.get("redirectRoute");if((r==null?void 0:r.status)===e.ChargeStatus.Paid&&r.redirectUrl&&!d.current){const C=JSON.parse(localStorage.getItem("orders")||"{}")[((S=r==null?void 0:r.order)==null?void 0:S.id)||""];C?window.open(C.fullAccessToken?`${r.redirectUrl}/${C.fullAccessToken}`:`${r.redirectUrl}`,"_self"):window.open(r.redirectUrl,"_self")}(r==null?void 0:r.status)===e.ChargeStatus.Paid&&d.current&&(console.log("redirectRouteRef.current",d.current),h(d.current,{replace:!0})),l&&d&&(d.current=l,n.delete("redirectRoute"),o(n))},1e3);return()=>clearTimeout(j)},[r]),p.useEffect(()=>{((r==null?void 0:r.gateway)==="PayPalFF"||(r==null?void 0:r.gateway)==="Сashapp")&&m(!0)},[r]),p.useEffect(()=>{var j;if(r!=null&&r.displayPaymentInfo&&r.displayPaymentInfo.length===1&&r.status===e.ChargeStatus.NotPaid&&!g.current){const l=r.displayPaymentInfo[0];l.type==="Button"&&((j=l.props)!=null&&j.url)&&(window.open(l.props.url,"_blank"),g.current=!0)}},[r==null?void 0:r.displayPaymentInfo,r==null?void 0:r.status]),s?e.jsxRuntimeExports.jsx("div",{className:le.loaderContainer,children:e.jsxRuntimeExports.jsx(e.Loader,{})}):e.jsxRuntimeExports.jsxs("div",{className:le.chargePageContainer,children:[e.jsxRuntimeExports.jsx("div",{className:le.chargeItems,children:e.jsxRuntimeExports.jsx(Ap,{charge:r})}),e.jsxRuntimeExports.jsx("div",{className:le.mainContent,style:f?{borderLeft:"1px solid var(--border-secondary)"}:void 0,children:e.jsxRuntimeExports.jsxs("div",{className:e.clx(le.contentWrapper,{[le.antistockContent]:f}),children:[r&&(r==null?void 0:r.status)!==e.ChargeStatus.NotPaid&&e.jsxRuntimeExports.jsx(e.ChargeStatusBlock,{charge:r}),r&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(le.statusBlock,{[le.statusBlockAntistock]:f}),children:[e.jsxRuntimeExports.jsx(Ro,{lastUpdate:r.expiresAt,email:r.customerForCharge.email,invoiceId:r.id,paymentType:r.gateway}),f&&(r==null?void 0:r.status)===e.ChargeStatus.NotPaid&&e.jsxRuntimeExports.jsx("div",{className:le.antistockPayNow,children:r==null?void 0:r.displayPaymentInfo.map((j,l)=>e.jsxRuntimeExports.jsx(Vt,{block:j},l))}),f&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:le.antistockTrackPayment,children:e.jsxRuntimeExports.jsx(e.TrackPayment,{timeline:r.timeline})}),e.jsxRuntimeExports.jsx(Ce,{className:le.antistockFooter})]})]}),!f&&(r==null?void 0:r.status)===e.ChargeStatus.NotPaid&&e.jsxRuntimeExports.jsx("div",{className:le.notPaidSection,children:r==null?void 0:r.displayPaymentInfo.map((j,l)=>e.jsxRuntimeExports.jsx(Vt,{block:j},l))}),!f&&e.jsxRuntimeExports.jsx(Ce,{className:le.footer})]})}),(r==null?void 0:r.gateway)==="PayPalFF"&&c&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>u(!1),children:e.jsxRuntimeExports.jsx(fp,{price:r.price,setIsOpen:u})}),(r==null?void 0:r.gateway)==="Сashapp"&&c&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>i(!1),children:e.jsxRuntimeExports.jsx(Kp,{setIsOpen:u,chargeId:r.id})})]})};var yo=(t=>(t.NEW="NEW",t.ANSWERED="ANSWERED",t.NOT_ANSWERED="NOT_ANSWERED",t.CLOSED="CLOSED",t))(yo||{});const xh="_wrapper_3txfs_1",hh="_ticketContainer_3txfs_23",gh="_title_3txfs_28",jh="_subtext_3txfs_35",Ih="_container_3txfs_41",fh="_content_3txfs_52",Sh="_messages_3txfs_63",_h="_input_3txfs_81",Ch="_textarea_3txfs_94",vh="_textareaAntistock_3txfs_123",Rh="_message_3txfs_63",Eh="_messageDate_3txfs_153",yh="_messageAntistock_3txfs_159",bh="_myMessage_3txfs_163",wh="_otherMessage_3txfs_170",kh="_button_3txfs_177",Nh="_disabled_3txfs_177",Th="_loadingMessage_3txfs_203",ee={wrapper:xh,ticketContainer:hh,title:gh,subtext:jh,container:Ih,content:fh,messages:Sh,input:_h,textarea:Ch,textareaAntistock:vh,message:Rh,messageDate:Eh,messageAntistock:yh,myMessage:bh,otherMessage:wh,button:kh,disabled:Nh,loadingMessage:Th},Lh=()=>{const t=window.location.pathname.split("/"),n=t[t.length-1],o=t[t.length-2],[s,i]=p.useState(!0),[r,a]=p.useState(null),[c,u]=p.useState(""),[h,d]=p.useState(null),{executeRecaptcha:g}=e.useReCaptcha(),{isAntistock:m}=e.useGeneralStore(),f=(r==null?void 0:r.status)===yo.CLOSED,j=async()=>{if(o&&n){const{data:x}=await e.fetchTicket(o,n);a(x),i(!1)}};p.useEffect(()=>{j();const x=setInterval(()=>{j()},5e3);return()=>clearInterval(x)},[]);const l=async()=>{const x=await g();if(!o||!n||!x||!c.trim())return;const C={content:c,createdAt:new Date().toISOString(),id:Date.now(),isSellerReply:!1};a(I=>I?{...I,messages:[...I.messages,C]}:null),d(C.id),u("");try{await e.sendTicketMessage(o,n,c,x,e.getTsId()),await j()}finally{setTimeout(()=>{d(null)},1e4)}},S=x=>{const C=new Date,I=new Date(x),R=Math.floor((C.getTime()-I.getTime())/1e3);if(R<60)return"just now";if(R<3600){const _=Math.floor(R/60);return`${_} minute${_>1?"s":""} ago`}else if(R<10800){const _=Math.floor(R/3600);return`${_} hour${_>1?"s":""} ago`}else return I.getFullYear()===C.getFullYear()?I.toLocaleDateString("en-US",{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"}):I.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"})};return e.jsxRuntimeExports.jsx("div",{className:ee.wrapper,children:s&&!r?e.jsxRuntimeExports.jsx(e.Loader,{}):e.jsxRuntimeExports.jsxs("div",{className:ee.container,children:[m?e.jsxRuntimeExports.jsxs("div",{className:ee.ticketContainer,children:[e.jsxRuntimeExports.jsx("div",{className:ee.title,style:{fontSize:"var(--font-heading-h3-size)"},children:r==null?void 0:r.title}),e.jsxRuntimeExports.jsx("div",{className:ee.subtext,style:{fontSize:"var(--font-body-md-size)"},children:"We’re going to respond to your ticket shortly. You’ll receive updates in your email inbox. Feel free to close this page."})]}):e.jsxRuntimeExports.jsx("div",{className:ee.title,children:`#${o} (${r==null?void 0:r.title})`}),e.jsxRuntimeExports.jsxs("div",{className:ee.content,style:{position:m?"relative":void 0,border:m?"1px solid var(--border-secondary)":void 0},children:[e.jsxRuntimeExports.jsx("div",{className:ee.messages,children:r==null?void 0:r.messages.sort((x,C)=>new Date(x.createdAt).getTime()-new Date(C.createdAt).getTime()).map(x=>e.jsxRuntimeExports.jsxs("div",{className:e.clx(ee.message,{[ee.messageAntistock]:m,[ee.myMessage]:!x.isSellerReply,[ee.otherMessage]:x.isSellerReply,[ee.loadingMessage]:h===x.id}),children:[e.jsxRuntimeExports.jsx("div",{className:ee.messageContent,children:e.splitTextIntoSpans(x.content,!1)}),h!==x.id&&e.jsxRuntimeExports.jsx("div",{className:ee.messageDate,children:S(x.createdAt)}),h===x.id&&e.jsxRuntimeExports.jsx("div",{className:ee.messageDate,children:e.jsxRuntimeExports.jsx(e.Loader,{})})]},x.id))}),e.jsxRuntimeExports.jsxs("div",{className:ee.input,children:[e.jsxRuntimeExports.jsx("textarea",{disabled:f,className:e.clx(ee.textarea,{[ee.textareaAntistock]:m}),value:c,placeholder:f?"The ticket has been closed. Need further assistance? Please submit a new request.":m?"Type a message...":"What worries you?",onChange:x=>u(x.target.value),onKeyDown:x=>{x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),l())}}),e.jsxRuntimeExports.jsx("div",{onClick:l,className:e.clx(ee.button,{[ee.disabled]:f}),children:e.jsxRuntimeExports.jsx(e.Icon,{name:"PaperPlaneRight"})})]})]})]})})},Ph="_subscriptionContainer_1j6ol_1",Ah="_leftSection_1j6ol_15",Bh="_content_1j6ol_26",Mh="_mainContent_1j6ol_33",$h="_detailsSection_1j6ol_37",Fh="_buttonGroup_1j6ol_50",Dh="_detailsContent_1j6ol_57",We={subscriptionContainer:Ph,leftSection:Ah,content:Bh,mainContent:Mh,detailsSection:$h,buttonGroup:Fh,detailsContent:Dh},Hh=()=>{const{id:t,accessToken:n}=e.useParams(),{subscription:o,setSubscription:s}=e.useSubscriptionStore(),{setIsOpen:i}=e.useModalStore(),[r,a]=p.useState(!1),[c,u]=p.useState(!1);p.useLayoutEffect(()=>{s(null)},[t,n]);const{balanceSettings:h,setBalanceSettings:d}=e.useCustomerDashboardStore();return p.useEffect(()=>{t&&n&&(async()=>{if(!t||!n)return;u(!0);const{data:m}=await e.fetchSubscription(t,n);s({...m}),u(!1)})()},[t,n]),p.useEffect(()=>{h||(async()=>{const m=await e.getBalanceSettings();d(m)})()},[h]),c?e.jsxRuntimeExports.jsx(e.Loader,{}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:We.subscriptionContainer,children:[e.jsxRuntimeExports.jsx("div",{className:We.leftSection,children:e.jsxRuntimeExports.jsxs("div",{className:We.content,children:[e.jsxRuntimeExports.jsx(ut,{}),e.jsxRuntimeExports.jsxs("div",{className:We.mainContent,children:[o&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Your Subscription"}),e.jsxRuntimeExports.jsx(cm,{subscription:{price:o.price,name:o.productName,description:o.productDescription,status:o.status,image:o.productImage,recurringInterval:o.recurringInterval}}),e.jsxRuntimeExports.jsx("div",{className:We.buttonGroup,children:o.pricingPlanExists&&e.jsxRuntimeExports.jsx(e.Button$1,{onClick:g=>{g.stopPropagation(),i(!0),a(!0)},style:{maxWidth:"500px",width:"100%"},children:"Change Plan"})})]}),e.jsxRuntimeExports.jsx(Ce,{})]})]})}),e.jsxRuntimeExports.jsx("div",{className:We.detailsSection,children:e.jsxRuntimeExports.jsxs("div",{className:We.detailsContent,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Details"}),(o==null?void 0:o.coupon)&&e.jsxRuntimeExports.jsx(Um,{coupon:o.coupon,currency:o.price.currency||"USD"}),o&&e.jsxRuntimeExports.jsx(ux,{id:t||"",accessToken:n||"",subscription:{price:o.price,name:o.productName,description:o.productDescription,status:o.status,image:o.productImage,recurringInterval:o.recurringInterval}}),o&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(nx,{}),o.activeTo&&e.jsxRuntimeExports.jsx(Bm,{})]}),e.jsxRuntimeExports.jsx(Ce,{className:"flex md:hidden"})]})})]}),e.jsxRuntimeExports.jsx(Nm,{isOpen:r,setIsOpen:a,subscription:o})]})},Oh="_topUpContainer_1pag6_1",Uh="_formWrapper_1pag6_15",Wh="_header_1pag6_29",Gh="_footer_1pag6_82",qh="_wrapper_1pag6_105",it={topUpContainer:Oh,formWrapper:Uh,header:Wh,footer:Gh,wrapper:qh},Vh=()=>{const{gatewaysDetail:t,setGatewaysDetail:n,balanceSettings:o,setBalanceSettings:s}=e.useCustomerDashboardStore();return p.useEffect(()=>{!t&&o&&(async()=>{const r=await e.getGatewaysDetail(o!=null&&o.isEnabled?(o==null?void 0:o.topUpSettings.gateways)||[]:[]);n(r)})()},[t,o]),p.useEffect(()=>{o||(async()=>{const r=await e.getBalanceSettings();s(r)})()},[o]),e.jsxRuntimeExports.jsxs("div",{className:it.wrapper,children:[e.jsxRuntimeExports.jsx(ut,{className:it.header}),e.jsxRuntimeExports.jsx("div",{className:it.topUpContainer,children:o?e.jsxRuntimeExports.jsx("div",{className:it.formWrapper,children:e.jsxRuntimeExports.jsx(e.BalanceModal,{setIsOpen:()=>{},isModal:!1})}):e.jsxRuntimeExports.jsx(e.Loader,{})}),e.jsxRuntimeExports.jsx("div",{className:it.footer,children:e.jsxRuntimeExports.jsx(Ce,{})})]})},zh="_orderPage_gc87l_1",Zh="_leftSection_gc87l_15",Xh="_content_gc87l_35",Yh="_main_gc87l_42",Kh="_mainAntistock_gc87l_56",Jh="_orderMainDataAntistock_gc87l_69",Qh="_timelineBlockAntistock_gc87l_81",e2="_footerAntistock_gc87l_92",t2="_statusBlock_gc87l_104",o2="_timelineBlock_gc87l_81",n2="_footer_gc87l_92",s2="_rightSection_gc87l_121",r2="_header_gc87l_142",i2="_productList_gc87l_150",a2="_mobileFooter_gc87l_157",c2="_loaderContainer_gc87l_166",l2="_orderMainData_gc87l_69",u2="_prices_gc87l_181",d2="_headerTitle_gc87l_185",p2="_headerDescription_gc87l_189",te={orderPage:zh,leftSection:Zh,content:Xh,main:Yh,mainAntistock:Kh,orderMainDataAntistock:Jh,timelineBlockAntistock:Qh,footerAntistock:e2,statusBlock:t2,timelineBlock:o2,footer:n2,rightSection:s2,header:r2,productList:i2,mobileFooter:a2,loaderContainer:c2,orderMainData:l2,prices:u2,headerTitle:d2,headerDescription:p2},m2=()=>{var f,j,l,S,x,C;const{id:t,accessToken:n}=e.useParams(),o=e.useNavigate(),[s,i]=p.useState(),[r,a]=p.useState(!1),c=e.useCopy(),{isAntistock:u}=e.useGeneralStore(),h=((f=s==null?void 0:s.rawPrice)==null?void 0:f.currency)||"USD",d=new Intl.NumberFormat("en-US",{style:"currency",currency:h}),g=p.useMemo(()=>(s==null?void 0:s.partOrders.map(I=>{var R,_;return{id:(I==null?void 0:I.id)||0,image:I.productWithVariant.image,name:(()=>{var F,K;const v=((F=I.productWithVariant)==null?void 0:F.name)||"",w=((K=I.productWithVariant)==null?void 0:K.variantName)||"";return!v&&!w?"":!w||v===w?v:v?`${v} (${w})`:w})(),description:"",price:{quantity:I.quantity,amount:((R=I.productWithVariant)==null?void 0:R.price.amount)||0,currency:(_=I.productWithVariant)==null?void 0:_.price.currency},deliveryCategories:"deliveryCategories"in I?I.deliveryCategories:void 0,customerNote:I.customerNote,chargeType:I.chargeType||"ONE_TIME"}}))||[],[s]),m=async(I,R,_=!1)=>{var w,F;_||a(!0);const{data:v}=await(R?e.fetchAuthorizedOrder(`${I}/${R}`):e.fetchOrder(I));a(!1),v.status!==e.OrderStatus.Completed&&((w=v.charge)==null?void 0:w.status)===e.ChargeStatus.NotPaid&&o(`/charges/${(F=v.charge)==null?void 0:F.id}`,{replace:!0}),i(v)};return p.useLayoutEffect(()=>{if(t&&!n){const I=JSON.parse(localStorage.getItem("orders")||"{}");I[t]&&o(`/orders/${t}/${I[t].fullAccessToken}`)}},[t]),p.useEffect(()=>{t&&m(t,n,!0);const I=setInterval(()=>{t&&m(t,n,!0)},5e3);return()=>{clearInterval(I)}},[t,n]),r?e.jsxRuntimeExports.jsx("div",{className:te.loaderContainer,children:e.jsxRuntimeExports.jsx(e.Loader,{})}):e.jsxRuntimeExports.jsxs("div",{className:te.orderPage,children:[e.jsxRuntimeExports.jsx("div",{className:te.leftSection,children:e.jsxRuntimeExports.jsxs("div",{className:te.content,children:[e.jsxRuntimeExports.jsx(ut,{}),s&&e.jsxRuntimeExports.jsxs("div",{className:`${te.main} ${u?te.mainAntistock:""}`,children:[e.jsxRuntimeExports.jsx(e.OrderStatusBlock,{className:te.statusBlock,orderStatus:s.status}),e.jsxRuntimeExports.jsxs("div",{className:`${te.orderMainData} ${u?te.orderMainDataAntistock:""}`,children:[e.jsxRuntimeExports.jsx(Ro,{lastUpdate:s.createdAt,paymentType:(j=s.charge)==null?void 0:j.gateway,email:s.customer?s.customer.email:((l=s.charge)==null?void 0:l.customerForCharge.email)||"",orderId:s.id}),"accessToken"in s.review&&!u&&e.jsxRuntimeExports.jsx(Rx,{orderId:s.id,review:s.review})]}),s.charge&&s.charge.timeline&&e.jsxRuntimeExports.jsx(e.TrackPayment,{className:`${te.timelineBlock} ${u?te.timelineBlockAntistock:""}`,timeline:s.charge.timeline}),e.jsxRuntimeExports.jsx(Ce,{className:`${te.footer} ${u?te.footerAntistock:""}`})]})]})}),e.jsxRuntimeExports.jsx("div",{className:te.rightSection,style:u?{borderLeft:"1px solid var(--border-secondary)"}:void 0,children:e.jsxRuntimeExports.jsxs("div",{className:te.content,children:[((S=s==null?void 0:s.charge)==null?void 0:S.name)&&e.jsxRuntimeExports.jsxs("header",{className:te.header,children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h1",{className:te.headerTitle,children:s.charge.name}),s.charge.description&&e.jsxRuntimeExports.jsx("p",{className:te.headerDescription,children:s.charge.description})]}),u?null:e.jsxRuntimeExports.jsxs(e.Button$1,{type:"Secondary",onClick:()=>c((s==null?void 0:s.id)||""),style:{whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:"4px"},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Copy"}),e.jsxRuntimeExports.jsx("span",{children:"Copy ID"})]})]}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("div",{className:te.productList,children:g.map(I=>e.jsxRuntimeExports.jsx(Zt,{product:I,isOrder:!0},I.id))}),u?null:e.jsxRuntimeExports.jsx(dt,{formatter:d,coupon:null,total:((x=s==null?void 0:s.charge)==null?void 0:x.price.amount)||0,discount:0,totalWithDiscount:((C=s==null?void 0:s.charge)==null?void 0:C.price.amount)||0,className:te.prices,isShowSubtotal:!1}),e.jsxRuntimeExports.jsx(Ce,{className:te.mobileFooter})]})]})})]})},x2=t=>{const{notifications:n,setNotifications:o}=e.useNotificationStore.getState();o(n.filter(s=>s.id!==t))},h2=t=>{const{notifications:n,setNotifications:o}=e.useNotificationStore.getState(),s=e.v4();return o([...n,{id:s,...t}]),s},g2=()=>{const{balance:t,setBalance:n}=e.useCustomerDashboardStore();return p.useEffect(()=>{t||(async()=>{const s=await e.getBalance();n(s)})()},[t]),t},j2=t=>{const{blocks:n,settings:o,header:s,footer:i,announcement:r,routes:a=[],shopLogo:c,apiURLs:u,isAntistock:h=!1}=t,[d,g]=p.useState(null),{general:m,setIsAntistock:f}=e.useGeneralStore(),{setApiUrls:j}=e.useApiStore(),{setBlocks:l,setSourceBlocks:S,setHeader:x,setFooter:C,setAnnouncement:I,setSettings:R}=e.useBlocksStore(),{themeSettings:_}=e.useThemeSettingsStore(),{settings:v,setSettings:w}=e.useSettingsStore(),F=e.IS_LOCAL_HOST?localStorage.getItem("fakeDomain")||"":window.location.hostname,K=localStorage.getItem("shopPassword"),Z=localStorage.getItem("shopId")||"",M=localStorage.getItem("draftId")||"";return p.useEffect(()=>{f(h)},[h,f]),p.useEffect(()=>{Z||localStorage.setItem("shopId",(m==null?void 0:m.info.id)||"15124f8d-2c8c-4dda-a04c-31c16816f9b6")},[m]),p.useEffect(()=>{M||localStorage.setItem("draftId","ca18cf24-6659-4015-b1ab-9ebe9fa64e74")},[M]),p.useEffect(()=>{!F&&!h&&localStorage.setItem("fakeDomain","drafts-ca18cf24-6659-4015-b1ab-9ebe9fa64e74.bgng.io"),!F&&h&&localStorage.setItem("fakeDomain","eva8.astck.io")},[F]),p.useEffect(()=>{if(_&&v){const b=vn(_,v);kn(_),Rn(b)}},[_,JSON.stringify(v),window.location.hostname]),p.useEffect(()=>{const E=new o().blockSettings;w(E)},[]),p.useLayoutEffect(()=>{const b={};Object.keys(n).map(D=>{b[D]=n[D]}),S(b),l(b),x(s),C(i),I(r),R(o),u&&j(u);const E=e.createBrowserRouter([{element:e.jsxRuntimeExports.jsx(yl,{shopDomain:F,shopId:Z,shopPassword:K||void 0,shopLogo:c,children:e.jsxRuntimeExports.jsx(e.ReCaptchaProvider,{children:e.jsxRuntimeExports.jsx(_l,{children:e.jsxRuntimeExports.jsx(e.Outlet,{})})})}),errorElement:e.jsxRuntimeExports.jsx(Cl,{}),children:[{path:"/admin/builder/*",element:e.jsxRuntimeExports.jsx(Kc,{children:e.jsxRuntimeExports.jsx(qc,{blocks:n,settings:o,header:s,footer:i,announcement:r})}),errorElement:e.jsxRuntimeExports.jsx(Yc,{})},...a,{path:"/checkout",element:e.jsxRuntimeExports.jsx(Eo,{}),errorElement:e.jsxRuntimeExports.jsx(Ne,{}),loader:()=>(document.title="Checkout",!0)},{path:"/top-up",element:e.jsxRuntimeExports.jsx(Vh,{}),errorElement:e.jsxRuntimeExports.jsx(Ne,{}),loader:()=>(document.title="Top Up Balance",!0)},{path:"/charges/:id",element:e.jsxRuntimeExports.jsx(mh,{}),errorElement:e.jsxRuntimeExports.jsx(Ne,{}),loader:()=>(document.title="Charges",!0)},{path:"/orders/:id/:accessToken?",element:e.jsxRuntimeExports.jsx(m2,{}),errorElement:e.jsxRuntimeExports.jsx(Ne,{}),loader:()=>(document.title="Orders",!0)},{path:"/subscriptions/:id/:accessToken?",element:e.jsxRuntimeExports.jsx(Hh,{}),errorElement:e.jsxRuntimeExports.jsx(Ne,{}),loader:()=>(document.title="Subscriptions",!0)},{path:h?"/account":"/customer-dash",element:e.jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100vw",height:"100dvh",overflowY:"scroll",overflowX:"hidden",background:"var(--surface-primary)",color:"var(--text-primary)"},children:[e.jsxRuntimeExports.jsx(e.RenderAnnouncement,{}),e.jsxRuntimeExports.jsx(e.RenderHeader,{}),e.jsxRuntimeExports.jsx("div",{style:{flex:"1 1 auto"},children:e.jsxRuntimeExports.jsx(e.CustomerDashboard,{})}),e.jsxRuntimeExports.jsx(e.RenderFooter,{})]}),errorElement:e.jsxRuntimeExports.jsx(Ne,{}),loader:()=>(document.title=h?"Account":"Customer Dashboard",!0)},{path:"/validation",element:e.jsxRuntimeExports.jsx(il,{}),errorElement:e.jsxRuntimeExports.jsx(Ne,{}),loader:()=>(document.title="Validation",!0)},{path:"/ticket/:id/:accessToken",element:e.jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100vw",height:"100dvh",overflowY:"scroll",overflowX:"hidden",background:"var(--surface-primary)",color:"var(--text-primary)"},children:[e.jsxRuntimeExports.jsx(e.RenderHeader,{}),e.jsxRuntimeExports.jsx("div",{style:{flex:1,width:"100%",height:"100%"},children:e.jsxRuntimeExports.jsx(e.ReCaptchaProvider,{children:e.jsxRuntimeExports.jsx(Lh,{})})}),e.jsxRuntimeExports.jsx(e.RenderFooter,{})]}),errorElement:e.jsxRuntimeExports.jsx(Ne,{}),loader:()=>(document.title="Ticket",!0)},{path:"*",element:e.jsxRuntimeExports.jsx(Cn,{}),errorElement:e.jsxRuntimeExports.jsx(Ne,{})}]}]);g(E)},[m]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:d&&e.jsxRuntimeExports.jsx(e.RouterProvider,{router:d})})};exports.ReCaptchaProvider=e.ReCaptchaProvider;exports.aspectRatioOptions=e.aspectRatioOptions;exports.formatPrice=e.formatPrice;exports.parseDraftJsText=e.parseDraftJsText;exports.splitTextIntoSpans=e.splitTextIntoSpans;exports.useAdaptiveStyles=e.useAdaptiveStyles;exports.useCart=e.useCart;exports.useGeneralInfo=e.useGeneralInfo;exports.useReCaptcha=e.useReCaptcha;exports.App=j2;exports.Checkout=Eo;exports.ColorVariables=ho;exports.hotReload=Nn;exports.iconNames=To;exports.removeNotification=x2;exports.showNotification=h2;exports.useBalance=g2;exports.useBuilderPages=Ln;exports.useCreateTicket=Tn;
|
|
104
|
+
`},children:e.jsxRuntimeExports.jsx("div",{className:P.indicator,style:{position:"absolute",left:`${Xt}%`,top:`${100-Yt}%`,transform:"translate(-50%, -50%)"}})}),e.jsxRuntimeExports.jsx("div",{className:P.hueSlider,style:{bottom:U?x?"225px":"150px":x?"175px":"100px"},children:e.jsxRuntimeExports.jsx("input",{type:"range",min:"0",max:"360",value:de,onChange:L=>{const k=Number(L.target.value);x?E===1?T(k,r,a,c):T(k,v,w,F):(d(k),T(k,r,a,c))},className:P.slider})}),e.jsxRuntimeExports.jsxs("div",{className:P.alphaSlider,style:{bottom:U?x?"200px":"125px":x?"150px":"75px"},children:[e.jsxRuntimeExports.jsx("div",{className:P.alphaBackground}),e.jsxRuntimeExports.jsx("div",{className:P.alphaGradient,style:{background:wo}}),e.jsxRuntimeExports.jsx("input",{type:"range",min:"0",max:"100",value:bo,onChange:L=>{const k=Number(L.target.value);x?E===1?T(i,r,a,k):T(_,v,w,k):(f(k),T(i,r,a,k))},className:P.slider})]}),x&&J&&e.jsxRuntimeExports.jsxs("div",{className:P.gradientWrapper,children:[e.jsxRuntimeExports.jsx("h3",{className:P.subtitle,children:"Rotation"}),e.jsxRuntimeExports.jsx("div",{className:P.gradient,children:e.jsxRuntimeExports.jsxs("div",{className:P.chargeTypes,children:[e.jsxRuntimeExports.jsxs("div",{className:e.clx(P.charge,{[P.chargeActive]:I==="horizontal"}),onClick:()=>R("horizontal"),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowsHorizontal",width:20,height:20}),"Horizontal"]}),e.jsxRuntimeExports.jsxs("div",{className:e.clx(P.charge,{[P.chargeActive]:I==="vertical"}),onClick:()=>R("vertical"),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowsVertical",width:20,height:20}),"Vertical"]})]})})]}),U&&e.jsxRuntimeExports.jsx(he,{initialColor:n,onChange:L=>l(L),title:"",isBlockSettings:U}),e.jsxRuntimeExports.jsxs("div",{className:P.buttons,children:[e.jsxRuntimeExports.jsx(e.Button,{onClick:X,className:e.clx(P.applyButton,P.cancelButton),type:"Secondary",children:"Cancel"}),e.jsxRuntimeExports.jsx(e.Button,{onClick:ue,className:P.applyButton,children:"Apply"})]})]})},yr=()=>{const{onPreview:t,zoomLevel:n}=e.usePreviewStore(),{keyBlock:o,hoverBlockId:s,isModalVisible:i,hoverBlockTopPosition:r}=e.useSubmodalStore(),{settings:a}=e.useSettingsStore(),{sourceBlocks:c}=e.useBlocksStore(),{pageContext:u}=e.usePagesStore(),{showModal:h}=e.useColorPickerStore(),{currentDevice:d}=e.useDeviceStore(),{isLoadingThemeSettings:g}=e.useThemeSettingsStore(),{isLoadingLayers:m}=e.useLayersStore(),f=I=>I?!c||!c[I]?e.jsxRuntimeExports.jsx(e.ErrorableBlock,{error:`Block "${I}" does not exist in blocks.`}):new c[I]().renderPreview(a,u):e.jsxRuntimeExports.jsx(e.ErrorableBlock,{error:"Block or block.name is undefined."});function j(){if(d.value==="desktop")return n>=1?"100%":`${(n*100).toFixed(2)}%`;{const I=d.value==="tablet"?768:425;return n>=1?`${I}px`:`${(I*n).toFixed(2)}px`}}function l(){switch(d.value){case"desktop":return"100%";case"tablet":return 768;case"mobile":return 425;default:return"100%"}}const{isOpenSelectModal:S}=e.usePagesStore(),x=p.useRef(null),C=I=>{x.current&&(x.current.scrollTop+=I.deltaY)};return e.jsxRuntimeExports.jsxs("div",{className:ot.preview,style:{zIndex:h&&!S?5e3:500},onWheel:I=>{I.stopPropagation(),C(I)},children:[i&&e.jsxRuntimeExports.jsx(Zs,{children:e.jsxRuntimeExports.jsx(Io,{})}),e.jsxRuntimeExports.jsxs(zs,{positionTop:r,positionLeft:!s&&o?void 0:250,children:[!g&&!m&&e.jsxRuntimeExports.jsx(e.RenderBlock,{render:f,block:o},o),(g||!o||m)&&e.jsxRuntimeExports.jsx("div",{className:ot.previewLoading,children:e.jsxRuntimeExports.jsx($e,{})})]}),h&&e.jsxRuntimeExports.jsx(Er,{}),t&&e.jsxRuntimeExports.jsxs("div",{className:ot.main,style:{width:l()},children:[e.jsxRuntimeExports.jsx(Ds,{}),e.jsxRuntimeExports.jsx("div",{style:{borderLeft:j()==="100%"?"none":"var(--default-border)",borderRight:j()==="100%"?"none":"var(--default-border)",width:"100%",display:"flex",flexDirection:"column",alignItems:"center",height:"calc(100vh - 160px)",overflowY:"scroll",overflowX:"hidden"},onScroll:I=>{I.stopPropagation()},onWheel:I=>{I.stopPropagation()},children:!g&&!m?e.jsxRuntimeExports.jsx("div",{className:ot.content,style:{width:j()},children:e.jsxRuntimeExports.jsx(e.PreviewContent,{scrollableRef:x})}):e.jsxRuntimeExports.jsx("div",{className:ot.loading,children:e.jsxRuntimeExports.jsx($e,{})})})]})]})},br="_sidebar_1xtkj_1",wr="_title_1xtkj_11",co={sidebar:br,title:wr},kr="_layers_1jhzw_1",Nr="_wrapper_1jhzw_9",Tr="_draggingWrapper_1jhzw_17",Lr="_block_1jhzw_21",Pr="_dragging_1jhzw_17",Ar="_active_1jhzw_56",Br="_add_1jhzw_63",Mr="_addTop_1jhzw_79",$r="_visible_1jhzw_95",Fr="_button_1jhzw_99",Dr="_nameBlock_1jhzw_158",Hr="_loader_1jhzw_162",Or="_actions_1jhzw_171",Ur="_deleteButton_1jhzw_179",re={layers:kr,wrapper:Nr,draggingWrapper:Tr,block:Lr,dragging:Pr,active:Ar,add:Br,addTop:Mr,visible:$r,button:Fr,nameBlock:Dr,loader:Hr,actions:Or,deleteButton:Ur},Wr="_block_sj4cc_1",Gr="_title_sj4cc_17",qr="_actions_sj4cc_21",Fe={block:Wr,title:Gr,actions:qr},Pt={header:"Header",footer:"Footer",announcement:"Announcement"},At=({id:t})=>{const{setCurrentBlock:n}=e.useLayersStore(),{activeBlock:o}=e.usePreviewStore(),[s,i]=p.useState(!1);function r(a){n(a)}return e.jsxRuntimeExports.jsxs("div",{className:e.clx(Fe.block,{[Fe.active]:o.id===t,[Fe.header]:t==="header",[Fe.footer]:t==="footer",[Fe.announcement]:t==="announcement"}),onClick:()=>r(t),onMouseOver:()=>i(!0),onMouseLeave:()=>i(!1),children:[at[Pt[t]]?e.jsxRuntimeExports.jsx("img",{src:at[Pt[t]],width:20,height:20}):e.jsxRuntimeExports.jsx(e.Icon,{name:"Cards",width:20,height:20}),e.jsxRuntimeExports.jsx("span",{className:Fe.title,children:Pt[t]}),e.jsxRuntimeExports.jsx("div",{className:Fe.actions,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"PushPin",hoverable:!0,width:20,height:20,fill:"#757575"})})]})},Vr=({id:t,name:n,onClick:o,isDragging:s,icon:i})=>{const{activeBlock:r,setActiveBlock:a}=e.usePreviewStore(),{showPreview:c,hidePreview:u,showModal:h,hideModal:d,clearHideTimeout:g,startHideTimeout:m,hoverBlockId:f,isModalVisible:j}=e.useSubmodalStore(),{setPositionBlock:l}=e.useLayersStore(),[S,x]=p.useState(!1),[C,I]=p.useState(!1),[R,_]=p.useState(!1),[v,w]=p.useState(!1),[F,K]=p.useState(null),Z=p.useRef(null),{attributes:M,listeners:b,setNodeRef:E,transform:D,transition:J}=e.useSortable({id:t}),U={transform:e.CSS.Transform.toString(D),transition:J},{setTitle:N,setDescription:A,setOnConfirm:W}=e.useConfirmationModalStore(),{pages:T,currentPage:q}=e.usePagesStore(),{removeBlock:ke}=e.useLayersStore(),ve=X=>{X.stopPropagation(),Z.current&&clearTimeout(Z.current),a({id:t,neededScroll:!0}),j&&d(),c(t),g()},z=(X,de=!0)=>{X.stopPropagation(),u(),h(t),g(),l(t,de)},ue=X=>{X.stopPropagation(),a({id:null,neededScroll:!1}),j?m():u()};return p.useEffect(()=>{_(!1),x(!1),I(!1),w(!1)},[s]),p.useEffect(()=>{j||(I(!1),x(!1))},[j]),e.jsxRuntimeExports.jsxs("div",{ref:E,style:U,className:e.clx(re.wrapper,{[re.draggingWrapper]:s&&r.id===t}),onClick:X=>{X.stopPropagation(),o(t)},onMouseEnter:ve,onMouseLeave:ue,...M,...b,children:[e.jsxRuntimeExports.jsxs("div",{className:e.clx(re.block,{[re.dragging]:s&&r.id===t,[re.active]:!s&&r.id===t}),children:[i?e.jsxRuntimeExports.jsx("img",{src:i,width:20,height:20}):e.jsxRuntimeExports.jsx(e.Icon,{name:"Cards",width:20,height:20}),e.jsxRuntimeExports.jsx("span",{className:re.nameBlock,children:n}),f===t&&!s&&e.jsxRuntimeExports.jsx("div",{className:e.clx(re.addTop,{[re.visible]:C}),onMouseEnter:()=>{I(!0)},onMouseLeave:()=>{I(!1)},children:e.jsxRuntimeExports.jsxs("button",{className:re.button,onClick:X=>z(X,!1),onMouseEnter:()=>{const X=setTimeout(()=>{s||w(!0)},200);K(X)},onMouseLeave:()=>{F&&clearTimeout(F),w(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Plus",fill:"#fff"}),v&&e.jsxRuntimeExports.jsx(Je,{text:"Click to add a section"})]})}),f===t&&!s&&e.jsxRuntimeExports.jsx("div",{className:e.clx(re.add,{[re.visible]:S}),onMouseEnter:()=>{x(!0)},onMouseLeave:()=>{x(!1)},children:e.jsxRuntimeExports.jsxs("button",{className:re.button,onClick:X=>z(X),onMouseEnter:()=>{const X=setTimeout(()=>{s||_(!0)},200);K(X)},onMouseLeave:()=>{F&&clearTimeout(F),_(!1)},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Plus",fill:"#fff"}),R&&e.jsxRuntimeExports.jsx(Je,{text:"Click to add a section"})]})})]}),f===t&&!s&&e.jsxRuntimeExports.jsxs("div",{className:re.actions,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20}),e.jsxRuntimeExports.jsx("div",{className:re.deleteButton,onClick:X=>{X.stopPropagation(),N("Remove Block"),A(`Are you sure you want to delete ${n||"this"} block? Once you delete this block, any content visible will also be deleted. This is irreversible.`),W(()=>{T&&ke(T[q].path,t)})},children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Trash",fill:"#C12A2A",hoverable:!0,width:20,height:20})})]})]})},zr=()=>{const{blocks:t,setCurrentBlock:n,currentBlock:o,moveBlock:s,isLoadingLayers:i,announcement:r}=e.useLayersStore(),{currentPage:a,pages:c}=e.usePagesStore(),{setMouseOverModal:u,setHoverBlockId:h}=e.useSubmodalStore(),{sourceBlocks:d}=e.useBlocksStore();function g(x){n(x),u(!1),h(null)}const m=e.useSensors(e.useSensor(e.PointerSensor,{activationConstraint:{distance:5}})),[f,j]=p.useState(!1),l=()=>{j(!0)},S=x=>{j(!1);const{active:C,over:I}=x;if(I&&C.id!==I.id&&c&&c[a]){const R=c[a].path,_=t[R].order,v=_.indexOf(C.id),w=_.indexOf(I.id);v!==-1&&w!==-1&&s(R,v,w)}};return e.jsxRuntimeExports.jsx("div",{className:re.layers,children:i?e.jsxRuntimeExports.jsx("div",{className:re.loader,children:e.jsxRuntimeExports.jsx($e,{})}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[r&&e.jsxRuntimeExports.jsx(At,{id:"announcement"}),e.jsxRuntimeExports.jsx(At,{id:"header"}),!o&&e.jsxRuntimeExports.jsx(e.DndContext,{sensors:m,onDragEnd:S,onDragStart:l,children:c&&c[a]&&t[c[a].path]&&e.jsxRuntimeExports.jsx(e.SortableContext,{items:t[c[a].path].order,strategy:e.verticalListSortingStrategy,children:t[c[a].path].order.map((x,C)=>e.jsxRuntimeExports.jsx(Vr,{id:x,name:e.getDisplayName(t[c[a].path].data[x].name,d),index:C,onClick:g,isDragging:f,icon:at[t[c[a].path].data[x].name]},x))})}),e.jsxRuntimeExports.jsx(At,{id:"footer"})]})})},Zr="_loader_eyvkk_1",Xr={loader:Zr},Yr=()=>{const{isLoadingSettings:t}=e.useSettingsStore();return t?e.jsxRuntimeExports.jsx("div",{className:Xr.loader,children:e.jsxRuntimeExports.jsx($e,{})}):e.jsxRuntimeExports.jsx(Kr,{})},Kr=()=>{const{settings:t}=e.useSettingsStore(),{settings:n,setSettingsInstance:o}=e.useBlocksStore();if(!t)return null;const{setError:s}=e.useErrorStore(),i=new n(t);p.useEffect(()=>{o(i)},[t]);try{return i.renderSettings()}catch(r){throw console.error("Error rendering settings:",r),s({message:"Error rendering settings",failedPageIds:[],failedThemeSettings:!1,failedSettings:!0}),r}},Jr="_theme_a1one_1",Qr="_block_a1one_8",ei="_name_a1one_23",ti="_loader_a1one_27",xt={theme:Jr,block:Qr,name:ei,loader:ti},oi=()=>{const t=e.useNavigate(),{isLoadingThemeSettings:n,setActiveBlock:o}=e.useThemeSettingsStore();function s(i){switch(i==null?void 0:i.name){case"Colors":t("/admin/builder/theme/colors"),o(Se[0]);break;case"Fonts":t("/admin/builder/theme/fonts"),o(Se[1]);break;case"Borders":t("/admin/builder/theme/borders"),o(Se[2]);break;case"Buttons":t("/admin/builder/theme/buttons"),o(Se[3]);break;case"Inputs":t("/admin/builder/theme/inputs"),o(Se[4]);break}}return e.jsxRuntimeExports.jsx("div",{className:xt.theme,children:n?e.jsxRuntimeExports.jsx("div",{className:xt.loader,children:e.jsxRuntimeExports.jsx($e,{})}):Se.map(i=>e.jsxRuntimeExports.jsxs("div",{onClick:()=>s(i),className:e.clx(xt.block),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:i.icon}),e.jsxRuntimeExports.jsx("span",{className:xt.name,children:i.name}),e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretRight"})]},i.icon))})},ni="_render_7e826_9",si="_open_7e826_24",ri="_close_7e826_51",ii="_clicked_7e826_55",ai="_loading_7e826_72",ci="_settings_7e826_76",qe={render:ni,open:si,close:ri,clicked:ii,loading:ai,settings:ci},li=({block:t})=>{const{pageContext:n}=e.usePagesStore(),{setError:o}=e.useErrorStore();try{return t.renderSettings(n)}catch(s){throw console.error("Error rendering settings:",s),o({message:"Error rendering block settings",failedPageIds:[],failedThemeSettings:!1,failedSettings:!0}),s}},ui="_wrapper_15ju8_1",di="_header_15ju8_8",pi="_title_15ju8_15",mi="_colorWrapper_15ju8_21",xi="_name_15ju8_35",hi="_color_15ju8_21",gi="_value_15ju8_47",ji="_length_15ju8_51",xe={wrapper:ui,header:di,title:pi,colorWrapper:mi,name:xi,color:hi,value:gi,length:ji},Ii=t=>{const{colors:n}=t,{themeSettings:o}=e.useThemeSettingsStore(),[s,i]=p.useState(!0);p.useEffect(()=>{n.length<=3&&i(!0)},[]);function r(a){const c=a.replace("--",""),[u,h]=c.split("-"),d=`${h.charAt(0).toUpperCase()+h.slice(1)} ${u.charAt(0).toUpperCase()+u.slice(1)}`,[g,m]=c.split("-");return{name:d,field:g,variable:m}}return e.jsxRuntimeExports.jsxs("div",{className:xe.wrapper,children:[e.jsxRuntimeExports.jsxs("div",{className:xe.header,children:[e.jsxRuntimeExports.jsx("div",{className:xe.title,children:"Section Colors"}),!s&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(xe.value,xe.length),onClick:()=>i(!0),children:["+",n.length]})]}),s&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:xe.colors,children:n.map(a=>{const c=r(a),{variable:u,name:h,field:d}=c;return e.jsxRuntimeExports.jsx(fi,{color:o.colors[d][u],name:h})})}),n.length>3&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(xe.value,xe.length),onClick:()=>i(!1),children:["Hide ",n.length," colors"]})]})]})},fi=t=>{const{name:n,color:o}=t,{setActiveLabel:s,setModalPosition:i,setInitialColor:r,setShowModal:a,setUpdate:c,setColor:u,setColorChange:h,colorChange:d,setIsGradientActive:g,setIsBlockSettings:m}=e.useColorPickerStore(),{updateColor:f}=e.useThemeSettingsStore(),j=(x,C)=>I=>{f(x,C,I)};p.useEffect(()=>{const x=()=>{a(!1),s(null),r(o),c(()=>{}),u(o),h(()=>{})};return document.body.addEventListener("click",x),()=>{document.body.removeEventListener("click",x)}},[]);const l=x=>{const C=n.split("/")[0],I=C.split(" ")[0].toLowerCase(),R=C.split(" ")[1].toLowerCase();x.stopPropagation(),a(!0),h(d),c(w=>j(R,I)(w)),r(o),u(o),m(!0),g(R==="surface");const{top:_,left:v}=jo(x,550,288,10,20,230,80);i({top:R==="surface"?_:_+125,left:v-200})};function S(x){return x.length>15?x.slice(0,15)+"...":x}return e.jsxRuntimeExports.jsxs("div",{className:xe.colorWrapper,onClick:l,children:[e.jsxRuntimeExports.jsx("div",{className:xe.color,style:{background:o}}),e.jsxRuntimeExports.jsx("div",{className:xe.name,children:n}),e.jsxRuntimeExports.jsx("div",{className:xe.value,children:S(o)})]})},Si="_back_1sznl_1",_i="_title_1sznl_9",Ci="_deleteButton_1sznl_17",vi="_backIcon_1sznl_30",ht={back:Si,title:_i,deleteButton:Ci,backIcon:vi},Ri=({onClick:t,setIsClicked:n,getDisplayName:o})=>{var m,f;const{activeBlock:s}=e.useBlocksStore(),{setTitle:i,setDescription:r,setOnConfirm:a}=e.useConfirmationModalStore(),{blocks:c,currentBlock:u,removeBlock:h}=e.useLayersStore(),{currentPage:d,pages:g}=e.usePagesStore();return e.jsxRuntimeExports.jsxs("div",{className:ht.back,children:[e.jsxRuntimeExports.jsx("div",{className:ht.backIcon,onClick:()=>t(),children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretLeft",hoverable:!0,width:20,height:20})}),e.jsxRuntimeExports.jsx("h3",{className:ht.title,children:s&&o(s)||g&&g[d]&&c[g[d].path]&&u&&o((m=c[g[d].path].data[u])==null?void 0:m.name)||u&&we(u)||"Loading"}),u&&g&&!["header","footer","announcement"].includes(u)&&c[g[d].path].data[u]&&o((f=c[g[d].path].data[u])==null?void 0:f.name)!=="unknown name"&&e.jsxRuntimeExports.jsx("button",{onClick:j=>{var l;j.stopPropagation(),i("Remove Block"),r(`Are you sure you want to delete ${o((l=c[g[d].path].data[u])==null?void 0:l.name)||"this"} block? Once you delete this block, any content visible will also be deleted. This is irreversible.`),a(()=>{n(!0),h(g[d].path,u),t(!0)})},className:ht.deleteButton,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A"})})]})},Ei=()=>{const t=e.useNavigate(),[n,o]=p.useState(!1),{header:s,footer:i,announcement:r,sourceBlocks:a,activeBlock:c,setActiveBlock:u,currentInstance:h,setCurrentInstance:d}=e.useBlocksStore(),{setActiveBlock:g}=e.usePreviewStore(),{blocks:m,addBlock:f,editBlock:j,currentBlock:l,setCurrentBlock:S,header:x,footer:C,announcement:I,isLoadingLayers:R}=e.useLayersStore(),{currentPage:_,pages:v}=e.usePagesStore(),{past:w,future:F}=e.useHistoryStore();function K(b=!1){if(v&&h&&l&&!["header","footer","announcement"].includes(l)&&!b){const E={blockSettings:{}};Object.keys(h.blockSettings).filter(D=>!["displayName","isAddable"].includes(D)).map(D=>{E.blockSettings[D]=h.blockSettings[D]}),j(v[_].path,l,{name:m[v[_].path].data[l].name,value:E})}u(null),S(null),g({id:null,neededScroll:!1}),setTimeout(()=>{o(!1)},150),d(null)}function Z(b){var U;if(!v||!_||!b)return null;if(b==="header"){const N=new s;return Object.keys(N.blockSettings).forEach(A=>{N.blockSettings[A]=x==null?void 0:x.blockSettings[A]}),Object.keys(N.blockColors).forEach(A=>{N.blockColors[A]=x==null?void 0:x.blockColors[A]}),N}if(b==="footer"){const N=new i;return Object.keys(N.blockSettings).forEach(A=>{N.blockSettings[A]=C==null?void 0:C.blockSettings[A]}),Object.keys(N.blockColors).forEach(A=>{N.blockColors[A]=C==null?void 0:C.blockColors[A]}),N}if(b==="announcement"){const N=new r;return Object.keys(N.blockSettings).forEach(A=>{N.blockSettings[A]=I==null?void 0:I.blockSettings[A]}),Object.keys(N.blockColors).forEach(A=>{N.blockColors[A]=I==null?void 0:I.blockColors[A]}),N}const E=m[v[_].path];if(!E||!E.data[b])return null;const D=E.data[b];return!D||!a[D.name]?null:new a[D.name]((U=D.value)==null?void 0:U.blockSettings)}p.useEffect(()=>{if(l){const b=Z(l);d(b)}else d(null)},[l,w,F,c]),p.useEffect(()=>{if(c&&v&&!l){const b={blockSettings:{},blockColors:{}},E=new a[c];d(E),Object.keys(E.blockSettings).filter(J=>!["displayName","isAddable"].includes(J)).map(J=>{b.blockSettings[J]=E.blockSettings[J]}),Object.keys(E.blockColors).filter(J=>!["displayName","isAddable"].includes(J)).map(J=>{b.blockColors[J]=E.blockColors[J]});const D=f(v[_].path,{name:c,value:b});g({id:D,neededScroll:!0}),S(D),t("/admin/builder")}},[c,w,F]);function M(b){if(!a)return"unknown name";if(!a[b])return l==="header"?x==null?void 0:x.blockSettings.displayName:l==="footer"?C==null?void 0:C.blockSettings.displayName:l==="announcement"?I==null?void 0:I.blockSettings.displayName:"unknown name";const E=new a[b];return!E.blockSettings||!E.blockSettings.displayName?"unknown name":E.blockSettings.displayName}return e.jsxRuntimeExports.jsxs("div",{className:e.clx(qe.render,{[qe.open]:l,[qe.close]:!l,[qe.clicked]:n}),onClick:b=>b.stopPropagation(),style:{opacity:R?0:1},children:[e.jsxRuntimeExports.jsx(Ri,{onClick:K,setIsClicked:o,getDisplayName:M}),e.jsxRuntimeExports.jsxs("div",{className:qe.settings,children:[h&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(li,{block:h}),e.jsxRuntimeExports.jsx(Ii,{colors:h.blockColors})]}),!c&&!l&&e.jsxRuntimeExports.jsx("div",{className:qe.loading,children:"Loading"})]})]})},yi="_header_9rrfr_1",bi="_title_9rrfr_9",wi="_backIcon_9rrfr_15",Bt={header:yi,title:bi,backIcon:wi},ct=({onClick:t,title:n})=>e.jsxRuntimeExports.jsxs("div",{className:Bt.header,children:[e.jsxRuntimeExports.jsx("div",{className:Bt.backIcon,onClick:t,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretLeft",hoverable:!0,width:20,height:20})}),e.jsxRuntimeExports.jsx("span",{className:Bt.title,children:n})]}),ki="_options_ymds7_1",Ni={options:ki},Ti="_wrapper_kzokw_1",Li="_open_kzokw_16",Pi="_close_kzokw_20",Mt={wrapper:Ti,open:Li,close:Pi},lt=t=>{const{isOpen:n,isClose:o,children:s}=t;return e.jsxRuntimeExports.jsx("div",{className:e.clx(Mt.wrapper,{[Mt.open]:n,[Mt.close]:o}),children:s})},Ai=()=>{var h,d;const{activeBlock:t,themeSettings:n,updateBorder:o,setActiveBlock:s}=e.useThemeSettingsStore();function i(g,m){o(m,g)}const r=e.useNavigate();function a(){s(null),r("/admin/builder/theme")}const c=p.useMemo(()=>n.borders,[n]),u=(t==null?void 0:t.name)==="Borders";return e.jsxRuntimeExports.jsxs(lt,{isOpen:u,isClose:!u,children:[e.jsxRuntimeExports.jsx(ct,{onClick:a,title:"Borders Style"}),e.jsxRuntimeExports.jsxs("div",{className:Ni.options,children:[e.jsxRuntimeExports.jsx(e.Select,{label:"Border Radius (px)",options:Object.keys(bt),value:((h=Object.entries(bt).find(([g,m])=>m===c.radius))==null?void 0:h[0])||"None",onChange:g=>i(bt[g],"radius")}),e.jsxRuntimeExports.jsx(e.Select,{label:"Border Thickness (px)",options:Object.keys(wt),value:((d=Object.entries(wt).find(([g,m])=>m===c.thickness))==null?void 0:d[0])||"None",onChange:g=>i(wt[g],"thickness")})]})]})},Bi="_options_jo38w_1",Mi="_alignments_jo38w_9",$i="_blocks_jo38w_15",Fi="_alignment_jo38w_9",Di="_active_jo38w_34",Hi="_chargeTypes_jo38w_41",Oi="_charge_jo38w_41",Ui="_chargeActive_jo38w_69",Wi="_sliderContainer_jo38w_83",Gi="_shadowInputs_jo38w_91",qi="_label_jo38w_102",Vi="_shadowInputsRow_jo38w_111",zi="_shadowInputsOpen_jo38w_119",ie={options:Bi,alignments:Mi,blocks:$i,alignment:Fi,active:Di,chargeTypes:Hi,charge:Oi,chargeActive:Ui,sliderContainer:Wi,shadowInputs:Gi,label:qi,shadowInputsRow:Vi,shadowInputsOpen:zi},Zi=["left","center","right"],Xi=()=>{const{activeBlock:t,themeSettings:n,updateButton:o,setActiveBlock:s}=e.useThemeSettingsStore(),{fonts:i}=e.useFontsStore(),[r,a]=p.useState("primary");function c(l,S){o(r,S,l)}const[u,h]=p.useState(!1),d=n.buttons[r],g=e.useNavigate();function m(){s(null),g("/admin/builder/theme")}const f=(t==null?void 0:t.name)==="Buttons";function j(l,S){c({...d.boxShadow,[l]:S},"boxShadow")}return e.jsxRuntimeExports.jsxs(lt,{isOpen:f,isClose:!f,children:[e.jsxRuntimeExports.jsx(ct,{onClick:m,title:"Buttons Style"}),e.jsxRuntimeExports.jsx("div",{className:ie.chargeTypes,style:{marginBottom:"10px"},children:["primary","secondary","tertiary"].map(l=>e.jsxRuntimeExports.jsx("div",{className:e.clx(ie.charge,{[ie.chargeActive]:r===l}),onClick:()=>a(l),children:l.charAt(0).toUpperCase()+l.slice(1)},l))}),d&&e.jsxRuntimeExports.jsxs("div",{className:ie.options,children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Height (px)",value:String(d.height),onChange:l=>c(Number(l),"height"),type:"number",min:0}),e.jsxRuntimeExports.jsx(e.Select,{label:"Font Size (px)",value:String(d.size),onChange:l=>c(Number(l),"size"),options:Rt}),e.jsxRuntimeExports.jsx(e.Input,{label:"Border Radius (px)",value:String(d.radius),onChange:l=>c(Number(l),"radius"),type:"number",min:0}),e.jsxRuntimeExports.jsx(e.Select,{label:"Font",value:d.font,onChange:l=>c(l,"font"),options:[...i.filter(l=>l.name!==d.font).map(l=>l.name)]}),e.jsxRuntimeExports.jsx(he,{initialColor:d.color,onChange:l=>c(l,"color"),title:"Text Color",labelStyle:"secondary",isGradientActive:!1}),e.jsxRuntimeExports.jsx(he,{initialColor:d.background,onChange:l=>c(l,"background"),title:"Background Color",labelStyle:"secondary",isGradientActive:!0}),e.jsxRuntimeExports.jsxs("div",{className:ie.sliderContainer,children:[e.jsxRuntimeExports.jsx("h4",{className:ie.label,children:"Shadow"}),e.jsxRuntimeExports.jsx(e.Button,{type:"Secondary",onClick:()=>h(!u),style:{padding:5,display:"flex"},children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretUp",style:{rotate:u?"0deg":"-180deg",transition:"0.3s rotate ease"}})})]}),e.jsxRuntimeExports.jsxs("div",{className:e.clx(ie.shadowInputs,{[ie.shadowInputsOpen]:u}),children:[e.jsxRuntimeExports.jsxs("div",{className:ie.shadowInputsRow,children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Left (px)",value:String(d.boxShadow.left),onChange:l=>j("left",Number(l)),type:"number"}),e.jsxRuntimeExports.jsx(e.Input,{label:"Top (px)",value:String(d.boxShadow.top),onChange:l=>j("top",Number(l)),type:"number"}),e.jsxRuntimeExports.jsx(e.Input,{label:"Blur (px)",value:String(d.boxShadow.blur),onChange:l=>j("blur",Number(l)),type:"number"}),e.jsxRuntimeExports.jsx("div",{style:{flex:1,whiteSpace:"nowrap"},children:e.jsxRuntimeExports.jsx(e.Input,{label:"Spread (px)",value:String(d.boxShadow.spread),onChange:l=>j("spread",Number(l)),type:"number"})})]}),e.jsxRuntimeExports.jsx(he,{initialColor:d.boxShadow.color,onChange:l=>j("color",l),title:"Color",labelStyle:"secondary",isGradientActive:!1})]}),e.jsxRuntimeExports.jsxs("div",{className:ie.alignments,children:[e.jsxRuntimeExports.jsx("h4",{className:ie.label,children:"Alignment Type"}),e.jsxRuntimeExports.jsx("div",{className:ie.blocks,children:Zi.map(l=>e.jsxRuntimeExports.jsx("div",{className:e.clx(ie.alignment,{[ie.active]:d.alignment===l}),onClick:()=>{c(l,"alignment")},children:e.jsxRuntimeExports.jsx(e.Icon,{name:l==="center"?"AlignCenterHorizontal":l==="left"?"AlignLeft":"AlignRight",fill:d.alignment===l?"#252525":"#757575"})},l))})]}),e.jsxRuntimeExports.jsx(e.Switch,{label:"Enable Hover",onChange:l=>c(l,"hover"),current:d.hover}),d.hover&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(he,{initialColor:d.colorHover,onChange:l=>c(l,"colorHover"),title:"Hover Text Color",labelStyle:"secondary",isGradientActive:!1}),e.jsxRuntimeExports.jsx(he,{initialColor:d.backgroundHover,onChange:l=>c(l,"backgroundHover"),title:"Hover Background Color",labelStyle:"secondary",isGradientActive:!0})]})]})]})},Yi="_category_hxy9u_1",Ki="_categoryTitle_hxy9u_19",$t={category:Yi,categoryTitle:Ki},Ji=()=>{const{themeSettings:t,setActiveColorCategory:n}=e.useThemeSettingsStore();function o(s){n(s)}return e.jsxRuntimeExports.jsx("div",{className:$t.wrapper,children:Object.keys(t.colors).map(s=>s==="icon"?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}):e.jsxRuntimeExports.jsxs("div",{className:$t.category,onClick:()=>o(s),children:[e.jsxRuntimeExports.jsxs("h2",{className:$t.categoryTitle,children:[s==="text"?"Text & Icon":we(s)," Colors"]}),e.jsxRuntimeExports.jsx(e.Icon,{name:"CaretRight",width:24,height:24})]},s))})},Qi="_options_ikvjo_38",ea={options:Qi},ta=()=>{const{activeBlock:t,setActiveFont:n,activeFont:o,themeSettings:s,updateFont:i}=e.useThemeSettingsStore(),{fonts:r}=e.useFontsStore(),[a,c]=p.useState(null);function u(){n(null)}function h(l,S){a&&o&&i("desktop",a,o,S,l)}const[d,g]=p.useState([]),m=p.useMemo(()=>o?s.fonts.desktop.heading[o]?(c("heading"),s.fonts.desktop.heading[o]):s.fonts.desktop.body[o]?(c("body"),s.fonts.desktop.body[o]):(c(null),null):null,[o,s]);p.useEffect(()=>{if(m){const l=r.find(S=>S.name===m.font);l&&(g(l.weights),l.weights.includes(m.boldWeight)||h("400","boldWeight"),l.weights.includes(m.weight)||h("400","weight"))}},[m,o]);const f=!!((t==null?void 0:t.name)==="Fonts"&&o),j=(t==null?void 0:t.name)!=="Fonts"||!o;return e.jsxRuntimeExports.jsxs(lt,{isOpen:f,isClose:j,children:[e.jsxRuntimeExports.jsx(ct,{onClick:u,title:"Font Style"}),o&&m&&e.jsxRuntimeExports.jsxs("div",{className:ea.options,children:[e.jsxRuntimeExports.jsx(e.Select,{label:"Font",value:m.font,onChange:l=>h(l,"font"),options:[...r.filter(l=>l.name!==m.font).map(l=>l.name)]}),e.jsxRuntimeExports.jsx(e.Select,{label:"Size",value:String(m.size),onChange:l=>h(l,"size"),options:Rt}),e.jsxRuntimeExports.jsx(e.Select,{label:"Default Weight",value:String(m.weight),onChange:l=>h(l,"weight"),options:d}),e.jsxRuntimeExports.jsx(e.Select,{label:"Bold Weight",value:String(m.boldWeight),onChange:l=>h(l,"boldWeight"),options:d}),e.jsxRuntimeExports.jsx(e.Select,{label:"Case",value:String(m.case).charAt(0).toUpperCase()+String(m.case).slice(1),onChange:l=>h(l.toLowerCase(),"case"),options:["Normal","Uppercase","Lowercase","Capitalize"].filter(l=>l.toLowerCase()!==String(m.case))})]})]})},oa="_wrapper_mkmxa_1",na="_category_mkmxa_5",sa="_categoryTitle_mkmxa_11",ra="_font_mkmxa_17",ia="_content_mkmxa_32",aa="_icon_mkmxa_39",ca="_paragraph_mkmxa_50",Le={wrapper:oa,category:na,categoryTitle:sa,font:ra,content:ia,icon:aa,paragraph:ca},la={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",h7:"h7",lg:"large",md:"medium",sm:"small"},ua=t=>{const{font:n,size:o,id:s,category:i}=t,{setActiveFont:r}=e.useThemeSettingsStore();return e.jsxRuntimeExports.jsxs("div",{className:Le.font,onClick:()=>r(s),children:[e.jsxRuntimeExports.jsx("div",{className:e.clx(Le.icon,{[Le.paragraph]:i==="paragraph"}),children:e.jsxRuntimeExports.jsx(e.Icon,{name:i==="paragraph"?"TextB":"TextH"})}),e.jsxRuntimeExports.jsxs("div",{className:Le.content,children:[e.jsxRuntimeExports.jsx("h2",{className:Le.categoryTitle,children:we(la[s])}),e.jsxRuntimeExports.jsx("span",{className:Le.value,children:`${n}, ${o}px`})]})]})},da=()=>{const{themeSettings:t,setActiveFont:n,activeBlock:o}=e.useThemeSettingsStore();p.useEffect(()=>(s(),()=>{s()}),[]);function s(){n(null)}if(o!=null&&o.name)return e.jsxRuntimeExports.jsx("div",{className:Le.wrapper,children:Object.entries(t.fonts.desktop).sort(([i],[r])=>i==="heading"?-1:r==="heading"?1:0).map(([i,r])=>e.jsxRuntimeExports.jsxs("div",{className:Le.category,children:[e.jsxRuntimeExports.jsx("h2",{className:Le.categoryTitle,children:we(i)}),Object.entries(r).map(([a,c])=>e.jsxRuntimeExports.jsx(ua,{id:a,category:i,...c},a))]},i))})},pa="_wrapper_16ym0_2",ma="_categoryTitle_16ym0_12",xa="_title_16ym0_74",ha="_field_16ym0_82",ga="_alignments_16ym0_92",ja="_lineField_16ym0_98",Ia="_style_16ym0_106",fa="_header_16ym0_113",fe={wrapper:pa,categoryTitle:ma,title:xa,field:ha,alignments:ga,lineField:ja,style:Ia,header:fa},Sa="_blocks_emecf_1",_a="_block_emecf_1",Ca="_active_emecf_21",Ft={blocks:Sa,block:_a,active:Ca},lo=t=>{const{items:n,selectedItem:o,onSelect:s,getIconName:i}=t;return e.jsxRuntimeExports.jsx("div",{className:Ft.blocks,children:n.map(r=>e.jsxRuntimeExports.jsx("div",{className:e.clx(Ft.block,{[Ft.active]:o===r}),onClick:()=>s(r),children:e.jsxRuntimeExports.jsx(e.Icon,{name:i(r),fill:o===r?"#252525":"#757575"})},String(r)))})},va=["left","center","right"],Ra=["solid","dashed"],nt=t=>{const{title:n,children:o,rightAddon:s}=t;return e.jsxRuntimeExports.jsxs("div",{className:fe.field,children:[e.jsxRuntimeExports.jsxs("div",{className:fe.header,children:[e.jsxRuntimeExports.jsx("h4",{className:fe.categoryTitle,children:n}),s]}),o]})},Ea=()=>{const{themeSettings:t,updateInput:n}=e.useThemeSettingsStore(),o=p.useMemo(()=>t.inputs,[t]),s=(r,a,c)=>{n(r,a,c)},i=r=>a=>{n(r,a,"color")};return e.jsxRuntimeExports.jsxs("div",{className:fe.wrapper,children:[e.jsxRuntimeExports.jsxs(nt,{title:"General",children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Height (px)",value:String(o.general.height),onChange:r=>s("general",r,"height"),type:"number",min:0}),e.jsxRuntimeExports.jsx(e.Select,{label:"Font Size (px)",onChange:r=>s("general",r,"size"),value:String(o.general.size),options:Rt}),e.jsxRuntimeExports.jsx(he,{initialColor:we(o.general.color),onChange:i("general"),title:"Font Color",labelStyle:"secondary",isGradientActive:!1})]}),e.jsxRuntimeExports.jsx(nt,{title:"Field Fill",rightAddon:e.jsxRuntimeExports.jsx("div",{className:fe.switch,children:e.jsxRuntimeExports.jsx(e.Switch,{onChange:r=>s("field",r,"active"),current:o.field.active})}),children:e.jsxRuntimeExports.jsx(he,{initialColor:o.field.color,onChange:i("field"),title:"Color",labelStyle:"secondary"})}),e.jsxRuntimeExports.jsx(nt,{title:"Placeholder",children:e.jsxRuntimeExports.jsx(he,{initialColor:we(o.placeholder.color),onChange:i("placeholder"),title:"Font Color",labelStyle:"secondary",isGradientActive:!1})}),e.jsxRuntimeExports.jsxs(nt,{title:"Border",rightAddon:e.jsxRuntimeExports.jsx("div",{className:fe.switch,children:e.jsxRuntimeExports.jsx(e.Switch,{onChange:r=>s("border",r,"active"),current:o.border.active})}),children:[e.jsxRuntimeExports.jsxs("div",{className:fe.lineField,children:[e.jsxRuntimeExports.jsxs("div",{className:fe.style,children:[e.jsxRuntimeExports.jsx("span",{className:fe.title,children:"Style"}),e.jsxRuntimeExports.jsx(lo,{items:Ra,selectedItem:o.border.style,onSelect:r=>s("border",r,"style"),getIconName:r=>r==="solid"?"Minus":"Selection"})]}),e.jsxRuntimeExports.jsx(e.Input,{label:"Radius (px)",value:String(o.border.radius),onChange:r=>s("border",r,"radius"),type:"number",min:0})]}),e.jsxRuntimeExports.jsx(e.Input,{label:"Thickness (px)",value:String(o.border.thickness),onChange:r=>s("border",r,"thickness"),type:"number",min:0}),e.jsxRuntimeExports.jsx(he,{initialColor:we(o.border.color),onChange:i("border"),title:"Color",labelStyle:"secondary",isGradientActive:!1})]}),e.jsxRuntimeExports.jsxs(nt,{title:"Label",children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Line Height (px)",value:String(o.label.height),onChange:r=>s("label",r,"height"),type:"number",min:0}),e.jsxRuntimeExports.jsx(e.Select,{label:"Font Size (px)",onChange:r=>s("label",r,"size"),value:String(o.label.size),options:Rt}),e.jsxRuntimeExports.jsx(he,{initialColor:we(o.label.color),onChange:i("label"),title:"Color",labelStyle:"secondary",isGradientActive:!1}),e.jsxRuntimeExports.jsxs("div",{className:fe.alignments,children:[e.jsxRuntimeExports.jsx("h4",{className:fe.title,children:"Alignment Type"}),e.jsxRuntimeExports.jsx(lo,{items:va,selectedItem:o.label.alignment,onSelect:r=>s("label",r,"alignment"),getIconName:r=>r==="center"?"AlignCenterHorizontal":r==="left"?"AlignLeft":"AlignRight"})]})]})]})},ya="_wrapper_1yw63_2",ba="_color_1yw63_24",wa="_content_1yw63_33",ka="_preview_1yw63_42",Na="_container_1yw63_52",Ta="_buttonWrapper_1yw63_62",La="_button_1yw63_62",Pa="_buttonBorder_1yw63_80",Aa="_buttonBackground_1yw63_83",Ba="_text_1yw63_87",Ma="_textText_1yw63_93",$a="_icon_1yw63_97",Fa="_iconIcon_1yw63_100",Da="_annotation_1yw63_104",Ha="_annotationText_1yw63_111",Oa="_label_1yw63_116",Ua="_circle_1yw63_127",Wa="_line_1yw63_140",Ga="_circle1_1yw63_154",qa="_circle2_1yw63_159",Va="_annotationIcon_1yw63_164",za="_annotationBorder_1yw63_192",Za="_line1_1yw63_203",Xa="_line2_1yw63_210",Ya="_circle3_1yw63_227",Ka="_circle4_1yw63_232",Ja="_annotationSurface_1yw63_237",y={wrapper:ya,color:ba,content:wa,preview:ka,container:Na,buttonWrapper:Ta,button:La,buttonBorder:Pa,buttonBackground:Aa,text:Ba,textText:Ma,icon:$a,iconIcon:Fa,annotation:Da,annotationText:Ha,label:Oa,circle:Ua,line:Wa,circle1:Ga,circle2:qa,annotationIcon:Va,annotationBorder:za,line1:Za,line2:Xa,circle3:Ya,circle4:Ka,annotationSurface:Ja},Qa=()=>{const{activeColorCategory:t}=e.useThemeSettingsStore();return e.jsxRuntimeExports.jsx("div",{className:y.container,children:e.jsxRuntimeExports.jsxs("div",{className:y.buttonWrapper,children:[e.jsxRuntimeExports.jsxs("div",{className:e.clx(y.button,{[y.buttonBorder]:t==="border",[y.buttonBackground]:t==="surface"}),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Smiley",className:e.clx(y.icon,{[y.iconIcon]:t==="text"}),width:22,height:22,fill:"#757575"}),e.jsxRuntimeExports.jsx("span",{className:e.clx(y.text,{[y.textText]:t==="text"}),children:"Button Example"})]}),t==="text"&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(y.annotation,y.annotationText),children:[e.jsxRuntimeExports.jsx("div",{className:y.label,children:"Text Color"}),e.jsxRuntimeExports.jsx("div",{className:y.line}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle1)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle2)})]}),t==="text"&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(y.annotation,y.annotationIcon),children:[e.jsxRuntimeExports.jsx("div",{className:y.label,children:"Icon Color"}),e.jsxRuntimeExports.jsx("div",{className:y.line}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle1)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle2)})]}),t==="border"&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(y.annotation,y.annotationBorder),children:[e.jsxRuntimeExports.jsx("div",{className:y.label,children:"Border Color"}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.line,y.line1)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.line,y.line2)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle1)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle2)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle3)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle4)})]}),t==="surface"&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(y.annotation,y.annotationSurface),children:[e.jsxRuntimeExports.jsx("div",{className:y.label,children:"Surface Color"}),e.jsxRuntimeExports.jsx("div",{className:y.line}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle1)}),e.jsxRuntimeExports.jsx("div",{className:e.clx(y.circle,y.circle2)})]})]})})},ec={text:["primary","secondary","tertiary","inverted","action","action-hover","disabled","warning","error","success","information","link"],border:["primary","secondary","action","actionHover","disabled","warning","error","success","information","focus"],surface:["primary","secondary","action1","action1Hover","action2","action2Hover","disabled","warning","error","success","information","modal"]},tc=()=>{const{activeBlock:t,setActiveColorCategory:n,activeColorCategory:o,themeSettings:s,updateColor:i}=e.useThemeSettingsStore();function r(){n(null)}function a(d,g,m){i(d,g,m)}const c=!!((t==null?void 0:t.name)==="Colors"&&o),u=(t==null?void 0:t.name)!=="Colors"||!o,h=o?ec[o]:[];return e.jsxRuntimeExports.jsxs(lt,{isOpen:c,isClose:u,children:[e.jsxRuntimeExports.jsx(ct,{onClick:r,title:o==="text"?"Text & Icon Colors":`${we(o)} Colors`}),o&&e.jsxRuntimeExports.jsxs("div",{className:y.wrapper,children:[e.jsxRuntimeExports.jsx(Qa,{}),h.map(d=>{const g=s.colors[o][d];return typeof g!="string"?null:e.jsxRuntimeExports.jsx("div",{className:y.color,children:e.jsxRuntimeExports.jsxs("div",{className:y.content,children:[e.jsxRuntimeExports.jsx("div",{className:y.preview,style:{background:g}}),e.jsxRuntimeExports.jsx(he,{title:we(d),initialColor:g,onChange:m=>a(o,d,m),isGradientActive:o==="surface"})]})},d)})]})]})},oc="_loader_1p5lr_1",nc={loader:oc},sc=()=>{const{activeBlock:t,themeSettings:n,isLoadingThemeSettings:o}=e.useThemeSettingsStore();return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:o?e.jsxRuntimeExports.jsx("div",{className:nc.loader,children:e.jsxRuntimeExports.jsx($e,{})}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[(t==null?void 0:t.name)==="Fonts"&&n.fonts&&e.jsxRuntimeExports.jsx(da,{}),(t==null?void 0:t.name)==="Fonts"&&n.fonts&&e.jsxRuntimeExports.jsx(ta,{}),(t==null?void 0:t.name)==="Colors"&&n.colors&&e.jsxRuntimeExports.jsx(Ji,{}),(t==null?void 0:t.name)==="Colors"&&n.colors&&e.jsxRuntimeExports.jsx(tc,{}),(t==null?void 0:t.name)==="Inputs"&&n.inputs&&e.jsxRuntimeExports.jsx(Ea,{}),(t==null?void 0:t.name)==="Borders"&&n.borders&&e.jsxRuntimeExports.jsx(Ai,{}),(t==null?void 0:t.name)==="Buttons"&&n.buttons&&e.jsxRuntimeExports.jsx(Xi,{})]})})},rc=()=>{const{activeBlock:t,setActiveBlock:n}=e.useThemeSettingsStore(),{activeBlock:o}=e.useNavbarStore(),s=e.useNavigate();function i(){n(null),s("/admin/builder/theme")}const r=!!t,a=!t||o.name!=="Theme";return e.jsxRuntimeExports.jsxs(lt,{isOpen:r,isClose:a,children:[e.jsxRuntimeExports.jsx(ct,{onClick:i,title:(t==null?void 0:t.name)||""}),e.jsxRuntimeExports.jsx(sc,{})]})},ic=()=>{const{activeBlock:t}=e.useNavbarStore(),{showTooltip:n}=e.useTooltipStore();function o(){switch(t.name){case"Layers":return"Layers";case"Add":return"Add Sections";case"Theme":return"Theme Settings";case"Settings":return"Settings"}}return e.jsxRuntimeExports.jsxs("div",{className:co.sidebar,style:{zIndex:n?50:"auto"},children:[e.jsxRuntimeExports.jsx("h3",{className:co.title,children:o()}),t.name==="Layers"&&e.jsxRuntimeExports.jsx(zr,{}),t.name==="Add"&&e.jsxRuntimeExports.jsx(Io,{}),e.jsxRuntimeExports.jsx(Ei,{}),e.jsxRuntimeExports.jsx(rc,{}),t.name==="Theme"&&e.jsxRuntimeExports.jsx(oi,{}),t.name==="Settings"&&e.jsxRuntimeExports.jsx(Yr,{})]})},ac="_wrapper_no6if_1",cc="_header_no6if_12",lc="_content_no6if_23",uc="_buttons_no6if_44",dc="_label_no6if_51",pc="_description_no6if_52",mc="_preview_no6if_60",xc="_block_no6if_66",hc="_slug_no6if_75",gc="_title_no6if_81",jc="_closeIcon_no6if_87",je={wrapper:ac,header:cc,content:lc,buttons:uc,label:dc,description:pc,preview:mc,block:xc,slug:hc,title:gc,closeIcon:jc},Ic=()=>{var K,Z,M,b,E,D,J;const{setIsOpenModal:t,pages:n,createPage:o,updatePage:s,isEdit:i,setIsEdit:r,editedPage:a,setEditedPage:c,pageContext:u}=e.usePagesStore(),{setIsOpen:h}=e.useModalStore(),{createPage:d,updatePage:g}=e.useLayersStore(),[m,f]=p.useState(a?n&&((K=n[a])==null?void 0:K.path):""),[j,l]=p.useState(a?n&&((Z=n[a])==null?void 0:Z.name):""),[S,x]=p.useState(a?n&&((M=n[a])==null?void 0:M.seo)&&((E=(b=n[a])==null?void 0:b.seo)==null?void 0:E.pageDescription)||"":`${u.general.info.name} is powered by the Billgang.com platform which allows them to sell their digital products online for free.`),[C,I]=p.useState(a&&n&&(D=n[a])!=null&&D.isPrivate?"private":"public");function R(){f(""),l(""),x(""),I("public"),r(!1),c(null)}function _(){h(!1),setTimeout(()=>{R(),t(!1),h(!0)},300)}p.useEffect(()=>()=>{_()},[]);function v(U){return U[0]==="/"?U:"/"+U}function w(){o({path:v(m),name:j||m||"",icon:"File",seo:{pageTitle:j||"",pageDescription:S||""},visibility:C||"public"}),d(v(m)),_()}function F(){n&&(e.defaultPagePaths.includes(n[a].path)||go(n[a].path),g(n[a].path||"",m||""),s(a,{path:v(m),name:j||m,icon:n[a].icon||"File",seo:{pageTitle:j||"",pageDescription:S||""},visibility:C||"public"})),_()}return e.jsxRuntimeExports.jsxs("div",{className:je.wrapper,onClick:U=>U.stopPropagation(),children:[e.jsxRuntimeExports.jsxs("div",{className:je.header,children:[e.jsxRuntimeExports.jsx("h2",{children:i?"Edit Page":"Create New Page"}),e.jsxRuntimeExports.jsx("div",{className:je.closeIcon,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"X",fill:"#757575",hoverable:!0,onClick:_})})]}),e.jsxRuntimeExports.jsxs("div",{className:je.content,children:[e.jsxRuntimeExports.jsx(e.Input,{label:"Page Slug",onChange:U=>f(U),value:m,placeholder:"path-to-page",disabled:!!(a&&n&&((J=n[a])!=null&&J.name)&&e.defaultPagePaths.includes(n[a].path)),required:!0,regex:"^.+$"}),e.jsxRuntimeExports.jsx(e.Input,{label:"Page Title",onChange:U=>{l(U)},value:j.charAt(0).toUpperCase()+j.slice(1),placeholder:"Contact us"}),e.jsxRuntimeExports.jsx(e.Textarea,{label:"Description",onChange:U=>x(U),value:S,placeholder:`${u.general.info.name} is powered by the Billgang.com platform which allows them to sell their digital products online for free.`,maxLength:150}),e.jsxRuntimeExports.jsxs("div",{className:je.preview,children:[e.jsxRuntimeExports.jsx("span",{className:je.label,children:"Preview"}),e.jsxRuntimeExports.jsxs("div",{className:je.block,children:[e.jsxRuntimeExports.jsx("span",{className:je.slug,children:m||"yoursite.url"}),e.jsxRuntimeExports.jsx("span",{className:je.title,children:j||"My Blank Page"}),e.jsxRuntimeExports.jsx("span",{className:je.description,children:S||"It is My Description"})]})]})]}),e.jsxRuntimeExports.jsxs("div",{className:je.buttons,children:[e.jsxRuntimeExports.jsx(e.Button,{onClick:_,type:"Secondary",children:"Cancel"}),e.jsxRuntimeExports.jsx(e.Button,{onClick:i?F:w,disabled:m.length===0,children:i?"Update":"Create"})]})]})},fc="_layout_1pjho_1",Sc="_main_1pjho_10",_c="_content_1pjho_18",Cc="_notifications_1pjho_26",gt={layout:fc,main:Sc,content:_c,notifications:Cc},vc="_notification_2jmah_1",Rc="_text_2jmah_22",Ec="_timer_2jmah_27",yc="_warning_2jmah_32",bc="_error_2jmah_37",wc="_success_2jmah_42",Ve={notification:vc,text:Rc,timer:Ec,warning:yc,error:bc,success:wc},uo={warning:"#C1972A",error:"#FF3F19",success:"#338B13"},fo=t=>{const{type:n,message:o,style:s,padding:i,timer:r,id:a,element:c}=t,[u,h]=p.useState(r),{setNotifications:d}=e.useNotificationStore();function g(){const f=e.useNotificationStore.getState().notifications.filter(j=>j.id!==a);d([...f])}return p.useEffect(()=>{const m=setTimeout(()=>{g()},r*1e3);return()=>clearTimeout(m)},[r]),p.useEffect(()=>{const m=setInterval(()=>h(f=>f-1),1e3);return()=>clearInterval(m)},[u]),c?c({type:n,message:o,style:s,padding:i,timer:r,id:a}):e.jsxRuntimeExports.jsx("div",{style:{padding:i,position:"relative"},children:e.jsxRuntimeExports.jsxs("div",{className:e.clx(Ve.notification,{[Ve.warning]:n==="warning",[Ve.error]:n==="error",[Ve.success]:n==="success"}),style:s,children:[e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Info",fill:uo[n],width:20,height:20})}),e.jsxRuntimeExports.jsx("div",{className:Ve.text,children:o}),r&&e.jsxRuntimeExports.jsx("div",{className:Ve.timer,children:u}),e.jsxRuntimeExports.jsx("div",{style:{display:"flex"},children:e.jsxRuntimeExports.jsx(e.Icon,{name:"X",fill:uo[n],width:20,height:20,hoverable:!0,onClick:()=>g()})})]})})},kc="_modal_1h74q_1",Nc="_title_1h74q_14",Tc="_buttons_1h74q_20",jt={modal:kc,title:Nc,buttons:Tc},So=()=>{const{title:t,description:n,onConfirm:o,setTitle:s,setDescription:i,setOnConfirm:r}=e.useConfirmationModalStore(),{setIsOpen:a}=e.useModalStore();function c(){a(!1),setTimeout(()=>{s(null),i(null),r(null),a(!0)},300)}return t&&n&&o&&e.jsxRuntimeExports.jsxs("div",{className:jt.modal,onClick:u=>u.stopPropagation(),children:[e.jsxRuntimeExports.jsx("div",{className:jt.title,children:t}),e.jsxRuntimeExports.jsx("div",{className:jt.description,children:n}),e.jsxRuntimeExports.jsxs("div",{className:jt.buttons,children:[e.jsxRuntimeExports.jsx(e.Button,{onClick:c,children:"Cancel"}),e.jsxRuntimeExports.jsx(e.Button,{onClick:()=>{o(),c()},type:"Secondary",children:"Confirm"})]})]})},Lc="_modal_270ti_1",Pc="_padding_270ti_17",Ac="_content_270ti_21",Bc="_close_270ti_42",It={modal:Lc,padding:Pc,content:Ac,close:Bc},vt=t=>{const{close:n,children:o,withAnimation:s=!0,hasPadding:i=!0}=t,{isOpen:r,setIsOpen:a}=e.useModalStore();return p.useEffect(()=>{const c=()=>{a(!1),s?setTimeout(()=>{n(!1),a(!0)},300):(n(!1),a(!0))};return document.body.addEventListener("click",c),()=>{document.body.removeEventListener("click",c)}},[]),e.jsxRuntimeExports.jsx("div",{className:e.clx(It.modal,{[It.padding]:i}),children:s?e.jsxRuntimeExports.jsx("div",{className:e.clx(It.content,{[It.close]:!r}),children:o}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:o})})},Mc=()=>{const{isOpenModal:t,setIsOpenModal:n}=e.usePagesStore(),{openModal:o,setOpenModal:s}=e.useChooseImageStore(),{notifications:i}=e.useNotificationStore(),{title:r,description:a,setTitle:c,setDescription:u,setOnConfirm:h}=e.useConfirmationModalStore();return e.jsxRuntimeExports.jsxs("div",{id:"builder",children:[e.jsxRuntimeExports.jsxs("div",{className:gt.layout,children:[e.jsxRuntimeExports.jsx(Cs,{}),e.jsxRuntimeExports.jsxs("main",{className:gt.main,children:[e.jsxRuntimeExports.jsx(ms,{}),e.jsxRuntimeExports.jsxs("div",{className:gt.content,children:[e.jsxRuntimeExports.jsx(ic,{}),e.jsxRuntimeExports.jsx(yr,{})]})]})]}),r&&a&&e.jsxRuntimeExports.jsx(vt,{close:()=>{c(null),u(null),h(null)},children:e.jsxRuntimeExports.jsx(So,{})}),t&&e.jsxRuntimeExports.jsx(vt,{close:n,children:e.jsxRuntimeExports.jsx(Ic,{})}),o&&e.jsxRuntimeExports.jsx(vt,{close:s,children:e.jsxRuntimeExports.jsx(e.ChooseImageModal,{})}),i.length>0&&e.jsxRuntimeExports.jsx("div",{className:gt.notifications,children:i.map(d=>e.jsxRuntimeExports.jsx(fo,{type:d.status,message:d.message,timer:d.timer||10,id:d.id,element:d.component},d.id))})]})};async function ze(t,n){const o=localStorage.getItem("shopId")||void 0,i=`${e.useApiStore.getState().apiUrls.api}/${t}/builder/shops/${o}/${n}`;return(await e.request({url:i,withToken:!0,method:"get"})).data}async function $c(){try{const[t,n,o,s,i,r,a,c]=await Promise.allSettled([ze("v1","general"),ze("v1","faqs"),ze("v1","listings"),ze("v1","products"),ze("v1","reviews"),ze("v1","categories"),{data:null},{data:null}]);return{general:t,faqs:n,listings:o,products:s,reviews:i,categories:r,fullPosts:a,posts:c}}catch(t){throw console.error("Error fetching page data:",t),t}}async function Fc(){const t=e.useApiStore.getState().apiUrls;try{const{data:n}=await e.axios.get(`${t.googleFonts}?key=AIzaSyAEsTbjAPUz_TeuFCq4z4LPK9w_vst0Pfw`);return n.items}catch(n){throw console.error("Error fetching page data:",n),n}}async function Dc(){var i;const t=localStorage.getItem("shopId"),n=localStorage.getItem("draftId"),s=`${e.useApiStore.getState().apiUrls.api}/v2/builder/shops/${t}/drafts/${n}/pages`;try{return(await e.request({url:s,withToken:!0,method:"get"})).data}catch(r){return{data:[],status:(i=r.response)==null?void 0:i.status}}}async function Hc(){const t=localStorage.getItem("shopId")||void 0,n=localStorage.getItem("draftId")||void 0,s=`${e.useApiStore.getState().apiUrls.api}/v2/builder/shops/${t}/drafts/${n}/all`;return(await e.request({url:s,withToken:!0,method:"get"})).data}const Oc=t=>{const{blocks:n,settings:o,header:s,footer:i,announcement:r}=t,{setBlocks:a,setSourceBlocks:c,setHeader:u,setFooter:h,setAnnouncement:d,setSettings:g}=e.useBlocksStore(),{fonts:m,setFonts:f}=e.useFontsStore(),{setSettings:j}=e.useSettingsStore(),{setPageContext:l}=e.usePagesStore(),{setThemeSettings:S,setIsLoadingThemeSettings:x}=e.useThemeSettingsStore(),{setIsLoadingSettings:C}=e.useSettingsStore(),{notifications:I,setNotifications:R}=e.useNotificationStore(),{setBlocks:_,blocks:v,createPage:w,setIsLoadingLayers:F,setHeader:K,setAnnouncement:Z,setFooter:M}=e.useLayersStore(),{setPages:b,setCurrentPage:E}=e.usePagesStore();return p.useEffect(()=>{x(!0),F(!0),C(!0);const D={};Object.keys(n).forEach(U=>{D[U]=n[U]}),c(D),a(D),u(s),h(i),d(r),g(o),(async()=>{const U={listings:null,products:null,reviews:null,categories:null,faqs:null,general:null,fullPosts:null,posts:null},N=await $c();Object.keys(N).map(z=>{const ue=z;U[ue]=N[ue].value.data}),l(U);const{data:A}=await Hc(),{themeSettings:W,layers:T,settings:q}=A||{};if(q){if(q.settings){const z=new o;z.blockSettings={displayName:"Settings",isAddable:!1,...q.settings},j(z.blockSettings)}q.header&&K(q.header),q.footer&&M(q.footer),q.announcement&&Z(q.announcement)}else{const z=new o;j(z.blockSettings)}W&&S(W);const ke=await Dc(),ve={};if(ke.status>=400&&R([...I,{id:e.v4(),message:"Error fetching pages",status:"error"}]),ke.data.length>0?(ke.data.forEach(z=>{var ue,X;v[z.path]||w(z.path),ve[z.id||z.path]={...z,icon:e.pages[z.path]?e.pages[z.path].icon:"File",name:z.name||((ue=z.seo)==null?void 0:ue.pageTitle)||((X=e.pages[z.path])==null?void 0:X.name)||z.path}}),b(ve),E(Object.keys(ve)[0])):(b(e.pages),E(Object.keys(e.pages)[0])),m.length===0){const z=await Fc();f([...z.map(ue=>{const X=ue.variants.map(de=>{if(!de.includes("italic"))return de==="regular"?"400":de}).filter(de=>de!==void 0);return{name:ue.family,weights:X}})])}_(T),x(!1),F(!1),C(!1)})()},[]),e.jsxRuntimeExports.jsx(Mc,{})};function Uc(){const t=new URL(window.location.href);window.history.replaceState(null,"",t.pathname+t.hash)}function Wc(){const t=new URLSearchParams(document.location.search),n=t.get("shopId")||localStorage.getItem("shopId"),o=t.get("sellerAccessToken")||localStorage.getItem("sellerAccessToken"),s=t.get("draftId")||localStorage.getItem("draftId");return Uc(),o&&localStorage.setItem("sellerAccessToken",o),n&&localStorage.setItem("shopId",n),s&&localStorage.setItem("draftId",s),!!(o&&n&&s)}const Gc="data:image/svg+xml,%3csvg%20width='204'%20height='241'%20viewBox='0%200%20204%20241'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M204%200V118.282L154.174%20134.707V69.0074L49.7111%20102.77V43.5716L204%200Z'%20fill='%23FF3F19'/%3e%3cpath%20d='M154.174%20134.694V191.155L0%20241V117.471L49.7114%20102.757V169.597L154.174%20134.694Z'%20fill='%23FF3F19'/%3e%3c/svg%3e",qc=t=>{const{blocks:n,settings:o,header:s,footer:i,announcement:r}=t,[a,c]=p.useState(!0),u=e.useNavigate(),h=e.useLocation();return p.useEffect(()=>{const d=h.pathname;if(d.startsWith("/admin/builder")){d==="/admin/builder/add"?document.title="Add Section | Builder":d==="/admin/builder/theme"?document.title="Theme Settings | Builder":d==="/admin/builder/settings"?document.title="Settings | Builder":document.title="Builder | Billgang";let g=document.querySelector("link[rel~='icon']");g||(g=document.createElement("link"),g.rel="icon",document.head.appendChild(g)),g&&(g.href=Gc)}},[h]),p.useEffect(()=>{c(!0),Wc()?c(!1):u("/")},[]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:a?e.jsxRuntimeExports.jsx($e,{}):e.jsxRuntimeExports.jsx(Oc,{blocks:n,settings:o,header:s,footer:i,announcement:r})})},Vc="_wrapper_1yd2j_1",zc="_error_1yd2j_11",Zc="_title_1yd2j_21",Xc="_buttons_1yd2j_29",st={wrapper:Vc,error:zc,title:Zc,buttons:Xc},po=async t=>{const n=localStorage.getItem("shopId")||void 0,o=localStorage.getItem("draftId"),i=`${e.useApiStore.getState().apiUrls.api}/v2/builder/shops/${n}/drafts/${o}/reset`;return await e.request({url:i,withToken:!0,method:"post",body:t})},Yc=()=>{const{error:t,setError:n}=e.useErrorStore(),{pages:o}=e.usePagesStore(),{setIsOpen:s}=e.useModalStore(),{title:i,description:r,setOnConfirm:a,setTitle:c,setDescription:u}=e.useConfirmationModalStore(),{setBlocks:h}=e.useLayersStore();async function d(){await po({resetSettings:(t==null?void 0:t.failedSettings)??!1,resetThemeSettings:(t==null?void 0:t.failedThemeSettings)??!1,resetPageIds:(t==null?void 0:t.failedPageIds)??[]}),n(null),h({}),window.location.reload()}async function g(){const m=[];o&&Object.keys(o).map(f=>o[f].id).filter(f=>f!==void 0).map(f=>m.push(f)),await po({resetSettings:!0,resetThemeSettings:!0,resetPageIds:m}),n(null)}return e.jsxRuntimeExports.jsxs("div",{className:st.wrapper,children:[e.jsxRuntimeExports.jsxs("div",{className:st.error,children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("div",{className:st.title,children:"Oops! Something went wrong"}),e.jsxRuntimeExports.jsx("span",{className:st.message,children:(t==null?void 0:t.message)||""})]}),e.jsxRuntimeExports.jsxs("div",{className:st.buttons,children:[e.jsxRuntimeExports.jsx(e.Button,{type:"Primary",onClick:d,children:"Reset Settings"}),e.jsxRuntimeExports.jsx(e.Button,{type:"Secondary",onClick:m=>{m.stopPropagation(),c("Reset All Settings"),u("Are you sure you want to reset all settings? This is irreversible."),a(async()=>{await g()})},children:"Reset All Settings"})]})]}),i&&r&&e.jsxRuntimeExports.jsx(vt,{close:()=>{s(!1),setTimeout(()=>{c(null),u(null),a(null),s(!0)},300)},children:e.jsxRuntimeExports.jsx(So,{})})]})},Kc=t=>{const{children:n}=t,{pathname:o}=e.useLocation(),{setActiveBlock:s}=e.useNavbarStore(),{setActiveBlock:i}=e.useThemeSettingsStore(),{setActiveBlock:r}=e.usePreviewStore();return p.useEffect(()=>{switch(r({id:null,neededScroll:!1}),o){case"/admin/builder":s(e.navbarBlocks[0]);break;case"/admin/builder/add":s(e.navbarBlocks[1]);break;case"/admin/builder/theme":s(e.navbarBlocks[2]);break;case"/admin/builder/settings":s(e.navbarBlocks[3]);break;case"/admin/builder/theme/colors":s(e.navbarBlocks[2]),i(Se[0]);break;case"/admin/builder/theme/fonts":s(e.navbarBlocks[2]),i(Se[1]);break;case"/admin/builder/theme/borders":s(e.navbarBlocks[2]),i(Se[2]);break;case"/admin/builder/theme/buttons":s(e.navbarBlocks[2]),i(Se[3]);break;case"/admin/builder/theme/inputs":s(e.navbarBlocks[2]),i(Se[4]);break}},[o]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:n})},Jc="_lock_1mxa7_1",Qc="_wrapper_1mxa7_12",el="_content_1mxa7_22",tl="_info_1mxa7_31",ol="_buttons_1mxa7_38",nl="_button_1mxa7_38",sl="_input_1mxa7_50",rl="_error_1mxa7_57",Ee={lock:Jc,wrapper:Qc,content:el,info:tl,buttons:ol,button:nl,input:sl,error:rl},il=()=>{const[t,n]=p.useState(!1),[o,s]=p.useState(!1),[i,r]=p.useState(""),{general:a,setGeneral:c}=e.useGeneralStore(),{setShopPassword:u}=e.useStorefrontStore(),h=e.useLocation(),d=e.useNavigate();p.useEffect(()=>{if(a&&(!a.info.passwordProtected||a.isPasswordValid)){const m=h.state.from==="/validation"?"/":h.state.from;d(m)}},[a]),p.useEffect(()=>{a||(async()=>{var l;n(!0);const f=localStorage.getItem("shopPassword")||"",j=await Wt(f);if(j.isPasswordValid){const S=((l=h.state)==null?void 0:l.from)||"/";d(S)}j.info.passwordProtected||(localStorage.removeItem("shopPassword"),u("")),c(j),n(!1)})()},[a]);async function g(){var f;n(!0);const m=await Wt(i);if(!m.isPasswordValid)s(!0);else{localStorage.setItem("shopPassword",i),u(i);const j=((f=h.state)==null?void 0:f.from)||"/";d(j),m.info.passwordProtected||(localStorage.removeItem("shopPassword"),u("")),c(m)}n(!1)}return e.jsxRuntimeExports.jsxs("div",{className:Ee.wrapper,children:[!t&&e.jsxRuntimeExports.jsxs("div",{className:Ee.content,children:[e.jsxRuntimeExports.jsx("div",{className:Ee.lock,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Lock",fill:"var(--text-secondary)",width:64,height:64})}),e.jsxRuntimeExports.jsxs("div",{className:Ee.info,children:[e.jsxRuntimeExports.jsx("h2",{id:"h2",className:Ee.title,children:"The store is password protected"}),e.jsxRuntimeExports.jsx("p",{id:"p",className:Ee.description,children:"If you do not have a password, we recommend you to contact the technical support of the store or write to the mail"})]}),e.jsxRuntimeExports.jsxs("div",{className:Ee.input,children:[e.jsxRuntimeExports.jsx(e.Input$1,{type:"password",onChange:m=>{s(!1),r(m)},value:i,placeholder:"Password",required:!0}),e.jsxRuntimeExports.jsx("span",{className:Ee.error,children:o&&"Incorrect password"})]}),e.jsxRuntimeExports.jsx("div",{className:Ee.buttons,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",className:Ee.button,disabled:o,onClick:g,children:"Submit"})})]}),t&&e.jsxRuntimeExports.jsx(e.Loader,{})]})},al="_notifications_2ywhg_1",cl={notifications:al},ll=()=>(p.useEffect(()=>{document.title="Temporarily Unavailable"},[]),e.jsxRuntimeExports.jsx("div",{style:{display:"flex",flexDirection:"column",width:"100vw",height:"100vh",overflowY:"scroll",overflowX:"hidden",background:"var(--surface-primary)",color:"var(--text-primary)"},children:e.jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",flex:"1",justifyContent:"center",alignItems:"center",gap:"24px"},children:[e.jsxRuntimeExports.jsx("h2",{style:{color:"var(--text-primary)",fontSize:"var(--font-heading-h2-size)"},children:"Temporarily Unavailable"}),e.jsxRuntimeExports.jsx("span",{style:{color:"var(--text-secondary)",fontSize:"var(--font-heading-h3-size)",width:"85%",textAlign:"center"},children:"We're making some quick updates to improve your shopping experience. During this time, browsing and checkout are temporarily unavailable."})]})})),ul="_notification_o93uc_1",dl="_accent_o93uc_15",pl="_body_o93uc_23",ml="_label_o93uc_30",xl="_content_o93uc_36",hl="_timer_o93uc_41",gl="_warning_o93uc_48",jl="_error_o93uc_53",Il="_success_o93uc_58",De={notification:ul,accent:dl,body:pl,label:ml,content:xl,timer:hl,warning:gl,error:jl,success:Il},fl={warning:"Warning",error:"Error",success:"Success"},Sl=({type:t,message:n,style:o,padding:s=0,timer:i=0})=>{const[r,a]=p.useState(i);return p.useEffect(()=>{if(!i)return;const c=setInterval(()=>a(u=>u-1),1e3);return()=>clearInterval(c)},[]),e.jsxRuntimeExports.jsx("div",{style:{padding:s,position:"relative"},children:e.jsxRuntimeExports.jsxs("div",{className:e.clx(De.notification,De[t]),style:o,children:[e.jsxRuntimeExports.jsx("div",{className:De.accent}),e.jsxRuntimeExports.jsx("div",{className:De.body,children:e.jsxRuntimeExports.jsxs("div",{className:De.content,children:[e.jsxRuntimeExports.jsxs("span",{className:De.label,children:[fl[t],":"]})," ",n]})}),i>0&&e.jsxRuntimeExports.jsx("span",{className:De.timer,children:r})]})})},_l=({children:t})=>{const n=e.useLocation(),{token:o,setToken:s}=e.useStorefrontStore(),{dashInfo:i,setDashInfo:r}=e.useCustomerDashboardStore(),{shopPassword:a}=e.useStorefrontStore(),c=e.useNavigate(),[u,h]=e.useSearchParams(),{notifications:d}=e.useNotificationStore(),[g,m]=p.useState(!0),{setCustomerEmail:f}=e.useCartStore(),{setThemeSettings:j,themeSettings:l}=e.useThemeSettingsStore(),{settings:S,setSettings:x}=e.useSettingsStore(),{setHeader:C,setFooter:I,setAnnouncement:R}=e.useLayersStore(),{general:_,setGeneral:v,isAntistock:w}=e.useGeneralStore(),{pageContext:F,setPageContext:K}=e.usePagesStore();e.useTrackingAnalytics((_==null?void 0:_.info.id)||localStorage.getItem("shopId")||"");const Z=async()=>{const M=await e.getDynamicPage(encodeURIComponent("/products"),_==null?void 0:_.info.passwordProtected);if(M){const{data:b}=M;K({...F,listings:b.listings})}};return p.useEffect(()=>{const M=localStorage.getItem("token");if(M&&(!o||!i))try{const b=e.jwtDecode(M);r(b),s(M),f(b.email)}catch(b){console.error("Failed to decode token:",b),localStorage.removeItem("token"),s(""),r(null)}},[o,i]),p.useEffect(()=>{const M=u.get("r");M&&(localStorage.setItem("referralCode",M),u.delete("r"),h(u),c({pathname:n.pathname,search:u.toString()},{replace:!0}))},[u,n]),p.useEffect(()=>{!n.pathname.startsWith("/products")&&!n.pathname.startsWith("/admin/builder")&&_&&(_.info.passwordProtected&&a||_.isPasswordValid)&&Z()},[_,a]),p.useLayoutEffect(()=>{const M=async()=>{if(m(!0),!_){const E=await Wt(a);if(!E.isPasswordValid&&!n.pathname.includes("/admin/builder")){c("/validation",{state:{from:n.pathname}});return}if(!E.info.passwordProtected){localStorage.removeItem("shopPassword");const{setShopPassword:D}=e.useStorefrontStore.getState();D("")}v(E)}},b=async()=>{m(!0);const{settings:E,theme:D}=(await pn()).data;E?(E.settings&&x(E.settings),E.header&&C(JSON.parse(JSON.stringify(E.header))),E.footer&&I(JSON.parse(JSON.stringify(E.footer))),E.announcement&&R(JSON.parse(JSON.stringify(E.announcement)))):x(S),j(D||l),m(!1)};n.pathname.startsWith("/validation")||M(),b()},[]),w&&(_!=null&&_.info.onHold)?e.jsxRuntimeExports.jsx(ll,{}):n.pathname.startsWith("/admin/builder")?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:t}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:g?e.jsxRuntimeExports.jsx("div",{style:{width:"100vw",height:"100dvh",display:"flex",justifyContent:"center",alignItems:"center"},children:e.jsxRuntimeExports.jsx(e.Loader,{})}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[t,d.length>0&&e.jsxRuntimeExports.jsx("div",{className:cl.notifications,children:d.map(M=>e.jsxRuntimeExports.jsx(fo,{type:M.status,message:M.message,timer:M.timer||10,id:M.id,element:w?Sl:M.component},M.id))})]})})},Cl=()=>(p.useEffect(()=>{setTimeout(()=>{window.location.reload()},500)},[]),e.jsxRuntimeExports.jsx("div",{style:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},children:e.jsxRuntimeExports.jsx(e.Loader,{})})),vl="_wrapper_ej209_1",Rl="_content_ej209_12",El="_title_ej209_22",Dt={wrapper:vl,content:Rl,title:El},Ne=()=>{const t=e.useNavigate(),n=e.useRouteError();return console.error("ROUTE ERROR: ",n),alert(n),e.jsxRuntimeExports.jsx("div",{className:Dt.wrapper,children:e.jsxRuntimeExports.jsxs("div",{className:Dt.content,children:[e.jsxRuntimeExports.jsx("h1",{className:Dt.title,children:"Something Went Wrong"}),e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",onClick:()=>{t("/")},children:"Go Home"})]})})},yl=({children:t,shopDomain:n,shopId:o,shopPassword:s,shopLogo:i})=>{const{setShopDomain:r,setShopId:a,setShopPassword:c,setShopTerms:u,setShopPrivacyPolicy:h,setShopRefundPolicy:d,setShopLogo:g}=e.useStorefrontStore();return p.useLayoutEffect(()=>{const m=async()=>{const{data:l}=await xn();u(l)},f=async()=>{const{data:l}=await gn();h(l)},j=async()=>{const{data:l}=await hn();d(l)};r(n),a(o),s&&c(s),i&&g(i),m(),f(),j()},[n,o,s]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:t})},bl="_checkoutItemsContainer_1kn61_2",wl="_innerContainer_1kn61_16",kl="_headerSection_1kn61_22",Nl="_header_1kn61_22",Tl="_productsContainer_1kn61_47",Ll="_couponContainer_1kn61_54",Pl="_checkoutFooter_1kn61_58",He={checkoutItemsContainer:bl,innerContainer:wl,headerSection:kl,header:Nl,productsContainer:Tl,couponContainer:Ll,checkoutFooter:Pl},Al="_checkoutFooter_sum4s_1",Bl="_antistock_sum4s_12",Ml="_footerBranding_sum4s_22",$l="_poweredText_sum4s_27",Fl="_antistockLink_sum4s_31",Dl="_footerNav_sum4s_39",Ze={checkoutFooter:Al,antistock:Bl,footerBranding:Ml,poweredText:$l,antistockLink:Fl,footerNav:Dl},Hl="data:image/svg+xml,%3csvg%20width='100'%20height='26'%20viewBox='0%200%20100%2026'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M20.3996%203.39999V12.8228L16.2964%2014.1313V8.89738L7.69363%2011.587V6.87107L20.3996%203.39999Z'%20fill='%23FF3F19'/%3e%3cpath%20d='M16.2964%2014.1313L16.2962%2018.6292L3.59961%2022.6V12.7592L7.69363%2011.587L7.69344%2016.9118L16.2964%2014.1313Z'%20fill='%23FF3F19'/%3e%3cpath%20d='M95.6308%2022C93.4931%2022%2091.8804%2020.882%2091.4678%2019.1776L93.118%2019.0676C93.4181%2019.984%2094.0931%2020.5338%2095.6308%2020.5338C97.4311%2020.5338%2098.4249%2019.8373%2098.4249%2018.4078V16.8316C97.9374%2017.858%2096.8122%2018.5178%2095.5183%2018.5178C92.9868%2018.5178%2091.1865%2016.575%2091.1865%2013.8076C91.1865%2011.0401%2092.9492%209.09737%2095.4433%209.09737C96.831%209.09737%2098.0499%209.77549%2098.5%2010.8568V9.3173H100V18.3711C100%2020.6438%2098.3687%2022%2095.6308%2022ZM95.5933%2017.0515C97.2998%2017.0515%2098.4062%2015.8053%2098.4249%2013.8076C98.4624%2011.8099%2097.3186%2010.5636%2095.5933%2010.5636C93.8494%2010.5636%2092.8367%2011.8099%2092.8367%2013.8076C92.8367%2015.8053%2093.8869%2017.0515%2095.5933%2017.0515Z'%20fill='%23252525'/%3e%3cpath%20d='M81.1836%2019.0309V9.3173H82.6275L82.665%2011.0584C83.1901%209.72051%2084.3527%209.09737%2085.7217%209.09737C87.9907%209.09737%2089.0783%2010.7285%2089.0783%2012.7812V19.0309H87.5031V13.2211C87.5031%2011.425%2086.8843%2010.4536%2085.3841%2010.4536C83.8464%2010.4536%2082.7588%2011.425%2082.7588%2013.2211V19.0309H81.1836Z'%20fill='%23252525'/%3e%3cpath%20d='M73.3176%2019.2509C71.2549%2019.2509%2069.9609%2018.2795%2069.9609%2016.6117C69.9609%2014.9622%2070.9173%2014.0458%2073.0926%2013.6426L76.618%2013.0011C76.618%2011.37%2075.8304%2010.5636%2074.2552%2010.5636C72.8676%2010.5636%2072.0987%2011.1867%2071.7987%2012.3047L70.1297%2012.1764C70.5048%2010.3436%2072.0049%209.09737%2074.2552%209.09737C76.8056%209.09737%2078.1932%2010.6002%2078.1932%2013.0561V17.0699C78.1932%2017.5097%2078.3433%2017.6747%2078.7183%2017.6747H79.1121V19.0309C78.9996%2019.0493%2078.7558%2019.0676%2078.512%2019.0676C77.3119%2019.0676%2076.7681%2018.6094%2076.6368%2017.5281C76.1492%2018.5361%2074.7803%2019.2509%2073.3176%2019.2509ZM73.4676%2017.8946C75.4554%2017.8946%2076.618%2016.6483%2076.618%2015.0355V14.3391L73.3926%2014.9255C72.0425%2015.1638%2071.6111%2015.6586%2071.6111%2016.4651C71.6111%2017.3814%2072.305%2017.8946%2073.4676%2017.8946Z'%20fill='%23252525'/%3e%3cpath%20d='M63.2168%2022C61.079%2022%2059.4663%2020.882%2059.0537%2019.1776L60.704%2019.0676C61.004%2019.984%2061.6791%2020.5338%2063.2168%2020.5338C65.017%2020.5338%2066.0109%2019.8373%2066.0109%2018.4078V16.8316C65.5233%2017.858%2064.3982%2018.5178%2063.1043%2018.5178C60.5727%2018.5178%2058.7725%2016.575%2058.7725%2013.8076C58.7725%2011.0401%2060.5352%209.09737%2063.0293%209.09737C64.4169%209.09737%2065.6358%209.77549%2066.0859%2010.8568V9.3173H67.5861V18.3711C67.5861%2020.6438%2065.9546%2022%2063.2168%2022ZM63.1793%2017.0515C64.8857%2017.0515%2065.9921%2015.8053%2066.0109%2013.8076C66.0484%2011.8099%2064.9045%2010.5636%2063.1793%2010.5636C61.4353%2010.5636%2060.4227%2011.8099%2060.4227%2013.8076C60.4227%2015.8053%2061.4728%2017.0515%2063.1793%2017.0515Z'%20fill='%23252525'/%3e%3cpath%20d='M56.2141%2019.0309C55.0515%2019.0309%2054.2451%2018.4811%2054.2451%2017.1982L54.2639%206.01834H55.8391V17.0699C55.8391%2017.4731%2056.0453%2017.6747%2056.4579%2017.6747H57.3205V19.0309H56.2141Z'%20fill='%23252525'/%3e%3cpath%20d='M51.0686%2019.0309C49.906%2019.0309%2049.0996%2018.4811%2049.0996%2017.1982L49.1184%206.01834H50.6936V17.0699C50.6936%2017.4731%2050.8998%2017.6747%2051.3124%2017.6747H52.175V19.0309H51.0686Z'%20fill='%23252525'/%3e%3cpath%20d='M44.5209%2019.0309V9.3173H46.0961V19.0309H44.5209ZM44.4834%207.79611V6H46.1336V7.79611H44.4834Z'%20fill='%23252525'/%3e%3cpath%20d='M32%2019.0309V6.01834H36.5756C39.726%206.01834%2041.3012%207.09967%2041.3012%209.51891C41.3012%2010.9851%2040.4198%2012.0481%2038.9384%2012.3047C40.7574%2012.5613%2041.8638%2013.7709%2041.8638%2015.4571C41.8638%2017.8213%2040.2323%2019.0309%2037.3257%2019.0309H32ZM37.3257%2017.4914C39.1447%2017.4914%2040.176%2016.74%2040.176%2015.3654C40.176%2013.9908%2039.1447%2013.1844%2037.3257%2013.1844H33.6127V17.4914H37.3257ZM36.5756%2011.6449C38.5258%2011.6449%2039.6135%2010.8935%2039.6135%209.59222C39.6135%208.21765%2038.6008%207.55786%2036.5756%207.55786H33.6127V11.6449H36.5756Z'%20fill='%23252525'/%3e%3c/svg%3e",Ce=({className:t})=>{const{shopTerms:n,shopPrivacyPolicy:o,shopRefundPolicy:s,shopLogo:i}=e.useStorefrontStore(),{isAntistock:r}=e.useGeneralStore();return e.jsxRuntimeExports.jsxs("footer",{className:`${Ze.checkoutFooter} ${t} ${r?Ze.antistock:""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:Ze.footerBranding,children:[e.jsxRuntimeExports.jsx("p",{className:Ze.poweredText,id:"md",style:r?{color:"var(--text-action)"}:void 0,children:"Powered by"}),r?e.jsxRuntimeExports.jsxs("a",{className:Ze.antistockLink,href:"https://antistock.io",target:"_blank",rel:"noopener noreferrer",children:[e.jsxRuntimeExports.jsx(e.SvgMiniLogoAntistock,{width:14,height:18}),"Antistock"]}):i||e.jsxRuntimeExports.jsx("img",{src:Hl,alt:"Billgang"})]}),e.jsxRuntimeExports.jsx("nav",{children:e.jsxRuntimeExports.jsxs("ul",{className:Ze.footerNav,children:[(n==null?void 0:n.showTermsOfServiceOnProduct)&&!r&&e.jsxRuntimeExports.jsx("li",{children:e.jsxRuntimeExports.jsx("a",{href:n.termsOfService,target:"_blank",rel:"noopener noreferrer",children:"Terms"})}),(o==null?void 0:o.showPrivacyPolicyOnProduct)&&e.jsxRuntimeExports.jsx("li",{children:e.jsxRuntimeExports.jsx("a",{href:o.privacyPolicy,target:"_blank",rel:"noopener noreferrer",children:"Privacy"})}),(s==null?void 0:s.showRefundPolicyOnProduct)&&e.jsxRuntimeExports.jsx("li",{children:e.jsxRuntimeExports.jsx("a",{href:s.refundPolicy,target:"_blank",rel:"noopener noreferrer",children:"Refund"})})]})})]})},Ol="_checkoutHeader_1stm3_1",Ul="_leftContainer_1stm3_20",Wl="_backArrow_1stm3_26",Gl="_logoContainer_1stm3_38",ql="_logo_1stm3_38",Vl="_antistockLink_1stm3_48",Xe={checkoutHeader:Ol,leftContainer:Ul,backArrow:Wl,logoContainer:Gl,logo:ql,antistockLink:Vl},zl="_activeBadge_1yb5i_1",Zl="_activeBadgeText_1yb5i_12",mo={activeBadge:zl,activeBadgeText:Zl},Xl=({className:t})=>e.jsxRuntimeExports.jsxs("div",{className:e.clx(mo.activeBadge,t),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Check",width:20,height:20}),e.jsxRuntimeExports.jsx("p",{className:mo.activeBadgeText,children:"Active"})]}),Yl="_timerContainer_rh66p_2",Kl="_timerText_rh66p_12",Jl="_timerContainerAntistock_rh66p_16",Ht={timerContainer:Yl,timerText:Kl,timerContainerAntistock:Jl},Ql=({expiresAt:t})=>{const[n,o]=p.useState(i()),{isAntistock:s}=e.useGeneralStore();function i(){const r=new Date,a=new Date(t).getTime()-r.getTime();if(a<=0)return{hours:"00",minutes:"00",seconds:"00"};const c=Math.floor(a/(1e3*60*60)),u=Math.floor(a%(1e3*60*60)/(1e3*60)),h=Math.floor(a%(1e3*60)/1e3);return{hours:String(c).padStart(2,"0"),minutes:String(u).padStart(2,"0"),seconds:String(h).padStart(2,"0")}}return p.useEffect(()=>{const r=setInterval(()=>{o(i())},1e3);return()=>clearInterval(r)},[t]),n.hours==="00"&&n.minutes==="00"&&n.seconds==="00"?null:s?e.jsxRuntimeExports.jsxs("div",{className:Ht.timerContainerAntistock,children:[e.jsxRuntimeExports.jsxs("span",{children:[n.hours,":",n.minutes,":",n.seconds]}),e.jsxRuntimeExports.jsx("span",{children:"remaining"})]}):e.jsxRuntimeExports.jsxs("div",{className:Ht.timerContainer,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Clock"}),e.jsxRuntimeExports.jsxs("p",{className:Ht.timerText,id:"md",children:[n.hours,":",n.minutes,":",n.seconds]})]})},eu="_progressBar_mcabf_4",tu="_progressBarLabel_mcabf_12",ou="_progressBarTrack_mcabf_17",nu="_progressBarFill_mcabf_28",ft={progressBar:eu,progressBarLabel:tu,progressBarTrack:ou,progressBarFill:nu},_o=({color:t,percent:n,disablePercentLabel:o})=>e.jsxRuntimeExports.jsxs("div",{className:ft.progressBar,children:[!o&&e.jsxRuntimeExports.jsxs("p",{className:ft.progressBarLabel,children:[n,"%"]}),e.jsxRuntimeExports.jsx("div",{className:ft.progressBarTrack,children:e.jsxRuntimeExports.jsx("div",{style:{width:`${n}%`,background:t||void 0},className:ft.progressBarFill})})]}),su="_rating_1bpps_4",ru="_disabled_1bpps_9",iu="_ratingStar_1bpps_14",au="_inactive_1bpps_22",St={rating:su,disabled:ru,ratingStar:iu,inactive:au},cu=({setRating:t,rating:n,disabled:o})=>{const[s,i]=p.useState(0),r=c=>{o||i(+c.currentTarget.id)},a=c=>{o||t(c)};return e.jsxRuntimeExports.jsx("div",{className:e.clx(St.rating,{[St.disabled]:o}),onMouseLeave:()=>i(0),children:[1,2,3,4,5].map(c=>e.jsxRuntimeExports.jsx("div",{id:c.toString(),className:e.clx(St.ratingStar,{[St.inactive]:!(n>=c||s>=c)}),onMouseEnter:r,onClick:()=>a(c),children:n>=c||s>=c?e.jsxRuntimeExports.jsx(e.FilledStar,{}):e.jsxRuntimeExports.jsx(e.Icon,{name:"Star",fill:"var(--text-secondary)",width:22,height:21})},c))})},lu="_inputRange_iv6ow_4",uu="_inputRangeLabel_iv6ow_14",du="_progressBar_iv6ow_22",pu="_progressBarFill_iv6ow_29",mu="_stepsContainer_iv6ow_40",xu="_step_iv6ow_40",hu="_stepDot_iv6ow_57",gu="_current_iv6ow_61",ju="_active_iv6ow_69",Iu="_inactive_iv6ow_72",fu="_tooltip_iv6ow_77",pe={inputRange:lu,inputRangeLabel:uu,progressBar:du,progressBarFill:pu,stepsContainer:mu,step:xu,stepDot:hu,current:gu,default:"_default_iv6ow_65",active:ju,inactive:Iu,tooltip:fu},Su=({totalSteps:t,step:n,onStepChange:o,label:s})=>{const[i,r]=p.useState(n),a=i===1?0:(i-1)/(t-1)*100,c=u=>{r(u),o(u)};return e.jsxRuntimeExports.jsxs("div",{className:pe.inputRange,children:[s&&e.jsxRuntimeExports.jsx("div",{className:pe.inputRangeLabel,children:s}),e.jsxRuntimeExports.jsxs("div",{className:pe.progressBar,children:[e.jsxRuntimeExports.jsx("div",{className:pe.progressBarFill,style:{width:`${Math.ceil(a)}%`}}),e.jsxRuntimeExports.jsx("div",{className:pe.stepsContainer,children:[...Array(t)].map((u,h)=>{const d=h+1,g=d<=i,m=d===i;return e.jsxRuntimeExports.jsxs("div",{className:pe.step,onClick:()=>c(d),children:[e.jsxRuntimeExports.jsx("div",{className:e.clx(pe.stepDot,m?pe.current:pe.default,g?pe.active:pe.inactive)}),m&&e.jsxRuntimeExports.jsxs("div",{className:pe.tooltip,style:{transform:`translateX(calc(50% - ${a<99?"40px":"70px"}))`},children:[e.jsxRuntimeExports.jsx("span",{children:i}),e.jsxRuntimeExports.jsx("span",{children:i===1?"month":"months"})]})]},d)})})]})]})},ut=({className:t,expiresAt:n})=>{const{shopGeneral:o}=e.useStorefrontStore(),s=e.useNavigate(),{isAntistock:i}=e.useGeneralStore();return e.jsxRuntimeExports.jsxs("header",{className:`${Xe.checkoutHeader} ${t}`,children:[e.jsxRuntimeExports.jsxs("div",{className:Xe.leftContainer,children:[e.jsxRuntimeExports.jsx("div",{className:Xe.backArrow,onClick:()=>{window.history.length>2?s(-1):s("/")},children:e.jsxRuntimeExports.jsx(e.Icon,{name:"ArrowUp"})}),(o==null?void 0:o.info.logo)&&e.jsxRuntimeExports.jsx("div",{className:Xe.logoContainer,children:i?e.jsxRuntimeExports.jsx("a",{className:Xe.antistockLink,href:"https://antistock.io",target:"_blank",rel:"noopener noreferrer",children:"Antistock"}):e.jsxRuntimeExports.jsx("img",{className:Xe.logo,src:e.convertCfImageIdToUrl(o.info.logo.cfId)})})]}),n&&e.jsxRuntimeExports.jsx(Ql,{expiresAt:n})]})},_u="_checkoutPrices_vp75r_1",Cu="_priceRow_vp75r_12",vu="_label_vp75r_22",Ru="_totalRow_vp75r_26",Eu="_totalLabel_vp75r_37",yu="_totalValue_vp75r_42",ye={checkoutPrices:_u,priceRow:Cu,label:vu,totalRow:Ru,totalLabel:Eu,totalValue:yu},dt=({formatter:t,coupon:n,discount:o,totalWithDiscount:s,total:i,className:r,isShowSubtotal:a=!0,feeOrDiscount:c})=>{const u=Math.max(0,o),{priceAdjusment:h}=e.useCartStore(),{isAntistock:d}=e.useGeneralStore(),m=(()=>{const f=s!==void 0?s:i-u;return!h||c===null||c===void 0?Math.max(f,0):h.isDiscount?Math.max(f-c,0):Math.max(f+c,0)})();return e.jsxRuntimeExports.jsxs("div",{className:`${ye.checkoutPrices} ${r||""}`,style:{border:d?"1px solid var(--border-secondary)":void 0},children:[a&&e.jsxRuntimeExports.jsxs("div",{className:ye.priceRow,children:[e.jsxRuntimeExports.jsx("p",{className:ye.label,id:"md",children:"Subtotal"}),e.jsxRuntimeExports.jsx("p",{id:"md",children:t.format(i)})]}),(n||u>0)&&e.jsxRuntimeExports.jsxs("div",{className:ye.priceRow,children:[e.jsxRuntimeExports.jsxs("p",{className:ye.label,id:"md",children:["Discount ",n&&!(n!=null&&n.isFixed)&&`(${n==null?void 0:n.discount}%)`]}),e.jsxRuntimeExports.jsx("p",{id:"md",children:n&&!(n!=null&&n.isFixed)&&(n==null?void 0:n.discount)===100?`-${t.format(i)}`:`-${t.format(u)}`})]}),c!=null&&c!==0&&h&&(h.fixedAmount!==0||h.percentage!==0)&&e.jsxRuntimeExports.jsxs("div",{className:ye.priceRow,children:[e.jsxRuntimeExports.jsxs("p",{className:ye.label,id:"md-bold",children:[h.isDiscount?"Discount: ":"Fee: ",h.percentage!==0&&h.fixedAmount===0&&`(${h.percentage}%)`,h.fixedAmount!==0&&h.percentage===0&&`(${t.format(h.fixedAmount)})`,h.percentage!==0&&h.fixedAmount!==0&&`(${h.percentage}% + ${t.format(h.fixedAmount)})`]}),e.jsxRuntimeExports.jsx("p",{id:"md-bold",children:t.format(c)})]}),e.jsxRuntimeExports.jsxs("div",{className:ye.totalRow,children:[e.jsxRuntimeExports.jsx("p",{className:ye.totalLabel,id:"md-bold",children:"Total Due"}),e.jsxRuntimeExports.jsx("p",{className:ye.totalValue,id:"md-bold",children:t.format(m)})]})]})},bu="_checkoutProduct_kxeys_1",wu="_isOrder_kxeys_1",ku="_productDetails_kxeys_10",Nu="_productImage_kxeys_16",Tu="_isOrderImage_kxeys_26",Lu="_productImageAntistock_kxeys_30",Pu="_image_kxeys_35",Au="_productInfo_kxeys_40",Bu="_productInfoOverrodePrice_kxeys_47",Mu="_productHeader_kxeys_51",$u="_quantityBadge_kxeys_57",Fu="_productPrice_kxeys_75",Du="_priceContainer_kxeys_84",Hu="_originalPrice_kxeys_92",Ou="_overridePrice_kxeys_98",Uu="_deliveryCategories_kxeys_102",Wu="_customerNote_kxeys_110",Gu="_noteHeader_kxeys_117",qu="_logoContainer_kxeys_123",Vu="_shopName_kxeys_135",zu="_noteContent_kxeys_139",Zu="_productName_kxeys_145",Y={checkoutProduct:bu,isOrder:wu,productDetails:ku,productImage:Nu,isOrderImage:Tu,productImageAntistock:Lu,image:Pu,productInfo:Au,productInfoOverrodePrice:Bu,productHeader:Mu,quantityBadge:$u,productPrice:Fu,priceContainer:Du,originalPrice:Hu,overridePrice:Ou,deliveryCategories:Uu,customerNote:Wu,noteHeader:Gu,logoContainer:qu,shopName:Vu,noteContent:zu,productName:Zu},Zt=({isOrder:t,product:n})=>{var a;const{shopGeneral:o}=e.useStorefrontStore(),s=n.subscriptionSettings,{cart:i}=e.useCart(),{isAntistock:r}=e.useGeneralStore();return e.jsxRuntimeExports.jsxs("div",{className:`${Y.checkoutProduct} ${t?Y.isOrder:""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:Y.productDetails,children:[e.jsxRuntimeExports.jsx("div",{className:`${Y.productImage} ${t?Y.isOrderImage:""} ${r?Y.productImageAntistock:""}`,children:n!=null&&n.image?e.jsxRuntimeExports.jsx("img",{className:Y.image,src:e.convertCfImageIdToUrl(n.image.cfId)}):e.jsxRuntimeExports.jsx(e.Icon,{name:"Image",fill:"var(--text-secondary)"})}),e.jsxRuntimeExports.jsx("div",{className:e.clx(Y.productInfo,{[Y.productInfoOverrodePrice]:n.variantsGateways&&i.gateway&&n.variantsGateways.some(c=>c.name===i.gateway&&c.overrodePrice)}),children:e.jsxRuntimeExports.jsxs("div",{className:Y.productHeader,children:[e.jsxRuntimeExports.jsx("h2",{className:Y.productName,id:"h5",children:n.name}),e.jsxRuntimeExports.jsxs("span",{className:Y.quantityBadge,id:"md",children:[n.price.quantity,"x"]})]})}),n.chargeType==="RECURRING"&&e.jsxRuntimeExports.jsx("p",{className:Y.productPrice,id:"md",children:s&&`${e.formatPrice(s.price)} / ${e.normalizeInterval(s.recurringIntervalDays||0)}${s.entryFee?" + "+e.formatPrice(s.entryFee):""}`}),n.chargeType==="ONE_TIME"&&e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:n.variantsGateways&&i.gateway&&n.variantsGateways.some(c=>c.name===i.gateway&&c.overrodePrice)?e.jsxRuntimeExports.jsxs("div",{className:Y.priceContainer,children:[e.jsxRuntimeExports.jsx("span",{className:Y.originalPrice,id:"md",children:e.formatPrice(n.price)}),e.jsxRuntimeExports.jsx("span",{className:Y.overridePrice,id:"md",children:e.formatPrice(((a=n.variantsGateways.find(c=>c.name===i.gateway))==null?void 0:a.overrodePrice)||n.price)})]}):e.jsxRuntimeExports.jsx("p",{className:Y.productPrice,id:"md",children:e.formatPrice(n.price)})})]}),n.deliveryCategories&&e.jsxRuntimeExports.jsx("div",{className:Y.deliveryCategories,children:n.deliveryCategories.map(c=>e.jsxRuntimeExports.jsx(e.DeliveryItem,{deliveryConfiguration:c},c.id))}),n.customerNote&&e.jsxRuntimeExports.jsxs("div",{className:Y.customerNote,style:r?{border:"1px solid var(--border-secondary)"}:void 0,children:[e.jsxRuntimeExports.jsxs("div",{className:Y.noteHeader,children:[(o==null?void 0:o.info.logo)&&e.jsxRuntimeExports.jsx("div",{className:Y.logoContainer,children:e.jsxRuntimeExports.jsx("img",{src:e.convertCfImageIdToUrl(o==null?void 0:o.info.logo.cfId)})}),e.jsxRuntimeExports.jsx("p",{className:Y.shopName,id:"md",children:o==null?void 0:o.info.name})]}),e.jsxRuntimeExports.jsx("p",{className:Y.noteContent,id:"md",children:n.customerNote})]})]})},Xu="_coupon_dkjzv_1",Yu="_couponApplied_dkjzv_7",Ku="_discount_dkjzv_17",Ju="_removeButton_dkjzv_23",Qu="_removeButtonText_dkjzv_27",ed="_couponInput_dkjzv_31",td="_couponInputContainer_dkjzv_37",Pe={coupon:Xu,couponApplied:Yu,discount:Ku,removeButton:Ju,removeButtonText:Qu,couponInput:ed,couponInputContainer:td},od=({applyCoupon:t,couponData:n,discount:o,removeCoupon:s,gateway:i})=>{const[r,a]=p.useState(null),[c,u]=p.useState(!1),{isAntistock:h}=e.useGeneralStore();return e.jsxRuntimeExports.jsxs("div",{className:Pe.coupon,children:[c&&e.jsxRuntimeExports.jsx(e.ContentLoader,{speed:2,width:500,height:48,viewBox:"0 0 500 48",backgroundColor:"var(--surface-secondary)",foregroundColor:"var(--surface-disabled)",className:Pe.skeleton,style:{borderRadius:"var(--border-radius)"},children:e.jsxRuntimeExports.jsx("rect",{x:"0",y:"0",rx:"10",ry:"10",width:"100%",height:"48"})}),!c&&(n?e.jsxRuntimeExports.jsxs("div",{className:Pe.couponApplied,style:h?{border:"1px solid var(--border-secondary)"}:void 0,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Check",fill:"var(--text-success)"}),e.jsxRuntimeExports.jsxs("p",{id:"md",style:{color:h?"var(--text-primary)":void 0},children:[r," is applied"," ",e.jsxRuntimeExports.jsxs("span",{className:Pe.discount,children:["-",o," ",!n.isFixed&&`(${n.discount}%)`]})]}),e.jsxRuntimeExports.jsx("button",{className:Pe.removeButton,onClick:s,children:e.jsxRuntimeExports.jsx("span",{className:Pe.removeButtonText,children:"Remove"})})]}):e.jsxRuntimeExports.jsxs("div",{className:Pe.couponInput,children:[e.jsxRuntimeExports.jsxs("div",{className:Pe.couponInputContainer,children:[e.jsxRuntimeExports.jsx(e.Input$1,{placeholder:"Enter a discount code",value:r||"",onChange:d=>{a(d===""?null:d)}}),e.jsxRuntimeExports.jsx(e.Button$1,{onClick:async()=>{u(!0),r&&await t(r),u(!1)},disabled:!i||!r,type:"Primary",children:"Apply"})]}),!h&&!i&&e.jsxRuntimeExports.jsx(e.Tip,{type:"warning",message:"The discount is related to the method of payment. Select to enter.",id:"md"})]}))]})},nd=({cart:t,products:n,applyCoupon:o,applyCouponPending:s,coupon:i,totalAndDiscount:r,removeCoupon:a})=>{const{priceAdjusment:c}=e.useCartStore(),[u,h]=p.useState(!1),d=p.useMemo(()=>t.parts.map(l=>{const S=n.find(C=>C.id===l.productId),x=S==null?void 0:S.variants.find(C=>C.id===l.productVariantId);return l.chargeType==="RECURRING"&&h(!0),{id:(S==null?void 0:S.id)||0,image:S==null?void 0:S.images[0],name:(()=>{const C=(S==null?void 0:S.name)||"",I=(x==null?void 0:x.name)||"";return!C&&!I?"":!I||C===I?C:C?`${C} (${I})`:I})(),description:"",price:{quantity:l.quantity,amount:(x==null?void 0:x.price.amount)||0,currency:x==null?void 0:x.price.currency},subscriptionSettings:x==null?void 0:x.subscriptionSettings,chargeType:l.chargeType,variantsGateways:x==null?void 0:x.gateways}}),[t,n]),g=p.useMemo(()=>{const l=d[0];if(l!=null&&l.variantsGateways&&t.gateway){const S=l.variantsGateways.find(x=>x.name===t.gateway&&x.overrodePrice);if(S!=null&&S.overrodePrice)return S.overrodePrice.currency}return(l==null?void 0:l.price.currency)||"USD"},[d,t.gateway]);console.log("checkoutProducts",d);const m=new Intl.NumberFormat("en-US",{style:"currency",currency:g}),f=p.useMemo(()=>i&&!i.isFixed&&i.discount===100||i&&i.isFixed&&i.discount===r.total?r.total:r.totalWithDiscount?r.total-r.totalWithDiscount:0,[r,i]),j=c?(c==null?void 0:c.fixedAmount)+Math.round((r.totalWithDiscount!==void 0?r.totalWithDiscount:r.total-f)*((c==null?void 0:c.percentage)/100)):null;return e.jsxRuntimeExports.jsx("div",{className:He.checkoutItemsContainer,children:e.jsxRuntimeExports.jsxs("div",{className:He.innerContainer,children:[e.jsxRuntimeExports.jsx(ut,{}),e.jsxRuntimeExports.jsxs("div",{className:He.headerSection,children:[e.jsxRuntimeExports.jsx("header",{className:He.header,children:e.jsxRuntimeExports.jsx("h1",{id:"h3",children:"Checkout"})}),e.jsxRuntimeExports.jsx("div",{className:He.productsContainer,children:d.map(l=>e.jsxRuntimeExports.jsx(Zt,{product:l},l.id))}),e.jsxRuntimeExports.jsx("div",{className:He.couponContainer,children:e.jsxRuntimeExports.jsx(od,{applyCoupon:o,applyCouponPending:s,couponData:i,discount:m.format(f),removeCoupon:a,gateway:t.gateway})}),e.jsxRuntimeExports.jsx(dt,{formatter:m,coupon:i,total:r.total,discount:f,totalWithDiscount:r.totalWithDiscount,feeOrDiscount:u?null:j})]}),e.jsxRuntimeExports.jsx("div",{className:He.checkoutFooter,children:e.jsxRuntimeExports.jsx(Ce,{})})]})})},sd="_checkoutOperational_b62bq_1",rd="_innerContainer_b62bq_17",id="_innerContainerAntistock_b62bq_27",ad="_paymentMethodsSectionAntistock_b62bq_39",cd="_continueButtonAntistock_b62bq_49",ld="_checkoutFooterAntistock_b62bq_59",ud="_antistock_b62bq_70",dd="_paymentMethodsSection_b62bq_39",pd="_socialConnectSection_b62bq_81",md="_socialConnectLabel_b62bq_84",xd="_socialConnectContent_b62bq_88",hd="_continueButton_b62bq_49",gd="_button_b62bq_96",jd="_checkoutFooter_b62bq_59",ae={checkoutOperational:sd,innerContainer:rd,innerContainerAntistock:id,paymentMethodsSectionAntistock:ad,continueButtonAntistock:cd,checkoutFooterAntistock:ld,antistock:ud,paymentMethodsSection:dd,socialConnectSection:pd,socialConnectLabel:md,socialConnectContent:xd,continueButton:hd,button:gd,checkoutFooter:jd},Id="_customFields_uhcib_2",fd="_checkboxWrapper_uhcib_9",Sd="_textareaWrapper_uhcib_16",_d="_inputWrapper_uhcib_17",Cd="_requiredStar_uhcib_27",Ke={customFields:Id,checkboxWrapper:fd,textareaWrapper:Sd,inputWrapper:_d,requiredStar:Cd},vd=({customFields:t,setCustomFields:n})=>{if(t.length===0)return null;const o=t.map(s=>e.jsxRuntimeExports.jsx(Rd,{customField:s,setCustomFields:n},s.name));return e.jsxRuntimeExports.jsx("div",{className:Ke.customFields,children:o})},Rd=({customField:t,setCustomFields:n})=>{const o=s=>{n(i=>i.map(r=>r.name===t.name?{...r,value:s}:r))};return e.jsxRuntimeExports.jsx(Ed,{value:t.value??"",placeholder:t.placeholder,required:t.required,defaultValue:t.defaultValue,type:t.type,onValueChange:o,label:t.name,regex:t.regex})},Ed=({label:t,type:n,defaultValue:o,value:s,placeholder:i,regex:r,required:a,onValueChange:c})=>{if(p.useEffect(()=>{s===""&&o!==void 0&&c(String(o))},[]),n===e.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox)return e.jsxRuntimeExports.jsxs("label",{className:Ke.checkboxWrapper,children:[e.jsxRuntimeExports.jsx(e.Checkbox,{value:s==="true",onChange:h=>c(h?"true":"false")}),e.jsxRuntimeExports.jsxs("p",{className:Ke.checkboxLabel,children:[t,a&&e.jsxRuntimeExports.jsx("span",{className:Ke.requiredStar,children:"*"})]})]});if(n===e.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Hidden)return e.jsxRuntimeExports.jsx("input",{type:"hidden",value:String(o??""),required:a});const u=h=>{(n===e.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?/^\d*$/:r?new RegExp(r):/.*/).test(h)&&c(h)};return n===e.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Textarea?e.jsxRuntimeExports.jsx("div",{className:Ke.textareaWrapper,children:e.jsxRuntimeExports.jsx(e.Textarea$1,{label:t,value:s,placeholder:i,onChange:u,required:a})}):e.jsxRuntimeExports.jsx("div",{className:Ke.inputWrapper,children:e.jsxRuntimeExports.jsx(e.Input$1,{type:n===e.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?"number":"text",placeholder:n===e.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?"Type something number...":i,label:t,value:s,required:a,onChange:u})})},yd="_connectedContainer_1rxr8_1",bd="_userInfo_1rxr8_10",wd="_avatar_1rxr8_16",kd="_avatarImage_1rxr8_26",_t={connectedContainer:yd,userInfo:bd,avatar:wd,avatarImage:kd},Nd=({customerEmail:t})=>{const{discordInfo:n,setDiscordInfo:o}=e.useDiscordStore(),{notifications:s,setNotifications:i}=e.useNotificationStore(),[r,a]=p.useState(!1),[c,u]=p.useState(0),[h,d]=p.useState(null),g=20,m=l=>{var S,x,C,I;return(x=(S=l==null?void 0:l.response)==null?void 0:S.data)!=null&&x.error?l.response.data.error:(I=(C=l==null?void 0:l.response)==null?void 0:C.data)!=null&&I.message?l.response.data.message:l!=null&&l.message?l.message:"Failed to connect to Discord. Please try again later."},f=(l,S)=>{i([...s,{id:e.v4(),message:l,status:S}])};p.useEffect(()=>{if(h&&r){const l=setInterval(()=>{h.closed&&(clearInterval(l),a(!1),d(null))},1e3);return()=>clearInterval(l)}},[h,r]);const j=()=>{t.trim()!==""&&(a(!0),u(0),fn({customerEmail:t,tsId:e.getTsId()}).then(({data:l})=>{const S=window.open(l.redirectUrl);d(S),(!S||S.closed||typeof S.closed>"u")&&setTimeout(()=>{const I=document.createElement("a");I.href=l.redirectUrl,I.target="_blank",I.click()});let x;const C=()=>{if(u(I=>I+1),c>=g||S&&S.closed){c>=g&&f("Authorization timeout. Please try again.","error"),a(!1),clearTimeout(x);return}Sn({id:l.id,customerEmail:t}).then(({data:I})=>{o({authorized:!0,id:l.id,avatar:I.avatar,username:I.username}),S&&S.close(),a(!1),d(null),f("Discord successfully connected!","success"),clearTimeout(x)}).catch(I=>{var R;if(console.log("Waiting for authorization...",I,{newWindow:S}),S&&S.closed){a(!1),clearTimeout(x);return}if((R=I==null?void 0:I.response)!=null&&R.status&&I.response.status!==404&&I.response.status>=400){f(m(I),"error"),a(!1),clearTimeout(x);return}clearTimeout(x),x=setTimeout(C,1500)})};C()}).catch(l=>{console.log("Could not initiate Discord authorization",l),f(m(l),"error"),a(!1)}))};return n!=null&&n.authorized?e.jsxRuntimeExports.jsxs("div",{className:_t.connectedContainer,children:[e.jsxRuntimeExports.jsxs("div",{className:_t.userInfo,children:[e.jsxRuntimeExports.jsx("div",{className:_t.avatar,children:n.avatar?e.jsxRuntimeExports.jsx("img",{className:_t.avatarImage,src:`https://cdn.discordapp.com/avatars/${n.id}/${n.avatar}.png?size=256`}):e.jsxRuntimeExports.jsx(e.Icon,{name:"UserCircle"})}),e.jsxRuntimeExports.jsx("p",{children:n.username}),e.jsxRuntimeExports.jsx(Xl,{})]}),e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:j,children:"Reconnect"})]}):e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:j,style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",gap:"10px"},disabled:r,children:r?e.jsxRuntimeExports.jsx(e.Loader,{}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"DiscordLogo"}),e.jsxRuntimeExports.jsx(e.StableText,{children:"Connect Your Discord"})]})})},Td="_paymentMethodsContainer_1pfqr_2",Ld="_antistock_1pfqr_15",xo={paymentMethodsContainer:Td,antistock:Ld},Pd="_bottomSheet_1x8kc_1",Ad="_content_1x8kc_8",Bd="_description_1x8kc_11",Md="_title_1x8kc_15",$d="_buttonGroup_1x8kc_19",Fd="_buttonWrapper_1x8kc_29",Dd="_fullWidthButton_1x8kc_32",Hd="_modal_1x8kc_36",Od="_header_1x8kc_43",Te={bottomSheet:Pd,content:Ad,description:Bd,title:Md,buttonGroup:$d,buttonWrapper:Fd,fullWidthButton:Dd,modal:Hd,header:Od},Ud=({setIsOpen:t,balance:n})=>{const o=e.useNavigate(),{setIsOpen:s}=e.useModalStore(),i=()=>{o("/top-up?redirectRoute=checkout")};function r(){s(!1),setTimeout(()=>{t(!1)},300)}return e.jsxRuntimeExports.jsxs("div",{className:Te.modal,onClick:a=>a.stopPropagation(),children:[e.jsxRuntimeExports.jsxs("div",{className:Te.header,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",className:Te.title,children:"Insufficient Customer Balance"}),e.jsxRuntimeExports.jsx(e.Icon,{name:"X",hoverable:!0,onClick:r,fill:"var(--text-primary)"})]}),e.jsxRuntimeExports.jsxs("div",{className:Te.bottomSheet,children:[e.jsxRuntimeExports.jsx("div",{className:Te.content,children:e.jsxRuntimeExports.jsxs("p",{className:Te.description,children:["You currently have ",n&&e.formatPrice(n)," in your balance. After topping up the required amount, you can continue to checkout."]})}),e.jsxRuntimeExports.jsxs("div",{className:Te.buttonGroup,children:[e.jsxRuntimeExports.jsx("div",{className:Te.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:r,children:"Cancel"})}),e.jsxRuntimeExports.jsx("div",{className:Te.fullWidthButton,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",onClick:i,children:"Add Balance"})})]})]})]})},Co=({align:t,gateway:n,gatewayDisplayName:o,selected:s,onSelect:i,total:r,onSignInClick:a,reversed:c,isAntistock:u=!1})=>{const{token:h}=e.useStorefrontStore(),{balance:d}=e.useCustomerDashboardStore(),[g,m]=p.useState(!1),{setIsOpen:f}=e.useModalStore(),j=l=>{l.stopPropagation(),i==null||i(n),d&&d.amount<r&&(m(!0),f(!0))};return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:e.clx(e.styles$3.paymentMethod,{[e.styles$3.selected]:s,[e.styles$3.alignColumn]:t==="column",[e.styles$3.reversed]:c&&!u,[e.styles$3.antistock]:u}),onClick:j,children:u?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("p",{className:e.styles$3.paymentText,id:"md",children:[o," ",e.jsxRuntimeExports.jsxs("span",{className:e.styles$3.balanceText,id:"md",children:["(",h?d&&e.formatPrice(d):e.jsxRuntimeExports.jsx("a",{className:e.styles$3.signInLink,onClick:a,id:"md",children:"Sign in"}),")"]})]}),e.jsxRuntimeExports.jsx("div",{className:e.styles$3.iconContainer,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Wallet",fill:"var(--text-primary)",width:20,height:20})})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("p",{className:e.styles$3.paymentText,id:"md",children:[o," ",e.jsxRuntimeExports.jsxs("span",{className:e.styles$3.balanceText,id:"md",children:["(",h?d&&e.formatPrice(d):e.jsxRuntimeExports.jsx("a",{className:e.styles$3.signInLink,onClick:a,id:"md",children:"Sign in"}),")"]})]}),e.jsxRuntimeExports.jsx("div",{className:e.styles$3.iconContainer,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Wallet",fill:"var(--text-primary)",width:20,height:20})})]})}),g&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>m(!1),children:e.jsxRuntimeExports.jsx(Ud,{setIsOpen:m,balance:d})})]})},vo=({possibleGateways:t,setGateway:n,totalAndDiscount:o,onSignInClick:s,setPaymentMethod:i,isAntistock:r=!1})=>{const[a,c]=p.useState(),[u,h]=p.useState(),{setPriceAdjustment:d}=e.useCartStore(),[g,m]=p.useState(null),f=(j,l)=>{var S;u!==l&&(n(l),d(((S=g==null?void 0:g.find(x=>x.name===l))==null?void 0:S.priceAdjustment)||null)),i(j),c(j),h(l)};return p.useEffect(()=>{if(g&&g.length>0){const j=g[0];if(j.name==="Balance")h(j.name),n(j.name),d(j.priceAdjustment||null);else if(j.paymentMethods&&j.paymentMethods.length>0){const l=j.paymentMethods[0];c(l),h(j.name),n(j.name),i(l),d(j.priceAdjustment||null)}}},[g]),p.useEffect(()=>{const j=async()=>{const{data:l}=await e.fetchGatewaysDetail([...t.availableGateways,...t.requiresSignInGateways]);m(l)};t.availableGateways.length&&j()},[]),p.useLayoutEffect(()=>{d(null)},[]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:g&&e.jsxRuntimeExports.jsx("div",{className:e.clx(xo.paymentMethodsContainer,{[xo.antistock]:r}),children:g==null?void 0:g.map(j=>j.name==="Balance"?e.jsxRuntimeExports.jsx(Co,{gateway:j.name,gatewayDisplayName:j.displayName,onSelect:l=>{h(l),u!==l&&n(l)},selected:j.name===u,total:o.total,onSignInClick:s,reversed:!0,isAntistock:r},j.name):j.paymentMethods.map(l=>e.jsxRuntimeExports.jsx(e.CheckoutPaymentMethod,{paymentMethod:l,gateway:j.name,gatewayDisplayName:j.displayName,gatewayLogoCfId:j.logoCfImageId,poweredByLogoCfId:j.poweredByImageCfImageId,onSelect:S=>f(S,j.name),selected:a===l&&u===j.name,isAntistock:r},`${j.name}-${l}`)))})})},Wd="_modal_14r0b_1",Gd={modal:Wd},qd=({setIsOpen:t})=>{const{token:n}=e.useStorefrontStore(),{setIsOpen:o}=e.useModalStore();p.useEffect(()=>{n&&s()},[n]);const s=()=>{o(!1),setTimeout(()=>{t(!1)},300)};return e.jsxRuntimeExports.jsx("div",{className:Gd.modal,onClick:i=>i.stopPropagation(),children:e.jsxRuntimeExports.jsx(e.Auth,{inModal:!0})})},Vd=({getPossibleGateways:t,setGateway:n,getDiscordSettings:o,cart:s,products:i,submitCart:r,reset:a,setCustomFieldsToCart:c,totalAndDiscount:u,setDiscordSocialConnectId:h,setPaymentMethod:d,isAntistock:g})=>{const m=p.useMemo(()=>o(),[]),[f,j]=p.useState([]),{balance:l,setBalance:S}=e.useCustomerDashboardStore(),{token:x}=e.useStorefrontStore(),{executeRecaptcha:C}=e.useReCaptcha(),{discordInfo:I}=e.useDiscordStore(),{customerEmail:R,setCustomerEmail:_}=e.useCartStore(),v=I!=null&&I.authorized?I.id:void 0,w=e.useNavigate(),F=p.useMemo(()=>t(),[s.parts]),[K,Z]=p.useState(!1),{setIsOpen:M}=e.useModalStore(),{notifications:b,setNotifications:E}=e.useNotificationStore();p.useEffect(()=>{const A=e.getCommonCustomFields(s.parts,i).map(W=>W.type===e.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox?{...W,value:String(W.defaultValue)}:W);j([...A])},[]),p.useEffect(()=>{const N=e.getCommonCustomFields(s.parts,i);j(A=>{const W=new Map(A.map(T=>[T.name,T]));return N.map(T=>{const q=W.get(T.name);return q&&q.value?{...T,value:q.value}:T.type===e.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox?{...T,value:String(T.defaultValue)}:T})})},[s.parts,i]),p.useEffect(()=>{x&&(async()=>{const A=await e.getBalance();S(A)})()},[x]);function D(N){return N&&/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(N)}const J=()=>{const N=[];return f.forEach(A=>{var W;A.required&&!((W=A.value)!=null&&W.toString().trim())&&N.push({message:`Field "${A.name}" is required.`,status:"error",id:e.v4()})}),N.length>0?(E([...b,...N]),!1):!0},U=async N=>{if(N.stopPropagation(),s.gateway==="Balance"&&!x){M(!0),Z(!0);return}if(!J())return;const A=Object.fromEntries(f.map(T=>[T.name,T.value||""]));c({...A}),v&&m.isEnabled&&h(v);const W=await C();if(W){const T=await r(W),q=JSON.parse(localStorage.getItem("orders")||"{}");if(Object.keys(q).length>10){const ke=Date.now()-864e5;Object.keys(q).forEach(ve=>{q[ve].createdAt<=ke&&delete q[ve]})}"order"in T?q[T.order.id]={createdAt:Date.now(),fullAccessToken:T.order.fullAccessToken}:q[T.id]={createdAt:Date.now(),fullAccessToken:T.fullAccessToken},localStorage.setItem("orders",JSON.stringify(q)),w(`/orders/${"order"in T?T.order.id:T.id}/${"order"in T?T.order.fullAccessToken:T.fullAccessToken}`),setTimeout(()=>a(),2e3)}};return e.jsxRuntimeExports.jsxs("div",{className:ae.checkoutOperational,style:g?{borderLeft:"1px solid var(--border-secondary)"}:void 0,children:[e.jsxRuntimeExports.jsxs("div",{className:`${ae.innerContainer} ${g?ae.innerContainerAntistock:""}`,children:[g?e.jsxRuntimeExports.jsx("h4",{style:{fontSize:"var(--input-label-size)",color:"var(--text-secondary)",paddingBottom:"12px",fontWeight:"400"},children:"Select Payment Method"}):null,s.parts.length>0&&e.jsxRuntimeExports.jsx(vo,{possibleGateways:F,setGateway:n,setPaymentMethod:d,balance:l,totalAndDiscount:u,onSignInClick:()=>{Z(!0),M(!0)},isAntistock:g}),e.jsxRuntimeExports.jsx("div",{className:e.clx(ae.paymentMethodsSection,{[ae.antistock]:g,[ae.paymentMethodsSectionAntistock]:g}),children:e.jsxRuntimeExports.jsx(e.Input$1,{placeholder:"your@email.com",value:R||"",onChange:N=>_(N),disabled:!!x,label:"Email Address"})}),e.jsxRuntimeExports.jsx(vd,{customFields:f,setCustomFields:j}),m.isEnabled&&e.jsxRuntimeExports.jsxs("div",{className:ae.socialConnectSection,children:[e.jsxRuntimeExports.jsx("p",{className:ae.socialConnectLabel,id:"md",children:"Social Connect"}),e.jsxRuntimeExports.jsx("div",{className:ae.socialConnectContent,children:e.jsxRuntimeExports.jsx(Nd,{customerEmail:R||""})})]}),e.jsxRuntimeExports.jsxs("div",{className:`${ae.continueButton} ${g?ae.continueButtonAntistock:""}`,children:[e.jsxRuntimeExports.jsx(e.Button$1,{onClick:U,disabled:!s.gateway||!D(R||"")||m.isRequired&&!(I!=null&&I.authorized),className:ae.button,children:"Continue to Checkout"}),e.jsxRuntimeExports.jsx(e.TermsOfService,{}),e.jsxRuntimeExports.jsx(e.SecuredBySsl,{isAntistock:g})]}),e.jsxRuntimeExports.jsx(Ce,{className:`${ae.checkoutFooter} ${g?ae.checkoutFooterAntistock:""}`})]}),K&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>Z(!1),children:e.jsxRuntimeExports.jsx(qd,{setIsOpen:Z})})]})},zd="_mt1_1l62z_1",Zd="_notifyBlock_1l62z_13",Xd="_notifyHeader_1l62z_19",Yd="_notifyContent_1l62z_25",Kd="_buttonBlock_1l62z_30",Jd="_imageBlock_1l62z_34",Qd="_imageContainer_1l62z_42",ep="_sectionBlock_1l62z_54",tp="_sectionTitle_1l62z_61",op="_sectionSubtitle_1l62z_64",np="_inputContainer_1l62z_69",_e={mt1:zd,notifyBlock:Zd,notifyHeader:Xd,notifyContent:Yd,buttonBlock:Kd,imageBlock:Jd,imageContainer:Qd,sectionBlock:ep,sectionTitle:tp,sectionSubtitle:op,inputContainer:np},sp=({props:t})=>{const n=e.useCopy();return e.jsxRuntimeExports.jsx("div",{className:_e.mt1,children:e.jsxRuntimeExports.jsxs("div",{className:_e.inputContainer,children:[e.jsxRuntimeExports.jsx(e.Input$1,{value:t.text,disabled:!0,onChange:()=>{}}),t.shownCopyButton&&e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:()=>n(t.text),children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Copy"})})]})})},rp=({props:t})=>e.jsxRuntimeExports.jsx(e.Button$1,{className:_e.buttonBlock,onClick:()=>window.open(t.url,"_blank","noopener"),children:t.text}),ip=({props:t})=>e.jsxRuntimeExports.jsx("div",{className:_e.imageBlock,children:e.jsxRuntimeExports.jsx("div",{className:_e.imageContainer,children:e.jsxRuntimeExports.jsx("img",{src:t.src,alt:""})})}),ap=({props:t})=>e.jsxRuntimeExports.jsxs("div",{className:_e.notifyBlock,children:[e.jsxRuntimeExports.jsxs("div",{className:_e.notifyHeader,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Info",width:24,height:24,fill:"var(--text-secondary)"}),e.jsxRuntimeExports.jsx("p",{children:t.heading})]}),e.jsxRuntimeExports.jsx("p",{className:_e.notifyContent,children:t.content})]}),cp=({props:t})=>{var n;return e.jsxRuntimeExports.jsxs("div",{className:_e.sectionBlock,children:[e.jsxRuntimeExports.jsx("p",{className:_e.sectionTitle,children:t.title}),e.jsxRuntimeExports.jsx("span",{className:_e.sectionSubtitle,children:t.subTitle}),(n=t.children)==null?void 0:n.map((o,s)=>e.jsxRuntimeExports.jsx(Vt,{block:o},s))]})},Vt=({block:t})=>{switch(t.type){case"Section":return e.jsxRuntimeExports.jsx(cp,{...t});case"ReadOnlyTextInput":return e.jsxRuntimeExports.jsx(sp,{...t});case"Notify":return e.jsxRuntimeExports.jsx(ap,{...t});case"Button":return e.jsxRuntimeExports.jsx(rp,{...t});case"Image":return e.jsxRuntimeExports.jsx(ip,{...t});default:return null}},lp="_bottomSheet_1x4sq_1",up="_content_1x4sq_8",dp="_agreementList_1x4sq_11",pp="_agreementItem_1x4sq_16",mp="_warning_1x4sq_23",xp="_buttonGroup_1x4sq_31",hp="_buttonWrapper_1x4sq_41",gp="_fullWidthButton_1x4sq_44",jp="_modal_1x4sq_48",Ip="_header_1x4sq_55",me={bottomSheet:lp,content:up,agreementList:dp,agreementItem:pp,warning:mp,buttonGroup:xp,buttonWrapper:hp,fullWidthButton:gp,modal:jp,header:Ip},fp=({setIsOpen:t,price:n})=>{const[o,s]=p.useState({agreeToSendAsFF:!1,agreeToSend:!1,agreeToNotAddNote:!1}),{setIsOpen:i}=e.useModalStore(),r=()=>{i(!1),setTimeout(()=>{t(!1)},300)};return e.jsxRuntimeExports.jsxs("div",{className:me.modal,onClick:a=>a.stopPropagation(),children:[e.jsxRuntimeExports.jsxs("div",{className:me.header,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Note"}),e.jsxRuntimeExports.jsx(e.Icon,{name:"X",hoverable:!0,onClick:r,fill:"var(--text-primary)"})]}),e.jsxRuntimeExports.jsxs("div",{className:me.bottomSheet,children:[e.jsxRuntimeExports.jsxs("div",{className:me.content,children:[e.jsxRuntimeExports.jsxs("div",{className:me.agreementList,children:[e.jsxRuntimeExports.jsxs("label",{className:me.agreementItem,children:[e.jsxRuntimeExports.jsx(e.Checkbox,{value:o.agreeToSendAsFF,onChange:a=>s({...o,agreeToSendAsFF:a})}),e.jsxRuntimeExports.jsx("p",{children:"I agree to send the payment as friends & family"})]}),e.jsxRuntimeExports.jsxs("label",{className:me.agreementItem,children:[e.jsxRuntimeExports.jsx(e.Checkbox,{value:o.agreeToSend,onChange:a=>s({...o,agreeToSend:a})}),e.jsxRuntimeExports.jsxs("p",{children:["I agree to send the payment of ",e.formatPrice(n)," ",n.currency]})]}),e.jsxRuntimeExports.jsxs("label",{className:me.agreementItem,children:[e.jsxRuntimeExports.jsx(e.Checkbox,{value:o.agreeToNotAddNote,onChange:a=>s({...o,agreeToNotAddNote:a})}),e.jsxRuntimeExports.jsx("p",{children:"I agree to not add a note to this payment"})]})]}),e.jsxRuntimeExports.jsx("div",{className:me.warning,children:e.jsxRuntimeExports.jsxs("p",{children:["Please note that you are required to send the exact payment of ",e.formatPrice(n)," ",n.currency,". If you were to send any amount over or below, your funds will be lost."]})})]}),e.jsxRuntimeExports.jsxs("div",{className:me.buttonGroup,children:[e.jsxRuntimeExports.jsx("div",{className:me.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",children:e.jsxRuntimeExports.jsx("span",{className:"text-[var(--text-secondary)]",children:"Cancel"})})}),e.jsxRuntimeExports.jsx("div",{className:me.fullWidthButton,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",disabled:!(o.agreeToSendAsFF&&o.agreeToNotAddNote&&o.agreeToSend),onClick:r,children:"Continue to Payment"})})]})]})]})},Sp="_chargeItemsContainer_vynct_5",_p="_chargeItemsInner_vynct_18",Cp="_productsContainer_vynct_25",vp="_antistockLayout_vynct_40",Rp="_mainContentAntistock_vynct_53",Ep="_desktopTrackPayment_vynct_64",yp="_desktopFooter_vynct_73",bp="_footerContainerAntistock_vynct_94",wp="_chargeHeader_vynct_107",kp="_chargeTitle_vynct_115",Np="_chargeDescription_vynct_121",Tp="_copyButton_vynct_127",Lp="_productsList_vynct_139",Pp="_footerContainer_vynct_94",ce={chargeItemsContainer:Sp,chargeItemsInner:_p,productsContainer:Cp,antistockLayout:vp,mainContentAntistock:Rp,desktopTrackPayment:Ep,desktopFooter:yp,footerContainerAntistock:bp,chargeHeader:wp,chargeTitle:kp,chargeDescription:Np,copyButton:Tp,productsList:Lp,footerContainer:Pp},Ap=({charge:t})=>{var a;const n=e.useCopy(),{isAntistock:o}=e.useGeneralStore(),s=(t==null?void 0:t.price.currency)||"USD",i=new Intl.NumberFormat("en-US",{style:"currency",currency:s}),r=p.useMemo(()=>{var c;return((c=t==null?void 0:t.order)==null?void 0:c.partOrders.map(u=>{var h,d,g,m;return{id:(u==null?void 0:u.id)||0,image:u.productWithVariant.image,name:(()=>{var l,S;const f=((l=u.productWithVariant)==null?void 0:l.name)||"",j=((S=u.productWithVariant)==null?void 0:S.variantName)||"";return!f&&!j?"":!j||f===j?f:f?`${f} (${j})`:j})(),description:"",price:{quantity:u.quantity,amount:((h=u.productWithVariant)==null?void 0:h.price.amount)||0,currency:(d=u.productWithVariant)==null?void 0:d.price.currency},subscriptionSettings:(g=t.order)!=null&&g.subscriptionOrderId?(m=u.productWithVariant)==null?void 0:m.subscriptionSettings:null}}))||[]},[t]);return e.jsxRuntimeExports.jsx("div",{className:ce.chargeItemsContainer,children:e.jsxRuntimeExports.jsxs("div",{className:ce.chargeItemsInner,children:[e.jsxRuntimeExports.jsx(ut,{expiresAt:t==null?void 0:t.expiresAt}),e.jsxRuntimeExports.jsxs("div",{className:`${ce.productsContainer} ${o?ce.antistockLayout:""}`,children:[(t==null?void 0:t.name)&&e.jsxRuntimeExports.jsxs("header",{className:ce.chargeHeader,children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h1",{className:ce.chargeTitle,id:"h5",children:t.name}),t.description&&e.jsxRuntimeExports.jsx("p",{className:ce.chargeDescription,id:"md",children:t.description})]}),((a=t.order)==null?void 0:a.id)&&!o&&e.jsxRuntimeExports.jsxs(e.Button$1,{type:"Secondary",className:ce.copyButton,onClick:()=>{var c;return n(((c=t.order)==null?void 0:c.id)||"")},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Copy"}),"Copy Order ID"]})]}),e.jsxRuntimeExports.jsxs("div",{className:o?ce.mainContentAntistock:"",style:o?void 0:{flex:1},children:[!!r.length&&e.jsxRuntimeExports.jsx("div",{className:ce.productsList,children:r.map(c=>e.jsxRuntimeExports.jsx(Zt,{product:c},c.id))}),e.jsxRuntimeExports.jsx(dt,{formatter:i,coupon:null,total:(t==null?void 0:t.price.amount)||0,discount:0,totalWithDiscount:(t==null?void 0:t.price.amount)||0,isShowSubtotal:!1}),o&&t&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:ce.desktopTrackPayment,children:e.jsxRuntimeExports.jsx(e.TrackPayment,{timeline:t.timeline})}),e.jsxRuntimeExports.jsx(Ce,{className:ce.desktopFooter})]})]}),!o&&e.jsxRuntimeExports.jsx(Ce,{className:`${ce.footerContainer} ${o?ce.footerContainerAntistock:""}`})]})]})})},Bp="_checkoutOrderMainData_hqf60_1",Mp="_orderDetailRow_hqf60_6",$p="_chargeIdRow_hqf60_16",Fp="_detailLabel_hqf60_25",Dp="_detailValue_hqf60_29",Hp="_chargeIdContainer_hqf60_33",Op="_chargeId_hqf60_16",Up="_copyIcon_hqf60_51",oe={checkoutOrderMainData:Bp,orderDetailRow:Mp,chargeIdRow:$p,detailLabel:Fp,detailValue:Dp,chargeIdContainer:Hp,chargeId:Op,copyIcon:Up},Ro=({lastUpdate:t,invoiceId:n,email:o,paymentType:s,orderId:i})=>{const r=e.useCopy(),[a,c]=p.useState(null),u=a==null?void 0:a.find(d=>d.name===s);p.useEffect(()=>{a||(async()=>{if(!s)return;const g=[s],m=await e.getGatewaysDetail(g);c(m)})()},[s,a]);const h=d=>{const g=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],m=d.getDate().toString().padStart(2,"0"),f=g[d.getMonth()],j=d.getFullYear(),l=d.getHours(),S=d.getMinutes().toString().padStart(2,"0"),x=d.getSeconds().toString().padStart(2,"0"),C=l>=12?"PM":"AM",I=(l%12||12).toString().padStart(2,"0");return`${f} ${m}, ${j} at ${I}:${S}:${x} ${C}`};return e.jsxRuntimeExports.jsxs("div",{className:oe.checkoutOrderMainData,children:[e.jsxRuntimeExports.jsxs("div",{className:oe.orderDetailRow,children:[e.jsxRuntimeExports.jsx("p",{className:oe.detailLabel,id:"md",children:"Last Updated"}),e.jsxRuntimeExports.jsx("p",{className:oe.detailValue,id:"md",children:h(new Date(t))})]}),s&&e.jsxRuntimeExports.jsxs("div",{className:oe.orderDetailRow,children:[e.jsxRuntimeExports.jsx("p",{className:oe.detailLabel,id:"md",children:"Payment Type"}),e.jsxRuntimeExports.jsx("p",{className:oe.detailValue,id:"md",children:u==null?void 0:u.displayName})]}),e.jsxRuntimeExports.jsxs("div",{className:oe.orderDetailRow,children:[e.jsxRuntimeExports.jsx("p",{className:oe.detailLabel,id:"md",children:"Email"}),e.jsxRuntimeExports.jsx("p",{className:oe.detailValue,id:"md",children:o})]}),n&&e.jsxRuntimeExports.jsxs("div",{className:oe.chargeIdRow,children:[e.jsxRuntimeExports.jsx("p",{className:oe.detailLabel,id:"md",children:"Charge ID"}),e.jsxRuntimeExports.jsxs("div",{className:oe.chargeIdContainer,children:[e.jsxRuntimeExports.jsx("p",{className:oe.chargeId,id:"md",children:n}),e.jsxRuntimeExports.jsx("div",{className:oe.copyIcon,onClick:()=>r(n),children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Copy"})})]})]}),i&&e.jsxRuntimeExports.jsxs("div",{className:oe.chargeIdRow,children:[e.jsxRuntimeExports.jsx("p",{className:oe.detailLabel,id:"md",children:"Order ID"}),e.jsxRuntimeExports.jsxs("div",{className:oe.chargeIdContainer,children:[e.jsxRuntimeExports.jsx("p",{className:oe.chargeId,id:"md",children:i}),e.jsxRuntimeExports.jsx("div",{className:oe.copyIcon,onClick:()=>r(i),children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Copy"})})]})]})]})},Wp="_bottomSheet_1yai1_1",Gp="_formContainer_1yai1_8",qp="_error_1yai1_14",Vp="_buttonGroup_1yai1_18",zp="_buttonWrapper_1yai1_28",Zp="_fullWidthButton_1yai1_31",Xp="_modal_1yai1_41",Yp="_header_1yai1_48",Ae={bottomSheet:Wp,formContainer:Gp,error:qp,buttonGroup:Vp,buttonWrapper:zp,fullWidthButton:Zp,modal:Xp,header:Yp},Kp=({chargeId:t,setIsOpen:n})=>{const[o,s]=p.useState(""),[i,r]=p.useState(""),{setIsOpen:a}=e.useModalStore(),c=d=>{try{return new URL(d),!0}catch{return!1}},u=async d=>{if(d.preventDefault(),!o){r("The link field cannot be empty.");return}if(!c(o)){r("Please enter a valid URL");return}await mn({url:o},t)&&(alert("CashApp successfully verified"),n(!1))},h=()=>{a(!1),setTimeout(()=>{n(!1)},300)};return e.jsxRuntimeExports.jsxs("div",{className:Ae.modal,onClick:d=>d.stopPropagation(),children:[e.jsxRuntimeExports.jsxs("div",{className:Ae.header,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",children:"CashApp Verify"}),e.jsxRuntimeExports.jsx(e.Icon,{name:"X",hoverable:!0,onClick:h,fill:"var(--text-primary)"})]}),e.jsxRuntimeExports.jsx("form",{onSubmit:u,children:e.jsxRuntimeExports.jsxs("div",{className:Ae.bottomSheet,children:[e.jsxRuntimeExports.jsx("div",{className:Ae.formContainer,children:e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx(e.Input$1,{value:o,onChange:d=>{s(d),r("")},label:"Enter Cashapp Link",placeholder:"https://cash.app/payments/0000"}),i&&e.jsxRuntimeExports.jsx("p",{className:Ae.error,children:i})]})}),e.jsxRuntimeExports.jsxs("div",{className:Ae.buttonGroup,children:[e.jsxRuntimeExports.jsx("div",{className:Ae.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:h,children:"Cancel"})}),e.jsxRuntimeExports.jsx("div",{className:Ae.fullWidthButton,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",children:"Verify"})})]})]})})]})},Jp="_container_1opbn_1",Qp="_productDetails_1opbn_8",em="_imageContainer_1opbn_14",tm="_image_1opbn_14",om="_textContainer_1opbn_32",nm="_header_1opbn_40",sm="_title_1opbn_46",rm="_price_1opbn_53",im="_badgeContainer_1opbn_57",am="_description_1opbn_61",be={container:Jp,productDetails:Qp,imageContainer:em,image:tm,textContainer:om,header:nm,title:sm,price:rm,badgeContainer:im,description:am},cm=({subscription:t})=>e.jsxRuntimeExports.jsxs("div",{className:be.container,children:[e.jsxRuntimeExports.jsxs("div",{className:be.productDetails,children:[e.jsxRuntimeExports.jsx("div",{className:be.imageContainer,children:t!=null&&t.image?e.jsxRuntimeExports.jsx("img",{className:be.image,src:e.convertCfImageIdToUrl(t.image.cfId),alt:t==null?void 0:t.name}):e.jsxRuntimeExports.jsx(e.Icon,{name:"Image"})}),e.jsxRuntimeExports.jsxs("div",{className:be.textContainer,children:[e.jsxRuntimeExports.jsx("div",{className:be.header,children:e.jsxRuntimeExports.jsx("h2",{className:be.title,children:t.name})}),e.jsxRuntimeExports.jsxs("p",{className:be.price,children:[e.formatPrice(t.price)," / ",t.recurringInterval]})]}),e.jsxRuntimeExports.jsx("div",{className:be.badgeContainer,children:e.jsxRuntimeExports.jsx(e.SubscriptionStatusBadge,{status:t.status})})]}),t.description&&e.jsxRuntimeExports.jsx(e.Markdown,{className:be.description,children:t.description})]}),lm="_card_69liy_1",um="_price_69liy_10",dm="_interval_69liy_17",pm="_name_69liy_22",mm="_description_69liy_28",xm="_currentPlan_69liy_32",hm="_selectButton_69liy_45",gm="_progressSection_69liy_50",jm="_progressLabel_69liy_54",Im="_bottomSheet_69liy_60",fm="_title_69liy_69",Sm="_typeSelector_69liy_80",_m="_typeOption_69liy_90",Cm="_active_69liy_100",vm="_saveTag_69liy_108",Rm="_planSelector_69liy_117",Em="_modal_69liy_127",ym="_inactive_69liy_148",bm="_notMounted_69liy_151",wm="_closeButton_69liy_157",Q={card:lm,price:um,interval:dm,name:pm,description:mm,currentPlan:xm,selectButton:hm,progressSection:gm,progressLabel:jm,bottomSheet:Im,title:fm,typeSelector:Sm,typeOption:_m,active:Cm,saveTag:vm,planSelector:Rm,modal:Em,inactive:ym,notMounted:bm,closeButton:wm},km=({variant:t,onSelect:n,isCurrent:o})=>{const s=t.subscriptionSettings.recurringIntervalDays===30?"month":t.subscriptionSettings.recurringIntervalDays===365?"year":"period",i=t.subscriptionSettings.price.amount.toFixed(2),r=t.subscriptionSettings.recurringIntervalDays,a=10;return e.jsxRuntimeExports.jsxs("div",{className:Q.card,onClick:n,children:[e.jsxRuntimeExports.jsxs("h2",{className:Q.price,children:["$",i," ",e.jsxRuntimeExports.jsxs("span",{className:Q.interval,children:["/ ",s]})]}),e.jsxRuntimeExports.jsx("h3",{className:Q.name,children:t.name}),t.description&&e.jsxRuntimeExports.jsx("p",{className:Q.description,children:t.description}),o?e.jsxRuntimeExports.jsxs("div",{className:Q.currentPlan,children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Check"}),"Your current Plan"]}):e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",className:Q.selectButton,children:"Select"}),o&&e.jsxRuntimeExports.jsxs("div",{className:Q.progressSection,children:[e.jsxRuntimeExports.jsx(_o,{percent:a/r*100,disablePercentLabel:!0}),e.jsxRuntimeExports.jsxs("p",{className:Q.progressLabel,children:["Used: ",a," of ",r," days"]})]})]})},Nm=({isOpen:t,setIsOpen:n,subscription:o})=>{const[s,i]=p.useState(null),[r,a]=p.useState(null),[c,u]=p.useState(null),{id:h,accessToken:d}=e.useParams(),[g,m]=p.useState(!1),[f,j]=p.useState(!1),{setIsOpen:l}=e.useModalStore();p.useEffect(()=>{t&&m(!0)},[t]);const S=()=>{n(!1)},[x,C]=p.useState(null);p.useEffect(()=>{h&&d&&(async()=>{if(h&&d){const{data:v}=await e.getSubscriptionUpgradePlans({id:h,accessToken:d});C(v)}})()},[h,d]),p.useEffect(()=>{var _;if(x!=null&&x.data.types[0]){const v=(_=x.data.types.flatMap(w=>w.productVariants).find(w=>w.data.id===(o==null?void 0:o.variantId)))==null?void 0:_.data;v&&(u(v),a(v))}},[x,o]),p.useEffect(()=>{x!=null&&x.data.types[0]&&i(x==null?void 0:x.data.types[0])},[x==null?void 0:x.data.types]);const I=_=>{i(_),a(null)},R=_=>{a(_),l(!0),j(!0)};return e.jsxRuntimeExports.jsxs("div",{className:e.clx(Q.modal,{[Q.active]:t,[Q.inactive]:!t&&g,[Q.notMounted]:!g}),onClick:_=>_.stopPropagation(),children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"X",onClick:S,hoverable:!0,className:Q.closeButton,fill:"var(--text-primary)"}),e.jsxRuntimeExports.jsxs("div",{className:Q.bottomSheet,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",className:Q.title,children:"Change Plan"}),e.jsxRuntimeExports.jsx("p",{className:Q.description,children:x==null?void 0:x.data.description}),e.jsxRuntimeExports.jsx("div",{className:Q.typeSelector,children:x==null?void 0:x.data.types.map(_=>e.jsxRuntimeExports.jsxs("div",{className:e.clx(Q.typeOption,{[Q.active]:(s==null?void 0:s.id)===_.id}),onClick:()=>I(_),children:[_.name,_.name==="Yearly"&&e.jsxRuntimeExports.jsx("span",{className:Q.saveTag,children:"Save %"})]},_.id))}),s&&e.jsxRuntimeExports.jsx("div",{className:Q.planSelector,children:s.productVariants.map(_=>e.jsxRuntimeExports.jsx(km,{variant:_.data,isSelected:(r==null?void 0:r.id)===_.data.id,isCurrent:(c==null?void 0:c.id)===_.data.id,onSelect:()=>R(_.data)},_.data.id))})]}),f&&r&&o&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>{j(!1)},children:e.jsxRuntimeExports.jsx(Sx,{setIsOpen:j,selectedVariant:r,subscription:o})})]})},Tm="_container_nb625_1",Lm="_title_nb625_11",Pm="_subtitle_nb625_16",Am="_info_nb625_20",Ct={container:Tm,title:Lm,subtitle:Pm,info:Am},Bm=()=>{const{subscription:t}=e.useSubscriptionStore(),[n,o]=e.extractDateAndTime((t==null?void 0:t.activeTo)||""),[s,i]=p.useState(!1),{setIsOpen:r}=e.useModalStore();return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:Ct.container,children:[e.jsxRuntimeExports.jsxs("div",{className:Ct.info,children:[e.jsxRuntimeExports.jsx("p",{className:Ct.title,children:"Expiration Date"}),e.jsxRuntimeExports.jsxs("p",{className:Ct.subtitle,children:[n," at ",o]})]}),e.jsxRuntimeExports.jsx(e.Button$1,{type:"Special",onClick:a=>{a.stopPropagation(),r(!0),i(!0)},children:"Extend"})]}),s&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>i(!1),children:e.jsxRuntimeExports.jsx(Fx,{setIsOpen:i})})]})},Mm="_couponContainer_1sspa_1",$m="_iconWrapper_1sspa_10",Fm="_details_1sspa_21",Dm="_title_1sspa_25",Hm="_progress_1sspa_29",Om="_foreverText_1sspa_34",Ye={couponContainer:Mm,iconWrapper:$m,details:Fm,title:Dm,progress:Hm,foreverText:Om},Um=({coupon:t,currency:n})=>{const o=t.isFixed?e.formatPrice({amount:t.discount,currency:n}):`${t.discount}%`,s=t.initialCouponDurationForSubscriptions?e.percentageDifference(t.initialCouponDurationForSubscriptions,t.currentCouponDurationForSubscriptions||1):100;return e.jsxRuntimeExports.jsxs("div",{className:Ye.couponContainer,children:[e.jsxRuntimeExports.jsx("div",{className:Ye.iconWrapper,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"CheckCircle"})}),e.jsxRuntimeExports.jsxs("div",{className:Ye.details,children:[e.jsxRuntimeExports.jsxs("p",{className:Ye.title,children:[t.name,", ",o," discount"]}),e.jsxRuntimeExports.jsx("div",{className:Ye.progress,children:e.jsxRuntimeExports.jsx(_o,{color:"#C2C2C2",percent:s,disablePercentLabel:!0})}),e.jsxRuntimeExports.jsx("p",{className:Ye.foreverText,children:"Forever discount code"})]})]})},Wm="_paymentMethodContainer_1g0da_4",Gm="_paymentMethodTitle_1g0da_15",qm="_activeMethod_1g0da_20",Vm="_noMethod_1g0da_28",zm="_activeMethodPaymentMethod_1g0da_37",Zm="_paymentMethodLogo_1g0da_47",Xm="_paymentMethodNumber_1g0da_57",Ym="_method_1g0da_61",Me={paymentMethodContainer:Wm,paymentMethodTitle:Gm,activeMethod:qm,noMethod:Vm,activeMethodPaymentMethod:zm,paymentMethodLogo:Zm,paymentMethodNumber:Xm,method:Ym},Km="_paymentMethods_1gev0_1",Jm="_modal_1gev0_14",Qm="_header_1gev0_28",ex="_content_1gev0_37",Oe={paymentMethods:Km,modal:Jm,header:Qm,content:ex},tx=t=>{const{setIsLoading:n,setIsOpen:o}=t,{subscription:s,setSubscription:i}=e.useSubscriptionStore();if(!s)return null;const{id:r}=e.useParams(),a=e.useNavigate(),{notifications:c,setNotifications:u}=e.useNotificationStore(),{setPaymentMethod:h,setGateway:d,cart:g}=e.useCart(),{setIsOpen:m}=e.useModalStore();async function f(){if(j(),n(!0),r&&s){const{data:l}=await e.changeSubscriptionGateway(r,g.gateway);l.isReconnectPaymentNeeded?a(`/charges/${l.chargeId}`):(u([...c,{status:"success",id:e.v4(),message:"Your action has been successfully completed"}]),i({...s,gatewayName:g.gateway}))}else u([...c,{status:"error",id:e.v4(),message:"Your action has been failed. Try again!"}]);n(!1)}function j(){m(!1),setTimeout(()=>{o(!1)},300)}return e.jsxRuntimeExports.jsxs("div",{className:Oe.modal,onClick:l=>{l.stopPropagation()},children:[e.jsxRuntimeExports.jsxs("div",{className:Oe.header,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",className:Oe.title,children:"Choose Payment Method"}),e.jsxRuntimeExports.jsx(e.Icon,{name:"X",onClick:j,hoverable:!0,fill:"var(--text-primary)"})]}),e.jsxRuntimeExports.jsxs("div",{className:Oe.content,children:[(s==null?void 0:s.availableGateways)&&e.jsxRuntimeExports.jsx(vo,{possibleGateways:{availableGateways:s.availableGateways,requiresSignInGateways:s.availableGateways},setGateway:d,setPaymentMethod:h,totalAndDiscount:{total:(s==null?void 0:s.price.amount)||0,totalWithDiscount:s==null?void 0:s.price.amount},onSignInClick:()=>a("/customer-dash")}),e.jsxRuntimeExports.jsxs("div",{className:Oe.paymentMethods,children:[e.jsxRuntimeExports.jsx("div",{className:Oe.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:j,children:"Cancel"})}),e.jsxRuntimeExports.jsx("div",{className:Oe.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",disabled:!g.gateway,onClick:()=>f(),children:"Continue"})})]})]})]})},ox="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20131.39%2086.9'%3e%3cdefs%3e%3cstyle%3e.a{opacity:0;}.b{fill:%23fff;}.c{fill:%23ff5f00;}.d{fill:%23eb001b;}.e{fill:%23f79e1b;}%3c/style%3e%3c/defs%3e%3ctitle%3eAsset%201%3c/title%3e%3cg%20class='a'%3e%3crect%20class='b'%20width='131.39'%20height='86.9'/%3e%3c/g%3e%3crect%20class='c'%20x='48.37'%20y='15.14'%20width='34.66'%20height='56.61'/%3e%3cpath%20class='d'%20d='M51.94,43.45a35.94,35.94,0,0,1,13.75-28.3,36,36,0,1,0,0,56.61A35.94,35.94,0,0,1,51.94,43.45Z'/%3e%3cpath%20class='e'%20d='M120.5,65.76V64.6H121v-.24h-1.19v.24h.47v1.16Zm2.31,0v-1.4h-.36l-.42,1-.42-1h-.36v1.4h.26V64.7l.39.91h.27l.39-.91v1.06Z'/%3e%3cpath%20class='e'%20d='M123.94,43.45a36,36,0,0,1-58.25,28.3,36,36,0,0,0,0-56.61,36,36,0,0,1,58.25,28.3Z'/%3e%3c/svg%3e",nx=()=>{var j,l,S;const{subscription:t}=e.useSubscriptionStore(),{cart:n,setPaymentMethod:o}=e.useCart(),s=e.useNavigate(),[i,r]=p.useState(null),[a,c]=p.useState(!1),[u,h]=p.useState(!1),{setIsOpen:d}=e.useModalStore();if(!t)return null;const[g,m]=p.useState(t.gatewayName||n.gateway),f=n.paymentMethod;return p.useEffect(()=>{(async()=>{const C=await e.getGatewaysDetail(t.availableGateways);r(C)})()},[]),p.useEffect(()=>{n.gateway!==g&&m(n.gateway)},[n.gateway]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:Me.paymentMethodContainer,children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("p",{className:Me.paymentMethodTitle,children:"Active Payment Method"}),t.gatewayInfo&&Object.keys(t.gatewayInfo).length>0&&e.jsxRuntimeExports.jsx(sx,{gatewayInfo:t.gatewayInfo}),(!t.gatewayInfo||Object.keys(t.gatewayInfo).length===0)&&g==="Balance"&&e.jsxRuntimeExports.jsx(Co,{gateway:g,gatewayDisplayName:g,total:(t==null?void 0:t.price.amount)||0,onSignInClick:()=>s("/customer-dash")}),(!t.gatewayInfo||Object.keys(t.gatewayInfo).length===0)&&!g&&e.jsxRuntimeExports.jsx("span",{className:Me.noMethod,children:"Payment method is not set"}),(!t.gatewayInfo||Object.keys(t.gatewayInfo).length===0)&&g&&e.jsxRuntimeExports.jsx("div",{className:Me.activeMethod,children:i&&e.jsxRuntimeExports.jsx(e.CheckoutPaymentMethod,{align:"row",gatewayLogoCfId:(j=i.find(x=>x.name===g))==null?void 0:j.logoCfImageId,gatewayDisplayName:(l=i.find(x=>x.name===g))==null?void 0:l.displayName,gateway:g,poweredByLogoCfId:(S=i.find(x=>x.name===g))==null?void 0:S.poweredByImageCfImageId,className:Me.activeMethodPaymentMethod,selected:f===g,onSelect:x=>{o(x)}},g)})]}),e.jsxRuntimeExports.jsx(e.Button$1,{type:"Special",onClick:x=>{x.stopPropagation(),d(!0),h(!0)},children:n.gateway?"Change":"Manage"})]}),u&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>h(!1),children:e.jsxRuntimeExports.jsx(tx,{setIsLoading:c,setIsOpen:h})})]})},sx=({gatewayInfo:t})=>{var n,o,s,i,r;return e.jsxRuntimeExports.jsxs("div",{className:Me.method,children:[e.jsxRuntimeExports.jsxs("div",{className:Me.paymentMethodLogo,children:[((n=t.card)==null?void 0:n.brand.toLowerCase())==="visa"&&e.jsxRuntimeExports.jsx(e.Visa,{}),((o=t.card)==null?void 0:o.brand.toLowerCase())==="mastercard"&&e.jsxRuntimeExports.jsx("img",{src:ox,alt:"",width:22}),((s=t.card)==null?void 0:s.brand.toLowerCase())!=="visa"&&((i=t.card)==null?void 0:i.brand.toLowerCase())!=="mastercard"&&e.jsxRuntimeExports.jsx(e.Icon,{name:"CreditCard",width:22})]}),e.jsxRuntimeExports.jsxs("p",{className:Me.paymentMethodNumber,children:["•••• •••• •••• ",(r=t.card)==null?void 0:r.last4]})]})},rx="_subscriptionProductContainer_83ibx_4",ix="_subscriptionProductImage_83ibx_15",ax="_subscriptionProductInfo_83ibx_32",cx="_name_83ibx_37",lx="_price_83ibx_40",rt={subscriptionProductContainer:rx,subscriptionProductImage:ix,subscriptionProductInfo:ax,name:cx,price:lx},ux=({subscription:t,id:n,accessToken:o})=>{const[s,i]=p.useState(!1),{setIsOpen:r}=e.useModalStore();return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:rt.subscriptionProductContainer,onClick:a=>a.stopPropagation(),children:[e.jsxRuntimeExports.jsx("div",{className:rt.subscriptionProductImage,children:t!=null&&t.image?e.jsxRuntimeExports.jsx("img",{src:e.convertCfImageIdToUrl(t.image.cfId)}):e.jsxRuntimeExports.jsx(e.Icon,{name:"Image"})}),e.jsxRuntimeExports.jsxs("div",{className:rt.subscriptionProductInfo,children:[e.jsxRuntimeExports.jsx("div",{className:"flex items-center gap-2",children:e.jsxRuntimeExports.jsx("h2",{className:rt.name,children:t.name})}),e.jsxRuntimeExports.jsxs("p",{className:rt.price,children:[e.formatPrice(t.price)," / ",t.recurringInterval]})]}),e.jsxRuntimeExports.jsx(e.Button$1,{type:"Special",onClick:a=>{a.preventDefault(),i(!0),r(!0)},children:"Cancel"})]}),s&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>i(!1),children:e.jsxRuntimeExports.jsx(Kx,{accessToken:o,id:n,isOpen:s,setIsOpen:i})})]})},dx="_content_5ctxw_1",px="_selectedPlan_5ctxw_37",mx="_planName_5ctxw_44",xx="_description_5ctxw_48",hx="_price_5ctxw_51",gx="_buttonGroup_5ctxw_79",jx="_buttonWrapper_5ctxw_84",Ix="_modal_5ctxw_88",fx="_header_5ctxw_95",Ie={content:dx,selectedPlan:px,planName:mx,description:xx,price:hx,buttonGroup:gx,buttonWrapper:jx,modal:Ix,header:fx},Sx=({setIsOpen:t,selectedVariant:n,subscription:o})=>{if(!n)return null;const{setIsOpen:s}=e.useModalStore(),i=()=>{r()},r=()=>{s(!1),setTimeout(()=>{t(!1)},300)},a=(n.subscriptionSettings.compareAtPrice||n.subscriptionSettings.price).amount,c=n.subscriptionSettings.compareAtPrice?n.subscriptionSettings.compareAtPrice.amount-n.subscriptionSettings.price.amount:n.subscriptionSettings.price.amount,u=a-c,h=new Intl.NumberFormat("en-US",{style:"currency",currency:o.price.currency});return e.jsxRuntimeExports.jsxs("div",{className:Ie.modal,children:[e.jsxRuntimeExports.jsxs("div",{className:Ie.header,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Choose upgrade method"}),e.jsxRuntimeExports.jsx(e.Icon,{name:"X",hoverable:!0,onClick:()=>r(),fill:"var(--text-primary)"})]}),e.jsxRuntimeExports.jsxs("div",{className:Ie.bottomSheet,children:[e.jsxRuntimeExports.jsxs("div",{className:Ie.content,children:[e.jsxRuntimeExports.jsxs("div",{className:Ie.selectedPlan,children:[e.jsxRuntimeExports.jsx("h2",{className:Ie.planName,children:n.name}),e.jsxRuntimeExports.jsx("p",{className:Ie.description,children:n.description}),e.jsxRuntimeExports.jsxs("p",{className:Ie.price,children:["$",n.subscriptionSettings.price.amount.toFixed(2)," /"," ",n.subscriptionSettings.recurringIntervalDays===30?"month":"year"]})]}),e.jsxRuntimeExports.jsx(dt,{formatter:h,coupon:null,total:u,discount:c})]}),e.jsxRuntimeExports.jsxs("div",{className:Ie.buttonGroup,children:[e.jsxRuntimeExports.jsx("div",{className:Ie.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:()=>r(),children:"Stay with us"})}),e.jsxRuntimeExports.jsx("div",{className:Ie.buttonWrapper,children:e.jsxRuntimeExports.jsxs(e.Button$1,{type:"Primary",onClick:i,children:["Upgrade for $",u.toFixed(2)]})})]})]})]})},_x="_reviewMessage_1t8u4_1",Cx="_leaveReviewContainer_1t8u4_11",vx="_leaveReviewTitle_1t8u4_20",Ot={reviewMessage:_x,leaveReviewContainer:Cx,leaveReviewTitle:vx},Rx=({review:t,orderId:n,className:o})=>{const[s,i]=p.useState((t==null?void 0:t.rating)||0),[r,a]=p.useState(!1),{setIsOpen:c}=e.useModalStore(),{notifications:u,setNotifications:h}=e.useNotificationStore(),d=async g=>{t&&"accessToken"in t&&(await jn({comment:g,rating:s,tsId:e.getTsId()},n,t.accessToken),h([...u,{status:"success",id:e.v4(),message:"Review left successfully"}]),a(!1))};return p.useEffect(()=>{t&&s&&"accessToken"in t&&!t.rating&&(c(!0),a(!0))},[s]),t?t.rating&&"accessToken"in t?e.jsxRuntimeExports.jsxs("div",{className:Ot.reviewMessage,children:["You left a ",t.rating," star rating"]}):e.jsxRuntimeExports.jsxs("div",{className:e.clx(Ot.leaveReviewContainer,o),children:[e.jsxRuntimeExports.jsx("p",{className:Ot.leaveReviewTitle,children:"Leave a review"}),e.jsxRuntimeExports.jsx(cu,{rating:s,setRating:i,disabled:!!t.rating||!("accessToken"in t)}),r&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>a(!1),children:e.jsxRuntimeExports.jsx(Lx,{setIsOpen:a,onSubmit:d})})]}):null},Ex="_bottomSheet_1bcyj_1",yx="_content_1bcyj_7",bx="_title_1bcyj_18",wx="_buttonGroup_1bcyj_22",kx="_buttonWrapper_1bcyj_33",Nx="_modal_1bcyj_37",Tx="_header_1bcyj_44",Be={bottomSheet:Ex,content:yx,title:bx,buttonGroup:wx,buttonWrapper:kx,modal:Nx,header:Tx},Lx=({setIsOpen:t,onSubmit:n})=>{const[o,s]=p.useState(""),{setIsOpen:i}=e.useModalStore(),r=()=>{i(!1),setTimeout(()=>{t(!1)},300)};return e.jsxRuntimeExports.jsxs("div",{className:Be.modal,onClick:a=>a.stopPropagation(),children:[e.jsxRuntimeExports.jsxs("div",{className:Be.header,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",className:Be.title,children:"Review Description"}),e.jsxRuntimeExports.jsx(e.Icon,{name:"X",hoverable:!0,onClick:r,fill:"var(--text-primary)"})]}),e.jsxRuntimeExports.jsxs("div",{className:Be.bottomSheet,children:[e.jsxRuntimeExports.jsx("div",{className:Be.content,children:e.jsxRuntimeExports.jsx(e.Textarea$1,{placeholder:"Great product and fast checkout...",value:o,onChange:a=>s(a),label:"Describe your review in detail below"})}),e.jsxRuntimeExports.jsxs("div",{className:Be.buttonGroup,children:[e.jsxRuntimeExports.jsx("div",{className:Be.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:r,children:"Cancel"})}),e.jsxRuntimeExports.jsx("div",{className:Be.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",disabled:!o,onClick:()=>{r(),n(o)},children:"Submit"})})]})]})]})},Px="_container_1idhv_1",Ax="_buttonGroup_1idhv_8",Bx="_buttonWrapper_1idhv_15",Mx="_header_1idhv_19",$x="_content_1idhv_28",Ue={container:Px,buttonGroup:Ax,buttonWrapper:Bx,header:Mx,content:$x},Fx=({setIsOpen:t})=>{const{subscription:n}=e.useSubscriptionStore(),{getTotalAndDiscount:o,cart:s,coupon:i}=e.useCart(),[r,a]=p.useState(1),c=e.useNavigate(),{setIsOpen:u}=e.useModalStore(),{setNotifications:h,notifications:d}=e.useNotificationStore(),[g,m]=p.useState(!1),f=p.useMemo(()=>o(),[i,s]),j=p.useMemo(()=>f.totalWithDiscount?f.total-f.totalWithDiscount:0,[f]);if(g)return e.jsxRuntimeExports.jsx(e.ProcessingPaymentModal,{});const l=(n==null?void 0:n.price.currency)||"USD",S=new Intl.NumberFormat("en-US",{style:"currency",currency:l});async function x(){var I;m(!0);try{const{data:R}=await e.extendSubscription((n==null?void 0:n.id)||"",{});h([{id:e.v4(),message:"Order created successfully",status:"success"}]),c(`/orders/${(I=R.data)==null?void 0:I.id}/${R.data.fullAccessToken}`)}catch(R){const _=R;h([...d,{id:e.v4(),message:`Order creation failed: ${_.message}`,status:"error"}]),C()}finally{m(!1)}}function C(){u(!1),setTimeout(()=>{t(!1)},300)}return e.jsxRuntimeExports.jsxs("div",{className:Ue.container,onClick:I=>I.stopPropagation(),children:[e.jsxRuntimeExports.jsxs("div",{className:Ue.header,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",className:Ue.title,children:"Extend Subscription"}),e.jsxRuntimeExports.jsx(e.Icon,{name:"X",onClick:C,hoverable:!0,fill:"var(--text-primary)"})]}),e.jsxRuntimeExports.jsxs("div",{className:Ue.content,children:[e.jsxRuntimeExports.jsx(Su,{step:r,totalSteps:12,onStepChange:a,label:"How long would you like to extend your subscription for?"}),e.jsxRuntimeExports.jsx(dt,{formatter:S,coupon:i,total:f.total,discount:j,totalWithDiscount:f.totalWithDiscount}),e.jsxRuntimeExports.jsxs("div",{className:Ue.buttonGroup,children:[e.jsxRuntimeExports.jsx("div",{className:Ue.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:C,children:"Cancel"})}),e.jsxRuntimeExports.jsx("div",{className:Ue.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",onClick:x,children:"Extend"})})]})]})]})},Dx="_bottomSheet_uw5jb_1",Hx="_content_uw5jb_7",Ox="_radioGroup_uw5jb_11",Ux="_confirmation_uw5jb_26",Wx="_iconWrapper_uw5jb_33",Gx="_title_uw5jb_42",qx="_message_uw5jb_48",Vx="_buttonGroup_uw5jb_54",zx="_buttonWrapper_uw5jb_64",Zx="_modal_uw5jb_68",Xx="_header_uw5jb_77",se={bottomSheet:Dx,content:Hx,radioGroup:Ox,confirmation:Ux,iconWrapper:Wx,title:Gx,message:qx,buttonGroup:Vx,buttonWrapper:zx,modal:Zx,header:Xx},Yx={0:"Are you sure?",1:"Just making sure",2:"We're sorry to see you go"},Kx=({isOpen:t,setIsOpen:n,id:o,accessToken:s})=>{const[i,r]=p.useState(0),[a,c]=p.useState(!1),[u,h]=p.useState(""),[d,g]=p.useState(""),{setIsOpen:m}=e.useModalStore(),f=async()=>{if(!u)return;c(!0);const l=await e.cancelSubscription(o,s,{reason:u==="Other reason"?d:u});c(!1),l&&r(2)};p.useEffect(()=>{t||(r(0),h(""),g(""))},[t]);const j=()=>{m(!1),setTimeout(()=>{n(!1)},300)};return e.jsxRuntimeExports.jsxs("div",{className:se.modal,onClick:l=>l.stopPropagation(),children:[e.jsxRuntimeExports.jsxs("div",{className:se.header,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",children:Yx[i]||""}),e.jsxRuntimeExports.jsx(e.Icon,{name:"X",onClick:j,hoverable:!0,fill:"var(--text-primary)"})]}),e.jsxRuntimeExports.jsxs("div",{className:se.content,children:[i===0&&e.jsxRuntimeExports.jsxs("div",{className:se.bottomSheet,children:[e.jsxRuntimeExports.jsx("p",{children:"Before you cancel your subscription can you tell us why?"}),e.jsxRuntimeExports.jsxs("div",{className:se.radioGroup,children:[e.jsxRuntimeExports.jsx(e.Radio,{defaultValue:u,onChange:l=>h(l),options:[{value:"Found another company",label:"Found another company"},{value:"Expensive",label:"Expensive"},{value:"Technical problems",label:"Technical problems"},{value:"Support problems",label:"Support problems"},{value:"Other reason",label:"Other reason"}],flexDirection:"column"}),u==="Other reason"&&e.jsxRuntimeExports.jsx(e.Textarea$1,{value:d,onChange:l=>g(l),placeholder:"Describe the reason..."})]}),e.jsxRuntimeExports.jsxs("div",{className:se.buttonGroup,children:[e.jsxRuntimeExports.jsx("div",{className:se.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:j,children:"Stay with us"})}),e.jsxRuntimeExports.jsx("div",{className:se.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",onClick:()=>u&&r(1),disabled:!u,children:"Continue"})})]})]}),i===1&&e.jsxRuntimeExports.jsxs("div",{className:se.bottomSheet,children:[e.jsxRuntimeExports.jsx("p",{children:"You'll lose access to all of the features and content available within this subscription."}),e.jsxRuntimeExports.jsxs("div",{className:se.buttonGroup,children:[e.jsxRuntimeExports.jsx("div",{className:se.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:j,children:"Stay with us"})}),e.jsxRuntimeExports.jsx("div",{className:se.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Primary",onClick:f,disabled:a,children:"Cancel it anyway"})})]})]}),i===2&&e.jsxRuntimeExports.jsxs("div",{className:se.bottomSheet,children:[e.jsxRuntimeExports.jsxs("div",{className:`${se.confirmation}`,children:[e.jsxRuntimeExports.jsx("div",{className:se.iconWrapper,children:e.jsxRuntimeExports.jsx(e.Icon,{name:"Check",fill:"var(--text-success)"})}),e.jsxRuntimeExports.jsx("p",{className:se.title,children:"Subscription Cancelled"}),e.jsxRuntimeExports.jsx("p",{className:se.message,children:"You'll lose access to all of the features and content available within this subscription."})]}),e.jsxRuntimeExports.jsx("div",{className:se.buttonGroup,children:e.jsxRuntimeExports.jsx("div",{className:se.buttonWrapper,children:e.jsxRuntimeExports.jsx(e.Button$1,{type:"Secondary",onClick:j,children:"Close"})})})]})]})]})},Jx="_checkoutContainer_thje1_1",Qx="_loaderContainer_thje1_20",Ut={checkoutContainer:Jx,loaderContainer:Qx},Eo=()=>{const{isAntistock:t}=e.useGeneralStore(),{cart:n,products:o,pending:s,getTotalAndDiscount:i,getPossibleGateways:r,submitCart:a,setGateway:c,applyCoupon:u,setDiscordSocialConnectId:h,setCustomFields:d,applyCouponPending:g,coupon:m,removeCoupon:f,getDiscordSettings:j,setPaymentMethod:l,reset:S}=e.useCart(),x=p.useMemo(()=>i(),[m,n]),C=e.useNavigate();return p.useEffect(()=>{if(n.parts.length===0){if(t){C("/");return}try{C(-1)}catch{C("/")}}},[n.parts]),s?e.jsxRuntimeExports.jsx("div",{className:Ut.checkoutContainer,children:e.jsxRuntimeExports.jsx("div",{className:Ut.loaderContainer,children:e.jsxRuntimeExports.jsx(e.Loader,{})})}):e.jsxRuntimeExports.jsxs("div",{className:Ut.checkoutContainer,children:[e.jsxRuntimeExports.jsx(nd,{cart:n,products:o,applyCoupon:u,applyCouponPending:g,coupon:m,removeCoupon:f,totalAndDiscount:x}),e.jsxRuntimeExports.jsx(Vd,{cart:n,getPossibleGateways:r,setGateway:c,getDiscordSettings:j,products:o,submitCart:a,totalAndDiscount:x,setCustomFieldsToCart:d,setDiscordSocialConnectId:h,setPaymentMethod:l,reset:S,isAntistock:t})]})},eh="_chargePageContainer_qeuie_1",th="_chargeItems_qeuie_14",oh="_mainContent_qeuie_25",nh="_contentWrapper_qeuie_44",sh="_antistockContent_qeuie_53",rh="_statusBlock_qeuie_58",ih="_statusBlockAntistock_qeuie_63",ah="_notPaidSection_qeuie_68",ch="_antistockPayNow_qeuie_82",lh="_antistockFooter_qeuie_86",uh="_antistockTrackPayment_qeuie_96",dh="_footer_qeuie_106",ph="_loaderContainer_qeuie_128",le={chargePageContainer:eh,chargeItems:th,mainContent:oh,contentWrapper:nh,antistockContent:sh,statusBlock:rh,statusBlockAntistock:ih,notPaidSection:ah,antistockPayNow:ch,antistockFooter:lh,antistockTrackPayment:uh,footer:dh,loaderContainer:ph},mh=()=>{const{id:t}=e.useParams(),[n,o]=e.useSearchParams(),[s,i]=p.useState(!1),[r,a]=p.useState(),[c,u]=p.useState(!0),h=e.useNavigate(),d=p.useRef(),g=p.useRef(!1),{setIsOpen:m}=e.useModalStore(),{isAntistock:f}=e.useGeneralStore();return p.useEffect(()=>{const j=async(S,x=!1)=>{x||i(!0);const{data:C}=await In(S);i(!1),a(C)},l=setInterval(()=>{t&&j(t,!0)},5e3);return t&&j(t),()=>{clearInterval(l)}},[]),p.useEffect(()=>{const j=setTimeout(()=>{var S;console.log("charge timeout",r);const l=n.get("redirectRoute");if((r==null?void 0:r.status)===e.ChargeStatus.Paid&&r.redirectUrl&&!d.current){const C=JSON.parse(localStorage.getItem("orders")||"{}")[((S=r==null?void 0:r.order)==null?void 0:S.id)||""];C?window.open(C.fullAccessToken?`${r.redirectUrl}/${C.fullAccessToken}`:`${r.redirectUrl}`,"_self"):window.open(r.redirectUrl,"_self")}(r==null?void 0:r.status)===e.ChargeStatus.Paid&&d.current&&(console.log("redirectRouteRef.current",d.current),h(d.current,{replace:!0})),l&&d&&(d.current=l,n.delete("redirectRoute"),o(n))},1e3);return()=>clearTimeout(j)},[r]),p.useEffect(()=>{((r==null?void 0:r.gateway)==="PayPalFF"||(r==null?void 0:r.gateway)==="Сashapp")&&m(!0)},[r]),p.useEffect(()=>{var j;if(r!=null&&r.displayPaymentInfo&&r.displayPaymentInfo.length===1&&r.status===e.ChargeStatus.NotPaid&&!g.current){const l=r.displayPaymentInfo[0];l.type==="Button"&&((j=l.props)!=null&&j.url)&&(window.open(l.props.url,"_blank"),g.current=!0)}},[r==null?void 0:r.displayPaymentInfo,r==null?void 0:r.status]),s?e.jsxRuntimeExports.jsx("div",{className:le.loaderContainer,children:e.jsxRuntimeExports.jsx(e.Loader,{})}):e.jsxRuntimeExports.jsxs("div",{className:le.chargePageContainer,children:[e.jsxRuntimeExports.jsx("div",{className:le.chargeItems,children:e.jsxRuntimeExports.jsx(Ap,{charge:r})}),e.jsxRuntimeExports.jsx("div",{className:le.mainContent,style:f?{borderLeft:"1px solid var(--border-secondary)"}:void 0,children:e.jsxRuntimeExports.jsxs("div",{className:e.clx(le.contentWrapper,{[le.antistockContent]:f}),children:[r&&(r==null?void 0:r.status)!==e.ChargeStatus.NotPaid&&e.jsxRuntimeExports.jsx(e.ChargeStatusBlock,{charge:r}),r&&e.jsxRuntimeExports.jsxs("div",{className:e.clx(le.statusBlock,{[le.statusBlockAntistock]:f}),children:[e.jsxRuntimeExports.jsx(Ro,{lastUpdate:r.expiresAt,email:r.customerForCharge.email,invoiceId:r.id,paymentType:r.gateway}),f&&(r==null?void 0:r.status)===e.ChargeStatus.NotPaid&&e.jsxRuntimeExports.jsx("div",{className:le.antistockPayNow,children:r==null?void 0:r.displayPaymentInfo.map((j,l)=>e.jsxRuntimeExports.jsx(Vt,{block:j},l))}),f&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:le.antistockTrackPayment,children:e.jsxRuntimeExports.jsx(e.TrackPayment,{timeline:r.timeline})}),e.jsxRuntimeExports.jsx(Ce,{className:le.antistockFooter})]})]}),!f&&(r==null?void 0:r.status)===e.ChargeStatus.NotPaid&&e.jsxRuntimeExports.jsx("div",{className:le.notPaidSection,children:r==null?void 0:r.displayPaymentInfo.map((j,l)=>e.jsxRuntimeExports.jsx(Vt,{block:j},l))}),!f&&e.jsxRuntimeExports.jsx(Ce,{className:le.footer})]})}),(r==null?void 0:r.gateway)==="PayPalFF"&&c&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>u(!1),children:e.jsxRuntimeExports.jsx(fp,{price:r.price,setIsOpen:u})}),(r==null?void 0:r.gateway)==="Сashapp"&&c&&e.jsxRuntimeExports.jsx(e.Modal,{close:()=>i(!1),children:e.jsxRuntimeExports.jsx(Kp,{setIsOpen:u,chargeId:r.id})})]})};var yo=(t=>(t.NEW="NEW",t.ANSWERED="ANSWERED",t.NOT_ANSWERED="NOT_ANSWERED",t.CLOSED="CLOSED",t))(yo||{});const xh="_wrapper_3txfs_1",hh="_ticketContainer_3txfs_23",gh="_title_3txfs_28",jh="_subtext_3txfs_35",Ih="_container_3txfs_41",fh="_content_3txfs_52",Sh="_messages_3txfs_63",_h="_input_3txfs_81",Ch="_textarea_3txfs_94",vh="_textareaAntistock_3txfs_123",Rh="_message_3txfs_63",Eh="_messageDate_3txfs_153",yh="_messageAntistock_3txfs_159",bh="_myMessage_3txfs_163",wh="_otherMessage_3txfs_170",kh="_button_3txfs_177",Nh="_disabled_3txfs_177",Th="_loadingMessage_3txfs_203",ee={wrapper:xh,ticketContainer:hh,title:gh,subtext:jh,container:Ih,content:fh,messages:Sh,input:_h,textarea:Ch,textareaAntistock:vh,message:Rh,messageDate:Eh,messageAntistock:yh,myMessage:bh,otherMessage:wh,button:kh,disabled:Nh,loadingMessage:Th},Lh=()=>{const t=window.location.pathname.split("/"),n=t[t.length-1],o=t[t.length-2],[s,i]=p.useState(!0),[r,a]=p.useState(null),[c,u]=p.useState(""),[h,d]=p.useState(null),{executeRecaptcha:g}=e.useReCaptcha(),{isAntistock:m}=e.useGeneralStore(),f=(r==null?void 0:r.status)===yo.CLOSED,j=async()=>{if(o&&n){const{data:x}=await e.fetchTicket(o,n);a(x),i(!1)}};p.useEffect(()=>{j();const x=setInterval(()=>{j()},5e3);return()=>clearInterval(x)},[]);const l=async()=>{const x=await g();if(!o||!n||!x||!c.trim())return;const C={content:c,createdAt:new Date().toISOString(),id:Date.now(),isSellerReply:!1};a(I=>I?{...I,messages:[...I.messages,C]}:null),d(C.id),u("");try{await e.sendTicketMessage(o,n,c,x,e.getTsId()),await j()}finally{setTimeout(()=>{d(null)},1e4)}},S=x=>{const C=new Date,I=new Date(x),R=Math.floor((C.getTime()-I.getTime())/1e3);if(R<60)return"just now";if(R<3600){const _=Math.floor(R/60);return`${_} minute${_>1?"s":""} ago`}else if(R<10800){const _=Math.floor(R/3600);return`${_} hour${_>1?"s":""} ago`}else return I.getFullYear()===C.getFullYear()?I.toLocaleDateString("en-US",{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"}):I.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"})};return e.jsxRuntimeExports.jsx("div",{className:ee.wrapper,children:s&&!r?e.jsxRuntimeExports.jsx(e.Loader,{}):e.jsxRuntimeExports.jsxs("div",{className:ee.container,children:[m?e.jsxRuntimeExports.jsxs("div",{className:ee.ticketContainer,children:[e.jsxRuntimeExports.jsx("div",{className:ee.title,style:{fontSize:"var(--font-heading-h3-size)"},children:r==null?void 0:r.title}),e.jsxRuntimeExports.jsx("div",{className:ee.subtext,style:{fontSize:"var(--font-body-md-size)"},children:"We’re going to respond to your ticket shortly. You’ll receive updates in your email inbox. Feel free to close this page."})]}):e.jsxRuntimeExports.jsx("div",{className:ee.title,children:`#${o} (${r==null?void 0:r.title})`}),e.jsxRuntimeExports.jsxs("div",{className:ee.content,style:{position:m?"relative":void 0,border:m?"1px solid var(--border-secondary)":void 0},children:[e.jsxRuntimeExports.jsx("div",{className:ee.messages,children:r==null?void 0:r.messages.sort((x,C)=>new Date(x.createdAt).getTime()-new Date(C.createdAt).getTime()).map(x=>e.jsxRuntimeExports.jsxs("div",{className:e.clx(ee.message,{[ee.messageAntistock]:m,[ee.myMessage]:!x.isSellerReply,[ee.otherMessage]:x.isSellerReply,[ee.loadingMessage]:h===x.id}),children:[e.jsxRuntimeExports.jsx("div",{className:ee.messageContent,children:e.splitTextIntoSpans(x.content,!1)}),h!==x.id&&e.jsxRuntimeExports.jsx("div",{className:ee.messageDate,children:S(x.createdAt)}),h===x.id&&e.jsxRuntimeExports.jsx("div",{className:ee.messageDate,children:e.jsxRuntimeExports.jsx(e.Loader,{})})]},x.id))}),e.jsxRuntimeExports.jsxs("div",{className:ee.input,children:[e.jsxRuntimeExports.jsx("textarea",{disabled:f,className:e.clx(ee.textarea,{[ee.textareaAntistock]:m}),value:c,placeholder:f?"The ticket has been closed. Need further assistance? Please submit a new request.":m?"Type a message...":"What worries you?",onChange:x=>u(x.target.value),onKeyDown:x=>{x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),l())}}),e.jsxRuntimeExports.jsx("div",{onClick:l,className:e.clx(ee.button,{[ee.disabled]:f}),children:e.jsxRuntimeExports.jsx(e.Icon,{name:"PaperPlaneRight"})})]})]})]})})},Ph="_subscriptionContainer_1j6ol_1",Ah="_leftSection_1j6ol_15",Bh="_content_1j6ol_26",Mh="_mainContent_1j6ol_33",$h="_detailsSection_1j6ol_37",Fh="_buttonGroup_1j6ol_50",Dh="_detailsContent_1j6ol_57",We={subscriptionContainer:Ph,leftSection:Ah,content:Bh,mainContent:Mh,detailsSection:$h,buttonGroup:Fh,detailsContent:Dh},Hh=()=>{const{id:t,accessToken:n}=e.useParams(),{subscription:o,setSubscription:s}=e.useSubscriptionStore(),{setIsOpen:i}=e.useModalStore(),[r,a]=p.useState(!1),[c,u]=p.useState(!1);p.useLayoutEffect(()=>{s(null)},[t,n]);const{balanceSettings:h,setBalanceSettings:d}=e.useCustomerDashboardStore();return p.useEffect(()=>{t&&n&&(async()=>{if(!t||!n)return;u(!0);const{data:m}=await e.fetchSubscription(t,n);s({...m}),u(!1)})()},[t,n]),p.useEffect(()=>{h||(async()=>{const m=await e.getBalanceSettings();d(m)})()},[h]),c?e.jsxRuntimeExports.jsx(e.Loader,{}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:We.subscriptionContainer,children:[e.jsxRuntimeExports.jsx("div",{className:We.leftSection,children:e.jsxRuntimeExports.jsxs("div",{className:We.content,children:[e.jsxRuntimeExports.jsx(ut,{}),e.jsxRuntimeExports.jsxs("div",{className:We.mainContent,children:[o&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Your Subscription"}),e.jsxRuntimeExports.jsx(cm,{subscription:{price:o.price,name:o.productName,description:o.productDescription,status:o.status,image:o.productImage,recurringInterval:o.recurringInterval}}),e.jsxRuntimeExports.jsx("div",{className:We.buttonGroup,children:o.pricingPlanExists&&e.jsxRuntimeExports.jsx(e.Button$1,{onClick:g=>{g.stopPropagation(),i(!0),a(!0)},style:{maxWidth:"500px",width:"100%"},children:"Change Plan"})})]}),e.jsxRuntimeExports.jsx(Ce,{})]})]})}),e.jsxRuntimeExports.jsx("div",{className:We.detailsSection,children:e.jsxRuntimeExports.jsxs("div",{className:We.detailsContent,children:[e.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Details"}),(o==null?void 0:o.coupon)&&e.jsxRuntimeExports.jsx(Um,{coupon:o.coupon,currency:o.price.currency||"USD"}),o&&e.jsxRuntimeExports.jsx(ux,{id:t||"",accessToken:n||"",subscription:{price:o.price,name:o.productName,description:o.productDescription,status:o.status,image:o.productImage,recurringInterval:o.recurringInterval}}),o&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(nx,{}),o.activeTo&&e.jsxRuntimeExports.jsx(Bm,{})]}),e.jsxRuntimeExports.jsx(Ce,{className:"flex md:hidden"})]})})]}),e.jsxRuntimeExports.jsx(Nm,{isOpen:r,setIsOpen:a,subscription:o})]})},Oh="_topUpContainer_1pag6_1",Uh="_formWrapper_1pag6_15",Wh="_header_1pag6_29",Gh="_footer_1pag6_82",qh="_wrapper_1pag6_105",it={topUpContainer:Oh,formWrapper:Uh,header:Wh,footer:Gh,wrapper:qh},Vh=()=>{const{gatewaysDetail:t,setGatewaysDetail:n,balanceSettings:o,setBalanceSettings:s}=e.useCustomerDashboardStore();return p.useEffect(()=>{!t&&o&&(async()=>{const r=await e.getGatewaysDetail(o!=null&&o.isEnabled?(o==null?void 0:o.topUpSettings.gateways)||[]:[]);n(r)})()},[t,o]),p.useEffect(()=>{o||(async()=>{const r=await e.getBalanceSettings();s(r)})()},[o]),e.jsxRuntimeExports.jsxs("div",{className:it.wrapper,children:[e.jsxRuntimeExports.jsx(ut,{className:it.header}),e.jsxRuntimeExports.jsx("div",{className:it.topUpContainer,children:o?e.jsxRuntimeExports.jsx("div",{className:it.formWrapper,children:e.jsxRuntimeExports.jsx(e.BalanceModal,{setIsOpen:()=>{},isModal:!1})}):e.jsxRuntimeExports.jsx(e.Loader,{})}),e.jsxRuntimeExports.jsx("div",{className:it.footer,children:e.jsxRuntimeExports.jsx(Ce,{})})]})},zh="_orderPage_gc87l_1",Zh="_leftSection_gc87l_15",Xh="_content_gc87l_35",Yh="_main_gc87l_42",Kh="_mainAntistock_gc87l_56",Jh="_orderMainDataAntistock_gc87l_69",Qh="_timelineBlockAntistock_gc87l_81",e2="_footerAntistock_gc87l_92",t2="_statusBlock_gc87l_104",o2="_timelineBlock_gc87l_81",n2="_footer_gc87l_92",s2="_rightSection_gc87l_121",r2="_header_gc87l_142",i2="_productList_gc87l_150",a2="_mobileFooter_gc87l_157",c2="_loaderContainer_gc87l_166",l2="_orderMainData_gc87l_69",u2="_prices_gc87l_181",d2="_headerTitle_gc87l_185",p2="_headerDescription_gc87l_189",te={orderPage:zh,leftSection:Zh,content:Xh,main:Yh,mainAntistock:Kh,orderMainDataAntistock:Jh,timelineBlockAntistock:Qh,footerAntistock:e2,statusBlock:t2,timelineBlock:o2,footer:n2,rightSection:s2,header:r2,productList:i2,mobileFooter:a2,loaderContainer:c2,orderMainData:l2,prices:u2,headerTitle:d2,headerDescription:p2},m2=()=>{var f,j,l,S,x,C;const{id:t,accessToken:n}=e.useParams(),o=e.useNavigate(),[s,i]=p.useState(),[r,a]=p.useState(!1),c=e.useCopy(),{isAntistock:u}=e.useGeneralStore(),h=((f=s==null?void 0:s.rawPrice)==null?void 0:f.currency)||"USD",d=new Intl.NumberFormat("en-US",{style:"currency",currency:h}),g=p.useMemo(()=>(s==null?void 0:s.partOrders.map(I=>{var R,_;return{id:(I==null?void 0:I.id)||0,image:I.productWithVariant.image,name:(()=>{var F,K;const v=((F=I.productWithVariant)==null?void 0:F.name)||"",w=((K=I.productWithVariant)==null?void 0:K.variantName)||"";return!v&&!w?"":!w||v===w?v:v?`${v} (${w})`:w})(),description:"",price:{quantity:I.quantity,amount:((R=I.productWithVariant)==null?void 0:R.price.amount)||0,currency:(_=I.productWithVariant)==null?void 0:_.price.currency},deliveryCategories:"deliveryCategories"in I?I.deliveryCategories:void 0,customerNote:I.customerNote,chargeType:I.chargeType||"ONE_TIME"}}))||[],[s]),m=async(I,R,_=!1)=>{var w,F;_||a(!0);const{data:v}=await(R?e.fetchAuthorizedOrder(`${I}/${R}`):e.fetchOrder(I));a(!1),v.status!==e.OrderStatus.Completed&&((w=v.charge)==null?void 0:w.status)===e.ChargeStatus.NotPaid&&o(`/charges/${(F=v.charge)==null?void 0:F.id}`,{replace:!0}),i(v)};return p.useLayoutEffect(()=>{if(t&&!n){const I=JSON.parse(localStorage.getItem("orders")||"{}");I[t]&&o(`/orders/${t}/${I[t].fullAccessToken}`)}},[t]),p.useEffect(()=>{t&&m(t,n,!0);const I=setInterval(()=>{t&&m(t,n,!0)},5e3);return()=>{clearInterval(I)}},[t,n]),r?e.jsxRuntimeExports.jsx("div",{className:te.loaderContainer,children:e.jsxRuntimeExports.jsx(e.Loader,{})}):e.jsxRuntimeExports.jsxs("div",{className:te.orderPage,children:[e.jsxRuntimeExports.jsx("div",{className:te.leftSection,children:e.jsxRuntimeExports.jsxs("div",{className:te.content,children:[e.jsxRuntimeExports.jsx(ut,{}),s&&e.jsxRuntimeExports.jsxs("div",{className:`${te.main} ${u?te.mainAntistock:""}`,children:[e.jsxRuntimeExports.jsx(e.OrderStatusBlock,{className:te.statusBlock,orderStatus:s.status}),e.jsxRuntimeExports.jsxs("div",{className:`${te.orderMainData} ${u?te.orderMainDataAntistock:""}`,children:[e.jsxRuntimeExports.jsx(Ro,{lastUpdate:s.createdAt,paymentType:(j=s.charge)==null?void 0:j.gateway,email:s.customer?s.customer.email:((l=s.charge)==null?void 0:l.customerForCharge.email)||"",orderId:s.id}),"accessToken"in s.review&&!u&&e.jsxRuntimeExports.jsx(Rx,{orderId:s.id,review:s.review})]}),s.charge&&s.charge.timeline&&e.jsxRuntimeExports.jsx(e.TrackPayment,{className:`${te.timelineBlock} ${u?te.timelineBlockAntistock:""}`,timeline:s.charge.timeline}),e.jsxRuntimeExports.jsx(Ce,{className:`${te.footer} ${u?te.footerAntistock:""}`})]})]})}),e.jsxRuntimeExports.jsx("div",{className:te.rightSection,style:u?{borderLeft:"1px solid var(--border-secondary)"}:void 0,children:e.jsxRuntimeExports.jsxs("div",{className:te.content,children:[((S=s==null?void 0:s.charge)==null?void 0:S.name)&&e.jsxRuntimeExports.jsxs("header",{className:te.header,children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h1",{className:te.headerTitle,children:s.charge.name}),s.charge.description&&e.jsxRuntimeExports.jsx("p",{className:te.headerDescription,children:s.charge.description})]}),u?null:e.jsxRuntimeExports.jsxs(e.Button$1,{type:"Secondary",onClick:()=>c((s==null?void 0:s.id)||""),style:{whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:"4px"},children:[e.jsxRuntimeExports.jsx(e.Icon,{name:"Copy"}),e.jsxRuntimeExports.jsx("span",{children:"Copy ID"})]})]}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("div",{className:te.productList,children:g.map(I=>e.jsxRuntimeExports.jsx(Zt,{product:I,isOrder:!0},I.id))}),u?null:e.jsxRuntimeExports.jsx(dt,{formatter:d,coupon:null,total:((x=s==null?void 0:s.charge)==null?void 0:x.price.amount)||0,discount:0,totalWithDiscount:((C=s==null?void 0:s.charge)==null?void 0:C.price.amount)||0,className:te.prices,isShowSubtotal:!1}),e.jsxRuntimeExports.jsx(Ce,{className:te.mobileFooter})]})]})})]})},x2=t=>{const{notifications:n,setNotifications:o}=e.useNotificationStore.getState();o(n.filter(s=>s.id!==t))},h2=t=>{const{notifications:n,setNotifications:o}=e.useNotificationStore.getState(),s=e.v4();return o([...n,{id:s,...t}]),s},g2=()=>{const{balance:t,setBalance:n}=e.useCustomerDashboardStore();return p.useEffect(()=>{t||(async()=>{const s=await e.getBalance();n(s)})()},[t]),t},j2=t=>{const{blocks:n,settings:o,header:s,footer:i,announcement:r,routes:a=[],shopLogo:c,apiURLs:u,isAntistock:h=!1}=t,[d,g]=p.useState(null),{general:m,setIsAntistock:f}=e.useGeneralStore(),{setApiUrls:j}=e.useApiStore(),{setBlocks:l,setSourceBlocks:S,setHeader:x,setFooter:C,setAnnouncement:I,setSettings:R}=e.useBlocksStore(),{themeSettings:_}=e.useThemeSettingsStore(),{settings:v,setSettings:w}=e.useSettingsStore(),F=e.IS_LOCAL_HOST?localStorage.getItem("fakeDomain")||"":window.location.hostname,K=localStorage.getItem("shopPassword"),Z=localStorage.getItem("shopId")||"",M=localStorage.getItem("draftId")||"";return p.useEffect(()=>{f(h)},[h,f]),p.useEffect(()=>{Z||localStorage.setItem("shopId",(m==null?void 0:m.info.id)||"15124f8d-2c8c-4dda-a04c-31c16816f9b6")},[m]),p.useEffect(()=>{M||localStorage.setItem("draftId","ca18cf24-6659-4015-b1ab-9ebe9fa64e74")},[M]),p.useEffect(()=>{!F&&!h&&localStorage.setItem("fakeDomain","drafts-ca18cf24-6659-4015-b1ab-9ebe9fa64e74.bgng.io"),!F&&h&&localStorage.setItem("fakeDomain","eva8.astck.io")},[F]),p.useEffect(()=>{if(_&&v){const b=vn(_,v);kn(_),Rn(b)}},[_,JSON.stringify(v),window.location.hostname]),p.useEffect(()=>{const E=new o().blockSettings;w(E)},[]),p.useLayoutEffect(()=>{const b={};Object.keys(n).map(D=>{b[D]=n[D]}),S(b),l(b),x(s),C(i),I(r),R(o),u&&j(u);const E=e.createBrowserRouter([{element:e.jsxRuntimeExports.jsx(yl,{shopDomain:F,shopId:Z,shopPassword:K||void 0,shopLogo:c,children:e.jsxRuntimeExports.jsx(e.ReCaptchaProvider,{children:e.jsxRuntimeExports.jsx(_l,{children:e.jsxRuntimeExports.jsx(e.Outlet,{})})})}),errorElement:e.jsxRuntimeExports.jsx(Cl,{}),children:[{path:"/admin/builder/*",element:e.jsxRuntimeExports.jsx(Kc,{children:e.jsxRuntimeExports.jsx(qc,{blocks:n,settings:o,header:s,footer:i,announcement:r})}),errorElement:e.jsxRuntimeExports.jsx(Yc,{})},...a,{path:"/checkout",element:e.jsxRuntimeExports.jsx(Eo,{}),errorElement:e.jsxRuntimeExports.jsx(Ne,{}),loader:()=>(document.title="Checkout",!0)},{path:"/top-up",element:e.jsxRuntimeExports.jsx(Vh,{}),errorElement:e.jsxRuntimeExports.jsx(Ne,{}),loader:()=>(document.title="Top Up Balance",!0)},{path:"/charges/:id",element:e.jsxRuntimeExports.jsx(mh,{}),errorElement:e.jsxRuntimeExports.jsx(Ne,{}),loader:()=>(document.title="Charges",!0)},{path:"/orders/:id/:accessToken?",element:e.jsxRuntimeExports.jsx(m2,{}),errorElement:e.jsxRuntimeExports.jsx(Ne,{}),loader:()=>(document.title="Orders",!0)},{path:"/subscriptions/:id/:accessToken?",element:e.jsxRuntimeExports.jsx(Hh,{}),errorElement:e.jsxRuntimeExports.jsx(Ne,{}),loader:()=>(document.title="Subscriptions",!0)},{path:h?"/account":"/customer-dash",element:e.jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100vw",height:"100dvh",overflowY:"scroll",overflowX:"hidden",background:"var(--surface-primary)",color:"var(--text-primary)"},children:[e.jsxRuntimeExports.jsx(e.RenderAnnouncement,{}),e.jsxRuntimeExports.jsx(e.RenderHeader,{}),e.jsxRuntimeExports.jsx("div",{style:{flex:"1 1 auto"},children:e.jsxRuntimeExports.jsx(e.CustomerDashboard,{})}),e.jsxRuntimeExports.jsx(e.RenderFooter,{})]}),errorElement:e.jsxRuntimeExports.jsx(Ne,{}),loader:()=>(document.title=h?"Account":"Customer Dashboard",!0)},{path:"/validation",element:e.jsxRuntimeExports.jsx(il,{}),errorElement:e.jsxRuntimeExports.jsx(Ne,{}),loader:()=>(document.title="Validation",!0)},{path:"/ticket/:id/:accessToken",element:e.jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100vw",height:"100dvh",overflowY:"scroll",overflowX:"hidden",background:"var(--surface-primary)",color:"var(--text-primary)"},children:[e.jsxRuntimeExports.jsx(e.RenderHeader,{}),e.jsxRuntimeExports.jsx("div",{style:{flex:1,width:"100%",height:"100%"},children:e.jsxRuntimeExports.jsx(e.ReCaptchaProvider,{children:e.jsxRuntimeExports.jsx(Lh,{})})}),e.jsxRuntimeExports.jsx(e.RenderFooter,{})]}),errorElement:e.jsxRuntimeExports.jsx(Ne,{}),loader:()=>(document.title="Ticket",!0)},{path:"*",element:e.jsxRuntimeExports.jsx(Cn,{}),errorElement:e.jsxRuntimeExports.jsx(Ne,{})}]}]);g(E)},[m]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:d&&e.jsxRuntimeExports.jsx(e.RouterProvider,{router:d})})};exports.ReCaptchaProvider=e.ReCaptchaProvider;exports.aspectRatioOptions=e.aspectRatioOptions;exports.formatPrice=e.formatPrice;exports.parseDraftJsText=e.parseDraftJsText;exports.splitTextIntoSpans=e.splitTextIntoSpans;exports.useAdaptiveStyles=e.useAdaptiveStyles;exports.useCart=e.useCart;exports.useGeneralInfo=e.useGeneralInfo;exports.useReCaptcha=e.useReCaptcha;exports.App=j2;exports.Checkout=Eo;exports.ColorVariables=ho;exports.hotReload=Nn;exports.iconNames=To;exports.removeNotification=x2;exports.showNotification=h2;exports.useBalance=g2;exports.useBuilderPages=Ln;exports.useCreateTicket=Tn;
|
package/dist/builder.es.js
CHANGED
|
@@ -7703,7 +7703,7 @@ const su = "data:image/svg+xml,%3csvg%20width='204'%20height='241'%20viewBox='0%
|
|
|
7703
7703
|
title: Ru
|
|
7704
7704
|
}, et = () => {
|
|
7705
7705
|
const t = re(), n = us();
|
|
7706
|
-
return console.error("ROUTE ERROR: ", n), /* @__PURE__ */ e.jsx("div", { className: Fo.wrapper, children: /* @__PURE__ */ e.jsxs("div", { className: Fo.content, children: [
|
|
7706
|
+
return console.error("ROUTE ERROR: ", n), alert(n), /* @__PURE__ */ e.jsx("div", { className: Fo.wrapper, children: /* @__PURE__ */ e.jsxs("div", { className: Fo.content, children: [
|
|
7707
7707
|
/* @__PURE__ */ e.jsx("h1", { className: Fo.title, children: "Something Went Wrong" }),
|
|
7708
7708
|
/* @__PURE__ */ e.jsx(
|
|
7709
7709
|
U,
|