import{I as ra,K as aa,bE as na,bN as oa,bz as lr,bH as pt,E as sa,bG as ia,B as ca,bO as la,G as ua,bP as da,Y as ma,r as f,x as Xe,j as t,F as j,d as p,e as P,b as be,p as Sr,o as Fe,i as N,bQ as pa,bR as fa,l as se,a1 as rt,ai as ha,u as ba,m as xa,bS as va,c as at,n as kt,a2 as ya,bT as ga,q as Ee,w as Se,a5 as ka,aj as ur,ak as wa,bU as Na,bV as Ca,bW as Sa,bX as Ea,k as Ra,bY as Aa}from"../../../chunk-06e5dacf.js";import{W as La}from"../../../chunk-d2233425.js";import{L as Ia,N as Er,J as je,i as dr,D as Ue,y as qe,O as Oa,o as z,l as Re,v as Ta,w as $a,x as _a,z as Me,k as Pa,m as et,P as Da,R as za,U as ja,V as Fa,X as Be,I as nt,q as Q,r as Ua,C as qa,j as Ba,E as yt,K as Va,t as tt,W as wt,Y as Ae,c as Rr,h as Wa,e as mr,Z as Ka,$ as Ga,a0 as ft,a1 as Qa,a2 as Ha,a3 as Ar,a4 as Lr}from"../../../chunk-86d0f190.js";import{k as Ja,P as pe,Q as Xa,f as gt,C as Ye,d as ot,u as Ir,R as Za,S as pr,x as Ya,s as Ma,T as Or,y as Tr,q as $r,U as en,V as fr,W as hr,X as _e,z as br,r as ht,A as tn,B as rn,w as an,Y as bt,Z as xr,$ as nn}from"../../../chunk-ea82ba7b.js";import{n as xt}from"../../../chunk-06db561b.js";import"../../../chunk-5d6d9427.js";import"../../../chunk-8505b20b.js";import{s as Pe}from"../../../chunk-d44934cf.js";import{u as on,t as sn}from"../../../chunk-6c9411f6.js";import{u as cn}from"../../../chunk-66b930c8.js";import{_ as _r}from"../../../chunk-4b95c2fb.js";import{a as ee,b as ln,u as un,x as dn}from"../../../chunk-d6455dbb.js";import{s as mn}from"../../../chunk-c5a2be9b.js";import{E as fe,F as pn}from"../../../chunk-c17ba02e.js";import{i as Ze}from"../../../chunk-97161c54.js";import{C as fn}from"../../../chunk-99b3f31c.js";import{f as hn}from"../../../chunk-d6f27383.js";import"../../../chunk-e4587ebd.js";function vr(e,r,a){if(!ra(a))return!1;var n=typeof r;return(n=="number"?aa(a)&&na(r,a.length):n=="string"&&r in a)?oa(a[r],e):!1}var bn=Ja(function(e,r,a){return e+(a?"-":"")+r.toLowerCase()}),xn=bn;function vn(e,r){var a=e.length;for(e.sort(r);a--;)e[a]=e[a].value;return e}function yn(e,r){if(e!==r){var a=e!==void 0,n=e===null,s=e===e,i=lr(e),o=r!==void 0,d=r===null,l=r===r,b=lr(r);if(!d&&!b&&!i&&e>r||i&&o&&l&&!d&&!b||n&&o&&l||!a&&l||!s)return 1;if(!n&&!i&&!b&&e<r||b&&a&&s&&!n&&!i||d&&a&&s||!o&&s||!l)return-1}return 0}function gn(e,r,a){for(var n=-1,s=e.criteria,i=r.criteria,o=s.length,d=a.length;++n<o;){var l=yn(s[n],i[n]);if(l){if(n>=d)return l;var b=a[n];return l*(b=="desc"?-1:1)}}return e.index-r.index}function kn(e,r,a){r.length?r=pt(r,function(i){return sa(i)?function(o){return ia(o,i.length===1?i[0]:i)}:i}):r=[ca];var n=-1;r=pt(r,la(ua));var s=da(e,function(i,o,d){var l=pt(r,function(b){return b(i)});return{criteria:l,index:++n,value:i}});return vn(s,function(i,o){return gn(i,o,a)})}var wn=Ia(function(e,r){if(e==null)return[];var a=r.length;return a>1&&vr(e,r[0],r[1])?r=[]:a>2&&vr(r[0],r[1],r[2])&&(r=[r[0]]),kn(e,ma(r,1),[])}),Nn=wn;function Cn({title:e,titleId:r,...a},n){return f.exports.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",ref:n,"aria-labelledby":r},a),e?f.exports.createElement("title",{id:r},e):null,f.exports.createElement("path",{fillRule:"evenodd",d:"M6.75 2.25A.75.75 0 017.5 3v1.5h9V3A.75.75 0 0118 3v1.5h.75a3 3 0 013 3v11.25a3 3 0 01-3 3H5.25a3 3 0 01-3-3V7.5a3 3 0 013-3H6V3a.75.75 0 01.75-.75zm13.5 9a1.5 1.5 0 00-1.5-1.5H5.25a1.5 1.5 0 00-1.5 1.5v7.5a1.5 1.5 0 001.5 1.5h13.5a1.5 1.5 0 001.5-1.5v-7.5z",clipRule:"evenodd"}))}const Sn=f.exports.forwardRef(Cn);var En=Sn;function Rn({title:e,titleId:r,...a},n){return f.exports.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",ref:n,"aria-labelledby":r},a),e?f.exports.createElement("title",{id:r},e):null,f.exports.createElement("path",{fillRule:"evenodd",d:"M12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25zM12.75 6a.75.75 0 00-1.5 0v6c0 .414.336.75.75.75h4.5a.75.75 0 000-1.5h-3.75V6z",clipRule:"evenodd"}))}const An=f.exports.forwardRef(Rn);var Ln=An;function Pr(e,r){let[a,n]=f.exports.useState(e),s=Er(e);return je(()=>n(s.current),[s,n,...r]),a}var In=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(In||{}),On=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(On||{}),Tn=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(Tn||{}),$n=(e=>(e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterOption=5]="RegisterOption",e[e.UnregisterOption=6]="UnregisterOption",e[e.RegisterLabel=7]="RegisterLabel",e))($n||{});function vt(e,r=a=>a){let a=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,n=Va(r(e.options.slice()),i=>i.dataRef.current.domRef.current),s=a?n.indexOf(a):null;return s===-1&&(s=null),{options:n,activeOptionIndex:s}}let _n={[1](e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,listboxState:1}},[0](e){if(e.dataRef.current.disabled||e.listboxState===0)return e;let r=e.activeOptionIndex,{isSelected:a}=e.dataRef.current,n=e.options.findIndex(s=>a(s.dataRef.current.value));return n!==-1&&(r=n),{...e,listboxState:0,activeOptionIndex:r}},[2](e,r){var a;if(e.dataRef.current.disabled||e.listboxState===1)return e;let n=vt(e),s=dn(r,{resolveItems:()=>n.options,resolveActiveIndex:()=>n.activeOptionIndex,resolveId:i=>i.id,resolveDisabled:i=>i.dataRef.current.disabled});return{...e,...n,searchQuery:"",activeOptionIndex:s,activationTrigger:(a=r.trigger)!=null?a:1}},[3]:(e,r)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let a=e.searchQuery!==""?0:1,n=e.searchQuery+r.value.toLowerCase(),s=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+a).concat(e.options.slice(0,e.activeOptionIndex+a)):e.options).find(o=>{var d;return!o.dataRef.current.disabled&&((d=o.dataRef.current.textValue)==null?void 0:d.startsWith(n))}),i=s?e.options.indexOf(s):-1;return i===-1||i===e.activeOptionIndex?{...e,searchQuery:n}:{...e,searchQuery:n,activeOptionIndex:i,activationTrigger:1}},[4](e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},[5]:(e,r)=>{let a={id:r.id,dataRef:r.dataRef},n=vt(e,s=>[...s,a]);return e.activeOptionIndex===null&&e.dataRef.current.isSelected(r.dataRef.current.value)&&(n.activeOptionIndex=n.options.indexOf(a)),{...e,...n}},[6]:(e,r)=>{let a=vt(e,n=>{let s=n.findIndex(i=>i.id===r.id);return s!==-1&&n.splice(s,1),n});return{...e,...a,activationTrigger:1}},[7]:(e,r)=>({...e,labelId:r.id})},Nt=f.exports.createContext(null);Nt.displayName="ListboxActionsContext";function Ve(e){let r=f.exports.useContext(Nt);if(r===null){let a=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(a,Ve),a}return r}let Ct=f.exports.createContext(null);Ct.displayName="ListboxDataContext";function We(e){let r=f.exports.useContext(Ct);if(r===null){let a=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(a,We),a}return r}function Pn(e,r){return Re(r.type,_n,e,r)}let Dn=f.exports.Fragment;function zn(e,r){let{value:a,defaultValue:n,form:s,name:i,onChange:o,by:d=(A,$)=>A===$,disabled:l=!1,horizontal:b=!1,multiple:w=!1,...y}=e;const k=b?"horizontal":"vertical";let h=qe(r),[x=w?[]:void 0,v]=Oa(a,o,n),[E,u]=f.exports.useReducer(Pn,{dataRef:f.exports.createRef(),listboxState:1,options:[],searchQuery:"",labelId:null,activeOptionIndex:null,activationTrigger:1}),C=f.exports.useRef({static:!1,hold:!1}),R=f.exports.useRef(null),W=f.exports.useRef(null),J=f.exports.useRef(null),c=z(typeof d=="string"?(A,$)=>{let G=d;return(A==null?void 0:A[G])===($==null?void 0:$[G])}:d),T=f.exports.useCallback(A=>Re(g.mode,{[1]:()=>x.some($=>c($,A)),[0]:()=>c(x,A)}),[x]),g=f.exports.useMemo(()=>({...E,value:x,disabled:l,mode:w?1:0,orientation:k,compare:c,isSelected:T,optionsPropsRef:C,labelRef:R,buttonRef:W,optionsRef:J}),[x,l,w,E]);je(()=>{E.dataRef.current=g},[g]),Ta([g.buttonRef,g.optionsRef],(A,$)=>{var G;u({type:1}),$a($,_a.Loose)||(A.preventDefault(),(G=g.buttonRef.current)==null||G.focus())},g.listboxState===0);let S=f.exports.useMemo(()=>({open:g.listboxState===0,disabled:l,value:x}),[g,l,x]),K=z(A=>{let $=g.options.find(G=>G.id===A);$&&D($.dataRef.current.value)}),F=z(()=>{if(g.activeOptionIndex!==null){let{dataRef:A,id:$}=g.options[g.activeOptionIndex];D(A.current.value),u({type:2,focus:ee.Specific,id:$})}}),I=z(()=>u({type:0})),ie=z(()=>u({type:1})),le=z((A,$,G)=>A===ee.Specific?u({type:2,focus:ee.Specific,id:$,trigger:G}):u({type:2,focus:A,trigger:G})),ue=z((A,$)=>(u({type:5,id:A,dataRef:$}),()=>u({type:6,id:A}))),xe=z(A=>(u({type:7,id:A}),()=>u({type:7,id:null}))),D=z(A=>Re(g.mode,{[0](){return v==null?void 0:v(A)},[1](){let $=g.value.slice(),G=$.findIndex(ye=>c(ye,A));return G===-1?$.push(A):$.splice(G,1),v==null?void 0:v($)}})),Z=z(A=>u({type:3,value:A})),q=z(()=>u({type:4})),Y=f.exports.useMemo(()=>({onChange:D,registerOption:ue,registerLabel:xe,goToOption:le,closeListbox:ie,openListbox:I,selectActiveOption:F,selectOption:K,search:Z,clearSearch:q}),[]),te={ref:h},ve=f.exports.useRef(null),ke=Me();return f.exports.useEffect(()=>{ve.current&&n!==void 0&&ke.addEventListener(ve.current,"reset",()=>{v==null||v(n)})},[ve,v]),Xe.createElement(Nt.Provider,{value:Y},Xe.createElement(Ct.Provider,{value:g},Xe.createElement(Pa,{value:Re(g.listboxState,{[0]:et.Open,[1]:et.Closed})},i!=null&&x!=null&&Da({[i]:x}).map(([A,$],G)=>Xe.createElement(za,{features:ja.Hidden,ref:G===0?ye=>{var we;ve.current=(we=ye==null?void 0:ye.closest("form"))!=null?we:null}:void 0,...Fa({key:A,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:s,name:A,value:$})})),Be({ourProps:te,theirProps:y,slot:S,defaultTag:Dn,name:"Listbox"}))))}let jn="button";function Fn(e,r){var a;let n=nt(),{id:s=`headlessui-listbox-button-${n}`,...i}=e,o=We("Listbox.Button"),d=Ve("Listbox.Button"),l=qe(o.buttonRef,r),b=Me(),w=z(E=>{switch(E.key){case Q.Space:case Q.Enter:case Q.ArrowDown:E.preventDefault(),d.openListbox(),b.nextFrame(()=>{o.value||d.goToOption(ee.First)});break;case Q.ArrowUp:E.preventDefault(),d.openListbox(),b.nextFrame(()=>{o.value||d.goToOption(ee.Last)});break}}),y=z(E=>{switch(E.key){case Q.Space:E.preventDefault();break}}),k=z(E=>{if(Ua(E.currentTarget))return E.preventDefault();o.listboxState===0?(d.closeListbox(),b.nextFrame(()=>{var u;return(u=o.buttonRef.current)==null?void 0:u.focus({preventScroll:!0})})):(E.preventDefault(),d.openListbox())}),h=Pr(()=>{if(o.labelId)return[o.labelId,s].join(" ")},[o.labelId,s]),x=f.exports.useMemo(()=>({open:o.listboxState===0,disabled:o.disabled,value:o.value}),[o]),v={ref:l,id:s,type:mn(e,o.buttonRef),"aria-haspopup":"listbox","aria-controls":(a=o.optionsRef.current)==null?void 0:a.id,"aria-expanded":o.listboxState===0,"aria-labelledby":h,disabled:o.disabled,onKeyDown:w,onKeyUp:y,onClick:k};return Be({ourProps:v,theirProps:i,slot:x,defaultTag:jn,name:"Listbox.Button"})}let Un="label";function qn(e,r){let a=nt(),{id:n=`headlessui-listbox-label-${a}`,...s}=e,i=We("Listbox.Label"),o=Ve("Listbox.Label"),d=qe(i.labelRef,r);je(()=>o.registerLabel(n),[n]);let l=z(()=>{var w;return(w=i.buttonRef.current)==null?void 0:w.focus({preventScroll:!0})}),b=f.exports.useMemo(()=>({open:i.listboxState===0,disabled:i.disabled}),[i]);return Be({ourProps:{ref:d,id:n,onClick:l},theirProps:s,slot:b,defaultTag:Un,name:"Listbox.Label"})}let Bn="ul",Vn=dr.RenderStrategy|dr.Static;function Wn(e,r){var a;let n=nt(),{id:s=`headlessui-listbox-options-${n}`,...i}=e,o=We("Listbox.Options"),d=Ve("Listbox.Options"),l=qe(o.optionsRef,r),b=Me(),w=Me(),y=qa(),k=(()=>y!==null?(y&et.Open)===et.Open:o.listboxState===0)();f.exports.useEffect(()=>{var u;let C=o.optionsRef.current;C&&o.listboxState===0&&C!==((u=Ba(C))==null?void 0:u.activeElement)&&C.focus({preventScroll:!0})},[o.listboxState,o.optionsRef]);let h=z(u=>{switch(w.dispose(),u.key){case Q.Space:if(o.searchQuery!=="")return u.preventDefault(),u.stopPropagation(),d.search(u.key);case Q.Enter:if(u.preventDefault(),u.stopPropagation(),o.activeOptionIndex!==null){let{dataRef:C}=o.options[o.activeOptionIndex];d.onChange(C.current.value)}o.mode===0&&(d.closeListbox(),yt().nextFrame(()=>{var C;return(C=o.buttonRef.current)==null?void 0:C.focus({preventScroll:!0})}));break;case Re(o.orientation,{vertical:Q.ArrowDown,horizontal:Q.ArrowRight}):return u.preventDefault(),u.stopPropagation(),d.goToOption(ee.Next);case Re(o.orientation,{vertical:Q.ArrowUp,horizontal:Q.ArrowLeft}):return u.preventDefault(),u.stopPropagation(),d.goToOption(ee.Previous);case Q.Home:case Q.PageUp:return u.preventDefault(),u.stopPropagation(),d.goToOption(ee.First);case Q.End:case Q.PageDown:return u.preventDefault(),u.stopPropagation(),d.goToOption(ee.Last);case Q.Escape:return u.preventDefault(),u.stopPropagation(),d.closeListbox(),b.nextFrame(()=>{var C;return(C=o.buttonRef.current)==null?void 0:C.focus({preventScroll:!0})});case Q.Tab:u.preventDefault(),u.stopPropagation();break;default:u.key.length===1&&(d.search(u.key),w.setTimeout(()=>d.clearSearch(),350));break}}),x=Pr(()=>{var u,C,R;return(R=(u=o.labelRef.current)==null?void 0:u.id)!=null?R:(C=o.buttonRef.current)==null?void 0:C.id},[o.labelRef.current,o.buttonRef.current]),v=f.exports.useMemo(()=>({open:o.listboxState===0}),[o]),E={"aria-activedescendant":o.activeOptionIndex===null||(a=o.options[o.activeOptionIndex])==null?void 0:a.id,"aria-multiselectable":o.mode===1?!0:void 0,"aria-labelledby":x,"aria-orientation":o.orientation,id:s,onKeyDown:h,role:"listbox",tabIndex:0,ref:l};return Be({ourProps:E,theirProps:i,slot:v,defaultTag:Bn,features:Vn,visible:k,name:"Listbox.Options"})}let Kn="li";function Gn(e,r){let a=nt(),{id:n=`headlessui-listbox-option-${a}`,disabled:s=!1,value:i,...o}=e,d=We("Listbox.Option"),l=Ve("Listbox.Option"),b=d.activeOptionIndex!==null?d.options[d.activeOptionIndex].id===n:!1,w=d.isSelected(i),y=f.exports.useRef(null),k=ln(y),h=Er({disabled:s,value:i,domRef:y,get textValue(){return k()}}),x=qe(r,y);je(()=>{if(d.listboxState!==0||!b||d.activationTrigger===0)return;let c=yt();return c.requestAnimationFrame(()=>{var T,g;(g=(T=y.current)==null?void 0:T.scrollIntoView)==null||g.call(T,{block:"nearest"})}),c.dispose},[y,b,d.listboxState,d.activationTrigger,d.activeOptionIndex]),je(()=>l.registerOption(n,h),[h,n]);let v=z(c=>{if(s)return c.preventDefault();l.onChange(i),d.mode===0&&(l.closeListbox(),yt().nextFrame(()=>{var T;return(T=d.buttonRef.current)==null?void 0:T.focus({preventScroll:!0})}))}),E=z(()=>{if(s)return l.goToOption(ee.Nothing);l.goToOption(ee.Specific,n)}),u=un(),C=z(c=>u.update(c)),R=z(c=>{u.wasMoved(c)&&(s||b||l.goToOption(ee.Specific,n,0))}),W=z(c=>{u.wasMoved(c)&&(s||b&&l.goToOption(ee.Nothing))}),J=f.exports.useMemo(()=>({active:b,selected:w,disabled:s}),[b,w,s]);return Be({ourProps:{id:n,ref:x,role:"option",tabIndex:s===!0?void 0:-1,"aria-disabled":s===!0?!0:void 0,"aria-selected":w,disabled:void 0,onClick:v,onFocus:E,onPointerEnter:C,onMouseEnter:C,onPointerMove:R,onMouseMove:R,onPointerLeave:W,onMouseLeave:W},theirProps:o,slot:J,defaultTag:Kn,name:"Listbox.Option"})}let Qn=Ue(zn),Hn=Ue(Fn),Jn=Ue(qn),Xn=Ue(Wn),Zn=Ue(Gn),De=Object.assign(Qn,{Button:Hn,Label:Jn,Options:Xn,Option:Zn});function Yn({title:e,titleId:r,...a},n){return f.exports.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:n,"aria-labelledby":r},a),e?f.exports.createElement("title",{id:r},e):null,f.exports.createElement("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",clipRule:"evenodd"}))}const Mn=f.exports.forwardRef(Yn);var eo=Mn;/*!
 * react-paypal-js v7.8.3 (2023-03-27T21:19:05.517Z)
 * Copyright 2020-present, PayPal, Inc. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var X;(function(e){e.INITIAL="initial",e.PENDING="pending",e.REJECTED="rejected",e.RESOLVED="resolved"})(X||(X={}));var he;(function(e){e.LOADING_STATUS="setLoadingStatus",e.RESET_OPTIONS="resetOptions",e.SET_BRAINTREE_INSTANCE="braintreeInstance"})(he||(he={}));var yr;(function(e){e.NUMBER="number",e.CVV="cvv",e.EXPIRATION_DATE="expirationDate",e.EXPIRATION_MONTH="expirationMonth",e.EXPIRATION_YEAR="expirationYear",e.POSTAL_CODE="postalCode"})(yr||(yr={}));var ze="data-react-paypal-script-id",Le={DATA_CLIENT_TOKEN:"data-client-token",DATA_USER_ID_TOKEN:"data-user-id-token",DATA_SDK_INTEGRATION_SOURCE:"data-sdk-integration-source",DATA_SDK_INTEGRATION_SOURCE_VALUE:"react-paypal-js",DATA_NAMESPACE:"data-namespace"},to="Failed to load the PayPal JS SDK script.",Dr="paypal",ro="usePayPalScriptReducer must be used within a PayPalScriptProvider",V=function(){return V=Object.assign||function(r){for(var a,n=1,s=arguments.length;n<s;n++){a=arguments[n];for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(r[i]=a[i])}return r},V.apply(this,arguments)};function ao(e,r){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(a[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(e);s<n.length;s++)r.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(a[n[s]]=e[n[s]]);return a}function gr(e,r,a){if(a||arguments.length===2)for(var n=0,s=r.length,i;n<s;n++)(i||!(n in r))&&(i||(i=Array.prototype.slice.call(r,0,n)),i[n]=r[n]);return e.concat(i||Array.prototype.slice.call(r))}function no(e){return e===void 0&&(e=Dr),window[e]}function oo(e){for(var r="",a=0;a<e.length;a++){var n=e[a].charCodeAt(0)*a;e[a+1]&&(n+=e[a+1].charCodeAt(0)*(a-1)),r+=String.fromCharCode(97+Math.abs(n)%26)}return r}function so(e){var r=e.reactComponentName,a=e.sdkComponentKey,n=e.sdkRequestedComponents,s=n===void 0?"":n,i=e.sdkDataNamespace,o=i===void 0?Dr:i,d=a.charAt(0).toUpperCase().concat(a.substring(1)),l="Unable to render <".concat(r," /> because window.").concat(o,".").concat(d," is undefined.");if(!s.includes(a)){var b=[s,a].filter(Boolean).join();l+=`
To fix the issue, add '`.concat(a,"' to the list of components passed to the parent PayPalScriptProvider:")+"\n`<PayPalScriptProvider options={{ components: '".concat(b,"'}}>`.")}return l}function zr(e){return"react-paypal-js-".concat(oo(JSON.stringify(e)))}function io(e){var r=self.document.querySelector("script[".concat(ze,'="').concat(e,'"]'));r!=null&&r.parentNode&&r.parentNode.removeChild(r)}function co(e,r){var a;switch(r.type){case he.LOADING_STATUS:return V(V({},e),{loadingStatus:r.value});case he.RESET_OPTIONS:return io(e.options[ze]),delete r.value[ze],V(V({},e),{loadingStatus:X.PENDING,options:V(V({},r.value),(a={},a[ze]="".concat(zr(r.value)),a[Le.DATA_SDK_INTEGRATION_SOURCE]=Le.DATA_SDK_INTEGRATION_SOURCE_VALUE,a))});case he.SET_BRAINTREE_INSTANCE:return V(V({},e),{braintreePayPalCheckoutInstance:r.value});default:return e}}var jr=f.exports.createContext(null);function lo(e){if(typeof(e==null?void 0:e.dispatch)=="function"&&e.dispatch.length!==0)return e;throw new Error(ro)}function uo(){var e=lo(f.exports.useContext(jr)),r=V(V({},e),{isInitial:e.loadingStatus===X.INITIAL,isPending:e.loadingStatus===X.PENDING,isResolved:e.loadingStatus===X.RESOLVED,isRejected:e.loadingStatus===X.REJECTED});return[r,e.dispatch]}f.exports.createContext({});var St=function(e){var r=e.className,a=r===void 0?"":r,n=e.disabled,s=n===void 0?!1:n,i=e.children,o=e.forceReRender,d=o===void 0?[]:o,l=ao(e,["className","disabled","children","forceReRender"]),b=s?{opacity:.38}:{},w="".concat(a," ").concat(s?"paypal-buttons-disabled":"").trim(),y=f.exports.useRef(null),k=f.exports.useRef(null),h=uo()[0],x=h.isResolved,v=h.options,E=f.exports.useState(null),u=E[0],C=E[1],R=f.exports.useState(!0),W=R[0],J=R[1],c=f.exports.useState(null),T=c[1];function g(){k.current!==null&&k.current.close().catch(function(){})}return f.exports.useEffect(function(){if(x===!1)return g;var S=no(v[Le.DATA_NAMESPACE]);if(S===void 0||S.Buttons===void 0)return T(function(){throw new Error(so({reactComponentName:St.displayName,sdkComponentKey:"buttons",sdkRequestedComponents:v.components,sdkDataNamespace:v[Le.DATA_NAMESPACE]}))}),g;var K=function(F,I){C(I),typeof l.onInit=="function"&&l.onInit(F,I)};try{k.current=S.Buttons(V(V({},l),{onInit:K}))}catch(F){return T(function(){throw new Error("Failed to render <PayPalButtons /> component. Failed to initialize:  ".concat(F))})}return k.current.isEligible()===!1?(J(!1),g):(y.current&&k.current.render(y.current).catch(function(F){y.current===null||y.current.children.length===0||T(function(){throw new Error("Failed to render <PayPalButtons /> component. ".concat(F))})}),g)},gr(gr([x],d,!0),[l.fundingSource],!1)),f.exports.useEffect(function(){u!==null&&(s===!0?u.disable().catch(function(){}):u.enable().catch(function(){}))},[s,u]),t(j,{children:W?t("div",{ref:y,style:b,className:w}):i})};St.displayName="PayPalButtons";function mo(e,r){var a=document.querySelector('script[src="'.concat(e,'"]'));if(a===null)return null;var n=Fr(e,r),s=a.cloneNode();if(delete s.dataset.uidAuto,Object.keys(s.dataset).length!==Object.keys(n.dataset).length)return null;var i=!0;return Object.keys(s.dataset).forEach(function(o){s.dataset[o]!==n.dataset[o]&&(i=!1)}),i?a:null}function po(e){var r=e.url,a=e.attributes,n=e.onSuccess,s=e.onError,i=Fr(r,a);i.onerror=s,i.onload=n,document.head.insertBefore(i,document.head.firstElementChild)}function fo(e){var r="https://www.paypal.com/sdk/js";e.sdkBaseURL&&(r=e.sdkBaseURL,delete e.sdkBaseURL),xo(e);var a=Object.keys(e).filter(function(i){return typeof e[i]!="undefined"&&e[i]!==null&&e[i]!==""}).reduce(function(i,o){var d=e[o].toString();return o.substring(0,5)==="data-"?i.dataAttributes[o]=d:i.queryParams[o]=d,i},{queryParams:{},dataAttributes:{}}),n=a.queryParams,s=a.dataAttributes;return{url:"".concat(r,"?").concat(ho(n)),dataAttributes:s}}function ho(e){var r="";return Object.keys(e).forEach(function(a){r.length!==0&&(r+="&"),r+=a+"="+e[a]}),r}function bo(e){var r=e.split("/* Original Error:")[1];return r?r.replace(/\n/g,"").replace("*/","").trim():e}function Fr(e,r){r===void 0&&(r={});var a=document.createElement("script");return a.src=e,Object.keys(r).forEach(function(n){a.setAttribute(n,r[n]),n==="data-csp-nonce"&&a.setAttribute("nonce",r["data-csp-nonce"])}),a}function xo(e){var r=e["merchant-id"],a=e["data-merchant-id"],n="",s="";return Array.isArray(r)?r.length>1?(n="*",s=r.toString()):n=r.toString():typeof r=="string"&&r.length>0?n=r:typeof a=="string"&&a.length>0&&(n="*",s=a),e["merchant-id"]=n,e["data-merchant-id"]=s,e}function vo(e,r){if(r===void 0&&(r=Ur()),qr(e,r),typeof document=="undefined")return r.resolve(null);var a=fo(e),n=a.url,s=a.dataAttributes,i=s["data-namespace"]||"paypal",o=kr(i);return mo(n,s)&&o?r.resolve(o):yo({url:n,attributes:s},r).then(function(){var d=kr(i);if(d)return d;throw new Error("The window.".concat(i," global variable is not available."))})}function yo(e,r){r===void 0&&(r=Ur()),qr(e,r);var a=e.url,n=e.attributes;if(typeof a!="string"||a.length===0)throw new Error("Invalid url.");if(typeof n!="undefined"&&typeof n!="object")throw new Error("Expected attributes to be an object.");return new r(function(s,i){if(typeof document=="undefined")return s();po({url:a,attributes:n,onSuccess:function(){return s()},onError:function(){var o=new Error('The script "'.concat(a,'" failed to load.'));return window.fetch?fetch(a).then(function(d){return d.status===200&&i(o),d.text()}).then(function(d){var l=bo(d);i(new Error(l))}).catch(function(d){i(d)}):i(o)}})})}function Ur(){if(typeof Promise=="undefined")throw new Error("Promise is undefined. To resolve the issue, use a Promise polyfill.");return Promise}function kr(e){return window[e]}function qr(e,r){if(typeof e!="object"||e===null)throw new Error("Expected an options object.");if(typeof r!="undefined"&&typeof r!="function")throw new Error("Expected PromisePonyfill to be a function.")}var go=function(e){var r,a=e.options,n=a===void 0?{"client-id":"test"}:a,s=e.children,i=e.deferLoading,o=i===void 0?!1:i,d=f.exports.useReducer(co,{options:V(V({},n),(r={},r[ze]="".concat(zr(n)),r[Le.DATA_SDK_INTEGRATION_SOURCE]=Le.DATA_SDK_INTEGRATION_SOURCE_VALUE,r)),loadingStatus:o?X.INITIAL:X.PENDING}),l=d[0],b=d[1];return f.exports.useEffect(function(){if(o===!1&&l.loadingStatus===X.INITIAL)return b({type:he.LOADING_STATUS,value:X.PENDING});if(l.loadingStatus===X.PENDING){var w=!0;return vo(l.options).then(function(){w&&b({type:he.LOADING_STATUS,value:X.RESOLVED})}).catch(function(y){console.error("".concat(to," ").concat(y)),w&&b({type:he.LOADING_STATUS,value:X.REJECTED})}),function(){w=!1}}},[l.options,o,l.loadingStatus]),t(jr.Provider,{value:V(V({},l),{dispatch:b}),children:s})};function ko({primary:e}){return p("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 4000 3000",children:[t("path",{fill:Pe(e,.2),d:"M2325.4 479.5c-532.5 0-623.2 620.6-1222.9 620.6s-766.2 1175.8 817 1175.8c1996.1 0 1620-1796.4 405.9-1796.4z",className:"colord3e8f9 svgShape"}),t("path",{fill:Pe(e,.7),d:"M2931.8 2552.7s-196.7 138.4-694.8 138.4c-498.1 0-641.6-157.6-641.6-157.6l11.4-92.6s193-118.6 651.6-118.6c458.7 0 668.4 118.6 668.4 118.6l5 111.8z",className:"color87b4de svgShape"}),t("path",{fill:e,d:"M1232 632.1s-68.3-90.8 119.8-234.8c0 0-29 54.1 0 92.9 0 0 8.5-85.2 53.4-118.5 44.9-33.2 248.4-65.7 273.6-62.6S1769 353 1769 353s-292.2 368.6-493.6 301.6",className:"color1f3e76 svgShape"}),t("path",{fill:Pe(e,.9),d:"M1352 549.5v-59l-.2-.6c-28.7-38.8.1-92.6.1-92.6-188.1 144-119.9 234.8-119.9 234.8l43.4 22.5c84.3 28 184.8-20.3 272.8-85.9-112.2 4.8-196.2-19.2-196.2-19.2z",className:"color3279af svgShape"}),t("path",{fill:"none",stroke:pe(e,.1),strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"10",strokeWidth:"10",d:"M2931.8 2552.7s-196.7 138.4-694.8 138.4c-498.1 0-641.6-158.1-641.6-158.1l11.4-93.1h0l147.1-1193.1c17.2-139.6 84.6-262 182.9-350.1S2164.3 755 2304.9 753c304.2-4.2 556.7 234 570.3 537.9l51.6 1149.9 5 111.9z",className:"colorStroke1f3e76 svgStroke"}),t("path",{fill:Pe(e,.9),d:"M2926.8 2440.9s-296.6 111.8-687 111.8-633-111.8-633-111.8 193-118.7 651.7-118.7 668.3 118.7 668.3 118.7z",className:"color3279af svgShape"}),t("path",{fill:"none",stroke:pe(e,.1),strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"10",strokeWidth:"10",d:"M2926.8 2440.9s-296.6 111.8-687 111.8-633-111.8-633-111.8",className:"colorStroke1f3e76 svgStroke"}),t("path",{fill:"none",stroke:pe(e,.1),strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"10",strokeWidth:"10",d:"M1465.8 1492.7L1353.8 2016",className:"colorStroke1f3e76 svgStroke"}),t("path",{fill:"none",stroke:pe(e,.1),strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"10",strokeWidth:"10",d:"M1595.4 1559L1489.3 2056",className:"colorStroke1f3e76 svgStroke"}),t("path",{fill:"none",stroke:pe(e,.1),strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"10",strokeWidth:"10",d:"M2330.2 753.5L2274.4 2552.4",className:"colorStroke1f3e76 svgStroke"}),t("path",{fill:"none",stroke:pe(e,.1),strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"10",strokeWidth:"10",d:"M2519.3 792.3s90.8 72.5 105.1 615.6c14.2 543.1-6.3 1111.3-6.3 1111.3m-603.8-430.6c-12.2 249.6-21.6 448.8-21.6 448.8m163.3-1762s-78.2 113.9-98.6 470.8c-4.2 73.2-9.4 170.8-15 279.6m-271.5 538.6c-17.4 234-29.2 423-29.2 423m236.8-1624.3s-90.4 124.3-137.4 454.3c-9 63.1-18.2 144.9-27.1 235.8m903.6-628.3s57.1 158.3 81.7 392.5 37.9 1152 37.9 1152",className:"colorStroke1f3e76 svgStroke"}),t("path",{fill:"none",stroke:pe(e,.1),strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"10",strokeWidth:"10",d:"M2856.7 1170.5s-200.5-97.8-554.4-97.8-533.5 97.8-533.5 97.8 242.1 74.3 533.5 74.3 554.4-74.3 554.4-74.3z",className:"colorStroke1f3e76 svgStroke"}),t("path",{fill:"none",stroke:Pe(e,.7),strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"10",strokeWidth:"10",d:"M1375.6 1709.1s-140.4.2-262.4-229.7 2.1-372.2 97.5-357.8 95.9 197.9-39.5 189c-84.3-5.5-253.7-204-84.6-468.4",className:"colorStroke87b4de svgStroke"}),t("path",{fill:Xa(e,.06),d:"M1163.4 789.8s193.3-289.3 515.4-418.1c0 0-177.7 29.8-446.8 260.4-61.5 52.7-68.6 157.7-68.6 157.7z",className:"color87b4de svgShape"}),t("path",{fill:"none",stroke:pe(e,.1),strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"10",strokeWidth:"10",d:"M2286.9 751.8s-43.2-30.1-43.2-71.1c0-41 23.4-80.5 84.9-80.5 61.4 0 78.5 42 78.5 81.1 0 39.2-47.9 71.6-47.9 71.6m-703.4 1290.4s276.4-27.3 635.2-27.3 618.2 32.9 618.2 32.9-192.8 47.7-620.7 47.7-632.7-53.3-632.7-53.3-61.2 42.3-227.4 0-210.9-162.5-210.9-162.5l146.3-490.8s66.9 93.7 166.9 143.8c100 50.1 183.3 37.1 183.3 37.1s229.9-55 592.5-55 581.2 55 581.2 55-243.9 25.8-583.8 25.8-590-25.8-590-25.8",className:"colorStroke1f3e76 svgStroke"})]})}const Br=({options:e,value:r,onChange:a,error:n,label:s,id:i})=>p(j,{children:[p("div",{className:"has-hover:hidden",children:[t("label",{htmlFor:i,className:"block text-sm font-medium text-gray-700",children:s}),t("div",{className:"mt-1",children:t("select",{id:i,className:P(n?"border-red-300 text-red-900 placeholder-red-300 focus:border-red-500 focus:outline-none focus:ring-red-500":"border-gray-300 focus:border-primary/75 focus:ring-primary/75","block w-full rounded-lg text-sm shadow-sm"),value:r,onChange:a,children:e==null?void 0:e.map(o=>t("option",{children:o.value},o.id))})})]}),p(De,{as:"div",value:r,onChange:a,className:"relative hidden has-hover:block",children:[t(De.Label,{className:"block text-sm font-medium text-gray-700",children:s}),p("div",{className:"mt-1",children:[p(De.Button,{className:P(n?"border-red-300 text-red-900 placeholder-red-300 focus:border-red-500 focus:outline-none focus:ring-red-500":"border-gray-300 focus:border-primary/75 focus:ring-primary/75","relative min-h-[38px] w-full cursor-default rounded-lg bg-white py-2 pl-3 pr-10 text-left text-sm text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 focus:outline-none focus:ring-2 sm:leading-[22px]"),children:[r,t("span",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2",children:t(eo,{className:"h-5 w-5 text-gray-400"})})]}),t(tt,{as:f.exports.Fragment,enter:"transition ease-out duration-200",enterFrom:"opacity-0 translate-y-1",enterTo:"opacity-100 translate-y-0",leave:"transition ease-in duration-150",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 translate-y-1",children:t(De.Options,{className:"absolute z-10 mt-1 max-h-60 w-full overflow-auto rounded-lg bg-white py-1 text-sm shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none",children:e==null?void 0:e.map(o=>t(De.Option,{value:o.value,className:({active:d})=>`relative cursor-default select-none py-2 pl-3 pr-9 ${d?"bg-primary text-white":"text-gray-900"}`,children:o.value},o.id))})})]})]})]}),wo=f.exports.lazy(()=>_r(()=>import("../../../time-picker.4a8adb7a.js"),["assets/time-picker.4a8adb7a.js","assets/chunk-06e5dacf.js","assets/chunk-86d0f190.js","assets/product-card.402781d2.css","assets/chunk-06db561b.js","assets/chunk-5d6d9427.js","assets/chunk-8505b20b.js","assets/chunk-ea82ba7b.js","assets/chunk-e4587ebd.js","assets/chunk-c5a2be9b.js","assets/chunk-d6455dbb.js","assets/chunk-c17ba02e.js","assets/chunk-d6f27383.js","assets/chunk-92efbd29.js","assets/chunk-893afc42.js","assets/chunk-d2233425.js","assets/chunk-d44934cf.js","assets/chunk-6c9411f6.js","assets/chunk-66b930c8.js","assets/chunk-4b95c2fb.js","assets/chunk-97161c54.js","assets/chunk-99b3f31c.js"])),No=f.exports.lazy(()=>_r(()=>import("../../../date-picker.599e482d.js"),["assets/date-picker.599e482d.js","assets/chunk-4b95c2fb.js","assets/chunk-06e5dacf.js","assets/chunk-0fa61ab8.js","assets/chunk-d6f27383.js","assets/chunk-893afc42.js","assets/chunk-92efbd29.js","assets/chunk-86d0f190.js","assets/product-card.402781d2.css","assets/chunk-06db561b.js","assets/chunk-5d6d9427.js","assets/chunk-8505b20b.js","assets/chunk-ea82ba7b.js","assets/chunk-e4587ebd.js","assets/chunk-15eb9620.js","assets/chunk-dcf9e478.js","assets/chunk-c17ba02e.js","assets/chunk-d2233425.js","assets/chunk-d44934cf.js","assets/chunk-6c9411f6.js","assets/chunk-66b930c8.js","assets/chunk-d6455dbb.js","assets/chunk-c5a2be9b.js","assets/chunk-97161c54.js","assets/chunk-99b3f31c.js"])),Co=/^name$|^number$|^email$/,So=({register:e,control:r,errors:a,setValue:n,setFocus:s})=>{var h;const i=be(),{hasFeature:o}=Sr(),d=o("customCheckoutFields"),{shippingMethods:l,formFields:b}=Fe(),w=f.exports.useMemo(()=>d?gt(b,{enabled:!0}):b==null?void 0:b.filter(x=>(x==null?void 0:x.enabled)&&Co.test(x==null?void 0:x.id)),[b,d]),y=f.exports.useMemo(()=>Ye(l,x=>(x==null?void 0:x.id)!=="pickup"&&(x==null?void 0:x.enabled)),[l]),k=w&&w.map(x=>{var R,W,J,c,T,g,S,K,F;const{label:v,type:E,id:u,required:C}=x||{};switch(E){case"text":return p("div",{className:"checkout-form-field checkout-form-field--text sm:col-span-6",children:[t("label",{htmlFor:v,className:"checkout-form-label block text-sm font-medium text-gray-700",children:v}),p("div",{className:"checkout-form-input-wrapper relative mt-1",children:[t("input",{id:v,type:"text",className:P(N(a,u)?"checkout-form-input--error border-red-300 text-red-900 placeholder-red-300 focus:border-red-500 focus:outline-none focus:ring-red-500":"checkout-form-input border-gray-300 focus:border-primary/75 focus:ring-primary/75","checkout-form-input block w-full rounded-lg text-sm shadow-sm"),...e(u,{required:C&&((R=i.thisIsRequired)!=null?R:"This is required.")})}),N(a,u)&&t("div",{className:"checkout-form-error-icon pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3",children:t(fe,{className:"h-5 w-5 text-red-500","aria-hidden":"true"})})]}),N(a,u)&&t("p",{className:"checkout-form-error-message mt-2 text-sm text-red-600",id:`${u}-error`,children:N(a,`${u}.message`)})]},u);case"email":return p("div",{className:"checkout-form-field checkout-form-field--email sm:col-span-6",children:[t("label",{htmlFor:u,className:"checkout-form-label block text-sm font-medium text-gray-700",children:v}),p("div",{className:"checkout-form-input-wrapper relative mt-1",children:[t("input",{id:u,type:"email",autoComplete:"on",className:P(N(a,u)?"checkout-form-input--error border-red-300 text-red-900 placeholder-red-300 focus:border-red-500 focus:outline-none focus:ring-red-500":"checkout-form-input border-gray-300 focus:border-primary/75 focus:ring-primary/75","checkout-form-input block w-full rounded-lg text-sm shadow-sm"),...e(u,{required:C&&((W=i.thisIsRequired)!=null?W:"This is required."),pattern:{value:fa,message:(J=i.invalidEmail)!=null?J:"Invalid email address."}})}),N(a,u)&&t("div",{className:"checkout-form-error-icon pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3",children:t(fe,{className:"h-5 w-5 text-red-500","aria-hidden":"true"})})]}),N(a,u)&&t("p",{className:"checkout-form-error-message mt-2 text-sm text-red-600",id:`${u}-error`,children:N(a,`${u}.message`)})]},u);case"number":return p("div",{className:"checkout-form-field checkout-form-field--number sm:col-span-6",children:[t("div",{className:"checkout-form-label-wrapper flex justify-between",children:t("label",{htmlFor:u,className:"checkout-form-label block text-sm font-medium text-gray-700",children:v})}),p("div",{className:"checkout-form-input-wrapper relative mt-1",children:[t("input",{id:u,type:"text",className:P(N(a,u)?"checkout-form-input--error border-red-300 text-red-900 placeholder-red-300 focus:border-red-500 focus:outline-none focus:ring-red-500":"checkout-form-input border-gray-300 focus:border-primary/75 focus:ring-primary/75","checkout-form-input block w-full rounded-lg text-sm shadow-sm"),onBeforeInput:I=>{/^[0-9*#+()\- ]+$/.test(I.data)||I.preventDefault()},...e(u,{required:C&&((c=i.thisIsRequired)!=null?c:"This is required."),minLength:{value:8,message:(T=i.invalidPhone)!=null?T:"Invalid Phone number."},maxLength:{value:15,message:(g=i.invalidPhone)!=null?g:"Invalid Phone number."},pattern:{value:pa,message:(S=i.invalidPhone)!=null?S:"Invalid Phone number."}})}),N(a,u)&&t("div",{className:"checkout-form-error-icon pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3",children:t(fe,{className:"h-5 w-5 text-red-500","aria-hidden":"true"})})]}),N(a,u)&&t("p",{className:"checkout-form-error-message mt-2 text-sm text-red-600",id:"number-error",children:N(a,`${u}.message`)})]},u);case"textarea":return u==="address"&&y?null:p("div",{className:"checkout-form-field checkout-form-field--textarea sm:col-span-6",children:[t("label",{htmlFor:u,className:"checkout-form-label block text-sm font-medium text-gray-700",children:v}),p("div",{className:"checkout-form-input-wrapper relative mt-1",children:[t("textarea",{rows:3,type:"text",id:u,autoComplete:"on",className:P(N(a,u)?"checkout-form-input--error border-red-300 text-red-900 placeholder-red-300 focus:border-red-500 focus:outline-none focus:ring-red-500":"checkout-form-input border-gray-300 focus:border-primary/75 focus:ring-primary/75","checkout-form-input checkout-form-textarea block w-full resize-none rounded-lg text-sm shadow-sm"),...e(u,{required:C&&((K=i.thisIsRequired)!=null?K:"This is required.")})}),N(a,u)&&t("div",{className:"checkout-form-error-icon pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3",children:t(fe,{className:"h-5 w-5 text-red-500","aria-hidden":"true"})})]}),N(a,u)&&t("p",{className:"checkout-form-error-message mt-2 text-sm text-red-600",id:`${u}-error`,children:N(a,`${u}.message`)})]},u);case"dropdown":{const I=N(x,"options");return I!=null&&I.length?t("div",{className:"checkout-form-field checkout-form-field--dropdown sm:col-span-6",children:t(wt,{render:({field:{value:ie,onChange:le},fieldState:{error:ue}})=>t(Br,{options:I,id:u,value:ie,onChange:le,error:ue,label:v}),name:u,control:r,rules:{required:C&&((F=i.thisIsRequired)!=null?F:"This is required.")},defaultValue:N(I,"[0].value")})},u):null}case"radio":return p("div",{className:"checkout-form-field checkout-form-field--radio sm:col-span-6",children:[t("div",{className:"checkout-form-label-wrapper flex justify-between",children:t("label",{htmlFor:v,className:"checkout-form-label block text-sm font-medium text-gray-700",children:v})}),p("fieldset",{className:"checkout-form-radio-group mt-4",children:[t("legend",{className:"sr-only",children:v}),t("div",{className:"checkout-form-radio-options space-y-4 sm:flex sm:flex-wrap sm:items-center sm:gap-x-10 sm:gap-y-4 sm:space-y-0",children:x==null?void 0:x.options.map((I,ie)=>p("div",{className:"checkout-form-radio-option flex items-center",children:[t("input",{id:I.id,type:"radio",defaultChecked:ie===0,value:I.value,className:"checkout-form-radio-input h-4 w-4 border-gray-300 text-primary focus:ring-primary/75",...e(u)}),t("label",{htmlFor:I.id,className:"checkout-form-radio-label ms-3 block text-sm font-medium text-gray-700",children:I.value})]},I.id))})]})]},u);case"date":{const I={field:x,register:e,control:r,setValue:n,setFocus:s,errors:a};return p("div",{className:"checkout-form-field checkout-form-field--date sm:col-span-6",children:[t("label",{htmlFor:u,className:"checkout-form-label block text-sm font-medium text-gray-700",children:v}),t("div",{className:"checkout-form-input-wrapper relative mt-1",children:t(f.exports.Suspense,{fallback:p("div",{className:"checkout-form-date-picker-fallback relative",children:[t("input",{type:"text",readOnly:!0,className:"checkout-form-input checkout-form-date-input block w-full rounded-lg border-gray-300 text-sm shadow-sm"}),t("div",{className:"checkout-form-date-icon absolute inset-y-0 right-0 flex cursor-pointer items-center pr-2",children:t(En,{className:"h-5 w-5 text-gray-400","aria-hidden":"true"})})]}),children:t(No,{...I})})}),N(a,u)&&t("p",{className:"checkout-form-error-message mt-2 text-sm text-red-600",id:`${u}-error`,children:N(a,`${u}.message`)})]},u)}case"time":{const I={field:x,register:e,control:r,setValue:n,setFocus:s,errors:a};return p("div",{className:"checkout-form-field checkout-form-field--time sm:col-span-6",children:[t(f.exports.Suspense,{fallback:p(j,{children:[t("label",{htmlFor:u,className:"checkout-form-label block text-sm font-medium text-gray-700",children:v}),p("div",{className:"checkout-form-time-picker-fallback relative mt-1",children:[t("input",{type:"text",readOnly:!0,className:"checkout-form-input checkout-form-time-input block w-full rounded-lg border-gray-300 text-sm shadow-sm"}),t("div",{className:"checkout-form-time-icon absolute inset-y-0 right-0 flex cursor-pointer items-center pr-2",children:t(Ln,{className:"h-5 w-5 text-gray-400","aria-hidden":"true"})})]})]}),children:t(wo,{...I})}),N(a,u)&&t("p",{className:"checkout-form-error-message mt-2 text-sm text-red-600",id:`${u}-error`,children:N(a,`${u}.message`)})]},u)}case"message":{const{message:I}=x;return p("div",{className:"checkout-form-field checkout-form-field--message sm:col-span-6",children:[t("label",{htmlFor:u,className:"checkout-form-label block text-sm font-medium text-gray-700",children:v}),t("div",{className:"checkout-form-message-wrapper relative mt-1 space-y-2",children:t("div",{className:"checkout-form-message checkout-message text-sm",dangerouslySetInnerHTML:{__html:I}})})]},u)}default:return null}});return p("div",{className:"checkout-form",children:[t("h2",{className:"checkout-form-title text-lg font-medium text-gray-900",children:(h=i.checkoutDetails)!=null?h:"Checkout details"}),t("div",{className:"checkout-form-content mt-4",children:t("div",{className:"checkout-form-fields mt-6 grid grid-cols-1 gap-x-4 gap-y-6 sm:grid-cols-6 ",children:k})})]})},Eo=({control:e,paymentOptions:r,codEnabled:a,errors:n})=>{var d;const s=be(),i=f.exports.useMemo(()=>{var l,b,w,y;return{PayPal:(l=s.paypal)!=null?l:"PayPal",Stripe:(b=s.card)!=null?b:"Card",Cash:(w=s.cash)!=null?w:"Cash",Razorpay:(y=s.razorpay)!=null?y:"Razorpay"}},[s]),o=f.exports.useMemo(()=>{if((r==null?void 0:r.length)>1)return"";const l=r[0];return l!=null&&l.paymentLink?l==null?void 0:l.name:l==null?void 0:l.type},[r]);return p("div",{className:"payment-methods mt-12 border-t pt-8",children:[p("div",{className:"payment-methods-header relative flex items-center",id:"payment-method",children:[t("h2",{className:"payment-methods-title text-lg font-medium text-gray-900",children:(d=s.payment)!=null?d:"Payment"}),N(n,"paymentMethod")&&t("div",{className:"payment-methods-error-icon pointer-events-none ps-3",children:t(fe,{className:"h-5 w-5 text-red-500","aria-hidden":"true"})})]}),t("div",{className:"payment-methods-options mt-6",children:t(wt,{render:({field:{value:l,onChange:b},fieldState:{error:w}})=>{var y;return p(j,{children:[t(Ae,{value:l,onChange:b,children:t("div",{className:"payment-methods-grid mt-1 grid grid-cols-1 gap-4 xs:flex xs:flex-wrap",children:r.map(k=>{var h;return t(Ae.Option,{as:"div",value:k!=null&&k.paymentLink?k==null?void 0:k.name:k==null?void 0:k.type,className:({active:x,checked:v})=>P(v?"border-transparent":"border-gray-300",x?"ring-2 ring-primary/75":"","payment-method-option relative block min-w-[121px] cursor-pointer rounded-lg border bg-white p-4 shadow-sm focus:outline-none sm:min-w-[160px]"),children:({active:x,checked:v})=>{var E,u,C;return p(j,{children:[p(Ae.Label,{as:"p",className:"payment-method-label flex items-center text-base font-medium text-gray-900",children:[t("img",{className:"payment-method-icon",src:k!=null&&k.paymentLink?`http://www.google.com/s2/favicons?sz=48&domain=${k.paymentLink}`:`/${xn((E=k.type)==null?void 0:E.toLowerCase())}.svg`,alt:(u=k.name)!=null?u:k.type,width:24,height:24}),t("span",{className:"payment-method-name ms-3 flex-1 text-xs font-normal uppercase tracking-widest",children:(C=k.name)!=null?C:i[k.type]})]}),t("div",{className:P(x?"border":"border-2",v?"border-primary/75":"border-transparent","payment-method-selected-indicator pointer-events-none absolute -inset-px rounded-lg"),"aria-hidden":"true"})]})}},(h=k.name)!=null?h:k.type)})})}),N(n,"paymentMethod")&&t("p",{className:"payment-methods-error-message mt-2 text-sm text-red-600",children:(y=s.selectPaymentMethodAlert)!=null?y:"Select a payment method to continue"})]})},control:e,name:"paymentMethod",defaultValue:o,rules:{required:!0}})})]})},Ro=({shippingMethods:e,shippingMethodError:r,setShippingMethodError:a,register:n,control:s,errors:i})=>{var E,u,C,R,W,J;const{shippingMethod:o,subTotal:d}=se(ot),{formFields:l}=Fe(),b=be(),w=Ir();f.exports.useMemo(()=>Ye(l,{id:"address",enabled:!0}),[l]);const y=f.exports.useCallback(c=>c&&(c==null?void 0:c.id)!=="pickup"&&Ze(c==null?void 0:c.minOrderAmount)&&d<(c==null?void 0:c.minOrderAmount),[d]),k=Za(y),h=f.exports.useCallback(c=>c&&!y(c)&&Ze(c==null?void 0:c.freeDeliveryAbove)&&d<(c==null?void 0:c.freeDeliveryAbove),[d,y]);f.exports.useEffect(()=>{if(!o){const c=Ye(e,k);c&&(w(pr(c)),a(null))}},[o,w,e,d,k,a]);const{formatCurrency:x}=rt(),v=f.exports.useMemo(()=>{var c;return(c=Nn(e,["freeDeliveryAbove"]))==null?void 0:c.reduce((T,g)=>{var S;return(g==null?void 0:g.id)==="pickup"||h(g)&&T.push(p("p",{className:"mt-2 text-xs font-normal text-gray-700",children:[t("b",{children:x(g.freeDeliveryAbove-d)})," ",(S=b.shippingSubTotalLessThanFree)!=null?S:"away from free"," ",p("b",{children:[g==null?void 0:g.label,"!"]})]},g==null?void 0:g.id)),T},[])},[e,d,x,h,b]);return p("div",{className:"shipping-methods mt-12 border-t pt-8",children:[p("div",{className:"shipping-methods-header relative flex items-center",id:"shipping-method",children:[t("h2",{className:"shipping-methods-title text-lg font-medium text-gray-900",children:(E=b.shipping)!=null?E:"Shipping"}),r&&t("div",{className:"shipping-methods-error-icon pointer-events-none ps-3",children:t(fe,{className:"h-5 w-5 text-red-500","aria-hidden":"true"})})]}),t("div",{className:"shipping-methods-options mt-6",children:t(Ae,{value:(u=o==null?void 0:o.id)!=null?u:"pickup",onChange:c=>{a(null),w(pr(Ye(e,{id:c})))},children:t("div",{className:P("shipping-methods-grid mt-1 grid grid-cols-1 gap-4 [grid-auto-rows:1fr] sm:grid-cols-2"),children:e.map(c=>t("div",{className:"shipping-method-item flex flex-col",children:t(Ae.Option,{as:"div",value:c.id,className:({active:T,disabled:g})=>P(T?"ring-2 ring-primary/75":"","shipping-method-option relative block h-full min-w-[121px] cursor-pointer rounded-lg border border-gray-300 bg-white p-4 shadow-sm focus:outline-none",g&&"cursor-default opacity-50"),disabled:y(c),children:({active:T,checked:g})=>{var S;return p(j,{children:[p(Ae.Label,{as:"p",className:"shipping-method-label flex items-center text-base font-medium text-gray-900",children:[p("span",{className:"shipping-method-name flex-1 text-sm font-normal",children:[c==null?void 0:c.label," ",y(c)?p("span",{className:"shipping-method-min-order text-xs",children:[" ","(",t("b",{children:x(c==null?void 0:c.minOrderAmount)})," ",(S=b.minOrder)!=null?S:"min order",")"]}):""]}),t("span",{className:P("shipping-method-price ms-3 text-xs",(c==null?void 0:c.rate)===0||Ze(c.freeDeliveryAbove)&&d>=c.freeDeliveryAbove?"font-medium uppercase tracking-wide":"font-medium "),children:(c==null?void 0:c.rate)===0||Ze(c.freeDeliveryAbove)&&d>=c.freeDeliveryAbove?b.free||"FREE":x(c==null?void 0:c.rate)})]}),t("div",{className:P(T?"border":"border-2",g?"border-primary/75":"border-transparent","shipping-method-selected-indicator pointer-events-none absolute -inset-px rounded-lg"),"aria-hidden":"true"})]})}},c.id)},c==null?void 0:c.id))})})}),o&&(o==null?void 0:o.id)==="pickup"&&!!((C=o==null?void 0:o.pickupLocations)!=null&&C.length)&&t("div",{className:"pickup-location-container mt-6 rounded-lg sm:col-span-6",children:t(wt,{render:({field:{value:c,onChange:T},fieldState:{error:g}})=>t(Br,{options:o==null?void 0:o.pickupLocations,value:c,onChange:T,error:g,label:"Pickup Location",id:"pickupAddress"}),control:s,name:"pickupAddress",defaultValue:(R=o==null?void 0:o.pickupLocations[0])==null?void 0:R.value})}),o&&(o==null?void 0:o.id)!=="pickup"&&(o==null?void 0:o.collectDeliveryAddress)&&!!((W=o==null?void 0:o.addressFields)!=null&&W.length)&&t("div",{className:"delivery-address-container mt-6 grid grid-cols-1 gap-x-4 gap-y-6 empty:hidden sm:grid-cols-6",children:(J=o==null?void 0:o.addressFields)==null?void 0:J.map(c=>{var g,S;return(c==null?void 0:c.enabled)?p("div",{className:ha("delivery-address-field sm:col-span-6",["city","state","zip"].includes(c==null?void 0:c.id)&&"sm:col-span-3"),children:[t("label",{htmlFor:"addressLine1",className:"delivery-address-label block text-sm font-medium text-gray-700",children:c==null?void 0:c.label}),p("div",{className:"delivery-address-input-container relative mt-1",children:[t("input",{id:"addressLine1",type:"text",autoComplete:"address-line1",className:P(N(i,`deliveryAddress.${c==null?void 0:c.id}`)?"border-red-300 text-red-900 placeholder-red-300 focus:border-red-500 focus:outline-none focus:ring-red-500":"border-gray-300 focus:border-primary/75 focus:ring-primary/75","delivery-address-input block w-full rounded-lg text-sm shadow-sm"),...n(`deliveryAddress.${c==null?void 0:c.id}`,{required:c!=null&&c.required?(g=b.thisIsRequired)!=null?g:"This is required.":!1,...(c==null?void 0:c.id)==="zip"&&{pattern:{value:/^(?=^.{3,12}$)(?=^.*[-\s]{0,1}.*$)[a-z0-9]+(?:[-\s][a-z0-9]+)?$/,message:(S=b.invalidZip)!=null?S:"Invalid zip code."}}})}),N(i,`deliveryAddress.${c==null?void 0:c.id}`)&&t("div",{className:"delivery-address-error-icon pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3",children:t(fe,{className:"h-5 w-5 text-red-500","aria-hidden":"true"})})]}),N(i,`deliveryAddress.${c==null?void 0:c.id}`)&&t("p",{className:"delivery-address-error-message mt-2 text-sm text-red-600",id:`deliveryAddress.${c==null?void 0:c.id}-error`,children:N(i,`deliveryAddress.${c==null?void 0:c.id}.message`)})]},c==null?void 0:c.id):null})}),v==null?void 0:v[0],r&&t("p",{className:"shipping-method-error mt-2 text-sm text-red-600",children:r})]})},wr=(e,r)=>{let a="";return!r||!e?a:(r==="PayPal"&&(a=Ca+e),r==="Stripe"&&(a=Sa+e),r==="Razorpay"&&(a=Ea+e),a?`=HYPERLINK("${a}", "${e}")`:"")},Ao=e=>{if(!e)return"";const{addressLine1:r,addressLine2:a,city:n,state:s,zip:i,...o}=e;let d="";return r&&(d+=r),a&&(d+=`, ${a}`),n&&(d+=`, ${n}`),s&&(d+=`, ${s}`),i&&(d+=`, ${i}`),Object.keys(o).forEach(b=>{o[b]&&(d+=`, ${o[b]}`)}),d},Nr=({error:e})=>{var jt,Ft,Ut,qt,Bt,Vt,Wt,Kt,Gt,Qt,Ht,Jt,Xt,Zt,Yt,Mt,er,tr,rr,ar;const{loading:r,revalidating:a,unavailableProducts:n,priceChange:s,stockExceededItems:i,shipping:o,shippingMethod:d,...l}=se(ot),b=se(Ya),w=se(Ma),y=se(Or),k=se(Tr),h=ba(),{hasCoupons:x}=xa();va();const v=at(),{storeOpen:E}=v,u=!E,C=kt(),R=Fe(),W=ya(),{templateName:J,checkFeature:c}=Rr(),{formatCartItems:T,stringifyOrder:g}=on(),S=be(),K=cn(),{formatCurrency:F,currencyCode:I,currencyData:ie}=rt();ga();const{hasFeature:le}=Sr(),ue=le("paymentMethods"),xe=le("customShippingMethods"),{isPreview:D}=$r(),[Z,q]=f.exports.useState(!1),[Y,te]=f.exports.useState(!1),[ve,ke]=f.exports.useState(e!=null?e:null),[A,$]=f.exports.useState(null),[G,ye]=f.exports.useState(!1),{formFields:we,shippingMethods:Ie,enabled:Vr}=R,{whatsappEnabled:Et,whatsappNumber:Rt,orderTracking:zo}=R.orders||{},{paymentMethods:Ne}=R.payments||{},U=Ir();Vr||xt("/",{overwriteLastHistoryEntry:!0});const st=se(en),At=st.findIndex(m=>m.current),B=st[At],Lt=m=>{At!==m&&(U(fr(m)),window.scrollTo({behavior:"smooth",top:0}))},[It,Ke]=f.exports.useState("idle");f.exports.useEffect(()=>{(c("skipCartView")||y)&&U(fr(1))},[U,c,y]),f.exports.useEffect(()=>()=>U(hr()),[U]);const Ge=f.exports.useMemo(()=>Et&&Rt,[Et,Rt]),de=f.exports.useMemo(()=>ue?Ne==null?void 0:Ne.filter(m=>(m==null?void 0:m.type)==="Stripe"?(m==null?void 0:m.enabled)&&((m==null?void 0:m.detailsSubmitted)&&(m==null?void 0:m.chargesEnabled)||(m==null?void 0:m.publisherKey)):m==null?void 0:m.enabled):gt(Ne,{enabled:!0,type:"Cash"}),[Ne,ue]),it=f.exports.useMemo(()=>xe?gt(Ie,{enabled:!0}):Ie==null?void 0:Ie.filter(m=>(m==null?void 0:m.enabled)&&["pickup","delivery"].includes(m==null?void 0:m.id)),[Ie,xe]),Ce=f.exports.useMemo(()=>!Ee(it),[it]),Ot=f.exports.useCallback(async m=>{const L=await Se.post(`/checkout/${h}/place-order`,m).then(_=>_.data);if(typeof window.fbq=="function"&&window.fbq("track","Purchase",{currency:I,value:N(m,"cartData.total")}),Wa.emitOrderPlaced(L),L!=null&&L.whatsappUrl){if(_e.removeItem("sl-cart"),window.self!==window.top)try{window.top.location.replace(L==null?void 0:L.whatsappUrl)}catch{window.open(L==null?void 0:L.whatsappUrl)}else window.location.replace(L==null?void 0:L.whatsappUrl);return}xt(`/summary/${L.orderId}`,{overwriteLastHistoryEntry:!0}).then(()=>{U(br()),_e.removeItem("sl-cart")})},[U,h,I]);f.exports.useEffect(()=>{D||U(ht({storeId:h,checkoutSettings:R}))},[U,D,h,R]);const Tt=mr(),{register:$t,setValue:Wr,getValues:Oe,handleSubmit:Kr,watch:Gr,control:ct,trigger:jo,setFocus:Qr,reset:_t,formState:{errors:lt}}=Tt,ut=Gr("paymentMethod"),M=f.exports.useMemo(()=>de==null?void 0:de.find(({name:m,type:L})=>m===ut||L===ut),[de,ut]);f.exports.useEffect(()=>{const m=JSON.parse(_e.getItem("co_form",()=>null));if(we&&m){const L=we.reduce((_,O)=>(m[O==null?void 0:O.id]&&(O==null?void 0:O.enabled)&&(_[O.id]=m[O.id]),_),{});Ce&&(m==null?void 0:m.deliveryAddress)&&(L.deliveryAddress=m.deliveryAddress),_t({...Oe(),...L})}},[we,Ce,_t,Oe]);const Qe=async(m,L,_)=>{var O,ce,re,H,dt,nr,or,sr;if(Ce&&!d){$((O=S.selectShippingMethodAlert)!=null?O:"Please select a shipping method.");const ae=document.getElementById("shipping-method");ae==null||ae.scrollIntoView({behavior:"smooth",block:"center"});return}if(D){ye(!0);return}if(!u)try{if(m.paymentMethod||(m.paymentMethod=""),_e.setItem("co_form",JSON.stringify(m)),te(!0),l!=null&&l.appliedCoupon)try{await Se.post(`/checkout/${h}/verify-coupon`,{couponCode:N(l,"appliedCoupon.code"),formData:m,cartData:bt(l,["subTotal","total"])})}catch(ge){const{message:ne}=(re=(ce=ge==null?void 0:ge.response)==null?void 0:ce.data)!=null?re:{};U(xr()),te(!1),setTimeout(()=>{Dt("couponCode",{message:ne},{shouldFocus:!0})});return}const ae={products:T(b),subTotal:l.subTotal,shippingMethod:d,shipping:o,appliedCoupon:l!=null&&l.discount?l==null?void 0:l.appliedCoupon:null,discount:l.discount,total:l.total},He=new Date,{deliveryAddress:ir,pickupAddress:ea,paymentMethod:Fo,...ta}=m,$e={orderDetails:{date:hn(He,"dd/MM/yyyy"),referenceNo:(H=m==null?void 0:m.referenceNo)!=null?H:wr(_,m.paymentMethod),products:g(b),shipping:(dt=N(d,"label"))!=null?dt:"",address:(d==null?void 0:d.id)==="pickup"?ea:Ao(ir),zipCode:(d==null?void 0:d.id)==="pickup"?"":N(ir,"zipCode",""),coupon:(nr=sn(N(l,"appliedCoupon.code")))!=null?nr:"",total:l.total,...M&&{paymentMethod:bt(M,["type","name"])},...ta},cartData:ae,metaData:{isIframe:window.self!==window.top&&!Ge}};if(m.paymentMethod==="Stripe"||m.paymentMethod==="Square"){const ge=m.paymentMethod==="Stripe"?`/checkout/${h}/create-checkout-session`:`/checkout/${h}/create-square-session`,ne=await Se.post(ge,$e).then(me=>me.data);if(window.self!==window.top){if(Ge){window.top.location.replace(ne.url);return}q(!0);const me=window.open(ne.url,"_blank"),mt=setInterval(async()=>{if(me.closed){clearInterval(mt),q(!1);const Je=ne.orderId,oe=await Se.get(`/store/${h}/orders/${Je}`).then(cr=>cr.data).catch(cr=>null);(oe==null?void 0:oe.paymentStatus)==="paid"&&xt(`/summary/${ne.orderId}`,{overwriteLastHistoryEntry:!0}).then(()=>{U(br()),_e.removeItem("sl-cart")}),q(!1),te(!1)}},500)}else window.location.replace(ne.url);return}if(m.paymentMethod==="Razorpay"){const{keyId:ge}=Ne.find(oe=>oe.type==="Razorpay")||{},ne=await Se.post(`/checkout/${h}/create-razorpay-order`,$e).then(oe=>oe.data),me={};m!=null&&m.name&&(me.name=m==null?void 0:m.name),m!=null&&m.email&&(me.email=m==null?void 0:m.email),m!=null&&m.number&&(me.contact=m==null?void 0:m.number);const mt={key:ge,name:N(v,"storeName"),currency:ne.currency,amount:ne.amount,order_id:ne.id,image:N(C,"header.logo"),handler:function(oe){$e.orderDetails.referenceNo=wr(oe.razorpay_payment_id,"Razorpay"),Ot($e)},prefill:me},Je=new window.Razorpay(mt);Je.open(),Je.on("payment.failed",function(oe){te(!1),ke(oe.error.description||"Oops! Something went wrong."),U(ht({storeId:h,checkoutSettings:R}))});return}await Ot($e)}catch(ae){console.log("\u{1F680} ~ submitOrder ~ err",ae);let He=ae==null?void 0:ae.message;ae.response&&(He=(sr=(or=ae.response)==null?void 0:or.data)==null?void 0:sr.message),U(hr()),ke(He||"Oops! Something went wrong."),te(!1),U(ht({storeId:h,checkoutSettings:R})),window.scrollTo({top:0,behavior:"smooth"})}},Hr=(m,L)=>{var _;if(Ce&&!d){$((_=S.selectShippingMethodAlert)!=null?_:"Select a shipping method to continue.");const O=document.getElementById("shipping-method");O==null||O.scrollIntoView({behavior:"smooth",block:"center"})}if(ur(m).length===1&&(m==null?void 0:m.paymentMethod)){const O=document.getElementById("payment-method");O==null||O.scrollIntoView({behavior:"smooth",block:"center"})}},Pt=()=>{let m=M==null?void 0:M.paymentLink;const L=M==null?void 0:M.variables;L&&(L==null?void 0:L.length)>0&&L.forEach(_=>{var re;let O;if(_==="VAR_AMOUNT"){const{precision:H}=ie;O=(re=l.total)==null?void 0:re.toFixed(H)}const ce=Oe();for(const H in ce)if(`VAR_${H==null?void 0:H.toUpperCase()}`===_&&ce[H]){O=encodeURIComponent(ce[H]);break}m=m.replaceAll(_,O)}),window.open(m,"_blank"),M!=null&&M.collectPaymentDetails?Ke("askForConfirmation"):(Qe(Oe()),Ke("paymentCompleted"))},{register:Jr,getValues:Xr,reset:Zr,setError:Dt,clearErrors:zt,formState:{errors:Te}}=mr({defaultValues:{couponCode:(Ft=(jt=l==null?void 0:l.appliedCoupon)==null?void 0:jt.code)!=null?Ft:""}});f.exports.useState("idle");const Yr=async()=>{const{couponCode:m}=Xr();if(!m)return;zt("couponCode");const L=await Se.post(`/checkout/${h}/verify-coupon`,{couponCode:m,formData:Oe(),cartData:bt(l,["subTotal","total"])}).then(_=>_.data).catch(_=>{var re,H;const{message:O,errorKey:ce}=(H=(re=_==null?void 0:_.response)==null?void 0:re.data)!=null?H:{};Dt("couponCode",{message:O},{shouldFocus:!0})});L&&U(nn(L))},Mr=()=>{U(xr()),Zr({couponCode:""})};return t("section",{id:"cart-page",children:t(Ka,{...Tt,children:p("div",{className:"cart-container h-full bg-white",children:[t(La,{children:t("title",{children:`${(Ut=S.shoppingCart)!=null?Ut:"Shopping Cart"} ${K!=null&&K.metaTitle?`| ${K==null?void 0:K.metaTitle}`:""}`})}),t(Lo,{steps:st,setView:Lt}),Z&&t(Cr,{className:{overlay:"bg-opacity-100"}}),(r==="idle"||a)&&t(Cr,{}),t(To,{customPaymentFlowStatus:It,setCustomPaymentFlowStatus:Ke,openPaymentLink:Pt,selectedPaymentMethod:M,isWhatsappOrder:Ge,processOrder:Qe}),r==="succeeded"&&!w&&t(Io,{}),r==="succeeded"&&w>0&&p("div",{className:"cart-content mx-auto max-w-2xl px-4 pb-24 pt-2 sm:px-6 sm:pt-4 lg:max-w-7xl lg:px-8",children:[!n&&!s&&!Ee(ve)&&t("div",{className:"order-summary-error mt-8 [word-wrap:break_word]",children:t(Ga,{title:ve,close:()=>ke(null)})}),n&&t(ft,{close:()=>U(tn(!1)),title:(qt=S.attentionNeeded)!=null?qt:"Attention needed",children:(Bt=S.unavailableProductAlert)!=null?Bt:"Some of the products has been removed from cart as they are currently unavailable."}),s&&t(ft,{close:()=>U(rn(!1)),title:(Vt=S.attentionNeeded)!=null?Vt:"Attention needed",children:(Wt=S.priceChangeAlert)!=null?Wt:"Prices of some products have changed since you last added them to the cart."}),t("form",{onSubmit:Kr(Qe,Hr),className:"cart-form",children:p("div",{className:"cart-layout mt-6 sm:mt-12 lg:grid lg:grid-cols-12 lg:items-start lg:gap-x-12 xl:gap-x-16",children:[(B==null?void 0:B.id)==="cart"&&p("div",{className:"cart-items lg:col-span-7",children:[t(Qa,{items:b}),t("div",{className:"continue-shopping mt-6 text-sm sm:text-base",children:p("a",{href:"/",className:"continue-shopping-link font-medium text-primary-alt decoration-primary-alt/75 transition-colors hover:text-primary-alt/80 hover:underline",children:[(Kt=S.continueShopping)!=null?Kt:"Continue Shopping",t("span",{"aria-hidden":"true",className:"continue-shopping-arrow rtl:rotate-90",children:v!=null&&v.isRtlLanguage?t(j,{children:" \u2190"}):t(j,{children:" \u2192"})})]})})]}),(B==null?void 0:B.id)==="checkout"&&p("div",{className:"checkout-form-container lg:col-span-7",children:[t(So,{register:$t,control:ct,setValue:Wr,setFocus:Qr,errors:lt}),Ce&&t(Ro,{register:$t,control:ct,errors:lt,shippingMethods:it,shippingMethodError:A,setShippingMethodError:$}),(de==null?void 0:de.length)>0&&t(Eo,{control:ct,errors:lt,paymentOptions:de})]}),p("section",{"aria-labelledby":"summary-heading",className:"order-summary sticky top-24 mt-16 rounded-lg bg-gray-50 px-4 py-6 sm:p-6 lg:col-span-5 lg:mt-0 lg:p-8",children:[p("div",{className:"order-summary-content",children:[t("h2",{id:"summary-heading",className:"order-summary-heading text-lg font-medium text-gray-900",children:(Gt=S.orderSummary)!=null?Gt:"Order summary"}),(c("showProductsInSummary")||y)&&t("div",{className:"order-summary-products mt-6 pb-4",children:t("dl",{className:"order-summary-products-list space-y-4",children:b==null?void 0:b.map((m,L)=>{var ce;const{selectedProduct:_,selectedVariant:O}=m!=null?m:{};return p("div",{className:"order-summary-products-item flex",children:[t("div",{className:"order-summary-products-item-thumbnail h-16 w-16 flex-shrink-0 self-start rounded-md",children:m!=null&&m.thumbnail?t("img",{src:ka(m==null?void 0:m.thumbnail),alt:_==null?void 0:_.name,className:"broken-image-fallback h-full w-full rounded-md object-cover after:bg-[length:16px]"}):t("div",{className:"flex h-16 w-16 cursor-default items-center justify-center rounded-md bg-gray-100",children:t(Ha,{className:"h-5 w-5 text-gray-400"})})}),p("div",{className:"order-summary-products-item-details ms-4",children:[t("p",{className:"order-summary-products-item-details-name singleline-truncate text-sm font-medium text-gray-900",children:_==null?void 0:_.name}),t("div",{className:"order-summary-products-item-details-variant mt-1 text-sm",children:(ce=ur(O==null?void 0:O.value))==null?void 0:ce.map((re,H)=>t(f.exports.Fragment,{children:O.value[re]&&p("p",{className:"order-summary-products-item-details-variant-item text-gray-500",children:[W[re]," - ",O.value[re]]})},H))})]}),t("div",{className:"order-summary-products-item-price flex flex-1 justify-end",children:!y&&t("p",{className:"order-summary-products-item-price-amount text-sm font-medium text-gray-900",children:F(m.price)})}),t("div",{className:"order-summary-products-item-remove ms-2 text-sm",children:p("button",{type:"button",className:"inline-flex items-center text-gray-400 hover:text-gray-500 focus:outline-none",onClick:()=>U(an(m.id)),children:[t("span",{className:"sr-only",children:"Remove"}),t(Ar,{className:"h-5 w-5","aria-hidden":"true"})]})})]},L)})})}),x&&p("div",{className:"order-summary-coupon",children:[p("div",{className:"order-summary-coupon-content mt-4 flex",children:[t("input",{type:"text",className:"block w-full flex-1 rounded-lg border-gray-300 text-sm uppercase shadow-sm placeholder:normal-case focus:border-primary focus:ring-0 disabled:font-medium disabled:text-gray-400 ltr:rounded-br-none ltr:rounded-tr-none rtl:rounded-bl-none rtl:rounded-tl-none",placeholder:(Qt=S.discountCode)!=null?Qt:"Discount code",disabled:l==null?void 0:l.appliedCoupon,...Jr("couponCode",{onChange:()=>{Te!=null&&Te.couponCode&&zt("couponCode")},setValueAs:m=>m==null?void 0:m.toLowerCase()})}),t("button",{type:"button",className:"inline-flex items-center rounded-lg border border-transparent bg-primary px-4 py-1.5 text-sm font-medium text-white hover:bg-primary-dark focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 disabled:cursor-not-allowed ltr:rounded-bl-none ltr:rounded-tl-none rtl:rounded-br-none rtl:rounded-tr-none",onClick:l!=null&&l.appliedCoupon?Mr:Yr,children:l!=null&&l.appliedCoupon?(Jt=S.remove)!=null?Jt:"Remove":(Ht=S.apply)!=null?Ht:"Apply"})]}),N(Te,"couponCode")&&t("p",{className:"order-summary-coupon-error mt-1 text-sm text-red-600",id:"$couponCode-error",children:N(Te,"couponCode.message")})]}),p("dl",{className:wa("mt-6 space-y-4 ",y&&"hidden"),children:[p("div",{className:"order-summary-subtotal flex items-center justify-between",children:[t("dt",{className:"text-sm text-gray-600",children:`${(Xt=S.subtotal)!=null?Xt:"Subtotal"} (${w} ${(Zt=S.items)!=null?Zt:"items"})`}),t("dd",{className:"text-sm font-medium text-gray-900",children:F(l==null?void 0:l.subTotal)})]}),(l==null?void 0:l.discount)>0&&p("div",{className:"order-summary-discount flex items-center justify-between",children:[t("dt",{className:"text-sm text-gray-600",children:`${(Yt=S.discount)!=null?Yt:"Discount"}`}),t("dd",{className:P("text-sm font-medium text-green-600"),children:F(-(l==null?void 0:l.discount))})]}),Ce&&p("div",{className:"order-summary-shipping flex items-center justify-between",children:[t("dt",{className:"text-sm text-gray-600",children:`${(Mt=S.shipping)!=null?Mt:"Shipping"}`}),t("dd",{className:P("text-sm",(B==null?void 0:B.id)==="cart"||!d?"font-normal text-gray-400":o===0?"font-medium uppercase tracking-wide  text-green-600":"font-medium  text-gray-900"),children:(B==null?void 0:B.id)==="cart"?(er=S.calculatedAtNextStep)!=null?er:"Calculated at next step":d?o===0?S.free||"FREE":F(o):"-"})]}),p("div",{className:"order-summary-total flex items-center justify-between border-t border-gray-200 pt-4",children:[t("dt",{className:"text-base font-medium text-gray-900",children:(tr=S.total)!=null?tr:"Total"}),t("dd",{className:"text-base font-medium text-gray-900",children:F(l==null?void 0:l.total)})]})]})]}),(B==null?void 0:B.id)==="cart"&&t("div",{className:"order-summary-cta mt-6",children:t("button",{type:"button",onClick:()=>Lt(1),className:P(u?"bg-gray-300":"bg-primary hover:bg-primary-dark focus:ring-primary/75","inline-flex w-full items-center justify-center rounded-lg border border-transparent px-4 py-2 text-base font-medium text-primary-text shadow-sm transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-50 disabled:cursor-not-allowed"),disabled:!Ee(i)||k||Y||u,children:(rr=S.continue)!=null?rr:"Continue"})}),(B==null?void 0:B.id)==="checkout"&&t("div",{className:"order-summary-cta mt-6",children:t(Oo,{selectedPaymentMethod:M,processOrder:Qe,customPaymentFlowStatus:It,setCustomPaymentFlowStatus:Ke,isWhatsappOrder:Ge,checkoutButtonLoading:Y,setCheckoutError:ke,setCheckoutLoading:q,openPaymentLink:Pt})}),G&&t(ft,{close:()=>ye(!1),title:(ar=S.attentionNeeded)!=null?ar:"Attention needed",children:"Checkout is disabled inside preview. Visit your store to test checkout flow."})]})]})})]})]})})})},Lo=({steps:e,setView:r})=>{var k;const a=kt(),n=N(a,"header"),{storeName:s,storeOpen:i}=at(),{checkFeature:o}=Rr(),d=!i,l=se(Or),b=be(),w=e.findIndex(h=>h.current);e[w];const y=h=>{h>=w||r(h)};return t(j,{children:p("header",{className:P(" sticky top-0 z-10 border-b border-gray-200 bg-white text-sm font-medium text-gray-700"),id:"cart-header",children:[d&&t("div",{className:"maintenance-banner static top-0 z-10 w-full bg-red-500 py-2 text-center text-white",children:t("span",{className:"maintenance-message text-sm font-medium",children:(k=b.maintenanceMode)!=null?k:"Sorry, we are currently not accepting orders. Please check back later."})}),t("div",{className:"cart-header-content relative mx-auto min-h-[68px] max-w-7xl px-4 py-5 lg:px-6 lg:py-6",children:p("div",{className:"cart-header-layout flex justify-between lg:justify-center",children:[p("a",{href:"/",className:P("store-logo flex items-center lg:absolute lg:left-[2rem] lg:top-1/2 lg:-mt-4"),children:[t("span",{className:"sr-only",children:s}),(n==null?void 0:n.logo)&&t("img",{className:"store-logo-image h-8 w-auto min-w-[2rem]",src:n==null?void 0:n.logo,alt:s}),!(n!=null&&n.logo)&&(n==null?void 0:n.showStoreName)&&t("span",{className:"store-name line-clamp-1 inline-block max-w-[200px] text-ellipsis whitespace-nowrap px-1 text-base font-extrabold text-gray-800",children:s})]}),o("showCartSteps")&&!l&&p(j,{children:[t("nav",{"aria-label":"Progress",className:"cart-steps hidden lg:block",children:t("ol",{role:"list",className:"cart-steps-list flex space-x-2.5",children:e.map((h,x)=>{var v;return p("li",{className:"cart-step group flex items-center",children:[p("div",{className:P(x<=w&&"cursor-pointer","cart-step-content flex"),onClick:()=>y(x),children:[h!=null&&h.completed?t("span",{className:"cart-step-icon completed relative flex h-5 w-5 flex-shrink-0 items-center justify-center",children:t(fn,{className:"h-full w-full text-primary group-hover:text-primary-dark","aria-hidden":"true"})}):h!=null&&h.current?p("span",{className:"cart-step-icon current relative flex h-5 w-5 flex-shrink-0 items-center justify-center","aria-hidden":"true",children:[t("span",{className:"absolute h-4 w-4 rounded-full bg-primary/25"}),t("span",{className:"relative block h-2 w-2 rounded-full bg-primary"})]}):t("div",{className:"cart-step-icon incomplete relative flex h-5 w-5 flex-shrink-0 items-center justify-center","aria-hidden":"true",children:t("div",{className:"h-2 w-2 rounded-full bg-gray-300 group-hover:bg-gray-400"})}),t("span",{"aria-current":"page",className:P("cart-step-label",(h==null?void 0:h.current)&&"text-primary-alt",h!=null&&h.completed?"text-gray-900":"text-gray-500","ms-1"),children:(v=b[h==null?void 0:h.id])!=null?v:h.name})]}),x!==e.length-1?t("span",{className:"cart-step-separator pointer-events-none ml-4 flex h-full cursor-text items-center justify-center text-gray-300","aria-hidden":"true",children:t("div",{className:"h-0.5 w-14 flex-1 rounded-sm bg-gray-100"})}):null]},h.id)})})}),p("p",{className:"cart-step-mobile self-center lg:hidden",children:["Step ",w+1," of 2"]})]})]})})]})})},Cr=({className:e={overlay:"bg-opacity-50"}})=>t("div",{className:P("fixed inset-0 z-10 flex items-center justify-center bg-gray-100",e.overlay),children:t("div",{className:P("h-8 w-8 animate-spin rounded-full border-4 border-solid border-t-primary/75",e==null?void 0:e.spinner)})}),Io=()=>{var n,s,i,o;const e=be(),r=kt(),{isRtlLanguage:a}=at();return t("div",{className:"flex h-full min-h-mobile items-start py-20 sm:min-h-content sm:items-center",children:p("div",{className:"mx-auto block w-full px-4",children:[p("div",{className:"m-auto h-full w-full max-w-md space-y-2 text-center",children:[t(ko,{primary:(n=r==null?void 0:r.primaryColor)!=null?n:"#2ab202"}),t("h3",{className:"text-3xl font-extrabold sm:text-4xl",children:(s=e.cartIsEmpty)!=null?s:"Cart is empty."}),t("p",{className:"text-sm text-gray-500 sm:text-base",children:(i=e.cartIsEmptySubTitle)!=null?i:"Looks like you haven't added anything to the cart yet."})]}),t("div",{className:"mt-6 text-center",children:p("a",{href:"/",className:"text-sm font-medium text-primary-alt transition-colors hover:text-primary-alt/80 sm:text-base",children:[(o=e.continueShopping)!=null?o:"Continue Shopping",t("span",{"aria-hidden":"true",className:"rtl:rotate-90",children:a?t(j,{children:" \u2190"}):t(j,{children:" \u2192"})})]})})]})})},Oo=({selectedPaymentMethod:e,customPaymentFlowStatus:r,setCustomPaymentFlowStatus:a,processOrder:n,isWhatsappOrder:s,checkoutButtonLoading:i,setCheckoutLoading:o,setCheckoutError:d,openPaymentLink:l})=>{var I,ie,le,ue,xe;const{stockExceededItems:b,shipping:w,...y}=se(ot),k=se(Tr),h=at(),{storeOpen:x}=h,v=!x,E=be(),u=Fe(),{isPreview:C}=$r(),R=f.exports.useMemo(()=>u.payments.paymentMethods.find(D=>D.type==="PayPal"),[u]),{getValues:W,watch:J,trigger:c,formState:{isValid:T}}=Lr(),g=J("paymentMethod"),S=(e==null?void 0:e.name)&&(e==null?void 0:e.type)==="Payment Link",K=(D,Z)=>{if(!D||!Z)return;const q=Na[Z],Y=(q==null?void 0:q.precision)===0;return!q||!Y?D:Math.round(D).toString()},F=p("button",{type:"submit",className:P("checkout-cta-button",s?"checkout-cta-button--whatsapp bg-[#2ab200] text-white hover:bg-[#49bf1f] focus:ring-[#49bf1f]":"checkout-cta-button--default bg-primary text-primary-text hover:bg-primary-dark focus:ring-primary/75","inline-flex w-full items-center justify-center rounded-lg border border-transparent px-4 py-2 text-base font-medium shadow-sm transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-50 disabled:cursor-not-allowed",i?"disabled:opacity-75":"disabled:bg-gray-300 disabled:text-white"),disabled:!Ee(b)||k||i||v,children:[s&&t("img",{src:"/whatsapp.svg",alt:"whatsApp",className:"checkout-cta-button-whatsapp-icon -ms-1 me-2 h-5 w-5","aria-hidden":"true",width:20,height:20}),t("span",{className:"checkout-cta-button-text",children:s?`${(I=E.orderOnWhatsapp)!=null?I:"Place order on WhatsApp"}`:`${(ie=E.checkout)!=null?ie:"Checkout"}`}),t(tt,{as:f.exports.Fragment,show:i,children:p("svg",{className:"checkout-cta-button-loading-icon ml-2 mr-3 h-5 w-5 animate-spin text-white",viewBox:"0 0 24 24",children:[t("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),t("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})})]});if(S)switch(r){case"idle":case"paymentStarted":case"askForConfirmation":return t(j,{children:p("button",{type:"button",onClick:async()=>{!await c(void 0,{shouldFocus:!0})||!Ee(b)||k||v||C||(e==null?void 0:e.name)&&(e==null?void 0:e.type)==="Payment Link"&&r==="idle"&&(e!=null&&e.collectPaymentDetails?a("paymentStarted"):l())},className:P("payment-link-button","bg-primary text-primary-text hover:bg-primary-dark focus:ring-primary/75","inline-flex w-full items-center justify-center rounded-lg border border-transparent px-4 py-2 text-base font-medium shadow-sm transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-50 disabled:cursor-not-allowed",!r==="paymentStarted"?"disabled:bg-gray-300 disabled:text-white":"disabled:opacity-75"),children:[p("span",{className:"payment-link-button-text",children:[(le=E.checkoutWith)!=null?le:"Checkout with"," ",e==null?void 0:e.name]}),t(tt,{as:f.exports.Fragment,show:r!=="idle",children:p("svg",{className:"payment-link-button-loading-icon ml-2 mr-3 h-5 w-5 animate-spin text-white",viewBox:"0 0 24 24",children:[t("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),t("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})})]})});case"paymentCompleted":return F;default:return t(j,{})}switch(g){case"PayPal":return p(j,{children:[t(St,{style:{layout:"vertical",label:"checkout",color:R==null?void 0:R.buttonColor},className:"paypal-checkout-button loader",forceReRender:[y==null?void 0:y.total,R==null?void 0:R.buttonColor,T],fundingSource:"paypal",createOrder:async(D,Z)=>{if(!(!await c(void 0,{shouldFocus:!0})||!Ee(b)||k||v||C))return Z.order.create({purchase_units:[{amount:{currency_code:h==null?void 0:h.currency.code,...w>0&&{breakdown:{item_total:{currency_code:h==null?void 0:h.currency.code,value:K(y==null?void 0:y.subTotal,h==null?void 0:h.currency.code)},shipping:{currency_code:h==null?void 0:h.currency.code,value:K(w,h==null?void 0:h.currency.code)}}},value:K(y==null?void 0:y.total,h==null?void 0:h.currency.code)},payee:{email_address:R==null?void 0:R.email}}]}).then(Y=>Y)},onApprove:async(D,Z)=>Z.order.capture().then(function(q){o(!0);const Y=N(q,"purchase_units[0].payments.captures[0].id");console.log("order approved::",q),n(W(),null,Y)}),onError:D=>{var q,Y;const Z=(q=D==null?void 0:D.message)==null?void 0:q.split(`

`)[1];try{const te=JSON.parse(Z);d("PayPal Error: "+((Y=te==null?void 0:te.details[0])==null?void 0:Y.description))}catch{d("PayPal Error: Something went wrong, please try again later")}},onCancel:(D,Z)=>{console.log("cancelled",D)}}),s&&p("p",{className:"paypal-whatsapp-info mt-2 text-center text-xs font-medium text-gray-600",children:[(ue=E.checkoutWithPaypal)!=null?ue:"Checkout with PayPal"," ","&"," ",(xe=E.orderOnWhatsapp)!=null?xe:"Place order on WhatsApp"]})]});default:return F}},To=({customPaymentFlowStatus:e,setCustomPaymentFlowStatus:r,selectedPaymentMethod:a,openPaymentLink:n,isWhatsappOrder:s,processOrder:i})=>{var h,x,v,E,u,C,R;const o=be(),{total:d}=se(ot),{formatCurrency:l}=rt(),{register:b,trigger:w,getValues:y,formState:{errors:k}}=Lr();return t(tt,{as:f.exports.Fragment,show:e==="paymentStarted"||e==="askForConfirmation",enter:"transition-opacity ease-linear duration-200",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"transition-opacity ease-linear duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:p("div",{className:"payment-link-backdrop fixed inset-0 z-20 flex items-center justify-center bg-white",children:[p("div",{className:"payment-link-content relative flex flex-col flex-wrap justify-between gap-4",children:[t("p",{className:"payment-link-instructions text-center text-lg text-gray-700 empty:hidden",children:(a==null?void 0:a.collectPaymentDetails)&&p(j,{children:[(h=o.pay)!=null?h:"Pay"," ",t("b",{children:l(d)})," & ",(x=o.noteThe)!=null?x:"Note the"," ",t("b",{children:a==null?void 0:a.paymentDetailName})]})}),e==="paymentStarted"&&p("div",{className:"payment-link-actions flex flex-col gap-1",children:[t("button",{type:"button",className:"payment-link-open-button inline-flex max-w-md flex-1 items-center justify-center rounded-lg border border-transparent bg-primary px-2 py-2 text-sm font-medium text-white shadow-sm transition-colors hover:bg-primary-dark focus:outline-none focus:ring-2 focus:ring-primary/75 focus:ring-offset-2",onClick:n,children:(v=o.openPaymentLink)!=null?v:"Open Payment Link"}),p("button",{type:"button",className:"payment-link-back-button inline-flex max-w-md flex-1 items-center justify-center gap-x-1.5 rounded-lg bg-white px-4 py-2 text-sm font-medium text-gray-500 transition-colors hover:bg-gray-50 focus:outline-none",onClick:()=>r("idle"),children:[t("span",{"aria-hidden":"true",className:"rtl:rotate-90",children:t(j,{children:" \u2190"})}),(E=o.goBack)!=null?E:"Go back"]})]}),e==="askForConfirmation"&&t(j,{children:a!=null&&a.collectPaymentDetails?p(j,{children:[p("div",{className:"payment-link-reference relative mt-1 w-full",children:[t("input",{type:"text",autoComplete:"off",className:P("payment-link-reference-input",N(k,"referenceNo")?"border-red-300 text-red-900 placeholder-red-500 focus:border-red-500 focus:outline-none focus:ring-red-500":"border-gray-300 focus:border-primary/75 focus:ring-primary/75","block w-full rounded-lg text-sm shadow-sm"),placeholder:`${a==null?void 0:a.paymentDetailName}`,...b("referenceNo",{required:(u=o.thisIsRequired)!=null?u:"This is required."})}),N(k,"referenceNo")&&t("div",{className:"payment-link-reference-error pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3",children:t(fe,{className:"h-5 w-5 text-red-500","aria-hidden":"true"})})]}),p("div",{className:"payment-link-confirmation-actions flex flex-col gap-1",children:[p("button",{type:"button",className:"payment-link-confirm-button inline-flex flex-1 items-center justify-center rounded-lg border border-transparent bg-primary px-2 py-2 text-sm font-medium text-white shadow-sm transition-colors hover:bg-primary-dark focus:outline-none focus:ring-2 focus:ring-primary/75 focus:ring-offset-2",onClick:async()=>{!await w("referenceNo",{shouldFocus:!0})||(i(y(),null),r("paymentCompleted"))},children:[s&&t("img",{src:"/whatsapp.svg",alt:"whatsApp",className:"payment-link-confirm-button__whatsapp-icon -ms-1 me-2 h-5 w-5","aria-hidden":"true",width:20,height:20}),(C=o.confirmPayment)!=null?C:"Confirm Payment"]}),t("button",{type:"button",className:"payment-link-cancel-button inline-flex max-w-md flex-1 items-center justify-center gap-x-1.5 rounded-lg bg-white px-4 py-2 text-sm font-medium text-gray-500 transition-colors hover:bg-gray-50 focus:outline-none",onClick:()=>r("idle"),children:(R=o.cancel)!=null?R:"Cancel"})]})]}):t("div",{className:"payment-link-loading flex",children:t("div",{className:"payment-link-loading-spinner inline-block h-6 w-6 animate-spin rounded-full border-[3px] border-current border-t-transparent text-primary",role:"status","aria-label":"loading",children:t("span",{className:"sr-only",children:"Loading..."})})})})]}),t("div",{className:"payment-link-close absolute right-0 top-0 p-4",children:p("button",{type:"button",className:"payment-link-close-button rounded-lg text-white hover:text-gray-100",onClick:()=>r("idle"),children:[t("span",{className:"sr-only",children:"Close"}),t(Ar,{className:"h-6 w-6","aria-hidden":"true"})]})})]})})};function $o({children:e}){return p(j,{children:[t("main",{className:"min-h-[100vh]",children:e}),t(pn,{})]})}const{MODE:_o}={VITE_PAYPAL_CLIENT_SB:"AacWKJyQU2QYEEqQ-jJ4MsPGxairNHk_tbllRNoOxEUgIJzXox6SwSa7BbDPozSCp_sqD-l6kROKcM5t",VITE_PAYPAL_CLIENT_PROD:"AbwYIo7P55_N-ytn94FhPoXtDlOfSCyxz9C-T-B0mHzcggwXi5zDgwtnT3aC_rm4EfKUTsDq1gmZHF_6",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0};function Po(){const{pageProps:{checkoutError:e}}=Ra(),{currencyCode:r}=rt(),a=Fe(),n=a.payments.paymentMethods.find(s=>s.type==="PayPal");return a.payments.paymentMethods.find(s=>s.type==="Payment Link"),n!=null&&n.enabled?t(go,{options:{"client-id":_o==="production"?"AbwYIo7P55_N-ytn94FhPoXtDlOfSCyxz9C-T-B0mHzcggwXi5zDgwtnT3aC_rm4EfKUTsDq1gmZHF_6":"AacWKJyQU2QYEEqQ-jJ4MsPGxairNHk_tbllRNoOxEUgIJzXox6SwSa7BbDPozSCp_sqD-l6kROKcM5t",components:"buttons","merchant-id":n==null?void 0:n.email,currency:r,"data-namespace":"paypal_sdk"},children:t(Nr,{error:e})}):t(Nr,{})}async function Do(e){var b;if(!Aa())return{pageContext:{pageProps:{}}};const{pageData:r,cookies:a}=e,{store:n}=JSON.parse(r);if(!N(n,"storeSettings.checkout.enabled"))return{pageContext:{redirectTo:"/"}};const i={};a.pi_error&&(i.checkoutError=a.pi_error);const o=N(n,"storeSettings.locale")||{},d=N(n,"storeSettings.seo")||{},l={...d,metaTitle:`${(b=o.shoppingCart)!=null?b:"Shopping Cart"} | ${d==null?void 0:d.metaTitle}`,searchIndex:!1};return{pageContext:{pageProps:i,documentProps:l,fallback:{["/store"]:{store:n}}}}}var os=Object.freeze(Object.defineProperty({__proto__:null,Page:Po,onBeforeRender:Do,Layout:$o},Symbol.toStringTag,{value:"Module"}));export{Ln as C,En as a,os as b,Pr as i};
