@billgangcom/theme-lib 1.97.5 → 1.98.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builder.cjs.js +1 -1
- package/dist/builder.es.js +9 -8
- package/dist/lib/createTicket.d.ts +1 -1
- package/package.json +1 -1
package/dist/builder.cjs.js
CHANGED
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
`,o+=` --border-sm: var(--scale-1);
|
|
99
99
|
`,o+=` --border-md: var(--scale-2);
|
|
100
100
|
`,o+=` --border-lg: var(--scale-4);
|
|
101
|
-
`,o+="}",o},Ti=e=>{const n=document.getElementById("dynamic-styles");if(n)n.innerHTML=e;else{const o=document.createElement("style");o.id="dynamic-styles",o.innerHTML=e,document.head.appendChild(o)}},Tn=new Set,Pi=e=>{const n=new Map;return Object.entries(e).forEach(([o,r])=>{typeof r=="object"&&Object.entries(r).forEach(([i,s])=>{var a,l;if(s&&s.font){const c=s.font.replace(/\s+/g,"+");n.has(c)||n.set(c,new Set),(a=n.get(c))==null||a.add(s.weight),(l=n.get(c))==null||l.add(s.boldWeight)}})}),n},Li=e=>{const n=new Map;return Object.entries(e).forEach(([o,r])=>{typeof r=="object"&&Object.keys(r).forEach(i=>{var s;if(i==="font"&&r[i]){const a=r[i].replace(/\s+/g,"+");n.has(a)||n.set(a,new Set),(s=n.get(a))==null||s.add("400")}})}),n},Ai=e=>{Tn.forEach(n=>{if(!e.has(n)){const o=document.querySelector(`link[data-font="${n}"]`);o&&o.remove(),Tn.delete(n)}})},Bi=e=>{const n=new Set;e.forEach((o,r)=>{const i=Array.from(o).join(";"),s=`${r}:wght@${i}`;if(n.add(s),!Tn.has(s)){const a=document.createElement("link");a.rel="stylesheet",a.href=`https://fonts.googleapis.com/css2?family=${s}&display=swap`,a.setAttribute("data-font",s),document.head.appendChild(a),Tn.add(s)}}),Ai(n)},Mi=e=>{if(e.fonts){const n=Pi(e.fonts.desktop),o=Li(e.buttons),r=new Map(n);o.forEach((i,s)=>{if(r.has(s)){const a=r.get(s);i.forEach(l=>a==null?void 0:a.add(l))}else r.set(s,new Set(i))}),Bi(r)}};function Fi(){if(window.location.pathname.includes("/admin/builder"))try{const{editBlock:e,currentBlock:n,blocks:o,setHeader:r,setFooter:i,setAnnouncement:s}=t.useLayersStore.getState(),{currentPage:a,pages:l}=t.usePagesStore.getState(),{currentInstance:c,settingsInstance:p}=t.useBlocksStore.getState(),{setSettings:u}=t.useSettingsStore.getState();if(n||u(p.blockSettings),c&&n){if(n==="header")r(c);else if(n==="footer")i(c);else if(n==="announcement")s(c);else if(n==="header"||n==="footer"||n==="announcement")throw new Error(`Missing ${n} data.`)}if(c&&l&&n&&!["header","footer","announcement"].includes(n)){const d={blockSettings:{}};if(!c.blockSettings)throw new Error("currentInstance.blockSettings is undefined.");if(Object.keys(c.blockSettings).filter(h=>!["displayName","isAddable"].includes(h)).forEach(h=>{d.blockSettings[h]=c.blockSettings[h]}),!l[a])throw new Error(`Page "${a}" does not exist.`);if(!o[l[a].path].data||!o[l[a].path].data[n])throw new Error(`Layer or block for page "${l[a].path}" and block "${n}" does not exist.`);e(l[a].path,n,{name:o[l[a].path].data[n].name,value:d})}}catch(e){console.error("Error in hotReload function:",e)}}const Di=()=>{const e=t.useApiStore.getState().apiUrls,n=t.useNavigate(),{notifications:o,setNotifications:r}=t.useNotificationStore(),{isAntistock:i}=t.useGeneralStore();return async(s,a,l,c)=>{const p=t.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${e.slApi}/v1/public/${p}/tickets`;try{const d=await t.request({method:"post",url:u,body:{title:s,firstMessage:a,email:c,recaptcha:l,tsId:t.getTsId()},withToken:!1});return r([...o,{id:t.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/${d.data.id}/${d.data.accessToken}`),d}catch(d){r([...o,{id:t.v4(),message:`Error: ${d}. Please try again later.`,status:"error"}])}}},$i=()=>{const{pages:e}=t.usePagesStore(),[n,o]=C.useState(e);return C.useEffect(()=>{o(e)},[e]),n},Oi="_tooltip_4hruj_1",Hi={tooltip:Oi},Mt=e=>{const{text:n}=e,{setShowTooltip:o}=t.useTooltipStore();return C.useEffect(()=>(o(!0),()=>{o(!1)}),[]),t.jsxRuntimeExports.jsx("div",{className:Hi.tooltip,children:n})},zi=()=>{const{undo:e,redo:n,past:o,future:r}=t.useHistoryStore(),[i,s]=C.useState(!1),[a,l]=C.useState(!1),[c,p]=C.useState(!1),[u,d]=C.useState(!1),[h,m]=C.useState(null),{notifications:g,setNotifications:x}=t.useNotificationStore();return C.useEffect(()=>{s(o.length===0)},[o]),C.useEffect(()=>{l(r.length===0)},[r]),t.jsxRuntimeExports.jsxs("div",{className:Ut.buttons,children:[t.jsxRuntimeExports.jsxs("div",{className:t.clx(Ut.button,{[Ut.disabled]:i}),onMouseEnter:()=>{const y=setTimeout(()=>{d(!0),p(!1)},200);m(y)},onMouseLeave:()=>{h&&clearTimeout(h),d(!1),p(!1)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"ArrowUUpLeft",width:20,height:20,onClick:()=>{i||(e(),x([...g,{id:t.v4(),message:"Changes undone",status:"success"}]))},fill:i?"#757575":"#252525"}),u&&t.jsxRuntimeExports.jsx(Mt,{text:i?"Nothing to undo":"Click to undo changes"})]}),t.jsxRuntimeExports.jsxs("div",{className:t.clx(Ut.button,{[Ut.disabled]:a}),onMouseEnter:()=>{const y=setTimeout(()=>{p(!0),d(!1)},200);m(y)},onMouseLeave:()=>{h&&clearTimeout(h),p(!1),d(!1)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"ArrowUUpRight",width:20,height:20,onClick:()=>{a||(n(),x([...g,{id:t.v4(),message:"Changes redone",status:"success"}]))},fill:a?"#757575":"#252525"}),c&&t.jsxRuntimeExports.jsx(Mt,{text:a?"Nothing to redo":"Click to redo changes"})]})]})},Ui="_devices_ls6k9_1",Wi="_device_ls6k9_1",Vi="_active_ls6k9_27",mo={devices:Ui,device:Wi,active:Vi},Gi=()=>t.jsxRuntimeExports.jsx("div",{className:mo.devices,children:$s.map(e=>t.jsxRuntimeExports.jsx(qi,{device:e}))}),qi=e=>{const{device:n}=e,{currentDevice:o,setCurrentDevice:r}=t.useDeviceStore(),[i,s]=C.useState(!1),[a,l]=C.useState(null);return t.jsxRuntimeExports.jsxs("div",{className:t.clx(mo.device,{[mo.active]:o.value===n.value}),onClick:()=>r(n),onMouseEnter:()=>{const c=setTimeout(()=>{s(!0)},200);l(c)},onMouseLeave:()=>{a&&clearTimeout(a),s(!1)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:n.icon,fill:o.value===n.value?"#252525":"#757575",width:20,height:20}),i&&t.jsxRuntimeExports.jsx(Mt,{text:`Switch to ${n.value} view`})]},n.value)},Zi="_preview_1x3m8_2",Xi="_active_1x3m8_19",Hn={preview:Zi,active:Xi},Yi=()=>{const{onPreview:e}=t.usePreviewStore(),[n,o]=C.useState(!1),[r,i]=C.useState(null);return t.jsxRuntimeExports.jsxs("a",{href:"/",className:t.clx(Hn.preview,{[Hn.active]:e}),target:"_blank",onMouseEnter:()=>{const s=setTimeout(()=>{o(!0)},200);i(s)},onMouseLeave:()=>{r&&clearTimeout(r),o(!1)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"ArrowUpRight",width:20,height:20}),t.jsxRuntimeExports.jsx("span",{className:Hn.text,children:"Preview"}),n&&t.jsxRuntimeExports.jsx(Mt,{text:"Open draft theme in new tab"})]})},Ki="_settings_u4cv4_1",Ji={settings:Ki},Qi="_pages_167qp_1",ea="_text_167qp_21",ta="_modal_167qp_27",na="_open_167qp_46",oa="_page_167qp_1",ra="_hoverable_167qp_61",sa="_separator_167qp_65",ia="_button_167qp_70",aa="_items_167qp_85",Oe={pages:Qi,default:"_default_167qp_5",text:ea,modal:ta,open:na,page:oa,hoverable:ra,separator:sa,button:ia,items:aa},Wr=async e=>{const n=localStorage.getItem("shopId")||void 0,o=localStorage.getItem("draftId"),i=`${t.useApiStore.getState().apiUrls.api}/v2/builder/shops/${n}/drafts/${o}/pages/${encodeURIComponent(e)}`;return await t.request({url:i,withToken:!0,method:"delete"})},la=()=>{const{currentPage:e,setCurrentPage:n,setIsOpenModal:o,pages:r,setIsEdit:i,setEditedPage:s,deletePage:a,setIsOpenSelectModal:l}=t.usePagesStore(),{deletePage:c,setCurrentBlock:p}=t.useLayersStore(),[u,d]=C.useState(null),{setTitle:h,setDescription:m,setOnConfirm:g}=t.useConfirmationModalStore(),[x,y]=C.useState(!1),f=C.useRef(null);t.useOnClickOutside(f,()=>{x&&y(!1)}),C.useEffect(()=>{x?l(!0):setTimeout(()=>{l(!1)},300)},[x]);const _=S=>S?S.replace(/_/g," ").split(" ").map(E=>E.charAt(0).toUpperCase()+E.slice(1)).join(" "):"";return t.jsxRuntimeExports.jsxs("div",{className:Oe.pages,ref:f,children:[t.jsxRuntimeExports.jsxs("div",{className:Oe.default,onClick:S=>{S.stopPropagation(),y(E=>!E)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:r&&r[e]&&r[e].icon||"File",fill:"#252525",width:20,height:20}),t.jsxRuntimeExports.jsx("span",{className:Oe.text,children:r&&r[e]&&t.defaultPagePaths.includes(r[e].path)?`${_(r[e].name)} page`:r&&r[e]&&r[e].name}),t.jsxRuntimeExports.jsx("div",{style:{transform:x?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.3s ease",display:"flex"},children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown",width:20,height:20})})]}),t.jsxRuntimeExports.jsxs("div",{className:t.clx(Oe.modal,{[Oe.open]:x}),onClick:S=>S.stopPropagation(),children:[r&&t.jsxRuntimeExports.jsx("div",{className:Oe.items,children:Object.keys(r).map(S=>{const E=r[S];return t.jsxRuntimeExports.jsxs("div",{className:t.clx(Oe.page,{[Oe.hoverable]:u===S}),onMouseEnter:()=>d(S),onMouseLeave:()=>d(null),onClick:()=>{d(null),i(!1),p(null),n(S),y(!1)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:E.icon,fill:"#252525"}),t.jsxRuntimeExports.jsx("span",{className:Oe.text,children:t.defaultPagePaths.includes(E.path)?`${_(E.name)} page`:E.name}),u===S&&t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Gear",fill:"#757575",onClick:b=>{b.stopPropagation(),i(!0),s(S),o(!0)}}),!t.defaultPagePaths.includes(E.path)&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",fill:"#C12A2A",onClick:b=>{b.stopPropagation(),h("Delete Page"),m(`Are you sure you want to delete ${E.name||"this"} page? Once you delete this page, any content visible will also be deleted. This is irreversible.`),g(()=>{b.stopPropagation(),r[e].path===E.path&&n(Object.keys(r)[0]),a(S),c(E.name),Wr(E.path)})}})]}),r[e]&&r[e].name===E.name&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Check",fill:"#FF3F19"})]},S)})}),t.jsxRuntimeExports.jsx("div",{className:Oe.separator}),t.jsxRuntimeExports.jsxs(t.Button,{className:Oe.button,onClick:S=>{S.stopPropagation(),o(!0)},size:"l",children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",fill:"#ff3f19"}),t.jsxRuntimeExports.jsx("span",{children:"Create New Page"})]})]})]})},ca="_zoom_fu0hj_1",zo={zoom:ca},ua=()=>{const{zoomLevel:e,setZoomLevel:n}=t.usePreviewStore();return t.jsxRuntimeExports.jsxs("label",{htmlFor:"zoom",className:zo.zoom,children:[t.jsxRuntimeExports.jsx("label",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center"},htmlFor:"zoom",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"MagnifyingGlassMinus",width:20,height:20})}),t.jsxRuntimeExports.jsx("input",{id:"zoom",type:"number",min:25,max:250,value:(e*100).toFixed(0),onChange:o=>{const r=Number(o.target.value);n(r/100)},className:zo.input}),t.jsxRuntimeExports.jsx("span",{children:"%"})]})},pa=()=>t.jsxRuntimeExports.jsxs("div",{className:Ji.settings,children:[t.jsxRuntimeExports.jsx(la,{}),t.jsxRuntimeExports.jsx(ua,{})]}),da="_theme_1e5wq_1",ma="_text_1e5wq_13",Uo={theme:da,text:ma},ha=()=>t.jsxRuntimeExports.jsx("div",{className:Uo.theme,children:t.jsxRuntimeExports.jsx("div",{className:Uo.text,children:"Live Theme"})}),xa=async(e,n,o)=>{const r=localStorage.getItem("shopId")||void 0,i=localStorage.getItem("draftId"),a=`${t.useApiStore.getState().apiUrls.api}/v2/builder/shops/${r}/drafts/${i}/${n}`;return await t.request({url:a,withToken:!0,method:e,body:o})};function Wt(e,n){try{return n.map(r=>{if(!r.value||!r.value.blockSettings){console.error("block.value or block.value.blockSettings is undefined.");return}return Object.values(r.value.blockSettings).filter(s=>s&&s.type===e).map(s=>{if(s.value===void 0)throw new Error("item.value is undefined.");return s.value}).flat()}).flat().filter(r=>r).map(r=>e==="ListingIds"?r.listingId:r)}catch(o){return console.error("Error in getValues function:",o),[]}}function ga(e,n,o){return fa(e,n)?(o.reviews||[]).length*3:0}function fa(e,n){return n.map(r=>{if(!r.value||!r.value.blockSettings){console.error("block.value or block.value.blockSettings is undefined.");return}return Object.values(r.value.blockSettings).filter(s=>s&&s.type===e).map(s=>{if(s.value===void 0)throw new Error("item.value is undefined.");return s.value}).flat()}).flat().filter(r=>r).length>0}function Ia(e,n){if(n){const o=Object.keys(n).find(r=>n[r].path===e);if(o)return n[o]}return null}const ja=({setIsLoading:e,isLoading:n})=>{const{themeSettings:o}=t.useThemeSettingsStore(),{settings:r}=t.useSettingsStore(),[i,s]=C.useState(null),[a,l]=C.useState(!1),{setNotifications:c,notifications:p}=t.useNotificationStore(),{header:u,footer:d,announcement:h,blocks:m}=t.useLayersStore(),{pageContext:g}=t.usePagesStore(),{pages:x}=t.usePagesStore(),y=async()=>{if(a)i&&clearTimeout(i);else{e(!0);const _=Object.keys(m).map(b=>{const k=Ia(b,x);return m[b]&&m[b].data&&(k!=null&&k.path)?{id:k?k.id:b,name:k?k.name:b,path:k.path,layout:{...m[b]},neededProductIds:[...Wt("ProductId",Object.values(m[b].data))],neededCategoryIds:[...Wt("CategoryId",Object.values(m[b].data))],neededAnnouncementIds:[...Wt("AnnouncementId",Object.values(m[b].data))],neededListingIds:[...Wt("ListingIds",Object.values(m[b].data))],neededFaqIds:[...Wt("FaqsIds",Object.values(m[b].data))],neededReviewCount:ga("ReviewCount",Object.values(m[b].data),g),seo:{pageTitle:k&&k.seo&&k.seo.pageTitle?k.seo.pageTitle:"",pageDescription:k&&k.seo&&k.seo.pageDescription?k.seo.pageDescription:""},isPrivate:!!(k&&k.visibility==="private")}:null}).filter(b=>b),S={settings:{...r},header:u,footer:d,announcement:h},{status:E}=await xa("post","save",{themeSettings:o,settings:S,updatedPages:_});c([...p,{id:t.v4(),message:E===200?"Settings saved":"Error",status:E===200?"success":"error"}]),e(!1)}l(!0);const f=setTimeout(()=>{l(!1)},2e3);s(f)};return t.jsxRuntimeExports.jsx(t.Button,{onClick:y,disabled:n,children:t.jsxRuntimeExports.jsx("span",{style:{userSelect:"none"},children:"Save"})})},Sa=()=>{const{isOpenSelectModal:e}=t.usePagesStore(),[n,o]=C.useState(!1),{showTooltip:r}=t.useTooltipStore();return t.jsxRuntimeExports.jsxs("div",{className:dn.header,style:{zIndex:e?5e4:r?501:50},children:[t.jsxRuntimeExports.jsxs("div",{className:dn.left,children:[t.jsxRuntimeExports.jsx(Gi,{}),t.jsxRuntimeExports.jsx(Yi,{})]}),t.jsxRuntimeExports.jsx("div",{className:dn.center,children:t.jsxRuntimeExports.jsx(pa,{})}),t.jsxRuntimeExports.jsxs("div",{className:dn.right,children:[t.jsxRuntimeExports.jsx(ha,{}),t.jsxRuntimeExports.jsx(zi,{}),t.jsxRuntimeExports.jsx(ja,{setIsLoading:o,isLoading:n}),n&&t.jsxRuntimeExports.jsx(mt,{})]})]})},ya="_exit_ovvox_1",Ca="_text_ovvox_11",ka="_exitLink_ovvox_16",zn={exit:ya,text:Ca,exitLink:ka},ba=()=>t.jsxRuntimeExports.jsx("div",{className:zn.exit,children:t.jsxRuntimeExports.jsxs("a",{href:"https://dash.billgang.com/",className:zn.exitLink,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"SignOut",width:20,height:20}),t.jsxRuntimeExports.jsx("span",{className:zn.text,children:"Exit"})]})}),_a="_navbar_1podc_1",wa="_main_1podc_6",Ea="_block_1podc_13",va="_active_1podc_29",hn={navbar:_a,main:wa,block:Ea,active:va},Ra=()=>{const{activeBlock:e}=t.useNavbarStore(),{setActiveBlock:n}=t.useBlocksStore(),{setCurrentBlock:o}=t.useLayersStore(),{setActiveBlock:r}=t.useThemeSettingsStore(),{setActiveBlock:i}=t.usePreviewStore(),s=t.useNavigate();function a(l){switch(n(null),o(null),r(null),i({id:null,neededScroll:!1}),l.name){case"Layers":s("/admin/builder");break;case"Add":s("/admin/builder/add");break;case"Theme":s("/admin/builder/theme");break;case"Settings":s("/admin/builder/settings");break}}return t.jsxRuntimeExports.jsxs("div",{className:hn.navbar,children:[t.jsxRuntimeExports.jsx(ba,{}),t.jsxRuntimeExports.jsx("div",{className:hn.main,children:t.navbarBlocks.map(l=>t.jsxRuntimeExports.jsxs("div",{className:t.clx(hn.block,{[hn.active]:e.icon===l.icon}),onClick:()=>a(l),children:[t.jsxRuntimeExports.jsx(t.Icon,{name:l.icon,fill:e.icon===l.icon?"#252525":"#757575"}),t.jsxRuntimeExports.jsx("span",{children:l.name})]},l.icon))})]})},Na="_preview_gb2ye_1",Ta="_main_gb2ye_15",Pa="_content_gb2ye_25",La="_loading_gb2ye_34",Aa="_previewLoading_gb2ye_65",Vt={preview:Na,main:Ta,content:Pa,loading:La,previewLoading:Aa},Ba="_header_11zku_2",Ma="_circles_11zku_16",Fa="_circle_11zku_16",Da="_red_11zku_32",$a="_green_11zku_36",Oa="_yellow_11zku_40",Ha="_input_11zku_44",za="_main_11zku_55",Ua="_text_11zku_63",Wa="_copy_11zku_75",qe={header:Ba,circles:Ma,circle:Fa,red:Da,green:$a,yellow:Oa,input:Ha,main:za,text:Ua,copy:Wa},Va=["red","yellow","green"],Ga=()=>{const{currentDevice:e}=t.useDeviceStore(),n=(i,s)=>i.length>s?i.slice(0,s)+"...":i,{notifications:o,setNotifications:r}=t.useNotificationStore();return t.jsxRuntimeExports.jsxs("div",{className:qe.header,children:[t.jsxRuntimeExports.jsx("div",{className:qe.circles,children:Va.map(i=>t.jsxRuntimeExports.jsx("div",{className:t.clx(qe.circle,{[qe.red]:i==="red",[qe.yellow]:i==="yellow",[qe.green]:i==="green"})},i))}),t.jsxRuntimeExports.jsx("div",{className:qe.input,children:t.jsxRuntimeExports.jsxs("div",{className:qe.main,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Lock",fill:"#757575",width:15,height:16}),t.jsxRuntimeExports.jsx("span",{className:qe.text,children:e.value==="mobile"?n(window.location.origin,35):e.value==="desktop"?n(window.location.origin,200):n(window.location.origin,100)})]})}),t.jsxRuntimeExports.jsx(t.Button,{type:"Secondary",style:{padding:"8px"},onClick:()=>{navigator.clipboard.writeText(window.location.origin),r([...o,{id:t.v4(),status:"success",message:"Domain copied to clipboard"}])},className:qe.copy,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Copy",width:20,height:20,fill:"#252525"})})]})},Qe=e=>e?e.replace(/_/g," ").split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" and "):"",Vr=(e,n,o,r,i,s,a)=>{const l=e.currentTarget.getBoundingClientRect(),c=window.innerHeight-l.bottom,p=l.top,u=window.innerWidth-l.right,d=l.left;let h,m;return h=l.bottom+r+window.scrollY,m=l.left,(c<n||c<i)&&(p>=n+a?h=l.top-n-r+window.scrollY:h=window.scrollY+a),h-window.scrollY<a&&(h=window.scrollY+a),(u<o||u<s)&&(d>=o?m=l.right-o:m=(window.innerWidth-o)/2),m<l.right+s&&(m=l.right+s),m<l.right&&m+o>l.left&&h<l.bottom&&h+n>l.top&&(u>=o+s?m=l.right+r+s:c>=n?h=l.bottom+r+window.scrollY:(h=window.scrollY+a,m=(window.innerWidth-o)/2)),{top:h,left:m}},qa="_results_1pahy_1",Wo={results:qa};function Za(e,n){return n?new n[e]().blockSettings.isAddable:!1}function Vo(e,n){return e?Object.keys(e||{}).reduce((o,r)=>(Za(r,n)&&o.push({name:r,displayName:t.getDisplayName(r,n)}),o),[]):[]}const Xa="_product_yggw5_1",Ya="_name_yggw5_15",Go={product:Xa,name:Ya},Ka=e=>{const{blockId:n,setSearchValue:o}=e,{sourceBlocks:r,setActiveBlock:i}=t.useBlocksStore(),{hideModal:s,hoverBlockId:a,isModalVisible:l,showPreview:c,hidePreview:p,clearHideTimeout:u,startHideTimeout:d,setHoverBlockTopPosition:h}=t.useSubmodalStore();function m(y){o(""),i(y),s("keyBlock")}function g(y,f){const _=window.innerHeight,S=400,E=10;let b=f.clientY-120;b+S>_&&(b=_-S-E),b<E&&(b=E),a||s("keyBlock"),c(y,"keyBlock"),u(),h(b)}function x(){l?d("keyBlock"):p("keyBlock"),h(null)}return t.jsxRuntimeExports.jsxs("div",{className:Go.product,onClick:()=>m(n),onMouseEnter:y=>g(n,y),onMouseLeave:x,children:[tn[n]?t.jsxRuntimeExports.jsx("img",{src:tn[n]}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Cards"}),t.jsxRuntimeExports.jsx("span",{className:Go.name,children:t.getDisplayName(n,r)}),t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretRight",width:20,height:20})]},n)},Gr=()=>{const{blocks:e,sourceBlocks:n}=t.useBlocksStore(),[o,r]=C.useState(""),[i,s]=C.useState([]),a=C.useMemo(()=>Vo(e,n),[e,n]),l=C.useMemo(()=>new t.Fuse(a,{keys:["displayName"],threshold:.4}),[a]);return C.useEffect(()=>{if(o.trim()==="")s(Vo(e,n));else{const c=l.search(o);s(c.map(p=>p.item))}},[o,l]),t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(t.Input,{type:"text",placeholder:"Search for sections",isSearch:!0,onChange:r,value:o,style:{marginBottom:10}}),t.jsxRuntimeExports.jsx("div",{className:Wo.results,children:i.length>0?i.map(c=>t.jsxRuntimeExports.jsx(Ka,{blockId:c.name,setSearchValue:r})):t.jsxRuntimeExports.jsx("div",{className:Wo.noResults,children:"No sections found"})})]})},Ja="_wrapper_1k1cr_1",Qa="_submodal_1k1cr_14",ho={wrapper:Ja,submodal:Qa},el=({children:e,positionTop:n,positionLeft:o})=>{const{keyBlock:r,startHideTimeout:i,clearHideTimeout:s,setMouseOverModal:a}=t.useSubmodalStore();return r?t.jsxRuntimeExports.jsx("div",{className:ho.wrapper,style:n?{top:n,left:o||void 0}:{},onMouseEnter:()=>{s(),a(!0)},onMouseLeave:()=>{a(!1),i()},children:e}):null},tl=({children:e})=>{const{hoverBlockId:n,startHideTimeout:o,clearHideTimeout:r,setMouseOverModal:i}=t.useSubmodalStore();return n?t.jsxRuntimeExports.jsx("div",{className:t.clx(ho.wrapper,ho.submodal),onMouseEnter:()=>{r(),i(!0)},onMouseLeave:()=>{i(!1),o()},children:e}):null},nl="_applyButton_1a9kh_2",ol="_content_1a9kh_7",rl="_title_1a9kh_14",sl="_label_1a9kh_21",il="_colorValue_1a9kh_40",al="_colorMap_1a9kh_48",ll="_indicator_1a9kh_57",cl="_hueSlider_1a9kh_66",ul="_slider_1a9kh_97",pl="_buttons_1a9kh_102",dl="_name_1a9kh_109",ml="_secondary_1a9kh_114",hl="_input_1a9kh_122",xl="_modal_1a9kh_160",gl="_alphaSlider_1a9kh_249",fl="_alphaBackground_1a9kh_257",Il="_alphaGradient_1a9kh_268",jl="_chargeTypes_1a9kh_297",Sl="_charge_1a9kh_297",yl="_chargeActive_1a9kh_326",Cl="_gradient_1a9kh_334",kl="_color_1a9kh_40",bl="_colorActive_1a9kh_355",_l="_gradientWrapper_1a9kh_362",wl="_subtitle_1a9kh_368",El="_colorTypes_1a9kh_375",vl="_colorType_1a9kh_375",Rl="_colorTypeActive_1a9kh_399",Nl="_colorsWrapper_1a9kh_404",Tl="_colors_1a9kh_404",K={applyButton:nl,content:ol,title:rl,label:sl,colorValue:il,colorMap:al,indicator:ll,hueSlider:cl,slider:ul,buttons:pl,name:dl,secondary:ml,input:hl,modal:xl,alphaSlider:gl,alphaBackground:fl,alphaGradient:Il,chargeTypes:jl,charge:Sl,chargeActive:yl,gradient:Cl,color:kl,colorActive:bl,gradientWrapper:_l,subtitle:wl,colorTypes:El,colorType:vl,colorTypeActive:Rl,colorsWrapper:Nl,colors:Tl};function Un(e){return(e.includes("linear-gradient")||e.includes("radial-gradient"))&&/^linear-gradient\(\d+deg,\s*#[A-Fa-f0-9]{8}\s+\d+%,\s*#[A-Fa-f0-9]{8}\s+\d+%\)$/.test(e)?!0:/^#([A-Fa-f0-9]{3}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$/.test(e)}const Fe=e=>{const{initialColor:n,onChange:o,title:r,labelStyle:i="primary",isGradientActive:s=!0,isBlockSettings:a}=e,[l,c]=C.useState(n);C.useEffect(()=>{c(n)},[n]);const{setActiveLabel:p,setModalPosition:u,setInitialColor:d,setShowModal:h,setUpdate:m,setColor:g,setColorChange:x,setIsGradientActive:y,colorChange:f}=t.useColorPickerStore();C.useEffect(()=>{const b=()=>{h(!1),p(null),d(n),m(()=>{}),g(n),x(()=>{})};return document.body.addEventListener("click",b),()=>{document.body.removeEventListener("click",b)}},[n]);const _=b=>{b.stopPropagation(),h(!0),x(c),m(o),d(n),g(l),y(s);const{top:k,left:L}=Vr(b,600,288,10,20,230,80);u({top:k,left:L})},S=b=>{const k=b.target.value;c(k),Un(k)&&(o(k),g(k),x(f))},E=()=>{Un(l)||c(n)};return t.jsxRuntimeExports.jsxs("div",{className:K.content,children:[t.jsxRuntimeExports.jsx("span",{className:t.clx(K.name,{[K.secondary]:i==="secondary"}),children:r}),t.jsxRuntimeExports.jsxs("label",{className:K.label,onClick:b=>b.stopPropagation(),children:[t.jsxRuntimeExports.jsx("div",{className:K.colorValue,style:{background:Un(l)?l:n},onClick:a?void 0:_}),t.jsxRuntimeExports.jsx("input",{type:"text",value:l.includes("linear-gradient")?l:l.toUpperCase(),onChange:S,onBlur:E,className:K.input,style:{textTransform:l.includes("linear-gradient")?"none":"uppercase"}})]})]})},Pl=()=>{const{modalPosition:e,color:n,initialColor:o,setShowModal:r,hue:i,saturation:s,brightness:a,alpha:l,dragging:c,setDragging:p,setHue:u,setSaturation:d,setBrightness:h,setAlpha:m,colorChange:g,setColor:x,update:y,isGradient:f,setIsGradient:_,gradientDirection:S,setGradientDirection:E,hue2:b,saturation2:k,brightness2:L,alpha2:$,setHue2:H,setSaturation2:O,setBrightness2:N,setAlpha2:v,activeColorIndex:P,setActiveColorIndex:B,isGradientActive:M,isBlockSettings:U}=t.useColorPickerStore(),A=(G,V,se)=>{V/=100,se/=100;const Z=pe=>(pe+G/60)%6,ne=pe=>se*(1-V*Math.max(0,Math.min(Z(pe),4-Z(pe),1))),Y=Math.round(255*ne(5)),ie=Math.round(255*ne(3)),oe=Math.round(255*ne(1));return{r:Y,g:ie,b:oe}},D=G=>G.toString(16).padStart(2,"0"),Q=(G,V,se,Z)=>{const{r:ne,g:Y,b:ie}=A(G,V,se),oe=Math.round(Z/100*255);return`#${D(ne)}${D(Y)}${D(ie)}${D(oe)}`},I=(G,V,se,Z)=>{if(f)if(P===1){u(G),d(V),h(se),m(Z);const ne=Q(G,V,se,Z),Y=Q(b,k,L,$),oe=`linear-gradient(${S==="vertical"?"0deg":"90deg"}, ${ne} 0%, ${Y} 100%)`;g(oe),x(oe)}else{H(G),O(V),N(se),v(Z);const ne=Q(G,V,se,Z),Y=Q(i,s,a,l),oe=`linear-gradient(${S==="vertical"?"0deg":"90deg"}, ${Y} 0%, ${ne} 100%)`;g(oe),x(oe)}else{const ne=Q(G,V,se,Z);g(ne),x(ne)}},J=(G,V,se)=>{const{width:Z,height:ne}=se.getBoundingClientRect(),Y=Math.max(0,Math.min(G/Z*100,100)),ie=Math.max(0,Math.min(100-V/ne*100,100));f?P===1?(d(Y),h(ie),I(i,Y,ie,l)):(O(Y),N(ie),I(b,Y,ie,$)):(d(Y),h(ie),I(i,Y,ie,l))},ge=G=>{const{offsetX:V,offsetY:se}=G.nativeEvent;p(!0),J(V,se,G.currentTarget)},j=G=>{if(c){const V=document.querySelector(`.${K.colorMap}`),{left:se,top:Z}=V.getBoundingClientRect(),ne=G.clientX-se,Y=G.clientY-Z;J(ne,Y,V)}},ee=()=>{p(!1)};C.useEffect(()=>{function G(Z){const ne=/linear-gradient\((\d+deg),\s*(#[0-9a-fA-F]{8})\s*0%,\s*(#[0-9a-fA-F]{8})\s*100%\)/,Y=Z.match(ne);if(Y){const ie=Y[1],oe=Y[2],pe=Y[3];return{angle:ie,col1:oe,col2:pe}}return null}function V(Z){const ne=parseInt(Z.slice(1,3),16),Y=parseInt(Z.slice(3,5),16),ie=parseInt(Z.slice(5,7),16),oe=parseInt(Z.slice(7,9),16)/255*100,{h:pe,s:w,b:T}=se(ne,Y,ie);return{h:pe,s:w,b:T,a:oe}}function se(Z,ne,Y){Z/=255,ne/=255,Y/=255;const ie=Math.max(Z,ne,Y),oe=Math.min(Z,ne,Y);let pe=0;const w=ie-oe,T=(ie===0?0:w/ie)*100,W=ie*100;if(ie===oe)pe=0;else switch(ie){case Z:pe=((ne-Y)/w+(ne<Y?6:0))*60;break;case ne:pe=((Y-Z)/w+2)*60;break;case Y:pe=((Z-ne)/w+4)*60;break}return{h:pe,s:T,b:W}}if(o&&o.startsWith("linear-gradient")){const Z=G(o);if(Z){const{angle:ne,col1:Y,col2:ie}=Z,oe=V(Y),pe=V(ie);_(!0),E(ne==="0deg"?"vertical":"horizontal"),u(oe.h),d(oe.s),h(oe.b),m(oe.a),H(pe.h),O(pe.s),N(pe.b),v(pe.a),B(1)}}else if(o){const ne=function(ie){let oe=ie;return oe.length===7?oe+"ff":oe.length===9?oe:oe.length===4?oe[0]+oe[1].repeat(2)+oe[2].repeat(2)+oe[3].repeat(2)+"ff":"#000000ff"}(o),Y=V(ne);_(!1),u(Y.h),d(Y.s),h(Y.b),m(Y.a)}},[o,_,E,u,d,h,m,H,O,N,v,B]),C.useEffect(()=>{let G,V,se,Z;f?P===1?(G=i,V=s,se=a,Z=l):(G=b,V=k,se=L,Z=$):(G=i,V=s,se=a,Z=l),I(G,V,se,Z)},[f,S,P,i,s,a,l,b,k,L,$]),C.useEffect(()=>{const G=se=>j(se),V=()=>ee();return c?(document.addEventListener("mousemove",G),document.addEventListener("mouseup",V)):(document.removeEventListener("mousemove",G),document.removeEventListener("mouseup",V)),()=>{document.removeEventListener("mousemove",G),document.removeEventListener("mouseup",V)}},[c,f,S]);function he(){if(!f)y(n);else{const G=Q(i,s,a,l),V=Q(b,k,L,$),Z=`linear-gradient(${S==="vertical"?"0deg":"90deg"}, ${G} 0%, ${V} 100%)`;y(Z)}r(!1)}function q(){r(!1),g(o)}const je=f?P===1?i:b:i,De=f?P===1?s:k:s,tt=f?P===1?a:L:a,at=f?P===1?l:$:l,{r:xt,g:un,b:pn}=A(je,De,tt),Fn=`linear-gradient(to right, rgba(${xt}, ${un}, ${pn}, 0), rgba(${xt}, ${un}, ${pn}, 1))`,$t=Q(i,s,a,l),Ot=Q(b,k,L,$);return t.jsxRuntimeExports.jsxs("div",{className:K.modal,onClick:G=>G.stopPropagation(),style:{top:`${e.top}px`,left:`${e.left}px`},children:[t.jsxRuntimeExports.jsx("h2",{className:K.title,children:"Color"}),M&&t.jsxRuntimeExports.jsxs("div",{className:K.colorTypes,children:[t.jsxRuntimeExports.jsxs("div",{className:t.clx(K.colorType,{[K.colorTypeActive]:!f}),onClick:()=>_(!1),children:[t.jsxRuntimeExports.jsx("div",{style:{background:"#757575",width:"16px",height:"16px",borderRadius:"50%"}}),"Solid"]}),t.jsxRuntimeExports.jsxs("div",{className:t.clx(K.colorType,{[K.colorTypeActive]:f}),onClick:()=>_(!0),children:[t.jsxRuntimeExports.jsx("div",{style:{background:"linear-gradient(to bottom, #757575 0%, #DBDBDB 100%)",width:"16px",height:"16px",borderRadius:"50%"}}),"Linear"]})]}),f&&M&&t.jsxRuntimeExports.jsxs("div",{className:K.colorsWrapper,children:[t.jsxRuntimeExports.jsx("div",{className:K.colors,style:{background:`linear-gradient(90deg, ${$t} 0%, ${Ot} 100%)`}}),t.jsxRuntimeExports.jsx("div",{className:t.clx(K.color,{[K.colorActive]:P===1}),onClick:()=>B(1),style:{background:$t}}),t.jsxRuntimeExports.jsx("div",{className:t.clx(K.color,{[K.colorActive]:P===2}),onClick:()=>B(2),style:{background:Ot}})]}),t.jsxRuntimeExports.jsx("div",{className:K.colorMap,onMouseDown:ge,style:{background:`
|
|
101
|
+
`,o+="}",o},Ti=e=>{const n=document.getElementById("dynamic-styles");if(n)n.innerHTML=e;else{const o=document.createElement("style");o.id="dynamic-styles",o.innerHTML=e,document.head.appendChild(o)}},Tn=new Set,Pi=e=>{const n=new Map;return Object.entries(e).forEach(([o,r])=>{typeof r=="object"&&Object.entries(r).forEach(([i,s])=>{var a,l;if(s&&s.font){const c=s.font.replace(/\s+/g,"+");n.has(c)||n.set(c,new Set),(a=n.get(c))==null||a.add(s.weight),(l=n.get(c))==null||l.add(s.boldWeight)}})}),n},Li=e=>{const n=new Map;return Object.entries(e).forEach(([o,r])=>{typeof r=="object"&&Object.keys(r).forEach(i=>{var s;if(i==="font"&&r[i]){const a=r[i].replace(/\s+/g,"+");n.has(a)||n.set(a,new Set),(s=n.get(a))==null||s.add("400")}})}),n},Ai=e=>{Tn.forEach(n=>{if(!e.has(n)){const o=document.querySelector(`link[data-font="${n}"]`);o&&o.remove(),Tn.delete(n)}})},Bi=e=>{const n=new Set;e.forEach((o,r)=>{const i=Array.from(o).join(";"),s=`${r}:wght@${i}`;if(n.add(s),!Tn.has(s)){const a=document.createElement("link");a.rel="stylesheet",a.href=`https://fonts.googleapis.com/css2?family=${s}&display=swap`,a.setAttribute("data-font",s),document.head.appendChild(a),Tn.add(s)}}),Ai(n)},Mi=e=>{if(e.fonts){const n=Pi(e.fonts.desktop),o=Li(e.buttons),r=new Map(n);o.forEach((i,s)=>{if(r.has(s)){const a=r.get(s);i.forEach(l=>a==null?void 0:a.add(l))}else r.set(s,new Set(i))}),Bi(r)}};function Fi(){if(window.location.pathname.includes("/admin/builder"))try{const{editBlock:e,currentBlock:n,blocks:o,setHeader:r,setFooter:i,setAnnouncement:s}=t.useLayersStore.getState(),{currentPage:a,pages:l}=t.usePagesStore.getState(),{currentInstance:c,settingsInstance:p}=t.useBlocksStore.getState(),{setSettings:u}=t.useSettingsStore.getState();if(n||u(p.blockSettings),c&&n){if(n==="header")r(c);else if(n==="footer")i(c);else if(n==="announcement")s(c);else if(n==="header"||n==="footer"||n==="announcement")throw new Error(`Missing ${n} data.`)}if(c&&l&&n&&!["header","footer","announcement"].includes(n)){const d={blockSettings:{}};if(!c.blockSettings)throw new Error("currentInstance.blockSettings is undefined.");if(Object.keys(c.blockSettings).filter(h=>!["displayName","isAddable"].includes(h)).forEach(h=>{d.blockSettings[h]=c.blockSettings[h]}),!l[a])throw new Error(`Page "${a}" does not exist.`);if(!o[l[a].path].data||!o[l[a].path].data[n])throw new Error(`Layer or block for page "${l[a].path}" and block "${n}" does not exist.`);e(l[a].path,n,{name:o[l[a].path].data[n].name,value:d})}}catch(e){console.error("Error in hotReload function:",e)}}const Di=()=>{const e=t.useApiStore.getState().apiUrls,n=t.useNavigate(),{notifications:o,setNotifications:r}=t.useNotificationStore(),{isAntistock:i}=t.useGeneralStore();return async(s,a,l,c,p)=>{const u=t.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,d=`${e.slApi}/v1/public/${u}/tickets`;try{const h=await t.request({method:"post",url:d,body:{title:s,firstMessage:a,email:c,recaptcha:l,tsId:t.getTsId(),orderId:p},withToken:!1});return r([...o,{id:t.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/${h.data.id}/${h.data.accessToken}`),h}catch(h){r([...o,{id:t.v4(),message:`Error: ${h}. Please try again later.`,status:"error"}])}}},$i=()=>{const{pages:e}=t.usePagesStore(),[n,o]=C.useState(e);return C.useEffect(()=>{o(e)},[e]),n},Oi="_tooltip_4hruj_1",Hi={tooltip:Oi},Mt=e=>{const{text:n}=e,{setShowTooltip:o}=t.useTooltipStore();return C.useEffect(()=>(o(!0),()=>{o(!1)}),[]),t.jsxRuntimeExports.jsx("div",{className:Hi.tooltip,children:n})},zi=()=>{const{undo:e,redo:n,past:o,future:r}=t.useHistoryStore(),[i,s]=C.useState(!1),[a,l]=C.useState(!1),[c,p]=C.useState(!1),[u,d]=C.useState(!1),[h,m]=C.useState(null),{notifications:g,setNotifications:x}=t.useNotificationStore();return C.useEffect(()=>{s(o.length===0)},[o]),C.useEffect(()=>{l(r.length===0)},[r]),t.jsxRuntimeExports.jsxs("div",{className:Ut.buttons,children:[t.jsxRuntimeExports.jsxs("div",{className:t.clx(Ut.button,{[Ut.disabled]:i}),onMouseEnter:()=>{const y=setTimeout(()=>{d(!0),p(!1)},200);m(y)},onMouseLeave:()=>{h&&clearTimeout(h),d(!1),p(!1)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"ArrowUUpLeft",width:20,height:20,onClick:()=>{i||(e(),x([...g,{id:t.v4(),message:"Changes undone",status:"success"}]))},fill:i?"#757575":"#252525"}),u&&t.jsxRuntimeExports.jsx(Mt,{text:i?"Nothing to undo":"Click to undo changes"})]}),t.jsxRuntimeExports.jsxs("div",{className:t.clx(Ut.button,{[Ut.disabled]:a}),onMouseEnter:()=>{const y=setTimeout(()=>{p(!0),d(!1)},200);m(y)},onMouseLeave:()=>{h&&clearTimeout(h),p(!1),d(!1)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"ArrowUUpRight",width:20,height:20,onClick:()=>{a||(n(),x([...g,{id:t.v4(),message:"Changes redone",status:"success"}]))},fill:a?"#757575":"#252525"}),c&&t.jsxRuntimeExports.jsx(Mt,{text:a?"Nothing to redo":"Click to redo changes"})]})]})},Ui="_devices_ls6k9_1",Wi="_device_ls6k9_1",Vi="_active_ls6k9_27",mo={devices:Ui,device:Wi,active:Vi},Gi=()=>t.jsxRuntimeExports.jsx("div",{className:mo.devices,children:$s.map(e=>t.jsxRuntimeExports.jsx(qi,{device:e}))}),qi=e=>{const{device:n}=e,{currentDevice:o,setCurrentDevice:r}=t.useDeviceStore(),[i,s]=C.useState(!1),[a,l]=C.useState(null);return t.jsxRuntimeExports.jsxs("div",{className:t.clx(mo.device,{[mo.active]:o.value===n.value}),onClick:()=>r(n),onMouseEnter:()=>{const c=setTimeout(()=>{s(!0)},200);l(c)},onMouseLeave:()=>{a&&clearTimeout(a),s(!1)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:n.icon,fill:o.value===n.value?"#252525":"#757575",width:20,height:20}),i&&t.jsxRuntimeExports.jsx(Mt,{text:`Switch to ${n.value} view`})]},n.value)},Zi="_preview_1x3m8_2",Xi="_active_1x3m8_19",Hn={preview:Zi,active:Xi},Yi=()=>{const{onPreview:e}=t.usePreviewStore(),[n,o]=C.useState(!1),[r,i]=C.useState(null);return t.jsxRuntimeExports.jsxs("a",{href:"/",className:t.clx(Hn.preview,{[Hn.active]:e}),target:"_blank",onMouseEnter:()=>{const s=setTimeout(()=>{o(!0)},200);i(s)},onMouseLeave:()=>{r&&clearTimeout(r),o(!1)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"ArrowUpRight",width:20,height:20}),t.jsxRuntimeExports.jsx("span",{className:Hn.text,children:"Preview"}),n&&t.jsxRuntimeExports.jsx(Mt,{text:"Open draft theme in new tab"})]})},Ki="_settings_u4cv4_1",Ji={settings:Ki},Qi="_pages_167qp_1",ea="_text_167qp_21",ta="_modal_167qp_27",na="_open_167qp_46",oa="_page_167qp_1",ra="_hoverable_167qp_61",sa="_separator_167qp_65",ia="_button_167qp_70",aa="_items_167qp_85",Oe={pages:Qi,default:"_default_167qp_5",text:ea,modal:ta,open:na,page:oa,hoverable:ra,separator:sa,button:ia,items:aa},Wr=async e=>{const n=localStorage.getItem("shopId")||void 0,o=localStorage.getItem("draftId"),i=`${t.useApiStore.getState().apiUrls.api}/v2/builder/shops/${n}/drafts/${o}/pages/${encodeURIComponent(e)}`;return await t.request({url:i,withToken:!0,method:"delete"})},la=()=>{const{currentPage:e,setCurrentPage:n,setIsOpenModal:o,pages:r,setIsEdit:i,setEditedPage:s,deletePage:a,setIsOpenSelectModal:l}=t.usePagesStore(),{deletePage:c,setCurrentBlock:p}=t.useLayersStore(),[u,d]=C.useState(null),{setTitle:h,setDescription:m,setOnConfirm:g}=t.useConfirmationModalStore(),[x,y]=C.useState(!1),f=C.useRef(null);t.useOnClickOutside(f,()=>{x&&y(!1)}),C.useEffect(()=>{x?l(!0):setTimeout(()=>{l(!1)},300)},[x]);const _=S=>S?S.replace(/_/g," ").split(" ").map(E=>E.charAt(0).toUpperCase()+E.slice(1)).join(" "):"";return t.jsxRuntimeExports.jsxs("div",{className:Oe.pages,ref:f,children:[t.jsxRuntimeExports.jsxs("div",{className:Oe.default,onClick:S=>{S.stopPropagation(),y(E=>!E)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:r&&r[e]&&r[e].icon||"File",fill:"#252525",width:20,height:20}),t.jsxRuntimeExports.jsx("span",{className:Oe.text,children:r&&r[e]&&t.defaultPagePaths.includes(r[e].path)?`${_(r[e].name)} page`:r&&r[e]&&r[e].name}),t.jsxRuntimeExports.jsx("div",{style:{transform:x?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.3s ease",display:"flex"},children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown",width:20,height:20})})]}),t.jsxRuntimeExports.jsxs("div",{className:t.clx(Oe.modal,{[Oe.open]:x}),onClick:S=>S.stopPropagation(),children:[r&&t.jsxRuntimeExports.jsx("div",{className:Oe.items,children:Object.keys(r).map(S=>{const E=r[S];return t.jsxRuntimeExports.jsxs("div",{className:t.clx(Oe.page,{[Oe.hoverable]:u===S}),onMouseEnter:()=>d(S),onMouseLeave:()=>d(null),onClick:()=>{d(null),i(!1),p(null),n(S),y(!1)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:E.icon,fill:"#252525"}),t.jsxRuntimeExports.jsx("span",{className:Oe.text,children:t.defaultPagePaths.includes(E.path)?`${_(E.name)} page`:E.name}),u===S&&t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Gear",fill:"#757575",onClick:b=>{b.stopPropagation(),i(!0),s(S),o(!0)}}),!t.defaultPagePaths.includes(E.path)&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",fill:"#C12A2A",onClick:b=>{b.stopPropagation(),h("Delete Page"),m(`Are you sure you want to delete ${E.name||"this"} page? Once you delete this page, any content visible will also be deleted. This is irreversible.`),g(()=>{b.stopPropagation(),r[e].path===E.path&&n(Object.keys(r)[0]),a(S),c(E.name),Wr(E.path)})}})]}),r[e]&&r[e].name===E.name&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Check",fill:"#FF3F19"})]},S)})}),t.jsxRuntimeExports.jsx("div",{className:Oe.separator}),t.jsxRuntimeExports.jsxs(t.Button,{className:Oe.button,onClick:S=>{S.stopPropagation(),o(!0)},size:"l",children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",fill:"#ff3f19"}),t.jsxRuntimeExports.jsx("span",{children:"Create New Page"})]})]})]})},ca="_zoom_fu0hj_1",zo={zoom:ca},ua=()=>{const{zoomLevel:e,setZoomLevel:n}=t.usePreviewStore();return t.jsxRuntimeExports.jsxs("label",{htmlFor:"zoom",className:zo.zoom,children:[t.jsxRuntimeExports.jsx("label",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center"},htmlFor:"zoom",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"MagnifyingGlassMinus",width:20,height:20})}),t.jsxRuntimeExports.jsx("input",{id:"zoom",type:"number",min:25,max:250,value:(e*100).toFixed(0),onChange:o=>{const r=Number(o.target.value);n(r/100)},className:zo.input}),t.jsxRuntimeExports.jsx("span",{children:"%"})]})},pa=()=>t.jsxRuntimeExports.jsxs("div",{className:Ji.settings,children:[t.jsxRuntimeExports.jsx(la,{}),t.jsxRuntimeExports.jsx(ua,{})]}),da="_theme_1e5wq_1",ma="_text_1e5wq_13",Uo={theme:da,text:ma},ha=()=>t.jsxRuntimeExports.jsx("div",{className:Uo.theme,children:t.jsxRuntimeExports.jsx("div",{className:Uo.text,children:"Live Theme"})}),xa=async(e,n,o)=>{const r=localStorage.getItem("shopId")||void 0,i=localStorage.getItem("draftId"),a=`${t.useApiStore.getState().apiUrls.api}/v2/builder/shops/${r}/drafts/${i}/${n}`;return await t.request({url:a,withToken:!0,method:e,body:o})};function Wt(e,n){try{return n.map(r=>{if(!r.value||!r.value.blockSettings){console.error("block.value or block.value.blockSettings is undefined.");return}return Object.values(r.value.blockSettings).filter(s=>s&&s.type===e).map(s=>{if(s.value===void 0)throw new Error("item.value is undefined.");return s.value}).flat()}).flat().filter(r=>r).map(r=>e==="ListingIds"?r.listingId:r)}catch(o){return console.error("Error in getValues function:",o),[]}}function ga(e,n,o){return fa(e,n)?(o.reviews||[]).length*3:0}function fa(e,n){return n.map(r=>{if(!r.value||!r.value.blockSettings){console.error("block.value or block.value.blockSettings is undefined.");return}return Object.values(r.value.blockSettings).filter(s=>s&&s.type===e).map(s=>{if(s.value===void 0)throw new Error("item.value is undefined.");return s.value}).flat()}).flat().filter(r=>r).length>0}function Ia(e,n){if(n){const o=Object.keys(n).find(r=>n[r].path===e);if(o)return n[o]}return null}const ja=({setIsLoading:e,isLoading:n})=>{const{themeSettings:o}=t.useThemeSettingsStore(),{settings:r}=t.useSettingsStore(),[i,s]=C.useState(null),[a,l]=C.useState(!1),{setNotifications:c,notifications:p}=t.useNotificationStore(),{header:u,footer:d,announcement:h,blocks:m}=t.useLayersStore(),{pageContext:g}=t.usePagesStore(),{pages:x}=t.usePagesStore(),y=async()=>{if(a)i&&clearTimeout(i);else{e(!0);const _=Object.keys(m).map(b=>{const k=Ia(b,x);return m[b]&&m[b].data&&(k!=null&&k.path)?{id:k?k.id:b,name:k?k.name:b,path:k.path,layout:{...m[b]},neededProductIds:[...Wt("ProductId",Object.values(m[b].data))],neededCategoryIds:[...Wt("CategoryId",Object.values(m[b].data))],neededAnnouncementIds:[...Wt("AnnouncementId",Object.values(m[b].data))],neededListingIds:[...Wt("ListingIds",Object.values(m[b].data))],neededFaqIds:[...Wt("FaqsIds",Object.values(m[b].data))],neededReviewCount:ga("ReviewCount",Object.values(m[b].data),g),seo:{pageTitle:k&&k.seo&&k.seo.pageTitle?k.seo.pageTitle:"",pageDescription:k&&k.seo&&k.seo.pageDescription?k.seo.pageDescription:""},isPrivate:!!(k&&k.visibility==="private")}:null}).filter(b=>b),S={settings:{...r},header:u,footer:d,announcement:h},{status:E}=await xa("post","save",{themeSettings:o,settings:S,updatedPages:_});c([...p,{id:t.v4(),message:E===200?"Settings saved":"Error",status:E===200?"success":"error"}]),e(!1)}l(!0);const f=setTimeout(()=>{l(!1)},2e3);s(f)};return t.jsxRuntimeExports.jsx(t.Button,{onClick:y,disabled:n,children:t.jsxRuntimeExports.jsx("span",{style:{userSelect:"none"},children:"Save"})})},Sa=()=>{const{isOpenSelectModal:e}=t.usePagesStore(),[n,o]=C.useState(!1),{showTooltip:r}=t.useTooltipStore();return t.jsxRuntimeExports.jsxs("div",{className:dn.header,style:{zIndex:e?5e4:r?501:50},children:[t.jsxRuntimeExports.jsxs("div",{className:dn.left,children:[t.jsxRuntimeExports.jsx(Gi,{}),t.jsxRuntimeExports.jsx(Yi,{})]}),t.jsxRuntimeExports.jsx("div",{className:dn.center,children:t.jsxRuntimeExports.jsx(pa,{})}),t.jsxRuntimeExports.jsxs("div",{className:dn.right,children:[t.jsxRuntimeExports.jsx(ha,{}),t.jsxRuntimeExports.jsx(zi,{}),t.jsxRuntimeExports.jsx(ja,{setIsLoading:o,isLoading:n}),n&&t.jsxRuntimeExports.jsx(mt,{})]})]})},ya="_exit_ovvox_1",Ca="_text_ovvox_11",ka="_exitLink_ovvox_16",zn={exit:ya,text:Ca,exitLink:ka},ba=()=>t.jsxRuntimeExports.jsx("div",{className:zn.exit,children:t.jsxRuntimeExports.jsxs("a",{href:"https://dash.billgang.com/",className:zn.exitLink,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"SignOut",width:20,height:20}),t.jsxRuntimeExports.jsx("span",{className:zn.text,children:"Exit"})]})}),_a="_navbar_1podc_1",wa="_main_1podc_6",Ea="_block_1podc_13",va="_active_1podc_29",hn={navbar:_a,main:wa,block:Ea,active:va},Ra=()=>{const{activeBlock:e}=t.useNavbarStore(),{setActiveBlock:n}=t.useBlocksStore(),{setCurrentBlock:o}=t.useLayersStore(),{setActiveBlock:r}=t.useThemeSettingsStore(),{setActiveBlock:i}=t.usePreviewStore(),s=t.useNavigate();function a(l){switch(n(null),o(null),r(null),i({id:null,neededScroll:!1}),l.name){case"Layers":s("/admin/builder");break;case"Add":s("/admin/builder/add");break;case"Theme":s("/admin/builder/theme");break;case"Settings":s("/admin/builder/settings");break}}return t.jsxRuntimeExports.jsxs("div",{className:hn.navbar,children:[t.jsxRuntimeExports.jsx(ba,{}),t.jsxRuntimeExports.jsx("div",{className:hn.main,children:t.navbarBlocks.map(l=>t.jsxRuntimeExports.jsxs("div",{className:t.clx(hn.block,{[hn.active]:e.icon===l.icon}),onClick:()=>a(l),children:[t.jsxRuntimeExports.jsx(t.Icon,{name:l.icon,fill:e.icon===l.icon?"#252525":"#757575"}),t.jsxRuntimeExports.jsx("span",{children:l.name})]},l.icon))})]})},Na="_preview_gb2ye_1",Ta="_main_gb2ye_15",Pa="_content_gb2ye_25",La="_loading_gb2ye_34",Aa="_previewLoading_gb2ye_65",Vt={preview:Na,main:Ta,content:Pa,loading:La,previewLoading:Aa},Ba="_header_11zku_2",Ma="_circles_11zku_16",Fa="_circle_11zku_16",Da="_red_11zku_32",$a="_green_11zku_36",Oa="_yellow_11zku_40",Ha="_input_11zku_44",za="_main_11zku_55",Ua="_text_11zku_63",Wa="_copy_11zku_75",qe={header:Ba,circles:Ma,circle:Fa,red:Da,green:$a,yellow:Oa,input:Ha,main:za,text:Ua,copy:Wa},Va=["red","yellow","green"],Ga=()=>{const{currentDevice:e}=t.useDeviceStore(),n=(i,s)=>i.length>s?i.slice(0,s)+"...":i,{notifications:o,setNotifications:r}=t.useNotificationStore();return t.jsxRuntimeExports.jsxs("div",{className:qe.header,children:[t.jsxRuntimeExports.jsx("div",{className:qe.circles,children:Va.map(i=>t.jsxRuntimeExports.jsx("div",{className:t.clx(qe.circle,{[qe.red]:i==="red",[qe.yellow]:i==="yellow",[qe.green]:i==="green"})},i))}),t.jsxRuntimeExports.jsx("div",{className:qe.input,children:t.jsxRuntimeExports.jsxs("div",{className:qe.main,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Lock",fill:"#757575",width:15,height:16}),t.jsxRuntimeExports.jsx("span",{className:qe.text,children:e.value==="mobile"?n(window.location.origin,35):e.value==="desktop"?n(window.location.origin,200):n(window.location.origin,100)})]})}),t.jsxRuntimeExports.jsx(t.Button,{type:"Secondary",style:{padding:"8px"},onClick:()=>{navigator.clipboard.writeText(window.location.origin),r([...o,{id:t.v4(),status:"success",message:"Domain copied to clipboard"}])},className:qe.copy,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Copy",width:20,height:20,fill:"#252525"})})]})},Qe=e=>e?e.replace(/_/g," ").split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" and "):"",Vr=(e,n,o,r,i,s,a)=>{const l=e.currentTarget.getBoundingClientRect(),c=window.innerHeight-l.bottom,p=l.top,u=window.innerWidth-l.right,d=l.left;let h,m;return h=l.bottom+r+window.scrollY,m=l.left,(c<n||c<i)&&(p>=n+a?h=l.top-n-r+window.scrollY:h=window.scrollY+a),h-window.scrollY<a&&(h=window.scrollY+a),(u<o||u<s)&&(d>=o?m=l.right-o:m=(window.innerWidth-o)/2),m<l.right+s&&(m=l.right+s),m<l.right&&m+o>l.left&&h<l.bottom&&h+n>l.top&&(u>=o+s?m=l.right+r+s:c>=n?h=l.bottom+r+window.scrollY:(h=window.scrollY+a,m=(window.innerWidth-o)/2)),{top:h,left:m}},qa="_results_1pahy_1",Wo={results:qa};function Za(e,n){return n?new n[e]().blockSettings.isAddable:!1}function Vo(e,n){return e?Object.keys(e||{}).reduce((o,r)=>(Za(r,n)&&o.push({name:r,displayName:t.getDisplayName(r,n)}),o),[]):[]}const Xa="_product_yggw5_1",Ya="_name_yggw5_15",Go={product:Xa,name:Ya},Ka=e=>{const{blockId:n,setSearchValue:o}=e,{sourceBlocks:r,setActiveBlock:i}=t.useBlocksStore(),{hideModal:s,hoverBlockId:a,isModalVisible:l,showPreview:c,hidePreview:p,clearHideTimeout:u,startHideTimeout:d,setHoverBlockTopPosition:h}=t.useSubmodalStore();function m(y){o(""),i(y),s("keyBlock")}function g(y,f){const _=window.innerHeight,S=400,E=10;let b=f.clientY-120;b+S>_&&(b=_-S-E),b<E&&(b=E),a||s("keyBlock"),c(y,"keyBlock"),u(),h(b)}function x(){l?d("keyBlock"):p("keyBlock"),h(null)}return t.jsxRuntimeExports.jsxs("div",{className:Go.product,onClick:()=>m(n),onMouseEnter:y=>g(n,y),onMouseLeave:x,children:[tn[n]?t.jsxRuntimeExports.jsx("img",{src:tn[n]}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Cards"}),t.jsxRuntimeExports.jsx("span",{className:Go.name,children:t.getDisplayName(n,r)}),t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretRight",width:20,height:20})]},n)},Gr=()=>{const{blocks:e,sourceBlocks:n}=t.useBlocksStore(),[o,r]=C.useState(""),[i,s]=C.useState([]),a=C.useMemo(()=>Vo(e,n),[e,n]),l=C.useMemo(()=>new t.Fuse(a,{keys:["displayName"],threshold:.4}),[a]);return C.useEffect(()=>{if(o.trim()==="")s(Vo(e,n));else{const c=l.search(o);s(c.map(p=>p.item))}},[o,l]),t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(t.Input,{type:"text",placeholder:"Search for sections",isSearch:!0,onChange:r,value:o,style:{marginBottom:10}}),t.jsxRuntimeExports.jsx("div",{className:Wo.results,children:i.length>0?i.map(c=>t.jsxRuntimeExports.jsx(Ka,{blockId:c.name,setSearchValue:r})):t.jsxRuntimeExports.jsx("div",{className:Wo.noResults,children:"No sections found"})})]})},Ja="_wrapper_1k1cr_1",Qa="_submodal_1k1cr_14",ho={wrapper:Ja,submodal:Qa},el=({children:e,positionTop:n,positionLeft:o})=>{const{keyBlock:r,startHideTimeout:i,clearHideTimeout:s,setMouseOverModal:a}=t.useSubmodalStore();return r?t.jsxRuntimeExports.jsx("div",{className:ho.wrapper,style:n?{top:n,left:o||void 0}:{},onMouseEnter:()=>{s(),a(!0)},onMouseLeave:()=>{a(!1),i()},children:e}):null},tl=({children:e})=>{const{hoverBlockId:n,startHideTimeout:o,clearHideTimeout:r,setMouseOverModal:i}=t.useSubmodalStore();return n?t.jsxRuntimeExports.jsx("div",{className:t.clx(ho.wrapper,ho.submodal),onMouseEnter:()=>{r(),i(!0)},onMouseLeave:()=>{i(!1),o()},children:e}):null},nl="_applyButton_1a9kh_2",ol="_content_1a9kh_7",rl="_title_1a9kh_14",sl="_label_1a9kh_21",il="_colorValue_1a9kh_40",al="_colorMap_1a9kh_48",ll="_indicator_1a9kh_57",cl="_hueSlider_1a9kh_66",ul="_slider_1a9kh_97",pl="_buttons_1a9kh_102",dl="_name_1a9kh_109",ml="_secondary_1a9kh_114",hl="_input_1a9kh_122",xl="_modal_1a9kh_160",gl="_alphaSlider_1a9kh_249",fl="_alphaBackground_1a9kh_257",Il="_alphaGradient_1a9kh_268",jl="_chargeTypes_1a9kh_297",Sl="_charge_1a9kh_297",yl="_chargeActive_1a9kh_326",Cl="_gradient_1a9kh_334",kl="_color_1a9kh_40",bl="_colorActive_1a9kh_355",_l="_gradientWrapper_1a9kh_362",wl="_subtitle_1a9kh_368",El="_colorTypes_1a9kh_375",vl="_colorType_1a9kh_375",Rl="_colorTypeActive_1a9kh_399",Nl="_colorsWrapper_1a9kh_404",Tl="_colors_1a9kh_404",K={applyButton:nl,content:ol,title:rl,label:sl,colorValue:il,colorMap:al,indicator:ll,hueSlider:cl,slider:ul,buttons:pl,name:dl,secondary:ml,input:hl,modal:xl,alphaSlider:gl,alphaBackground:fl,alphaGradient:Il,chargeTypes:jl,charge:Sl,chargeActive:yl,gradient:Cl,color:kl,colorActive:bl,gradientWrapper:_l,subtitle:wl,colorTypes:El,colorType:vl,colorTypeActive:Rl,colorsWrapper:Nl,colors:Tl};function Un(e){return(e.includes("linear-gradient")||e.includes("radial-gradient"))&&/^linear-gradient\(\d+deg,\s*#[A-Fa-f0-9]{8}\s+\d+%,\s*#[A-Fa-f0-9]{8}\s+\d+%\)$/.test(e)?!0:/^#([A-Fa-f0-9]{3}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$/.test(e)}const Fe=e=>{const{initialColor:n,onChange:o,title:r,labelStyle:i="primary",isGradientActive:s=!0,isBlockSettings:a}=e,[l,c]=C.useState(n);C.useEffect(()=>{c(n)},[n]);const{setActiveLabel:p,setModalPosition:u,setInitialColor:d,setShowModal:h,setUpdate:m,setColor:g,setColorChange:x,setIsGradientActive:y,colorChange:f}=t.useColorPickerStore();C.useEffect(()=>{const b=()=>{h(!1),p(null),d(n),m(()=>{}),g(n),x(()=>{})};return document.body.addEventListener("click",b),()=>{document.body.removeEventListener("click",b)}},[n]);const _=b=>{b.stopPropagation(),h(!0),x(c),m(o),d(n),g(l),y(s);const{top:k,left:L}=Vr(b,600,288,10,20,230,80);u({top:k,left:L})},S=b=>{const k=b.target.value;c(k),Un(k)&&(o(k),g(k),x(f))},E=()=>{Un(l)||c(n)};return t.jsxRuntimeExports.jsxs("div",{className:K.content,children:[t.jsxRuntimeExports.jsx("span",{className:t.clx(K.name,{[K.secondary]:i==="secondary"}),children:r}),t.jsxRuntimeExports.jsxs("label",{className:K.label,onClick:b=>b.stopPropagation(),children:[t.jsxRuntimeExports.jsx("div",{className:K.colorValue,style:{background:Un(l)?l:n},onClick:a?void 0:_}),t.jsxRuntimeExports.jsx("input",{type:"text",value:l.includes("linear-gradient")?l:l.toUpperCase(),onChange:S,onBlur:E,className:K.input,style:{textTransform:l.includes("linear-gradient")?"none":"uppercase"}})]})]})},Pl=()=>{const{modalPosition:e,color:n,initialColor:o,setShowModal:r,hue:i,saturation:s,brightness:a,alpha:l,dragging:c,setDragging:p,setHue:u,setSaturation:d,setBrightness:h,setAlpha:m,colorChange:g,setColor:x,update:y,isGradient:f,setIsGradient:_,gradientDirection:S,setGradientDirection:E,hue2:b,saturation2:k,brightness2:L,alpha2:$,setHue2:H,setSaturation2:O,setBrightness2:N,setAlpha2:v,activeColorIndex:P,setActiveColorIndex:B,isGradientActive:M,isBlockSettings:U}=t.useColorPickerStore(),A=(G,V,se)=>{V/=100,se/=100;const Z=pe=>(pe+G/60)%6,ne=pe=>se*(1-V*Math.max(0,Math.min(Z(pe),4-Z(pe),1))),Y=Math.round(255*ne(5)),ie=Math.round(255*ne(3)),oe=Math.round(255*ne(1));return{r:Y,g:ie,b:oe}},D=G=>G.toString(16).padStart(2,"0"),Q=(G,V,se,Z)=>{const{r:ne,g:Y,b:ie}=A(G,V,se),oe=Math.round(Z/100*255);return`#${D(ne)}${D(Y)}${D(ie)}${D(oe)}`},I=(G,V,se,Z)=>{if(f)if(P===1){u(G),d(V),h(se),m(Z);const ne=Q(G,V,se,Z),Y=Q(b,k,L,$),oe=`linear-gradient(${S==="vertical"?"0deg":"90deg"}, ${ne} 0%, ${Y} 100%)`;g(oe),x(oe)}else{H(G),O(V),N(se),v(Z);const ne=Q(G,V,se,Z),Y=Q(i,s,a,l),oe=`linear-gradient(${S==="vertical"?"0deg":"90deg"}, ${Y} 0%, ${ne} 100%)`;g(oe),x(oe)}else{const ne=Q(G,V,se,Z);g(ne),x(ne)}},J=(G,V,se)=>{const{width:Z,height:ne}=se.getBoundingClientRect(),Y=Math.max(0,Math.min(G/Z*100,100)),ie=Math.max(0,Math.min(100-V/ne*100,100));f?P===1?(d(Y),h(ie),I(i,Y,ie,l)):(O(Y),N(ie),I(b,Y,ie,$)):(d(Y),h(ie),I(i,Y,ie,l))},ge=G=>{const{offsetX:V,offsetY:se}=G.nativeEvent;p(!0),J(V,se,G.currentTarget)},j=G=>{if(c){const V=document.querySelector(`.${K.colorMap}`),{left:se,top:Z}=V.getBoundingClientRect(),ne=G.clientX-se,Y=G.clientY-Z;J(ne,Y,V)}},ee=()=>{p(!1)};C.useEffect(()=>{function G(Z){const ne=/linear-gradient\((\d+deg),\s*(#[0-9a-fA-F]{8})\s*0%,\s*(#[0-9a-fA-F]{8})\s*100%\)/,Y=Z.match(ne);if(Y){const ie=Y[1],oe=Y[2],pe=Y[3];return{angle:ie,col1:oe,col2:pe}}return null}function V(Z){const ne=parseInt(Z.slice(1,3),16),Y=parseInt(Z.slice(3,5),16),ie=parseInt(Z.slice(5,7),16),oe=parseInt(Z.slice(7,9),16)/255*100,{h:pe,s:w,b:T}=se(ne,Y,ie);return{h:pe,s:w,b:T,a:oe}}function se(Z,ne,Y){Z/=255,ne/=255,Y/=255;const ie=Math.max(Z,ne,Y),oe=Math.min(Z,ne,Y);let pe=0;const w=ie-oe,T=(ie===0?0:w/ie)*100,W=ie*100;if(ie===oe)pe=0;else switch(ie){case Z:pe=((ne-Y)/w+(ne<Y?6:0))*60;break;case ne:pe=((Y-Z)/w+2)*60;break;case Y:pe=((Z-ne)/w+4)*60;break}return{h:pe,s:T,b:W}}if(o&&o.startsWith("linear-gradient")){const Z=G(o);if(Z){const{angle:ne,col1:Y,col2:ie}=Z,oe=V(Y),pe=V(ie);_(!0),E(ne==="0deg"?"vertical":"horizontal"),u(oe.h),d(oe.s),h(oe.b),m(oe.a),H(pe.h),O(pe.s),N(pe.b),v(pe.a),B(1)}}else if(o){const ne=function(ie){let oe=ie;return oe.length===7?oe+"ff":oe.length===9?oe:oe.length===4?oe[0]+oe[1].repeat(2)+oe[2].repeat(2)+oe[3].repeat(2)+"ff":"#000000ff"}(o),Y=V(ne);_(!1),u(Y.h),d(Y.s),h(Y.b),m(Y.a)}},[o,_,E,u,d,h,m,H,O,N,v,B]),C.useEffect(()=>{let G,V,se,Z;f?P===1?(G=i,V=s,se=a,Z=l):(G=b,V=k,se=L,Z=$):(G=i,V=s,se=a,Z=l),I(G,V,se,Z)},[f,S,P,i,s,a,l,b,k,L,$]),C.useEffect(()=>{const G=se=>j(se),V=()=>ee();return c?(document.addEventListener("mousemove",G),document.addEventListener("mouseup",V)):(document.removeEventListener("mousemove",G),document.removeEventListener("mouseup",V)),()=>{document.removeEventListener("mousemove",G),document.removeEventListener("mouseup",V)}},[c,f,S]);function he(){if(!f)y(n);else{const G=Q(i,s,a,l),V=Q(b,k,L,$),Z=`linear-gradient(${S==="vertical"?"0deg":"90deg"}, ${G} 0%, ${V} 100%)`;y(Z)}r(!1)}function q(){r(!1),g(o)}const je=f?P===1?i:b:i,De=f?P===1?s:k:s,tt=f?P===1?a:L:a,at=f?P===1?l:$:l,{r:xt,g:un,b:pn}=A(je,De,tt),Fn=`linear-gradient(to right, rgba(${xt}, ${un}, ${pn}, 0), rgba(${xt}, ${un}, ${pn}, 1))`,$t=Q(i,s,a,l),Ot=Q(b,k,L,$);return t.jsxRuntimeExports.jsxs("div",{className:K.modal,onClick:G=>G.stopPropagation(),style:{top:`${e.top}px`,left:`${e.left}px`},children:[t.jsxRuntimeExports.jsx("h2",{className:K.title,children:"Color"}),M&&t.jsxRuntimeExports.jsxs("div",{className:K.colorTypes,children:[t.jsxRuntimeExports.jsxs("div",{className:t.clx(K.colorType,{[K.colorTypeActive]:!f}),onClick:()=>_(!1),children:[t.jsxRuntimeExports.jsx("div",{style:{background:"#757575",width:"16px",height:"16px",borderRadius:"50%"}}),"Solid"]}),t.jsxRuntimeExports.jsxs("div",{className:t.clx(K.colorType,{[K.colorTypeActive]:f}),onClick:()=>_(!0),children:[t.jsxRuntimeExports.jsx("div",{style:{background:"linear-gradient(to bottom, #757575 0%, #DBDBDB 100%)",width:"16px",height:"16px",borderRadius:"50%"}}),"Linear"]})]}),f&&M&&t.jsxRuntimeExports.jsxs("div",{className:K.colorsWrapper,children:[t.jsxRuntimeExports.jsx("div",{className:K.colors,style:{background:`linear-gradient(90deg, ${$t} 0%, ${Ot} 100%)`}}),t.jsxRuntimeExports.jsx("div",{className:t.clx(K.color,{[K.colorActive]:P===1}),onClick:()=>B(1),style:{background:$t}}),t.jsxRuntimeExports.jsx("div",{className:t.clx(K.color,{[K.colorActive]:P===2}),onClick:()=>B(2),style:{background:Ot}})]}),t.jsxRuntimeExports.jsx("div",{className:K.colorMap,onMouseDown:ge,style:{background:`
|
|
102
102
|
linear-gradient(to top, black, transparent),
|
|
103
103
|
linear-gradient(to right, hsl(${je}, 100%, 100%), hsl(${je}, 100%, 50%))
|
|
104
104
|
`},children:t.jsxRuntimeExports.jsx("div",{className:K.indicator,style:{position:"absolute",left:`${De}%`,top:`${100-tt}%`,transform:"translate(-50%, -50%)"}})}),t.jsxRuntimeExports.jsx("div",{className:K.hueSlider,style:{bottom:U?f?"225px":"150px":f?"175px":"100px"},children:t.jsxRuntimeExports.jsx("input",{type:"range",min:"0",max:"360",value:je,onChange:G=>{const V=Number(G.target.value);f?P===1?I(V,s,a,l):I(V,k,L,$):(u(V),I(V,s,a,l))},className:K.slider})}),t.jsxRuntimeExports.jsxs("div",{className:K.alphaSlider,style:{bottom:U?f?"200px":"125px":f?"150px":"75px"},children:[t.jsxRuntimeExports.jsx("div",{className:K.alphaBackground}),t.jsxRuntimeExports.jsx("div",{className:K.alphaGradient,style:{background:Fn}}),t.jsxRuntimeExports.jsx("input",{type:"range",min:"0",max:"100",value:at,onChange:G=>{const V=Number(G.target.value);f?P===1?I(i,s,a,V):I(b,k,L,V):(m(V),I(i,s,a,V))},className:K.slider})]}),f&&M&&t.jsxRuntimeExports.jsxs("div",{className:K.gradientWrapper,children:[t.jsxRuntimeExports.jsx("h3",{className:K.subtitle,children:"Rotation"}),t.jsxRuntimeExports.jsx("div",{className:K.gradient,children:t.jsxRuntimeExports.jsxs("div",{className:K.chargeTypes,children:[t.jsxRuntimeExports.jsxs("div",{className:t.clx(K.charge,{[K.chargeActive]:S==="horizontal"}),onClick:()=>E("horizontal"),children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"ArrowsHorizontal",width:20,height:20}),"Horizontal"]}),t.jsxRuntimeExports.jsxs("div",{className:t.clx(K.charge,{[K.chargeActive]:S==="vertical"}),onClick:()=>E("vertical"),children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"ArrowsVertical",width:20,height:20}),"Vertical"]})]})})]}),U&&t.jsxRuntimeExports.jsx(Fe,{initialColor:n,onChange:G=>x(G),title:"",isBlockSettings:U}),t.jsxRuntimeExports.jsxs("div",{className:K.buttons,children:[t.jsxRuntimeExports.jsx(t.Button,{onClick:q,className:t.clx(K.applyButton,K.cancelButton),type:"Secondary",children:"Cancel"}),t.jsxRuntimeExports.jsx(t.Button,{onClick:he,className:K.applyButton,children:"Apply"})]})]})},Ll=()=>{const{onPreview:e,zoomLevel:n}=t.usePreviewStore(),{keyBlock:o,hoverBlockId:r,isModalVisible:i,hoverBlockTopPosition:s}=t.useSubmodalStore(),{settings:a}=t.useSettingsStore(),{sourceBlocks:l}=t.useBlocksStore(),{pageContext:c}=t.usePagesStore(),{showModal:p}=t.useColorPickerStore(),{currentDevice:u}=t.useDeviceStore(),{isLoadingThemeSettings:d}=t.useThemeSettingsStore(),{isLoadingLayers:h}=t.useLayersStore(),m=S=>S?!l||!l[S]?t.jsxRuntimeExports.jsx(t.ErrorableBlock,{error:`Block "${S}" does not exist in blocks.`}):new l[S]().renderPreview(a,c):t.jsxRuntimeExports.jsx(t.ErrorableBlock,{error:"Block or block.name is undefined."});function g(){if(u.value==="desktop")return n>=1?"100%":`${(n*100).toFixed(2)}%`;{const S=u.value==="tablet"?768:425;return n>=1?`${S}px`:`${(S*n).toFixed(2)}px`}}function x(){switch(u.value){case"desktop":return"100%";case"tablet":return 768;case"mobile":return 425;default:return"100%"}}const{isOpenSelectModal:y}=t.usePagesStore(),f=C.useRef(null),_=S=>{f.current&&(f.current.scrollTop+=S.deltaY)};return t.jsxRuntimeExports.jsxs("div",{className:Vt.preview,style:{zIndex:p&&!y?5e3:500},onWheel:S=>{S.stopPropagation(),_(S)},children:[i&&t.jsxRuntimeExports.jsx(tl,{children:t.jsxRuntimeExports.jsx(Gr,{})}),t.jsxRuntimeExports.jsxs(el,{positionTop:s,positionLeft:!r&&o?void 0:250,children:[!d&&!h&&t.jsxRuntimeExports.jsx(t.RenderBlock,{render:m,block:o},o),(d||!o||h)&&t.jsxRuntimeExports.jsx("div",{className:Vt.previewLoading,children:t.jsxRuntimeExports.jsx(mt,{})})]}),p&&t.jsxRuntimeExports.jsx(Pl,{}),e&&t.jsxRuntimeExports.jsxs("div",{className:Vt.main,style:{width:x()},children:[t.jsxRuntimeExports.jsx(Ga,{}),t.jsxRuntimeExports.jsx("div",{style:{borderLeft:g()==="100%"?"none":"var(--default-border)",borderRight:g()==="100%"?"none":"var(--default-border)",width:"100%",display:"flex",flexDirection:"column",alignItems:"center",height:"calc(100vh - 160px)",overflowY:"scroll",overflowX:"hidden"},onScroll:S=>{S.stopPropagation()},onWheel:S=>{S.stopPropagation()},children:!d&&!h?t.jsxRuntimeExports.jsx("div",{className:Vt.content,style:{width:g()},children:t.jsxRuntimeExports.jsx(t.PreviewContent,{scrollableRef:f})}):t.jsxRuntimeExports.jsx("div",{className:Vt.loading,children:t.jsxRuntimeExports.jsx(mt,{})})})]})]})},Al="_sidebar_1xtkj_1",Bl="_title_1xtkj_11",qo={sidebar:Al,title:Bl},Ml="_layers_1jhzw_1",Fl="_wrapper_1jhzw_9",Dl="_draggingWrapper_1jhzw_17",$l="_block_1jhzw_21",Ol="_dragging_1jhzw_17",Hl="_active_1jhzw_56",zl="_add_1jhzw_63",Ul="_addTop_1jhzw_79",Wl="_visible_1jhzw_95",Vl="_button_1jhzw_99",Gl="_nameBlock_1jhzw_158",ql="_loader_1jhzw_162",Zl="_actions_1jhzw_171",Xl="_deleteButton_1jhzw_179",Se={layers:Ml,wrapper:Fl,draggingWrapper:Dl,block:$l,dragging:Ol,active:Hl,add:zl,addTop:Ul,visible:Wl,button:Vl,nameBlock:Gl,loader:ql,actions:Zl,deleteButton:Xl},Yl="_block_sj4cc_1",Kl="_title_sj4cc_17",Jl="_actions_sj4cc_21",ft={block:Yl,title:Kl,actions:Jl},Wn={header:"Header",footer:"Footer",announcement:"Announcement"},Vn=({id:e})=>{const{setCurrentBlock:n}=t.useLayersStore(),{activeBlock:o}=t.usePreviewStore(),[r,i]=C.useState(!1);function s(a){n(a)}return t.jsxRuntimeExports.jsxs("div",{className:t.clx(ft.block,{[ft.active]:o.id===e,[ft.header]:e==="header",[ft.footer]:e==="footer",[ft.announcement]:e==="announcement"}),onClick:()=>s(e),onMouseOver:()=>i(!0),onMouseLeave:()=>i(!1),children:[tn[Wn[e]]?t.jsxRuntimeExports.jsx("img",{src:tn[Wn[e]],width:20,height:20}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Cards",width:20,height:20}),t.jsxRuntimeExports.jsx("span",{className:ft.title,children:Wn[e]}),t.jsxRuntimeExports.jsx("div",{className:ft.actions,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"PushPin",hoverable:!0,width:20,height:20,fill:"#757575"})})]})},Ql=({id:e,name:n,onClick:o,isDragging:r,icon:i})=>{const{activeBlock:s,setActiveBlock:a}=t.usePreviewStore(),{showPreview:l,hidePreview:c,showModal:p,hideModal:u,clearHideTimeout:d,startHideTimeout:h,hoverBlockId:m,isModalVisible:g}=t.useSubmodalStore(),{setPositionBlock:x}=t.useLayersStore(),[y,f]=C.useState(!1),[_,S]=C.useState(!1),[E,b]=C.useState(!1),[k,L]=C.useState(!1),[$,H]=C.useState(null),O=C.useRef(null),{attributes:N,listeners:v,setNodeRef:P,transform:B,transition:M}=t.useSortable({id:e}),U={transform:t.CSS.Transform.toString(B),transition:M},{setTitle:A,setDescription:D,setOnConfirm:Q}=t.useConfirmationModalStore(),{pages:I,currentPage:J}=t.usePagesStore(),{removeBlock:ge}=t.useLayersStore(),j=q=>{q.stopPropagation(),O.current&&clearTimeout(O.current),a({id:e,neededScroll:!0}),g&&u(),l(e),d()},ee=(q,je=!0)=>{q.stopPropagation(),c(),p(e),d(),x(e,je)},he=q=>{q.stopPropagation(),a({id:null,neededScroll:!1}),g?h():c()};return C.useEffect(()=>{b(!1),f(!1),S(!1),L(!1)},[r]),C.useEffect(()=>{g||(S(!1),f(!1))},[g]),t.jsxRuntimeExports.jsxs("div",{ref:P,style:U,className:t.clx(Se.wrapper,{[Se.draggingWrapper]:r&&s.id===e}),onClick:q=>{q.stopPropagation(),o(e)},onMouseEnter:j,onMouseLeave:he,...N,...v,children:[t.jsxRuntimeExports.jsxs("div",{className:t.clx(Se.block,{[Se.dragging]:r&&s.id===e,[Se.active]:!r&&s.id===e}),children:[i?t.jsxRuntimeExports.jsx("img",{src:i,width:20,height:20}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Cards",width:20,height:20}),t.jsxRuntimeExports.jsx("span",{className:Se.nameBlock,children:n}),m===e&&!r&&t.jsxRuntimeExports.jsx("div",{className:t.clx(Se.addTop,{[Se.visible]:_}),onMouseEnter:()=>{S(!0)},onMouseLeave:()=>{S(!1)},children:t.jsxRuntimeExports.jsxs("button",{className:Se.button,onClick:q=>ee(q,!1),onMouseEnter:()=>{const q=setTimeout(()=>{r||L(!0)},200);H(q)},onMouseLeave:()=>{$&&clearTimeout($),L(!1)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",fill:"#fff"}),k&&t.jsxRuntimeExports.jsx(Mt,{text:"Click to add a section"})]})}),m===e&&!r&&t.jsxRuntimeExports.jsx("div",{className:t.clx(Se.add,{[Se.visible]:y}),onMouseEnter:()=>{f(!0)},onMouseLeave:()=>{f(!1)},children:t.jsxRuntimeExports.jsxs("button",{className:Se.button,onClick:q=>ee(q),onMouseEnter:()=>{const q=setTimeout(()=>{r||b(!0)},200);H(q)},onMouseLeave:()=>{$&&clearTimeout($),b(!1)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",fill:"#fff"}),E&&t.jsxRuntimeExports.jsx(Mt,{text:"Click to add a section"})]})})]}),m===e&&!r&&t.jsxRuntimeExports.jsxs("div",{className:Se.actions,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20}),t.jsxRuntimeExports.jsx("div",{className:Se.deleteButton,onClick:q=>{q.stopPropagation(),A("Remove Block"),D(`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.`),Q(()=>{I&&ge(I[J].path,e)})},children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",fill:"#C12A2A",hoverable:!0,width:20,height:20})})]})]})},ec=()=>{const{blocks:e,setCurrentBlock:n,currentBlock:o,moveBlock:r,isLoadingLayers:i,announcement:s}=t.useLayersStore(),{currentPage:a,pages:l}=t.usePagesStore(),{setMouseOverModal:c,setHoverBlockId:p}=t.useSubmodalStore(),{sourceBlocks:u}=t.useBlocksStore();function d(f){n(f),c(!1),p(null)}const h=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}})),[m,g]=C.useState(!1),x=()=>{g(!0)},y=f=>{g(!1);const{active:_,over:S}=f;if(S&&_.id!==S.id&&l&&l[a]){const E=l[a].path,b=e[E].order,k=b.indexOf(_.id),L=b.indexOf(S.id);k!==-1&&L!==-1&&r(E,k,L)}};return t.jsxRuntimeExports.jsx("div",{className:Se.layers,children:i?t.jsxRuntimeExports.jsx("div",{className:Se.loader,children:t.jsxRuntimeExports.jsx(mt,{})}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[s&&t.jsxRuntimeExports.jsx(Vn,{id:"announcement"}),t.jsxRuntimeExports.jsx(Vn,{id:"header"}),!o&&t.jsxRuntimeExports.jsx(t.DndContext,{sensors:h,onDragEnd:y,onDragStart:x,children:l&&l[a]&&e[l[a].path]&&t.jsxRuntimeExports.jsx(t.SortableContext,{items:e[l[a].path].order,strategy:t.verticalListSortingStrategy,children:e[l[a].path].order.map((f,_)=>t.jsxRuntimeExports.jsx(Ql,{id:f,name:t.getDisplayName(e[l[a].path].data[f].name,u),index:_,onClick:d,isDragging:m,icon:tn[e[l[a].path].data[f].name]},f))})}),t.jsxRuntimeExports.jsx(Vn,{id:"footer"})]})})},tc="_loader_eyvkk_1",nc={loader:tc},oc=()=>{const{isLoadingSettings:e}=t.useSettingsStore();return e?t.jsxRuntimeExports.jsx("div",{className:nc.loader,children:t.jsxRuntimeExports.jsx(mt,{})}):t.jsxRuntimeExports.jsx(rc,{})},rc=()=>{const{settings:e}=t.useSettingsStore(),{settings:n,setSettingsInstance:o}=t.useBlocksStore();if(!e)return null;const{setError:r}=t.useErrorStore(),i=new n(e);C.useEffect(()=>{o(i)},[e]);try{return i.renderSettings()}catch(s){throw console.error("Error rendering settings:",s),r({message:"Error rendering settings",failedPageIds:[],failedThemeSettings:!1,failedSettings:!0}),s}},sc="_theme_a1one_1",ic="_block_a1one_8",ac="_name_a1one_23",lc="_loader_a1one_27",xn={theme:sc,block:ic,name:ac,loader:lc},cc=()=>{const e=t.useNavigate(),{isLoadingThemeSettings:n,setActiveBlock:o}=t.useThemeSettingsStore();function r(i){switch(i==null?void 0:i.name){case"Colors":e("/admin/builder/theme/colors"),o(We[0]);break;case"Fonts":e("/admin/builder/theme/fonts"),o(We[1]);break;case"Borders":e("/admin/builder/theme/borders"),o(We[2]);break;case"Buttons":e("/admin/builder/theme/buttons"),o(We[3]);break;case"Inputs":e("/admin/builder/theme/inputs"),o(We[4]);break}}return t.jsxRuntimeExports.jsx("div",{className:xn.theme,children:n?t.jsxRuntimeExports.jsx("div",{className:xn.loader,children:t.jsxRuntimeExports.jsx(mt,{})}):We.map(i=>t.jsxRuntimeExports.jsxs("div",{onClick:()=>r(i),className:t.clx(xn.block),children:[t.jsxRuntimeExports.jsx(t.Icon,{name:i.icon}),t.jsxRuntimeExports.jsx("span",{className:xn.name,children:i.name}),t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretRight"})]},i.icon))})},uc="_render_7e826_9",pc="_open_7e826_24",dc="_close_7e826_51",mc="_clicked_7e826_55",hc="_loading_7e826_72",xc="_settings_7e826_76",wt={render:uc,open:pc,close:dc,clicked:mc,loading:hc,settings:xc},gc=({block:e})=>{const{pageContext:n}=t.usePagesStore(),{setError:o}=t.useErrorStore();try{return e.renderSettings(n)}catch(r){throw console.error("Error rendering settings:",r),o({message:"Error rendering block settings",failedPageIds:[],failedThemeSettings:!1,failedSettings:!0}),r}},fc="_wrapper_15ju8_1",Ic="_header_15ju8_8",jc="_title_15ju8_15",Sc="_colorWrapper_15ju8_21",yc="_name_15ju8_35",Cc="_color_15ju8_21",kc="_value_15ju8_47",bc="_length_15ju8_51",Be={wrapper:fc,header:Ic,title:jc,colorWrapper:Sc,name:yc,color:Cc,value:kc,length:bc},_c=e=>{const{colors:n}=e,{themeSettings:o}=t.useThemeSettingsStore(),[r,i]=C.useState(!0);C.useEffect(()=>{n.length<=3&&i(!0)},[]);function s(a){const l=a.replace("--",""),[c,p]=l.split("-"),u=`${p.charAt(0).toUpperCase()+p.slice(1)} ${c.charAt(0).toUpperCase()+c.slice(1)}`,[d,h]=l.split("-");return{name:u,field:d,variable:h}}return t.jsxRuntimeExports.jsxs("div",{className:Be.wrapper,children:[t.jsxRuntimeExports.jsxs("div",{className:Be.header,children:[t.jsxRuntimeExports.jsx("div",{className:Be.title,children:"Section Colors"}),!r&&t.jsxRuntimeExports.jsxs("div",{className:t.clx(Be.value,Be.length),onClick:()=>i(!0),children:["+",n.length]})]}),r&&t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx("div",{className:Be.colors,children:n.map(a=>{const l=s(a),{variable:c,name:p,field:u}=l;return t.jsxRuntimeExports.jsx(wc,{color:o.colors[u][c],name:p})})}),n.length>3&&t.jsxRuntimeExports.jsxs("div",{className:t.clx(Be.value,Be.length),onClick:()=>i(!1),children:["Hide ",n.length," colors"]})]})]})},wc=e=>{const{name:n,color:o}=e,{setActiveLabel:r,setModalPosition:i,setInitialColor:s,setShowModal:a,setUpdate:l,setColor:c,setColorChange:p,colorChange:u,setIsGradientActive:d,setIsBlockSettings:h}=t.useColorPickerStore(),{updateColor:m}=t.useThemeSettingsStore(),g=(f,_)=>S=>{m(f,_,S)};C.useEffect(()=>{const f=()=>{a(!1),r(null),s(o),l(()=>{}),c(o),p(()=>{})};return document.body.addEventListener("click",f),()=>{document.body.removeEventListener("click",f)}},[]);const x=f=>{const _=n.split("/")[0],S=_.split(" ")[0].toLowerCase(),E=_.split(" ")[1].toLowerCase();f.stopPropagation(),a(!0),p(u),l(L=>g(E,S)(L)),s(o),c(o),h(!0),d(E==="surface");const{top:b,left:k}=Vr(f,550,288,10,20,230,80);i({top:E==="surface"?b:b+125,left:k-200})};function y(f){return f.length>15?f.slice(0,15)+"...":f}return t.jsxRuntimeExports.jsxs("div",{className:Be.colorWrapper,onClick:x,children:[t.jsxRuntimeExports.jsx("div",{className:Be.color,style:{background:o}}),t.jsxRuntimeExports.jsx("div",{className:Be.name,children:n}),t.jsxRuntimeExports.jsx("div",{className:Be.value,children:y(o)})]})},Ec="_back_1sznl_1",vc="_title_1sznl_9",Rc="_deleteButton_1sznl_17",Nc="_backIcon_1sznl_30",gn={back:Ec,title:vc,deleteButton:Rc,backIcon:Nc},Tc=({onClick:e,setIsClicked:n,getDisplayName:o})=>{var h,m;const{activeBlock:r}=t.useBlocksStore(),{setTitle:i,setDescription:s,setOnConfirm:a}=t.useConfirmationModalStore(),{blocks:l,currentBlock:c,removeBlock:p}=t.useLayersStore(),{currentPage:u,pages:d}=t.usePagesStore();return t.jsxRuntimeExports.jsxs("div",{className:gn.back,children:[t.jsxRuntimeExports.jsx("div",{className:gn.backIcon,onClick:()=>e(),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretLeft",hoverable:!0,width:20,height:20})}),t.jsxRuntimeExports.jsx("h3",{className:gn.title,children:r&&o(r)||d&&d[u]&&l[d[u].path]&&c&&o((h=l[d[u].path].data[c])==null?void 0:h.name)||c&&Qe(c)||"Loading"}),c&&d&&!["header","footer","announcement"].includes(c)&&l[d[u].path].data[c]&&o((m=l[d[u].path].data[c])==null?void 0:m.name)!=="unknown name"&&t.jsxRuntimeExports.jsx("button",{onClick:g=>{var x;g.stopPropagation(),i("Remove Block"),s(`Are you sure you want to delete ${o((x=l[d[u].path].data[c])==null?void 0:x.name)||"this"} block? Once you delete this block, any content visible will also be deleted. This is irreversible.`),a(()=>{n(!0),p(d[u].path,c),e(!0)})},className:gn.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A"})})]})},Pc=()=>{const e=t.useNavigate(),[n,o]=C.useState(!1),{header:r,footer:i,announcement:s,sourceBlocks:a,activeBlock:l,setActiveBlock:c,currentInstance:p,setCurrentInstance:u}=t.useBlocksStore(),{setActiveBlock:d}=t.usePreviewStore(),{blocks:h,addBlock:m,editBlock:g,currentBlock:x,setCurrentBlock:y,header:f,footer:_,announcement:S,isLoadingLayers:E}=t.useLayersStore(),{currentPage:b,pages:k}=t.usePagesStore(),{past:L,future:$}=t.useHistoryStore();function H(v=!1){if(k&&p&&x&&!["header","footer","announcement"].includes(x)&&!v){const P={blockSettings:{}};Object.keys(p.blockSettings).filter(B=>!["displayName","isAddable"].includes(B)).map(B=>{P.blockSettings[B]=p.blockSettings[B]}),g(k[b].path,x,{name:h[k[b].path].data[x].name,value:P})}c(null),y(null),d({id:null,neededScroll:!1}),setTimeout(()=>{o(!1)},150),u(null)}function O(v){var U;if(!k||!b||!v)return null;if(v==="header"){const A=new r;return Object.keys(A.blockSettings).forEach(D=>{A.blockSettings[D]=f==null?void 0:f.blockSettings[D]}),Object.keys(A.blockColors).forEach(D=>{A.blockColors[D]=f==null?void 0:f.blockColors[D]}),A}if(v==="footer"){const A=new i;return Object.keys(A.blockSettings).forEach(D=>{A.blockSettings[D]=_==null?void 0:_.blockSettings[D]}),Object.keys(A.blockColors).forEach(D=>{A.blockColors[D]=_==null?void 0:_.blockColors[D]}),A}if(v==="announcement"){const A=new s;return Object.keys(A.blockSettings).forEach(D=>{A.blockSettings[D]=S==null?void 0:S.blockSettings[D]}),Object.keys(A.blockColors).forEach(D=>{A.blockColors[D]=S==null?void 0:S.blockColors[D]}),A}const P=h[k[b].path];if(!P||!P.data[v])return null;const B=P.data[v];return!B||!a[B.name]?null:new a[B.name]((U=B.value)==null?void 0:U.blockSettings)}C.useEffect(()=>{if(x){const v=O(x);u(v)}else u(null)},[x,L,$,l]),C.useEffect(()=>{if(l&&k&&!x){const v={blockSettings:{},blockColors:{}},P=new a[l];u(P),Object.keys(P.blockSettings).filter(M=>!["displayName","isAddable"].includes(M)).map(M=>{v.blockSettings[M]=P.blockSettings[M]}),Object.keys(P.blockColors).filter(M=>!["displayName","isAddable"].includes(M)).map(M=>{v.blockColors[M]=P.blockColors[M]});const B=m(k[b].path,{name:l,value:v});d({id:B,neededScroll:!0}),y(B),e("/admin/builder")}},[l,L,$]);function N(v){if(!a)return"unknown name";if(!a[v])return x==="header"?f==null?void 0:f.blockSettings.displayName:x==="footer"?_==null?void 0:_.blockSettings.displayName:x==="announcement"?S==null?void 0:S.blockSettings.displayName:"unknown name";const P=new a[v];return!P.blockSettings||!P.blockSettings.displayName?"unknown name":P.blockSettings.displayName}return t.jsxRuntimeExports.jsxs("div",{className:t.clx(wt.render,{[wt.open]:x,[wt.close]:!x,[wt.clicked]:n}),onClick:v=>v.stopPropagation(),style:{opacity:E?0:1},children:[t.jsxRuntimeExports.jsx(Tc,{onClick:H,setIsClicked:o,getDisplayName:N}),t.jsxRuntimeExports.jsxs("div",{className:wt.settings,children:[p&&t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(gc,{block:p}),t.jsxRuntimeExports.jsx(_c,{colors:p.blockColors})]}),!l&&!x&&t.jsxRuntimeExports.jsx("div",{className:wt.loading,children:"Loading"})]})]})},Lc="_header_9rrfr_1",Ac="_title_9rrfr_9",Bc="_backIcon_9rrfr_15",Gn={header:Lc,title:Ac,backIcon:Bc},on=({onClick:e,title:n})=>t.jsxRuntimeExports.jsxs("div",{className:Gn.header,children:[t.jsxRuntimeExports.jsx("div",{className:Gn.backIcon,onClick:e,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretLeft",hoverable:!0,width:20,height:20})}),t.jsxRuntimeExports.jsx("span",{className:Gn.title,children:n})]}),Mc="_options_ymds7_1",Fc={options:Mc},Dc="_wrapper_kzokw_1",$c="_open_kzokw_16",Oc="_close_kzokw_20",qn={wrapper:Dc,open:$c,close:Oc},rn=e=>{const{isOpen:n,isClose:o,children:r}=e;return t.jsxRuntimeExports.jsx("div",{className:t.clx(qn.wrapper,{[qn.open]:n,[qn.close]:o}),children:r})},Hc=()=>{var p,u;const{activeBlock:e,themeSettings:n,updateBorder:o,setActiveBlock:r}=t.useThemeSettingsStore();function i(d,h){o(h,d)}const s=t.useNavigate();function a(){r(null),s("/admin/builder/theme")}const l=C.useMemo(()=>n.borders,[n]),c=(e==null?void 0:e.name)==="Borders";return t.jsxRuntimeExports.jsxs(rn,{isOpen:c,isClose:!c,children:[t.jsxRuntimeExports.jsx(on,{onClick:a,title:"Borders Style"}),t.jsxRuntimeExports.jsxs("div",{className:Fc.options,children:[t.jsxRuntimeExports.jsx(t.Select,{label:"Border Radius (px)",options:Object.keys(Dn),value:((p=Object.entries(Dn).find(([d,h])=>h===l.radius))==null?void 0:p[0])||"None",onChange:d=>i(Dn[d],"radius")}),t.jsxRuntimeExports.jsx(t.Select,{label:"Border Thickness (px)",options:Object.keys($n),value:((u=Object.entries($n).find(([d,h])=>h===l.thickness))==null?void 0:u[0])||"None",onChange:d=>i($n[d],"thickness")})]})]})},zc="_options_jo38w_1",Uc="_alignments_jo38w_9",Wc="_blocks_jo38w_15",Vc="_alignment_jo38w_9",Gc="_active_jo38w_34",qc="_chargeTypes_jo38w_41",Zc="_charge_jo38w_41",Xc="_chargeActive_jo38w_69",Yc="_sliderContainer_jo38w_83",Kc="_shadowInputs_jo38w_91",Jc="_label_jo38w_102",Qc="_shadowInputsRow_jo38w_111",eu="_shadowInputsOpen_jo38w_119",ke={options:zc,alignments:Uc,blocks:Wc,alignment:Vc,active:Gc,chargeTypes:qc,charge:Zc,chargeActive:Xc,sliderContainer:Yc,shadowInputs:Kc,label:Jc,shadowInputsRow:Qc,shadowInputsOpen:eu},tu=["left","center","right"],nu=()=>{const{activeBlock:e,themeSettings:n,updateButton:o,setActiveBlock:r}=t.useThemeSettingsStore(),{fonts:i}=t.useFontsStore(),[s,a]=C.useState("primary");function l(x,y){o(s,y,x)}const[c,p]=C.useState(!1),u=n.buttons[s],d=t.useNavigate();function h(){r(null),d("/admin/builder/theme")}const m=(e==null?void 0:e.name)==="Buttons";function g(x,y){l({...u.boxShadow,[x]:y},"boxShadow")}return t.jsxRuntimeExports.jsxs(rn,{isOpen:m,isClose:!m,children:[t.jsxRuntimeExports.jsx(on,{onClick:h,title:"Buttons Style"}),t.jsxRuntimeExports.jsx("div",{className:ke.chargeTypes,style:{marginBottom:"10px"},children:["primary","secondary","tertiary"].map(x=>t.jsxRuntimeExports.jsx("div",{className:t.clx(ke.charge,{[ke.chargeActive]:s===x}),onClick:()=>a(x),children:x.charAt(0).toUpperCase()+x.slice(1)},x))}),u&&t.jsxRuntimeExports.jsxs("div",{className:ke.options,children:[t.jsxRuntimeExports.jsx(t.Input,{label:"Height (px)",value:String(u.height),onChange:x=>l(Number(x),"height"),type:"number",min:0}),t.jsxRuntimeExports.jsx(t.Select,{label:"Font Size (px)",value:String(u.size),onChange:x=>l(Number(x),"size"),options:Nn}),t.jsxRuntimeExports.jsx(t.Input,{label:"Border Radius (px)",value:String(u.radius),onChange:x=>l(Number(x),"radius"),type:"number",min:0}),t.jsxRuntimeExports.jsx(t.Select,{label:"Font",value:u.font,onChange:x=>l(x,"font"),options:[...i.filter(x=>x.name!==u.font).map(x=>x.name)]}),t.jsxRuntimeExports.jsx(Fe,{initialColor:u.color,onChange:x=>l(x,"color"),title:"Text Color",labelStyle:"secondary",isGradientActive:!1}),t.jsxRuntimeExports.jsx(Fe,{initialColor:u.background,onChange:x=>l(x,"background"),title:"Background Color",labelStyle:"secondary",isGradientActive:!0}),t.jsxRuntimeExports.jsxs("div",{className:ke.sliderContainer,children:[t.jsxRuntimeExports.jsx("h4",{className:ke.label,children:"Shadow"}),t.jsxRuntimeExports.jsx(t.Button,{type:"Secondary",onClick:()=>p(!c),style:{padding:5,display:"flex"},children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretUp",style:{rotate:c?"0deg":"-180deg",transition:"0.3s rotate ease"}})})]}),t.jsxRuntimeExports.jsxs("div",{className:t.clx(ke.shadowInputs,{[ke.shadowInputsOpen]:c}),children:[t.jsxRuntimeExports.jsxs("div",{className:ke.shadowInputsRow,children:[t.jsxRuntimeExports.jsx(t.Input,{label:"Left (px)",value:String(u.boxShadow.left),onChange:x=>g("left",Number(x)),type:"number"}),t.jsxRuntimeExports.jsx(t.Input,{label:"Top (px)",value:String(u.boxShadow.top),onChange:x=>g("top",Number(x)),type:"number"}),t.jsxRuntimeExports.jsx(t.Input,{label:"Blur (px)",value:String(u.boxShadow.blur),onChange:x=>g("blur",Number(x)),type:"number"}),t.jsxRuntimeExports.jsx("div",{style:{flex:1,whiteSpace:"nowrap"},children:t.jsxRuntimeExports.jsx(t.Input,{label:"Spread (px)",value:String(u.boxShadow.spread),onChange:x=>g("spread",Number(x)),type:"number"})})]}),t.jsxRuntimeExports.jsx(Fe,{initialColor:u.boxShadow.color,onChange:x=>g("color",x),title:"Color",labelStyle:"secondary",isGradientActive:!1})]}),t.jsxRuntimeExports.jsxs("div",{className:ke.alignments,children:[t.jsxRuntimeExports.jsx("h4",{className:ke.label,children:"Alignment Type"}),t.jsxRuntimeExports.jsx("div",{className:ke.blocks,children:tu.map(x=>t.jsxRuntimeExports.jsx("div",{className:t.clx(ke.alignment,{[ke.active]:u.alignment===x}),onClick:()=>{l(x,"alignment")},children:t.jsxRuntimeExports.jsx(t.Icon,{name:x==="center"?"AlignCenterHorizontal":x==="left"?"AlignLeft":"AlignRight",fill:u.alignment===x?"#252525":"#757575"})},x))})]}),t.jsxRuntimeExports.jsx(t.Switch,{label:"Enable Hover",onChange:x=>l(x,"hover"),current:u.hover}),u.hover&&t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(Fe,{initialColor:u.colorHover,onChange:x=>l(x,"colorHover"),title:"Hover Text Color",labelStyle:"secondary",isGradientActive:!1}),t.jsxRuntimeExports.jsx(Fe,{initialColor:u.backgroundHover,onChange:x=>l(x,"backgroundHover"),title:"Hover Background Color",labelStyle:"secondary",isGradientActive:!0})]})]})]})},ou="_category_hxy9u_1",ru="_categoryTitle_hxy9u_19",Zn={category:ou,categoryTitle:ru},su=()=>{const{themeSettings:e,setActiveColorCategory:n}=t.useThemeSettingsStore();function o(r){n(r)}return t.jsxRuntimeExports.jsx("div",{className:Zn.wrapper,children:Object.keys(e.colors).map(r=>r==="icon"?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{}):t.jsxRuntimeExports.jsxs("div",{className:Zn.category,onClick:()=>o(r),children:[t.jsxRuntimeExports.jsxs("h2",{className:Zn.categoryTitle,children:[r==="text"?"Text & Icon":Qe(r)," Colors"]}),t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretRight",width:24,height:24})]},r))})},iu="_options_ikvjo_38",au={options:iu},lu=()=>{const{activeBlock:e,setActiveFont:n,activeFont:o,themeSettings:r,updateFont:i}=t.useThemeSettingsStore(),{fonts:s}=t.useFontsStore(),[a,l]=C.useState(null);function c(){n(null)}function p(x,y){a&&o&&i("desktop",a,o,y,x)}const[u,d]=C.useState([]),h=C.useMemo(()=>o?r.fonts.desktop.heading[o]?(l("heading"),r.fonts.desktop.heading[o]):r.fonts.desktop.body[o]?(l("body"),r.fonts.desktop.body[o]):(l(null),null):null,[o,r]);C.useEffect(()=>{if(h){const x=s.find(y=>y.name===h.font);x&&(d(x.weights),x.weights.includes(h.boldWeight)||p("400","boldWeight"),x.weights.includes(h.weight)||p("400","weight"))}},[h,o]);const m=!!((e==null?void 0:e.name)==="Fonts"&&o),g=(e==null?void 0:e.name)!=="Fonts"||!o;return t.jsxRuntimeExports.jsxs(rn,{isOpen:m,isClose:g,children:[t.jsxRuntimeExports.jsx(on,{onClick:c,title:"Font Style"}),o&&h&&t.jsxRuntimeExports.jsxs("div",{className:au.options,children:[t.jsxRuntimeExports.jsx(t.Select,{label:"Font",value:h.font,onChange:x=>p(x,"font"),options:[...s.filter(x=>x.name!==h.font).map(x=>x.name)]}),t.jsxRuntimeExports.jsx(t.Select,{label:"Size",value:String(h.size),onChange:x=>p(x,"size"),options:Nn}),t.jsxRuntimeExports.jsx(t.Select,{label:"Default Weight",value:String(h.weight),onChange:x=>p(x,"weight"),options:u}),t.jsxRuntimeExports.jsx(t.Select,{label:"Bold Weight",value:String(h.boldWeight),onChange:x=>p(x,"boldWeight"),options:u}),t.jsxRuntimeExports.jsx(t.Select,{label:"Case",value:String(h.case).charAt(0).toUpperCase()+String(h.case).slice(1),onChange:x=>p(x.toLowerCase(),"case"),options:["Normal","Uppercase","Lowercase","Capitalize"].filter(x=>x.toLowerCase()!==String(h.case))})]})]})},cu="_wrapper_mkmxa_1",uu="_category_mkmxa_5",pu="_categoryTitle_mkmxa_11",du="_font_mkmxa_17",mu="_content_mkmxa_32",hu="_icon_mkmxa_39",xu="_paragraph_mkmxa_50",it={wrapper:cu,category:uu,categoryTitle:pu,font:du,content:mu,icon:hu,paragraph:xu},gu={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",h7:"h7",lg:"large",md:"medium",sm:"small"},fu=e=>{const{font:n,size:o,id:r,category:i}=e,{setActiveFont:s}=t.useThemeSettingsStore();return t.jsxRuntimeExports.jsxs("div",{className:it.font,onClick:()=>s(r),children:[t.jsxRuntimeExports.jsx("div",{className:t.clx(it.icon,{[it.paragraph]:i==="paragraph"}),children:t.jsxRuntimeExports.jsx(t.Icon,{name:i==="paragraph"?"TextB":"TextH"})}),t.jsxRuntimeExports.jsxs("div",{className:it.content,children:[t.jsxRuntimeExports.jsx("h2",{className:it.categoryTitle,children:Qe(gu[r])}),t.jsxRuntimeExports.jsx("span",{className:it.value,children:`${n}, ${o}px`})]})]})},Iu=()=>{const{themeSettings:e,setActiveFont:n,activeBlock:o}=t.useThemeSettingsStore();C.useEffect(()=>(r(),()=>{r()}),[]);function r(){n(null)}if(o!=null&&o.name)return t.jsxRuntimeExports.jsx("div",{className:it.wrapper,children:Object.entries(e.fonts.desktop).sort(([i],[s])=>i==="heading"?-1:s==="heading"?1:0).map(([i,s])=>t.jsxRuntimeExports.jsxs("div",{className:it.category,children:[t.jsxRuntimeExports.jsx("h2",{className:it.categoryTitle,children:Qe(i)}),Object.entries(s).map(([a,l])=>t.jsxRuntimeExports.jsx(fu,{id:a,category:i,...l},a))]},i))})},ju="_wrapper_16ym0_2",Su="_categoryTitle_16ym0_12",yu="_title_16ym0_74",Cu="_field_16ym0_82",ku="_alignments_16ym0_92",bu="_lineField_16ym0_98",_u="_style_16ym0_106",wu="_header_16ym0_113",Ue={wrapper:ju,categoryTitle:Su,title:yu,field:Cu,alignments:ku,lineField:bu,style:_u,header:wu},Eu="_blocks_emecf_1",vu="_block_emecf_1",Ru="_active_emecf_21",Xn={blocks:Eu,block:vu,active:Ru},Zo=e=>{const{items:n,selectedItem:o,onSelect:r,getIconName:i}=e;return t.jsxRuntimeExports.jsx("div",{className:Xn.blocks,children:n.map(s=>t.jsxRuntimeExports.jsx("div",{className:t.clx(Xn.block,{[Xn.active]:o===s}),onClick:()=>r(s),children:t.jsxRuntimeExports.jsx(t.Icon,{name:i(s),fill:o===s?"#252525":"#757575"})},String(s)))})},Nu=["left","center","right"],Tu=["solid","dashed"],Gt=e=>{const{title:n,children:o,rightAddon:r}=e;return t.jsxRuntimeExports.jsxs("div",{className:Ue.field,children:[t.jsxRuntimeExports.jsxs("div",{className:Ue.header,children:[t.jsxRuntimeExports.jsx("h4",{className:Ue.categoryTitle,children:n}),r]}),o]})},Pu=()=>{const{themeSettings:e,updateInput:n}=t.useThemeSettingsStore(),o=C.useMemo(()=>e.inputs,[e]),r=(s,a,l)=>{n(s,a,l)},i=s=>a=>{n(s,a,"color")};return t.jsxRuntimeExports.jsxs("div",{className:Ue.wrapper,children:[t.jsxRuntimeExports.jsxs(Gt,{title:"General",children:[t.jsxRuntimeExports.jsx(t.Input,{label:"Height (px)",value:String(o.general.height),onChange:s=>r("general",s,"height"),type:"number",min:0}),t.jsxRuntimeExports.jsx(t.Select,{label:"Font Size (px)",onChange:s=>r("general",s,"size"),value:String(o.general.size),options:Nn}),t.jsxRuntimeExports.jsx(Fe,{initialColor:Qe(o.general.color),onChange:i("general"),title:"Font Color",labelStyle:"secondary",isGradientActive:!1})]}),t.jsxRuntimeExports.jsx(Gt,{title:"Field Fill",rightAddon:t.jsxRuntimeExports.jsx("div",{className:Ue.switch,children:t.jsxRuntimeExports.jsx(t.Switch,{onChange:s=>r("field",s,"active"),current:o.field.active})}),children:t.jsxRuntimeExports.jsx(Fe,{initialColor:o.field.color,onChange:i("field"),title:"Color",labelStyle:"secondary"})}),t.jsxRuntimeExports.jsx(Gt,{title:"Placeholder",children:t.jsxRuntimeExports.jsx(Fe,{initialColor:Qe(o.placeholder.color),onChange:i("placeholder"),title:"Font Color",labelStyle:"secondary",isGradientActive:!1})}),t.jsxRuntimeExports.jsxs(Gt,{title:"Border",rightAddon:t.jsxRuntimeExports.jsx("div",{className:Ue.switch,children:t.jsxRuntimeExports.jsx(t.Switch,{onChange:s=>r("border",s,"active"),current:o.border.active})}),children:[t.jsxRuntimeExports.jsxs("div",{className:Ue.lineField,children:[t.jsxRuntimeExports.jsxs("div",{className:Ue.style,children:[t.jsxRuntimeExports.jsx("span",{className:Ue.title,children:"Style"}),t.jsxRuntimeExports.jsx(Zo,{items:Tu,selectedItem:o.border.style,onSelect:s=>r("border",s,"style"),getIconName:s=>s==="solid"?"Minus":"Selection"})]}),t.jsxRuntimeExports.jsx(t.Input,{label:"Radius (px)",value:String(o.border.radius),onChange:s=>r("border",s,"radius"),type:"number",min:0})]}),t.jsxRuntimeExports.jsx(t.Input,{label:"Thickness (px)",value:String(o.border.thickness),onChange:s=>r("border",s,"thickness"),type:"number",min:0}),t.jsxRuntimeExports.jsx(Fe,{initialColor:Qe(o.border.color),onChange:i("border"),title:"Color",labelStyle:"secondary",isGradientActive:!1})]}),t.jsxRuntimeExports.jsxs(Gt,{title:"Label",children:[t.jsxRuntimeExports.jsx(t.Input,{label:"Line Height (px)",value:String(o.label.height),onChange:s=>r("label",s,"height"),type:"number",min:0}),t.jsxRuntimeExports.jsx(t.Select,{label:"Font Size (px)",onChange:s=>r("label",s,"size"),value:String(o.label.size),options:Nn}),t.jsxRuntimeExports.jsx(Fe,{initialColor:Qe(o.label.color),onChange:i("label"),title:"Color",labelStyle:"secondary",isGradientActive:!1}),t.jsxRuntimeExports.jsxs("div",{className:Ue.alignments,children:[t.jsxRuntimeExports.jsx("h4",{className:Ue.title,children:"Alignment Type"}),t.jsxRuntimeExports.jsx(Zo,{items:Nu,selectedItem:o.label.alignment,onSelect:s=>r("label",s,"alignment"),getIconName:s=>s==="center"?"AlignCenterHorizontal":s==="left"?"AlignLeft":"AlignRight"})]})]})]})},Lu="_wrapper_1yw63_2",Au="_color_1yw63_24",Bu="_content_1yw63_33",Mu="_preview_1yw63_42",Fu="_container_1yw63_52",Du="_buttonWrapper_1yw63_62",$u="_button_1yw63_62",Ou="_buttonBorder_1yw63_80",Hu="_buttonBackground_1yw63_83",zu="_text_1yw63_87",Uu="_textText_1yw63_93",Wu="_icon_1yw63_97",Vu="_iconIcon_1yw63_100",Gu="_annotation_1yw63_104",qu="_annotationText_1yw63_111",Zu="_label_1yw63_116",Xu="_circle_1yw63_127",Yu="_line_1yw63_140",Ku="_circle1_1yw63_154",Ju="_circle2_1yw63_159",Qu="_annotationIcon_1yw63_164",ep="_annotationBorder_1yw63_192",tp="_line1_1yw63_203",np="_line2_1yw63_210",op="_circle3_1yw63_227",rp="_circle4_1yw63_232",sp="_annotationSurface_1yw63_237",F={wrapper:Lu,color:Au,content:Bu,preview:Mu,container:Fu,buttonWrapper:Du,button:$u,buttonBorder:Ou,buttonBackground:Hu,text:zu,textText:Uu,icon:Wu,iconIcon:Vu,annotation:Gu,annotationText:qu,label:Zu,circle:Xu,line:Yu,circle1:Ku,circle2:Ju,annotationIcon:Qu,annotationBorder:ep,line1:tp,line2:np,circle3:op,circle4:rp,annotationSurface:sp},ip=()=>{const{activeColorCategory:e}=t.useThemeSettingsStore();return t.jsxRuntimeExports.jsx("div",{className:F.container,children:t.jsxRuntimeExports.jsxs("div",{className:F.buttonWrapper,children:[t.jsxRuntimeExports.jsxs("div",{className:t.clx(F.button,{[F.buttonBorder]:e==="border",[F.buttonBackground]:e==="surface"}),children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Smiley",className:t.clx(F.icon,{[F.iconIcon]:e==="text"}),width:22,height:22,fill:"#757575"}),t.jsxRuntimeExports.jsx("span",{className:t.clx(F.text,{[F.textText]:e==="text"}),children:"Button Example"})]}),e==="text"&&t.jsxRuntimeExports.jsxs("div",{className:t.clx(F.annotation,F.annotationText),children:[t.jsxRuntimeExports.jsx("div",{className:F.label,children:"Text Color"}),t.jsxRuntimeExports.jsx("div",{className:F.line}),t.jsxRuntimeExports.jsx("div",{className:t.clx(F.circle,F.circle1)}),t.jsxRuntimeExports.jsx("div",{className:t.clx(F.circle,F.circle2)})]}),e==="text"&&t.jsxRuntimeExports.jsxs("div",{className:t.clx(F.annotation,F.annotationIcon),children:[t.jsxRuntimeExports.jsx("div",{className:F.label,children:"Icon Color"}),t.jsxRuntimeExports.jsx("div",{className:F.line}),t.jsxRuntimeExports.jsx("div",{className:t.clx(F.circle,F.circle1)}),t.jsxRuntimeExports.jsx("div",{className:t.clx(F.circle,F.circle2)})]}),e==="border"&&t.jsxRuntimeExports.jsxs("div",{className:t.clx(F.annotation,F.annotationBorder),children:[t.jsxRuntimeExports.jsx("div",{className:F.label,children:"Border Color"}),t.jsxRuntimeExports.jsx("div",{className:t.clx(F.line,F.line1)}),t.jsxRuntimeExports.jsx("div",{className:t.clx(F.line,F.line2)}),t.jsxRuntimeExports.jsx("div",{className:t.clx(F.circle,F.circle1)}),t.jsxRuntimeExports.jsx("div",{className:t.clx(F.circle,F.circle2)}),t.jsxRuntimeExports.jsx("div",{className:t.clx(F.circle,F.circle3)}),t.jsxRuntimeExports.jsx("div",{className:t.clx(F.circle,F.circle4)})]}),e==="surface"&&t.jsxRuntimeExports.jsxs("div",{className:t.clx(F.annotation,F.annotationSurface),children:[t.jsxRuntimeExports.jsx("div",{className:F.label,children:"Surface Color"}),t.jsxRuntimeExports.jsx("div",{className:F.line}),t.jsxRuntimeExports.jsx("div",{className:t.clx(F.circle,F.circle1)}),t.jsxRuntimeExports.jsx("div",{className:t.clx(F.circle,F.circle2)})]})]})})},ap={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"]},lp=()=>{const{activeBlock:e,setActiveColorCategory:n,activeColorCategory:o,themeSettings:r,updateColor:i}=t.useThemeSettingsStore();function s(){n(null)}function a(u,d,h){i(u,d,h)}const l=!!((e==null?void 0:e.name)==="Colors"&&o),c=(e==null?void 0:e.name)!=="Colors"||!o,p=o?ap[o]:[];return t.jsxRuntimeExports.jsxs(rn,{isOpen:l,isClose:c,children:[t.jsxRuntimeExports.jsx(on,{onClick:s,title:o==="text"?"Text & Icon Colors":`${Qe(o)} Colors`}),o&&t.jsxRuntimeExports.jsxs("div",{className:F.wrapper,children:[t.jsxRuntimeExports.jsx(ip,{}),p.map(u=>{const d=r.colors[o][u];return typeof d!="string"?null:t.jsxRuntimeExports.jsx("div",{className:F.color,children:t.jsxRuntimeExports.jsxs("div",{className:F.content,children:[t.jsxRuntimeExports.jsx("div",{className:F.preview,style:{background:d}}),t.jsxRuntimeExports.jsx(Fe,{title:Qe(u),initialColor:d,onChange:h=>a(o,u,h),isGradientActive:o==="surface"})]})},u)})]})]})},cp="_loader_1p5lr_1",up={loader:cp},pp=()=>{const{activeBlock:e,themeSettings:n,isLoadingThemeSettings:o}=t.useThemeSettingsStore();return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:o?t.jsxRuntimeExports.jsx("div",{className:up.loader,children:t.jsxRuntimeExports.jsx(mt,{})}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[(e==null?void 0:e.name)==="Fonts"&&n.fonts&&t.jsxRuntimeExports.jsx(Iu,{}),(e==null?void 0:e.name)==="Fonts"&&n.fonts&&t.jsxRuntimeExports.jsx(lu,{}),(e==null?void 0:e.name)==="Colors"&&n.colors&&t.jsxRuntimeExports.jsx(su,{}),(e==null?void 0:e.name)==="Colors"&&n.colors&&t.jsxRuntimeExports.jsx(lp,{}),(e==null?void 0:e.name)==="Inputs"&&n.inputs&&t.jsxRuntimeExports.jsx(Pu,{}),(e==null?void 0:e.name)==="Borders"&&n.borders&&t.jsxRuntimeExports.jsx(Hc,{}),(e==null?void 0:e.name)==="Buttons"&&n.buttons&&t.jsxRuntimeExports.jsx(nu,{})]})})},dp=()=>{const{activeBlock:e,setActiveBlock:n}=t.useThemeSettingsStore(),{activeBlock:o}=t.useNavbarStore(),r=t.useNavigate();function i(){n(null),r("/admin/builder/theme")}const s=!!e,a=!e||o.name!=="Theme";return t.jsxRuntimeExports.jsxs(rn,{isOpen:s,isClose:a,children:[t.jsxRuntimeExports.jsx(on,{onClick:i,title:(e==null?void 0:e.name)||""}),t.jsxRuntimeExports.jsx(pp,{})]})},mp=()=>{const{activeBlock:e}=t.useNavbarStore(),{showTooltip:n}=t.useTooltipStore();function o(){switch(e.name){case"Layers":return"Layers";case"Add":return"Add Sections";case"Theme":return"Theme Settings";case"Settings":return"Settings"}}return t.jsxRuntimeExports.jsxs("div",{className:qo.sidebar,style:{zIndex:n?50:"auto"},children:[t.jsxRuntimeExports.jsx("h3",{className:qo.title,children:o()}),e.name==="Layers"&&t.jsxRuntimeExports.jsx(ec,{}),e.name==="Add"&&t.jsxRuntimeExports.jsx(Gr,{}),t.jsxRuntimeExports.jsx(Pc,{}),t.jsxRuntimeExports.jsx(dp,{}),e.name==="Theme"&&t.jsxRuntimeExports.jsx(cc,{}),e.name==="Settings"&&t.jsxRuntimeExports.jsx(oc,{})]})},hp="_wrapper_no6if_1",xp="_header_no6if_12",gp="_content_no6if_23",fp="_buttons_no6if_44",Ip="_label_no6if_51",jp="_description_no6if_52",Sp="_preview_no6if_60",yp="_block_no6if_66",Cp="_slug_no6if_75",kp="_title_no6if_81",bp="_closeIcon_no6if_87",He={wrapper:hp,header:xp,content:gp,buttons:fp,label:Ip,description:jp,preview:Sp,block:yp,slug:Cp,title:kp,closeIcon:bp},_p=()=>{var H,O,N,v,P,B,M;const{setIsOpenModal:e,pages:n,createPage:o,updatePage:r,isEdit:i,setIsEdit:s,editedPage:a,setEditedPage:l,pageContext:c}=t.usePagesStore(),{setIsOpen:p}=t.useModalStore(),{createPage:u,updatePage:d}=t.useLayersStore(),[h,m]=C.useState(a?n&&((H=n[a])==null?void 0:H.path):""),[g,x]=C.useState(a?n&&((O=n[a])==null?void 0:O.name):""),[y,f]=C.useState(a?n&&((N=n[a])==null?void 0:N.seo)&&((P=(v=n[a])==null?void 0:v.seo)==null?void 0:P.pageDescription)||"":`${c.general.info.name} is powered by the Billgang.com platform which allows them to sell their digital products online for free.`),[_,S]=C.useState(a&&n&&(B=n[a])!=null&&B.isPrivate?"private":"public");function E(){m(""),x(""),f(""),S("public"),s(!1),l(null)}function b(){p(!1),setTimeout(()=>{E(),e(!1),p(!0)},300)}C.useEffect(()=>()=>{b()},[]);function k(U){return U[0]==="/"?U:"/"+U}function L(){o({path:k(h),name:g||h||"",icon:"File",seo:{pageTitle:g||"",pageDescription:y||""},visibility:_||"public"}),u(k(h)),b()}function $(){n&&(t.defaultPagePaths.includes(n[a].path)||Wr(n[a].path),d(n[a].path||"",h||""),r(a,{path:k(h),name:g||h,icon:n[a].icon||"File",seo:{pageTitle:g||"",pageDescription:y||""},visibility:_||"public"})),b()}return t.jsxRuntimeExports.jsxs("div",{className:He.wrapper,onClick:U=>U.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:He.header,children:[t.jsxRuntimeExports.jsx("h2",{children:i?"Edit Page":"Create New Page"}),t.jsxRuntimeExports.jsx("div",{className:He.closeIcon,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"X",fill:"#757575",hoverable:!0,onClick:b})})]}),t.jsxRuntimeExports.jsxs("div",{className:He.content,children:[t.jsxRuntimeExports.jsx(t.Input,{label:"Page Slug",onChange:U=>m(U),value:h,placeholder:"path-to-page",disabled:!!(a&&n&&((M=n[a])!=null&&M.name)&&t.defaultPagePaths.includes(n[a].path)),required:!0,regex:"^.+$"}),t.jsxRuntimeExports.jsx(t.Input,{label:"Page Title",onChange:U=>{x(U)},value:g.charAt(0).toUpperCase()+g.slice(1),placeholder:"Contact us"}),t.jsxRuntimeExports.jsx(t.Textarea,{label:"Description",onChange:U=>f(U),value:y,placeholder:`${c.general.info.name} is powered by the Billgang.com platform which allows them to sell their digital products online for free.`,maxLength:150}),t.jsxRuntimeExports.jsxs("div",{className:He.preview,children:[t.jsxRuntimeExports.jsx("span",{className:He.label,children:"Preview"}),t.jsxRuntimeExports.jsxs("div",{className:He.block,children:[t.jsxRuntimeExports.jsx("span",{className:He.slug,children:h||"yoursite.url"}),t.jsxRuntimeExports.jsx("span",{className:He.title,children:g||"My Blank Page"}),t.jsxRuntimeExports.jsx("span",{className:He.description,children:y||"It is My Description"})]})]})]}),t.jsxRuntimeExports.jsxs("div",{className:He.buttons,children:[t.jsxRuntimeExports.jsx(t.Button,{onClick:b,type:"Secondary",children:"Cancel"}),t.jsxRuntimeExports.jsx(t.Button,{onClick:i?$:L,disabled:h.length===0,children:i?"Update":"Create"})]})]})},wp="_layout_1pjho_1",Ep="_main_1pjho_10",vp="_content_1pjho_18",Rp="_notifications_1pjho_26",fn={layout:wp,main:Ep,content:vp,notifications:Rp},Np="_notification_2jmah_1",Tp="_text_2jmah_22",Pp="_timer_2jmah_27",Lp="_warning_2jmah_32",Ap="_error_2jmah_37",Bp="_success_2jmah_42",Et={notification:Np,text:Tp,timer:Pp,warning:Lp,error:Ap,success:Bp},Xo={warning:"#C1972A",error:"#FF3F19",success:"#338B13"},qr=e=>{const{type:n,message:o,style:r,padding:i,timer:s,id:a,element:l}=e,[c,p]=C.useState(s),{setNotifications:u}=t.useNotificationStore();function d(){const m=t.useNotificationStore.getState().notifications.filter(g=>g.id!==a);u([...m])}return C.useEffect(()=>{const h=setTimeout(()=>{d()},s*1e3);return()=>clearTimeout(h)},[s]),C.useEffect(()=>{const h=setInterval(()=>p(m=>m-1),1e3);return()=>clearInterval(h)},[c]),l?l({type:n,message:o,style:r,padding:i,timer:s,id:a}):t.jsxRuntimeExports.jsx("div",{style:{padding:i,position:"relative"},children:t.jsxRuntimeExports.jsxs("div",{className:t.clx(Et.notification,{[Et.warning]:n==="warning",[Et.error]:n==="error",[Et.success]:n==="success"}),style:r,children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Info",fill:Xo[n],width:20,height:20})}),t.jsxRuntimeExports.jsx("div",{className:Et.text,children:o}),s&&t.jsxRuntimeExports.jsx("div",{className:Et.timer,children:c}),t.jsxRuntimeExports.jsx("div",{style:{display:"flex"},children:t.jsxRuntimeExports.jsx(t.Icon,{name:"X",fill:Xo[n],width:20,height:20,hoverable:!0,onClick:()=>d()})})]})})},Mp="_modal_1h74q_1",Fp="_title_1h74q_14",Dp="_buttons_1h74q_20",In={modal:Mp,title:Fp,buttons:Dp},Zr=()=>{const{title:e,description:n,onConfirm:o,setTitle:r,setDescription:i,setOnConfirm:s}=t.useConfirmationModalStore(),{setIsOpen:a}=t.useModalStore();function l(){a(!1),setTimeout(()=>{r(null),i(null),s(null),a(!0)},300)}return e&&n&&o&&t.jsxRuntimeExports.jsxs("div",{className:In.modal,onClick:c=>c.stopPropagation(),children:[t.jsxRuntimeExports.jsx("div",{className:In.title,children:e}),t.jsxRuntimeExports.jsx("div",{className:In.description,children:n}),t.jsxRuntimeExports.jsxs("div",{className:In.buttons,children:[t.jsxRuntimeExports.jsx(t.Button,{onClick:l,children:"Cancel"}),t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>{o(),l()},type:"Secondary",children:"Confirm"})]})]})},$p="_modal_270ti_1",Op="_padding_270ti_17",Hp="_content_270ti_21",zp="_close_270ti_42",jn={modal:$p,padding:Op,content:Hp,close:zp},En=e=>{const{close:n,children:o,withAnimation:r=!0,hasPadding:i=!0}=e,{isOpen:s,setIsOpen:a}=t.useModalStore();return C.useEffect(()=>{const l=()=>{a(!1),r?setTimeout(()=>{n(!1),a(!0)},300):(n(!1),a(!0))};return document.body.addEventListener("click",l),()=>{document.body.removeEventListener("click",l)}},[]),t.jsxRuntimeExports.jsx("div",{className:t.clx(jn.modal,{[jn.padding]:i}),children:r?t.jsxRuntimeExports.jsx("div",{className:t.clx(jn.content,{[jn.close]:!s}),children:o}):t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:o})})},Up=()=>{const{isOpenModal:e,setIsOpenModal:n}=t.usePagesStore(),{openModal:o,setOpenModal:r}=t.useChooseImageStore(),{notifications:i}=t.useNotificationStore(),{title:s,description:a,setTitle:l,setDescription:c,setOnConfirm:p}=t.useConfirmationModalStore();return t.jsxRuntimeExports.jsxs("div",{id:"builder",children:[t.jsxRuntimeExports.jsxs("div",{className:fn.layout,children:[t.jsxRuntimeExports.jsx(Ra,{}),t.jsxRuntimeExports.jsxs("main",{className:fn.main,children:[t.jsxRuntimeExports.jsx(Sa,{}),t.jsxRuntimeExports.jsxs("div",{className:fn.content,children:[t.jsxRuntimeExports.jsx(mp,{}),t.jsxRuntimeExports.jsx(Ll,{})]})]})]}),s&&a&&t.jsxRuntimeExports.jsx(En,{close:()=>{l(null),c(null),p(null)},children:t.jsxRuntimeExports.jsx(Zr,{})}),e&&t.jsxRuntimeExports.jsx(En,{close:n,children:t.jsxRuntimeExports.jsx(_p,{})}),o&&t.jsxRuntimeExports.jsx(En,{close:r,children:t.jsxRuntimeExports.jsx(t.ChooseImageModal,{})}),i.length>0&&t.jsxRuntimeExports.jsx("div",{className:fn.notifications,children:i.map(u=>t.jsxRuntimeExports.jsx(qr,{type:u.status,message:u.message,timer:u.timer||10,id:u.id,element:u.component},u.id))})]})};async function vt(e,n){const o=localStorage.getItem("shopId")||void 0,i=`${t.useApiStore.getState().apiUrls.api}/${e}/builder/shops/${o}/${n}`;return(await t.request({url:i,withToken:!0,method:"get"})).data}async function Wp(){try{const[e,n,o,r,i,s,a,l]=await Promise.allSettled([vt("v1","general"),vt("v1","faqs"),vt("v1","listings"),vt("v1","products"),vt("v1","reviews"),vt("v1","categories"),{data:null},{data:null}]);return{general:e,faqs:n,listings:o,products:r,reviews:i,categories:s,fullPosts:a,posts:l}}catch(e){throw console.error("Error fetching page data:",e),e}}async function Vp(){const e=t.useApiStore.getState().apiUrls;try{const{data:n}=await t.axios.get(`${e.googleFonts}?key=AIzaSyAEsTbjAPUz_TeuFCq4z4LPK9w_vst0Pfw`);return n.items}catch(n){throw console.error("Error fetching page data:",n),n}}async function Gp(){var i;const e=localStorage.getItem("shopId"),n=localStorage.getItem("draftId"),r=`${t.useApiStore.getState().apiUrls.api}/v2/builder/shops/${e}/drafts/${n}/pages`;try{return(await t.request({url:r,withToken:!0,method:"get"})).data}catch(s){return{data:[],status:(i=s.response)==null?void 0:i.status}}}async function qp(){const e=localStorage.getItem("shopId")||void 0,n=localStorage.getItem("draftId")||void 0,r=`${t.useApiStore.getState().apiUrls.api}/v2/builder/shops/${e}/drafts/${n}/all`;return(await t.request({url:r,withToken:!0,method:"get"})).data}const Zp=e=>{const{blocks:n,settings:o,header:r,footer:i,announcement:s}=e,{setBlocks:a,setSourceBlocks:l,setHeader:c,setFooter:p,setAnnouncement:u,setSettings:d}=t.useBlocksStore(),{fonts:h,setFonts:m}=t.useFontsStore(),{setSettings:g}=t.useSettingsStore(),{setPageContext:x}=t.usePagesStore(),{setThemeSettings:y,setIsLoadingThemeSettings:f}=t.useThemeSettingsStore(),{setIsLoadingSettings:_}=t.useSettingsStore(),{notifications:S,setNotifications:E}=t.useNotificationStore(),{setBlocks:b,blocks:k,createPage:L,setIsLoadingLayers:$,setHeader:H,setAnnouncement:O,setFooter:N}=t.useLayersStore(),{setPages:v,setCurrentPage:P}=t.usePagesStore();return C.useEffect(()=>{f(!0),$(!0),_(!0);const B={};Object.keys(n).forEach(U=>{B[U]=n[U]}),l(B),a(B),c(r),p(i),u(s),d(o),(async()=>{const U={listings:null,products:null,reviews:null,categories:null,faqs:null,general:null,fullPosts:null,posts:null},A=await Wp();Object.keys(A).map(ee=>{const he=ee;U[he]=A[he].value.data}),x(U);const{data:D}=await qp(),{themeSettings:Q,layers:I,settings:J}=D||{};if(J){if(J.settings){const ee=new o;ee.blockSettings={displayName:"Settings",isAddable:!1,...J.settings},g(ee.blockSettings)}J.header&&H(J.header),J.footer&&N(J.footer),J.announcement&&O(J.announcement)}else{const ee=new o;g(ee.blockSettings)}Q&&y(Q);const ge=await Gp(),j={};if(ge.status>=400&&E([...S,{id:t.v4(),message:"Error fetching pages",status:"error"}]),ge.data.length>0?(ge.data.forEach(ee=>{var he,q;k[ee.path]||L(ee.path),j[ee.id||ee.path]={...ee,icon:t.pages[ee.path]?t.pages[ee.path].icon:"File",name:ee.name||((he=ee.seo)==null?void 0:he.pageTitle)||((q=t.pages[ee.path])==null?void 0:q.name)||ee.path}}),v(j),P(Object.keys(j)[0])):(v(t.pages),P(Object.keys(t.pages)[0])),h.length===0){const ee=await Vp();m([...ee.map(he=>{const q=he.variants.map(je=>{if(!je.includes("italic"))return je==="regular"?"400":je}).filter(je=>je!==void 0);return{name:he.family,weights:q}})])}b(I),f(!1),$(!1),_(!1)})()},[]),t.jsxRuntimeExports.jsx(Up,{})};function Xp(){const e=new URL(window.location.href);window.history.replaceState(null,"",e.pathname+e.hash)}function Yp(){const e=new URLSearchParams(document.location.search),n=e.get("shopId")||localStorage.getItem("shopId"),o=e.get("sellerAccessToken")||localStorage.getItem("sellerAccessToken"),r=e.get("draftId")||localStorage.getItem("draftId");return Xp(),o&&localStorage.setItem("sellerAccessToken",o),n&&localStorage.setItem("shopId",n),r&&localStorage.setItem("draftId",r),!!(o&&n&&r)}const Kp="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",Jp=e=>{const{blocks:n,settings:o,header:r,footer:i,announcement:s}=e,[a,l]=C.useState(!0),c=t.useNavigate(),p=t.useLocation();return C.useEffect(()=>{const u=p.pathname;if(u.startsWith("/admin/builder")){u==="/admin/builder/add"?document.title="Add Section | Builder":u==="/admin/builder/theme"?document.title="Theme Settings | Builder":u==="/admin/builder/settings"?document.title="Settings | Builder":document.title="Builder | Billgang";let d=document.querySelector("link[rel~='icon']");d||(d=document.createElement("link"),d.rel="icon",document.head.appendChild(d)),d&&(d.href=Kp)}},[p]),C.useEffect(()=>{l(!0),Yp()?l(!1):c("/")},[]),t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:a?t.jsxRuntimeExports.jsx(mt,{}):t.jsxRuntimeExports.jsx(Zp,{blocks:n,settings:o,header:r,footer:i,announcement:s})})},Qp="_wrapper_1yd2j_1",ed="_error_1yd2j_11",td="_title_1yd2j_21",nd="_buttons_1yd2j_29",qt={wrapper:Qp,error:ed,title:td,buttons:nd},Yo=async e=>{const n=localStorage.getItem("shopId")||void 0,o=localStorage.getItem("draftId"),i=`${t.useApiStore.getState().apiUrls.api}/v2/builder/shops/${n}/drafts/${o}/reset`;return await t.request({url:i,withToken:!0,method:"post",body:e})},od=()=>{const{error:e,setError:n}=t.useErrorStore(),{pages:o}=t.usePagesStore(),{setIsOpen:r}=t.useModalStore(),{title:i,description:s,setOnConfirm:a,setTitle:l,setDescription:c}=t.useConfirmationModalStore(),{setBlocks:p}=t.useLayersStore();async function u(){await Yo({resetSettings:(e==null?void 0:e.failedSettings)??!1,resetThemeSettings:(e==null?void 0:e.failedThemeSettings)??!1,resetPageIds:(e==null?void 0:e.failedPageIds)??[]}),n(null),p({}),window.location.reload()}async function d(){const h=[];o&&Object.keys(o).map(m=>o[m].id).filter(m=>m!==void 0).map(m=>h.push(m)),await Yo({resetSettings:!0,resetThemeSettings:!0,resetPageIds:h}),n(null)}return t.jsxRuntimeExports.jsxs("div",{className:qt.wrapper,children:[t.jsxRuntimeExports.jsxs("div",{className:qt.error,children:[t.jsxRuntimeExports.jsxs("div",{children:[t.jsxRuntimeExports.jsx("div",{className:qt.title,children:"Oops! Something went wrong"}),t.jsxRuntimeExports.jsx("span",{className:qt.message,children:(e==null?void 0:e.message)||""})]}),t.jsxRuntimeExports.jsxs("div",{className:qt.buttons,children:[t.jsxRuntimeExports.jsx(t.Button,{type:"Primary",onClick:u,children:"Reset Settings"}),t.jsxRuntimeExports.jsx(t.Button,{type:"Secondary",onClick:h=>{h.stopPropagation(),l("Reset All Settings"),c("Are you sure you want to reset all settings? This is irreversible."),a(async()=>{await d()})},children:"Reset All Settings"})]})]}),i&&s&&t.jsxRuntimeExports.jsx(En,{close:()=>{r(!1),setTimeout(()=>{l(null),c(null),a(null),r(!0)},300)},children:t.jsxRuntimeExports.jsx(Zr,{})})]})},rd=e=>{const{children:n}=e,{pathname:o}=t.useLocation(),{setActiveBlock:r}=t.useNavbarStore(),{setActiveBlock:i}=t.useThemeSettingsStore(),{setActiveBlock:s}=t.usePreviewStore();return C.useEffect(()=>{switch(s({id:null,neededScroll:!1}),o){case"/admin/builder":r(t.navbarBlocks[0]);break;case"/admin/builder/add":r(t.navbarBlocks[1]);break;case"/admin/builder/theme":r(t.navbarBlocks[2]);break;case"/admin/builder/settings":r(t.navbarBlocks[3]);break;case"/admin/builder/theme/colors":r(t.navbarBlocks[2]),i(We[0]);break;case"/admin/builder/theme/fonts":r(t.navbarBlocks[2]),i(We[1]);break;case"/admin/builder/theme/borders":r(t.navbarBlocks[2]),i(We[2]);break;case"/admin/builder/theme/buttons":r(t.navbarBlocks[2]),i(We[3]);break;case"/admin/builder/theme/inputs":r(t.navbarBlocks[2]),i(We[4]);break}},[o]),t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:n})},sd="_lock_1mxa7_1",id="_wrapper_1mxa7_12",ad="_content_1mxa7_22",ld="_info_1mxa7_31",cd="_buttons_1mxa7_38",ud="_button_1mxa7_38",pd="_input_1mxa7_50",dd="_error_1mxa7_57",Ze={lock:sd,wrapper:id,content:ad,info:ld,buttons:cd,button:ud,input:pd,error:dd},md=()=>{const[e,n]=C.useState(!1),[o,r]=C.useState(!1),[i,s]=C.useState(""),{general:a,setGeneral:l}=t.useGeneralStore(),{setShopPassword:c}=t.useStorefrontStore(),p=t.useLocation(),u=t.useNavigate();C.useEffect(()=>{if(a&&(!a.info.passwordProtected||a.isPasswordValid)){const h=p.state.from==="/validation"?"/":p.state.from;u(h)}},[a]),C.useEffect(()=>{a||(async()=>{var x;n(!0);const m=localStorage.getItem("shopPassword")||"",g=await po(m);if(g.isPasswordValid){const y=((x=p.state)==null?void 0:x.from)||"/";u(y)}g.info.passwordProtected||(localStorage.removeItem("shopPassword"),c("")),l(g),n(!1)})()},[a]);async function d(){var m;n(!0);const h=await po(i);if(!h.isPasswordValid)r(!0);else{localStorage.setItem("shopPassword",i),c(i);const g=((m=p.state)==null?void 0:m.from)||"/";u(g),h.info.passwordProtected||(localStorage.removeItem("shopPassword"),c("")),l(h)}n(!1)}return t.jsxRuntimeExports.jsxs("div",{className:Ze.wrapper,children:[!e&&t.jsxRuntimeExports.jsxs("div",{className:Ze.content,children:[t.jsxRuntimeExports.jsx("div",{className:Ze.lock,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Lock",fill:"var(--text-secondary)",width:64,height:64})}),t.jsxRuntimeExports.jsxs("div",{className:Ze.info,children:[t.jsxRuntimeExports.jsx("h2",{id:"h2",className:Ze.title,children:"The store is password protected"}),t.jsxRuntimeExports.jsx("p",{id:"p",className:Ze.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"})]}),t.jsxRuntimeExports.jsxs("div",{className:Ze.input,children:[t.jsxRuntimeExports.jsx(t.Input$1,{type:"password",onChange:h=>{r(!1),s(h)},value:i,placeholder:"Password",required:!0}),t.jsxRuntimeExports.jsx("span",{className:Ze.error,children:o&&"Incorrect password"})]}),t.jsxRuntimeExports.jsx("div",{className:Ze.buttons,children:t.jsxRuntimeExports.jsx(t.Button$1,{type:"Primary",className:Ze.button,disabled:o,onClick:d,children:"Submit"})})]}),e&&t.jsxRuntimeExports.jsx(t.Loader,{})]})},hd="_notifications_2ywhg_1",xd={notifications:hd},gd=()=>(C.useEffect(()=>{document.title="On Maintenance"},[]),t.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:t.jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",flex:"1",justifyContent:"center",alignItems:"center",gap:"24px"},children:[t.jsxRuntimeExports.jsx("h2",{style:{color:"var(--text-primary)",fontSize:"var(--font-heading-h2-size)"},children:"Temporarily Unavailable"}),t.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."})]})})),fd="_notification_o93uc_1",Id="_accent_o93uc_15",jd="_body_o93uc_23",Sd="_label_o93uc_30",yd="_content_o93uc_36",Cd="_timer_o93uc_41",kd="_warning_o93uc_48",bd="_error_o93uc_53",_d="_success_o93uc_58",It={notification:fd,accent:Id,body:jd,label:Sd,content:yd,timer:Cd,warning:kd,error:bd,success:_d},wd={warning:"Warning",error:"Error",success:"Success"},Ed=({type:e,message:n,style:o,padding:r=0,timer:i=0})=>{const[s,a]=C.useState(i);return C.useEffect(()=>{if(!i)return;const l=setInterval(()=>a(c=>c-1),1e3);return()=>clearInterval(l)},[]),t.jsxRuntimeExports.jsx("div",{style:{padding:r,position:"relative"},children:t.jsxRuntimeExports.jsxs("div",{className:t.clx(It.notification,It[e]),style:o,children:[t.jsxRuntimeExports.jsx("div",{className:It.accent}),t.jsxRuntimeExports.jsx("div",{className:It.body,children:t.jsxRuntimeExports.jsxs("div",{className:It.content,children:[t.jsxRuntimeExports.jsxs("span",{className:It.label,children:[wd[e],":"]})," ",n]})}),i>0&&t.jsxRuntimeExports.jsx("span",{className:It.timer,children:s})]})})},vd=({children:e})=>{const n=t.useLocation(),{token:o,setToken:r}=t.useStorefrontStore(),{dashInfo:i,setDashInfo:s}=t.useCustomerDashboardStore(),{shopPassword:a}=t.useStorefrontStore(),l=t.useNavigate(),[c,p]=t.useSearchParams(),{notifications:u}=t.useNotificationStore(),[d,h]=C.useState(!0),{setCustomerEmail:m}=t.useCartStore(),{setThemeSettings:g,themeSettings:x}=t.useThemeSettingsStore(),{settings:y,setSettings:f}=t.useSettingsStore(),{setHeader:_,setFooter:S,setAnnouncement:E}=t.useLayersStore(),{general:b,setGeneral:k,isAntistock:L}=t.useGeneralStore(),{pageContext:$,setPageContext:H}=t.usePagesStore();t.useTrackingAnalytics((b==null?void 0:b.info.id)||localStorage.getItem("shopId")||"");const O=async()=>{const N=await t.getDynamicPage(encodeURIComponent("/products"),b==null?void 0:b.info.passwordProtected);if(N){const{data:v}=N;H({...$,listings:v.listings})}};return C.useEffect(()=>{const N=localStorage.getItem("token");if(N&&(!o||!i))try{const v=t.jwtDecode(N);s(v),r(N),m(v.email)}catch(v){console.error("Failed to decode token:",v),localStorage.removeItem("token"),r(""),s(null)}},[o,i]),C.useEffect(()=>{const N=c.get("r");N&&(localStorage.setItem("referralCode",N),c.delete("r"),p(c),l({pathname:n.pathname,search:c.toString()},{replace:!0}))},[c,n]),C.useEffect(()=>{!n.pathname.startsWith("/products")&&!n.pathname.startsWith("/admin/builder")&&b&&(b.info.passwordProtected&&a||b.isPasswordValid)&&O()},[b,a]),C.useLayoutEffect(()=>{const N=async()=>{if(h(!0),!b){const P=await po(a);if(!P.isPasswordValid&&!n.pathname.includes("/admin/builder")){l("/validation",{state:{from:n.pathname}});return}if(!P.info.passwordProtected){localStorage.removeItem("shopPassword");const{setShopPassword:B}=t.useStorefrontStore.getState();B("")}k(P)}h(!1)},v=async()=>{h(!0);const{settings:P,theme:B}=(await ji()).data;P?(P.settings&&f(P.settings),P.header&&_(JSON.parse(JSON.stringify(P.header))),P.footer&&S(JSON.parse(JSON.stringify(P.footer))),P.announcement&&E(JSON.parse(JSON.stringify(P.announcement)))):f(y),g(B||x),h(!1)};n.pathname.startsWith("/validation")||N(),v()},[]),L&&(b!=null&&b.info.onHold)?t.jsxRuntimeExports.jsx(gd,{}):n.pathname.startsWith("/admin/builder")?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:e}):t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:d?t.jsxRuntimeExports.jsx("div",{style:{width:"100vw",height:"100vh",display:"flex",justifyContent:"center",alignItems:"center"},children:t.jsxRuntimeExports.jsx(t.Loader,{})}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[e,u.length>0&&t.jsxRuntimeExports.jsx("div",{className:xd.notifications,children:u.map(N=>t.jsxRuntimeExports.jsx(qr,{type:N.status,message:N.message,timer:N.timer||10,id:N.id,element:L?Ed:N.component},N.id))})]})})},Rd=()=>(C.useEffect(()=>{setTimeout(()=>{window.location.reload()},500)},[]),t.jsxRuntimeExports.jsx("div",{style:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},children:t.jsxRuntimeExports.jsx(t.Loader,{})})),Nd="_wrapper_rccv2_1",Td="_content_rccv2_11",Pd="_title_rccv2_21",Yn={wrapper:Nd,content:Td,title:Pd},rt=()=>{const e=t.useNavigate();return t.jsxRuntimeExports.jsx("div",{className:Yn.wrapper,children:t.jsxRuntimeExports.jsxs("div",{className:Yn.content,children:[t.jsxRuntimeExports.jsx("h1",{className:Yn.title,children:"Something went wrong"}),t.jsxRuntimeExports.jsx(t.Button,{type:"Primary",onClick:()=>{e("/")},children:"Go to Home"})]})})},Ld=({children:e,shopDomain:n,shopId:o,shopPassword:r,shopLogo:i})=>{const{setShopDomain:s,setShopId:a,setShopPassword:l,setShopTerms:c,setShopPrivacyPolicy:p,setShopRefundPolicy:u,setShopLogo:d}=t.useStorefrontStore();return C.useLayoutEffect(()=>{const h=async()=>{const{data:x}=await yi();c(x)},m=async()=>{const{data:x}=await ki();p(x)},g=async()=>{const{data:x}=await Ci();u(x)};s(n),a(o),r&&l(r),i&&d(i),h(),m(),g()},[n,o,r]),t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:e})},Ad="_checkoutItemsContainer_1kn61_2",Bd="_innerContainer_1kn61_16",Md="_headerSection_1kn61_22",Fd="_header_1kn61_22",Dd="_productsContainer_1kn61_47",$d="_couponContainer_1kn61_54",Od="_checkoutFooter_1kn61_58",jt={checkoutItemsContainer:Ad,innerContainer:Bd,headerSection:Md,header:Fd,productsContainer:Dd,couponContainer:$d,checkoutFooter:Od},Hd="_checkoutFooter_sum4s_1",zd="_antistock_sum4s_12",Ud="_footerBranding_sum4s_22",Wd="_poweredText_sum4s_27",Vd="_antistockLink_sum4s_31",Gd="_footerNav_sum4s_39",Rt={checkoutFooter:Hd,antistock:zd,footerBranding:Ud,poweredText:Wd,antistockLink:Vd,footerNav:Gd},qd="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",Ge=({className:e})=>{const{shopTerms:n,shopPrivacyPolicy:o,shopRefundPolicy:r,shopLogo:i}=t.useStorefrontStore(),{isAntistock:s}=t.useGeneralStore();return t.jsxRuntimeExports.jsxs("footer",{className:`${Rt.checkoutFooter} ${e} ${s?Rt.antistock:""}`,children:[t.jsxRuntimeExports.jsxs("div",{className:Rt.footerBranding,children:[t.jsxRuntimeExports.jsx("p",{className:Rt.poweredText,id:"md",style:s?{color:"var(--text-action)"}:void 0,children:"Powered by"}),s?t.jsxRuntimeExports.jsxs("a",{className:Rt.antistockLink,href:"https://antistock.io",target:"_blank",rel:"noopener noreferrer",children:[t.jsxRuntimeExports.jsx(t.SvgMiniLogoAntistock,{width:14,height:18}),"Antistock"]}):i||t.jsxRuntimeExports.jsx("img",{src:qd,alt:"Billgang"})]}),t.jsxRuntimeExports.jsx("nav",{children:t.jsxRuntimeExports.jsxs("ul",{className:Rt.footerNav,children:[(n==null?void 0:n.showTermsOfServiceOnProduct)&&!s&&t.jsxRuntimeExports.jsx("li",{children:t.jsxRuntimeExports.jsx("a",{href:n.termsOfService,target:"_blank",rel:"noopener noreferrer",children:"Terms"})}),(o==null?void 0:o.showPrivacyPolicyOnProduct)&&t.jsxRuntimeExports.jsx("li",{children:t.jsxRuntimeExports.jsx("a",{href:o.privacyPolicy,target:"_blank",rel:"noopener noreferrer",children:"Privacy"})}),(r==null?void 0:r.showRefundPolicyOnProduct)&&t.jsxRuntimeExports.jsx("li",{children:t.jsxRuntimeExports.jsx("a",{href:r.refundPolicy,target:"_blank",rel:"noopener noreferrer",children:"Refund"})})]})})]})},Zd="_checkoutHeader_1stm3_1",Xd="_leftContainer_1stm3_20",Yd="_backArrow_1stm3_26",Kd="_logoContainer_1stm3_38",Jd="_logo_1stm3_38",Qd="_antistockLink_1stm3_48",Nt={checkoutHeader:Zd,leftContainer:Xd,backArrow:Yd,logoContainer:Kd,logo:Jd,antistockLink:Qd},em="_activeBadge_1yb5i_1",tm="_activeBadgeText_1yb5i_12",Ko={activeBadge:em,activeBadgeText:tm},nm=({className:e})=>t.jsxRuntimeExports.jsxs("div",{className:t.clx(Ko.activeBadge,e),children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Check",width:20,height:20}),t.jsxRuntimeExports.jsx("p",{className:Ko.activeBadgeText,children:"Active"})]}),om="_timerContainer_rh66p_2",rm="_timerText_rh66p_12",sm="_timerContainerAntistock_rh66p_16",Kn={timerContainer:om,timerText:rm,timerContainerAntistock:sm},im=({expiresAt:e})=>{const[n,o]=C.useState(i()),{isAntistock:r}=t.useGeneralStore();function i(){const s=new Date,a=new Date(e).getTime()-s.getTime();if(a<=0)return{hours:"00",minutes:"00",seconds:"00"};const l=Math.floor(a/(1e3*60*60)),c=Math.floor(a%(1e3*60*60)/(1e3*60)),p=Math.floor(a%(1e3*60)/1e3);return{hours:String(l).padStart(2,"0"),minutes:String(c).padStart(2,"0"),seconds:String(p).padStart(2,"0")}}return C.useEffect(()=>{const s=setInterval(()=>{o(i())},1e3);return()=>clearInterval(s)},[e]),n.hours==="00"&&n.minutes==="00"&&n.seconds==="00"?null:r?t.jsxRuntimeExports.jsxs("div",{className:Kn.timerContainerAntistock,children:[t.jsxRuntimeExports.jsxs("span",{children:[n.hours,":",n.minutes,":",n.seconds]}),t.jsxRuntimeExports.jsx("span",{children:"remaining"})]}):t.jsxRuntimeExports.jsxs("div",{className:Kn.timerContainer,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Clock"}),t.jsxRuntimeExports.jsxs("p",{className:Kn.timerText,id:"md",children:[n.hours,":",n.minutes,":",n.seconds]})]})},am="_progressBar_mcabf_4",lm="_progressBarLabel_mcabf_12",cm="_progressBarTrack_mcabf_17",um="_progressBarFill_mcabf_28",Sn={progressBar:am,progressBarLabel:lm,progressBarTrack:cm,progressBarFill:um},Xr=({color:e,percent:n,disablePercentLabel:o})=>t.jsxRuntimeExports.jsxs("div",{className:Sn.progressBar,children:[!o&&t.jsxRuntimeExports.jsxs("p",{className:Sn.progressBarLabel,children:[n,"%"]}),t.jsxRuntimeExports.jsx("div",{className:Sn.progressBarTrack,children:t.jsxRuntimeExports.jsx("div",{style:{width:`${n}%`,background:e||void 0},className:Sn.progressBarFill})})]}),pm="_rating_1bpps_4",dm="_disabled_1bpps_9",mm="_ratingStar_1bpps_14",hm="_inactive_1bpps_22",yn={rating:pm,disabled:dm,ratingStar:mm,inactive:hm},xm=({setRating:e,rating:n,disabled:o})=>{const[r,i]=C.useState(0),s=l=>{o||i(+l.currentTarget.id)},a=l=>{o||e(l)};return t.jsxRuntimeExports.jsx("div",{className:t.clx(yn.rating,{[yn.disabled]:o}),onMouseLeave:()=>i(0),children:[1,2,3,4,5].map(l=>t.jsxRuntimeExports.jsx("div",{id:l.toString(),className:t.clx(yn.ratingStar,{[yn.inactive]:!(n>=l||r>=l)}),onMouseEnter:s,onClick:()=>a(l),children:n>=l||r>=l?t.jsxRuntimeExports.jsx(t.FilledStar,{}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Star",fill:"var(--text-secondary)",width:22,height:21})},l))})},gm="_inputRange_iv6ow_4",fm="_inputRangeLabel_iv6ow_14",Im="_progressBar_iv6ow_22",jm="_progressBarFill_iv6ow_29",Sm="_stepsContainer_iv6ow_40",ym="_step_iv6ow_40",Cm="_stepDot_iv6ow_57",km="_current_iv6ow_61",bm="_active_iv6ow_69",_m="_inactive_iv6ow_72",wm="_tooltip_iv6ow_77",Le={inputRange:gm,inputRangeLabel:fm,progressBar:Im,progressBarFill:jm,stepsContainer:Sm,step:ym,stepDot:Cm,current:km,default:"_default_iv6ow_65",active:bm,inactive:_m,tooltip:wm},Em=({totalSteps:e,step:n,onStepChange:o,label:r})=>{const[i,s]=C.useState(n),a=i===1?0:(i-1)/(e-1)*100,l=c=>{s(c),o(c)};return t.jsxRuntimeExports.jsxs("div",{className:Le.inputRange,children:[r&&t.jsxRuntimeExports.jsx("div",{className:Le.inputRangeLabel,children:r}),t.jsxRuntimeExports.jsxs("div",{className:Le.progressBar,children:[t.jsxRuntimeExports.jsx("div",{className:Le.progressBarFill,style:{width:`${Math.ceil(a)}%`}}),t.jsxRuntimeExports.jsx("div",{className:Le.stepsContainer,children:[...Array(e)].map((c,p)=>{const u=p+1,d=u<=i,h=u===i;return t.jsxRuntimeExports.jsxs("div",{className:Le.step,onClick:()=>l(u),children:[t.jsxRuntimeExports.jsx("div",{className:t.clx(Le.stepDot,h?Le.current:Le.default,d?Le.active:Le.inactive)}),h&&t.jsxRuntimeExports.jsxs("div",{className:Le.tooltip,style:{transform:`translateX(calc(50% - ${a<99?"40px":"70px"}))`},children:[t.jsxRuntimeExports.jsx("span",{children:i}),t.jsxRuntimeExports.jsx("span",{children:i===1?"month":"months"})]})]},u)})})]})]})},sn=({className:e,expiresAt:n})=>{const{shopGeneral:o}=t.useStorefrontStore(),r=t.useNavigate(),{isAntistock:i}=t.useGeneralStore();return t.jsxRuntimeExports.jsxs("header",{className:`${Nt.checkoutHeader} ${e}`,children:[t.jsxRuntimeExports.jsxs("div",{className:Nt.leftContainer,children:[t.jsxRuntimeExports.jsx("div",{className:Nt.backArrow,onClick:()=>{window.history.length>2?r(-1):r("/")},children:t.jsxRuntimeExports.jsx(t.Icon,{name:"ArrowUp"})}),(o==null?void 0:o.info.logo)&&t.jsxRuntimeExports.jsx("div",{className:Nt.logoContainer,children:i?t.jsxRuntimeExports.jsx("a",{className:Nt.antistockLink,href:"https://antistock.io",target:"_blank",rel:"noopener noreferrer",children:"Antistock"}):t.jsxRuntimeExports.jsx("img",{className:Nt.logo,src:t.convertCfImageIdToUrl(o.info.logo.cfId)})})]}),n&&t.jsxRuntimeExports.jsx(im,{expiresAt:n})]})},vm="_checkoutPrices_vp75r_1",Rm="_priceRow_vp75r_12",Nm="_label_vp75r_22",Tm="_totalRow_vp75r_26",Pm="_totalLabel_vp75r_37",Lm="_totalValue_vp75r_42",Xe={checkoutPrices:vm,priceRow:Rm,label:Nm,totalRow:Tm,totalLabel:Pm,totalValue:Lm},an=({formatter:e,coupon:n,discount:o,totalWithDiscount:r,total:i,className:s,isShowSubtotal:a=!0,feeOrDiscount:l})=>{const c=Math.max(0,o),{priceAdjusment:p}=t.useCartStore(),{isAntistock:u}=t.useGeneralStore(),h=(()=>{const m=r!==void 0?r:i-c;return!p||l===null||l===void 0?Math.max(m,0):p.isDiscount?Math.max(m-l,0):Math.max(m+l,0)})();return t.jsxRuntimeExports.jsxs("div",{className:`${Xe.checkoutPrices} ${s||""}`,style:{border:u?"1px solid var(--border-secondary)":void 0},children:[a&&t.jsxRuntimeExports.jsxs("div",{className:Xe.priceRow,children:[t.jsxRuntimeExports.jsx("p",{className:Xe.label,id:"md",children:"Subtotal"}),t.jsxRuntimeExports.jsx("p",{id:"md",children:e.format(i)})]}),(n||c>0)&&t.jsxRuntimeExports.jsxs("div",{className:Xe.priceRow,children:[t.jsxRuntimeExports.jsxs("p",{className:Xe.label,id:"md",children:["Discount ",n&&!(n!=null&&n.isFixed)&&`(${n==null?void 0:n.discount}%)`]}),t.jsxRuntimeExports.jsx("p",{id:"md",children:n&&!(n!=null&&n.isFixed)&&(n==null?void 0:n.discount)===100?`-${e.format(i)}`:`-${e.format(c)}`})]}),l!=null&&l!==0&&p&&(p.fixedAmount!==0||p.percentage!==0)&&t.jsxRuntimeExports.jsxs("div",{className:Xe.priceRow,children:[t.jsxRuntimeExports.jsxs("p",{className:Xe.label,id:"md-bold",children:[p.isDiscount?"Discount: ":"Fee: ",p.percentage!==0&&p.fixedAmount===0&&`(${p.percentage}%)`,p.fixedAmount!==0&&p.percentage===0&&`(${e.format(p.fixedAmount)})`,p.percentage!==0&&p.fixedAmount!==0&&`(${p.percentage}% + ${e.format(p.fixedAmount)})`]}),t.jsxRuntimeExports.jsx("p",{id:"md-bold",children:e.format(l)})]}),t.jsxRuntimeExports.jsxs("div",{className:Xe.totalRow,children:[t.jsxRuntimeExports.jsx("p",{className:Xe.totalLabel,id:"md-bold",children:"Total Due"}),t.jsxRuntimeExports.jsx("p",{className:Xe.totalValue,id:"md-bold",children:e.format(h)})]})]})},Am="_checkoutProduct_hr575_1",Bm="_isOrder_hr575_1",Mm="_productDetails_hr575_10",Fm="_productImage_hr575_16",Dm="_isOrderImage_hr575_26",$m="_productImageAntistock_hr575_30",Om="_image_hr575_35",Hm="_productInfo_hr575_40",zm="_productHeader_hr575_47",Um="_quantityBadge_hr575_53",Wm="_productPrice_hr575_71",Vm="_deliveryCategories_hr575_80",Gm="_customerNote_hr575_88",qm="_noteHeader_hr575_95",Zm="_logoContainer_hr575_101",Xm="_shopName_hr575_113",Ym="_noteContent_hr575_117",Km="_productName_hr575_123",fe={checkoutProduct:Am,isOrder:Bm,productDetails:Mm,productImage:Fm,isOrderImage:Dm,productImageAntistock:$m,image:Om,productInfo:Hm,productHeader:zm,quantityBadge:Um,productPrice:Wm,deliveryCategories:Vm,customerNote:Gm,noteHeader:qm,logoContainer:Zm,shopName:Xm,noteContent:Ym,productName:Km},wo=({isOrder:e,product:n})=>{var a;const{shopGeneral:o}=t.useStorefrontStore(),r=n.subscriptionSettings,{cart:i}=t.useCart(),{isAntistock:s}=t.useGeneralStore();return t.jsxRuntimeExports.jsxs("div",{className:`${fe.checkoutProduct} ${e?fe.isOrder:""}`,children:[t.jsxRuntimeExports.jsxs("div",{className:fe.productDetails,children:[t.jsxRuntimeExports.jsx("div",{className:`${fe.productImage} ${e?fe.isOrderImage:""} ${s?fe.productImageAntistock:""}`,children:n!=null&&n.image?t.jsxRuntimeExports.jsx("img",{className:fe.image,src:t.convertCfImageIdToUrl(n.image.cfId)}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",fill:"var(--text-secondary)"})}),t.jsxRuntimeExports.jsx("div",{className:fe.productInfo,children:t.jsxRuntimeExports.jsxs("div",{className:fe.productHeader,children:[t.jsxRuntimeExports.jsx("h2",{className:fe.productName,id:"h5",children:n.name}),t.jsxRuntimeExports.jsxs("span",{className:fe.quantityBadge,id:"md",children:[n.price.quantity,"x"]})]})}),n.chargeType==="RECURRING"&&t.jsxRuntimeExports.jsx("p",{className:fe.productPrice,id:"md",children:r&&`${t.formatPrice(r.price)} / ${t.normalizeInterval(r.recurringIntervalDays||0)}${r.entryFee?" + "+t.formatPrice(r.entryFee):""}`}),n.chargeType==="ONE_TIME"&&t.jsxRuntimeExports.jsx("p",{className:fe.productPrice,id:"md",children:n.variantsGateways&&i.gateway&&n.variantsGateways.some(l=>l.name===i.gateway&&l.overrodePrice)?t.formatPrice(((a=n.variantsGateways.find(l=>l.name===i.gateway))==null?void 0:a.overrodePrice)||n.price):t.formatPrice(n.price)})]}),n.deliveryCategories&&t.jsxRuntimeExports.jsx("div",{className:fe.deliveryCategories,children:n.deliveryCategories.map(l=>t.jsxRuntimeExports.jsx(t.DeliveryItem,{deliveryConfiguration:l},l.id))}),n.customerNote&&t.jsxRuntimeExports.jsxs("div",{className:fe.customerNote,style:s?{border:"1px solid var(--border-secondary)"}:void 0,children:[t.jsxRuntimeExports.jsxs("div",{className:fe.noteHeader,children:[(o==null?void 0:o.info.logo)&&t.jsxRuntimeExports.jsx("div",{className:fe.logoContainer,children:t.jsxRuntimeExports.jsx("img",{src:t.convertCfImageIdToUrl(o==null?void 0:o.info.logo.cfId)})}),t.jsxRuntimeExports.jsx("p",{className:fe.shopName,id:"md",children:o==null?void 0:o.info.name})]}),t.jsxRuntimeExports.jsx("p",{className:fe.noteContent,id:"md",children:n.customerNote})]})]})},Jm="_coupon_dkjzv_1",Qm="_couponApplied_dkjzv_7",eh="_discount_dkjzv_17",th="_removeButton_dkjzv_23",nh="_removeButtonText_dkjzv_27",oh="_couponInput_dkjzv_31",rh="_couponInputContainer_dkjzv_37",lt={coupon:Jm,couponApplied:Qm,discount:eh,removeButton:th,removeButtonText:nh,couponInput:oh,couponInputContainer:rh},sh=({applyCoupon:e,couponData:n,discount:o,removeCoupon:r,gateway:i})=>{const[s,a]=C.useState(null),[l,c]=C.useState(!1),{isAntistock:p}=t.useGeneralStore();return t.jsxRuntimeExports.jsxs("div",{className:lt.coupon,children:[l&&t.jsxRuntimeExports.jsx(t.ContentLoader,{speed:2,width:500,height:48,viewBox:"0 0 500 48",backgroundColor:"var(--surface-secondary)",foregroundColor:"var(--surface-disabled)",className:lt.skeleton,style:{borderRadius:"var(--border-radius)"},children:t.jsxRuntimeExports.jsx("rect",{x:"0",y:"0",rx:"10",ry:"10",width:"100%",height:"48"})}),!l&&(n?t.jsxRuntimeExports.jsxs("div",{className:lt.couponApplied,style:p?{border:"1px solid var(--border-secondary)"}:void 0,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Check",fill:"var(--text-success)"}),t.jsxRuntimeExports.jsxs("p",{id:"md",style:{color:p?"var(--text-primary)":void 0},children:[s," is applied"," ",t.jsxRuntimeExports.jsxs("span",{className:lt.discount,children:["-",o," ",!n.isFixed&&`(${n.discount}%)`]})]}),t.jsxRuntimeExports.jsx("button",{className:lt.removeButton,onClick:r,children:t.jsxRuntimeExports.jsx("span",{className:lt.removeButtonText,children:"Remove"})})]}):t.jsxRuntimeExports.jsxs("div",{className:lt.couponInput,children:[t.jsxRuntimeExports.jsxs("div",{className:lt.couponInputContainer,children:[t.jsxRuntimeExports.jsx(t.Input$1,{placeholder:"Enter a discount code",value:s||"",onChange:u=>{a(u===""?null:u)}}),t.jsxRuntimeExports.jsx(t.Button$1,{onClick:async()=>{c(!0),s&&await e(s),c(!1)},disabled:!i||!s,type:"Primary",children:"Apply"})]}),!p&&!i&&t.jsxRuntimeExports.jsx(t.Tip,{type:"warning",message:"The discount is related to the method of payment. Select to enter.",id:"md"})]}))]})},ih=({cart:e,products:n,applyCoupon:o,applyCouponPending:r,coupon:i,totalAndDiscount:s,removeCoupon:a})=>{var x;const{priceAdjusment:l}=t.useCartStore(),[c,p]=C.useState(!1),u=C.useMemo(()=>e.parts.map(y=>{const f=n.find(S=>S.id===y.productId),_=f==null?void 0:f.variants.find(S=>S.id===y.productVariantId);return y.chargeType==="RECURRING"&&p(!0),{id:(f==null?void 0:f.id)||0,image:f==null?void 0:f.images[0],name:(()=>{const S=(f==null?void 0:f.name)||"",E=(_==null?void 0:_.name)||"";return!S&&!E?"":!E||S===E?S:S?`${S} (${E})`:E})(),description:"",price:{quantity:y.quantity,amount:(_==null?void 0:_.price.amount)||0,currency:_==null?void 0:_.price.currency},subscriptionSettings:_==null?void 0:_.subscriptionSettings,chargeType:y.chargeType,variantsGateways:_==null?void 0:_.gateways}}),[e,n]),d=((x=u[0])==null?void 0:x.price.currency)||"USD",h=new Intl.NumberFormat("en-US",{style:"currency",currency:d}),m=C.useMemo(()=>i&&!i.isFixed&&i.discount===100?s.total:s.totalWithDiscount?s.total-s.totalWithDiscount:0,[s,i]),g=l?(l==null?void 0:l.fixedAmount)+Math.round((s.totalWithDiscount!==void 0?s.totalWithDiscount:s.total-m)*((l==null?void 0:l.percentage)/100)):null;return t.jsxRuntimeExports.jsx("div",{className:jt.checkoutItemsContainer,children:t.jsxRuntimeExports.jsxs("div",{className:jt.innerContainer,children:[t.jsxRuntimeExports.jsx(sn,{}),t.jsxRuntimeExports.jsxs("div",{className:jt.headerSection,children:[t.jsxRuntimeExports.jsx("header",{className:jt.header,children:t.jsxRuntimeExports.jsx("h1",{id:"h3",children:"Checkout"})}),t.jsxRuntimeExports.jsx("div",{className:jt.productsContainer,children:u.map(y=>t.jsxRuntimeExports.jsx(wo,{product:y},y.id))}),t.jsxRuntimeExports.jsx("div",{className:jt.couponContainer,children:t.jsxRuntimeExports.jsx(sh,{applyCoupon:o,applyCouponPending:r,couponData:i,discount:h.format(m),removeCoupon:a,gateway:e.gateway})}),t.jsxRuntimeExports.jsx(an,{formatter:h,coupon:i,total:s.total,discount:m,totalWithDiscount:s.totalWithDiscount,feeOrDiscount:c?null:g})]}),t.jsxRuntimeExports.jsx("div",{className:jt.checkoutFooter,children:t.jsxRuntimeExports.jsx(Ge,{})})]})})},ah="_checkoutOperational_b62bq_1",lh="_innerContainer_b62bq_17",ch="_innerContainerAntistock_b62bq_27",uh="_paymentMethodsSectionAntistock_b62bq_39",ph="_continueButtonAntistock_b62bq_49",dh="_checkoutFooterAntistock_b62bq_59",mh="_antistock_b62bq_70",hh="_paymentMethodsSection_b62bq_39",xh="_socialConnectSection_b62bq_81",gh="_socialConnectLabel_b62bq_84",fh="_socialConnectContent_b62bq_88",Ih="_continueButton_b62bq_49",jh="_button_b62bq_96",Sh="_checkoutFooter_b62bq_59",be={checkoutOperational:ah,innerContainer:lh,innerContainerAntistock:ch,paymentMethodsSectionAntistock:uh,continueButtonAntistock:ph,checkoutFooterAntistock:dh,antistock:mh,paymentMethodsSection:hh,socialConnectSection:xh,socialConnectLabel:gh,socialConnectContent:fh,continueButton:Ih,button:jh,checkoutFooter:Sh},yh="_customFields_uhcib_2",Ch="_checkboxWrapper_uhcib_9",kh="_textareaWrapper_uhcib_16",bh="_inputWrapper_uhcib_17",_h="_requiredStar_uhcib_27",Lt={customFields:yh,checkboxWrapper:Ch,textareaWrapper:kh,inputWrapper:bh,requiredStar:_h},wh=({customFields:e,setCustomFields:n})=>{if(e.length===0)return null;const o=e.map(r=>t.jsxRuntimeExports.jsx(Eh,{customField:r,setCustomFields:n},r.name));return t.jsxRuntimeExports.jsx("div",{className:Lt.customFields,children:o})},Eh=({customField:e,setCustomFields:n})=>{const o=r=>{n(i=>i.map(s=>s.name===e.name?{...s,value:r}:s))};return t.jsxRuntimeExports.jsx(vh,{value:e.value??"",placeholder:e.placeholder,required:e.required,defaultValue:e.defaultValue,type:e.type,onValueChange:o,label:e.name,regex:e.regex})},vh=({label:e,type:n,defaultValue:o,value:r,placeholder:i,regex:s,required:a,onValueChange:l})=>{if(C.useEffect(()=>{r===""&&o!==void 0&&l(String(o))},[]),n===t.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox)return t.jsxRuntimeExports.jsxs("label",{className:Lt.checkboxWrapper,children:[t.jsxRuntimeExports.jsx(t.Checkbox,{value:r==="true",onChange:p=>l(p?"true":"false")}),t.jsxRuntimeExports.jsxs("p",{className:Lt.checkboxLabel,children:[e,a&&t.jsxRuntimeExports.jsx("span",{className:Lt.requiredStar,children:"*"})]})]});if(n===t.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Hidden)return t.jsxRuntimeExports.jsx("input",{type:"hidden",value:String(o??""),required:a});const c=p=>{(n===t.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?/^\d*$/:s?new RegExp(s):/.*/).test(p)&&l(p)};return n===t.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Textarea?t.jsxRuntimeExports.jsx("div",{className:Lt.textareaWrapper,children:t.jsxRuntimeExports.jsx(t.Textarea$1,{label:e,value:r,placeholder:i,onChange:c,required:a})}):t.jsxRuntimeExports.jsx("div",{className:Lt.inputWrapper,children:t.jsxRuntimeExports.jsx(t.Input$1,{type:n===t.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?"number":"text",placeholder:n===t.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?"Type something number...":i,label:e,value:r,required:a,onChange:c})})},Rh="_connectedContainer_1rxr8_1",Nh="_userInfo_1rxr8_10",Th="_avatar_1rxr8_16",Ph="_avatarImage_1rxr8_26",Cn={connectedContainer:Rh,userInfo:Nh,avatar:Th,avatarImage:Ph},Lh=({customerEmail:e})=>{const{discordInfo:n,setDiscordInfo:o}=t.useDiscordStore(),{notifications:r,setNotifications:i}=t.useNotificationStore(),[s,a]=C.useState(!1),[l,c]=C.useState(0),[p,u]=C.useState(null),d=20,h=x=>{var y,f,_,S;return(f=(y=x==null?void 0:x.response)==null?void 0:y.data)!=null&&f.error?x.response.data.error:(S=(_=x==null?void 0:x.response)==null?void 0:_.data)!=null&&S.message?x.response.data.message:x!=null&&x.message?x.message:"Failed to connect to Discord. Please try again later."},m=(x,y)=>{i([...r,{id:t.v4(),message:x,status:y}])};C.useEffect(()=>{if(p&&s){const x=setInterval(()=>{p.closed&&(clearInterval(x),a(!1),u(null))},1e3);return()=>clearInterval(x)}},[p,s]);const g=()=>{e.trim()!==""&&(a(!0),c(0),wi({customerEmail:e,tsId:t.getTsId()}).then(({data:x})=>{const y=window.open(x.redirectUrl);u(y),(!y||y.closed||typeof y.closed>"u")&&setTimeout(()=>{const S=document.createElement("a");S.href=x.redirectUrl,S.target="_blank",S.click()});let f;const _=()=>{if(c(S=>S+1),l>=d||y&&y.closed){l>=d&&m("Authorization timeout. Please try again.","error"),a(!1),clearTimeout(f);return}Ei({id:x.id,customerEmail:e}).then(({data:S})=>{o({authorized:!0,id:x.id,avatar:S.avatar,username:S.username}),y&&y.close(),a(!1),u(null),m("Discord successfully connected!","success"),clearTimeout(f)}).catch(S=>{var E;if(console.log("Waiting for authorization...",S,{newWindow:y}),y&&y.closed){a(!1),clearTimeout(f);return}if((E=S==null?void 0:S.response)!=null&&E.status&&S.response.status!==404&&S.response.status>=400){m(h(S),"error"),a(!1),clearTimeout(f);return}clearTimeout(f),f=setTimeout(_,1500)})};_()}).catch(x=>{console.log("Could not initiate Discord authorization",x),m(h(x),"error"),a(!1)}))};return n!=null&&n.authorized?t.jsxRuntimeExports.jsxs("div",{className:Cn.connectedContainer,children:[t.jsxRuntimeExports.jsxs("div",{className:Cn.userInfo,children:[t.jsxRuntimeExports.jsx("div",{className:Cn.avatar,children:n.avatar?t.jsxRuntimeExports.jsx("img",{className:Cn.avatarImage,src:`https://cdn.discordapp.com/avatars/${n.id}/${n.avatar}.png?size=256`}):t.jsxRuntimeExports.jsx(t.Icon,{name:"UserCircle"})}),t.jsxRuntimeExports.jsx("p",{children:n.username}),t.jsxRuntimeExports.jsx(nm,{})]}),t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:g,children:"Reconnect"})]}):t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:g,style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",gap:"10px"},disabled:s,children:s?t.jsxRuntimeExports.jsx(t.Loader,{}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"DiscordLogo"}),t.jsxRuntimeExports.jsx(t.StableText,{children:"Connect Your Discord"})]})})},Ah="_paymentMethodsContainer_1pfqr_2",Bh="_antistock_1pfqr_15",Jo={paymentMethodsContainer:Ah,antistock:Bh},Mh="_bottomSheet_1x8kc_1",Fh="_content_1x8kc_8",Dh="_description_1x8kc_11",$h="_title_1x8kc_15",Oh="_buttonGroup_1x8kc_19",Hh="_buttonWrapper_1x8kc_29",zh="_fullWidthButton_1x8kc_32",Uh="_modal_1x8kc_36",Wh="_header_1x8kc_43",st={bottomSheet:Mh,content:Fh,description:Dh,title:$h,buttonGroup:Oh,buttonWrapper:Hh,fullWidthButton:zh,modal:Uh,header:Wh},Vh=({setIsOpen:e,balance:n})=>{const o=t.useNavigate(),{setIsOpen:r}=t.useModalStore(),i=()=>{o("/top-up?redirectRoute=checkout")};function s(){r(!1),setTimeout(()=>{e(!1)},300)}return t.jsxRuntimeExports.jsxs("div",{className:st.modal,onClick:a=>a.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:st.header,children:[t.jsxRuntimeExports.jsx("h3",{id:"h3",className:st.title,children:"Insufficient Customer Balance"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",hoverable:!0,onClick:s,fill:"var(--text-primary)"})]}),t.jsxRuntimeExports.jsxs("div",{className:st.bottomSheet,children:[t.jsxRuntimeExports.jsx("div",{className:st.content,children:t.jsxRuntimeExports.jsxs("p",{className:st.description,children:["You currently have ",n&&t.formatPrice(n)," in your balance. After topping up the required amount, you can continue to checkout."]})}),t.jsxRuntimeExports.jsxs("div",{className:st.buttonGroup,children:[t.jsxRuntimeExports.jsx("div",{className:st.buttonWrapper,children:t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:s,children:"Cancel"})}),t.jsxRuntimeExports.jsx("div",{className:st.fullWidthButton,children:t.jsxRuntimeExports.jsx(t.Button$1,{type:"Primary",onClick:i,children:"Add Balance"})})]})]})]})},Yr=({align:e,gateway:n,gatewayDisplayName:o,selected:r,onSelect:i,total:s,onSignInClick:a,reversed:l,isAntistock:c=!1})=>{const{token:p}=t.useStorefrontStore(),{balance:u}=t.useCustomerDashboardStore(),[d,h]=C.useState(!1),{setIsOpen:m}=t.useModalStore(),g=x=>{x.stopPropagation(),i==null||i(n),u&&u.amount<s&&(h(!0),m(!0))};return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx("div",{className:t.clx(t.styles$3.paymentMethod,{[t.styles$3.selected]:r,[t.styles$3.alignColumn]:e==="column",[t.styles$3.reversed]:l&&!c,[t.styles$3.antistock]:c}),onClick:g,children:c?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("p",{className:t.styles$3.paymentText,id:"md",children:[o," ",t.jsxRuntimeExports.jsxs("span",{className:t.styles$3.balanceText,id:"md",children:["(",p?u&&t.formatPrice(u):t.jsxRuntimeExports.jsx("a",{className:t.styles$3.signInLink,onClick:a,id:"md",children:"Sign in"}),")"]})]}),t.jsxRuntimeExports.jsx("div",{className:t.styles$3.iconContainer,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Wallet",fill:"var(--text-primary)",width:20,height:20})})]}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("p",{className:t.styles$3.paymentText,id:"md",children:[o," ",t.jsxRuntimeExports.jsxs("span",{className:t.styles$3.balanceText,id:"md",children:["(",p?u&&t.formatPrice(u):t.jsxRuntimeExports.jsx("a",{className:t.styles$3.signInLink,onClick:a,id:"md",children:"Sign in"}),")"]})]}),t.jsxRuntimeExports.jsx("div",{className:t.styles$3.iconContainer,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Wallet",fill:"var(--text-primary)",width:20,height:20})})]})}),d&&t.jsxRuntimeExports.jsx(t.Modal,{close:()=>h(!1),children:t.jsxRuntimeExports.jsx(Vh,{setIsOpen:h,balance:u})})]})},Kr=({possibleGateways:e,setGateway:n,totalAndDiscount:o,onSignInClick:r,setPaymentMethod:i,isAntistock:s=!1})=>{const[a,l]=C.useState(),[c,p]=C.useState(),{setPriceAdjustment:u}=t.useCartStore(),[d,h]=C.useState(null),m=(g,x)=>{var y;c!==x&&(n(x),u(((y=d==null?void 0:d.find(f=>f.name===x))==null?void 0:y.priceAdjustment)||null)),i(g),l(g),p(x)};return C.useEffect(()=>{if(d&&d.length>0){const g=d[0];if(g.name==="Balance")p(g.name),n(g.name),u(g.priceAdjustment||null);else if(g.paymentMethods&&g.paymentMethods.length>0){const x=g.paymentMethods[0];l(x),p(g.name),n(g.name),i(x),u(g.priceAdjustment||null)}}},[d]),C.useEffect(()=>{const g=async()=>{const{data:x}=await t.fetchGatewaysDetail([...e.availableGateways,...e.requiresSignInGateways]);h(x)};e.availableGateways.length&&g()},[]),C.useLayoutEffect(()=>{u(null)},[]),t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:d&&t.jsxRuntimeExports.jsx("div",{className:t.clx(Jo.paymentMethodsContainer,{[Jo.antistock]:s}),children:d==null?void 0:d.map(g=>g.name==="Balance"?t.jsxRuntimeExports.jsx(Yr,{gateway:g.name,gatewayDisplayName:g.displayName,onSelect:x=>{p(x),c!==x&&n(x)},selected:g.name===c,total:o.total,onSignInClick:r,reversed:!0,isAntistock:s},g.name):g.paymentMethods.map(x=>t.jsxRuntimeExports.jsx(t.CheckoutPaymentMethod,{paymentMethod:x,gateway:g.name,gatewayDisplayName:g.displayName,gatewayLogoCfId:g.logoCfImageId,poweredByLogoCfId:g.poweredByImageCfImageId,onSelect:y=>m(y,g.name),selected:a===x&&c===g.name,isAntistock:s},`${g.name}-${x}`)))})})},Gh="_modal_14r0b_1",qh={modal:Gh},Zh=({setIsOpen:e})=>{const{token:n}=t.useStorefrontStore(),{setIsOpen:o}=t.useModalStore();C.useEffect(()=>{n&&r()},[n]);const r=()=>{o(!1),setTimeout(()=>{e(!1)},300)};return t.jsxRuntimeExports.jsx("div",{className:qh.modal,onClick:i=>i.stopPropagation(),children:t.jsxRuntimeExports.jsx(t.Auth,{inModal:!0})})},Xh=({getPossibleGateways:e,setGateway:n,getDiscordSettings:o,cart:r,products:i,submitCart:s,reset:a,setCustomFieldsToCart:l,totalAndDiscount:c,setDiscordSocialConnectId:p,setPaymentMethod:u,isAntistock:d})=>{const h=C.useMemo(()=>o(),[]),[m,g]=C.useState([]),{balance:x,setBalance:y}=t.useCustomerDashboardStore(),{token:f}=t.useStorefrontStore(),{executeRecaptcha:_}=t.useReCaptcha(),{discordInfo:S}=t.useDiscordStore(),{customerEmail:E,setCustomerEmail:b}=t.useCartStore(),k=S!=null&&S.authorized?S.id:void 0,L=t.useNavigate(),$=C.useMemo(()=>e(),[r.parts]),[H,O]=C.useState(!1),{setIsOpen:N}=t.useModalStore(),{notifications:v,setNotifications:P}=t.useNotificationStore();C.useEffect(()=>{const D=t.getCommonCustomFields(r.parts,i).map(Q=>Q.type===t.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox?{...Q,value:String(Q.defaultValue)}:Q);g([...D])},[]),C.useEffect(()=>{const A=t.getCommonCustomFields(r.parts,i);g(D=>{const Q=new Map(D.map(I=>[I.name,I]));return A.map(I=>{const J=Q.get(I.name);return J&&J.value?{...I,value:J.value}:I.type===t.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox?{...I,value:String(I.defaultValue)}:I})})},[r.parts,i]),C.useEffect(()=>{f&&(async()=>{const D=await t.getBalance();y(D)})()},[f]);function B(A){return A&&/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(A)}const M=()=>{const A=[];return m.forEach(D=>{var Q;D.required&&!((Q=D.value)!=null&&Q.toString().trim())&&A.push({message:`Field "${D.name}" is required.`,status:"error",id:t.v4()})}),A.length>0?(P([...v,...A]),!1):!0},U=async A=>{if(A.stopPropagation(),r.gateway==="Balance"&&!f){N(!0),O(!0);return}if(!M())return;const D=Object.fromEntries(m.map(I=>[I.name,I.value||""]));l({...D}),k&&h.isEnabled&&p(k);const Q=await _();if(Q){const I=await s(Q),J=JSON.parse(localStorage.getItem("orders")||"{}");if(Object.keys(J).length>10){const ge=Date.now()-864e5;Object.keys(J).forEach(j=>{J[j].createdAt<=ge&&delete J[j]})}"order"in I?J[I.order.id]={createdAt:Date.now(),fullAccessToken:I.order.fullAccessToken}:J[I.id]={createdAt:Date.now(),fullAccessToken:I.fullAccessToken},localStorage.setItem("orders",JSON.stringify(J)),L(`/orders/${"order"in I?I.order.id:I.id}/${"order"in I?I.order.fullAccessToken:I.fullAccessToken}`),setTimeout(()=>a(),0)}};return t.jsxRuntimeExports.jsxs("div",{className:be.checkoutOperational,style:d?{borderLeft:"1px solid var(--border-secondary)"}:void 0,children:[t.jsxRuntimeExports.jsxs("div",{className:`${be.innerContainer} ${d?be.innerContainerAntistock:""}`,children:[d?t.jsxRuntimeExports.jsx("h4",{style:{fontSize:"var(--input-label-size)",color:"var(--text-secondary)",paddingBottom:"12px",fontWeight:"400"},children:"Select Payment Method"}):null,r.parts.length>0&&t.jsxRuntimeExports.jsx(Kr,{possibleGateways:$,setGateway:n,setPaymentMethod:u,balance:x,totalAndDiscount:c,onSignInClick:()=>{O(!0),N(!0)},isAntistock:d}),t.jsxRuntimeExports.jsx("div",{className:t.clx(be.paymentMethodsSection,{[be.antistock]:d,[be.paymentMethodsSectionAntistock]:d}),children:t.jsxRuntimeExports.jsx(t.Input$1,{placeholder:"your@email.com",value:E||"",onChange:A=>b(A),disabled:!!f,label:"Email Address"})}),t.jsxRuntimeExports.jsx(wh,{customFields:m,setCustomFields:g}),h.isEnabled&&t.jsxRuntimeExports.jsxs("div",{className:be.socialConnectSection,children:[t.jsxRuntimeExports.jsx("p",{className:be.socialConnectLabel,id:"md",children:"Social Connect"}),t.jsxRuntimeExports.jsx("div",{className:be.socialConnectContent,children:t.jsxRuntimeExports.jsx(Lh,{customerEmail:E||""})})]}),t.jsxRuntimeExports.jsxs("div",{className:`${be.continueButton} ${d?be.continueButtonAntistock:""}`,children:[t.jsxRuntimeExports.jsx(t.Button$1,{onClick:U,disabled:!r.gateway||!B(E||"")||h.isRequired&&!(S!=null&&S.authorized),className:be.button,children:"Continue to Checkout"}),!d&&t.jsxRuntimeExports.jsx(t.TermsOfService,{}),t.jsxRuntimeExports.jsx(t.SecuredBySsl,{isAntistock:d})]}),t.jsxRuntimeExports.jsx(Ge,{className:`${be.checkoutFooter} ${d?be.checkoutFooterAntistock:""}`})]}),H&&t.jsxRuntimeExports.jsx(t.Modal,{close:()=>O(!1),children:t.jsxRuntimeExports.jsx(Zh,{setIsOpen:O})})]})},Yh="_mt1_1l62z_1",Kh="_notifyBlock_1l62z_13",Jh="_notifyHeader_1l62z_19",Qh="_notifyContent_1l62z_25",ex="_buttonBlock_1l62z_30",tx="_imageBlock_1l62z_34",nx="_imageContainer_1l62z_42",ox="_sectionBlock_1l62z_54",rx="_sectionTitle_1l62z_61",sx="_sectionSubtitle_1l62z_64",ix="_inputContainer_1l62z_69",Ve={mt1:Yh,notifyBlock:Kh,notifyHeader:Jh,notifyContent:Qh,buttonBlock:ex,imageBlock:tx,imageContainer:nx,sectionBlock:ox,sectionTitle:rx,sectionSubtitle:sx,inputContainer:ix},ax=({props:e})=>{const n=t.useCopy();return t.jsxRuntimeExports.jsx("div",{className:Ve.mt1,children:t.jsxRuntimeExports.jsxs("div",{className:Ve.inputContainer,children:[t.jsxRuntimeExports.jsx(t.Input$1,{value:e.text,disabled:!0,onChange:()=>{}}),e.shownCopyButton&&t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:()=>n(e.text),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Copy"})})]})})},lx=({props:e})=>t.jsxRuntimeExports.jsx(t.Button$1,{className:Ve.buttonBlock,onClick:()=>window.open(e.url,"_blank","noopener"),children:e.text}),cx=({props:e})=>t.jsxRuntimeExports.jsx("div",{className:Ve.imageBlock,children:t.jsxRuntimeExports.jsx("div",{className:Ve.imageContainer,children:t.jsxRuntimeExports.jsx("img",{src:e.src,alt:""})})}),ux=({props:e})=>t.jsxRuntimeExports.jsxs("div",{className:Ve.notifyBlock,children:[t.jsxRuntimeExports.jsxs("div",{className:Ve.notifyHeader,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Info",width:24,height:24,fill:"var(--text-secondary)"}),t.jsxRuntimeExports.jsx("p",{children:e.heading})]}),t.jsxRuntimeExports.jsx("p",{className:Ve.notifyContent,children:e.content})]}),px=({props:e})=>{var n;return t.jsxRuntimeExports.jsxs("div",{className:Ve.sectionBlock,children:[t.jsxRuntimeExports.jsx("p",{className:Ve.sectionTitle,children:e.title}),t.jsxRuntimeExports.jsx("span",{className:Ve.sectionSubtitle,children:e.subTitle}),(n=e.children)==null?void 0:n.map((o,r)=>t.jsxRuntimeExports.jsx(xo,{block:o},r))]})},xo=({block:e})=>{switch(e.type){case"Section":return t.jsxRuntimeExports.jsx(px,{...e});case"ReadOnlyTextInput":return t.jsxRuntimeExports.jsx(ax,{...e});case"Notify":return t.jsxRuntimeExports.jsx(ux,{...e});case"Button":return t.jsxRuntimeExports.jsx(lx,{...e});case"Image":return t.jsxRuntimeExports.jsx(cx,{...e});default:return null}},dx="_bottomSheet_1x4sq_1",mx="_content_1x4sq_8",hx="_agreementList_1x4sq_11",xx="_agreementItem_1x4sq_16",gx="_warning_1x4sq_23",fx="_buttonGroup_1x4sq_31",Ix="_buttonWrapper_1x4sq_41",jx="_fullWidthButton_1x4sq_44",Sx="_modal_1x4sq_48",yx="_header_1x4sq_55",Ae={bottomSheet:dx,content:mx,agreementList:hx,agreementItem:xx,warning:gx,buttonGroup:fx,buttonWrapper:Ix,fullWidthButton:jx,modal:Sx,header:yx},Cx=({setIsOpen:e,price:n})=>{const[o,r]=C.useState({agreeToSendAsFF:!1,agreeToSend:!1,agreeToNotAddNote:!1}),{setIsOpen:i}=t.useModalStore(),s=()=>{i(!1),setTimeout(()=>{e(!1)},300)};return t.jsxRuntimeExports.jsxs("div",{className:Ae.modal,onClick:a=>a.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:Ae.header,children:[t.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Note"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",hoverable:!0,onClick:s,fill:"var(--text-primary)"})]}),t.jsxRuntimeExports.jsxs("div",{className:Ae.bottomSheet,children:[t.jsxRuntimeExports.jsxs("div",{className:Ae.content,children:[t.jsxRuntimeExports.jsxs("div",{className:Ae.agreementList,children:[t.jsxRuntimeExports.jsxs("label",{className:Ae.agreementItem,children:[t.jsxRuntimeExports.jsx(t.Checkbox,{value:o.agreeToSendAsFF,onChange:a=>r({...o,agreeToSendAsFF:a})}),t.jsxRuntimeExports.jsx("p",{children:"I agree to send the payment as friends & family"})]}),t.jsxRuntimeExports.jsxs("label",{className:Ae.agreementItem,children:[t.jsxRuntimeExports.jsx(t.Checkbox,{value:o.agreeToSend,onChange:a=>r({...o,agreeToSend:a})}),t.jsxRuntimeExports.jsxs("p",{children:["I agree to send the payment of ",t.formatPrice(n)," ",n.currency]})]}),t.jsxRuntimeExports.jsxs("label",{className:Ae.agreementItem,children:[t.jsxRuntimeExports.jsx(t.Checkbox,{value:o.agreeToNotAddNote,onChange:a=>r({...o,agreeToNotAddNote:a})}),t.jsxRuntimeExports.jsx("p",{children:"I agree to not add a note to this payment"})]})]}),t.jsxRuntimeExports.jsx("div",{className:Ae.warning,children:t.jsxRuntimeExports.jsxs("p",{children:["Please note that you are required to send the exact payment of ",t.formatPrice(n)," ",n.currency,". If you were to send any amount over or below, your funds will be lost."]})})]}),t.jsxRuntimeExports.jsxs("div",{className:Ae.buttonGroup,children:[t.jsxRuntimeExports.jsx("div",{className:Ae.buttonWrapper,children:t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",children:t.jsxRuntimeExports.jsx("span",{className:"text-[var(--text-secondary)]",children:"Cancel"})})}),t.jsxRuntimeExports.jsx("div",{className:Ae.fullWidthButton,children:t.jsxRuntimeExports.jsx(t.Button$1,{type:"Primary",disabled:!(o.agreeToSendAsFF&&o.agreeToNotAddNote&&o.agreeToSend),onClick:s,children:"Continue to Payment"})})]})]})]})},kx="_chargeItemsContainer_18agp_4",bx="_chargeItemsInner_18agp_20",_x="_productsContainer_18agp_27",wx="_antistockLayout_18agp_42",Ex="_mainContentAntistock_18agp_55",vx="_desktopTrackPayment_18agp_66",Rx="_desktopFooter_18agp_75",Nx="_footerContainerAntistock_18agp_96",Tx="_chargeHeader_18agp_109",Px="_chargeTitle_18agp_117",Lx="_chargeDescription_18agp_123",Ax="_copyButton_18agp_129",Bx="_productsList_18agp_141",Mx="_footerContainer_18agp_96",_e={chargeItemsContainer:kx,chargeItemsInner:bx,productsContainer:_x,antistockLayout:wx,mainContentAntistock:Ex,desktopTrackPayment:vx,desktopFooter:Rx,footerContainerAntistock:Nx,chargeHeader:Tx,chargeTitle:Px,chargeDescription:Lx,copyButton:Ax,productsList:Bx,footerContainer:Mx},Fx=({charge:e})=>{var a;const n=t.useCopy(),{isAntistock:o}=t.useGeneralStore(),r=(e==null?void 0:e.price.currency)||"USD",i=new Intl.NumberFormat("en-US",{style:"currency",currency:r}),s=C.useMemo(()=>{var l;return((l=e==null?void 0:e.order)==null?void 0:l.partOrders.map(c=>{var p,u,d,h;return{id:(c==null?void 0:c.id)||0,image:c.productWithVariant.image,name:(()=>{var x,y;const m=((x=c.productWithVariant)==null?void 0:x.name)||"",g=((y=c.productWithVariant)==null?void 0:y.variantName)||"";return!m&&!g?"":!g||m===g?m:m?`${m} (${g})`:g})(),description:"",price:{quantity:c.quantity,amount:((p=c.productWithVariant)==null?void 0:p.price.amount)||0,currency:(u=c.productWithVariant)==null?void 0:u.price.currency},subscriptionSettings:(d=e.order)!=null&&d.subscriptionOrderId?(h=c.productWithVariant)==null?void 0:h.subscriptionSettings:null}}))||[]},[e]);return t.jsxRuntimeExports.jsx("div",{className:_e.chargeItemsContainer,children:t.jsxRuntimeExports.jsxs("div",{className:_e.chargeItemsInner,children:[t.jsxRuntimeExports.jsx(sn,{expiresAt:e==null?void 0:e.expiresAt}),t.jsxRuntimeExports.jsxs("div",{className:`${_e.productsContainer} ${o?_e.antistockLayout:""}`,children:[(e==null?void 0:e.name)&&t.jsxRuntimeExports.jsxs("header",{className:_e.chargeHeader,children:[t.jsxRuntimeExports.jsxs("div",{children:[t.jsxRuntimeExports.jsx("h1",{className:_e.chargeTitle,id:"h5",children:e.name}),e.description&&t.jsxRuntimeExports.jsx("p",{className:_e.chargeDescription,id:"md",children:e.description})]}),((a=e.order)==null?void 0:a.id)&&!o&&t.jsxRuntimeExports.jsxs(t.Button$1,{type:"Secondary",className:_e.copyButton,onClick:()=>{var l;return n(((l=e.order)==null?void 0:l.id)||"")},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Copy"}),"Copy Order ID"]})]}),t.jsxRuntimeExports.jsxs("div",{className:o?_e.mainContentAntistock:"",style:o?void 0:{flex:1},children:[!!s.length&&t.jsxRuntimeExports.jsx("div",{className:_e.productsList,children:s.map(l=>t.jsxRuntimeExports.jsx(wo,{product:l},l.id))}),t.jsxRuntimeExports.jsx(an,{formatter:i,coupon:null,total:(e==null?void 0:e.price.amount)||0,discount:0,totalWithDiscount:(e==null?void 0:e.price.amount)||0,isShowSubtotal:!1}),o&&e&&t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx("div",{className:_e.desktopTrackPayment,children:t.jsxRuntimeExports.jsx(t.TrackPayment,{timeline:e.timeline})}),t.jsxRuntimeExports.jsx(Ge,{className:_e.desktopFooter})]})]}),!o&&t.jsxRuntimeExports.jsx(Ge,{className:`${_e.footerContainer} ${o?_e.footerContainerAntistock:""}`})]})]})})},Dx="_checkoutOrderMainData_hqf60_1",$x="_orderDetailRow_hqf60_6",Ox="_chargeIdRow_hqf60_16",Hx="_detailLabel_hqf60_25",zx="_detailValue_hqf60_29",Ux="_chargeIdContainer_hqf60_33",Wx="_chargeId_hqf60_16",Vx="_copyIcon_hqf60_51",Ce={checkoutOrderMainData:Dx,orderDetailRow:$x,chargeIdRow:Ox,detailLabel:Hx,detailValue:zx,chargeIdContainer:Ux,chargeId:Wx,copyIcon:Vx},Jr=({lastUpdate:e,invoiceId:n,email:o,paymentType:r})=>{const i=t.useCopy(),[s,a]=C.useState(null),l=s==null?void 0:s.find(p=>p.name===r);C.useEffect(()=>{s||(async()=>{const u=[r],d=await t.getGatewaysDetail(u);a(d)})()},[r,s]);const c=p=>{const u=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],d=p.getDate().toString().padStart(2,"0"),h=u[p.getMonth()],m=p.getFullYear(),g=p.getHours(),x=p.getMinutes().toString().padStart(2,"0"),y=p.getSeconds().toString().padStart(2,"0"),f=g>=12?"PM":"AM",_=(g%12||12).toString().padStart(2,"0");return`${h} ${d}, ${m} at ${_}:${x}:${y} ${f}`};return t.jsxRuntimeExports.jsxs("div",{className:Ce.checkoutOrderMainData,children:[t.jsxRuntimeExports.jsxs("div",{className:Ce.orderDetailRow,children:[t.jsxRuntimeExports.jsx("p",{className:Ce.detailLabel,id:"md",children:"Last Updated"}),t.jsxRuntimeExports.jsx("p",{className:Ce.detailValue,id:"md",children:c(new Date(e))})]}),t.jsxRuntimeExports.jsxs("div",{className:Ce.orderDetailRow,children:[t.jsxRuntimeExports.jsx("p",{className:Ce.detailLabel,id:"md",children:"Payment Type"}),t.jsxRuntimeExports.jsx("p",{className:Ce.detailValue,id:"md",children:l==null?void 0:l.displayName})]}),t.jsxRuntimeExports.jsxs("div",{className:Ce.orderDetailRow,children:[t.jsxRuntimeExports.jsx("p",{className:Ce.detailLabel,id:"md",children:"Email"}),t.jsxRuntimeExports.jsx("p",{className:Ce.detailValue,id:"md",children:o})]}),t.jsxRuntimeExports.jsxs("div",{className:Ce.chargeIdRow,children:[t.jsxRuntimeExports.jsx("p",{className:Ce.detailLabel,id:"md",children:"Charge ID"}),t.jsxRuntimeExports.jsxs("div",{className:Ce.chargeIdContainer,children:[t.jsxRuntimeExports.jsx("p",{className:Ce.chargeId,id:"md",children:n}),t.jsxRuntimeExports.jsx("div",{className:Ce.copyIcon,onClick:()=>i(n),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Copy"})})]})]})]})},Gx="_bottomSheet_1yai1_1",qx="_formContainer_1yai1_8",Zx="_error_1yai1_14",Xx="_buttonGroup_1yai1_18",Yx="_buttonWrapper_1yai1_28",Kx="_fullWidthButton_1yai1_31",Jx="_modal_1yai1_41",Qx="_header_1yai1_48",ct={bottomSheet:Gx,formContainer:qx,error:Zx,buttonGroup:Xx,buttonWrapper:Yx,fullWidthButton:Kx,modal:Jx,header:Qx},eg=({chargeId:e,setIsOpen:n})=>{const[o,r]=C.useState(""),[i,s]=C.useState(""),{setIsOpen:a}=t.useModalStore(),l=u=>{try{return new URL(u),!0}catch{return!1}},c=async u=>{if(u.preventDefault(),!o){s("The link field cannot be empty.");return}if(!l(o)){s("Please enter a valid URL");return}await Si({url:o},e)&&(alert("CashApp successfully verified"),n(!1))},p=()=>{a(!1),setTimeout(()=>{n(!1)},300)};return t.jsxRuntimeExports.jsxs("div",{className:ct.modal,onClick:u=>u.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:ct.header,children:[t.jsxRuntimeExports.jsx("h3",{id:"h3",children:"CashApp Verify"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",hoverable:!0,onClick:p,fill:"var(--text-primary)"})]}),t.jsxRuntimeExports.jsx("form",{onSubmit:c,children:t.jsxRuntimeExports.jsxs("div",{className:ct.bottomSheet,children:[t.jsxRuntimeExports.jsx("div",{className:ct.formContainer,children:t.jsxRuntimeExports.jsxs("div",{children:[t.jsxRuntimeExports.jsx(t.Input$1,{value:o,onChange:u=>{r(u),s("")},label:"Enter Cashapp Link",placeholder:"https://cash.app/payments/0000"}),i&&t.jsxRuntimeExports.jsx("p",{className:ct.error,children:i})]})}),t.jsxRuntimeExports.jsxs("div",{className:ct.buttonGroup,children:[t.jsxRuntimeExports.jsx("div",{className:ct.buttonWrapper,children:t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:p,children:"Cancel"})}),t.jsxRuntimeExports.jsx("div",{className:ct.fullWidthButton,children:t.jsxRuntimeExports.jsx(t.Button$1,{type:"Primary",children:"Verify"})})]})]})})]})},tg="_container_1opbn_1",ng="_productDetails_1opbn_8",og="_imageContainer_1opbn_14",rg="_image_1opbn_14",sg="_textContainer_1opbn_32",ig="_header_1opbn_40",ag="_title_1opbn_46",lg="_price_1opbn_53",cg="_badgeContainer_1opbn_57",ug="_description_1opbn_61",Ye={container:tg,productDetails:ng,imageContainer:og,image:rg,textContainer:sg,header:ig,title:ag,price:lg,badgeContainer:cg,description:ug};function pg(e,n){const o={};return(e[e.length-1]===""?[...e,""]:e).join((o.padRight?" ":"")+","+(o.padLeft===!1?"":" ")).trim()}const dg=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,mg=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,hg={};function Qo(e,n){return(hg.jsx?mg:dg).test(e)}const xg=/[ \t\n\f\r]/g;function gg(e){return typeof e=="object"?e.type==="text"?er(e.value):!1:er(e)}function er(e){return e.replace(xg,"")===""}class ln{constructor(n,o,r){this.normal=o,this.property=n,r&&(this.space=r)}}ln.prototype.normal={};ln.prototype.property={};ln.prototype.space=void 0;function Qr(e,n){const o={},r={};for(const i of e)Object.assign(o,i.property),Object.assign(r,i.normal);return new ln(o,r,n)}function go(e){return e.toLowerCase()}class ve{constructor(n,o){this.attribute=o,this.property=n}}ve.prototype.attribute="";ve.prototype.booleanish=!1;ve.prototype.boolean=!1;ve.prototype.commaOrSpaceSeparated=!1;ve.prototype.commaSeparated=!1;ve.prototype.defined=!1;ve.prototype.mustUseProperty=!1;ve.prototype.number=!1;ve.prototype.overloadedBoolean=!1;ve.prototype.property="";ve.prototype.spaceSeparated=!1;ve.prototype.space=void 0;let fg=0;const X=bt(),xe=bt(),es=bt(),R=bt(),le=bt(),At=bt(),Te=bt();function bt(){return 2**++fg}const fo=Object.freeze(Object.defineProperty({__proto__:null,boolean:X,booleanish:xe,commaOrSpaceSeparated:Te,commaSeparated:At,number:R,overloadedBoolean:es,spaceSeparated:le},Symbol.toStringTag,{value:"Module"})),Jn=Object.keys(fo);class Eo extends ve{constructor(n,o,r,i){let s=-1;if(super(n,o),tr(this,"space",i),typeof r=="number")for(;++s<Jn.length;){const a=Jn[s];tr(this,Jn[s],(r&fo[a])===fo[a])}}}Eo.prototype.defined=!0;function tr(e,n,o){o&&(e[n]=o)}function Ft(e){const n={},o={};for(const[r,i]of Object.entries(e.properties)){const s=new Eo(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),n[r]=s,o[go(r)]=r,o[go(s.attribute)]=r}return new ln(n,o,e.space)}const ts=Ft({properties:{ariaActiveDescendant:null,ariaAtomic:xe,ariaAutoComplete:null,ariaBusy:xe,ariaChecked:xe,ariaColCount:R,ariaColIndex:R,ariaColSpan:R,ariaControls:le,ariaCurrent:null,ariaDescribedBy:le,ariaDetails:null,ariaDisabled:xe,ariaDropEffect:le,ariaErrorMessage:null,ariaExpanded:xe,ariaFlowTo:le,ariaGrabbed:xe,ariaHasPopup:null,ariaHidden:xe,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:le,ariaLevel:R,ariaLive:null,ariaModal:xe,ariaMultiLine:xe,ariaMultiSelectable:xe,ariaOrientation:null,ariaOwns:le,ariaPlaceholder:null,ariaPosInSet:R,ariaPressed:xe,ariaReadOnly:xe,ariaRelevant:null,ariaRequired:xe,ariaRoleDescription:le,ariaRowCount:R,ariaRowIndex:R,ariaRowSpan:R,ariaSelected:xe,ariaSetSize:R,ariaSort:null,ariaValueMax:R,ariaValueMin:R,ariaValueNow:R,ariaValueText:null,role:null},transform(e,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()}});function ns(e,n){return n in e?e[n]:n}function os(e,n){return ns(e,n.toLowerCase())}const Ig=Ft({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:At,acceptCharset:le,accessKey:le,action:null,allow:null,allowFullScreen:X,allowPaymentRequest:X,allowUserMedia:X,alt:null,as:null,async:X,autoCapitalize:null,autoComplete:le,autoFocus:X,autoPlay:X,blocking:le,capture:null,charSet:null,checked:X,cite:null,className:le,cols:R,colSpan:null,content:null,contentEditable:xe,controls:X,controlsList:le,coords:R|At,crossOrigin:null,data:null,dateTime:null,decoding:null,default:X,defer:X,dir:null,dirName:null,disabled:X,download:es,draggable:xe,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:X,formTarget:null,headers:le,height:R,hidden:X,high:R,href:null,hrefLang:null,htmlFor:le,httpEquiv:le,id:null,imageSizes:null,imageSrcSet:null,inert:X,inputMode:null,integrity:null,is:null,isMap:X,itemId:null,itemProp:le,itemRef:le,itemScope:X,itemType:le,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:X,low:R,manifest:null,max:null,maxLength:R,media:null,method:null,min:null,minLength:R,multiple:X,muted:X,name:null,nonce:null,noModule:X,noValidate:X,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:X,optimum:R,pattern:null,ping:le,placeholder:null,playsInline:X,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:X,referrerPolicy:null,rel:le,required:X,reversed:X,rows:R,rowSpan:R,sandbox:le,scope:null,scoped:X,seamless:X,selected:X,shadowRootClonable:X,shadowRootDelegatesFocus:X,shadowRootMode:null,shape:null,size:R,sizes:null,slot:null,span:R,spellCheck:xe,src:null,srcDoc:null,srcLang:null,srcSet:null,start:R,step:null,style:null,tabIndex:R,target:null,title:null,translate:null,type:null,typeMustMatch:X,useMap:null,value:xe,width:R,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:le,axis:null,background:null,bgColor:null,border:R,borderColor:null,bottomMargin:R,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:X,declare:X,event:null,face:null,frame:null,frameBorder:null,hSpace:R,leftMargin:R,link:null,longDesc:null,lowSrc:null,marginHeight:R,marginWidth:R,noResize:X,noHref:X,noShade:X,noWrap:X,object:null,profile:null,prompt:null,rev:null,rightMargin:R,rules:null,scheme:null,scrolling:xe,standby:null,summary:null,text:null,topMargin:R,valueType:null,version:null,vAlign:null,vLink:null,vSpace:R,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:X,disableRemotePlayback:X,prefix:null,property:null,results:R,security:null,unselectable:null},space:"html",transform:os}),jg=Ft({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Te,accentHeight:R,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:R,amplitude:R,arabicForm:null,ascent:R,attributeName:null,attributeType:null,azimuth:R,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:R,by:null,calcMode:null,capHeight:R,className:le,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:R,diffuseConstant:R,direction:null,display:null,dur:null,divisor:R,dominantBaseline:null,download:X,dx:null,dy:null,edgeMode:null,editable:null,elevation:R,enableBackground:null,end:null,event:null,exponent:R,externalResourcesRequired:null,fill:null,fillOpacity:R,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:At,g2:At,glyphName:At,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:R,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:R,horizOriginX:R,horizOriginY:R,id:null,ideographic:R,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:R,k:R,k1:R,k2:R,k3:R,k4:R,kernelMatrix:Te,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:R,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:R,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:R,overlineThickness:R,paintOrder:null,panose1:null,path:null,pathLength:R,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:le,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:R,pointsAtY:R,pointsAtZ:R,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Te,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Te,rev:Te,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Te,requiredFeatures:Te,requiredFonts:Te,requiredFormats:Te,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:R,specularExponent:R,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:R,strikethroughThickness:R,string:null,stroke:null,strokeDashArray:Te,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:R,strokeOpacity:R,strokeWidth:null,style:null,surfaceScale:R,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Te,tabIndex:R,tableValues:null,target:null,targetX:R,targetY:R,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Te,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:R,underlineThickness:R,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:R,values:null,vAlphabetic:R,vMathematical:R,vectorEffect:null,vHanging:R,vIdeographic:R,version:null,vertAdvY:R,vertOriginX:R,vertOriginY:R,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:R,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:ns}),rs=Ft({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,n){return"xlink:"+n.slice(5).toLowerCase()}}),ss=Ft({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:os}),is=Ft({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()}}),Sg={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},yg=/[A-Z]/g,nr=/-[a-z]/g,Cg=/^data[-\w.:]+$/i;function kg(e,n){const o=go(n);let r=n,i=ve;if(o in e.normal)return e.property[e.normal[o]];if(o.length>4&&o.slice(0,4)==="data"&&Cg.test(n)){if(n.charAt(4)==="-"){const s=n.slice(5).replace(nr,_g);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=n.slice(4);if(!nr.test(s)){let a=s.replace(yg,bg);a.charAt(0)!=="-"&&(a="-"+a),n="data"+a}}i=Eo}return new i(r,n)}function bg(e){return"-"+e.toLowerCase()}function _g(e){return e.charAt(1).toUpperCase()}const wg=Qr([ts,Ig,rs,ss,is],"html"),vo=Qr([ts,jg,rs,ss,is],"svg");function Eg(e){return e.join(" ").trim()}var as={},or=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,vg=/\n/g,Rg=/^\s*/,Ng=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Tg=/^:\s*/,Pg=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Lg=/^[;\s]*/,Ag=/^\s+|\s+$/g,Bg=`
|
package/dist/builder.es.js
CHANGED
|
@@ -3568,18 +3568,19 @@ function hb() {
|
|
|
3568
3568
|
}
|
|
3569
3569
|
const pb = () => {
|
|
3570
3570
|
const e = Te.getState().apiUrls, t = Ie(), { notifications: n, setNotifications: o } = Le(), { isAntistock: s } = je();
|
|
3571
|
-
return async (i, a, l, c) => {
|
|
3572
|
-
const
|
|
3571
|
+
return async (i, a, l, c, d) => {
|
|
3572
|
+
const u = Pt ? localStorage.getItem("fakeDomain") : window.location.hostname, h = `${e.slApi}/v1/public/${u}/tickets`;
|
|
3573
3573
|
try {
|
|
3574
|
-
const
|
|
3574
|
+
const m = await Ee({
|
|
3575
3575
|
method: "post",
|
|
3576
|
-
url:
|
|
3576
|
+
url: h,
|
|
3577
3577
|
body: {
|
|
3578
3578
|
title: i,
|
|
3579
3579
|
firstMessage: a,
|
|
3580
3580
|
email: c,
|
|
3581
3581
|
recaptcha: l,
|
|
3582
|
-
tsId: jo()
|
|
3582
|
+
tsId: jo(),
|
|
3583
|
+
orderId: d
|
|
3583
3584
|
},
|
|
3584
3585
|
withToken: !1
|
|
3585
3586
|
});
|
|
@@ -3590,13 +3591,13 @@ const pb = () => {
|
|
|
3590
3591
|
message: s ? "Support ticket successfully created. You can expect to hear from us soon." : "Ticket created successfully. We will contact you by mail",
|
|
3591
3592
|
status: "success"
|
|
3592
3593
|
}
|
|
3593
|
-
]), t(`/ticket/${
|
|
3594
|
-
} catch (
|
|
3594
|
+
]), t(`/ticket/${m.data.id}/${m.data.accessToken}`), m;
|
|
3595
|
+
} catch (m) {
|
|
3595
3596
|
o([
|
|
3596
3597
|
...n,
|
|
3597
3598
|
{
|
|
3598
3599
|
id: Fe(),
|
|
3599
|
-
message: `Error: ${
|
|
3600
|
+
message: `Error: ${m}. Please try again later.`,
|
|
3600
3601
|
status: "error"
|
|
3601
3602
|
}
|
|
3602
3603
|
]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useCreateTicket: () => (title: string, message: string, recaptcha: string, email: string) => Promise<import("@api").RequestResponse<any> | undefined>;
|
|
1
|
+
export declare const useCreateTicket: () => (title: string, message: string, recaptcha: string, email: string, orderId?: string) => Promise<import("@api").RequestResponse<any> | undefined>;
|