@bailierich/booking-components 2.1.0 → 2.1.1

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/index.js CHANGED
@@ -7,16 +7,16 @@
7
7
  transform: translateX(${t==="left"?"-50%":"0%"});
8
8
  }
9
9
  }
10
- `}),jsxRuntime.jsxs("div",{className:`flex items-center whitespace-nowrap ${h[n]} ${k[l]} uppercase tracking-wider`,style:{fontFamily:g?.headingFont||"inherit",color:s||p.text,animation:`scroll-${t} ${C}s linear infinite`,animationPlayState:w?"paused":"running"},children:[jsxRuntime.jsx("span",{className:"inline-block",children:I}),jsxRuntime.jsx("span",{className:"inline-block","aria-hidden":"true",children:I})]})]})}function An({address:e,displayType:t="both",mapHeight:r="medium",mapStyle:a="roadmap",zoom:o=15,showMarker:i=true,borderRadius:n=12,directionsButtonText:s="Get Directions",colors:l,typography:c,enableInlineEditing:d=false,sectionId:u=""}){let g={small:300,medium:400,large:500}[r],b=encodeURIComponent(e),v=`https://www.google.com/maps/dir/?api=1&destination=${b}`,f=`https://www.google.com/maps/embed/v1/place?key=${undefined?.VITE_GOOGLE_MAPS_API_KEY||typeof globalThis<"u"&&globalThis.process?.env?.NEXT_PUBLIC_GOOGLE_MAPS_API_KEY||""}&q=${b}&zoom=${o}&maptype=${a}`;return jsxRuntime.jsx("div",{className:"container mx-auto px-4",children:jsxRuntime.jsxs("div",{className:"max-w-4xl mx-auto",children:[(t==="map-only"||t==="both")&&e&&jsxRuntime.jsx("div",{className:"w-full overflow-hidden mb-6",style:{height:`${g}px`,borderRadius:`${n}px`},children:jsxRuntime.jsx("iframe",{src:f,className:"w-full h-full",style:{border:0},allowFullScreen:true,loading:"lazy",referrerPolicy:"no-referrer-when-downgrade",title:"Location Map"})}),(t==="address-only"||t==="both")&&jsxRuntime.jsx("div",{className:"p-6 rounded-lg border",style:{backgroundColor:`${l.primary}10`,borderColor:`${l.primary}30`,borderRadius:`${n}px`},children:jsxRuntime.jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-4",children:[jsxRuntime.jsx("div",{className:"flex-1",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsxs("svg",{className:"w-5 h-5 mt-0.5 flex-shrink-0",fill:"none",stroke:l.primary,viewBox:"0 0 24 24",children:[jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"}),jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 11a3 3 0 11-6 0 3 3 0 016 0z"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"font-medium mb-1",style:{color:l.text,fontFamily:c?.bodyFont||"inherit"},...d&&{"data-editable":true,"data-section-id":u,"data-field-path":"settings.address"},children:e||"Add your address"}),e&&jsxRuntime.jsx("a",{href:v,target:"_blank",rel:"noopener noreferrer",className:"text-sm underline hover:no-underline",style:{color:l.primary},children:"View in Google Maps \uFFFD"})]})]})}),e&&jsxRuntime.jsx("a",{href:v,target:"_blank",rel:"noopener noreferrer",className:"px-6 py-3 rounded-lg font-semibold transition-all hover:opacity-90 text-center",style:{backgroundColor:l.primary,color:"#FFFFFF"},children:s})]})}),!e&&jsxRuntime.jsxs("div",{className:"p-12 rounded-lg border-2 border-dashed text-center",style:{borderColor:`${l.primary}30`,borderRadius:`${n}px`},children:[jsxRuntime.jsxs("svg",{className:"w-12 h-12 mx-auto mb-4",fill:"none",stroke:l.primary,viewBox:"0 0 24 24",children:[jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"}),jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 11a3 3 0 11-6 0 3 3 0 016 0z"})]}),jsxRuntime.jsx("p",{style:{color:l.text,opacity:.6},children:"Add your business address to display a map"})]})]})})}function Mn({imageUrl:e,altText:t="",caption:r,maxWidth:a="large",alignment:o="center",aspectRatio:i="auto",borderRadius:n=12,linkUrl:s,openInNewTab:l=true,colors:c,typography:d,enableInlineEditing:u=false,sectionId:p=""}){let g={full:"max-w-full",large:"max-w-6xl",medium:"max-w-4xl",small:"max-w-2xl"},b={auto:null,"16:9":"56.25%","4:3":"75%","1:1":"100%","3:2":"66.67%"},v=o==="center"?"mx-auto":o==="right"?"ml-auto":"mr-auto",w=jsxRuntime.jsxs("div",{className:`${g[a]} ${v}`,children:[jsxRuntime.jsx("div",{className:"relative w-full overflow-hidden",style:{borderRadius:`${n}px`,...b[i]&&{paddingBottom:b[i]}},children:e?jsxRuntime.jsx("img",{src:e,alt:t||"Image",className:i==="auto"?"w-full h-auto":"absolute top-0 left-0 w-full h-full object-cover",style:{borderRadius:`${n}px`}}):jsxRuntime.jsx("div",{className:"flex items-center justify-center bg-gray-100",style:{backgroundColor:`${c.primary}10`,borderRadius:`${n}px`,minHeight:i==="auto"?"300px":void 0},children:jsxRuntime.jsxs("div",{className:"text-center px-4",children:[jsxRuntime.jsx("svg",{className:"w-16 h-16 mx-auto mb-4",fill:"none",stroke:c.primary,viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})}),jsxRuntime.jsx("p",{style:{color:c.text,opacity:.6},children:"Add an image URL to display"})]})})}),r&&e&&jsxRuntime.jsx("p",{className:"mt-3 text-sm text-center",style:{color:c.text,opacity:.7,fontFamily:d?.bodyFont||"inherit"},...u&&{"data-editable":true,"data-section-id":p,"data-field-path":"settings.caption"},children:r})]});return jsxRuntime.jsx("div",{className:a==="full"?"w-full":"container mx-auto px-4",children:s&&e?jsxRuntime.jsx("a",{href:s,target:l?"_blank":"_self",rel:l?"noopener noreferrer":void 0,className:"block",children:w}):w})}function Xa({faq:e,index:t,colors:r,typography:a,enableInlineEditing:o,sectionId:i}){let[n,s]=Ge.useState(false);return jsxRuntime.jsxs("div",{className:"border-b border-opacity-10",style:{borderColor:r.text},children:[jsxRuntime.jsxs("button",{onClick:()=>s(!n),className:"w-full py-4 px-6 flex items-center justify-between text-left hover:bg-opacity-5 transition-colors",style:{backgroundColor:n?`${r.primary}10`:"transparent"},children:[jsxRuntime.jsx("span",{className:"font-semibold text-lg pr-4",style:{color:r.text,fontFamily:a?.headingFont||"inherit"},...o&&{"data-editable":true,"data-section-id":i,"data-field-path":`settings.faqs.${t}.question`},children:e.question||"Add question..."}),jsxRuntime.jsx("svg",{className:"w-5 h-5 flex-shrink-0 transition-transform",style:{color:r.primary,transform:n?"rotate(180deg)":"rotate(0deg)"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),n&&jsxRuntime.jsx("div",{className:"px-6 pb-4 pt-2",style:{color:r.text,opacity:.8,fontFamily:a?.bodyFont||"inherit"},...o&&{"data-editable":true,"data-section-id":i,"data-field-path":`settings.faqs.${t}.answer`},children:e.answer||"Add answer..."})]})}function $n({title:e="Frequently Asked Questions",faqs:t=[],layout:r="accordion",maxWidth:a="large",colors:o,typography:i,enableInlineEditing:n=false,sectionId:s=""}){return jsxRuntime.jsx("div",{className:"container mx-auto px-4",children:jsxRuntime.jsxs("div",{className:`${{full:"max-w-full",large:"max-w-4xl",medium:"max-w-3xl",small:"max-w-2xl"}[a]} mx-auto`,children:[e&&jsxRuntime.jsx("h2",{className:"text-3xl font-bold text-center mb-8",style:{color:o.text,fontFamily:i?.headingFont||"inherit"},...n&&{"data-editable":true,"data-section-id":s,"data-field-path":"settings.title"},children:e}),t.length>0?jsxRuntime.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:`1px solid ${o.text}20`,backgroundColor:`${o.primary}05`},children:t.map((c,d)=>r==="accordion"?jsxRuntime.jsx(Xa,{faq:c,index:d,colors:o,typography:i,enableInlineEditing:n,sectionId:s},d):jsxRuntime.jsxs("div",{className:"border-b border-opacity-10 last:border-b-0 p-6",style:{borderColor:o.text},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-lg mb-2",style:{color:o.text,fontFamily:i?.headingFont||"inherit"},...n&&{"data-editable":true,"data-section-id":s,"data-field-path":`settings.faqs.${d}.question`},children:c.question||"Add question..."}),jsxRuntime.jsx("p",{style:{color:o.text,opacity:.8,fontFamily:i?.bodyFont||"inherit"},...n&&{"data-editable":true,"data-section-id":s,"data-field-path":`settings.faqs.${d}.answer`},children:c.answer||"Add answer..."})]},d))}):jsxRuntime.jsxs("div",{className:"p-12 rounded-lg border-2 border-dashed text-center",style:{borderColor:`${o.primary}30`,backgroundColor:`${o.primary}05`},children:[jsxRuntime.jsx("svg",{className:"w-12 h-12 mx-auto mb-4",fill:"none",stroke:o.primary,viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),jsxRuntime.jsx("p",{style:{color:o.text,opacity:.6},children:"Add FAQ items to get started"})]})]})})}function Bn({brandName:e="Your Brand",logoUrl:t,showLogo:r=true,showBrandName:a=true,links:o=[],ctaText:i,ctaUrl:n,sticky:s=true,transparentOnTop:l=false,colors:c,typography:d,enableInlineEditing:u=false,sectionId:p=""}){let[g,b]=Ge.useState(false),[v,w]=Ge.useState(false),[f,x]=Ge.useState("");Ge.useEffect(()=>{let h=()=>{w(window.scrollY>20);};return window.addEventListener("scroll",h),()=>window.removeEventListener("scroll",h)},[]),Ge.useEffect(()=>{let h=()=>{let k=o.filter(I=>I.url.startsWith("#")).map(I=>document.querySelector(`[data-section-id="${I.url.substring(1)}"]`)).filter(Boolean),S="";k.forEach(I=>{if(I){let R=I.getBoundingClientRect();R.top<=100&&R.bottom>=100&&(S=I.getAttribute("data-section-id")||"");}}),x(S);};return window.addEventListener("scroll",h),()=>window.removeEventListener("scroll",h)},[o]);let y=(h,k)=>{if(k.startsWith("#")){h.preventDefault();let S=k.substring(1),I=document.querySelector(`[data-section-id="${S}"]`);I&&I.scrollIntoView({behavior:"smooth",block:"start"}),b(false);}},N=l&&!v;return jsxRuntime.jsx("nav",{className:`${s?"sticky top-0 z-50":""} ${N?"bg-transparent":s?"bg-white/80 backdrop-blur-md border-b":"bg-white border-b"} transition-all duration-300`,style:{borderColor:N?"transparent":`${c.primary}20`},children:jsxRuntime.jsxs("div",{className:"container mx-auto px-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between h-16 md:h-20",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[r&&t&&jsxRuntime.jsx("img",{src:t,alt:e,className:"h-8 md:h-10 w-auto object-contain"}),a&&jsxRuntime.jsx("h1",{className:"text-xl md:text-2xl font-bold",style:{fontFamily:d?.headingFont||"inherit",color:c.text},...u&&{"data-editable":true,"data-section-id":p,"data-field-path":"settings.brandName"},children:e})]}),jsxRuntime.jsxs("div",{className:"hidden md:flex items-center gap-8",children:[o.map((h,k)=>{let S=h.url.startsWith("#")&&h.url.substring(1)===f;return jsxRuntime.jsxs("a",{href:h.url,onClick:I=>y(I,h.url),className:"relative text-base font-medium transition-colors group",style:{color:S?c.primary:c.text,fontFamily:d?.bodyFont||"inherit"},...h.linkType==="external"&&!h.url.startsWith("#")?{target:"_blank",rel:"noopener noreferrer"}:{},...u&&{"data-editable":true,"data-section-id":p,"data-field-path":`settings.links.${k}.label`},children:[h.label,jsxRuntime.jsx("span",{className:`absolute -bottom-1 left-0 h-0.5 transition-all ${S?"w-full":"w-0 group-hover:w-full"}`,style:{backgroundColor:c.primary}})]},h.id)}),i&&n&&jsxRuntime.jsx("a",{href:n,className:"px-6 py-2.5 rounded-full font-semibold transition-all hover:opacity-90 hover:scale-105",style:{backgroundColor:c.primary,color:c.buttonText||"#FFFFFF",fontFamily:d?.bodyFont||"inherit"},children:i})]}),jsxRuntime.jsx("button",{onClick:()=>b(!g),className:"md:hidden p-2 rounded-lg transition-colors hover:bg-black/5","aria-label":"Toggle menu",children:jsxRuntime.jsx("svg",{className:"w-6 h-6",fill:"none",stroke:c.text,viewBox:"0 0 24 24",children:g?jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"}):jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})})]}),jsxRuntime.jsx("div",{className:`md:hidden overflow-hidden transition-all duration-300 ${g?"max-h-96 pb-4":"max-h-0"}`,children:jsxRuntime.jsxs("div",{className:"flex flex-col space-y-3 pt-4 border-t",style:{borderColor:`${c.primary}20`},children:[o.map((h,k)=>{let S=h.url.startsWith("#")&&h.url.substring(1)===f;return jsxRuntime.jsx("a",{href:h.url,onClick:I=>y(I,h.url),className:"text-base font-medium py-2 px-4 rounded-lg transition-colors",style:{color:S?c.primary:c.text,backgroundColor:S?`${c.primary}10`:"transparent",fontFamily:d?.bodyFont||"inherit"},...h.linkType==="external"&&!h.url.startsWith("#")?{target:"_blank",rel:"noopener noreferrer"}:{},children:h.label},h.id)}),i&&n&&jsxRuntime.jsx("a",{href:n,className:"px-6 py-3 rounded-full font-semibold text-center transition-all hover:opacity-90",style:{backgroundColor:c.primary,color:c.buttonText||"#FFFFFF",fontFamily:d?.bodyFont||"inherit"},children:i})]})})]})})}function zn({title:e,content:t,alignment:r="left",maxWidth:a="medium",textSize:o="medium",backgroundColor:i,textColor:n,paddingY:s="medium",colors:l,typography:c,enableInlineEditing:d=false,sectionId:u=""}){let p={full:"max-w-full",large:"max-w-6xl",medium:"max-w-4xl",small:"max-w-2xl"},g={left:"text-left",center:"text-center",right:"text-right"},b={small:"text-sm",medium:"text-base",large:"text-lg"};return jsxRuntime.jsx("div",{className:{none:"py-0",small:"py-8",medium:"py-16",large:"py-24"}[s],style:{backgroundColor:i||"transparent"},children:jsxRuntime.jsx("div",{className:"container mx-auto px-4",children:jsxRuntime.jsxs("div",{className:`${p[a]} mx-auto ${g[r]}`,children:[e&&jsxRuntime.jsx("h2",{className:"text-3xl md:text-4xl font-bold mb-6",style:{color:n||l.text,fontFamily:c?.headingFont||"inherit"},...d&&{"data-editable":true,"data-section-id":u,"data-field-path":"settings.title"},children:e}),jsxRuntime.jsx("div",{className:`${b[o]} leading-relaxed whitespace-pre-wrap`,style:{color:n||l.text,fontFamily:c?.bodyFont||"inherit"},...d&&{"data-editable":true,"data-section-id":u,"data-field-path":"settings.content"},children:t||"Add your text content here..."})]})})})}function $c(e,t=false){if(t)return .15;switch(e){case "fast":return .2;case "slow":return .5;default:return .3}}function Ja(e=50){return {enter:t=>({x:t==="forward"?e:-e,opacity:0}),center:{x:0,opacity:1},exit:t=>({x:t==="forward"?-e:e,opacity:0})}}function Qa(){return {enter:()=>({opacity:0,scale:.95}),center:{opacity:1,scale:1},exit:()=>({opacity:0,scale:.95})}}function Lc(e,t){return e==="fade"?Qa():Ja(t)}var rr={easing:[.4,0,.2,1],spring:{type:"spring",damping:30,stiffness:300},staggerChildren:{staggerChildren:.05,delayChildren:.1},cardHover:{scale:1.02,transition:{duration:.2}},buttonHover:{scale:1.05,transition:{duration:.2}},fadeIn:{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}},slideUp:{initial:{y:"100%"},animate:{y:0},exit:{y:"100%"}},scaleIn:{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9}},slideInLeft:{initial:{opacity:0,x:-10},animate:{opacity:1,x:0}},slideInRight:{initial:{opacity:0,x:10},animate:{opacity:1,x:0}},backdrop:{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}}};function Bc(){return typeof window>"u"?false:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function zc(e,t=.1,r=.05){return Array.from({length:e},(a,o)=>({initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.3,delay:t+o*r,ease:rr.easing}}))}function ge(e=0,t=.3){return {initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:t,delay:e,ease:rr.easing}}}function On({services:e,categories:t=[],selectedService:r,onServiceSelect:a,settings:o,colors:i}){let[n,s]=Ge.useState(null),[l,c]=Ge.useState(new Set(t.length>0?[t[0].id]:[])),d=o.serviceLayout||"grid",u=o.columns||2,p=o.headerContent?.value||"Choose Your Service",g=o.subheaderContent?.value||"Select the service you'd like to book",b=o.showPricing!==false,v=o.showDuration!==false,w=o.showDescription!==false,f=o.enableCategories===true,x=o.categoryStyle||"dropdown",y=o.policyImages||[],N=o.policyText||null,C=o.imageSpacing||"small",h={none:"0px",small:"8px",medium:"16px",large:"24px"},k=o.imageBorderRadius||"0px",S={1:"grid-cols-1",2:"grid-cols-1 sm:grid-cols-2",3:"grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",4:"grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"}[u]||"grid-cols-2",I=f&&n?e.filter(m=>m.category===n):e,R=(m,F)=>{let M=r===m.id;return jsxRuntime.jsx("button",{onClick:()=>a(m.id),className:`w-full ${F==="grid"?"h-full":""} p-4 rounded-lg border-2 transition-all text-left ${F==="grid"?"flex flex-col":""} ${M?"border-current shadow-lg":"border-gray-200 hover:border-gray-300"}`,style:{borderColor:M?i.primary:void 0,backgroundColor:M?`${i.primary}10`:void 0},children:F==="grid"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("p",{className:"font-semibold mb-1",children:m.name}),w&&jsxRuntime.jsx("p",{className:"text-xs opacity-70 mb-2 flex-1",children:m.description}),jsxRuntime.jsxs("div",{className:"flex justify-between items-center text-sm mt-auto",children:[b&&jsxRuntime.jsxs("span",{className:"font-bold",style:{color:i.primary},children:["$",m.price]}),v&&jsxRuntime.jsxs("span",{className:"opacity-60",children:[m.duration," min"]})]})]}):jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"font-semibold mb-1",children:m.name}),w&&jsxRuntime.jsx("p",{className:"text-sm opacity-70",children:m.description})]}),jsxRuntime.jsxs("div",{className:"text-right ml-4",children:[b&&jsxRuntime.jsxs("p",{className:"font-bold",style:{color:i.primary},children:["$",m.price]}),v&&jsxRuntime.jsxs("p",{className:"text-sm opacity-60",children:[m.duration," min"]})]})]})},m.id)};return jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs(framerMotion.motion.div,{...ge(.05),className:"text-center sm:text-left",children:[jsxRuntime.jsx("h2",{className:"text-xl sm:text-2xl font-bold mb-2",style:{color:i.primary},children:p}),jsxRuntime.jsx("p",{className:"text-sm opacity-70",children:g})]}),y&&y.length>0&&jsxRuntime.jsx("div",{className:"w-full flex flex-col",style:{gap:h[C]},children:y.slice(0,3).map((m,F)=>jsxRuntime.jsx("div",{className:"w-full overflow-hidden",style:{aspectRatio:"720 / 300",borderRadius:k},children:jsxRuntime.jsx("img",{src:m.url,alt:m.alt||`Policy image ${F+1}`,className:"w-full h-full object-cover"})},F))}),(!y||y.length===0)&&N&&jsxRuntime.jsx("div",{className:"w-full p-4 rounded-lg border",style:{backgroundColor:`${i.primary}10`,borderColor:`${i.primary}30`},dangerouslySetInnerHTML:{__html:N}}),f&&t.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[x==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-medium mb-2",children:"Service Category"}),jsxRuntime.jsxs("select",{value:n||"all",onChange:m=>s(m.target.value==="all"?null:m.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:border-transparent transition-all",style:{"--tw-ring-color":i.primary},children:[jsxRuntime.jsx("option",{value:"all",children:"All Services"}),t.map(m=>jsxRuntime.jsx("option",{value:m.id,children:m.name},m.id))]})]}),x==="tabs"&&jsxRuntime.jsxs("div",{className:"flex gap-2 flex-wrap",children:[jsxRuntime.jsx("button",{onClick:()=>s(null),className:`px-4 py-2 rounded-lg transition-all text-sm font-medium ${n===null?"text-white shadow-lg":"border border-gray-300 hover:border-gray-400"}`,style:{backgroundColor:n===null?i.primary:void 0},children:"All Services"}),t.map(m=>jsxRuntime.jsx("button",{onClick:()=>s(m.id),className:`px-4 py-2 rounded-lg transition-all text-sm font-medium ${n===m.id?"text-white shadow-lg":"border border-gray-300 hover:border-gray-400"}`,style:{backgroundColor:n===m.id?i.primary:void 0},children:m.name},m.id))]}),x==="pills"&&jsxRuntime.jsxs("div",{className:"flex gap-2 overflow-x-auto pb-2 scrollbar-hide",children:[jsxRuntime.jsx("button",{onClick:()=>s(null),className:`px-5 py-2 rounded-full transition-all text-sm font-medium whitespace-nowrap ${n===null?"text-white shadow-md":"bg-gray-100 hover:bg-gray-200"}`,style:{backgroundColor:n===null?i.primary:void 0},children:"All"}),t.map(m=>jsxRuntime.jsx("button",{onClick:()=>s(m.id),className:`px-5 py-2 rounded-full transition-all text-sm font-medium whitespace-nowrap ${n===m.id?"text-white shadow-md":"bg-gray-100 hover:bg-gray-200"}`,style:{backgroundColor:n===m.id?i.primary:void 0},children:m.name},m.id))]}),x==="chips"&&jsxRuntime.jsxs("div",{className:"flex gap-2 flex-wrap",children:[jsxRuntime.jsxs("button",{onClick:()=>s(null),className:`px-3 py-1.5 rounded-lg transition-all text-xs font-medium flex items-center gap-1.5 ${n===null?"text-white":"border border-gray-300 bg-white hover:border-gray-400"}`,style:{backgroundColor:n===null?i.primary:void 0,borderColor:n===null?i.primary:void 0},children:[n===null&&jsxRuntime.jsx("span",{className:"text-[10px]",children:"\u2713"}),"All"]}),t.map(m=>jsxRuntime.jsxs("button",{onClick:()=>s(m.id),className:`px-3 py-1.5 rounded-lg transition-all text-xs font-medium flex items-center gap-1.5 ${n===m.id?"text-white":"border border-gray-300 bg-white hover:border-gray-400"}`,style:{backgroundColor:n===m.id?i.primary:void 0,borderColor:n===m.id?i.primary:void 0},children:[n===m.id&&jsxRuntime.jsx("span",{className:"text-[10px]",children:"\u2713"}),m.name]},m.id))]})]}),f&&x==="accordion"?jsxRuntime.jsx("div",{className:"space-y-4",children:t.map(m=>{let F=l.has(m.id),M=e.filter(A=>A.category===m.id);return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{onClick:()=>{let A=new Set(l);F?A.delete(m.id):A.add(m.id),c(A);},className:"w-full flex items-center justify-between py-2 border-b-2 transition-all group",style:{borderColor:F?i.primary:"#e5e7eb"},children:[jsxRuntime.jsx("span",{className:"font-semibold text-left transition-colors",style:{color:F?i.primary:void 0},children:m.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-4 h-4 transition-all ${F?"rotate-180":""}`,style:{color:F?i.primary:"#9ca3af"}})]}),F&&jsxRuntime.jsx("div",{className:`mt-4 ${d==="grid"?`grid ${S} gap-3`:"space-y-3"}`,children:M.map(A=>R(A,d))})]},m.id)})}):d==="grid"?jsxRuntime.jsx("div",{className:`grid ${S} gap-3`,children:I.map(m=>R(m,"grid"))}):jsxRuntime.jsx("div",{className:"space-y-3",children:I.map(m=>R(m,"list"))})]})}function oi(){let e=[],t=new Date;t.setHours(0,0,0,0);for(let r=0;r<3;r++){let a=new Date(t.getFullYear(),t.getMonth()+r,1),o=new Date(a.getFullYear(),a.getMonth()+1,0).getDate();for(let i=1;i<=o;i++){if(new Date(a.getFullYear(),a.getMonth(),i)<t||Math.random()>.6)continue;let s=`${a.getFullYear()}-${String(a.getMonth()+1).padStart(2,"0")}-${String(i).padStart(2,"0")}`;e.push(s);}}return e}var ko={avoid:{bg:"#FEE2E2",text:"#991B1B",label:"Avoid"},caution:{bg:"#FEF3C7",text:"#92400E",label:"Caution"},optimal:{bg:"#D1FAE5",text:"#065F46",label:"Optimal"},neutral:{bg:"#F3F4F6",text:"#4B5563",label:"Neutral"}};function nr({availableDates:e,selectedDate:t,onDateSelect:r,settings:a,colors:o,cyclePhases:i,selectedService:n,addons:s=[],selectedAddons:l=[],onAddonsChange:c,addonPlacement:d="date_selection"}){console.log("[DateSelection] Addon Debug:",{addonsLength:s.length,hasOnAddonsChange:!!c,addonPlacement:d,showAddons:d!=="separate_step"&&s.length>0&&!!c,addons:s,selectedService:n});let u=a.calendarView||"month",p=a.headerContent?.value||"Select a Date",g=!e||e.length===0,b=Ge.useMemo(()=>g?oi():e,[g,e]),v=Ge.useMemo(()=>{let D=new Date;if(D.setHours(0,0,0,0),b.length>0){let T=b.find(P=>new Date(P)>=D);if(T){let P=new Date(T);return `${P.getFullYear()}-${String(P.getMonth()+1).padStart(2,"0")}`}}return `${D.getFullYear()}-${String(D.getMonth()+1).padStart(2,"0")}`},[b]),[w,f]=Ge.useState(v),x=Ge.useMemo(()=>new Set(b),[b]),[y,N]=w.split("-").map(Number),h=["January","February","March","April","May","June","July","August","September","October","November","December"][N-1],k=Ge.useMemo(()=>{let D=new Date(y,N-1,1),T=new Date(y,N,0),P=D.getDay(),z=T.getDate(),K=[];for(let Y=0;Y<P;Y++)K.push(null);for(let Y=1;Y<=z;Y++){let Te=`${y}-${String(N).padStart(2,"0")}-${String(Y).padStart(2,"0")}`,U=new Date(Te),ie=new Date;ie.setHours(0,0,0,0),K.push({day:Y,dateStr:Te,isAvailable:x.has(Te)&&U>=ie});}return K},[y,N,x]),S=Ge.useMemo(()=>{let D=new Date(y,N-2,1),T=`${D.getFullYear()}-${String(D.getMonth()+1).padStart(2,"0")}`;return b.some(P=>P.startsWith(T))},[b,y,N]),I=Ge.useMemo(()=>{let D=new Date(y,N,1),T=`${D.getFullYear()}-${String(D.getMonth()+1).padStart(2,"0")}`;return b.some(P=>P.startsWith(T))},[b,y,N]),R=()=>{if(!S)return;let D=new Date(y,N-2,1);f(`${D.getFullYear()}-${String(D.getMonth()+1).padStart(2,"0")}`);},m=()=>{if(!I)return;let D=new Date(y,N,1);f(`${D.getFullYear()}-${String(D.getMonth()+1).padStart(2,"0")}`);},F=i&&Object.keys(i).length>0,M=()=>{let D=n?.price||0;return l.length>0&&s.length>0&&l.forEach(T=>{let P=s.find(z=>z.id===T);P&&(D+=P.addonPrice||P.price||0);}),D},A=D=>{if(!c)return;let T=l.includes(D);c(T?l.filter(P=>P!==D):[...l,D]);};return jsxRuntime.jsxs("div",{className:"space-y-6",children:[n&&jsxRuntime.jsx(framerMotion.motion.div,{...ge(.05),className:"bg-gradient-to-br from-white to-gray-50/30 rounded-xl border border-gray-200/80 p-6 shadow-sm hover:shadow-md transition-shadow",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-4",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-3",children:jsxRuntime.jsx("h3",{className:"text-sm font-semibold tracking-wide uppercase",style:{color:o.primary},children:"Your Selection"})}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("p",{className:"font-bold text-lg text-gray-900",children:n.name}),n.description&&jsxRuntime.jsx("p",{className:"text-sm text-gray-600 leading-relaxed",children:n.description}),n.duration&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-gray-500",children:[jsxRuntime.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),jsxRuntime.jsxs("span",{children:[n.duration," minutes"]})]})]})]}),jsxRuntime.jsxs("div",{className:"text-right",children:[jsxRuntime.jsx("div",{className:"text-xs text-gray-500 mb-1 font-medium",children:"Price"}),jsxRuntime.jsxs("div",{className:"text-2xl font-bold",style:{color:o.primary},children:["$",n.price]})]})]})}),d!=="separate_step"&&s.length>0&&c&&jsxRuntime.jsxs(framerMotion.motion.div,{...ge(.1),className:"bg-white rounded-xl border border-gray-200/80 p-6 shadow-sm hover:shadow-md transition-shadow",children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-4",children:jsxRuntime.jsx("h3",{className:"text-sm font-semibold tracking-wide uppercase",style:{color:o.primary},children:"Enhance Your Experience"})}),jsxRuntime.jsx("div",{className:"space-y-3",children:s.map(D=>{let T=l.includes(D.id),P=D.addonPrice||D.price||0;return jsxRuntime.jsxs("label",{className:"flex items-start gap-4 p-4 rounded-xl border-2 cursor-pointer transition-all group",style:{borderColor:T?o.primary:"#E5E7EB",backgroundColor:T?`${o.primary}08`:"transparent",boxShadow:T?`0 0 0 3px ${o.primary}15`:"none"},children:[jsxRuntime.jsx("div",{className:"flex items-center pt-0.5",children:jsxRuntime.jsx("input",{type:"checkbox",checked:T,onChange:()=>A(D.id),className:"w-5 h-5 rounded border-2 border-gray-300 cursor-pointer",style:{accentColor:o.primary}})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-3 mb-1",children:[jsxRuntime.jsx("span",{className:"font-semibold text-base text-gray-900 group-hover:text-gray-700 transition-colors",children:D.name}),jsxRuntime.jsxs("span",{className:"text-base font-bold whitespace-nowrap flex-shrink-0",style:{color:o.primary},children:["+$",P]})]}),D.description&&jsxRuntime.jsx("p",{className:"text-sm text-gray-600 leading-relaxed",children:D.description})]})]},D.id)})}),l.length>0&&jsxRuntime.jsx("div",{className:"mt-6 pt-5 border-t-2 border-gray-100",children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-xs text-gray-500 mb-1 font-medium uppercase tracking-wide",children:"New Total"}),jsxRuntime.jsxs("div",{className:"text-sm text-gray-600",children:["Service + ",l.length," add-on",l.length>1?"s":""]})]}),jsxRuntime.jsxs("div",{className:"text-3xl font-bold",style:{color:o.primary},children:["$",M()]})]})})]}),jsxRuntime.jsx(framerMotion.motion.h2,{...ge(.15),className:"text-xl sm:text-2xl font-bold text-center sm:text-left",style:{color:o.primary},children:p}),F&&jsxRuntime.jsx(framerMotion.motion.div,{...ge(.1),className:"bg-white rounded-lg border border-gray-200 px-4 py-3",children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2 text-xs",children:[jsxRuntime.jsx("span",{className:"font-medium flex items-center",style:{color:o.primary},children:"Cycle Calendar:"}),jsxRuntime.jsx("div",{className:"flex items-center gap-3",children:Object.entries(ko).map(([D,T])=>jsxRuntime.jsxs("div",{className:"flex items-center space-x-1.5",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded border border-gray-300",style:{backgroundColor:T.bg}}),jsxRuntime.jsx("span",{children:T.label})]},D))})]})}),u==="month"?jsxRuntime.jsxs("div",{className:"border border-gray-200 rounded-lg p-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("button",{className:`p-2 rounded transition-colors ${S?"hover:bg-gray-100":"opacity-30 cursor-not-allowed"}`,onClick:R,disabled:!S,children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4"})}),jsxRuntime.jsxs("p",{className:"font-semibold",children:[h," ",y]}),jsxRuntime.jsx("button",{className:`p-2 rounded transition-colors ${I?"hover:bg-gray-100":"opacity-30 cursor-not-allowed"}`,onClick:m,disabled:!I,children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-7 gap-2",children:[["Su","Mo","Tu","We","Th","Fr","Sa"].map(D=>jsxRuntime.jsx("div",{className:"text-center text-xs font-medium py-2 opacity-60",children:D},D)),k.map((D,T)=>{if(!D)return jsxRuntime.jsx("div",{},`empty-${T}`);let{day:P,dateStr:z,isAvailable:K}=D,Y=t===z,Te=i?.[z],U=Te?ko[Te]:null;return jsxRuntime.jsx("button",{onClick:()=>K&&r(z),disabled:!K,className:`aspect-square rounded-lg text-sm transition-all ${Y?"text-white shadow-lg font-semibold":K?"hover:scale-105 cursor-pointer":"bg-gray-50 text-gray-300 cursor-not-allowed opacity-40"}`,style:{backgroundColor:Y?o.primary:U?.bg||void 0,color:Y?"white":U?.text||void 0},children:P},z)})]})]}):jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-3",children:b.slice(0,5).map(D=>{let T=new Date(D),P=T.getDate(),K=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][T.getDay()],Y=t===D;return jsxRuntime.jsxs("button",{onClick:()=>r(D),className:`p-4 rounded-lg border-2 transition-all text-center ${Y?"border-current text-white":"border-gray-200 hover:border-gray-300"}`,style:{borderColor:Y?o.primary:void 0,backgroundColor:Y?o.primary:void 0},children:[jsxRuntime.jsx("p",{className:"text-xs mb-1 opacity-75",children:K}),jsxRuntime.jsx("p",{className:"text-2xl font-semibold",children:P})]},D)})})]})}function Hn({availableTimes:e,selectedTime:t,onTimeSelect:r,settings:a,serviceDuration:o,colors:i,selectedService:n,selectedDate:s,selectedAddons:l=[],addons:c=[]}){let d=a.timeFormat||"12h",u=a.showDuration!==false,p=a.headerContent?.value||"Pick a Time",g=a.columns||3,b=()=>{let x=n?.price||0;return l.length>0&&c.length>0&&l.forEach(y=>{let N=c.find(C=>C.id===y);N&&(x+=N.addonPrice||N.price||0);}),x},v=x=>new Date(x+"T00:00:00").toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"}),w=x=>{let y=x.trim().split(" "),[N,C]=y[0].split(":"),h=parseInt(N),k=C||"00";if(y.length>1){let S=y[1];return d==="24h"?(S==="PM"&&h!==12?h+=12:S==="AM"&&h===12&&(h=0),`${String(h).padStart(2,"0")}:${k}`):x}if(d==="12h"){let S=h>=12?"PM":"AM";return `${h===0?12:h>12?h-12:h}:${k} ${S}`}return `${String(h).padStart(2,"0")}:${k}`},f={2:"grid-cols-2",3:"grid-cols-2 sm:grid-cols-3",4:"grid-cols-2 sm:grid-cols-3 lg:grid-cols-4"}[g]||"grid-cols-3";return jsxRuntime.jsxs("div",{className:"space-y-6",children:[n&&s&&jsxRuntime.jsxs(framerMotion.motion.div,{...ge(.05),className:"bg-gradient-to-br from-white to-gray-50/30 rounded-xl border border-gray-200/80 p-6 shadow-sm hover:shadow-md transition-shadow",children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-4",children:jsxRuntime.jsx("h3",{className:"text-sm font-semibold tracking-wide uppercase",style:{color:i.primary},children:"Your Booking"})}),jsxRuntime.jsxs("div",{className:"mb-3",children:[jsxRuntime.jsx("p",{className:"font-bold text-lg text-gray-900",children:n.name}),n.duration&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-gray-500 mt-1",children:[jsxRuntime.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),jsxRuntime.jsxs("span",{children:[n.duration," minutes"]})]})]}),l.length>0&&c.length>0&&jsxRuntime.jsxs("div",{className:"mb-4",children:[jsxRuntime.jsx("p",{className:"text-sm font-bold text-gray-900 mb-2",children:"Add-ons"}),jsxRuntime.jsx("div",{className:"space-y-2",children:l.map(x=>{let y=c.find(N=>N.id===x);return y?jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm text-gray-700 font-medium",children:y.name}),jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-gray-900",children:["$",y.addonPrice||y.price||0]})]},x):null})})]}),jsxRuntime.jsx("div",{className:"border-t border-gray-200 -mx-6 mb-4"}),jsxRuntime.jsx("div",{className:"bg-gray-50/50 -mx-6 px-6 py-4 mb-4",children:jsxRuntime.jsx("div",{className:"flex items-center justify-between",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("svg",{className:"w-5 h-5",style:{color:i.primary},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),jsxRuntime.jsx("span",{className:"font-bold text-base text-gray-900",children:v(s)})]})})}),jsxRuntime.jsx("div",{className:"border-t border-gray-200 -mx-6 mb-4"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-base font-bold text-gray-900",children:"Total"}),jsxRuntime.jsxs("span",{className:"text-2xl font-bold",style:{color:i.primary},children:["$",b()]})]})]}),jsxRuntime.jsx(framerMotion.motion.h2,{...ge(n&&s?.15:.05),className:"text-xl sm:text-2xl font-bold text-center sm:text-left",style:{color:i.primary},children:p}),jsxRuntime.jsx(framerMotion.motion.div,{className:`grid ${f} gap-3`,initial:{opacity:0},animate:{opacity:1},transition:{duration:.3,delay:n&&s?.2:.1},children:e.map((x,y)=>{let N=t===x;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>r(x),className:`p-3 rounded-lg border-2 transition-all text-center hover:scale-105 ${N?"border-current text-white shadow-lg":"border-gray-200 hover:border-gray-300"}`,style:{borderColor:N?i.primary:void 0,backgroundColor:N?i.primary:void 0},initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{duration:.2,delay:.15+y*.03,ease:"easeOut"},children:[jsxRuntime.jsx("p",{className:"font-medium",children:w(x)}),u&&o&&jsxRuntime.jsxs("p",{className:"text-xs mt-1 opacity-75",children:[o," min"]})]},x)})})]})}function Wn({addons:e,selectedAddons:t,onAddonsChange:r,settings:a,colors:o}){let i=a.headerContent?.value||"Add Extras",n=a.subheaderContent?.value||"Enhance your experience with these optional add-ons",s=a.showPricing!==false,l=a.showDuration!==false,c=d=>{let u=t.includes(d)?t.filter(p=>p!==d):[...t,d];r(u);};return jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs(framerMotion.motion.div,{...ge(.05),className:"text-center sm:text-left",children:[jsxRuntime.jsx("h2",{className:"text-xl sm:text-2xl font-bold mb-2",style:{color:o.primary},children:i}),jsxRuntime.jsx("p",{className:"text-sm opacity-70",children:n})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:e.map((d,u)=>{let p=t.includes(d.id);return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>c(d.id),className:`p-4 rounded-lg border-2 transition-all text-left relative ${p?"border-current shadow-lg":"border-gray-200 hover:border-gray-300"}`,style:{borderColor:p?o.primary:void 0,backgroundColor:p?`${o.primary}10`:void 0},initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.3,delay:.1+u*.05},children:[p&&jsxRuntime.jsx("div",{className:"absolute top-3 right-3 w-6 h-6 rounded-full flex items-center justify-center text-white text-sm",style:{backgroundColor:o.primary},children:"\u2713"}),jsxRuntime.jsx("p",{className:"font-semibold mb-1 pr-8",children:d.name}),jsxRuntime.jsx("p",{className:"text-xs opacity-70 mb-3",children:d.description}),jsxRuntime.jsxs("div",{className:"flex justify-between items-center text-sm",children:[s&&jsxRuntime.jsxs("span",{className:"font-bold",style:{color:o.primary},children:["+$",d.price]}),l&&jsxRuntime.jsxs("span",{className:"opacity-60",children:["+",d.duration," min"]})]})]},d.id)})}),t.length>0&&jsxRuntime.jsxs(framerMotion.motion.div,{className:"bg-gray-50 rounded-lg p-4 mt-4",initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},children:[jsxRuntime.jsx("p",{className:"text-sm font-medium mb-2",children:"Selected Add-ons:"}),jsxRuntime.jsx("div",{className:"space-y-1",children:t.map(d=>{let u=e.find(p=>p.id===d);return u?jsxRuntime.jsxs("div",{className:"flex justify-between text-sm",children:[jsxRuntime.jsx("span",{children:u.name}),jsxRuntime.jsxs("span",{className:"font-medium",style:{color:o.primary},children:["+$",u.price]})]},d):null})})]})]})}function jn({isOpen:e,onClose:t,title:r,children:a,isRequired:o=false,maxHeight:i="80vh"}){return Ge.useEffect(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset";}),[e]),Ge.useEffect(()=>{if(!o&&e){let n=s=>{s.key==="Escape"&&t();};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)}},[e,o,t]),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{...rr.backdrop,onClick:o?void 0:t,className:"fixed inset-0 bg-black/50 z-50",style:{backdropFilter:"blur(4px)"}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{y:"100%"},animate:{y:0},exit:{y:"100%"},transition:rr.spring,className:"fixed bottom-0 left-0 right-0 bg-white rounded-t-2xl shadow-2xl z-50",style:{maxHeight:i},children:[jsxRuntime.jsx("div",{className:"flex justify-center pt-3 pb-2",children:jsxRuntime.jsx("div",{className:"w-12 h-1 bg-gray-300 rounded-full"})}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-6 pb-4 border-b border-gray-200",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[r&&jsxRuntime.jsx("h3",{className:"text-lg font-semibold",children:r}),o&&jsxRuntime.jsx("span",{className:"text-xs font-medium px-2 py-0.5 bg-amber-100 text-amber-800 rounded",children:"Required"})]}),!o&&jsxRuntime.jsx("button",{onClick:t,className:"p-2 hover:bg-gray-100 rounded-lg transition-colors","aria-label":"Close",children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("div",{className:"overflow-y-auto",style:{maxHeight:`calc(${i} - 120px)`},children:jsxRuntime.jsx("div",{className:"px-6 py-6",children:a})})]})]})})}function Vn({contactInfo:e,onContactInfoChange:t,settings:r,optInModules:a=[],onOptInData:o,colors:i,isPreview:n=false}){let[s,l]=Ge.useState(false),[c,d]=Ge.useState(null),[u,p]=Ge.useState(()=>{let m={};return a.forEach(F=>{F.defaultChecked&&(m[F.id]=true);}),m}),[g,b]=Ge.useState({}),[v,w]=Ge.useState({}),f=Ge.useRef(false);Ge.useEffect(()=>{f.current||(f.current=true,a.forEach(m=>{m.defaultChecked&&m.renderCustomForm&&o&&m.renderCustomForm(()=>{},F=>o(m.id,F),i);}));},[]);let x=r.headerContent?.value||"Your Information",y=m=>m?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(m)?null:"Please enter a valid email address":"Email is required",N=m=>m?m.replace(/\D/g,"").length<10?"Please enter a valid phone number":null:"Phone number is required",C=m=>!m||m.trim().length===0?"Name is required":m.trim().length<2?"Name must be at least 2 characters":null,h=(m,F)=>{switch(m){case "email":return y(F);case "phone":return N(F);case "name":return C(F);default:return null}},k=[{label:"Name *",type:"text",placeholder:"Your full name",field:"name"},{label:"Email *",type:"email",placeholder:"your@email.com",field:"email"},{label:"Phone *",type:"tel",placeholder:"(555) 123-4567",field:"phone"},{label:"Notes (optional)",type:"textarea",placeholder:"Any special requests or notes...",field:"notes"}],S=(m,F)=>{if(t({...e,[m]:F}),!n&&v[m]){let M=h(m,F);b(A=>({...A,[m]:M||""}));}},I=m=>{if(n)return;w(A=>({...A,[m]:true}));let F=e[m]||"",M=h(m,F);b(A=>({...A,[m]:M||""}));},R=(m,F)=>{if(p(M=>({...M,[m.id]:F})),F){if(m.renderCustomForm){let M=false;if(m.renderCustomForm(()=>{},D=>{o&&o(m.id,D),M=true;},i)===null&&M)return}d(m),l(true);}else o&&o(m.id,null);};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsx(framerMotion.motion.h2,{...ge(.05),className:"text-xl sm:text-2xl font-bold text-center sm:text-left",style:{color:i.primary},children:x}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[k.map((m,F)=>jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{duration:.3,delay:.1+F*.05,ease:"easeOut"},children:[jsxRuntime.jsx("label",{className:"block text-sm font-medium mb-1",children:m.label}),m.type==="textarea"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("textarea",{className:`w-full px-3 py-2 border rounded-lg focus:ring-2 focus:border-transparent resize-none transition-all ${!n&&g[m.field]&&v[m.field]?"border-red-500":"border-gray-300"}`,style:{"--tw-ring-color":i.primary},rows:3,placeholder:m.placeholder,value:e[m.field]||"",onChange:M=>S(m.field,M.target.value),onBlur:()=>I(m.field)}),!n&&g[m.field]&&v[m.field]&&jsxRuntime.jsx("p",{className:"text-red-500 text-xs mt-1",children:g[m.field]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("input",{type:m.type,className:`w-full px-3 py-2 border rounded-lg focus:ring-2 focus:border-transparent transition-all ${!n&&g[m.field]&&v[m.field]?"border-red-500":"border-gray-300"}`,style:{"--tw-ring-color":i.primary},placeholder:m.placeholder,value:e[m.field]||"",onChange:M=>S(m.field,M.target.value),onBlur:()=>I(m.field)}),!n&&g[m.field]&&v[m.field]&&jsxRuntime.jsx("p",{className:"text-red-500 text-xs mt-1",children:g[m.field]})]})]},m.label)),a.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{className:"pt-3 border-t border-gray-200 space-y-3",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.3,delay:.3},children:a.map(m=>jsxRuntime.jsxs("label",{className:"flex items-start gap-3 cursor-pointer group",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:u[m.id]||false,onChange:F=>R(m,F.target.checked),className:"mt-1 w-4 h-4 rounded border-gray-300",style:{accentColor:i.primary}}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("span",{className:"text-sm font-medium",children:[m.label,m.required&&jsxRuntime.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),m.description&&jsxRuntime.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:m.description})]})]},m.id))})]})]}),c&&jsxRuntime.jsx(jn,{isOpen:s,onClose:()=>l(false),title:c.formTitle||"Additional Information",isRequired:c.required,children:c.renderCustomForm?c.renderCustomForm(()=>l(false),m=>{o&&o(c.id,m);},i):jsxRuntime.jsxs("div",{className:"space-y-4",children:[c.formFields?.map(m=>jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-1",children:[m.label,m.required&&jsxRuntime.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),m.type==="textarea"?jsxRuntime.jsx("textarea",{className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:border-transparent resize-none",style:{"--tw-ring-color":i.primary},rows:3,placeholder:m.placeholder}):m.type==="select"&&m.options?jsxRuntime.jsx("select",{className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:border-transparent",style:{"--tw-ring-color":i.primary},children:m.options.map(F=>jsxRuntime.jsx("option",{value:F.value,children:F.label},F.value))}):jsxRuntime.jsx("input",{type:m.type,className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:border-transparent",style:{"--tw-ring-color":i.primary},placeholder:m.placeholder})]},m.id)),jsxRuntime.jsx("button",{onClick:()=>{o&&c&&o(c.id,{}),l(false);},className:"w-full py-3 rounded-lg text-white font-medium transition-all hover:opacity-90",style:{backgroundColor:i.primary},children:"Save & Continue"})]})})]})}function Yn({service:e,addons:t=[],selectedDate:r,selectedTime:a,paymentProvider:o,paymentConfig:i,onConfirm:n,colors:s,isPreview:l=false}){let c=e?.price||0,d=t.reduce((y,N)=>y+(N.addonPrice||N.price||0),0),u=c+d,p=e?.duration||0,g=t.reduce((y,N)=>y+(N.duration||0),0),b=p+g,v=i.depositPercentage||20,w=(u*(v/100)).toFixed(2),f=u.toFixed(2),x=(parseFloat(f)-parseFloat(w)).toFixed(2);return jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsx(framerMotion.motion.h2,{...ge(.05),className:"text-xl font-bold text-center",style:{color:s.primary},children:"Confirm & Pay"}),jsxRuntime.jsx(framerMotion.motion.div,{className:"bg-gray-50 rounded-lg p-4",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.3,delay:.1},children:jsxRuntime.jsxs("div",{className:"space-y-2",children:[e&&jsxRuntime.jsxs("div",{className:"flex justify-between items-center text-sm",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"font-medium",children:e.name}),jsxRuntime.jsxs("p",{className:"text-xs opacity-70",children:[b," min total"]})]}),jsxRuntime.jsxs("span",{className:"font-bold",style:{color:s.primary},children:["$",c]})]}),t.length>0&&jsxRuntime.jsx("div",{className:"space-y-1 text-xs",children:t.map(y=>jsxRuntime.jsxs("div",{className:"flex justify-between opacity-70",children:[jsxRuntime.jsxs("span",{children:["+ ",y.name]}),jsxRuntime.jsxs("span",{children:["+$",y.addonPrice||y.price||0]})]},y.id))}),r&&jsxRuntime.jsxs("div",{className:"flex justify-between items-center text-sm pt-2 border-t border-gray-200",children:[jsxRuntime.jsx("span",{className:"opacity-70",children:new Date(r+"T00:00:00").toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})}),jsxRuntime.jsx("span",{children:a})]}),jsxRuntime.jsxs("div",{className:"pt-2 mt-2 border-t border-gray-200 flex justify-between items-center",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Due Today"}),jsxRuntime.jsxs("span",{className:"text-lg font-bold",style:{color:s.primary},children:["$",w]})]})]})}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.3,delay:.2},children:l?jsxRuntime.jsxs("div",{className:"border border-gray-200 rounded-lg p-4 bg-white",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("div",{className:"h-10 bg-gray-50 border border-gray-200 rounded flex items-center px-3",children:jsxRuntime.jsx("span",{className:"text-xs text-gray-400",children:"Card Number"})}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxRuntime.jsx("div",{className:"h-10 bg-gray-50 border border-gray-200 rounded flex items-center px-3",children:jsxRuntime.jsx("span",{className:"text-xs text-gray-400",children:"MM/YY"})}),jsxRuntime.jsx("div",{className:"h-10 bg-gray-50 border border-gray-200 rounded flex items-center px-3",children:jsxRuntime.jsx("span",{className:"text-xs text-gray-400",children:"CVV"})})]})]}),jsxRuntime.jsxs("div",{className:"mt-3 flex items-center justify-center gap-1",children:[jsxRuntime.jsx("svg",{className:"w-3 h-3 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})}),jsxRuntime.jsxs("span",{className:"text-xs text-gray-400",children:["Powered by ",o==="square"?"Square":"Stripe"]})]})]}):jsxRuntime.jsx("div",{className:"border border-gray-200 rounded-lg p-4 bg-white",children:jsxRuntime.jsxs("div",{className:"text-center py-8 text-sm text-gray-500",children:[jsxRuntime.jsxs("div",{className:"animate-pulse",children:["Initializing ",o==="square"?"Square":"Stripe"," payment..."]}),jsxRuntime.jsx("div",{className:"mt-4 text-xs text-gray-400",children:"Please wait while we securely load the payment form"})]})})}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.3,delay:.3},children:jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",className:"mt-0.5 w-4 h-4 rounded border-gray-300",style:{accentColor:s.primary}}),jsxRuntime.jsxs("span",{className:"text-xs",children:["I agree to the ",jsxRuntime.jsx("a",{href:"#",className:"underline",style:{color:s.primary},children:"cancellation policy"})," and understand the $",x," balance is due at appointment."]})]}),jsxRuntime.jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",className:"mt-0.5 w-4 h-4 rounded border-gray-300",style:{accentColor:s.primary}}),jsxRuntime.jsxs("span",{className:"text-xs",children:["I agree to the ",jsxRuntime.jsx("a",{href:"#",className:"underline",style:{color:s.primary},children:"terms of service"}),"."]})]})]})})]})}var Io={avoid:{phase:"avoid",color:"#EF4444",bgColor:"#FEF2F2",label:"Avoid",icon:"\u{1F534}",description:"Period - avoid waxing"},caution:{phase:"caution",color:"#F59E0B",bgColor:"#FFFBEB",label:"Caution",icon:"\u{1F7E1}",description:"End of period - proceed with caution"},optimal:{phase:"optimal",color:"#10B981",bgColor:"#F0FDF4",label:"Optimal",icon:"\u{1F7E2}",description:"Best time for waxing"},neutral:{phase:"neutral",color:"#6B7280",bgColor:"#F9FAFB",label:"Neutral",icon:"\u26AA",description:"Okay but not optimal"},unknown:{phase:"unknown",color:"#9CA3AF",bgColor:"#F3F4F6",label:"Unknown",icon:"\u2753",description:"No cycle data available"}};function pi({availableDates:e,selectedDate:t,onDateSelect:r,settings:a,colors:o,fetchCycleData:i,selectedClient:n,onCycleWarning:s,cycleAwareEnabled:l}){let[c,d]=Ge.useState({}),[u,p]=Ge.useState(false),[g,b]=Ge.useState(null),v=Ge.useMemo(()=>l!==void 0?l:!!(n?.cycle_opt_in&&i),[l,n?.cycle_opt_in,i]);Ge.useEffect(()=>{if(!v||!i||!n){d({});return}e.length!==0&&(p(true),b(null),i(n,e).then(f=>{d(f);}).catch(f=>{console.error("[CycleAwareDateSelection] Error fetching cycle data:",f),b(f.message||"Failed to load cycle data"),d({});}).finally(()=>{p(false);}));},[v,i,n,e]);let w=Ge.useCallback(f=>{let x=c[f];x?.phase==="avoid"&&s&&s(x,f),r(f,x);},[c,r,s]);return jsxRuntime.jsxs("div",{className:"cycle-aware-date-selection space-y-4",children:[v&&Object.keys(c).length>0&&jsxRuntime.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:[jsxRuntime.jsxs("h4",{className:"font-medium mb-3 flex items-center",style:{color:o.primary},children:[jsxRuntime.jsx("span",{className:"mr-2",children:"\u{1F4C5}"}),"Your Cycle Calendar"]}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-3 text-sm",children:Object.entries(Io).map(([f,x])=>f!=="unknown"&&jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full border border-gray-300",style:{backgroundColor:x.color}}),jsxRuntime.jsx("span",{children:x.label})]},f))}),jsxRuntime.jsx("p",{className:"text-xs opacity-70 mt-2",children:"Green dates are optimal for comfortable waxing appointments"})]}),v&&u&&jsxRuntime.jsx("div",{className:"text-center py-2 text-sm opacity-70",children:"Loading cycle predictions..."}),v&&g&&jsxRuntime.jsx("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-3",children:jsxRuntime.jsxs("p",{className:"text-yellow-800 text-sm",children:["Unable to load cycle predictions: ",g]})}),jsxRuntime.jsx(nr,{availableDates:e,selectedDate:t,onDateSelect:w,settings:a,colors:o}),v&&t&&c[t]?.phase==="avoid"&&jsxRuntime.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4",children:jsxRuntime.jsxs("div",{className:"flex items-start space-x-3",children:[jsxRuntime.jsx("span",{className:"text-red-500 text-xl",children:"\u26A0\uFE0F"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h4",{className:"font-medium text-red-800 mb-1",children:"This date falls during your predicted period"}),jsxRuntime.jsx("p",{className:"text-red-700 text-sm mb-3",children:"Waxing during this time may be more uncomfortable than usual. Would you like to see better alternatives?"}),jsxRuntime.jsxs("div",{className:"flex space-x-2",children:[jsxRuntime.jsx("button",{className:"px-3 py-1 bg-red-100 text-red-700 rounded text-sm hover:bg-red-200 transition-colors",onClick:()=>{let f=e.filter(x=>c[x]?.phase==="optimal");f.length>0&&w(f[0]);},children:"Show optimal dates"}),jsxRuntime.jsx("button",{className:"px-3 py-1 text-red-600 text-sm hover:underline",children:"Continue anyway"})]})]})]})})]})}var gi={enabled:true,duration:6e5,warningThreshold:12e4,maxExtensions:2,extensionDuration:3e5,showActions:true,showWarning:true};function Rr({holdStatus:e,config:t,colors:r,onExtend:a,onRelease:o,onWarning:i,onExpired:n,className:s=""}){let[l,c]=Ge.useState(Date.now()),[d,u]=Ge.useState(false),[p,g]=Ge.useState(false),[b,v]=Ge.useState(false),w={...gi,...t};Ge.useEffect(()=>{if(!e)return;let F=setInterval(()=>{c(Date.now());},1e3);return ()=>clearInterval(F)},[e]);let f=e?Math.max(0,e.expiresAt-l):0,x=f===0&&e!==null,y=f<=w.warningThreshold&&f>0;Ge.useEffect(()=>{y&&!d&&i&&e&&(u(true),i(f));},[y,d,i,e,f]),Ge.useEffect(()=>{x&&e&&n&&n();},[x,e,n]),Ge.useEffect(()=>{u(false);},[e?.holdKey]);let N=Ge.useCallback(async()=>{if(!(!a||!e||p))try{g(!0),await a(),u(!1);}catch(F){console.error("[HoldTimer] Failed to extend hold:",F);}finally{g(false);}},[a,e,p]),C=Ge.useCallback(async()=>{if(!(!o||!e||b))try{v(!0),await o();}catch(F){console.error("[HoldTimer] Failed to release hold:",F);}finally{v(false);}},[o,e,b]);if(!e||!w.enabled)return null;let h=Math.floor(f/6e4),k=Math.floor(f%6e4/1e3),S=`${h}:${k.toString().padStart(2,"0")}`,I="rgba(139, 92, 246, 0.1)",R="rgba(139, 92, 246, 0.3)",m=r.primary;return x?(I="rgba(239, 68, 68, 0.1)",R="rgba(239, 68, 68, 0.3)",m="#EF4444"):y&&w.showWarning&&(I=`${r.secondary}1A`,R=`${r.secondary}4D`,m=r.secondary),jsxRuntime.jsx("div",{className:`rounded-lg p-4 text-center ${s}`,style:{backgroundColor:I,borderWidth:"1px",borderStyle:"solid",borderColor:R},children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center",children:[jsxRuntime.jsx("div",{className:"flex flex-col items-center gap-2 mb-4",children:x?jsxRuntime.jsxs("div",{style:{color:m},className:"font-medium text-base",children:[jsxRuntime.jsx("span",{children:"Time expired - "}),jsxRuntime.jsx("button",{onClick:C,disabled:b,className:"underline hover:no-underline focus:outline-none focus:ring-2 focus:ring-offset-2 inline disabled:opacity-50",style:{color:m},children:b?"Releasing...":"select a new time"})]}):jsxRuntime.jsxs("div",{style:{color:m},className:"font-medium text-base",children:["Your time slot is reserved for ",S]})}),w.showActions&&!x&&jsxRuntime.jsxs("div",{className:"flex justify-center gap-2",children:[a&&e.canExtend&&jsxRuntime.jsxs("button",{onClick:N,disabled:!e.canExtend||p,className:"px-4 py-2 text-sm font-medium rounded transition-all active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed text-white",style:{backgroundColor:r.primary},"aria-label":`Extend hold (${e.maxExtensions-e.extensions} extensions remaining)`,children:[p?"Extending...":"Extend",!p&&e.maxExtensions-e.extensions>0&&jsxRuntime.jsxs("span",{className:"ml-1",children:["(",e.maxExtensions-e.extensions,")"]})]}),o&&jsxRuntime.jsx("button",{onClick:C,disabled:b,className:"px-4 py-2 text-sm font-medium rounded border transition-all active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed",style:{borderColor:"rgba(255, 255, 255, 0.2)",color:r.text||"#000000"},"aria-label":"Release hold and return to time selection",children:b?"Releasing...":"Release"})]}),!x&&!e.canExtend&&e.extensions>=e.maxExtensions&&jsxRuntime.jsx("div",{className:"mt-3 pt-3 border-t border-white/10 text-center",children:jsxRuntime.jsxs("div",{className:"text-sm",style:{color:r.secondary},children:["Maximum extensions reached - complete booking now or"," ",jsxRuntime.jsx("button",{onClick:C,disabled:b,className:"hover:underline focus:outline-none focus:underline disabled:opacity-50",style:{color:r.primary},children:b?"releasing...":"select a different time"})]})})]})})}function Ro({config:e,colors:t,services:r=[],categories:a=[],dates:o=[],times:i=[],addons:n=[],paymentProvider:s,paymentConfig:l,isPreview:c=false,onComplete:d,onStepChange:u,onServiceSelect:p,onDateSelect:g,onContactInfoChange:b,validateStep:v,holdTimer:w,stepOrder:f,optInModules:x=[],onOptInData:y,customPaymentForm:N,cyclePhases:C}){let[h,k]=Ge.useState(0),[S,I]=Ge.useState("forward"),[R,m]=Ge.useState(null),[F,M]=Ge.useState(null),[A,D]=Ge.useState(null),[T,P]=Ge.useState([]),[z,K]=Ge.useState({}),[Y,Te]=Ge.useState({}),[U,ie]=Ge.useState(null),Xe=t.bookingText||t.text||"#000000",ot=e.transitions||{},xe=ot.style||"slide",At=ot.speed||"normal",je=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,fe=e.background||{type:"color",value:"#FFFFFF"},O={service:{id:"service",name:"Service",enabled:e.steps?.service_selection?.enabled!==false,settings:e.steps?.service_selection?.settings||{}},date:{id:"date",name:"Date",enabled:e.steps?.date_selection?.enabled!==false,settings:e.steps?.date_selection?.settings||{}},time:{id:"time",name:"Time",enabled:e.steps?.time_selection?.enabled!==false,settings:e.steps?.time_selection?.settings||{}},addons:{id:"addons",name:"Add-ons",enabled:e.steps?.addon_selection?.enabled===true,settings:e.steps?.addon_selection?.settings||{}},details:{id:"details",name:"Details",enabled:e.steps?.contact_form?.enabled!==false,settings:e.steps?.contact_form?.settings||{}},confirm:{id:"confirm",name:"Confirm",enabled:e.steps?.confirmation?.enabled===true,settings:e.steps?.confirmation?.settings||{}}},Ne=f||["service","date","time","addons","details","confirm"],J=Ne.map(E=>O[E]).filter(E=>E&&E.enabled);console.log("[BookingFlow] Step configuration:",{customStepOrder:f,orderedStepIds:Ne,allSteps:J.map(E=>E.id),currentStepIndex:h,currentStepId:J[h]?.id});let re=J[h],at=()=>fe.type==="gradient"?{background:fe.value}:fe.type==="image"?{backgroundImage:`url(${fe.value})`,backgroundSize:"cover",backgroundPosition:"center"}:{backgroundColor:fe.value},it=()=>{if(je)return .15;switch(At){case "fast":return .2;case "slow":return .5;default:return .3}},gr=()=>xe==="fade"?{enter:()=>({opacity:0,scale:.95}),center:{opacity:1,scale:1},exit:()=>({opacity:0,scale:.95})}:{enter:()=>({x:S==="forward"?50:-50,opacity:0}),center:{x:0,opacity:1},exit:()=>({x:S==="forward"?-50:50,opacity:0})},Kt=()=>{let E=re?.id;if(v)return v(E,{service:R,date:F,time:A,addons:T,contact:z});switch(E){case "service":return R!==null;case "date":return F!==null;case "time":return A!==null;case "details":if(c)return true;let W=z?.name&&z.name.trim().length>=2,_=z?.email&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(z.email),ye=z?.phone&&z.phone.replace(/\D/g,"").length>=10;return W&&_&&ye;default:return true}},$t=E=>E<h,Ce=E=>{I(E>h?"forward":"backward"),k(E),u&&u(E,J[E]?.id);},bt=()=>{h<J.length-1&&Ce(h+1);},Lt=async()=>{if(h===0)return;let E=h-1;if(J[E]?.id==="time"&&U&&w?.releaseHold)try{await w.releaseHold(U.holdId),ie(null),D(null);}catch(_){console.error("[BookingFlow] Failed to release hold:",_);}Ce(E);},fr=async E=>{if(D(E),w?.enabled&&w.createHold&&F&&R)try{let W=r.find(ye=>ye.id===R),_=await w.createHold({date:F,time:E,serviceId:R,serviceDuration:W?.duration||60});ie(_);}catch(W){console.error("[BookingFlow] Failed to create hold:",W);return}bt();},yr=()=>{ie(null),D(null);let E=J.findIndex(W=>W.id==="time");E>=0&&Ce(E);},Jt=async()=>{d&&d({service:R,date:F,time:A,addons:T,contact:z,optIn:Y});},Zr=()=>{if(!re)return null;let E={settings:re.settings,colors:t},W=r.find(_=>_.id===R);switch(re.id){case "service":return jsxRuntime.jsx(On,{...E,services:r,categories:a,selectedService:R,onServiceSelect:se=>{m(se),p&&p(se);}});case "date":return jsxRuntime.jsx(nr,{...E,availableDates:o,selectedDate:F,onDateSelect:se=>{M(se),g&&g(se);},cyclePhases:C,selectedService:W,addons:n,selectedAddons:T,onAddonsChange:P,addonPlacement:e.steps?.addon_selection?.settings?.placement||"date_selection"});case "time":return jsxRuntime.jsx(Hn,{...E,availableTimes:i,selectedTime:A,onTimeSelect:fr,serviceDuration:W?.duration||60,selectedService:W,selectedDate:F,selectedAddons:T,addons:n});case "addons":return jsxRuntime.jsx(Wn,{...E,addons:n,selectedAddons:T,onAddonsChange:P});case "details":return jsxRuntime.jsx(Vn,{...E,contactInfo:z,onContactInfoChange:se=>{K(se),b&&b(se);},optInModules:x,onOptInData:y});case "confirm":let _=n.filter(se=>T.includes(se.id)),ye=_.reduce((se,Pe)=>se+(Pe.addonPrice||Pe.price||0),0),br=(W?.price||0)+ye,hr=_.reduce((se,Pe)=>Pe.affectsDuration&&Pe.additionalDuration?se+Pe.additionalDuration:se,W?.duration||60);return N?jsxRuntime.jsx(N,{bookingData:{service:R,serviceName:W?.name,date:F,time:A,addons:T,contact:z,amount:W?.price||0,duration:hr,clientName:z?.name,clientEmail:z?.email,clientPhone:z?.phone,pendingBooking:{customerClientId:null,serviceId:R,date:F,time:A,notes:z?.notes||"",selectedAddons:_,addonServices:T,addonTotalCost:ye,totalAmount:br,duration:hr}},onPaymentSuccess:Jt,onPaymentError:Pe=>{console.error("[BookingFlow] Payment error:",Pe);}}):jsxRuntime.jsx(Yn,{...E,service:W,addons:_,selectedDate:F||"",selectedTime:A||"",paymentProvider:s||"square",paymentConfig:l||{depositPercentage:20},isPreview:c,onConfirm:Jt});default:return null}},st=()=>{let E=e.progressBar?.style||"dots";return E==="bar"?jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-medium",children:["Step ",h+1," of ",J.length]}),jsxRuntime.jsx("span",{className:"text-xs opacity-60",children:re?.name})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-gray-200 rounded-full overflow-hidden",children:jsxRuntime.jsx(framerMotion.motion.div,{className:"h-full rounded-full",style:{backgroundColor:t.primary},initial:{width:0},animate:{width:`${(h+1)/J.length*100}%`},transition:{duration:.3,ease:"easeOut"}})})]}):E==="minimal"?jsxRuntime.jsxs("div",{className:"mb-6 text-center",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium",style:{color:t.primary},children:re?.name}),jsxRuntime.jsxs("p",{className:"text-xs opacity-60 mt-1",children:["Step ",h+1," of ",J.length]})]}):jsxRuntime.jsx("div",{className:"flex justify-center mb-4 overflow-x-auto py-2",children:jsxRuntime.jsx("div",{className:"flex items-center space-x-1.5 px-4 min-w-max",children:J.map((W,_)=>jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(framerMotion.motion.div,{className:`w-6 h-6 rounded-full flex items-center justify-center font-medium text-xs transition-all flex-shrink-0 ${_===h?"text-white shadow-md":$t(_)?"text-white":"bg-gray-200 text-gray-500"}`,style:{backgroundColor:_<=h?t.primary:void 0},animate:{scale:_===h?1.05:1},transition:{duration:.2},children:$t(_)?"\u2713":_+1}),_<J.length-1&&jsxRuntime.jsx(framerMotion.motion.div,{className:`w-4 h-0.5 mx-1 transition-all flex-shrink-0 ${_<h?"":"bg-gray-200"}`,style:{backgroundColor:_<h?t.primary:void 0},initial:{scaleX:0},animate:{scaleX:1},transition:{duration:.3,delay:.1}})]},W.id))})})};return jsxRuntime.jsxs("div",{className:"w-full max-w-4xl mx-auto p-6 rounded-2xl shadow-xl",style:{...at(),color:Xe},children:[st(),w?.enabled&&U&&re?.id!=="time"&&jsxRuntime.jsx(Rr,{holdStatus:U,config:w.config,colors:t,onExtend:async()=>{if(w.extendHold&&U)try{let E=await w.extendHold(U.holdId);ie(E);}catch(E){console.error("[BookingFlow] Failed to extend hold:",E);}},onRelease:async()=>{if(w.releaseHold&&U)try{await w.releaseHold(U.holdId),ie(null),D(null);let E=J.findIndex(W=>W.id==="time");E>=0&&Ce(E);}catch(E){console.error("[BookingFlow] Failed to release hold:",E);}},onExpired:yr,className:"mb-6"}),jsxRuntime.jsx("div",{className:"mb-6 min-h-[300px] relative overflow-hidden",children:jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",custom:S,children:jsxRuntime.jsx(framerMotion.motion.div,{custom:S,variants:gr(),initial:"enter",animate:"center",exit:"exit",transition:{duration:it(),ease:[.4,0,.2,1]},children:Zr()},h)})}),!(re?.id==="confirm"&&N)&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between pt-4 border-t border-gray-200",children:[jsxRuntime.jsx("button",{onClick:Lt,disabled:h===0,className:"px-4 py-2 rounded-lg border border-gray-300 disabled:opacity-30 disabled:cursor-not-allowed hover:bg-gray-50 transition-all text-sm font-medium",children:"Back"}),h<J.length-1?jsxRuntime.jsx("button",{onClick:bt,disabled:!Kt(),className:"px-6 py-2 rounded-lg text-white disabled:opacity-50 disabled:cursor-not-allowed hover:opacity-90 transition-all text-sm font-medium shadow-md",style:{backgroundColor:t.primary},children:"Next"}):jsxRuntime.jsx("button",{onClick:Jt,disabled:!Kt(),className:"px-6 py-2 rounded-lg text-white disabled:opacity-50 disabled:cursor-not-allowed hover:opacity-90 transition-all text-sm font-medium shadow-md",style:{backgroundColor:t.primary},children:re?.id==="confirm"?"Pay & Confirm":"Complete"})]})]})}function yi({section:e,theme:t,BookingFlowComponent:r,config:a,enableInlineEditing:o=false}){let{type:i,settings:n}=e,s=e.id;i==="video_section"&&console.log("\u{1F3AC} Rendering video_section:",{type:i,settings:n,sectionId:s});let l=t?.colors||{primary:"#BCB4FF",secondary:"#CAC426",text:"#000000"},c=t?.typography||{headingFont:"Geist Sans",bodyFont:"Inter",bodySize:"16px"};switch(i){case "logo":return jsxRuntime.jsx(tn,{logoUrl:n.logoUrl,fallbackText:n.fallbackText,size:n.size,alignment:n.alignment,colors:l,enableInlineEditing:o,sectionId:s});case "header":return jsxRuntime.jsx(nn,{name:n.name,title:n.title,bio:n.bio,showName:n.showName,showTitle:n.showTitle,showBio:n.showBio,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "featured_link":return jsxRuntime.jsx(on,{text:n.text,url:n.url,style:n.style,size:n.size,colors:l,enableInlineEditing:o,sectionId:s});case "link_list":return jsxRuntime.jsx(sn,{links:n.links||[],style:n.style,colors:l,enableInlineEditing:o,sectionId:s});case "social_bar":return jsxRuntime.jsx(ln,{platforms:n.platforms||[],socialLinks:n.socialLinks,style:n.style,size:n.size,position:n.position,invertIcons:n.invertIcons,colors:l,enableInlineEditing:o,sectionId:s});case "instagram_feed":return jsxRuntime.jsx(Fn,{username:n.username,colors:l,enableInlineEditing:o,sectionId:s});case "minimal_header":return jsxRuntime.jsx(bn,{brandName:n.brandName,logoUrl:n.logoUrl,style:n.style,alignment:n.alignment,sticky:n.sticky,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "minimal_navigation":return jsxRuntime.jsx(xn,{links:n.links||[],style:n.style,colors:l,enableInlineEditing:o,sectionId:s});case "feature_content":return jsxRuntime.jsx(wn,{headline:n.headline,description:n.description,image:n.image,buttonText:n.buttonText,buttonUrl:n.buttonUrl,showButton:n.showButton,layout:n.layout,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "minimal_footer":return jsxRuntime.jsx(vn,{alignment:n.alignment,showSocial:n.showSocial,showContact:n.showContact,showLinks:n.showLinks,footerText:n.footerText,colors:l,enableInlineEditing:o,sectionId:s});case "hero":return jsxRuntime.jsx(cn,{headline:n.headline,subheadline:n.subheadline,heroImage:n.heroImage,ctaButton:n.ctaButton,layout:n.layout,imagePosition:n.imagePosition,contentDisplay:n.contentDisplay,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "about":return jsxRuntime.jsx(dn,{title:n.title,content:n.content,image:n.image,layout:n.layout,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "services_preview":return jsxRuntime.jsx(un,{title:n.title,services:n.services,layout:n.layout,columns:n.columns,showPrices:n.showPrices,showDuration:n.showDuration,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "gallery":return jsxRuntime.jsx(mn,{title:n.title,images:n.images||[],columns:n.columns,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "testimonials":return jsxRuntime.jsx(gn,{title:n.title,testimonials:n.testimonials,layout:n.layout,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "team":return jsxRuntime.jsx(fn,{title:n.title,members:n.members,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "contact":return jsxRuntime.jsx(yn,{title:n.title,showForm:n.showForm,email:n.email,phone:n.phone,address:n.address,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "before_after":return jsxRuntime.jsx(Cn,{title:n.title,comparisons:n.comparisons,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "pricing_table":return jsxRuntime.jsx(Sn,{title:n.title,plans:n.plans,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "booking":return jsxRuntime.jsx(En,{config:a||{},colors:l,BookingFlowComponent:r,enableInlineEditing:o,sectionId:s});case "fixed_info_card":return jsxRuntime.jsx(In,{name:n.name,subheading:n.subheading,bio:n.bio,links:n.links||[],bookingButtonText:n.bookingButtonText,bookingButtonUrl:n.bookingButtonUrl,showBookingButton:n.showBookingButton,position:n.position,cardWidth:n.cardWidth,cardColor:n.cardColor,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "video_section":return jsxRuntime.jsx(Rn,{videoUrl:n.videoUrl,aspectRatio:n.aspectRatio,autoplay:n.autoplay,loop:n.loop,muted:n.muted,controls:n.controls,allowFullScreen:n.allowFullScreen,coverImage:n.coverImage,maxWidth:n.maxWidth,alignment:n.alignment,borderRadius:n.borderRadius,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "scrolling_text_divider":return jsxRuntime.jsx(Pn,{text:n.text,scrollDirection:n.scrollDirection,scrollSpeed:n.scrollSpeed,orientation:n.orientation,dividerIcon:n.dividerIcon,customIcon:n.customIcon,textSize:n.textSize,textColor:n.textColor,fontWeight:n.fontWeight,backgroundColor:n.backgroundColor,backgroundGradient:n.backgroundGradient,pauseOnHover:n.pauseOnHover,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "location_map":return jsxRuntime.jsx(An,{address:n.address,displayType:n.displayType,mapHeight:n.mapHeight,mapStyle:n.mapStyle,zoom:n.zoom,showMarker:n.showMarker,borderRadius:n.borderRadius,directionsButtonText:n.directionsButtonText,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "image_section":return jsxRuntime.jsx(Mn,{imageUrl:n.imageUrl,altText:n.altText,caption:n.caption,maxWidth:n.maxWidth,alignment:n.alignment,aspectRatio:n.aspectRatio,borderRadius:n.borderRadius,linkUrl:n.linkUrl,openInNewTab:n.openInNewTab,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "faq_section":return jsxRuntime.jsx($n,{title:n.title,faqs:n.faqs,layout:n.layout,maxWidth:n.maxWidth,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "navbar":return jsxRuntime.jsx(Bn,{brandName:n.brandName,logoUrl:n.logoUrl,showLogo:n.showLogo,showBrandName:n.showBrandName,links:n.links,ctaText:n.ctaText,ctaUrl:n.ctaUrl,sticky:n.sticky,transparentOnTop:n.transparentOnTop,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "text_section":return jsxRuntime.jsx(zn,{title:n.title,content:n.content,alignment:n.alignment,maxWidth:n.maxWidth,textSize:n.textSize,backgroundColor:n.backgroundColor,textColor:n.textColor,paddingY:n.paddingY,colors:l,typography:c,enableInlineEditing:o,sectionId:s});default:return jsxRuntime.jsx("div",{className:"container mx-auto px-4 py-16",children:jsxRuntime.jsx("div",{className:"max-w-4xl mx-auto p-8 rounded-lg border-2 border-dashed text-center",style:{borderColor:l.primary,opacity:.5},children:jsxRuntime.jsxs("p",{className:"text-lg",style:{color:l.text},children:["Unknown section type: ",i]})})})}}var Xn=null;function xi(){if(!Xn){let e=undefined.VITE_SUPABASE_URL||process.env.NEXT_PUBLIC_SUPABASE_URL,t=undefined.VITE_SUPABASE_ANON_KEY||process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;if(!e||!t)throw new Error("Supabase URL and Anon Key must be provided");Xn=supabaseJs.createClient(e,t);}return Xn}var nt={bucket:"form-uploads",limits:{maxSize:5*1024*1024,allowedTypes:["image/jpeg","image/png","image/webp","image/jpg"]}};async function To(e,t,r){if(console.log("\u{1F4E6} uploadFormImage called:",{fileName:e.name,clientId:t,formId:r}),e.size>nt.limits.maxSize)throw new Error(`File size exceeds maximum of ${nt.limits.maxSize/1024/1024}MB`);if(!nt.limits.allowedTypes.includes(e.type))throw new Error(`File type ${e.type} not allowed. Accepted types: JPG, PNG, WebP`);console.log("\u{1F3A8} Starting image optimization...");let a=await vi(e);console.log("\u2705 Image optimized:",{originalSize:e.size,optimizedSize:a.size});let o=Date.now();e.name.split(".").pop()?.toLowerCase()||"jpg";let n=e.name.replace(/[^a-zA-Z0-9.-]/g,"_").substring(0,50),s=`${o}_${n}`,l=`${t}/${r}/${s}`;console.log("\u2601\uFE0F Uploading to Supabase:",{filePath:l,bucket:nt.bucket});let c=xi(),{data:d,error:u}=await c.storage.from(nt.bucket).upload(l,a,{cacheControl:"3600",upsert:false,contentType:a.type});if(console.log("\u{1F4E4} Upload result:",{data:d,error:u}),u)throw console.error("\u274C Supabase upload error:",u),new Error(`Upload failed: ${u.message}`);console.log("\u2705 Upload successful, getting public URL...");let{data:{publicUrl:p}}=c.storage.from(nt.bucket).getPublicUrl(l);return console.log("\u2705 Public URL obtained:",p),{url:p,path:l,filename:e.name,size:a.size,type:a.type}}async function vi(e,t=1920,r=.85){console.log("\u{1F5BC}\uFE0F optimizeImage: Starting optimization");let a=e.type==="image/png"||e.type==="image/webp",o=a?e.type:"image/jpeg";return console.log("\u{1F5BC}\uFE0F optimizeImage: Output type:",o,"Transparency:",a),new Promise((i,n)=>{let s=setTimeout(()=>{console.error("\u23F1\uFE0F optimizeImage: Timeout after 30 seconds"),n(new Error("Image optimization timed out"));},3e4),l=new Image,c=document.createElement("canvas"),d=c.getContext("2d",{alpha:a});if(!d){clearTimeout(s),console.error("\u274C optimizeImage: Canvas context not available"),n(new Error("Canvas context not available"));return}console.log("\u{1F5BC}\uFE0F optimizeImage: Created canvas and context"),l.onload=()=>{console.log("\u{1F5BC}\uFE0F optimizeImage: Image loaded",{width:l.width,height:l.height});try{let u=Math.min(t/l.width,1);c.width=l.width*u,c.height=l.height*u,console.log("\u{1F5BC}\uFE0F optimizeImage: Resizing to",{width:c.width,height:c.height}),a&&d.clearRect(0,0,c.width,c.height),d.drawImage(l,0,0,c.width,c.height),console.log("\u{1F5BC}\uFE0F optimizeImage: Image drawn, converting to blob..."),c.toBlob(p=>{if(clearTimeout(s),!p){console.error("\u274C optimizeImage: Blob conversion failed"),n(new Error("Image optimization failed"));return}console.log("\u2705 optimizeImage: Blob created",{size:p.size,type:o});let g=new File([p],e.name,{type:o,lastModified:Date.now()});console.log("\u2705 optimizeImage: Optimization complete"),i(g);},o,r);}catch(u){clearTimeout(s),console.error("\u274C optimizeImage: Error during processing",u),n(u);}},l.onerror=u=>{clearTimeout(s),console.error("\u274C optimizeImage: Failed to load image",u),n(new Error("Failed to load image"));},console.log("\u{1F5BC}\uFE0F optimizeImage: Creating object URL and loading image..."),l.src=URL.createObjectURL(e);})}function Po(e){return e.size>nt.limits.maxSize?{valid:false,error:`File size exceeds maximum of ${nt.limits.maxSize/1024/1024}MB`}:nt.limits.allowedTypes.includes(e.type)?{valid:true}:{valid:false,error:"File type not allowed. Accepted: JPG, PNG, WebP"}}function Pr({field:e,value:t,error:r,onChange:a,businessId:o,formId:i,styling:n}){let s=Ge.useRef(null),[l,c]=Ge.useState(false),[d,u]=Ge.useState(null),p=n?.labelColor||"#374151",g=n?.fieldStyle||"outlined",v=(()=>{let f="w-full px-4 py-2 transition-all focus:outline-none";if(r)return `${f} bg-red-50 border border-red-300 rounded-lg focus:ring-2 focus:ring-red-500`;switch(g){case "filled":return `${f} bg-gray-100 border border-transparent rounded-lg focus:bg-white focus:ring-2 focus:ring-gray-900 focus:border-transparent`;case "underlined":return `${f} bg-transparent border-0 border-b-2 border-gray-300 rounded-none focus:border-gray-900 focus:ring-0 px-0`;case "minimal":return `${f} bg-transparent border border-gray-200 rounded-lg focus:border-gray-400 focus:ring-1 focus:ring-gray-300`;case "outlined":default:return `${f} bg-white border-2 border-gray-300 rounded-lg focus:border-gray-900 focus:ring-2 focus:ring-gray-900`}})(),w="block text-sm font-medium mb-1";if(e.type==="text"||e.type==="email"||e.type==="tel")return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:e.id,className:w,style:{color:p},children:[e.label,e.required&&jsxRuntime.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),jsxRuntime.jsx("input",{type:e.type,id:e.id,name:e.id,value:t||"",onChange:f=>a(f.target.value),placeholder:e.placeholder,required:e.required,className:v,style:{color:p}}),r&&jsxRuntime.jsx("p",{className:"mt-1 text-xs text-red-600",children:r})]});if(e.type==="textarea")return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:e.id,className:w,style:{color:p},children:[e.label,e.required&&jsxRuntime.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),jsxRuntime.jsx("textarea",{id:e.id,name:e.id,value:t||"",onChange:f=>a(f.target.value),placeholder:e.placeholder,required:e.required,rows:4,className:v,style:{color:p}}),r&&jsxRuntime.jsx("p",{className:"mt-1 text-xs text-red-600",children:r})]});if(e.type==="date")return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:e.id,className:w,style:{color:p},children:[e.label,e.required&&jsxRuntime.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),jsxRuntime.jsx("input",{type:"date",id:e.id,name:e.id,value:t||"",onChange:f=>a(f.target.value),required:e.required,className:v,style:{color:p}}),r&&jsxRuntime.jsx("p",{className:"mt-1 text-xs text-red-600",children:r})]});if(e.type==="select"&&e.options)return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:e.id,className:w,style:{color:p},children:[e.label,e.required&&jsxRuntime.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),jsxRuntime.jsxs("select",{id:e.id,name:e.id,value:t||"",onChange:f=>a(f.target.value),required:e.required,className:v,style:{color:p},children:[jsxRuntime.jsx("option",{value:"",children:"Select an option..."}),e.options.map(f=>jsxRuntime.jsx("option",{value:f.value,children:f.label},f.value))]}),r&&jsxRuntime.jsx("p",{className:"mt-1 text-xs text-red-600",children:r})]});if(e.type==="radio"&&e.options)return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:w,style:{color:p},children:[e.label,e.required&&jsxRuntime.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),jsxRuntime.jsx("div",{className:"space-y-2 mt-2",children:e.options.map(f=>jsxRuntime.jsxs("label",{className:"flex items-center space-x-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"radio",name:e.id,value:f.value,checked:t===f.value,onChange:x=>a(x.target.value),required:e.required,className:"w-4 h-4 text-gray-900 focus:ring-gray-900 focus:ring-2"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:n?.labelColor||"#000000"},children:f.label})]},f.value))}),r&&jsxRuntime.jsx("p",{className:"mt-1 text-xs text-red-600",children:r})]});if(e.type==="checkbox"&&e.options){let f=Array.isArray(t)?t:[],x=y=>{let N=f.includes(y)?f.filter(C=>C!==y):[...f,y];a(N);};return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:w,style:{color:p},children:[e.label,e.required&&jsxRuntime.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),jsxRuntime.jsx("div",{className:"space-y-2 mt-2",children:e.options.map(y=>jsxRuntime.jsxs("label",{className:"flex items-center space-x-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",name:`${e.id}[]`,value:y.value,checked:f.includes(y.value),onChange:()=>x(y.value),className:"w-4 h-4 text-gray-900 focus:ring-gray-900 focus:ring-2 rounded"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:n?.labelColor||"#000000"},children:y.label})]},y.value))}),r&&jsxRuntime.jsx("p",{className:"mt-1 text-xs text-red-600",children:r})]})}if(e.type==="photo"){let f=async x=>{let y=x.target.files?.[0];if(!y)return;u(null);let N=Po(y);if(!N.valid){u(N.error||"Invalid file"),s.current&&(s.current.value="");return}if(!o||!i){u("Missing required configuration for file upload"),s.current&&(s.current.value="");return}c(true);try{let C=await To(y,o,i);a({url:C.url,filename:C.filename,size:C.size,type:C.type,uploadedAt:new Date().toISOString()}),u(null);}catch(C){console.error("Photo upload error:",C),u(C instanceof Error?C.message:"Upload failed"),s.current&&(s.current.value="");}finally{c(false);}};return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:e.id,className:w,style:{color:p},children:[e.label,e.required&&jsxRuntime.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),jsxRuntime.jsxs("div",{className:"mt-1",children:[jsxRuntime.jsx("input",{ref:s,type:"file",id:e.id,name:e.id,accept:"image/*",onChange:f,required:e.required,disabled:l,className:`block w-full text-sm text-gray-500
10
+ `}),jsxRuntime.jsxs("div",{className:`flex items-center whitespace-nowrap ${h[n]} ${k[l]} uppercase tracking-wider`,style:{fontFamily:g?.headingFont||"inherit",color:s||p.text,animation:`scroll-${t} ${C}s linear infinite`,animationPlayState:w?"paused":"running"},children:[jsxRuntime.jsx("span",{className:"inline-block",children:I}),jsxRuntime.jsx("span",{className:"inline-block","aria-hidden":"true",children:I})]})]})}function An({address:e,displayType:t="both",mapHeight:r="medium",mapStyle:a="roadmap",zoom:o=15,showMarker:i=true,borderRadius:n=12,directionsButtonText:s="Get Directions",colors:l,typography:c,enableInlineEditing:d=false,sectionId:u=""}){let g={small:300,medium:400,large:500}[r],b=encodeURIComponent(e),v=`https://www.google.com/maps/dir/?api=1&destination=${b}`,f=`https://www.google.com/maps/embed/v1/place?key=${undefined?.VITE_GOOGLE_MAPS_API_KEY||typeof globalThis<"u"&&globalThis.process?.env?.NEXT_PUBLIC_GOOGLE_MAPS_API_KEY||""}&q=${b}&zoom=${o}&maptype=${a}`;return jsxRuntime.jsx("div",{className:"container mx-auto px-4",children:jsxRuntime.jsxs("div",{className:"max-w-4xl mx-auto",children:[(t==="map-only"||t==="both")&&e&&jsxRuntime.jsx("div",{className:"w-full overflow-hidden mb-6",style:{height:`${g}px`,borderRadius:`${n}px`},children:jsxRuntime.jsx("iframe",{src:f,className:"w-full h-full",style:{border:0},allowFullScreen:true,loading:"lazy",referrerPolicy:"no-referrer-when-downgrade",title:"Location Map"})}),(t==="address-only"||t==="both")&&jsxRuntime.jsx("div",{className:"p-6 rounded-lg border",style:{backgroundColor:`${l.primary}10`,borderColor:`${l.primary}30`,borderRadius:`${n}px`},children:jsxRuntime.jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-4",children:[jsxRuntime.jsx("div",{className:"flex-1",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsxs("svg",{className:"w-5 h-5 mt-0.5 flex-shrink-0",fill:"none",stroke:l.primary,viewBox:"0 0 24 24",children:[jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"}),jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 11a3 3 0 11-6 0 3 3 0 016 0z"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"font-medium mb-1",style:{color:l.text,fontFamily:c?.bodyFont||"inherit"},...d&&{"data-editable":true,"data-section-id":u,"data-field-path":"settings.address"},children:e||"Add your address"}),e&&jsxRuntime.jsx("a",{href:v,target:"_blank",rel:"noopener noreferrer",className:"text-sm underline hover:no-underline",style:{color:l.primary},children:"View in Google Maps \uFFFD"})]})]})}),e&&jsxRuntime.jsx("a",{href:v,target:"_blank",rel:"noopener noreferrer",className:"px-6 py-3 rounded-lg font-semibold transition-all hover:opacity-90 text-center",style:{backgroundColor:l.primary,color:"#FFFFFF"},children:s})]})}),!e&&jsxRuntime.jsxs("div",{className:"p-12 rounded-lg border-2 border-dashed text-center",style:{borderColor:`${l.primary}30`,borderRadius:`${n}px`},children:[jsxRuntime.jsxs("svg",{className:"w-12 h-12 mx-auto mb-4",fill:"none",stroke:l.primary,viewBox:"0 0 24 24",children:[jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"}),jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 11a3 3 0 11-6 0 3 3 0 016 0z"})]}),jsxRuntime.jsx("p",{style:{color:l.text,opacity:.6},children:"Add your business address to display a map"})]})]})})}function Mn({imageUrl:e,altText:t="",caption:r,maxWidth:a="large",alignment:o="center",aspectRatio:i="auto",borderRadius:n=12,linkUrl:s,openInNewTab:l=true,colors:c,typography:d,enableInlineEditing:u=false,sectionId:p=""}){let g={full:"max-w-full",large:"max-w-6xl",medium:"max-w-4xl",small:"max-w-2xl"},b={auto:null,"16:9":"56.25%","4:3":"75%","1:1":"100%","3:2":"66.67%"},v=o==="center"?"mx-auto":o==="right"?"ml-auto":"mr-auto",w=jsxRuntime.jsxs("div",{className:`${g[a]} ${v}`,children:[jsxRuntime.jsx("div",{className:"relative w-full overflow-hidden",style:{borderRadius:`${n}px`,...b[i]&&{paddingBottom:b[i]}},children:e?jsxRuntime.jsx("img",{src:e,alt:t||"Image",className:i==="auto"?"w-full h-auto":"absolute top-0 left-0 w-full h-full object-cover",style:{borderRadius:`${n}px`}}):jsxRuntime.jsx("div",{className:"flex items-center justify-center bg-gray-100",style:{backgroundColor:`${c.primary}10`,borderRadius:`${n}px`,minHeight:i==="auto"?"300px":void 0},children:jsxRuntime.jsxs("div",{className:"text-center px-4",children:[jsxRuntime.jsx("svg",{className:"w-16 h-16 mx-auto mb-4",fill:"none",stroke:c.primary,viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})}),jsxRuntime.jsx("p",{style:{color:c.text,opacity:.6},children:"Add an image URL to display"})]})})}),r&&e&&jsxRuntime.jsx("p",{className:"mt-3 text-sm text-center",style:{color:c.text,opacity:.7,fontFamily:d?.bodyFont||"inherit"},...u&&{"data-editable":true,"data-section-id":p,"data-field-path":"settings.caption"},children:r})]});return jsxRuntime.jsx("div",{className:a==="full"?"w-full":"container mx-auto px-4",children:s&&e?jsxRuntime.jsx("a",{href:s,target:l?"_blank":"_self",rel:l?"noopener noreferrer":void 0,className:"block",children:w}):w})}function Xa({faq:e,index:t,colors:r,typography:a,enableInlineEditing:o,sectionId:i}){let[n,s]=Ge.useState(false);return jsxRuntime.jsxs("div",{className:"border-b border-opacity-10",style:{borderColor:r.text},children:[jsxRuntime.jsxs("button",{onClick:()=>s(!n),className:"w-full py-4 px-6 flex items-center justify-between text-left hover:bg-opacity-5 transition-colors",style:{backgroundColor:n?`${r.primary}10`:"transparent"},children:[jsxRuntime.jsx("span",{className:"font-semibold text-lg pr-4",style:{color:r.text,fontFamily:a?.headingFont||"inherit"},...o&&{"data-editable":true,"data-section-id":i,"data-field-path":`settings.faqs.${t}.question`},children:e.question||"Add question..."}),jsxRuntime.jsx("svg",{className:"w-5 h-5 flex-shrink-0 transition-transform",style:{color:r.primary,transform:n?"rotate(180deg)":"rotate(0deg)"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),n&&jsxRuntime.jsx("div",{className:"px-6 pb-4 pt-2",style:{color:r.text,opacity:.8,fontFamily:a?.bodyFont||"inherit"},...o&&{"data-editable":true,"data-section-id":i,"data-field-path":`settings.faqs.${t}.answer`},children:e.answer||"Add answer..."})]})}function $n({title:e="Frequently Asked Questions",faqs:t=[],layout:r="accordion",maxWidth:a="large",colors:o,typography:i,enableInlineEditing:n=false,sectionId:s=""}){return jsxRuntime.jsx("div",{className:"container mx-auto px-4",children:jsxRuntime.jsxs("div",{className:`${{full:"max-w-full",large:"max-w-4xl",medium:"max-w-3xl",small:"max-w-2xl"}[a]} mx-auto`,children:[e&&jsxRuntime.jsx("h2",{className:"text-3xl font-bold text-center mb-8",style:{color:o.text,fontFamily:i?.headingFont||"inherit"},...n&&{"data-editable":true,"data-section-id":s,"data-field-path":"settings.title"},children:e}),t.length>0?jsxRuntime.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:`1px solid ${o.text}20`,backgroundColor:`${o.primary}05`},children:t.map((c,d)=>r==="accordion"?jsxRuntime.jsx(Xa,{faq:c,index:d,colors:o,typography:i,enableInlineEditing:n,sectionId:s},d):jsxRuntime.jsxs("div",{className:"border-b border-opacity-10 last:border-b-0 p-6",style:{borderColor:o.text},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-lg mb-2",style:{color:o.text,fontFamily:i?.headingFont||"inherit"},...n&&{"data-editable":true,"data-section-id":s,"data-field-path":`settings.faqs.${d}.question`},children:c.question||"Add question..."}),jsxRuntime.jsx("p",{style:{color:o.text,opacity:.8,fontFamily:i?.bodyFont||"inherit"},...n&&{"data-editable":true,"data-section-id":s,"data-field-path":`settings.faqs.${d}.answer`},children:c.answer||"Add answer..."})]},d))}):jsxRuntime.jsxs("div",{className:"p-12 rounded-lg border-2 border-dashed text-center",style:{borderColor:`${o.primary}30`,backgroundColor:`${o.primary}05`},children:[jsxRuntime.jsx("svg",{className:"w-12 h-12 mx-auto mb-4",fill:"none",stroke:o.primary,viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),jsxRuntime.jsx("p",{style:{color:o.text,opacity:.6},children:"Add FAQ items to get started"})]})]})})}function Bn({brandName:e="Your Brand",logoUrl:t,showLogo:r=true,showBrandName:a=true,links:o=[],ctaText:i,ctaUrl:n,sticky:s=true,transparentOnTop:l=false,colors:c,typography:d,enableInlineEditing:u=false,sectionId:p=""}){let[g,b]=Ge.useState(false),[v,w]=Ge.useState(false),[f,x]=Ge.useState("");Ge.useEffect(()=>{let h=()=>{w(window.scrollY>20);};return window.addEventListener("scroll",h),()=>window.removeEventListener("scroll",h)},[]),Ge.useEffect(()=>{let h=()=>{let k=o.filter(I=>I.url.startsWith("#")).map(I=>document.querySelector(`[data-section-id="${I.url.substring(1)}"]`)).filter(Boolean),S="";k.forEach(I=>{if(I){let R=I.getBoundingClientRect();R.top<=100&&R.bottom>=100&&(S=I.getAttribute("data-section-id")||"");}}),x(S);};return window.addEventListener("scroll",h),()=>window.removeEventListener("scroll",h)},[o]);let y=(h,k)=>{if(k.startsWith("#")){h.preventDefault();let S=k.substring(1),I=document.querySelector(`[data-section-id="${S}"]`);I&&I.scrollIntoView({behavior:"smooth",block:"start"}),b(false);}},N=l&&!v;return jsxRuntime.jsx("nav",{className:`${s?"sticky top-0 z-50":""} ${N?"bg-transparent":s?"bg-white/80 backdrop-blur-md border-b":"bg-white border-b"} transition-all duration-300`,style:{borderColor:N?"transparent":`${c.primary}20`},children:jsxRuntime.jsxs("div",{className:"container mx-auto px-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between h-16 md:h-20",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[r&&t&&jsxRuntime.jsx("img",{src:t,alt:e,className:"h-8 md:h-10 w-auto object-contain"}),a&&jsxRuntime.jsx("h1",{className:"text-xl md:text-2xl font-bold",style:{fontFamily:d?.headingFont||"inherit",color:c.text},...u&&{"data-editable":true,"data-section-id":p,"data-field-path":"settings.brandName"},children:e})]}),jsxRuntime.jsxs("div",{className:"hidden md:flex items-center gap-8",children:[o.map((h,k)=>{let S=h.url.startsWith("#")&&h.url.substring(1)===f;return jsxRuntime.jsxs("a",{href:h.url,onClick:I=>y(I,h.url),className:"relative text-base font-medium transition-colors group",style:{color:S?c.primary:c.text,fontFamily:d?.bodyFont||"inherit"},...h.linkType==="external"&&!h.url.startsWith("#")?{target:"_blank",rel:"noopener noreferrer"}:{},...u&&{"data-editable":true,"data-section-id":p,"data-field-path":`settings.links.${k}.label`},children:[h.label,jsxRuntime.jsx("span",{className:`absolute -bottom-1 left-0 h-0.5 transition-all ${S?"w-full":"w-0 group-hover:w-full"}`,style:{backgroundColor:c.primary}})]},h.id)}),i&&n&&jsxRuntime.jsx("a",{href:n,className:"px-6 py-2.5 rounded-full font-semibold transition-all hover:opacity-90 hover:scale-105",style:{backgroundColor:c.primary,color:c.buttonText||"#FFFFFF",fontFamily:d?.bodyFont||"inherit"},children:i})]}),jsxRuntime.jsx("button",{onClick:()=>b(!g),className:"md:hidden p-2 rounded-lg transition-colors hover:bg-black/5","aria-label":"Toggle menu",children:jsxRuntime.jsx("svg",{className:"w-6 h-6",fill:"none",stroke:c.text,viewBox:"0 0 24 24",children:g?jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"}):jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})})]}),jsxRuntime.jsx("div",{className:`md:hidden overflow-hidden transition-all duration-300 ${g?"max-h-96 pb-4":"max-h-0"}`,children:jsxRuntime.jsxs("div",{className:"flex flex-col space-y-3 pt-4 border-t",style:{borderColor:`${c.primary}20`},children:[o.map((h,k)=>{let S=h.url.startsWith("#")&&h.url.substring(1)===f;return jsxRuntime.jsx("a",{href:h.url,onClick:I=>y(I,h.url),className:"text-base font-medium py-2 px-4 rounded-lg transition-colors",style:{color:S?c.primary:c.text,backgroundColor:S?`${c.primary}10`:"transparent",fontFamily:d?.bodyFont||"inherit"},...h.linkType==="external"&&!h.url.startsWith("#")?{target:"_blank",rel:"noopener noreferrer"}:{},children:h.label},h.id)}),i&&n&&jsxRuntime.jsx("a",{href:n,className:"px-6 py-3 rounded-full font-semibold text-center transition-all hover:opacity-90",style:{backgroundColor:c.primary,color:c.buttonText||"#FFFFFF",fontFamily:d?.bodyFont||"inherit"},children:i})]})})]})})}function zn({title:e,content:t,alignment:r="left",maxWidth:a="medium",textSize:o="medium",backgroundColor:i,textColor:n,paddingY:s="medium",colors:l,typography:c,enableInlineEditing:d=false,sectionId:u=""}){let p={full:"max-w-full",large:"max-w-6xl",medium:"max-w-4xl",small:"max-w-2xl"},g={left:"text-left",center:"text-center",right:"text-right"},b={small:"text-sm",medium:"text-base",large:"text-lg"};return jsxRuntime.jsx("div",{className:{none:"py-0",small:"py-8",medium:"py-16",large:"py-24"}[s],style:{backgroundColor:i||"transparent"},children:jsxRuntime.jsx("div",{className:"container mx-auto px-4",children:jsxRuntime.jsxs("div",{className:`${p[a]} mx-auto ${g[r]}`,children:[e&&jsxRuntime.jsx("h2",{className:"text-3xl md:text-4xl font-bold mb-6",style:{color:n||l.text,fontFamily:c?.headingFont||"inherit"},...d&&{"data-editable":true,"data-section-id":u,"data-field-path":"settings.title"},children:e}),jsxRuntime.jsx("div",{className:`${b[o]} leading-relaxed whitespace-pre-wrap`,style:{color:n||l.text,fontFamily:c?.bodyFont||"inherit"},...d&&{"data-editable":true,"data-section-id":u,"data-field-path":"settings.content"},children:t||"Add your text content here..."})]})})})}function $c(e,t=false){if(t)return .15;switch(e){case "fast":return .2;case "slow":return .5;default:return .3}}function Ja(e=50){return {enter:t=>({x:t==="forward"?e:-e,opacity:0}),center:{x:0,opacity:1},exit:t=>({x:t==="forward"?-e:e,opacity:0})}}function Qa(){return {enter:()=>({opacity:0,scale:.95}),center:{opacity:1,scale:1},exit:()=>({opacity:0,scale:.95})}}function Lc(e,t){return e==="fade"?Qa():Ja(t)}var rr={easing:[.4,0,.2,1],spring:{type:"spring",damping:30,stiffness:300},staggerChildren:{staggerChildren:.05,delayChildren:.1},cardHover:{scale:1.02,transition:{duration:.2}},buttonHover:{scale:1.05,transition:{duration:.2}},fadeIn:{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}},slideUp:{initial:{y:"100%"},animate:{y:0},exit:{y:"100%"}},scaleIn:{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9}},slideInLeft:{initial:{opacity:0,x:-10},animate:{opacity:1,x:0}},slideInRight:{initial:{opacity:0,x:10},animate:{opacity:1,x:0}},backdrop:{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}}};function Bc(){return typeof window>"u"?false:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function zc(e,t=.1,r=.05){return Array.from({length:e},(a,o)=>({initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.3,delay:t+o*r,ease:rr.easing}}))}function ge(e=0,t=.3){return {initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:t,delay:e,ease:rr.easing}}}function On({services:e,categories:t=[],selectedService:r,onServiceSelect:a,settings:o,colors:i}){let[n,s]=Ge.useState(null),[l,c]=Ge.useState(new Set(t.length>0?[t[0].id]:[])),d=o.serviceLayout||"grid",u=o.columns||2,p=o.headerContent?.value||"Choose Your Service",g=o.subheaderContent?.value||"Select the service you'd like to book",b=o.showPricing!==false,v=o.showDuration!==false,w=o.showDescription!==false,f=o.enableCategories===true,x=o.categoryStyle||"dropdown",y=o.policyImages||[],N=o.policyText||null,C=o.imageSpacing||"small",h={none:"0px",small:"8px",medium:"16px",large:"24px"},k=o.imageBorderRadius||"0px",S={1:"grid-cols-1",2:"grid-cols-1 sm:grid-cols-2",3:"grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",4:"grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"}[u]||"grid-cols-2",I=f&&n?e.filter(m=>m.category===n):e,R=(m,F)=>{let M=r===m.id;return jsxRuntime.jsx("button",{onClick:()=>a(m.id),className:`w-full ${F==="grid"?"h-full":""} p-4 rounded-lg border-2 transition-all text-left ${F==="grid"?"flex flex-col":""} ${M?"border-current shadow-lg":"border-gray-200 hover:border-gray-300"}`,style:{borderColor:M?i.primary:void 0,backgroundColor:M?`${i.primary}10`:void 0},children:F==="grid"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("p",{className:"font-semibold mb-1",children:m.name}),w&&jsxRuntime.jsx("p",{className:"text-xs opacity-70 mb-2 flex-1",children:m.description}),jsxRuntime.jsxs("div",{className:"flex justify-between items-center text-sm mt-auto",children:[b&&jsxRuntime.jsxs("span",{className:"font-bold",style:{color:i.primary},children:["$",m.price]}),v&&jsxRuntime.jsxs("span",{className:"opacity-60",children:[m.duration," min"]})]})]}):jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"font-semibold mb-1",children:m.name}),w&&jsxRuntime.jsx("p",{className:"text-sm opacity-70",children:m.description})]}),jsxRuntime.jsxs("div",{className:"text-right ml-4",children:[b&&jsxRuntime.jsxs("p",{className:"font-bold",style:{color:i.primary},children:["$",m.price]}),v&&jsxRuntime.jsxs("p",{className:"text-sm opacity-60",children:[m.duration," min"]})]})]})},m.id)};return jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs(framerMotion.motion.div,{...ge(.05),className:"text-center sm:text-left",children:[jsxRuntime.jsx("h2",{className:"text-xl sm:text-2xl font-bold mb-2",style:{color:i.primary},children:p}),jsxRuntime.jsx("p",{className:"text-sm opacity-70",children:g})]}),y&&y.length>0&&jsxRuntime.jsx("div",{className:"w-full flex flex-col",style:{gap:h[C]},children:y.slice(0,3).map((m,F)=>jsxRuntime.jsx("div",{className:"w-full overflow-hidden",style:{aspectRatio:"720 / 300",borderRadius:k},children:jsxRuntime.jsx("img",{src:m.url,alt:m.alt||`Policy image ${F+1}`,className:"w-full h-full object-cover"})},F))}),(!y||y.length===0)&&N&&jsxRuntime.jsx("div",{className:"w-full p-4 rounded-lg border",style:{backgroundColor:`${i.primary}10`,borderColor:`${i.primary}30`},dangerouslySetInnerHTML:{__html:N}}),f&&t.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[x==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-medium mb-2",children:"Service Category"}),jsxRuntime.jsxs("select",{value:n||"all",onChange:m=>s(m.target.value==="all"?null:m.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:border-transparent transition-all",style:{"--tw-ring-color":i.primary},children:[jsxRuntime.jsx("option",{value:"all",children:"All Services"}),t.map(m=>jsxRuntime.jsx("option",{value:m.id,children:m.name},m.id))]})]}),x==="tabs"&&jsxRuntime.jsxs("div",{className:"flex gap-2 flex-wrap",children:[jsxRuntime.jsx("button",{onClick:()=>s(null),className:`px-4 py-2 rounded-lg transition-all text-sm font-medium ${n===null?"text-white shadow-lg":"border border-gray-300 hover:border-gray-400"}`,style:{backgroundColor:n===null?i.primary:void 0},children:"All Services"}),t.map(m=>jsxRuntime.jsx("button",{onClick:()=>s(m.id),className:`px-4 py-2 rounded-lg transition-all text-sm font-medium ${n===m.id?"text-white shadow-lg":"border border-gray-300 hover:border-gray-400"}`,style:{backgroundColor:n===m.id?i.primary:void 0},children:m.name},m.id))]}),x==="pills"&&jsxRuntime.jsxs("div",{className:"flex gap-2 overflow-x-auto pb-2 scrollbar-hide",children:[jsxRuntime.jsx("button",{onClick:()=>s(null),className:`px-5 py-2 rounded-full transition-all text-sm font-medium whitespace-nowrap ${n===null?"text-white shadow-md":"bg-gray-100 hover:bg-gray-200"}`,style:{backgroundColor:n===null?i.primary:void 0},children:"All"}),t.map(m=>jsxRuntime.jsx("button",{onClick:()=>s(m.id),className:`px-5 py-2 rounded-full transition-all text-sm font-medium whitespace-nowrap ${n===m.id?"text-white shadow-md":"bg-gray-100 hover:bg-gray-200"}`,style:{backgroundColor:n===m.id?i.primary:void 0},children:m.name},m.id))]}),x==="chips"&&jsxRuntime.jsxs("div",{className:"flex gap-2 flex-wrap",children:[jsxRuntime.jsxs("button",{onClick:()=>s(null),className:`px-3 py-1.5 rounded-lg transition-all text-xs font-medium flex items-center gap-1.5 ${n===null?"text-white":"border border-gray-300 bg-white hover:border-gray-400"}`,style:{backgroundColor:n===null?i.primary:void 0,borderColor:n===null?i.primary:void 0},children:[n===null&&jsxRuntime.jsx("span",{className:"text-[10px]",children:"\u2713"}),"All"]}),t.map(m=>jsxRuntime.jsxs("button",{onClick:()=>s(m.id),className:`px-3 py-1.5 rounded-lg transition-all text-xs font-medium flex items-center gap-1.5 ${n===m.id?"text-white":"border border-gray-300 bg-white hover:border-gray-400"}`,style:{backgroundColor:n===m.id?i.primary:void 0,borderColor:n===m.id?i.primary:void 0},children:[n===m.id&&jsxRuntime.jsx("span",{className:"text-[10px]",children:"\u2713"}),m.name]},m.id))]})]}),f&&x==="accordion"?jsxRuntime.jsx("div",{className:"space-y-4",children:t.map(m=>{let F=l.has(m.id),M=e.filter(A=>A.category===m.id);return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{onClick:()=>{let A=new Set(l);F?A.delete(m.id):A.add(m.id),c(A);},className:"w-full flex items-center justify-between py-2 border-b-2 transition-all group",style:{borderColor:F?i.primary:"#e5e7eb"},children:[jsxRuntime.jsx("span",{className:"font-semibold text-left transition-colors",style:{color:F?i.primary:void 0},children:m.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-4 h-4 transition-all ${F?"rotate-180":""}`,style:{color:F?i.primary:"#9ca3af"}})]}),F&&jsxRuntime.jsx("div",{className:`mt-4 ${d==="grid"?`grid ${S} gap-3`:"space-y-3"}`,children:M.map(A=>R(A,d))})]},m.id)})}):d==="grid"?jsxRuntime.jsx("div",{className:`grid ${S} gap-3`,children:I.map(m=>R(m,"grid"))}):jsxRuntime.jsx("div",{className:"space-y-3",children:I.map(m=>R(m,"list"))})]})}function oi(){let e=[],t=new Date;t.setHours(0,0,0,0);for(let r=0;r<3;r++){let a=new Date(t.getFullYear(),t.getMonth()+r,1),o=new Date(a.getFullYear(),a.getMonth()+1,0).getDate();for(let i=1;i<=o;i++){if(new Date(a.getFullYear(),a.getMonth(),i)<t||Math.random()>.6)continue;let s=`${a.getFullYear()}-${String(a.getMonth()+1).padStart(2,"0")}-${String(i).padStart(2,"0")}`;e.push(s);}}return e}var ko={avoid:{bg:"#FEE2E2",text:"#991B1B",label:"Avoid"},caution:{bg:"#FEF3C7",text:"#92400E",label:"Caution"},optimal:{bg:"#D1FAE5",text:"#065F46",label:"Optimal"},neutral:{bg:"#F3F4F6",text:"#4B5563",label:"Neutral"}};function nr({availableDates:e,selectedDate:t,onDateSelect:r,settings:a,colors:o,cyclePhases:i,selectedService:n,addons:s=[],selectedAddons:l=[],onAddonsChange:c,addonPlacement:d="date_selection"}){console.log("[DateSelection] Addon Debug:",{addonsLength:s.length,hasOnAddonsChange:!!c,addonPlacement:d,showAddons:d!=="separate_step"&&s.length>0&&!!c,addons:s,selectedService:n});let u=a.calendarView||"month",p=a.headerContent?.value||"Select a Date",g=!e||e.length===0,b=Ge.useMemo(()=>g?oi():e,[g,e]),v=Ge.useMemo(()=>{let D=new Date;if(D.setHours(0,0,0,0),b.length>0){let T=b.find(P=>new Date(P)>=D);if(T){let P=new Date(T);return `${P.getFullYear()}-${String(P.getMonth()+1).padStart(2,"0")}`}}return `${D.getFullYear()}-${String(D.getMonth()+1).padStart(2,"0")}`},[b]),[w,f]=Ge.useState(v),x=Ge.useMemo(()=>new Set(b),[b]),[y,N]=w.split("-").map(Number),h=["January","February","March","April","May","June","July","August","September","October","November","December"][N-1],k=Ge.useMemo(()=>{let D=new Date(y,N-1,1),T=new Date(y,N,0),P=D.getDay(),z=T.getDate(),K=[];for(let Y=0;Y<P;Y++)K.push(null);for(let Y=1;Y<=z;Y++){let Te=`${y}-${String(N).padStart(2,"0")}-${String(Y).padStart(2,"0")}`,U=new Date(Te),ie=new Date;ie.setHours(0,0,0,0),K.push({day:Y,dateStr:Te,isAvailable:x.has(Te)&&U>=ie});}return K},[y,N,x]),S=Ge.useMemo(()=>{let D=new Date(y,N-2,1),T=`${D.getFullYear()}-${String(D.getMonth()+1).padStart(2,"0")}`;return b.some(P=>P.startsWith(T))},[b,y,N]),I=Ge.useMemo(()=>{let D=new Date(y,N,1),T=`${D.getFullYear()}-${String(D.getMonth()+1).padStart(2,"0")}`;return b.some(P=>P.startsWith(T))},[b,y,N]),R=()=>{if(!S)return;let D=new Date(y,N-2,1);f(`${D.getFullYear()}-${String(D.getMonth()+1).padStart(2,"0")}`);},m=()=>{if(!I)return;let D=new Date(y,N,1);f(`${D.getFullYear()}-${String(D.getMonth()+1).padStart(2,"0")}`);},F=i&&Object.keys(i).length>0,M=()=>{let D=n?.price||0;return l.length>0&&s.length>0&&l.forEach(T=>{let P=s.find(z=>z.id===T);P&&(D+=P.addonPrice||P.price||0);}),D},A=D=>{if(!c)return;let T=l.includes(D);c(T?l.filter(P=>P!==D):[...l,D]);};return jsxRuntime.jsxs("div",{className:"space-y-6",children:[n&&jsxRuntime.jsx(framerMotion.motion.div,{...ge(.05),className:"bg-gradient-to-br from-white to-gray-50/30 rounded-xl border border-gray-200/80 p-6 shadow-sm hover:shadow-md transition-shadow",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-4",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-3",children:jsxRuntime.jsx("h3",{className:"text-sm font-semibold tracking-wide uppercase",style:{color:o.primary},children:"Your Selection"})}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("p",{className:"font-bold text-lg text-gray-900",children:n.name}),n.description&&jsxRuntime.jsx("p",{className:"text-sm text-gray-600 leading-relaxed",children:n.description}),n.duration&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-gray-500",children:[jsxRuntime.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),jsxRuntime.jsxs("span",{children:[n.duration," minutes"]})]})]})]}),jsxRuntime.jsxs("div",{className:"text-right",children:[jsxRuntime.jsx("div",{className:"text-xs text-gray-500 mb-1 font-medium",children:"Price"}),jsxRuntime.jsxs("div",{className:"text-2xl font-bold",style:{color:o.primary},children:["$",n.price]})]})]})}),d!=="separate_step"&&s.length>0&&c&&jsxRuntime.jsxs(framerMotion.motion.div,{...ge(.1),className:"bg-white rounded-xl border border-gray-200/80 p-6 shadow-sm hover:shadow-md transition-shadow",children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-4",children:jsxRuntime.jsx("h3",{className:"text-sm font-semibold tracking-wide uppercase",style:{color:o.primary},children:"Enhance Your Experience"})}),jsxRuntime.jsx("div",{className:"space-y-3",children:s.map(D=>{let T=l.includes(D.id),P=D.addonPrice||D.price||0;return jsxRuntime.jsxs("label",{className:"flex items-start gap-4 p-4 rounded-xl border-2 cursor-pointer transition-all group",style:{borderColor:T?o.primary:"#E5E7EB",backgroundColor:T?`${o.primary}08`:"transparent",boxShadow:T?`0 0 0 3px ${o.primary}15`:"none"},children:[jsxRuntime.jsx("div",{className:"flex items-center pt-0.5",children:jsxRuntime.jsx("input",{type:"checkbox",checked:T,onChange:()=>A(D.id),className:"w-5 h-5 rounded border-2 border-gray-300 cursor-pointer",style:{accentColor:o.primary}})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-3 mb-1",children:[jsxRuntime.jsx("span",{className:"font-semibold text-base text-gray-900 group-hover:text-gray-700 transition-colors",children:D.name}),jsxRuntime.jsxs("span",{className:"text-base font-bold whitespace-nowrap flex-shrink-0",style:{color:o.primary},children:["+$",P]})]}),D.description&&jsxRuntime.jsx("p",{className:"text-sm text-gray-600 leading-relaxed",children:D.description})]})]},D.id)})}),l.length>0&&jsxRuntime.jsx("div",{className:"mt-6 pt-5 border-t-2 border-gray-100",children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-xs text-gray-500 mb-1 font-medium uppercase tracking-wide",children:"New Total"}),jsxRuntime.jsxs("div",{className:"text-sm text-gray-600",children:["Service + ",l.length," add-on",l.length>1?"s":""]})]}),jsxRuntime.jsxs("div",{className:"text-3xl font-bold",style:{color:o.primary},children:["$",M()]})]})})]}),jsxRuntime.jsx(framerMotion.motion.h2,{...ge(.15),className:"text-xl sm:text-2xl font-bold text-center sm:text-left",style:{color:o.primary},children:p}),F&&jsxRuntime.jsx(framerMotion.motion.div,{...ge(.1),className:"bg-white rounded-lg border border-gray-200 px-4 py-3",children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2 text-xs",children:[jsxRuntime.jsx("span",{className:"font-medium flex items-center",style:{color:o.primary},children:"Cycle Calendar:"}),jsxRuntime.jsx("div",{className:"flex items-center gap-3",children:Object.entries(ko).map(([D,T])=>jsxRuntime.jsxs("div",{className:"flex items-center space-x-1.5",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded border border-gray-300",style:{backgroundColor:T.bg}}),jsxRuntime.jsx("span",{children:T.label})]},D))})]})}),u==="month"?jsxRuntime.jsxs("div",{className:"border border-gray-200 rounded-lg p-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("button",{className:`p-2 rounded transition-colors ${S?"hover:bg-gray-100":"opacity-30 cursor-not-allowed"}`,onClick:R,disabled:!S,children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4"})}),jsxRuntime.jsxs("p",{className:"font-semibold",children:[h," ",y]}),jsxRuntime.jsx("button",{className:`p-2 rounded transition-colors ${I?"hover:bg-gray-100":"opacity-30 cursor-not-allowed"}`,onClick:m,disabled:!I,children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-7 gap-2",children:[["Su","Mo","Tu","We","Th","Fr","Sa"].map(D=>jsxRuntime.jsx("div",{className:"text-center text-xs font-medium py-2 opacity-60",children:D},D)),k.map((D,T)=>{if(!D)return jsxRuntime.jsx("div",{},`empty-${T}`);let{day:P,dateStr:z,isAvailable:K}=D,Y=t===z,Te=i?.[z],U=Te?ko[Te]:null;return jsxRuntime.jsx("button",{onClick:()=>K&&r(z),disabled:!K,className:`aspect-square rounded-lg text-sm transition-all ${Y?"text-white shadow-lg font-semibold":K?"hover:scale-105 cursor-pointer":"bg-gray-50 text-gray-300 cursor-not-allowed opacity-40"}`,style:{backgroundColor:Y?o.primary:U?.bg||void 0,color:Y?"white":U?.text||void 0},children:P},z)})]})]}):jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-3",children:b.slice(0,5).map(D=>{let T=new Date(D),P=T.getDate(),K=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][T.getDay()],Y=t===D;return jsxRuntime.jsxs("button",{onClick:()=>r(D),className:`p-4 rounded-lg border-2 transition-all text-center ${Y?"border-current text-white":"border-gray-200 hover:border-gray-300"}`,style:{borderColor:Y?o.primary:void 0,backgroundColor:Y?o.primary:void 0},children:[jsxRuntime.jsx("p",{className:"text-xs mb-1 opacity-75",children:K}),jsxRuntime.jsx("p",{className:"text-2xl font-semibold",children:P})]},D)})})]})}function Hn({availableTimes:e,selectedTime:t,onTimeSelect:r,settings:a,serviceDuration:o,colors:i,selectedService:n,selectedDate:s,selectedAddons:l=[],addons:c=[]}){let d=a.timeFormat||"12h",u=a.showDuration!==false,p=a.headerContent?.value||"Pick a Time",g=a.columns||3,b=()=>{let x=n?.price||0;return l.length>0&&c.length>0&&l.forEach(y=>{let N=c.find(C=>C.id===y);N&&(x+=N.addonPrice||N.price||0);}),x},v=x=>new Date(x+"T00:00:00").toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"}),w=x=>{let y=x.trim().split(" "),[N,C]=y[0].split(":"),h=parseInt(N),k=C||"00";if(y.length>1){let S=y[1];return d==="24h"?(S==="PM"&&h!==12?h+=12:S==="AM"&&h===12&&(h=0),`${String(h).padStart(2,"0")}:${k}`):x}if(d==="12h"){let S=h>=12?"PM":"AM";return `${h===0?12:h>12?h-12:h}:${k} ${S}`}return `${String(h).padStart(2,"0")}:${k}`},f={2:"grid-cols-2",3:"grid-cols-2 sm:grid-cols-3",4:"grid-cols-2 sm:grid-cols-3 lg:grid-cols-4"}[g]||"grid-cols-3";return jsxRuntime.jsxs("div",{className:"space-y-6",children:[n&&s&&jsxRuntime.jsxs(framerMotion.motion.div,{...ge(.05),className:"bg-gradient-to-br from-white to-gray-50/30 rounded-xl border border-gray-200/80 p-6 shadow-sm hover:shadow-md transition-shadow",children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-4",children:jsxRuntime.jsx("h3",{className:"text-sm font-semibold tracking-wide uppercase",style:{color:i.primary},children:"Your Booking"})}),jsxRuntime.jsxs("div",{className:"mb-3",children:[jsxRuntime.jsx("p",{className:"font-bold text-lg text-gray-900",children:n.name}),n.duration&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-gray-500 mt-1",children:[jsxRuntime.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),jsxRuntime.jsxs("span",{children:[n.duration," minutes"]})]})]}),l.length>0&&c.length>0&&jsxRuntime.jsxs("div",{className:"mb-4",children:[jsxRuntime.jsx("p",{className:"text-sm font-bold text-gray-900 mb-2",children:"Add-ons"}),jsxRuntime.jsx("div",{className:"space-y-2",children:l.map(x=>{let y=c.find(N=>N.id===x);return y?jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm text-gray-700 font-medium",children:y.name}),jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-gray-900",children:["$",y.addonPrice||y.price||0]})]},x):null})})]}),jsxRuntime.jsx("div",{className:"border-t border-gray-200 -mx-6 mb-4"}),jsxRuntime.jsx("div",{className:"bg-gray-50/50 -mx-6 px-6 py-4 mb-4",children:jsxRuntime.jsx("div",{className:"flex items-center justify-between",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("svg",{className:"w-5 h-5",style:{color:i.primary},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),jsxRuntime.jsx("span",{className:"font-bold text-base text-gray-900",children:v(s)})]})})}),jsxRuntime.jsx("div",{className:"border-t border-gray-200 -mx-6 mb-4"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-base font-bold text-gray-900",children:"Total"}),jsxRuntime.jsxs("span",{className:"text-2xl font-bold",style:{color:i.primary},children:["$",b()]})]})]}),jsxRuntime.jsx(framerMotion.motion.h2,{...ge(n&&s?.15:.05),className:"text-xl sm:text-2xl font-bold text-center sm:text-left",style:{color:i.primary},children:p}),jsxRuntime.jsx(framerMotion.motion.div,{className:`grid ${f} gap-3`,initial:{opacity:0},animate:{opacity:1},transition:{duration:.3,delay:n&&s?.2:.1},children:e.map((x,y)=>{let N=t===x;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>r(x),className:`p-3 rounded-lg border-2 transition-all text-center hover:scale-105 ${N?"border-current text-white shadow-lg":"border-gray-200 hover:border-gray-300"}`,style:{borderColor:N?i.primary:void 0,backgroundColor:N?i.primary:void 0},initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{duration:.2,delay:.15+y*.03,ease:"easeOut"},children:[jsxRuntime.jsx("p",{className:"font-medium",children:w(x)}),u&&o&&jsxRuntime.jsxs("p",{className:"text-xs mt-1 opacity-75",children:[o," min"]})]},x)})})]})}function Wn({addons:e,selectedAddons:t,onAddonsChange:r,settings:a,colors:o}){let i=a.headerContent?.value||"Add Extras",n=a.subheaderContent?.value||"Enhance your experience with these optional add-ons",s=a.showPricing!==false,l=a.showDuration!==false,c=d=>{let u=t.includes(d)?t.filter(p=>p!==d):[...t,d];r(u);};return jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs(framerMotion.motion.div,{...ge(.05),className:"text-center sm:text-left",children:[jsxRuntime.jsx("h2",{className:"text-xl sm:text-2xl font-bold mb-2",style:{color:o.primary},children:i}),jsxRuntime.jsx("p",{className:"text-sm opacity-70",children:n})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:e.map((d,u)=>{let p=t.includes(d.id);return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>c(d.id),className:`p-4 rounded-lg border-2 transition-all text-left relative ${p?"border-current shadow-lg":"border-gray-200 hover:border-gray-300"}`,style:{borderColor:p?o.primary:void 0,backgroundColor:p?`${o.primary}10`:void 0},initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.3,delay:.1+u*.05},children:[p&&jsxRuntime.jsx("div",{className:"absolute top-3 right-3 w-6 h-6 rounded-full flex items-center justify-center text-white text-sm",style:{backgroundColor:o.primary},children:"\u2713"}),jsxRuntime.jsx("p",{className:"font-semibold mb-1 pr-8",children:d.name}),jsxRuntime.jsx("p",{className:"text-xs opacity-70 mb-3",children:d.description}),jsxRuntime.jsxs("div",{className:"flex justify-between items-center text-sm",children:[s&&jsxRuntime.jsxs("span",{className:"font-bold",style:{color:o.primary},children:["+$",d.price]}),l&&jsxRuntime.jsxs("span",{className:"opacity-60",children:["+",d.duration," min"]})]})]},d.id)})}),t.length>0&&jsxRuntime.jsxs(framerMotion.motion.div,{className:"bg-gray-50 rounded-lg p-4 mt-4",initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},children:[jsxRuntime.jsx("p",{className:"text-sm font-medium mb-2",children:"Selected Add-ons:"}),jsxRuntime.jsx("div",{className:"space-y-1",children:t.map(d=>{let u=e.find(p=>p.id===d);return u?jsxRuntime.jsxs("div",{className:"flex justify-between text-sm",children:[jsxRuntime.jsx("span",{children:u.name}),jsxRuntime.jsxs("span",{className:"font-medium",style:{color:o.primary},children:["+$",u.price]})]},d):null})})]})]})}function jn({isOpen:e,onClose:t,title:r,children:a,isRequired:o=false,maxHeight:i="80vh"}){return Ge.useEffect(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset";}),[e]),Ge.useEffect(()=>{if(!o&&e){let n=s=>{s.key==="Escape"&&t();};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)}},[e,o,t]),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{...rr.backdrop,onClick:o?void 0:t,className:"fixed inset-0 bg-black/50 z-50",style:{backdropFilter:"blur(4px)"}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{y:"100%"},animate:{y:0},exit:{y:"100%"},transition:rr.spring,className:"fixed bottom-0 left-0 right-0 bg-white rounded-t-2xl shadow-2xl z-50",style:{maxHeight:i},children:[jsxRuntime.jsx("div",{className:"flex justify-center pt-3 pb-2",children:jsxRuntime.jsx("div",{className:"w-12 h-1 bg-gray-300 rounded-full"})}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-6 pb-4 border-b border-gray-200",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[r&&jsxRuntime.jsx("h3",{className:"text-lg font-semibold",children:r}),o&&jsxRuntime.jsx("span",{className:"text-xs font-medium px-2 py-0.5 bg-amber-100 text-amber-800 rounded",children:"Required"})]}),!o&&jsxRuntime.jsx("button",{onClick:t,className:"p-2 hover:bg-gray-100 rounded-lg transition-colors","aria-label":"Close",children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("div",{className:"overflow-y-auto",style:{maxHeight:`calc(${i} - 120px)`},children:jsxRuntime.jsx("div",{className:"px-6 py-6",children:a})})]})]})})}function Vn({contactInfo:e,onContactInfoChange:t,settings:r,optInModules:a=[],onOptInData:o,colors:i,isPreview:n=false}){let[s,l]=Ge.useState(false),[c,d]=Ge.useState(null),[u,p]=Ge.useState(()=>{let m={};return a.forEach(F=>{F.defaultChecked&&(m[F.id]=true);}),m}),[g,b]=Ge.useState({}),[v,w]=Ge.useState({}),f=Ge.useRef(false);Ge.useEffect(()=>{f.current||(f.current=true,a.forEach(m=>{m.defaultChecked&&m.renderCustomForm&&o&&m.renderCustomForm(()=>{},F=>o(m.id,F),i);}));},[]);let x=r.headerContent?.value||"Your Information",y=m=>m?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(m)?null:"Please enter a valid email address":"Email is required",N=m=>m?m.replace(/\D/g,"").length<10?"Please enter a valid phone number":null:"Phone number is required",C=m=>!m||m.trim().length===0?"Name is required":m.trim().length<2?"Name must be at least 2 characters":null,h=(m,F)=>{switch(m){case "email":return y(F);case "phone":return N(F);case "name":return C(F);default:return null}},k=[{label:"Name *",type:"text",placeholder:"Your full name",field:"name"},{label:"Email *",type:"email",placeholder:"your@email.com",field:"email"},{label:"Phone *",type:"tel",placeholder:"(555) 123-4567",field:"phone"},{label:"Notes (optional)",type:"textarea",placeholder:"Any special requests or notes...",field:"notes"}],S=(m,F)=>{if(t({...e,[m]:F}),!n&&v[m]){let M=h(m,F);b(A=>({...A,[m]:M||""}));}},I=m=>{if(n)return;w(A=>({...A,[m]:true}));let F=e[m]||"",M=h(m,F);b(A=>({...A,[m]:M||""}));},R=(m,F)=>{if(p(M=>({...M,[m.id]:F})),F){if(m.renderCustomForm){let M=false;if(m.renderCustomForm(()=>{},D=>{o&&o(m.id,D),M=true;},i)===null&&M)return}d(m),l(true);}else o&&o(m.id,null);};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsx(framerMotion.motion.h2,{...ge(.05),className:"text-xl sm:text-2xl font-bold text-center sm:text-left",style:{color:i.primary},children:x}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[k.map((m,F)=>jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{duration:.3,delay:.1+F*.05,ease:"easeOut"},children:[jsxRuntime.jsx("label",{className:"block text-sm font-medium mb-1",children:m.label}),m.type==="textarea"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("textarea",{className:`w-full px-3 py-2 border rounded-lg focus:ring-2 focus:border-transparent resize-none transition-all ${!n&&g[m.field]&&v[m.field]?"border-red-500":"border-gray-300"}`,style:{"--tw-ring-color":i.primary},rows:3,placeholder:m.placeholder,value:e[m.field]||"",onChange:M=>S(m.field,M.target.value),onBlur:()=>I(m.field)}),!n&&g[m.field]&&v[m.field]&&jsxRuntime.jsx("p",{className:"text-red-500 text-xs mt-1",children:g[m.field]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("input",{type:m.type,className:`w-full px-3 py-2 border rounded-lg focus:ring-2 focus:border-transparent transition-all ${!n&&g[m.field]&&v[m.field]?"border-red-500":"border-gray-300"}`,style:{"--tw-ring-color":i.primary},placeholder:m.placeholder,value:e[m.field]||"",onChange:M=>S(m.field,M.target.value),onBlur:()=>I(m.field)}),!n&&g[m.field]&&v[m.field]&&jsxRuntime.jsx("p",{className:"text-red-500 text-xs mt-1",children:g[m.field]})]})]},m.label)),a.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{className:"pt-3 border-t border-gray-200 space-y-3",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.3,delay:.3},children:a.map(m=>jsxRuntime.jsxs("label",{className:"flex items-start gap-3 cursor-pointer group",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:u[m.id]||false,onChange:F=>R(m,F.target.checked),className:"mt-1 w-4 h-4 rounded border-gray-300",style:{accentColor:i.primary}}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("span",{className:"text-sm font-medium",children:[m.label,m.required&&jsxRuntime.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),m.description&&jsxRuntime.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:m.description})]})]},m.id))})]})]}),c&&jsxRuntime.jsx(jn,{isOpen:s,onClose:()=>l(false),title:c.formTitle||"Additional Information",isRequired:c.required,children:c.renderCustomForm?c.renderCustomForm(()=>l(false),m=>{o&&o(c.id,m);},i):jsxRuntime.jsxs("div",{className:"space-y-4",children:[c.formFields?.map(m=>jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-1",children:[m.label,m.required&&jsxRuntime.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),m.type==="textarea"?jsxRuntime.jsx("textarea",{className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:border-transparent resize-none",style:{"--tw-ring-color":i.primary},rows:3,placeholder:m.placeholder}):m.type==="select"&&m.options?jsxRuntime.jsx("select",{className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:border-transparent",style:{"--tw-ring-color":i.primary},children:m.options.map(F=>jsxRuntime.jsx("option",{value:F.value,children:F.label},F.value))}):jsxRuntime.jsx("input",{type:m.type,className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:border-transparent",style:{"--tw-ring-color":i.primary},placeholder:m.placeholder})]},m.id)),jsxRuntime.jsx("button",{onClick:()=>{o&&c&&o(c.id,{}),l(false);},className:"w-full py-3 rounded-lg text-white font-medium transition-all hover:opacity-90",style:{backgroundColor:i.primary},children:"Save & Continue"})]})})]})}function Yn({service:e,addons:t=[],selectedDate:r,selectedTime:a,paymentProvider:o,paymentConfig:i,onConfirm:n,colors:s,isPreview:l=false}){let c=e?.price||0,d=t.reduce((y,N)=>y+(N.addonPrice||N.price||0),0),u=c+d,p=e?.duration||0,g=t.reduce((y,N)=>y+(N.duration||0),0),b=p+g,v=i.depositPercentage||20,w=(u*(v/100)).toFixed(2),f=u.toFixed(2),x=(parseFloat(f)-parseFloat(w)).toFixed(2);return jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsx(framerMotion.motion.h2,{...ge(.05),className:"text-xl font-bold text-center",style:{color:s.primary},children:"Confirm & Pay"}),jsxRuntime.jsx(framerMotion.motion.div,{className:"bg-gray-50 rounded-lg p-4",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.3,delay:.1},children:jsxRuntime.jsxs("div",{className:"space-y-2",children:[e&&jsxRuntime.jsxs("div",{className:"flex justify-between items-center text-sm",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"font-medium",children:e.name}),jsxRuntime.jsxs("p",{className:"text-xs opacity-70",children:[b," min total"]})]}),jsxRuntime.jsxs("span",{className:"font-bold",style:{color:s.primary},children:["$",c]})]}),t.length>0&&jsxRuntime.jsx("div",{className:"space-y-1 text-xs",children:t.map(y=>jsxRuntime.jsxs("div",{className:"flex justify-between opacity-70",children:[jsxRuntime.jsxs("span",{children:["+ ",y.name]}),jsxRuntime.jsxs("span",{children:["+$",y.addonPrice||y.price||0]})]},y.id))}),r&&jsxRuntime.jsxs("div",{className:"flex justify-between items-center text-sm pt-2 border-t border-gray-200",children:[jsxRuntime.jsx("span",{className:"opacity-70",children:new Date(r+"T00:00:00").toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})}),jsxRuntime.jsx("span",{children:a})]}),jsxRuntime.jsxs("div",{className:"pt-2 mt-2 border-t border-gray-200 flex justify-between items-center",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Due Today"}),jsxRuntime.jsxs("span",{className:"text-lg font-bold",style:{color:s.primary},children:["$",w]})]})]})}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.3,delay:.2},children:l?jsxRuntime.jsxs("div",{className:"border border-gray-200 rounded-lg p-4 bg-white",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("div",{className:"h-10 bg-gray-50 border border-gray-200 rounded flex items-center px-3",children:jsxRuntime.jsx("span",{className:"text-xs text-gray-400",children:"Card Number"})}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxRuntime.jsx("div",{className:"h-10 bg-gray-50 border border-gray-200 rounded flex items-center px-3",children:jsxRuntime.jsx("span",{className:"text-xs text-gray-400",children:"MM/YY"})}),jsxRuntime.jsx("div",{className:"h-10 bg-gray-50 border border-gray-200 rounded flex items-center px-3",children:jsxRuntime.jsx("span",{className:"text-xs text-gray-400",children:"CVV"})})]})]}),jsxRuntime.jsxs("div",{className:"mt-3 flex items-center justify-center gap-1",children:[jsxRuntime.jsx("svg",{className:"w-3 h-3 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})}),jsxRuntime.jsxs("span",{className:"text-xs text-gray-400",children:["Powered by ",o==="square"?"Square":"Stripe"]})]})]}):jsxRuntime.jsx("div",{className:"border border-gray-200 rounded-lg p-4 bg-white",children:jsxRuntime.jsxs("div",{className:"text-center py-8 text-sm text-gray-500",children:[jsxRuntime.jsxs("div",{className:"animate-pulse",children:["Initializing ",o==="square"?"Square":"Stripe"," payment..."]}),jsxRuntime.jsx("div",{className:"mt-4 text-xs text-gray-400",children:"Please wait while we securely load the payment form"})]})})}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.3,delay:.3},children:jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",className:"mt-0.5 w-4 h-4 rounded border-gray-300",style:{accentColor:s.primary}}),jsxRuntime.jsxs("span",{className:"text-xs",children:["I agree to the ",jsxRuntime.jsx("a",{href:"#",className:"underline",style:{color:s.primary},children:"cancellation policy"})," and understand the $",x," balance is due at appointment."]})]}),jsxRuntime.jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",className:"mt-0.5 w-4 h-4 rounded border-gray-300",style:{accentColor:s.primary}}),jsxRuntime.jsxs("span",{className:"text-xs",children:["I agree to the ",jsxRuntime.jsx("a",{href:"#",className:"underline",style:{color:s.primary},children:"terms of service"}),"."]})]})]})})]})}var Io={avoid:{phase:"avoid",color:"#EF4444",bgColor:"#FEF2F2",label:"Avoid",icon:"\u{1F534}",description:"Period - avoid waxing"},caution:{phase:"caution",color:"#F59E0B",bgColor:"#FFFBEB",label:"Caution",icon:"\u{1F7E1}",description:"End of period - proceed with caution"},optimal:{phase:"optimal",color:"#10B981",bgColor:"#F0FDF4",label:"Optimal",icon:"\u{1F7E2}",description:"Best time for waxing"},neutral:{phase:"neutral",color:"#6B7280",bgColor:"#F9FAFB",label:"Neutral",icon:"\u26AA",description:"Okay but not optimal"},unknown:{phase:"unknown",color:"#9CA3AF",bgColor:"#F3F4F6",label:"Unknown",icon:"\u2753",description:"No cycle data available"}};function pi({availableDates:e,selectedDate:t,onDateSelect:r,settings:a,colors:o,fetchCycleData:i,selectedClient:n,onCycleWarning:s,cycleAwareEnabled:l}){let[c,d]=Ge.useState({}),[u,p]=Ge.useState(false),[g,b]=Ge.useState(null),v=Ge.useMemo(()=>l!==void 0?l:!!(n?.cycle_opt_in&&i),[l,n?.cycle_opt_in,i]);Ge.useEffect(()=>{if(!v||!i||!n){d({});return}e.length!==0&&(p(true),b(null),i(n,e).then(f=>{d(f);}).catch(f=>{console.error("[CycleAwareDateSelection] Error fetching cycle data:",f),b(f.message||"Failed to load cycle data"),d({});}).finally(()=>{p(false);}));},[v,i,n,e]);let w=Ge.useCallback(f=>{let x=c[f];x?.phase==="avoid"&&s&&s(x,f),r(f,x);},[c,r,s]);return jsxRuntime.jsxs("div",{className:"cycle-aware-date-selection space-y-4",children:[v&&Object.keys(c).length>0&&jsxRuntime.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:[jsxRuntime.jsxs("h4",{className:"font-medium mb-3 flex items-center",style:{color:o.primary},children:[jsxRuntime.jsx("span",{className:"mr-2",children:"\u{1F4C5}"}),"Your Cycle Calendar"]}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-3 text-sm",children:Object.entries(Io).map(([f,x])=>f!=="unknown"&&jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full border border-gray-300",style:{backgroundColor:x.color}}),jsxRuntime.jsx("span",{children:x.label})]},f))}),jsxRuntime.jsx("p",{className:"text-xs opacity-70 mt-2",children:"Green dates are optimal for comfortable waxing appointments"})]}),v&&u&&jsxRuntime.jsx("div",{className:"text-center py-2 text-sm opacity-70",children:"Loading cycle predictions..."}),v&&g&&jsxRuntime.jsx("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-3",children:jsxRuntime.jsxs("p",{className:"text-yellow-800 text-sm",children:["Unable to load cycle predictions: ",g]})}),jsxRuntime.jsx(nr,{availableDates:e,selectedDate:t,onDateSelect:w,settings:a,colors:o}),v&&t&&c[t]?.phase==="avoid"&&jsxRuntime.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4",children:jsxRuntime.jsxs("div",{className:"flex items-start space-x-3",children:[jsxRuntime.jsx("span",{className:"text-red-500 text-xl",children:"\u26A0\uFE0F"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h4",{className:"font-medium text-red-800 mb-1",children:"This date falls during your predicted period"}),jsxRuntime.jsx("p",{className:"text-red-700 text-sm mb-3",children:"Waxing during this time may be more uncomfortable than usual. Would you like to see better alternatives?"}),jsxRuntime.jsxs("div",{className:"flex space-x-2",children:[jsxRuntime.jsx("button",{className:"px-3 py-1 bg-red-100 text-red-700 rounded text-sm hover:bg-red-200 transition-colors",onClick:()=>{let f=e.filter(x=>c[x]?.phase==="optimal");f.length>0&&w(f[0]);},children:"Show optimal dates"}),jsxRuntime.jsx("button",{className:"px-3 py-1 text-red-600 text-sm hover:underline",children:"Continue anyway"})]})]})]})})]})}var gi={enabled:true,duration:6e5,warningThreshold:12e4,maxExtensions:2,extensionDuration:3e5,showActions:true,showWarning:true};function Tr({holdStatus:e,config:t,colors:r,onExtend:a,onRelease:o,onWarning:i,onExpired:n,className:s=""}){let[l,c]=Ge.useState(Date.now()),[d,u]=Ge.useState(false),[p,g]=Ge.useState(false),[b,v]=Ge.useState(false),w={...gi,...t};Ge.useEffect(()=>{if(!e)return;let F=setInterval(()=>{c(Date.now());},1e3);return ()=>clearInterval(F)},[e]);let f=e?Math.max(0,e.expiresAt-l):0,x=f===0&&e!==null,y=f<=w.warningThreshold&&f>0;Ge.useEffect(()=>{y&&!d&&i&&e&&(u(true),i(f));},[y,d,i,e,f]),Ge.useEffect(()=>{x&&e&&n&&n();},[x,e,n]),Ge.useEffect(()=>{u(false);},[e?.holdKey]);let N=Ge.useCallback(async()=>{if(!(!a||!e||p))try{g(!0),await a(),u(!1);}catch(F){console.error("[HoldTimer] Failed to extend hold:",F);}finally{g(false);}},[a,e,p]),C=Ge.useCallback(async()=>{if(!(!o||!e||b))try{v(!0),await o();}catch(F){console.error("[HoldTimer] Failed to release hold:",F);}finally{v(false);}},[o,e,b]);if(!e||!w.enabled)return null;let h=Math.floor(f/6e4),k=Math.floor(f%6e4/1e3),S=`${h}:${k.toString().padStart(2,"0")}`,I="rgba(139, 92, 246, 0.1)",R="rgba(139, 92, 246, 0.3)",m=r.primary;return x?(I="rgba(239, 68, 68, 0.1)",R="rgba(239, 68, 68, 0.3)",m="#EF4444"):y&&w.showWarning&&(I=`${r.secondary}1A`,R=`${r.secondary}4D`,m=r.secondary),jsxRuntime.jsx("div",{className:`rounded-lg p-4 text-center ${s}`,style:{backgroundColor:I,borderWidth:"1px",borderStyle:"solid",borderColor:R},children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center",children:[jsxRuntime.jsx("div",{className:"flex flex-col items-center gap-2 mb-4",children:x?jsxRuntime.jsxs("div",{style:{color:m},className:"font-medium text-base",children:[jsxRuntime.jsx("span",{children:"Time expired - "}),jsxRuntime.jsx("button",{onClick:C,disabled:b,className:"underline hover:no-underline focus:outline-none focus:ring-2 focus:ring-offset-2 inline disabled:opacity-50",style:{color:m},children:b?"Releasing...":"select a new time"})]}):jsxRuntime.jsxs("div",{style:{color:m},className:"font-medium text-base",children:["Your time slot is reserved for ",S]})}),w.showActions&&!x&&jsxRuntime.jsxs("div",{className:"flex justify-center gap-2",children:[a&&e.canExtend&&jsxRuntime.jsxs("button",{onClick:N,disabled:!e.canExtend||p,className:"px-4 py-2 text-sm font-medium rounded transition-all active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed text-white",style:{backgroundColor:r.primary},"aria-label":`Extend hold (${e.maxExtensions-e.extensions} extensions remaining)`,children:[p?"Extending...":"Extend",!p&&e.maxExtensions-e.extensions>0&&jsxRuntime.jsxs("span",{className:"ml-1",children:["(",e.maxExtensions-e.extensions,")"]})]}),o&&jsxRuntime.jsx("button",{onClick:C,disabled:b,className:"px-4 py-2 text-sm font-medium rounded border transition-all active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed",style:{borderColor:"rgba(255, 255, 255, 0.2)",color:r.text||"#000000"},"aria-label":"Release hold and return to time selection",children:b?"Releasing...":"Release"})]}),!x&&!e.canExtend&&e.extensions>=e.maxExtensions&&jsxRuntime.jsx("div",{className:"mt-3 pt-3 border-t border-white/10 text-center",children:jsxRuntime.jsxs("div",{className:"text-sm",style:{color:r.secondary},children:["Maximum extensions reached - complete booking now or"," ",jsxRuntime.jsx("button",{onClick:C,disabled:b,className:"hover:underline focus:outline-none focus:underline disabled:opacity-50",style:{color:r.primary},children:b?"releasing...":"select a different time"})]})})]})})}function Ro({config:e,colors:t,services:r=[],categories:a=[],dates:o=[],times:i=[],addons:n=[],paymentProvider:s,paymentConfig:l,isPreview:c=false,onComplete:d,onStepChange:u,onServiceSelect:p,onDateSelect:g,onContactInfoChange:b,validateStep:v,holdTimer:w,stepOrder:f,optInModules:x=[],onOptInData:y,customPaymentForm:N,cyclePhases:C}){let[h,k]=Ge.useState(0),[S,I]=Ge.useState("forward"),[R,m]=Ge.useState(null),[F,M]=Ge.useState(null),[A,D]=Ge.useState(null),[T,P]=Ge.useState([]),[z,K]=Ge.useState({}),[Y,Te]=Ge.useState({}),[U,ie]=Ge.useState(null),Xe=t.bookingText||t.text||"#000000",ot=e.transitions||{},ve=ot.style||"slide",At=ot.speed||"normal",je=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,fe=e.background||{type:"color",value:"#FFFFFF"},O={service:{id:"service",name:"Service",enabled:e.steps?.service_selection?.enabled!==false,settings:e.steps?.service_selection?.settings||{}},date:{id:"date",name:"Date",enabled:e.steps?.date_selection?.enabled!==false,settings:e.steps?.date_selection?.settings||{}},time:{id:"time",name:"Time",enabled:e.steps?.time_selection?.enabled!==false,settings:e.steps?.time_selection?.settings||{}},addons:{id:"addons",name:"Add-ons",enabled:e.steps?.addon_selection?.enabled===true,settings:e.steps?.addon_selection?.settings||{}},details:{id:"details",name:"Details",enabled:e.steps?.contact_form?.enabled!==false,settings:e.steps?.contact_form?.settings||{}},confirm:{id:"confirm",name:"Confirm",enabled:e.steps?.confirmation?.enabled===true,settings:e.steps?.confirmation?.settings||{}}},Ne=f||["service","date","time","addons","details","confirm"],J=Ne.map(E=>O[E]).filter(E=>E&&E.enabled);console.log("[BookingFlow] Step configuration:",{customStepOrder:f,orderedStepIds:Ne,allSteps:J.map(E=>E.id),currentStepIndex:h,currentStepId:J[h]?.id});let re=J[h],at=()=>fe.type==="gradient"?{background:fe.value}:fe.type==="image"?{backgroundImage:`url(${fe.value})`,backgroundSize:"cover",backgroundPosition:"center"}:{backgroundColor:fe.value},it=()=>{if(je)return .15;switch(At){case "fast":return .2;case "slow":return .5;default:return .3}},fr=()=>ve==="fade"?{enter:()=>({opacity:0,scale:.95}),center:{opacity:1,scale:1},exit:()=>({opacity:0,scale:.95})}:{enter:()=>({x:S==="forward"?50:-50,opacity:0}),center:{x:0,opacity:1},exit:()=>({x:S==="forward"?-50:50,opacity:0})},Kt=()=>{let E=re?.id;if(v)return v(E,{service:R,date:F,time:A,addons:T,contact:z});switch(E){case "service":return R!==null;case "date":return F!==null;case "time":return A!==null;case "details":if(c)return true;let W=z?.name&&z.name.trim().length>=2,_=z?.email&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(z.email),ye=z?.phone&&z.phone.replace(/\D/g,"").length>=10;return W&&_&&ye;default:return true}},$t=E=>E<h,Ce=E=>{I(E>h?"forward":"backward"),k(E),u&&u(E,J[E]?.id);},bt=()=>{h<J.length-1&&Ce(h+1);},Lt=async()=>{if(h===0)return;let E=h-1;if(J[E]?.id==="time"&&U&&w?.releaseHold)try{await w.releaseHold(U.holdId),ie(null),D(null);}catch(_){console.error("[BookingFlow] Failed to release hold:",_);}Ce(E);},yr=async E=>{if(D(E),w?.enabled&&w.createHold&&F&&R)try{let W=r.find(ye=>ye.id===R),_=await w.createHold({date:F,time:E,serviceId:R,serviceDuration:W?.duration||60});ie(_);}catch(W){console.error("[BookingFlow] Failed to create hold:",W);return}bt();},br=()=>{ie(null),D(null);let E=J.findIndex(W=>W.id==="time");E>=0&&Ce(E);},Jt=async()=>{d&&d({service:R,date:F,time:A,addons:T,contact:z,optIn:Y});},Zr=()=>{if(!re)return null;let E={settings:re.settings,colors:t},W=r.find(_=>_.id===R);switch(re.id){case "service":return jsxRuntime.jsx(On,{...E,services:r,categories:a,selectedService:R,onServiceSelect:se=>{m(se),p&&p(se);}});case "date":return jsxRuntime.jsx(nr,{...E,availableDates:o,selectedDate:F,onDateSelect:se=>{M(se),g&&g(se);},cyclePhases:C,selectedService:W,addons:n,selectedAddons:T,onAddonsChange:P,addonPlacement:e.steps?.addon_selection?.settings?.placement||"date_selection"});case "time":return jsxRuntime.jsx(Hn,{...E,availableTimes:i,selectedTime:A,onTimeSelect:yr,serviceDuration:W?.duration||60,selectedService:W,selectedDate:F,selectedAddons:T,addons:n});case "addons":return jsxRuntime.jsx(Wn,{...E,addons:n,selectedAddons:T,onAddonsChange:P});case "details":return jsxRuntime.jsx(Vn,{...E,contactInfo:z,onContactInfoChange:se=>{K(se),b&&b(se);},optInModules:x,onOptInData:y});case "confirm":let _=n.filter(se=>T.includes(se.id)),ye=_.reduce((se,Pe)=>se+(Pe.addonPrice||Pe.price||0),0),hr=(W?.price||0)+ye,xr=_.reduce((se,Pe)=>Pe.affectsDuration&&Pe.additionalDuration?se+Pe.additionalDuration:se,W?.duration||60);return N?jsxRuntime.jsx(N,{bookingData:{service:R,serviceName:W?.name,date:F,time:A,addons:T,contact:z,amount:W?.price||0,duration:xr,clientName:z?.name,clientEmail:z?.email,clientPhone:z?.phone,pendingBooking:{customerClientId:null,serviceId:R,date:F,time:A,notes:z?.notes||"",selectedAddons:_,addonServices:T,addonTotalCost:ye,totalAmount:hr,duration:xr}},onPaymentSuccess:Jt,onPaymentError:Pe=>{console.error("[BookingFlow] Payment error:",Pe);}}):jsxRuntime.jsx(Yn,{...E,service:W,addons:_,selectedDate:F||"",selectedTime:A||"",paymentProvider:s||"square",paymentConfig:l||{depositPercentage:20},isPreview:c,onConfirm:Jt});default:return null}},st=()=>{let E=e.progressBar?.style||"dots";return E==="bar"?jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-medium",children:["Step ",h+1," of ",J.length]}),jsxRuntime.jsx("span",{className:"text-xs opacity-60",children:re?.name})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-gray-200 rounded-full overflow-hidden",children:jsxRuntime.jsx(framerMotion.motion.div,{className:"h-full rounded-full",style:{backgroundColor:t.primary},initial:{width:0},animate:{width:`${(h+1)/J.length*100}%`},transition:{duration:.3,ease:"easeOut"}})})]}):E==="minimal"?jsxRuntime.jsxs("div",{className:"mb-6 text-center",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium",style:{color:t.primary},children:re?.name}),jsxRuntime.jsxs("p",{className:"text-xs opacity-60 mt-1",children:["Step ",h+1," of ",J.length]})]}):jsxRuntime.jsx("div",{className:"flex justify-center mb-4 overflow-x-auto py-2",children:jsxRuntime.jsx("div",{className:"flex items-center space-x-1.5 px-4 min-w-max",children:J.map((W,_)=>jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(framerMotion.motion.div,{className:`w-6 h-6 rounded-full flex items-center justify-center font-medium text-xs transition-all flex-shrink-0 ${_===h?"text-white shadow-md":$t(_)?"text-white":"bg-gray-200 text-gray-500"}`,style:{backgroundColor:_<=h?t.primary:void 0},animate:{scale:_===h?1.05:1},transition:{duration:.2},children:$t(_)?"\u2713":_+1}),_<J.length-1&&jsxRuntime.jsx(framerMotion.motion.div,{className:`w-4 h-0.5 mx-1 transition-all flex-shrink-0 ${_<h?"":"bg-gray-200"}`,style:{backgroundColor:_<h?t.primary:void 0},initial:{scaleX:0},animate:{scaleX:1},transition:{duration:.3,delay:.1}})]},W.id))})})};return jsxRuntime.jsxs("div",{className:"w-full max-w-4xl mx-auto p-6 rounded-2xl shadow-xl",style:{...at(),color:Xe},children:[st(),w?.enabled&&U&&re?.id!=="time"&&jsxRuntime.jsx(Tr,{holdStatus:U,config:w.config,colors:t,onExtend:async()=>{if(w.extendHold&&U)try{let E=await w.extendHold(U.holdId);ie(E);}catch(E){console.error("[BookingFlow] Failed to extend hold:",E);}},onRelease:async()=>{if(w.releaseHold&&U)try{await w.releaseHold(U.holdId),ie(null),D(null);let E=J.findIndex(W=>W.id==="time");E>=0&&Ce(E);}catch(E){console.error("[BookingFlow] Failed to release hold:",E);}},onExpired:br,className:"mb-6"}),jsxRuntime.jsx("div",{className:"mb-6 min-h-[300px] relative overflow-hidden",children:jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",custom:S,children:jsxRuntime.jsx(framerMotion.motion.div,{custom:S,variants:fr(),initial:"enter",animate:"center",exit:"exit",transition:{duration:it(),ease:[.4,0,.2,1]},children:Zr()},h)})}),!(re?.id==="confirm"&&N)&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between pt-4 border-t border-gray-200",children:[jsxRuntime.jsx("button",{onClick:Lt,disabled:h===0,className:"px-4 py-2 rounded-lg border border-gray-300 disabled:opacity-30 disabled:cursor-not-allowed hover:bg-gray-50 transition-all text-sm font-medium",children:"Back"}),h<J.length-1?jsxRuntime.jsx("button",{onClick:bt,disabled:!Kt(),className:"px-6 py-2 rounded-lg text-white disabled:opacity-50 disabled:cursor-not-allowed hover:opacity-90 transition-all text-sm font-medium shadow-md",style:{backgroundColor:t.primary},children:"Next"}):jsxRuntime.jsx("button",{onClick:Jt,disabled:!Kt(),className:"px-6 py-2 rounded-lg text-white disabled:opacity-50 disabled:cursor-not-allowed hover:opacity-90 transition-all text-sm font-medium shadow-md",style:{backgroundColor:t.primary},children:re?.id==="confirm"?"Pay & Confirm":"Complete"})]})]})}function yi({section:e,theme:t,BookingFlowComponent:r,config:a,enableInlineEditing:o=false}){let{type:i,settings:n}=e,s=e.id;i==="video_section"&&console.log("\u{1F3AC} Rendering video_section:",{type:i,settings:n,sectionId:s});let l=t?.colors||{primary:"#BCB4FF",secondary:"#CAC426",text:"#000000"},c=t?.typography||{headingFont:"Geist Sans",bodyFont:"Inter",bodySize:"16px"};switch(i){case "logo":return jsxRuntime.jsx(tn,{logoUrl:n.logoUrl,fallbackText:n.fallbackText,size:n.size,alignment:n.alignment,colors:l,enableInlineEditing:o,sectionId:s});case "header":return jsxRuntime.jsx(nn,{name:n.name,title:n.title,bio:n.bio,showName:n.showName,showTitle:n.showTitle,showBio:n.showBio,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "featured_link":return jsxRuntime.jsx(on,{text:n.text,url:n.url,style:n.style,size:n.size,colors:l,enableInlineEditing:o,sectionId:s});case "link_list":return jsxRuntime.jsx(sn,{links:n.links||[],style:n.style,colors:l,enableInlineEditing:o,sectionId:s});case "social_bar":return jsxRuntime.jsx(ln,{platforms:n.platforms||[],socialLinks:n.socialLinks,style:n.style,size:n.size,position:n.position,invertIcons:n.invertIcons,colors:l,enableInlineEditing:o,sectionId:s});case "instagram_feed":return jsxRuntime.jsx(Fn,{username:n.username,colors:l,enableInlineEditing:o,sectionId:s});case "minimal_header":return jsxRuntime.jsx(bn,{brandName:n.brandName,logoUrl:n.logoUrl,style:n.style,alignment:n.alignment,sticky:n.sticky,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "minimal_navigation":return jsxRuntime.jsx(xn,{links:n.links||[],style:n.style,colors:l,enableInlineEditing:o,sectionId:s});case "feature_content":return jsxRuntime.jsx(wn,{headline:n.headline,description:n.description,image:n.image,buttonText:n.buttonText,buttonUrl:n.buttonUrl,showButton:n.showButton,layout:n.layout,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "minimal_footer":return jsxRuntime.jsx(vn,{alignment:n.alignment,showSocial:n.showSocial,showContact:n.showContact,showLinks:n.showLinks,footerText:n.footerText,colors:l,enableInlineEditing:o,sectionId:s});case "hero":return jsxRuntime.jsx(cn,{headline:n.headline,subheadline:n.subheadline,heroImage:n.heroImage,ctaButton:n.ctaButton,layout:n.layout,imagePosition:n.imagePosition,contentDisplay:n.contentDisplay,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "about":return jsxRuntime.jsx(dn,{title:n.title,content:n.content,image:n.image,layout:n.layout,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "services_preview":return jsxRuntime.jsx(un,{title:n.title,services:n.services,layout:n.layout,columns:n.columns,showPrices:n.showPrices,showDuration:n.showDuration,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "gallery":return jsxRuntime.jsx(mn,{title:n.title,images:n.images||[],columns:n.columns,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "testimonials":return jsxRuntime.jsx(gn,{title:n.title,testimonials:n.testimonials,layout:n.layout,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "team":return jsxRuntime.jsx(fn,{title:n.title,members:n.members,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "contact":return jsxRuntime.jsx(yn,{title:n.title,showForm:n.showForm,email:n.email,phone:n.phone,address:n.address,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "before_after":return jsxRuntime.jsx(Cn,{title:n.title,comparisons:n.comparisons,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "pricing_table":return jsxRuntime.jsx(Sn,{title:n.title,plans:n.plans,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "booking":return jsxRuntime.jsx(En,{config:a||{},colors:l,BookingFlowComponent:r,enableInlineEditing:o,sectionId:s});case "fixed_info_card":return jsxRuntime.jsx(In,{name:n.name,subheading:n.subheading,bio:n.bio,links:n.links||[],bookingButtonText:n.bookingButtonText,bookingButtonUrl:n.bookingButtonUrl,showBookingButton:n.showBookingButton,position:n.position,cardWidth:n.cardWidth,cardColor:n.cardColor,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "video_section":return jsxRuntime.jsx(Rn,{videoUrl:n.videoUrl,aspectRatio:n.aspectRatio,autoplay:n.autoplay,loop:n.loop,muted:n.muted,controls:n.controls,allowFullScreen:n.allowFullScreen,coverImage:n.coverImage,maxWidth:n.maxWidth,alignment:n.alignment,borderRadius:n.borderRadius,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "scrolling_text_divider":return jsxRuntime.jsx(Pn,{text:n.text,scrollDirection:n.scrollDirection,scrollSpeed:n.scrollSpeed,orientation:n.orientation,dividerIcon:n.dividerIcon,customIcon:n.customIcon,textSize:n.textSize,textColor:n.textColor,fontWeight:n.fontWeight,backgroundColor:n.backgroundColor,backgroundGradient:n.backgroundGradient,pauseOnHover:n.pauseOnHover,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "location_map":return jsxRuntime.jsx(An,{address:n.address,displayType:n.displayType,mapHeight:n.mapHeight,mapStyle:n.mapStyle,zoom:n.zoom,showMarker:n.showMarker,borderRadius:n.borderRadius,directionsButtonText:n.directionsButtonText,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "image_section":return jsxRuntime.jsx(Mn,{imageUrl:n.imageUrl,altText:n.altText,caption:n.caption,maxWidth:n.maxWidth,alignment:n.alignment,aspectRatio:n.aspectRatio,borderRadius:n.borderRadius,linkUrl:n.linkUrl,openInNewTab:n.openInNewTab,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "faq_section":return jsxRuntime.jsx($n,{title:n.title,faqs:n.faqs,layout:n.layout,maxWidth:n.maxWidth,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "navbar":return jsxRuntime.jsx(Bn,{brandName:n.brandName,logoUrl:n.logoUrl,showLogo:n.showLogo,showBrandName:n.showBrandName,links:n.links,ctaText:n.ctaText,ctaUrl:n.ctaUrl,sticky:n.sticky,transparentOnTop:n.transparentOnTop,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "text_section":return jsxRuntime.jsx(zn,{title:n.title,content:n.content,alignment:n.alignment,maxWidth:n.maxWidth,textSize:n.textSize,backgroundColor:n.backgroundColor,textColor:n.textColor,paddingY:n.paddingY,colors:l,typography:c,enableInlineEditing:o,sectionId:s});default:return jsxRuntime.jsx("div",{className:"container mx-auto px-4 py-16",children:jsxRuntime.jsx("div",{className:"max-w-4xl mx-auto p-8 rounded-lg border-2 border-dashed text-center",style:{borderColor:l.primary,opacity:.5},children:jsxRuntime.jsxs("p",{className:"text-lg",style:{color:l.text},children:["Unknown section type: ",i]})})})}}var Xn=null;function xi(){if(!Xn){let e=undefined.VITE_SUPABASE_URL||process.env.NEXT_PUBLIC_SUPABASE_URL,t=undefined.VITE_SUPABASE_ANON_KEY||process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;if(!e||!t)throw new Error("Supabase URL and Anon Key must be provided");Xn=supabaseJs.createClient(e,t);}return Xn}var nt={bucket:"form-uploads",limits:{maxSize:5*1024*1024,allowedTypes:["image/jpeg","image/png","image/webp","image/jpg"]}};async function To(e,t,r){if(console.log("\u{1F4E6} uploadFormImage called:",{fileName:e.name,clientId:t,formId:r}),e.size>nt.limits.maxSize)throw new Error(`File size exceeds maximum of ${nt.limits.maxSize/1024/1024}MB`);if(!nt.limits.allowedTypes.includes(e.type))throw new Error(`File type ${e.type} not allowed. Accepted types: JPG, PNG, WebP`);console.log("\u{1F3A8} Starting image optimization...");let a=await vi(e);console.log("\u2705 Image optimized:",{originalSize:e.size,optimizedSize:a.size});let o=Date.now();e.name.split(".").pop()?.toLowerCase()||"jpg";let n=e.name.replace(/[^a-zA-Z0-9.-]/g,"_").substring(0,50),s=`${o}_${n}`,l=`${t}/${r}/${s}`;console.log("\u2601\uFE0F Uploading to Supabase:",{filePath:l,bucket:nt.bucket});let c=xi(),{data:d,error:u}=await c.storage.from(nt.bucket).upload(l,a,{cacheControl:"3600",upsert:false,contentType:a.type});if(console.log("\u{1F4E4} Upload result:",{data:d,error:u}),u)throw console.error("\u274C Supabase upload error:",u),new Error(`Upload failed: ${u.message}`);console.log("\u2705 Upload successful, getting public URL...");let{data:{publicUrl:p}}=c.storage.from(nt.bucket).getPublicUrl(l);return console.log("\u2705 Public URL obtained:",p),{url:p,path:l,filename:e.name,size:a.size,type:a.type}}async function vi(e,t=1920,r=.85){console.log("\u{1F5BC}\uFE0F optimizeImage: Starting optimization");let a=e.type==="image/png"||e.type==="image/webp",o=a?e.type:"image/jpeg";return console.log("\u{1F5BC}\uFE0F optimizeImage: Output type:",o,"Transparency:",a),new Promise((i,n)=>{let s=setTimeout(()=>{console.error("\u23F1\uFE0F optimizeImage: Timeout after 30 seconds"),n(new Error("Image optimization timed out"));},3e4),l=new Image,c=document.createElement("canvas"),d=c.getContext("2d",{alpha:a});if(!d){clearTimeout(s),console.error("\u274C optimizeImage: Canvas context not available"),n(new Error("Canvas context not available"));return}console.log("\u{1F5BC}\uFE0F optimizeImage: Created canvas and context"),l.onload=()=>{console.log("\u{1F5BC}\uFE0F optimizeImage: Image loaded",{width:l.width,height:l.height});try{let u=Math.min(t/l.width,1);c.width=l.width*u,c.height=l.height*u,console.log("\u{1F5BC}\uFE0F optimizeImage: Resizing to",{width:c.width,height:c.height}),a&&d.clearRect(0,0,c.width,c.height),d.drawImage(l,0,0,c.width,c.height),console.log("\u{1F5BC}\uFE0F optimizeImage: Image drawn, converting to blob..."),c.toBlob(p=>{if(clearTimeout(s),!p){console.error("\u274C optimizeImage: Blob conversion failed"),n(new Error("Image optimization failed"));return}console.log("\u2705 optimizeImage: Blob created",{size:p.size,type:o});let g=new File([p],e.name,{type:o,lastModified:Date.now()});console.log("\u2705 optimizeImage: Optimization complete"),i(g);},o,r);}catch(u){clearTimeout(s),console.error("\u274C optimizeImage: Error during processing",u),n(u);}},l.onerror=u=>{clearTimeout(s),console.error("\u274C optimizeImage: Failed to load image",u),n(new Error("Failed to load image"));},console.log("\u{1F5BC}\uFE0F optimizeImage: Creating object URL and loading image..."),l.src=URL.createObjectURL(e);})}function Po(e){return e.size>nt.limits.maxSize?{valid:false,error:`File size exceeds maximum of ${nt.limits.maxSize/1024/1024}MB`}:nt.limits.allowedTypes.includes(e.type)?{valid:true}:{valid:false,error:"File type not allowed. Accepted: JPG, PNG, WebP"}}function Ar({field:e,value:t,error:r,onChange:a,businessId:o,formId:i,styling:n}){let s=Ge.useRef(null),[l,c]=Ge.useState(false),[d,u]=Ge.useState(null),p=n?.labelColor||"#374151",g=n?.fieldStyle||"outlined",v=(()=>{let f="w-full px-4 py-2 transition-all focus:outline-none";if(r)return `${f} bg-red-50 border border-red-300 rounded-lg focus:ring-2 focus:ring-red-500`;switch(g){case "filled":return `${f} bg-gray-100 border border-transparent rounded-lg focus:bg-white focus:ring-2 focus:ring-gray-900 focus:border-transparent`;case "underlined":return `${f} bg-transparent border-0 border-b-2 border-gray-300 rounded-none focus:border-gray-900 focus:ring-0 px-0`;case "minimal":return `${f} bg-transparent border border-gray-200 rounded-lg focus:border-gray-400 focus:ring-1 focus:ring-gray-300`;case "outlined":default:return `${f} bg-white border-2 border-gray-300 rounded-lg focus:border-gray-900 focus:ring-2 focus:ring-gray-900`}})(),w="block text-sm font-medium mb-1";if(e.type==="text"||e.type==="email"||e.type==="tel")return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:e.id,className:w,style:{color:p},children:[e.label,e.required&&jsxRuntime.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),jsxRuntime.jsx("input",{type:e.type,id:e.id,name:e.id,value:t||"",onChange:f=>a(f.target.value),placeholder:e.placeholder,required:e.required,className:v,style:{color:p}}),r&&jsxRuntime.jsx("p",{className:"mt-1 text-xs text-red-600",children:r})]});if(e.type==="textarea")return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:e.id,className:w,style:{color:p},children:[e.label,e.required&&jsxRuntime.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),jsxRuntime.jsx("textarea",{id:e.id,name:e.id,value:t||"",onChange:f=>a(f.target.value),placeholder:e.placeholder,required:e.required,rows:4,className:v,style:{color:p}}),r&&jsxRuntime.jsx("p",{className:"mt-1 text-xs text-red-600",children:r})]});if(e.type==="date")return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:e.id,className:w,style:{color:p},children:[e.label,e.required&&jsxRuntime.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),jsxRuntime.jsx("input",{type:"date",id:e.id,name:e.id,value:t||"",onChange:f=>a(f.target.value),required:e.required,className:v,style:{color:p}}),r&&jsxRuntime.jsx("p",{className:"mt-1 text-xs text-red-600",children:r})]});if(e.type==="select"&&e.options)return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:e.id,className:w,style:{color:p},children:[e.label,e.required&&jsxRuntime.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),jsxRuntime.jsxs("select",{id:e.id,name:e.id,value:t||"",onChange:f=>a(f.target.value),required:e.required,className:v,style:{color:p},children:[jsxRuntime.jsx("option",{value:"",children:"Select an option..."}),e.options.map(f=>jsxRuntime.jsx("option",{value:f.value,children:f.label},f.value))]}),r&&jsxRuntime.jsx("p",{className:"mt-1 text-xs text-red-600",children:r})]});if(e.type==="radio"&&e.options)return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:w,style:{color:p},children:[e.label,e.required&&jsxRuntime.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),jsxRuntime.jsx("div",{className:"space-y-2 mt-2",children:e.options.map(f=>jsxRuntime.jsxs("label",{className:"flex items-center space-x-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"radio",name:e.id,value:f.value,checked:t===f.value,onChange:x=>a(x.target.value),required:e.required,className:"w-4 h-4 text-gray-900 focus:ring-gray-900 focus:ring-2"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:n?.labelColor||"#000000"},children:f.label})]},f.value))}),r&&jsxRuntime.jsx("p",{className:"mt-1 text-xs text-red-600",children:r})]});if(e.type==="checkbox"&&e.options){let f=Array.isArray(t)?t:[],x=y=>{let N=f.includes(y)?f.filter(C=>C!==y):[...f,y];a(N);};return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:w,style:{color:p},children:[e.label,e.required&&jsxRuntime.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),jsxRuntime.jsx("div",{className:"space-y-2 mt-2",children:e.options.map(y=>jsxRuntime.jsxs("label",{className:"flex items-center space-x-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",name:`${e.id}[]`,value:y.value,checked:f.includes(y.value),onChange:()=>x(y.value),className:"w-4 h-4 text-gray-900 focus:ring-gray-900 focus:ring-2 rounded"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:n?.labelColor||"#000000"},children:y.label})]},y.value))}),r&&jsxRuntime.jsx("p",{className:"mt-1 text-xs text-red-600",children:r})]})}if(e.type==="photo"){let f=async x=>{let y=x.target.files?.[0];if(!y)return;u(null);let N=Po(y);if(!N.valid){u(N.error||"Invalid file"),s.current&&(s.current.value="");return}if(!o||!i){u("Missing required configuration for file upload"),s.current&&(s.current.value="");return}c(true);try{let C=await To(y,o,i);a({url:C.url,filename:C.filename,size:C.size,type:C.type,uploadedAt:new Date().toISOString()}),u(null);}catch(C){console.error("Photo upload error:",C),u(C instanceof Error?C.message:"Upload failed"),s.current&&(s.current.value="");}finally{c(false);}};return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:e.id,className:w,style:{color:p},children:[e.label,e.required&&jsxRuntime.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),jsxRuntime.jsxs("div",{className:"mt-1",children:[jsxRuntime.jsx("input",{ref:s,type:"file",id:e.id,name:e.id,accept:"image/*",onChange:f,required:e.required,disabled:l,className:`block w-full text-sm text-gray-500
11
11
  file:mr-4 file:py-2 file:px-4
12
12
  file:rounded-lg file:border-0
13
13
  file:text-sm file:font-medium
14
14
  file:bg-gray-900 file:text-white
15
15
  hover:file:bg-gray-800
16
16
  file:cursor-pointer cursor-pointer
17
- disabled:opacity-50 disabled:cursor-not-allowed`}),l&&jsxRuntime.jsxs("div",{className:"mt-2 flex items-center gap-2 text-xs text-blue-600",children:[jsxRuntime.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-2 border-blue-600 border-t-transparent"}),jsxRuntime.jsx("span",{children:"Uploading..."})]}),t&&!l&&jsxRuntime.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[jsxRuntime.jsx("svg",{className:"w-4 h-4 text-green-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),jsxRuntime.jsxs("span",{className:"text-xs text-gray-600",children:[t.filename," (",Math.round(t.size/1024),"KB)"]})]})]}),jsxRuntime.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"Max file size: 5MB \u2022 JPG, PNG, WebP"}),d&&jsxRuntime.jsx("p",{className:"mt-1 text-xs text-red-600",children:d}),r&&jsxRuntime.jsx("p",{className:"mt-1 text-xs text-red-600",children:r})]})}if(e.type==="image"){let f=e,x=f.imageUrl;if(!x)return null;let y=f.imageSize||"medium",N=y==="full",C={small:"200px",medium:"400px",large:"600px"},h=N?"none":C[y]||C.medium,k={none:"0",sm:"0.25rem",md:"0.375rem",lg:"0.5rem",full:"9999px"},S=k[f.borderRadius]||k.md,I=N?"":{left:"mr-auto",center:"mx-auto",right:"ml-auto"}[f.imageAlignment||"center"],R={maxWidth:h,...N&&{width:"100%"}};return jsxRuntime.jsx("div",{className:I,style:R,children:jsxRuntime.jsx("img",{src:x,alt:e.label||"",className:"w-full h-auto",style:{borderRadius:S}})})}return null}function Lo(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Ge.useMemo(()=>a=>{t.forEach(o=>o(a));},t)}var ar=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ft(e){let t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Mr(e){return "nodeType"in e}function he(e){var t,r;return e?Ft(e)?e:Mr(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function $r(e){let{Document:t}=he(e);return e instanceof t}function _t(e){return Ft(e)?false:e instanceof he(e).HTMLElement}function Qn(e){return e instanceof he(e).SVGElement}function Dt(e){return e?Ft(e)?e.document:Mr(e)?$r(e)?e:_t(e)||Qn(e)?e.ownerDocument:document:document:document}var Be=ar?Ge.useLayoutEffect:Ge.useEffect;function Lr(e){let t=Ge.useRef(e);return Be(()=>{t.current=e;}),Ge.useCallback(function(){for(var r=arguments.length,a=new Array(r),o=0;o<r;o++)a[o]=arguments[o];return t.current==null?void 0:t.current(...a)},[])}function Bo(){let e=Ge.useRef(null),t=Ge.useCallback((a,o)=>{e.current=setInterval(a,o);},[]),r=Ge.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null);},[]);return [t,r]}function qt(e,t){t===void 0&&(t=[e]);let r=Ge.useRef(e);return Be(()=>{r.current!==e&&(r.current=e);},t),r}function Vt(e,t){let r=Ge.useRef();return Ge.useMemo(()=>{let a=e(r.current);return r.current=a,a},[...t])}function ir(e){let t=Lr(e),r=Ge.useRef(null),a=Ge.useCallback(o=>{o!==r.current&&t?.(o,r.current),r.current=o;},[]);return [r,a]}function Br(e){let t=Ge.useRef();return Ge.useEffect(()=>{t.current=e;},[e]),t.current}var Kn={};function It(e,t){return Ge.useMemo(()=>{if(t)return t;let r=Kn[e]==null?0:Kn[e]+1;return Kn[e]=r,e+"-"+r},[e,t])}function zo(e){return function(t){for(var r=arguments.length,a=new Array(r>1?r-1:0),o=1;o<r;o++)a[o-1]=arguments[o];return a.reduce((i,n)=>{let s=Object.entries(n);for(let[l,c]of s){let d=i[l];d!=null&&(i[l]=d+e*c);}return i},{...t})}}var Et=zo(1),Yt=zo(-1);function Ci(e){return "clientX"in e&&"clientY"in e}function sr(e){if(!e)return false;let{KeyboardEvent:t}=he(e.target);return t&&e instanceof t}function Si(e){if(!e)return false;let{TouchEvent:t}=he(e.target);return t&&e instanceof t}function zr(e){if(Si(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:r}=e.touches[0];return {x:t,y:r}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:r}=e.changedTouches[0];return {x:t,y:r}}}return Ci(e)?{x:e.clientX,y:e.clientY}:null}var ft=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:r}=e;return "translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:r}=e;return "scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return [ft.Translate.toString(e),ft.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:a}=e;return t+" "+r+"ms "+a}}}),Mo="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Oo(e){return e.matches(Mo)?e:e.querySelector(Mo)}var Di={display:"none"};function Uo(e){let{id:t,value:r}=e;return Ge__default.default.createElement("div",{id:t,style:Di},r)}function Wo(e){let{id:t,announcement:r,ariaLiveType:a="assertive"}=e,o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return Ge__default.default.createElement("div",{id:t,style:o,role:"status","aria-live":a,"aria-atomic":true},r)}function jo(){let[e,t]=Ge.useState("");return {announce:Ge.useCallback(a=>{a!=null&&t(a);},[]),announcement:e}}var ta=Ge.createContext(null);function Ti(e){let t=Ge.useContext(ta);Ge.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t]);}function Pi(){let[e]=Ge.useState(()=>new Set),t=Ge.useCallback(a=>(e.add(a),()=>e.delete(a)),[e]);return [Ge.useCallback(a=>{let{type:o,event:i}=a;e.forEach(n=>{var s;return (s=n[o])==null?void 0:s.call(n,i)});},[e]),t]}var Ai={draggable:`
17
+ disabled:opacity-50 disabled:cursor-not-allowed`}),l&&jsxRuntime.jsxs("div",{className:"mt-2 flex items-center gap-2 text-xs text-blue-600",children:[jsxRuntime.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-2 border-blue-600 border-t-transparent"}),jsxRuntime.jsx("span",{children:"Uploading..."})]}),t&&!l&&jsxRuntime.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[jsxRuntime.jsx("svg",{className:"w-4 h-4 text-green-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),jsxRuntime.jsxs("span",{className:"text-xs text-gray-600",children:[t.filename," (",Math.round(t.size/1024),"KB)"]})]})]}),jsxRuntime.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"Max file size: 5MB \u2022 JPG, PNG, WebP"}),d&&jsxRuntime.jsx("p",{className:"mt-1 text-xs text-red-600",children:d}),r&&jsxRuntime.jsx("p",{className:"mt-1 text-xs text-red-600",children:r})]})}if(e.type==="image"){let f=e,x=f.imageUrl;if(!x)return null;let y=f.imageSize||"medium",N=y==="full",C={small:"200px",medium:"400px",large:"600px"},h=N?"none":C[y]||C.medium,k={none:"0",sm:"0.25rem",md:"0.375rem",lg:"0.5rem",full:"9999px"},S=k[f.borderRadius]||k.md,I=N?"":{left:"mr-auto",center:"mx-auto",right:"ml-auto"}[f.imageAlignment||"center"],R={maxWidth:h,...N&&{width:"100%"}};return jsxRuntime.jsx("div",{className:I,style:R,children:jsxRuntime.jsx("img",{src:x,alt:e.label||"",className:"w-full h-auto",style:{borderRadius:S}})})}return null}function Lo(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Ge.useMemo(()=>a=>{t.forEach(o=>o(a));},t)}var ar=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ft(e){let t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function $r(e){return "nodeType"in e}function he(e){var t,r;return e?Ft(e)?e:$r(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function Lr(e){let{Document:t}=he(e);return e instanceof t}function _t(e){return Ft(e)?false:e instanceof he(e).HTMLElement}function Qn(e){return e instanceof he(e).SVGElement}function Dt(e){return e?Ft(e)?e.document:$r(e)?Lr(e)?e:_t(e)||Qn(e)?e.ownerDocument:document:document:document}var Be=ar?Ge.useLayoutEffect:Ge.useEffect;function Br(e){let t=Ge.useRef(e);return Be(()=>{t.current=e;}),Ge.useCallback(function(){for(var r=arguments.length,a=new Array(r),o=0;o<r;o++)a[o]=arguments[o];return t.current==null?void 0:t.current(...a)},[])}function Bo(){let e=Ge.useRef(null),t=Ge.useCallback((a,o)=>{e.current=setInterval(a,o);},[]),r=Ge.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null);},[]);return [t,r]}function qt(e,t){t===void 0&&(t=[e]);let r=Ge.useRef(e);return Be(()=>{r.current!==e&&(r.current=e);},t),r}function Vt(e,t){let r=Ge.useRef();return Ge.useMemo(()=>{let a=e(r.current);return r.current=a,a},[...t])}function ir(e){let t=Br(e),r=Ge.useRef(null),a=Ge.useCallback(o=>{o!==r.current&&t?.(o,r.current),r.current=o;},[]);return [r,a]}function zr(e){let t=Ge.useRef();return Ge.useEffect(()=>{t.current=e;},[e]),t.current}var Kn={};function It(e,t){return Ge.useMemo(()=>{if(t)return t;let r=Kn[e]==null?0:Kn[e]+1;return Kn[e]=r,e+"-"+r},[e,t])}function zo(e){return function(t){for(var r=arguments.length,a=new Array(r>1?r-1:0),o=1;o<r;o++)a[o-1]=arguments[o];return a.reduce((i,n)=>{let s=Object.entries(n);for(let[l,c]of s){let d=i[l];d!=null&&(i[l]=d+e*c);}return i},{...t})}}var Et=zo(1),Yt=zo(-1);function Ci(e){return "clientX"in e&&"clientY"in e}function sr(e){if(!e)return false;let{KeyboardEvent:t}=he(e.target);return t&&e instanceof t}function Si(e){if(!e)return false;let{TouchEvent:t}=he(e.target);return t&&e instanceof t}function Or(e){if(Si(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:r}=e.touches[0];return {x:t,y:r}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:r}=e.changedTouches[0];return {x:t,y:r}}}return Ci(e)?{x:e.clientX,y:e.clientY}:null}var ft=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:r}=e;return "translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:r}=e;return "scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return [ft.Translate.toString(e),ft.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:a}=e;return t+" "+r+"ms "+a}}}),Mo="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Oo(e){return e.matches(Mo)?e:e.querySelector(Mo)}var Di={display:"none"};function Uo(e){let{id:t,value:r}=e;return Ge__default.default.createElement("div",{id:t,style:Di},r)}function Wo(e){let{id:t,announcement:r,ariaLiveType:a="assertive"}=e,o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return Ge__default.default.createElement("div",{id:t,style:o,role:"status","aria-live":a,"aria-atomic":true},r)}function jo(){let[e,t]=Ge.useState("");return {announce:Ge.useCallback(a=>{a!=null&&t(a);},[]),announcement:e}}var ta=Ge.createContext(null);function Ti(e){let t=Ge.useContext(ta);Ge.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t]);}function Pi(){let[e]=Ge.useState(()=>new Set),t=Ge.useCallback(a=>(e.add(a),()=>e.delete(a)),[e]);return [Ge.useCallback(a=>{let{type:o,event:i}=a;e.forEach(n=>{var s;return (s=n[o])==null?void 0:s.call(n,i)});},[e]),t]}var Ai={draggable:`
18
18
  To pick up a draggable item, press the space bar.
19
19
  While dragging, use the arrow keys to move the item.
20
20
  Press space again to drop the item in its new position, or press escape to cancel.
21
- `},Mi={onDragStart(e){let{active:t}=e;return "Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return "Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function $i(e){let{announcements:t=Mi,container:r,hiddenTextDescribedById:a,screenReaderInstructions:o=Ai}=e,{announce:i,announcement:n}=jo(),s=It("DndLiveRegion"),[l,c]=Ge.useState(false);if(Ge.useEffect(()=>{c(true);},[]),Ti(Ge.useMemo(()=>({onDragStart(u){let{active:p}=u;i(t.onDragStart({active:p}));},onDragMove(u){let{active:p,over:g}=u;t.onDragMove&&i(t.onDragMove({active:p,over:g}));},onDragOver(u){let{active:p,over:g}=u;i(t.onDragOver({active:p,over:g}));},onDragEnd(u){let{active:p,over:g}=u;i(t.onDragEnd({active:p,over:g}));},onDragCancel(u){let{active:p,over:g}=u;i(t.onDragCancel({active:p,over:g}));}}),[i,t])),!l)return null;let d=Ge__default.default.createElement(Ge__default.default.Fragment,null,Ge__default.default.createElement(Uo,{id:a,value:o.draggable}),Ge__default.default.createElement(Wo,{id:s,announcement:n}));return r?reactDom.createPortal(d,r):d}var oe;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable";})(oe||(oe={}));function Ur(){}function ra(e,t){return Ge.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function na(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Ge.useMemo(()=>[...t].filter(a=>a!=null),[...t])}var We=Object.freeze({x:0,y:0});function Li(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Bi(e,t){let{data:{value:r}}=e,{data:{value:a}}=t;return r-a}function zi(e,t){let{data:{value:r}}=e,{data:{value:a}}=t;return a-r}function oa(e,t){if(!e||e.length===0)return null;let[r]=e;return r[t]}function _o(e,t,r){return t===void 0&&(t=e.left),r===void 0&&(r=e.top),{x:t+e.width*.5,y:r+e.height*.5}}var aa=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:a}=e,o=_o(t,t.left,t.top),i=[];for(let n of a){let{id:s}=n,l=r.get(s);if(l){let c=Li(_o(l),o);i.push({id:s,data:{droppableContainer:n,value:c}});}}return i.sort(Bi)};function Oi(e,t){let r=Math.max(t.top,e.top),a=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),n=o-a,s=i-r;if(a<o&&r<i){let l=t.width*t.height,c=e.width*e.height,d=n*s,u=d/(l+c-d);return Number(u.toFixed(4))}return 0}var Hi=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:a}=e,o=[];for(let i of a){let{id:n}=i,s=r.get(n);if(s){let l=Oi(s,t);l>0&&o.push({id:n,data:{droppableContainer:i,value:l}});}}return o.sort(zi)};function Ui(e,t,r){return {...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function ia(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:We}function Wi(e){return function(r){for(var a=arguments.length,o=new Array(a>1?a-1:0),i=1;i<a;i++)o[i-1]=arguments[i];return o.reduce((n,s)=>({...n,top:n.top+e*s.y,bottom:n.bottom+e*s.y,left:n.left+e*s.x,right:n.right+e*s.x}),{...r})}}var ji=Wi(1);function _i(e){if(e.startsWith("matrix3d(")){let t=e.slice(9,-1).split(/, /);return {x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){let t=e.slice(7,-1).split(/, /);return {x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function qi(e,t,r){let a=_i(t);if(!a)return e;let{scaleX:o,scaleY:i,x:n,y:s}=a,l=e.left-n-(1-o)*parseFloat(r),c=e.top-s-(1-i)*parseFloat(r.slice(r.indexOf(" ")+1)),d=o?e.width/o:e.width,u=i?e.height/i:e.height;return {width:d,height:u,top:c,right:l+d,bottom:c+u,left:l}}var Vi={ignoreTransform:false};function Pt(e,t){t===void 0&&(t=Vi);let r=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:c,transformOrigin:d}=he(e).getComputedStyle(e);c&&(r=qi(r,c,d));}let{top:a,left:o,width:i,height:n,bottom:s,right:l}=r;return {top:a,left:o,width:i,height:n,bottom:s,right:l}}function qo(e){return Pt(e,{ignoreTransform:true})}function Yi(e){let t=e.innerWidth,r=e.innerHeight;return {top:0,left:0,right:t,bottom:r,width:t,height:r}}function Gi(e,t){return t===void 0&&(t=he(e).getComputedStyle(e)),t.position==="fixed"}function Xi(e,t){t===void 0&&(t=he(e).getComputedStyle(e));let r=/(auto|scroll|overlay)/;return ["overflow","overflowX","overflowY"].some(o=>{let i=t[o];return typeof i=="string"?r.test(i):false})}function _r(e,t){let r=[];function a(o){if(t!=null&&r.length>=t||!o)return r;if($r(o)&&o.scrollingElement!=null&&!r.includes(o.scrollingElement))return r.push(o.scrollingElement),r;if(!_t(o)||Qn(o)||r.includes(o))return r;let i=he(e).getComputedStyle(o);return o!==e&&Xi(o,i)&&r.push(o),Gi(o,i)?r:a(o.parentNode)}return e?a(e):r}function sa(e){let[t]=_r(e,1);return t??null}function Zn(e){return !ar||!e?null:Ft(e)?e:Mr(e)?$r(e)||e===Dt(e).scrollingElement?window:_t(e)?e:null:null}function la(e){return Ft(e)?e.scrollX:e.scrollLeft}function ca(e){return Ft(e)?e.scrollY:e.scrollTop}function ro(e){return {x:la(e),y:ca(e)}}var ce;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward";})(ce||(ce={}));function da(e){return !ar||!e?false:e===document.scrollingElement}function ua(e){let t={x:0,y:0},r=da(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},a={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},o=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,n=e.scrollTop>=a.y,s=e.scrollLeft>=a.x;return {isTop:o,isLeft:i,isBottom:n,isRight:s,maxScroll:a,minScroll:t}}var Ki={x:.2,y:.2};function Ji(e,t,r,a,o){let{top:i,left:n,right:s,bottom:l}=r;a===void 0&&(a=10),o===void 0&&(o=Ki);let{isTop:c,isBottom:d,isLeft:u,isRight:p}=ua(e),g={x:0,y:0},b={x:0,y:0},v={height:t.height*o.y,width:t.width*o.x};return !c&&i<=t.top+v.height?(g.y=ce.Backward,b.y=a*Math.abs((t.top+v.height-i)/v.height)):!d&&l>=t.bottom-v.height&&(g.y=ce.Forward,b.y=a*Math.abs((t.bottom-v.height-l)/v.height)),!p&&s>=t.right-v.width?(g.x=ce.Forward,b.x=a*Math.abs((t.right-v.width-s)/v.width)):!u&&n<=t.left+v.width&&(g.x=ce.Backward,b.x=a*Math.abs((t.left+v.width-n)/v.width)),{direction:g,speed:b}}function Qi(e){if(e===document.scrollingElement){let{innerWidth:i,innerHeight:n}=window;return {top:0,left:0,right:i,bottom:n,width:i,height:n}}let{top:t,left:r,right:a,bottom:o}=e.getBoundingClientRect();return {top:t,left:r,right:a,bottom:o,width:e.clientWidth,height:e.clientHeight}}function ma(e){return e.reduce((t,r)=>Et(t,ro(r)),We)}function Zi(e){return e.reduce((t,r)=>t+la(r),0)}function es(e){return e.reduce((t,r)=>t+ca(r),0)}function ts(e,t){if(t===void 0&&(t=Pt),!e)return;let{top:r,left:a,bottom:o,right:i}=t(e);sa(e)&&(o<=0||i<=0||r>=window.innerHeight||a>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"});}var rs=[["x",["left","right"],Zi],["y",["top","bottom"],es]],cr=class{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let a=_r(r),o=ma(a);this.rect={...t},this.width=t.width,this.height=t.height;for(let[i,n,s]of rs)for(let l of n)Object.defineProperty(this,l,{get:()=>{let c=s(a),d=o[i]-c;return this.rect[l]+d},enumerable:true});Object.defineProperty(this,"rect",{enumerable:false});}},Rt=class{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var a;return (a=this.target)==null?void 0:a.removeEventListener(...r)});},this.target=t;}add(t,r,a){var o;(o=this.target)==null||o.addEventListener(t,r,a),this.listeners.push([t,r,a]);}};function ns(e){let{EventTarget:t}=he(e);return e instanceof t?e:Dt(e)}function eo(e,t){let r=Math.abs(e.x),a=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+a**2)>t:"x"in t&&"y"in t?r>t.x&&a>t.y:"x"in t?r>t.x:"y"in t?a>t.y:false}var ze;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange";})(ze||(ze={}));function Vo(e){e.preventDefault();}function os(e){e.stopPropagation();}var B;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab";})(B||(B={}));var pa={start:[B.Space,B.Enter],cancel:[B.Esc],end:[B.Space,B.Enter,B.Tab]},as=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case B.Right:return {...r,x:r.x+25};case B.Left:return {...r,x:r.x-25};case B.Down:return {...r,y:r.y+25};case B.Up:return {...r,y:r.y-25}}},Wr=class{constructor(t){this.props=void 0,this.autoScrollEnabled=false,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;let{event:{target:r}}=t;this.props=t,this.listeners=new Rt(Dt(r)),this.windowListeners=new Rt(he(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach();}attach(){this.handleStart(),this.windowListeners.add(ze.Resize,this.handleCancel),this.windowListeners.add(ze.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ze.Keydown,this.handleKeyDown));}handleStart(){let{activeNode:t,onStart:r}=this.props,a=t.node.current;a&&ts(a),r(We);}handleKeyDown(t){if(sr(t)){let{active:r,context:a,options:o}=this.props,{keyboardCodes:i=pa,coordinateGetter:n=as,scrollBehavior:s="smooth"}=o,{code:l}=t;if(i.end.includes(l)){this.handleEnd(t);return}if(i.cancel.includes(l)){this.handleCancel(t);return}let{collisionRect:c}=a.current,d=c?{x:c.left,y:c.top}:We;this.referenceCoordinates||(this.referenceCoordinates=d);let u=n(t,{active:r,context:a.current,currentCoordinates:d});if(u){let p=Yt(u,d),g={x:0,y:0},{scrollableAncestors:b}=a.current;for(let v of b){let w=t.code,{isTop:f,isRight:x,isLeft:y,isBottom:N,maxScroll:C,minScroll:h}=ua(v),k=Qi(v),S={x:Math.min(w===B.Right?k.right-k.width/2:k.right,Math.max(w===B.Right?k.left:k.left+k.width/2,u.x)),y:Math.min(w===B.Down?k.bottom-k.height/2:k.bottom,Math.max(w===B.Down?k.top:k.top+k.height/2,u.y))},I=w===B.Right&&!x||w===B.Left&&!y,R=w===B.Down&&!N||w===B.Up&&!f;if(I&&S.x!==u.x){let m=v.scrollLeft+p.x,F=w===B.Right&&m<=C.x||w===B.Left&&m>=h.x;if(F&&!p.y){v.scrollTo({left:m,behavior:s});return}F?g.x=v.scrollLeft-m:g.x=w===B.Right?v.scrollLeft-C.x:v.scrollLeft-h.x,g.x&&v.scrollBy({left:-g.x,behavior:s});break}else if(R&&S.y!==u.y){let m=v.scrollTop+p.y,F=w===B.Down&&m<=C.y||w===B.Up&&m>=h.y;if(F&&!p.x){v.scrollTo({top:m,behavior:s});return}F?g.y=v.scrollTop-m:g.y=w===B.Down?v.scrollTop-C.y:v.scrollTop-h.y,g.y&&v.scrollBy({top:-g.y,behavior:s});break}}this.handleMove(t,Et(Yt(u,this.referenceCoordinates),g));}}}handleMove(t,r){let{onMove:a}=this.props;t.preventDefault(),a(r);}handleEnd(t){let{onEnd:r}=this.props;t.preventDefault(),this.detach(),r();}handleCancel(t){let{onCancel:r}=this.props;t.preventDefault(),this.detach(),r();}detach(){this.listeners.removeAll(),this.windowListeners.removeAll();}};Wr.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:a=pa,onActivation:o}=t,{active:i}=r,{code:n}=e.nativeEvent;if(a.start.includes(n)){let s=i.activatorNode.current;return s&&e.target!==s?false:(e.preventDefault(),o?.({event:e.nativeEvent}),true)}return false}}];function Yo(e){return !!(e&&"distance"in e)}function Go(e){return !!(e&&"delay"in e)}var dr=class{constructor(t,r,a){var o;a===void 0&&(a=ns(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=true,this.document=void 0,this.activated=false,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;let{event:i}=t,{target:n}=i;this.props=t,this.events=r,this.document=Dt(n),this.documentListeners=new Rt(this.document),this.listeners=new Rt(a),this.windowListeners=new Rt(he(n)),this.initialCoordinates=(o=zr(i))!=null?o:We,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach();}attach(){let{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:a}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:false}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(ze.Resize,this.handleCancel),this.windowListeners.add(ze.DragStart,Vo),this.windowListeners.add(ze.VisibilityChange,this.handleCancel),this.windowListeners.add(ze.ContextMenu,Vo),this.documentListeners.add(ze.Keydown,this.handleKeydown),r){if(a!=null&&a({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Go(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Yo(r)){this.handlePending(r);return}}this.handleStart();}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null);}handlePending(t,r){let{active:a,onPending:o}=this.props;o(a,t,this.initialCoordinates,r);}handleStart(){let{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=true,this.documentListeners.add(ze.Click,os,{capture:true}),this.removeTextSelection(),this.documentListeners.add(ze.SelectionChange,this.removeTextSelection),r(t));}handleMove(t){var r;let{activated:a,initialCoordinates:o,props:i}=this,{onMove:n,options:{activationConstraint:s}}=i;if(!o)return;let l=(r=zr(t))!=null?r:We,c=Yt(o,l);if(!a&&s){if(Yo(s)){if(s.tolerance!=null&&eo(c,s.tolerance))return this.handleCancel();if(eo(c,s.distance))return this.handleStart()}if(Go(s)&&eo(c,s.tolerance))return this.handleCancel();this.handlePending(s,c);return}t.cancelable&&t.preventDefault(),n(l);}handleEnd(){let{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r();}handleCancel(){let{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r();}handleKeydown(t){t.code===B.Esc&&this.handleCancel();}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges();}},is={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},Xt=class extends dr{constructor(t){let{event:r}=t,a=Dt(r.target);super(t,is,a);}};Xt.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:a}=t;return !r.isPrimary||r.button!==0?false:(a?.({event:r}),true)}}];var ss={move:{name:"mousemove"},end:{name:"mouseup"}},no;(function(e){e[e.RightClick=2]="RightClick";})(no||(no={}));var oo=class extends dr{constructor(t){super(t,ss,Dt(t.event.target));}};oo.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:a}=t;return r.button===no.RightClick?false:(a?.({event:r}),true)}}];var to={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}},ao=class extends dr{constructor(t){super(t,to);}static setup(){return window.addEventListener(to.move.name,t,{capture:false,passive:false}),function(){window.removeEventListener(to.move.name,t);};function t(){}}};ao.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:a}=t,{touches:o}=r;return o.length>1?false:(a?.({event:r}),true)}}];var lr;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect";})(lr||(lr={}));var jr;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder";})(jr||(jr={}));function ls(e){let{acceleration:t,activator:r=lr.Pointer,canScroll:a,draggingRect:o,enabled:i,interval:n=5,order:s=jr.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:d,delta:u,threshold:p}=e,g=ds({delta:u,disabled:!i}),[b,v]=Bo(),w=Ge.useRef({x:0,y:0}),f=Ge.useRef({x:0,y:0}),x=Ge.useMemo(()=>{switch(r){case lr.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case lr.DraggableRect:return o}},[r,o,l]),y=Ge.useRef(null),N=Ge.useCallback(()=>{let h=y.current;if(!h)return;let k=w.current.x*f.current.x,S=w.current.y*f.current.y;h.scrollBy(k,S);},[]),C=Ge.useMemo(()=>s===jr.TreeOrder?[...c].reverse():c,[s,c]);Ge.useEffect(()=>{if(!i||!c.length||!x){v();return}for(let h of C){if(a?.(h)===false)continue;let k=c.indexOf(h),S=d[k];if(!S)continue;let{direction:I,speed:R}=Ji(h,S,x,t,p);for(let m of ["x","y"])g[m][I[m]]||(R[m]=0,I[m]=0);if(R.x>0||R.y>0){v(),y.current=h,b(N,n),w.current=R,f.current=I;return}}w.current={x:0,y:0},f.current={x:0,y:0},v();},[t,N,a,v,i,n,JSON.stringify(x),JSON.stringify(g),b,c,C,d,JSON.stringify(p)]);}var cs={x:{[ce.Backward]:false,[ce.Forward]:false},y:{[ce.Backward]:false,[ce.Forward]:false}};function ds(e){let{delta:t,disabled:r}=e,a=Br(t);return Vt(o=>{if(r||!a||!o)return cs;let i={x:Math.sign(t.x-a.x),y:Math.sign(t.y-a.y)};return {x:{[ce.Backward]:o.x[ce.Backward]||i.x===-1,[ce.Forward]:o.x[ce.Forward]||i.x===1},y:{[ce.Backward]:o.y[ce.Backward]||i.y===-1,[ce.Forward]:o.y[ce.Forward]||i.y===1}}},[r,t,a])}function us(e,t){let r=t!=null?e.get(t):void 0,a=r?r.node.current:null;return Vt(o=>{var i;return t==null?null:(i=a??o)!=null?i:null},[a,t])}function ms(e,t){return Ge.useMemo(()=>e.reduce((r,a)=>{let{sensor:o}=a,i=o.activators.map(n=>({eventName:n.eventName,handler:t(n.handler,a)}));return [...r,...i]},[]),[e,t])}var ur;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging";})(ur||(ur={}));var io;(function(e){e.Optimized="optimized";})(io||(io={}));var Xo=new Map;function ps(e,t){let{dragging:r,dependencies:a,config:o}=t,[i,n]=Ge.useState(null),{frequency:s,measure:l,strategy:c}=o,d=Ge.useRef(e),u=w(),p=qt(u),g=Ge.useCallback(function(f){f===void 0&&(f=[]),!p.current&&n(x=>x===null?f:x.concat(f.filter(y=>!x.includes(y))));},[p]),b=Ge.useRef(null),v=Vt(f=>{if(u&&!r)return Xo;if(!f||f===Xo||d.current!==e||i!=null){let x=new Map;for(let y of e){if(!y)continue;if(i&&i.length>0&&!i.includes(y.id)&&y.rect.current){x.set(y.id,y.rect.current);continue}let N=y.node.current,C=N?new cr(l(N),N):null;y.rect.current=C,C&&x.set(y.id,C);}return x}return f},[e,i,r,u,l]);return Ge.useEffect(()=>{d.current=e;},[e]),Ge.useEffect(()=>{u||g();},[r,u]),Ge.useEffect(()=>{i&&i.length>0&&n(null);},[JSON.stringify(i)]),Ge.useEffect(()=>{u||typeof s!="number"||b.current!==null||(b.current=setTimeout(()=>{g(),b.current=null;},s));},[s,u,g,...a]),{droppableRects:v,measureDroppableContainers:g,measuringScheduled:i!=null};function w(){switch(c){case ur.Always:return false;case ur.BeforeDragging:return r;default:return !r}}}function ga(e,t){return Vt(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function gs(e,t){return ga(e,t)}function fs(e){let{callback:t,disabled:r}=e,a=Lr(t),o=Ge.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:i}=window;return new i(a)},[a,r]);return Ge.useEffect(()=>()=>o?.disconnect(),[o]),o}function qr(e){let{callback:t,disabled:r}=e,a=Lr(t),o=Ge.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:i}=window;return new i(a)},[r]);return Ge.useEffect(()=>()=>o?.disconnect(),[o]),o}function ys(e){return new cr(Pt(e),e)}function Ko(e,t,r){t===void 0&&(t=ys);let[a,o]=Ge.useState(null);function i(){o(l=>{if(!e)return null;if(e.isConnected===false){var c;return (c=l??r)!=null?c:null}let d=t(e);return JSON.stringify(l)===JSON.stringify(d)?l:d});}let n=fs({callback(l){if(e)for(let c of l){let{type:d,target:u}=c;if(d==="childList"&&u instanceof HTMLElement&&u.contains(e)){i();break}}}}),s=qr({callback:i});return Be(()=>{i(),e?(s?.observe(e),n?.observe(document.body,{childList:true,subtree:true})):(s?.disconnect(),n?.disconnect());},[e]),a}function bs(e){let t=ga(e);return ia(e,t)}var Jo=[];function hs(e){let t=Ge.useRef(e),r=Vt(a=>e?a&&a!==Jo&&e&&t.current&&e.parentNode===t.current.parentNode?a:_r(e):Jo,[e]);return Ge.useEffect(()=>{t.current=e;},[e]),r}function xs(e){let[t,r]=Ge.useState(null),a=Ge.useRef(e),o=Ge.useCallback(i=>{let n=Zn(i.target);n&&r(s=>s?(s.set(n,ro(n)),new Map(s)):null);},[]);return Ge.useEffect(()=>{let i=a.current;if(e!==i){n(i);let s=e.map(l=>{let c=Zn(l);return c?(c.addEventListener("scroll",o,{passive:true}),[c,ro(c)]):null}).filter(l=>l!=null);r(s.length?new Map(s):null),a.current=e;}return ()=>{n(e),n(i);};function n(s){s.forEach(l=>{let c=Zn(l);c?.removeEventListener("scroll",o);});}},[o,e]),Ge.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,n)=>Et(i,n),We):ma(e):We,[e,t])}function Qo(e,t){t===void 0&&(t=[]);let r=Ge.useRef(null);return Ge.useEffect(()=>{r.current=null;},t),Ge.useEffect(()=>{let a=e!==We;a&&!r.current&&(r.current=e),!a&&r.current&&(r.current=null);},[e]),r.current?Yt(e,r.current):We}function vs(e){Ge.useEffect(()=>{if(!ar)return;let t=e.map(r=>{let{sensor:a}=r;return a.setup==null?void 0:a.setup()});return ()=>{for(let r of t)r?.();}},e.map(t=>{let{sensor:r}=t;return r}));}function ws(e,t){return Ge.useMemo(()=>e.reduce((r,a)=>{let{eventName:o,handler:i}=a;return r[o]=n=>{i(n,t);},r},{}),[e,t])}function fa(e){return Ge.useMemo(()=>e?Yi(e):null,[e])}var Zo=[];function Ns(e,t){t===void 0&&(t=Pt);let[r]=e,a=fa(r?he(r):null),[o,i]=Ge.useState(Zo);function n(){i(()=>e.length?e.map(l=>da(l)?a:new cr(t(l),l)):Zo);}let s=qr({callback:n});return Be(()=>{s?.disconnect(),n(),e.forEach(l=>s?.observe(l));},[e]),o}function Cs(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return _t(t)?t:e}function Ss(e){let{measure:t}=e,[r,a]=Ge.useState(null),o=Ge.useCallback(c=>{for(let{target:d}of c)if(_t(d)){a(u=>{let p=t(d);return u?{...u,width:p.width,height:p.height}:p});break}},[t]),i=qr({callback:o}),n=Ge.useCallback(c=>{let d=Cs(c);i?.disconnect(),d&&i?.observe(d),a(d?t(d):null);},[t,i]),[s,l]=ir(n);return Ge.useMemo(()=>({nodeRef:s,rect:r,setRef:l}),[r,s,l])}var ks=[{sensor:Xt,options:{}},{sensor:Wr,options:{}}],Fs={current:{}},Hr={draggable:{measure:qo},droppable:{measure:qo,strategy:ur.WhileDragging,frequency:io.Optimized},dragOverlay:{measure:Pt}},Tt=class extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return !r})}getNodeFor(t){var r,a;return (r=(a=this.get(t))==null?void 0:a.node.current)!=null?r:void 0}},Ds={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Tt,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Ur},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Hr,measureDroppableContainers:Ur,windowRect:null,measuringScheduled:false},Is={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Ur,draggableNodes:new Map,over:null,measureDroppableContainers:Ur},Vr=Ge.createContext(Is),ya=Ge.createContext(Ds);function Es(){return {draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Tt}}}function Rs(e,t){switch(t.type){case oe.DragStart:return {...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case oe.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case oe.DragEnd:case oe.DragCancel:return {...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case oe.RegisterDroppable:{let{element:r}=t,{id:a}=r,o=new Tt(e.droppable.containers);return o.set(a,r),{...e,droppable:{...e.droppable,containers:o}}}case oe.SetDroppableDisabled:{let{id:r,key:a,disabled:o}=t,i=e.droppable.containers.get(r);if(!i||a!==i.key)return e;let n=new Tt(e.droppable.containers);return n.set(r,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:n}}}case oe.UnregisterDroppable:{let{id:r,key:a}=t,o=e.droppable.containers.get(r);if(!o||a!==o.key)return e;let i=new Tt(e.droppable.containers);return i.delete(r),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function Ts(e){let{disabled:t}=e,{active:r,activatorEvent:a,draggableNodes:o}=Ge.useContext(Vr),i=Br(a),n=Br(r?.id);return Ge.useEffect(()=>{if(!t&&!a&&i&&n!=null){if(!sr(i)||document.activeElement===i.target)return;let s=o.get(n);if(!s)return;let{activatorNode:l,node:c}=s;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(let d of [l.current,c.current]){if(!d)continue;let u=Oo(d);if(u){u.focus();break}}});}},[a,t,o,n,i]),null}function Ps(e,t){let{transform:r,...a}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...a}),r):r}function As(e){return Ge.useMemo(()=>({draggable:{...Hr.draggable,...e?.draggable},droppable:{...Hr.droppable,...e?.droppable},dragOverlay:{...Hr.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Ms(e){let{activeNode:t,measure:r,initialRect:a,config:o=true}=e,i=Ge.useRef(false),{x:n,y:s}=typeof o=="boolean"?{x:o,y:o}:o;Be(()=>{if(!n&&!s||!t){i.current=false;return}if(i.current||!a)return;let c=t?.node.current;if(!c||c.isConnected===false)return;let d=r(c),u=ia(d,a);if(n||(u.x=0),s||(u.y=0),i.current=true,Math.abs(u.x)>0||Math.abs(u.y)>0){let p=sa(c);p&&p.scrollBy({top:u.y,left:u.x});}},[t,n,s,a,r]);}var ba=Ge.createContext({...We,scaleX:1,scaleY:1}),yt;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized";})(yt||(yt={}));var ha=Ge.memo(function(t){var r,a,o,i;let{id:n,accessibility:s,autoScroll:l=true,children:c,sensors:d=ks,collisionDetection:u=Hi,measuring:p,modifiers:g,...b}=t,v=Ge.useReducer(Rs,void 0,Es),[w,f]=v,[x,y]=Pi(),[N,C]=Ge.useState(yt.Uninitialized),h=N===yt.Initialized,{draggable:{active:k,nodes:S,translate:I},droppable:{containers:R}}=w,m=k!=null?S.get(k):null,F=Ge.useRef({initial:null,translated:null}),M=Ge.useMemo(()=>{var pe;return k!=null?{id:k,data:(pe=m?.data)!=null?pe:Fs,rect:F}:null},[k,m]),A=Ge.useRef(null),[D,T]=Ge.useState(null),[P,z]=Ge.useState(null),K=qt(b,Object.values(b)),Y=It("DndDescribedBy",n),Te=Ge.useMemo(()=>R.getEnabled(),[R]),U=As(p),{droppableRects:ie,measureDroppableContainers:Xe,measuringScheduled:ot}=ps(Te,{dragging:h,dependencies:[I.x,I.y],config:U.droppable}),xe=us(S,k),At=Ge.useMemo(()=>P?zr(P):null,[P]),je=La(),fe=gs(xe,U.draggable.measure);Ms({activeNode:k!=null?S.get(k):null,config:je.layoutShiftCompensation,initialRect:fe,measure:U.draggable.measure});let O=Ko(xe,U.draggable.measure,fe),Mt=Ko(xe?xe.parentElement:null),Ne=Ge.useRef({activatorEvent:null,active:null,activeNode:xe,collisionRect:null,collisions:null,droppableRects:ie,draggableNodes:S,draggingNode:null,draggingNodeRect:null,droppableContainers:R,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),J=R.getNodeFor((r=Ne.current.over)==null?void 0:r.id),re=Ss({measure:U.dragOverlay.measure}),at=(a=re.nodeRef.current)!=null?a:xe,it=h?(o=re.rect)!=null?o:O:null,gr=!!(re.nodeRef.current&&re.rect),Kt=bs(gr?null:O),$t=fa(at?he(at):null),Ce=hs(h?J??xe:null),bt=Ns(Ce),Lt=Ps(g,{transform:{x:I.x-Kt.x,y:I.y-Kt.y,scaleX:1,scaleY:1},activatorEvent:P,active:M,activeNodeRect:O,containerNodeRect:Mt,draggingNodeRect:it,over:Ne.current.over,overlayNodeRect:re.rect,scrollableAncestors:Ce,scrollableAncestorRects:bt,windowRect:$t}),fr=At?Et(At,I):null,yr=xs(Ce),Jt=Qo(yr),Zr=Qo(yr,[O]),st=Et(Lt,Jt),E=it?ji(it,Lt):null,W=M&&E?u({active:M,collisionRect:E,droppableRects:ie,droppableContainers:Te,pointerCoordinates:fr}):null,_=oa(W,"id"),[ye,br]=Ge.useState(null),hr=gr?Lt:Et(Lt,Zr),se=Ui(hr,(i=ye?.rect)!=null?i:null,O),Pe=Ge.useRef(null),uo=Ge.useCallback((pe,Se)=>{let{sensor:ke,options:lt}=Se;if(A.current==null)return;let Ae=S.get(A.current);if(!Ae)return;let Fe=pe.nativeEvent,_e=new ke({active:A.current,activeNode:Ae,event:Fe,options:lt,context:Ne,onAbort(de){if(!S.get(de))return;let{onDragAbort:qe}=K.current,Ke={id:de};qe?.(Ke),x({type:"onDragAbort",event:Ke});},onPending(de,ct,qe,Ke){if(!S.get(de))return;let{onDragPending:Zt}=K.current,dt={id:de,constraint:ct,initialCoordinates:qe,offset:Ke};Zt?.(dt),x({type:"onDragPending",event:dt});},onStart(de){let ct=A.current;if(ct==null)return;let qe=S.get(ct);if(!qe)return;let{onDragStart:Ke}=K.current,Qt={activatorEvent:Fe,active:{id:ct,data:qe.data,rect:F}};reactDom.unstable_batchedUpdates(()=>{Ke?.(Qt),C(yt.Initializing),f({type:oe.DragStart,initialCoordinates:de,active:ct}),x({type:"onDragStart",event:Qt}),T(Pe.current),z(Fe);});},onMove(de){f({type:oe.DragMove,coordinates:de});},onEnd:Bt(oe.DragEnd),onCancel:Bt(oe.DragCancel)});Pe.current=_e;function Bt(de){return async function(){let{active:qe,collisions:Ke,over:Qt,scrollAdjustedTranslate:Zt}=Ne.current,dt=null;if(qe&&Zt){let{cancelDrop:er}=K.current;dt={activatorEvent:Fe,active:qe,collisions:Ke,delta:Zt,over:Qt},de===oe.DragEnd&&typeof er=="function"&&await Promise.resolve(er(dt))&&(de=oe.DragCancel);}A.current=null,reactDom.unstable_batchedUpdates(()=>{f({type:de}),C(yt.Uninitialized),br(null),T(null),z(null),Pe.current=null;let er=de===oe.DragEnd?"onDragEnd":"onDragCancel";if(dt){let en=K.current[er];en?.(dt),x({type:er,event:dt});}});}}},[S]),Aa=Ge.useCallback((pe,Se)=>(ke,lt)=>{let Ae=ke.nativeEvent,Fe=S.get(lt);if(A.current!==null||!Fe||Ae.dndKit||Ae.defaultPrevented)return;let _e={active:Fe};pe(ke,Se.options,_e)===true&&(Ae.dndKit={capturedBy:Se.sensor},A.current=lt,uo(ke,Se));},[S,uo]),mo=ms(d,Aa);vs(d),Be(()=>{O&&N===yt.Initializing&&C(yt.Initialized);},[O,N]),Ge.useEffect(()=>{let{onDragMove:pe}=K.current,{active:Se,activatorEvent:ke,collisions:lt,over:Ae}=Ne.current;if(!Se||!ke)return;let Fe={active:Se,activatorEvent:ke,collisions:lt,delta:{x:st.x,y:st.y},over:Ae};reactDom.unstable_batchedUpdates(()=>{pe?.(Fe),x({type:"onDragMove",event:Fe});});},[st.x,st.y]),Ge.useEffect(()=>{let{active:pe,activatorEvent:Se,collisions:ke,droppableContainers:lt,scrollAdjustedTranslate:Ae}=Ne.current;if(!pe||A.current==null||!Se||!Ae)return;let{onDragOver:Fe}=K.current,_e=lt.get(_),Bt=_e&&_e.rect.current?{id:_e.id,rect:_e.rect.current,data:_e.data,disabled:_e.disabled}:null,de={active:pe,activatorEvent:Se,collisions:ke,delta:{x:Ae.x,y:Ae.y},over:Bt};reactDom.unstable_batchedUpdates(()=>{br(Bt),Fe?.(de),x({type:"onDragOver",event:de});});},[_]),Be(()=>{Ne.current={activatorEvent:P,active:M,activeNode:xe,collisionRect:E,collisions:W,droppableRects:ie,draggableNodes:S,draggingNode:at,draggingNodeRect:it,droppableContainers:R,over:ye,scrollableAncestors:Ce,scrollAdjustedTranslate:st},F.current={initial:it,translated:E};},[M,xe,W,E,S,at,it,ie,R,ye,Ce,st]),ls({...je,delta:I,draggingRect:E,pointerCoordinates:fr,scrollableAncestors:Ce,scrollableAncestorRects:bt});let Ma=Ge.useMemo(()=>({active:M,activeNode:xe,activeNodeRect:O,activatorEvent:P,collisions:W,containerNodeRect:Mt,dragOverlay:re,draggableNodes:S,droppableContainers:R,droppableRects:ie,over:ye,measureDroppableContainers:Xe,scrollableAncestors:Ce,scrollableAncestorRects:bt,measuringConfiguration:U,measuringScheduled:ot,windowRect:$t}),[M,xe,O,P,W,Mt,re,S,R,ie,ye,Xe,Ce,bt,U,ot,$t]),$a=Ge.useMemo(()=>({activatorEvent:P,activators:mo,active:M,activeNodeRect:O,ariaDescribedById:{draggable:Y},dispatch:f,draggableNodes:S,over:ye,measureDroppableContainers:Xe}),[P,mo,M,O,f,Y,S,ye,Xe]);return Ge__default.default.createElement(ta.Provider,{value:y},Ge__default.default.createElement(Vr.Provider,{value:$a},Ge__default.default.createElement(ya.Provider,{value:Ma},Ge__default.default.createElement(ba.Provider,{value:se},c)),Ge__default.default.createElement(Ts,{disabled:s?.restoreFocus===false})),Ge__default.default.createElement($i,{...s,hiddenTextDescribedById:Y}));function La(){let pe=D?.autoScrollEnabled===false,Se=typeof l=="object"?l.enabled===false:l===false,ke=h&&!pe&&!Se;return typeof l=="object"?{...l,enabled:ke}:{enabled:ke}}}),$s=Ge.createContext(null),ea="button",Ls="Draggable";function xa(e){let{id:t,data:r,disabled:a=false,attributes:o}=e,i=It(Ls),{activators:n,activatorEvent:s,active:l,activeNodeRect:c,ariaDescribedById:d,draggableNodes:u,over:p}=Ge.useContext(Vr),{role:g=ea,roleDescription:b="draggable",tabIndex:v=0}=o??{},w=l?.id===t,f=Ge.useContext(w?ba:$s),[x,y]=ir(),[N,C]=ir(),h=ws(n,t),k=qt(r);Be(()=>(u.set(t,{id:t,key:i,node:x,activatorNode:N,data:k}),()=>{let I=u.get(t);I&&I.key===i&&u.delete(t);}),[u,t]);let S=Ge.useMemo(()=>({role:g,tabIndex:v,"aria-disabled":a,"aria-pressed":w&&g===ea?true:void 0,"aria-roledescription":b,"aria-describedby":d.draggable}),[a,g,v,w,b,d.draggable]);return {active:l,activatorEvent:s,activeNodeRect:c,attributes:S,isDragging:w,listeners:a?void 0:h,node:x,over:p,setNodeRef:y,setActivatorNodeRef:C,transform:f}}function va(){return Ge.useContext(ya)}var Bs="Droppable",zs={timeout:25};function wa(e){let{data:t,disabled:r=false,id:a,resizeObserverConfig:o}=e,i=It(Bs),{active:n,dispatch:s,over:l,measureDroppableContainers:c}=Ge.useContext(Vr),d=Ge.useRef({disabled:r}),u=Ge.useRef(false),p=Ge.useRef(null),g=Ge.useRef(null),{disabled:b,updateMeasurementsFor:v,timeout:w}={...zs,...o},f=qt(v??a),x=Ge.useCallback(()=>{if(!u.current){u.current=true;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{c(Array.isArray(f.current)?f.current:[f.current]),g.current=null;},w);},[w]),y=qr({callback:x,disabled:b||!n}),N=Ge.useCallback((S,I)=>{y&&(I&&(y.unobserve(I),u.current=false),S&&y.observe(S));},[y]),[C,h]=ir(N),k=qt(t);return Ge.useEffect(()=>{!y||!C.current||(y.disconnect(),u.current=false,y.observe(C.current));},[C,y]),Ge.useEffect(()=>(s({type:oe.RegisterDroppable,element:{id:a,key:i,disabled:r,node:C,rect:p,data:k}}),()=>s({type:oe.UnregisterDroppable,key:i,id:a})),[a]),Ge.useEffect(()=>{r!==d.current.disabled&&(s({type:oe.SetDroppableDisabled,id:a,key:i,disabled:r}),d.current.disabled=r);},[a,i,r,s]),{active:n,rect:p,isOver:l?.id===a,node:C,over:l,setNodeRef:h}}function Ca(e,t,r){let a=e.slice();return a.splice(r<0?a.length+r:r,0,a.splice(t,1)[0]),a}function Us(e,t){return e.reduce((r,a,o)=>{let i=t.get(a);return i&&(r[o]=i),r},Array(e.length))}function Yr(e){return e!==null&&e>=0}function Ws(e,t){if(e===t)return true;if(e.length!==t.length)return false;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return false;return true}function js(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}var Sa=e=>{let{rects:t,activeIndex:r,overIndex:a,index:o}=e,i=Ca(t,a,r),n=t[o],s=i[o];return !s||!n?null:{x:s.left-n.left,y:s.top-n.top,scaleX:s.width/n.width,scaleY:s.height/n.height}};var Gr={scaleX:1,scaleY:1},ka=e=>{var t;let{activeIndex:r,activeNodeRect:a,index:o,rects:i,overIndex:n}=e,s=(t=i[r])!=null?t:a;if(!s)return null;if(o===r){let c=i[n];return c?{x:0,y:r<n?c.top+c.height-(s.top+s.height):c.top-s.top,...Gr}:null}let l=_s(i,o,r);return o>r&&o<=n?{x:0,y:-s.height-l,...Gr}:o<r&&o>=n?{x:0,y:s.height+l,...Gr}:{x:0,y:0,...Gr}};function _s(e,t,r){let a=e[t],o=e[t-1],i=e[t+1];return a?r<t?o?a.top-(o.top+o.height):i?i.top-(a.top+a.height):0:i?i.top-(a.top+a.height):o?a.top-(o.top+o.height):0:0}var Fa="Sortable",Da=Ge__default.default.createContext({activeIndex:-1,containerId:Fa,disableTransforms:false,items:[],overIndex:-1,useDragOverlay:false,sortedRects:[],strategy:Sa,disabled:{draggable:false,droppable:false}});function Ia(e){let{children:t,id:r,items:a,strategy:o=Sa,disabled:i=false}=e,{active:n,dragOverlay:s,droppableRects:l,over:c,measureDroppableContainers:d}=va(),u=It(Fa,r),p=s.rect!==null,g=Ge.useMemo(()=>a.map(h=>typeof h=="object"&&"id"in h?h.id:h),[a]),b=n!=null,v=n?g.indexOf(n.id):-1,w=c?g.indexOf(c.id):-1,f=Ge.useRef(g),x=!Ws(g,f.current),y=w!==-1&&v===-1||x,N=js(i);Be(()=>{x&&b&&d(g);},[x,g,b,d]),Ge.useEffect(()=>{f.current=g;},[g]);let C=Ge.useMemo(()=>({activeIndex:v,containerId:u,disabled:N,disableTransforms:y,items:g,overIndex:w,useDragOverlay:p,sortedRects:Us(g,l),strategy:o}),[v,u,N.draggable,N.droppable,y,g,w,l,p,o]);return Ge__default.default.createElement(Da.Provider,{value:C},t)}var qs=e=>{let{id:t,items:r,activeIndex:a,overIndex:o}=e;return Ca(r,a,o).indexOf(t)},Vs=e=>{let{containerId:t,isSorting:r,wasDragging:a,index:o,items:i,newIndex:n,previousItems:s,previousContainerId:l,transition:c}=e;return !c||!a||s!==i&&o===n?false:r?true:n!==o&&t===l},Ys={duration:200,easing:"ease"},Ea="transform",Gs=ft.Transition.toString({property:Ea,duration:0,easing:"linear"}),Xs={roleDescription:"sortable"};function Ks(e){let{disabled:t,index:r,node:a,rect:o}=e,[i,n]=Ge.useState(null),s=Ge.useRef(r);return Be(()=>{if(!t&&r!==s.current&&a.current){let l=o.current;if(l){let c=Pt(a.current,{ignoreTransform:true}),d={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(d.x||d.y)&&n(d);}}r!==s.current&&(s.current=r);},[t,r,a,o]),Ge.useEffect(()=>{i&&n(null);},[i]),i}function Ra(e){let{animateLayoutChanges:t=Vs,attributes:r,disabled:a,data:o,getNewIndex:i=qs,id:n,strategy:s,resizeObserverConfig:l,transition:c=Ys}=e,{items:d,containerId:u,activeIndex:p,disabled:g,disableTransforms:b,sortedRects:v,overIndex:w,useDragOverlay:f,strategy:x}=Ge.useContext(Da),y=Js(a,g),N=d.indexOf(n),C=Ge.useMemo(()=>({sortable:{containerId:u,index:N,items:d},...o}),[u,o,N,d]),h=Ge.useMemo(()=>d.slice(d.indexOf(n)),[d,n]),{rect:k,node:S,isOver:I,setNodeRef:R}=wa({id:n,data:C,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:h,...l}}),{active:m,activatorEvent:F,activeNodeRect:M,attributes:A,setNodeRef:D,listeners:T,isDragging:P,over:z,setActivatorNodeRef:K,transform:Y}=xa({id:n,data:C,attributes:{...Xs,...r},disabled:y.draggable}),Te=Lo(R,D),U=!!m,ie=U&&!b&&Yr(p)&&Yr(w),Xe=!f&&P,ot=Xe&&ie?Y:null,At=ie?ot??(s??x)({rects:v,activeNodeRect:M,activeIndex:p,overIndex:w,index:N}):null,je=Yr(p)&&Yr(w)?i({id:n,items:d,activeIndex:p,overIndex:w}):N,fe=m?.id,O=Ge.useRef({activeId:fe,items:d,newIndex:je,containerId:u}),Mt=d!==O.current.items,Ne=t({active:m,containerId:u,isDragging:P,isSorting:U,id:n,index:N,items:d,newIndex:O.current.newIndex,previousItems:O.current.items,previousContainerId:O.current.containerId,transition:c,wasDragging:O.current.activeId!=null}),J=Ks({disabled:!Ne,index:N,node:S,rect:k});return Ge.useEffect(()=>{U&&O.current.newIndex!==je&&(O.current.newIndex=je),u!==O.current.containerId&&(O.current.containerId=u),d!==O.current.items&&(O.current.items=d);},[U,je,u,d]),Ge.useEffect(()=>{if(fe===O.current.activeId)return;if(fe!=null&&O.current.activeId==null){O.current.activeId=fe;return}let at=setTimeout(()=>{O.current.activeId=fe;},50);return ()=>clearTimeout(at)},[fe]),{active:m,activeIndex:p,attributes:A,data:C,rect:k,index:N,newIndex:je,items:d,isOver:I,isSorting:U,isDragging:P,listeners:T,node:S,overIndex:w,over:z,setNodeRef:Te,setActivatorNodeRef:K,setDroppableNodeRef:R,setDraggableNodeRef:D,transform:J??At,transition:re()};function re(){if(J||Mt&&O.current.newIndex===N)return Gs;if(!(Xe&&!sr(F)||!c)&&(U||Ne))return ft.Transition.toString({...c,property:Ea})}}function Js(e,t){var r,a;return typeof e=="boolean"?{draggable:e,droppable:false}:{draggable:(r=e?.draggable)!=null?r:t.draggable,droppable:(a=e?.droppable)!=null?a:t.droppable}}[B.Down,B.Right,B.Up,B.Left];function Zs({field:e,value:t,error:r,onChange:a,businessId:o,formId:i,styling:n}){let{attributes:s,listeners:l,setNodeRef:c,transform:d,transition:u,isDragging:p}=Ra({id:e.id}),g={transform:ft.Transform.toString(d),transition:u,opacity:p?.5:1};return jsxRuntime.jsxs("div",{ref:c,style:g,className:`relative group ${p?"z-50":""}`,children:[jsxRuntime.jsx("div",{...s,...l,className:"absolute -left-8 top-1/2 -translate-y-1/2 z-50 opacity-0 group-hover:opacity-100 transition-opacity cursor-grab active:cursor-grabbing",onClick:b=>b.stopPropagation(),children:jsxRuntime.jsx("div",{className:"flex items-center gap-1 bg-[#BCB4FF] text-black px-1.5 py-1 rounded-md shadow-lg border border-black/10",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-3 h-3"})})}),jsxRuntime.jsx("div",{className:"absolute inset-0 pointer-events-none transition-all rounded-lg group-hover:border border-[#BCB4FF]/30"}),jsxRuntime.jsx("div",{style:{pointerEvents:"auto"},children:jsxRuntime.jsx(Pr,{field:e,value:t,error:r,onChange:a,businessId:o,formId:i,styling:n})})]})}function Jr({block:e,formData:t,errors:r,onChange:a,businessId:o,formId:i,styling:n,previewMode:s,onFieldReorder:l}){let c=na(ra(Xt,{activationConstraint:{distance:8}})),d=u=>{let{active:p,over:g}=u;if(g&&p.id!==g.id&&l&&e.fields){let b=e.fields.findIndex(w=>w.id===p.id),v=e.fields.findIndex(w=>w.id===g.id);l(e.id,b,v);}};if(e.type==="section"){let u=e.fields||[];return s&&l?jsxRuntime.jsxs("div",{className:"border rounded-lg p-6",style:{backgroundColor:n?.sectionBackground||"#FFFFFF",borderColor:n?.fieldBorder?`${n.fieldBorder}30`:"#E5E7EB"},children:[e.title&&jsxRuntime.jsx("h2",{className:"text-xl font-semibold mb-2",style:{color:n?.labelColor||"#000000"},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"text-sm mb-6",style:{color:n?.textColor||"#000000"},children:e.description}),jsxRuntime.jsx(ha,{sensors:c,collisionDetection:aa,onDragEnd:d,children:jsxRuntime.jsx(Ia,{items:u.map(p=>p.id),strategy:ka,children:jsxRuntime.jsx("div",{className:"space-y-4",children:u.map(p=>jsxRuntime.jsx(Zs,{field:p,value:t[p.id],error:r[p.id],onChange:g=>a(p.id,g,p),businessId:o,formId:i,styling:n},p.id))})})})]}):jsxRuntime.jsxs("div",{className:"border rounded-lg p-6",style:{backgroundColor:n?.sectionBackground||"#FFFFFF",borderColor:n?.fieldBorder?`${n.fieldBorder}30`:"#E5E7EB"},children:[e.title&&jsxRuntime.jsx("h2",{className:"text-xl font-semibold mb-2",style:{color:n?.labelColor||"#000000"},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"text-sm mb-6",style:{color:n?.textColor||"#000000"},children:e.description}),jsxRuntime.jsx("div",{className:"space-y-4",children:u.map(p=>jsxRuntime.jsx(Pr,{field:p,value:t[p.id],error:r[p.id],onChange:g=>a(p.id,g,p),businessId:o,formId:i,styling:n},p.id))})]})}if(e.type==="text"){let u={left:"text-left",center:"text-center",right:"text-right"}[e.alignment||"left"];return jsxRuntime.jsx("div",{className:`prose prose-gray max-w-none ${u}`,children:jsxRuntime.jsx("p",{className:"whitespace-pre-wrap",style:{color:n?.textColor||"#000000"},children:e.content})})}if(e.type==="image"&&e.imageUrl){let u=e.imageSize||"medium",p=u==="full",g=p?"":{left:"mr-auto",center:"mx-auto",right:"ml-auto"}[e.alignment||"center"],b={small:"300px",medium:"500px",large:"700px"},v=p?"none":b[u]||b.medium,w={none:"0",sm:"0.25rem",md:"0.375rem",lg:"0.5rem",xl:"0.75rem",full:"9999px"},f=w[e.borderRadius]||w.lg,x={maxWidth:v,...p&&{width:"100vw",marginLeft:"50%",transform:"translateX(-50%)"}};return jsxRuntime.jsx("div",{className:g,style:x,children:jsxRuntime.jsx("img",{src:e.imageUrl,alt:"",className:"w-full h-auto",style:{borderRadius:f,objectFit:"cover"}})})}return null}function co(e,t){if(t.required){if(e==null||e==="")return {isValid:false,error:`${t.label} is required`};if(Array.isArray(e)&&e.length===0)return {isValid:false,error:`Please select at least one ${t.label.toLowerCase()}`};if(t.type==="photo"&&!e.data)return {isValid:false,error:`${t.label} is required`}}if(t.type==="email"&&e&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e))return {isValid:false,error:"Please enter a valid email address"};if(t.type==="tel"&&e&&(!/^[\d\s\-\+\(\)]+$/.test(e)||e.replace(/\D/g,"").length<10))return {isValid:false,error:"Please enter a valid phone number"};if(t.type==="date"&&e){let r=new Date(e);if(isNaN(r.getTime()))return {isValid:false,error:"Please enter a valid date"}}return {isValid:true}}function Ta(e,t){let r={},a=true;return t.forEach(o=>{let i=co(e[o.id],o);!i.isValid&&i.error&&(r[o.id]=i.error,a=false);}),{isValid:a,errors:r}}function $u(e){let t={};return Object.keys(e).forEach(r=>{let a=e[r];typeof a=="string"?t[r]=a.trim():(Array.isArray(a)||a&&typeof a=="object"&&a.data,t[r]=a);}),t}function Pa({form:e,businessId:t,onSuccess:r}){let[a,o]=Ge.useState({}),[i,n]=Ge.useState({}),[s,l]=Ge.useState(false),[c,d]=Ge.useState(false),[u,p]=Ge.useState(null),g=(x,y,N)=>{if(o(C=>({...C,[x]:y})),i[x]){let C=co(y,N);n(h=>{let k={...h};return C.isValid?delete k[x]:k[x]=C.error||"",k});}},b=async x=>{x.preventDefault(),p(null);let y=[];e.settings.blocks.forEach(C=>{C.type==="section"&&C.fields&&y.push(...C.fields);});let N=Ta(a,y);if(!N.isValid){n(N.errors);return}l(true);try{let h=typeof window<"u"&&undefined?"/api/forms/submit":`/api/studio/forms/${t}/${e.slug}/submit`,k=await fetch(h,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({formId:e.id,slug:e.slug,data:a})});if(!k.ok){let S=await k.json();throw new Error(S.message||"Failed to submit form")}d(!0),o({}),n({}),r&&r();}catch(C){console.error("Form submission error:",C),p(C.message||"Failed to submit form. Please try again.");}finally{l(false);}};if(c)return jsxRuntime.jsx("div",{className:"max-w-2xl mx-auto px-4 py-12",children:jsxRuntime.jsxs("div",{className:"bg-green-50 border border-green-200 rounded-lg p-8 text-center",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-4",children:jsxRuntime.jsx("svg",{className:"w-8 h-8 text-green-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),jsxRuntime.jsx("h3",{className:"text-xl font-semibold mb-2",style:{color:e.settings.styling?.labelColor||"#000000"},children:"Success!"}),jsxRuntime.jsx("p",{style:{color:e.settings.styling?.textColor||"#000000"},children:e.settings.successMessage}),jsxRuntime.jsx("button",{onClick:()=>d(false),className:"mt-6 px-4 py-2 bg-gray-900 text-white rounded-lg hover:bg-gray-800 transition-colors",children:"Submit Another Response"})]})});let v=e.settings.styling?.alignment||"left",w=v==="center"?"text-center":v==="right"?"text-right":"text-left",f=e.settings.styling?.buttonColor||"#CAC426";return jsxRuntime.jsxs("div",{className:"max-w-2xl mx-auto px-4 py-12",children:[jsxRuntime.jsxs("div",{className:`mb-8 ${w}`,children:[jsxRuntime.jsx("h1",{className:"text-3xl font-bold mb-2",style:{color:e.settings.styling?.textColor||"#000000"},children:e.settings.title}),e.settings.description&&jsxRuntime.jsx("p",{style:{color:e.settings.styling?.textColor||"#000000"},children:e.settings.description})]}),jsxRuntime.jsxs("form",{onSubmit:b,className:"space-y-8",children:[e.settings.blocks.map(x=>jsxRuntime.jsx(Jr,{block:x,formData:a,errors:i,onChange:g,businessId:t,formId:e.id,styling:e.settings.styling},x.id)),u&&jsxRuntime.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4",children:jsxRuntime.jsx("p",{className:"text-sm text-red-600",children:u})}),jsxRuntime.jsx("div",{className:"pt-6",children:jsxRuntime.jsx("button",{type:"submit",disabled:s,className:"w-full px-6 py-3 text-white rounded-lg disabled:opacity-50 disabled:cursor-not-allowed transition-all font-medium hover:opacity-90",style:{backgroundColor:f},children:s?"Submitting...":e.settings.submitButtonText})})]})]})}exports.About=dn;exports.AddonsSelection=Wn;exports.BeforeAfter=Cn;exports.BookingFlow=Ro;exports.BookingSection=En;exports.BottomSheet=jn;exports.CYCLE_PHASES=Io;exports.Confirmation=Yn;exports.Contact=yn;exports.ContactForm=Vn;exports.CycleAwareDateSelection=pi;exports.DateSelection=nr;exports.FAQSection=$n;exports.FeatureContent=wn;exports.FeaturedLink=on;exports.FixedInfoCard=In;exports.FormBlock=Jr;exports.FormRenderer=Pa;exports.Gallery=mn;exports.Header=nn;exports.Hero=cn;exports.HoldTimer=Rr;exports.ImageSection=Mn;exports.InstagramFeed=Fn;exports.LinkList=sn;exports.LocationMap=An;exports.Logo=tn;exports.MinimalFooter=vn;exports.MinimalHeader=bn;exports.MinimalNavigation=xn;exports.Navbar=Bn;exports.PricingTable=Sn;exports.ScrollingTextDivider=Pn;exports.SectionRenderer=yi;exports.ServiceSelection=On;exports.ServicesPreview=un;exports.SocialBar=ln;exports.Team=fn;exports.Testimonials=gn;exports.TextSection=zn;exports.TimeSelection=Hn;exports.VideoSection=Rn;exports.animations=rr;exports.createEntranceAnimation=ge;exports.createStaggerAnimation=zc;exports.getAnimationDuration=$c;exports.getFadeVariants=Qa;exports.getSlideVariants=Ja;exports.getTransitionVariants=Lc;exports.sanitizeFormData=$u;exports.shouldReduceMotion=Bc;exports.validateField=co;exports.validateForm=Ta;//# sourceMappingURL=index.js.map
21
+ `},Mi={onDragStart(e){let{active:t}=e;return "Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return "Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function $i(e){let{announcements:t=Mi,container:r,hiddenTextDescribedById:a,screenReaderInstructions:o=Ai}=e,{announce:i,announcement:n}=jo(),s=It("DndLiveRegion"),[l,c]=Ge.useState(false);if(Ge.useEffect(()=>{c(true);},[]),Ti(Ge.useMemo(()=>({onDragStart(u){let{active:p}=u;i(t.onDragStart({active:p}));},onDragMove(u){let{active:p,over:g}=u;t.onDragMove&&i(t.onDragMove({active:p,over:g}));},onDragOver(u){let{active:p,over:g}=u;i(t.onDragOver({active:p,over:g}));},onDragEnd(u){let{active:p,over:g}=u;i(t.onDragEnd({active:p,over:g}));},onDragCancel(u){let{active:p,over:g}=u;i(t.onDragCancel({active:p,over:g}));}}),[i,t])),!l)return null;let d=Ge__default.default.createElement(Ge__default.default.Fragment,null,Ge__default.default.createElement(Uo,{id:a,value:o.draggable}),Ge__default.default.createElement(Wo,{id:s,announcement:n}));return r?reactDom.createPortal(d,r):d}var oe;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable";})(oe||(oe={}));function Wr(){}function ra(e,t){return Ge.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function na(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Ge.useMemo(()=>[...t].filter(a=>a!=null),[...t])}var We=Object.freeze({x:0,y:0});function Li(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Bi(e,t){let{data:{value:r}}=e,{data:{value:a}}=t;return r-a}function zi(e,t){let{data:{value:r}}=e,{data:{value:a}}=t;return a-r}function oa(e,t){if(!e||e.length===0)return null;let[r]=e;return r[t]}function _o(e,t,r){return t===void 0&&(t=e.left),r===void 0&&(r=e.top),{x:t+e.width*.5,y:r+e.height*.5}}var aa=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:a}=e,o=_o(t,t.left,t.top),i=[];for(let n of a){let{id:s}=n,l=r.get(s);if(l){let c=Li(_o(l),o);i.push({id:s,data:{droppableContainer:n,value:c}});}}return i.sort(Bi)};function Oi(e,t){let r=Math.max(t.top,e.top),a=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),n=o-a,s=i-r;if(a<o&&r<i){let l=t.width*t.height,c=e.width*e.height,d=n*s,u=d/(l+c-d);return Number(u.toFixed(4))}return 0}var Hi=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:a}=e,o=[];for(let i of a){let{id:n}=i,s=r.get(n);if(s){let l=Oi(s,t);l>0&&o.push({id:n,data:{droppableContainer:i,value:l}});}}return o.sort(zi)};function Ui(e,t,r){return {...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function ia(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:We}function Wi(e){return function(r){for(var a=arguments.length,o=new Array(a>1?a-1:0),i=1;i<a;i++)o[i-1]=arguments[i];return o.reduce((n,s)=>({...n,top:n.top+e*s.y,bottom:n.bottom+e*s.y,left:n.left+e*s.x,right:n.right+e*s.x}),{...r})}}var ji=Wi(1);function _i(e){if(e.startsWith("matrix3d(")){let t=e.slice(9,-1).split(/, /);return {x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){let t=e.slice(7,-1).split(/, /);return {x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function qi(e,t,r){let a=_i(t);if(!a)return e;let{scaleX:o,scaleY:i,x:n,y:s}=a,l=e.left-n-(1-o)*parseFloat(r),c=e.top-s-(1-i)*parseFloat(r.slice(r.indexOf(" ")+1)),d=o?e.width/o:e.width,u=i?e.height/i:e.height;return {width:d,height:u,top:c,right:l+d,bottom:c+u,left:l}}var Vi={ignoreTransform:false};function Pt(e,t){t===void 0&&(t=Vi);let r=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:c,transformOrigin:d}=he(e).getComputedStyle(e);c&&(r=qi(r,c,d));}let{top:a,left:o,width:i,height:n,bottom:s,right:l}=r;return {top:a,left:o,width:i,height:n,bottom:s,right:l}}function qo(e){return Pt(e,{ignoreTransform:true})}function Yi(e){let t=e.innerWidth,r=e.innerHeight;return {top:0,left:0,right:t,bottom:r,width:t,height:r}}function Gi(e,t){return t===void 0&&(t=he(e).getComputedStyle(e)),t.position==="fixed"}function Xi(e,t){t===void 0&&(t=he(e).getComputedStyle(e));let r=/(auto|scroll|overlay)/;return ["overflow","overflowX","overflowY"].some(o=>{let i=t[o];return typeof i=="string"?r.test(i):false})}function qr(e,t){let r=[];function a(o){if(t!=null&&r.length>=t||!o)return r;if(Lr(o)&&o.scrollingElement!=null&&!r.includes(o.scrollingElement))return r.push(o.scrollingElement),r;if(!_t(o)||Qn(o)||r.includes(o))return r;let i=he(e).getComputedStyle(o);return o!==e&&Xi(o,i)&&r.push(o),Gi(o,i)?r:a(o.parentNode)}return e?a(e):r}function sa(e){let[t]=qr(e,1);return t??null}function Zn(e){return !ar||!e?null:Ft(e)?e:$r(e)?Lr(e)||e===Dt(e).scrollingElement?window:_t(e)?e:null:null}function la(e){return Ft(e)?e.scrollX:e.scrollLeft}function ca(e){return Ft(e)?e.scrollY:e.scrollTop}function ro(e){return {x:la(e),y:ca(e)}}var ce;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward";})(ce||(ce={}));function da(e){return !ar||!e?false:e===document.scrollingElement}function ua(e){let t={x:0,y:0},r=da(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},a={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},o=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,n=e.scrollTop>=a.y,s=e.scrollLeft>=a.x;return {isTop:o,isLeft:i,isBottom:n,isRight:s,maxScroll:a,minScroll:t}}var Ki={x:.2,y:.2};function Ji(e,t,r,a,o){let{top:i,left:n,right:s,bottom:l}=r;a===void 0&&(a=10),o===void 0&&(o=Ki);let{isTop:c,isBottom:d,isLeft:u,isRight:p}=ua(e),g={x:0,y:0},b={x:0,y:0},v={height:t.height*o.y,width:t.width*o.x};return !c&&i<=t.top+v.height?(g.y=ce.Backward,b.y=a*Math.abs((t.top+v.height-i)/v.height)):!d&&l>=t.bottom-v.height&&(g.y=ce.Forward,b.y=a*Math.abs((t.bottom-v.height-l)/v.height)),!p&&s>=t.right-v.width?(g.x=ce.Forward,b.x=a*Math.abs((t.right-v.width-s)/v.width)):!u&&n<=t.left+v.width&&(g.x=ce.Backward,b.x=a*Math.abs((t.left+v.width-n)/v.width)),{direction:g,speed:b}}function Qi(e){if(e===document.scrollingElement){let{innerWidth:i,innerHeight:n}=window;return {top:0,left:0,right:i,bottom:n,width:i,height:n}}let{top:t,left:r,right:a,bottom:o}=e.getBoundingClientRect();return {top:t,left:r,right:a,bottom:o,width:e.clientWidth,height:e.clientHeight}}function ma(e){return e.reduce((t,r)=>Et(t,ro(r)),We)}function Zi(e){return e.reduce((t,r)=>t+la(r),0)}function es(e){return e.reduce((t,r)=>t+ca(r),0)}function ts(e,t){if(t===void 0&&(t=Pt),!e)return;let{top:r,left:a,bottom:o,right:i}=t(e);sa(e)&&(o<=0||i<=0||r>=window.innerHeight||a>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"});}var rs=[["x",["left","right"],Zi],["y",["top","bottom"],es]],cr=class{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let a=qr(r),o=ma(a);this.rect={...t},this.width=t.width,this.height=t.height;for(let[i,n,s]of rs)for(let l of n)Object.defineProperty(this,l,{get:()=>{let c=s(a),d=o[i]-c;return this.rect[l]+d},enumerable:true});Object.defineProperty(this,"rect",{enumerable:false});}},Rt=class{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var a;return (a=this.target)==null?void 0:a.removeEventListener(...r)});},this.target=t;}add(t,r,a){var o;(o=this.target)==null||o.addEventListener(t,r,a),this.listeners.push([t,r,a]);}};function ns(e){let{EventTarget:t}=he(e);return e instanceof t?e:Dt(e)}function eo(e,t){let r=Math.abs(e.x),a=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+a**2)>t:"x"in t&&"y"in t?r>t.x&&a>t.y:"x"in t?r>t.x:"y"in t?a>t.y:false}var ze;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange";})(ze||(ze={}));function Vo(e){e.preventDefault();}function os(e){e.stopPropagation();}var B;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab";})(B||(B={}));var pa={start:[B.Space,B.Enter],cancel:[B.Esc],end:[B.Space,B.Enter,B.Tab]},as=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case B.Right:return {...r,x:r.x+25};case B.Left:return {...r,x:r.x-25};case B.Down:return {...r,y:r.y+25};case B.Up:return {...r,y:r.y-25}}},jr=class{constructor(t){this.props=void 0,this.autoScrollEnabled=false,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;let{event:{target:r}}=t;this.props=t,this.listeners=new Rt(Dt(r)),this.windowListeners=new Rt(he(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach();}attach(){this.handleStart(),this.windowListeners.add(ze.Resize,this.handleCancel),this.windowListeners.add(ze.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ze.Keydown,this.handleKeyDown));}handleStart(){let{activeNode:t,onStart:r}=this.props,a=t.node.current;a&&ts(a),r(We);}handleKeyDown(t){if(sr(t)){let{active:r,context:a,options:o}=this.props,{keyboardCodes:i=pa,coordinateGetter:n=as,scrollBehavior:s="smooth"}=o,{code:l}=t;if(i.end.includes(l)){this.handleEnd(t);return}if(i.cancel.includes(l)){this.handleCancel(t);return}let{collisionRect:c}=a.current,d=c?{x:c.left,y:c.top}:We;this.referenceCoordinates||(this.referenceCoordinates=d);let u=n(t,{active:r,context:a.current,currentCoordinates:d});if(u){let p=Yt(u,d),g={x:0,y:0},{scrollableAncestors:b}=a.current;for(let v of b){let w=t.code,{isTop:f,isRight:x,isLeft:y,isBottom:N,maxScroll:C,minScroll:h}=ua(v),k=Qi(v),S={x:Math.min(w===B.Right?k.right-k.width/2:k.right,Math.max(w===B.Right?k.left:k.left+k.width/2,u.x)),y:Math.min(w===B.Down?k.bottom-k.height/2:k.bottom,Math.max(w===B.Down?k.top:k.top+k.height/2,u.y))},I=w===B.Right&&!x||w===B.Left&&!y,R=w===B.Down&&!N||w===B.Up&&!f;if(I&&S.x!==u.x){let m=v.scrollLeft+p.x,F=w===B.Right&&m<=C.x||w===B.Left&&m>=h.x;if(F&&!p.y){v.scrollTo({left:m,behavior:s});return}F?g.x=v.scrollLeft-m:g.x=w===B.Right?v.scrollLeft-C.x:v.scrollLeft-h.x,g.x&&v.scrollBy({left:-g.x,behavior:s});break}else if(R&&S.y!==u.y){let m=v.scrollTop+p.y,F=w===B.Down&&m<=C.y||w===B.Up&&m>=h.y;if(F&&!p.x){v.scrollTo({top:m,behavior:s});return}F?g.y=v.scrollTop-m:g.y=w===B.Down?v.scrollTop-C.y:v.scrollTop-h.y,g.y&&v.scrollBy({top:-g.y,behavior:s});break}}this.handleMove(t,Et(Yt(u,this.referenceCoordinates),g));}}}handleMove(t,r){let{onMove:a}=this.props;t.preventDefault(),a(r);}handleEnd(t){let{onEnd:r}=this.props;t.preventDefault(),this.detach(),r();}handleCancel(t){let{onCancel:r}=this.props;t.preventDefault(),this.detach(),r();}detach(){this.listeners.removeAll(),this.windowListeners.removeAll();}};jr.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:a=pa,onActivation:o}=t,{active:i}=r,{code:n}=e.nativeEvent;if(a.start.includes(n)){let s=i.activatorNode.current;return s&&e.target!==s?false:(e.preventDefault(),o?.({event:e.nativeEvent}),true)}return false}}];function Yo(e){return !!(e&&"distance"in e)}function Go(e){return !!(e&&"delay"in e)}var dr=class{constructor(t,r,a){var o;a===void 0&&(a=ns(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=true,this.document=void 0,this.activated=false,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;let{event:i}=t,{target:n}=i;this.props=t,this.events=r,this.document=Dt(n),this.documentListeners=new Rt(this.document),this.listeners=new Rt(a),this.windowListeners=new Rt(he(n)),this.initialCoordinates=(o=Or(i))!=null?o:We,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach();}attach(){let{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:a}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:false}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(ze.Resize,this.handleCancel),this.windowListeners.add(ze.DragStart,Vo),this.windowListeners.add(ze.VisibilityChange,this.handleCancel),this.windowListeners.add(ze.ContextMenu,Vo),this.documentListeners.add(ze.Keydown,this.handleKeydown),r){if(a!=null&&a({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Go(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Yo(r)){this.handlePending(r);return}}this.handleStart();}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null);}handlePending(t,r){let{active:a,onPending:o}=this.props;o(a,t,this.initialCoordinates,r);}handleStart(){let{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=true,this.documentListeners.add(ze.Click,os,{capture:true}),this.removeTextSelection(),this.documentListeners.add(ze.SelectionChange,this.removeTextSelection),r(t));}handleMove(t){var r;let{activated:a,initialCoordinates:o,props:i}=this,{onMove:n,options:{activationConstraint:s}}=i;if(!o)return;let l=(r=Or(t))!=null?r:We,c=Yt(o,l);if(!a&&s){if(Yo(s)){if(s.tolerance!=null&&eo(c,s.tolerance))return this.handleCancel();if(eo(c,s.distance))return this.handleStart()}if(Go(s)&&eo(c,s.tolerance))return this.handleCancel();this.handlePending(s,c);return}t.cancelable&&t.preventDefault(),n(l);}handleEnd(){let{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r();}handleCancel(){let{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r();}handleKeydown(t){t.code===B.Esc&&this.handleCancel();}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges();}},is={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},Xt=class extends dr{constructor(t){let{event:r}=t,a=Dt(r.target);super(t,is,a);}};Xt.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:a}=t;return !r.isPrimary||r.button!==0?false:(a?.({event:r}),true)}}];var ss={move:{name:"mousemove"},end:{name:"mouseup"}},no;(function(e){e[e.RightClick=2]="RightClick";})(no||(no={}));var oo=class extends dr{constructor(t){super(t,ss,Dt(t.event.target));}};oo.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:a}=t;return r.button===no.RightClick?false:(a?.({event:r}),true)}}];var to={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}},ao=class extends dr{constructor(t){super(t,to);}static setup(){return window.addEventListener(to.move.name,t,{capture:false,passive:false}),function(){window.removeEventListener(to.move.name,t);};function t(){}}};ao.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:a}=t,{touches:o}=r;return o.length>1?false:(a?.({event:r}),true)}}];var lr;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect";})(lr||(lr={}));var _r;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder";})(_r||(_r={}));function ls(e){let{acceleration:t,activator:r=lr.Pointer,canScroll:a,draggingRect:o,enabled:i,interval:n=5,order:s=_r.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:d,delta:u,threshold:p}=e,g=ds({delta:u,disabled:!i}),[b,v]=Bo(),w=Ge.useRef({x:0,y:0}),f=Ge.useRef({x:0,y:0}),x=Ge.useMemo(()=>{switch(r){case lr.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case lr.DraggableRect:return o}},[r,o,l]),y=Ge.useRef(null),N=Ge.useCallback(()=>{let h=y.current;if(!h)return;let k=w.current.x*f.current.x,S=w.current.y*f.current.y;h.scrollBy(k,S);},[]),C=Ge.useMemo(()=>s===_r.TreeOrder?[...c].reverse():c,[s,c]);Ge.useEffect(()=>{if(!i||!c.length||!x){v();return}for(let h of C){if(a?.(h)===false)continue;let k=c.indexOf(h),S=d[k];if(!S)continue;let{direction:I,speed:R}=Ji(h,S,x,t,p);for(let m of ["x","y"])g[m][I[m]]||(R[m]=0,I[m]=0);if(R.x>0||R.y>0){v(),y.current=h,b(N,n),w.current=R,f.current=I;return}}w.current={x:0,y:0},f.current={x:0,y:0},v();},[t,N,a,v,i,n,JSON.stringify(x),JSON.stringify(g),b,c,C,d,JSON.stringify(p)]);}var cs={x:{[ce.Backward]:false,[ce.Forward]:false},y:{[ce.Backward]:false,[ce.Forward]:false}};function ds(e){let{delta:t,disabled:r}=e,a=zr(t);return Vt(o=>{if(r||!a||!o)return cs;let i={x:Math.sign(t.x-a.x),y:Math.sign(t.y-a.y)};return {x:{[ce.Backward]:o.x[ce.Backward]||i.x===-1,[ce.Forward]:o.x[ce.Forward]||i.x===1},y:{[ce.Backward]:o.y[ce.Backward]||i.y===-1,[ce.Forward]:o.y[ce.Forward]||i.y===1}}},[r,t,a])}function us(e,t){let r=t!=null?e.get(t):void 0,a=r?r.node.current:null;return Vt(o=>{var i;return t==null?null:(i=a??o)!=null?i:null},[a,t])}function ms(e,t){return Ge.useMemo(()=>e.reduce((r,a)=>{let{sensor:o}=a,i=o.activators.map(n=>({eventName:n.eventName,handler:t(n.handler,a)}));return [...r,...i]},[]),[e,t])}var ur;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging";})(ur||(ur={}));var io;(function(e){e.Optimized="optimized";})(io||(io={}));var Xo=new Map;function ps(e,t){let{dragging:r,dependencies:a,config:o}=t,[i,n]=Ge.useState(null),{frequency:s,measure:l,strategy:c}=o,d=Ge.useRef(e),u=w(),p=qt(u),g=Ge.useCallback(function(f){f===void 0&&(f=[]),!p.current&&n(x=>x===null?f:x.concat(f.filter(y=>!x.includes(y))));},[p]),b=Ge.useRef(null),v=Vt(f=>{if(u&&!r)return Xo;if(!f||f===Xo||d.current!==e||i!=null){let x=new Map;for(let y of e){if(!y)continue;if(i&&i.length>0&&!i.includes(y.id)&&y.rect.current){x.set(y.id,y.rect.current);continue}let N=y.node.current,C=N?new cr(l(N),N):null;y.rect.current=C,C&&x.set(y.id,C);}return x}return f},[e,i,r,u,l]);return Ge.useEffect(()=>{d.current=e;},[e]),Ge.useEffect(()=>{u||g();},[r,u]),Ge.useEffect(()=>{i&&i.length>0&&n(null);},[JSON.stringify(i)]),Ge.useEffect(()=>{u||typeof s!="number"||b.current!==null||(b.current=setTimeout(()=>{g(),b.current=null;},s));},[s,u,g,...a]),{droppableRects:v,measureDroppableContainers:g,measuringScheduled:i!=null};function w(){switch(c){case ur.Always:return false;case ur.BeforeDragging:return r;default:return !r}}}function ga(e,t){return Vt(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function gs(e,t){return ga(e,t)}function fs(e){let{callback:t,disabled:r}=e,a=Br(t),o=Ge.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:i}=window;return new i(a)},[a,r]);return Ge.useEffect(()=>()=>o?.disconnect(),[o]),o}function Vr(e){let{callback:t,disabled:r}=e,a=Br(t),o=Ge.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:i}=window;return new i(a)},[r]);return Ge.useEffect(()=>()=>o?.disconnect(),[o]),o}function ys(e){return new cr(Pt(e),e)}function Ko(e,t,r){t===void 0&&(t=ys);let[a,o]=Ge.useState(null);function i(){o(l=>{if(!e)return null;if(e.isConnected===false){var c;return (c=l??r)!=null?c:null}let d=t(e);return JSON.stringify(l)===JSON.stringify(d)?l:d});}let n=fs({callback(l){if(e)for(let c of l){let{type:d,target:u}=c;if(d==="childList"&&u instanceof HTMLElement&&u.contains(e)){i();break}}}}),s=Vr({callback:i});return Be(()=>{i(),e?(s?.observe(e),n?.observe(document.body,{childList:true,subtree:true})):(s?.disconnect(),n?.disconnect());},[e]),a}function bs(e){let t=ga(e);return ia(e,t)}var Jo=[];function hs(e){let t=Ge.useRef(e),r=Vt(a=>e?a&&a!==Jo&&e&&t.current&&e.parentNode===t.current.parentNode?a:qr(e):Jo,[e]);return Ge.useEffect(()=>{t.current=e;},[e]),r}function xs(e){let[t,r]=Ge.useState(null),a=Ge.useRef(e),o=Ge.useCallback(i=>{let n=Zn(i.target);n&&r(s=>s?(s.set(n,ro(n)),new Map(s)):null);},[]);return Ge.useEffect(()=>{let i=a.current;if(e!==i){n(i);let s=e.map(l=>{let c=Zn(l);return c?(c.addEventListener("scroll",o,{passive:true}),[c,ro(c)]):null}).filter(l=>l!=null);r(s.length?new Map(s):null),a.current=e;}return ()=>{n(e),n(i);};function n(s){s.forEach(l=>{let c=Zn(l);c?.removeEventListener("scroll",o);});}},[o,e]),Ge.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,n)=>Et(i,n),We):ma(e):We,[e,t])}function Qo(e,t){t===void 0&&(t=[]);let r=Ge.useRef(null);return Ge.useEffect(()=>{r.current=null;},t),Ge.useEffect(()=>{let a=e!==We;a&&!r.current&&(r.current=e),!a&&r.current&&(r.current=null);},[e]),r.current?Yt(e,r.current):We}function vs(e){Ge.useEffect(()=>{if(!ar)return;let t=e.map(r=>{let{sensor:a}=r;return a.setup==null?void 0:a.setup()});return ()=>{for(let r of t)r?.();}},e.map(t=>{let{sensor:r}=t;return r}));}function ws(e,t){return Ge.useMemo(()=>e.reduce((r,a)=>{let{eventName:o,handler:i}=a;return r[o]=n=>{i(n,t);},r},{}),[e,t])}function fa(e){return Ge.useMemo(()=>e?Yi(e):null,[e])}var Zo=[];function Ns(e,t){t===void 0&&(t=Pt);let[r]=e,a=fa(r?he(r):null),[o,i]=Ge.useState(Zo);function n(){i(()=>e.length?e.map(l=>da(l)?a:new cr(t(l),l)):Zo);}let s=Vr({callback:n});return Be(()=>{s?.disconnect(),n(),e.forEach(l=>s?.observe(l));},[e]),o}function Cs(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return _t(t)?t:e}function Ss(e){let{measure:t}=e,[r,a]=Ge.useState(null),o=Ge.useCallback(c=>{for(let{target:d}of c)if(_t(d)){a(u=>{let p=t(d);return u?{...u,width:p.width,height:p.height}:p});break}},[t]),i=Vr({callback:o}),n=Ge.useCallback(c=>{let d=Cs(c);i?.disconnect(),d&&i?.observe(d),a(d?t(d):null);},[t,i]),[s,l]=ir(n);return Ge.useMemo(()=>({nodeRef:s,rect:r,setRef:l}),[r,s,l])}var ks=[{sensor:Xt,options:{}},{sensor:jr,options:{}}],Fs={current:{}},Ur={draggable:{measure:qo},droppable:{measure:qo,strategy:ur.WhileDragging,frequency:io.Optimized},dragOverlay:{measure:Pt}},Tt=class extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return !r})}getNodeFor(t){var r,a;return (r=(a=this.get(t))==null?void 0:a.node.current)!=null?r:void 0}},Ds={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Tt,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Wr},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Ur,measureDroppableContainers:Wr,windowRect:null,measuringScheduled:false},Is={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Wr,draggableNodes:new Map,over:null,measureDroppableContainers:Wr},Yr=Ge.createContext(Is),ya=Ge.createContext(Ds);function Es(){return {draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Tt}}}function Rs(e,t){switch(t.type){case oe.DragStart:return {...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case oe.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case oe.DragEnd:case oe.DragCancel:return {...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case oe.RegisterDroppable:{let{element:r}=t,{id:a}=r,o=new Tt(e.droppable.containers);return o.set(a,r),{...e,droppable:{...e.droppable,containers:o}}}case oe.SetDroppableDisabled:{let{id:r,key:a,disabled:o}=t,i=e.droppable.containers.get(r);if(!i||a!==i.key)return e;let n=new Tt(e.droppable.containers);return n.set(r,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:n}}}case oe.UnregisterDroppable:{let{id:r,key:a}=t,o=e.droppable.containers.get(r);if(!o||a!==o.key)return e;let i=new Tt(e.droppable.containers);return i.delete(r),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function Ts(e){let{disabled:t}=e,{active:r,activatorEvent:a,draggableNodes:o}=Ge.useContext(Yr),i=zr(a),n=zr(r?.id);return Ge.useEffect(()=>{if(!t&&!a&&i&&n!=null){if(!sr(i)||document.activeElement===i.target)return;let s=o.get(n);if(!s)return;let{activatorNode:l,node:c}=s;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(let d of [l.current,c.current]){if(!d)continue;let u=Oo(d);if(u){u.focus();break}}});}},[a,t,o,n,i]),null}function Ps(e,t){let{transform:r,...a}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...a}),r):r}function As(e){return Ge.useMemo(()=>({draggable:{...Ur.draggable,...e?.draggable},droppable:{...Ur.droppable,...e?.droppable},dragOverlay:{...Ur.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Ms(e){let{activeNode:t,measure:r,initialRect:a,config:o=true}=e,i=Ge.useRef(false),{x:n,y:s}=typeof o=="boolean"?{x:o,y:o}:o;Be(()=>{if(!n&&!s||!t){i.current=false;return}if(i.current||!a)return;let c=t?.node.current;if(!c||c.isConnected===false)return;let d=r(c),u=ia(d,a);if(n||(u.x=0),s||(u.y=0),i.current=true,Math.abs(u.x)>0||Math.abs(u.y)>0){let p=sa(c);p&&p.scrollBy({top:u.y,left:u.x});}},[t,n,s,a,r]);}var ba=Ge.createContext({...We,scaleX:1,scaleY:1}),yt;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized";})(yt||(yt={}));var ha=Ge.memo(function(t){var r,a,o,i;let{id:n,accessibility:s,autoScroll:l=true,children:c,sensors:d=ks,collisionDetection:u=Hi,measuring:p,modifiers:g,...b}=t,v=Ge.useReducer(Rs,void 0,Es),[w,f]=v,[x,y]=Pi(),[N,C]=Ge.useState(yt.Uninitialized),h=N===yt.Initialized,{draggable:{active:k,nodes:S,translate:I},droppable:{containers:R}}=w,m=k!=null?S.get(k):null,F=Ge.useRef({initial:null,translated:null}),M=Ge.useMemo(()=>{var pe;return k!=null?{id:k,data:(pe=m?.data)!=null?pe:Fs,rect:F}:null},[k,m]),A=Ge.useRef(null),[D,T]=Ge.useState(null),[P,z]=Ge.useState(null),K=qt(b,Object.values(b)),Y=It("DndDescribedBy",n),Te=Ge.useMemo(()=>R.getEnabled(),[R]),U=As(p),{droppableRects:ie,measureDroppableContainers:Xe,measuringScheduled:ot}=ps(Te,{dragging:h,dependencies:[I.x,I.y],config:U.droppable}),ve=us(S,k),At=Ge.useMemo(()=>P?Or(P):null,[P]),je=La(),fe=gs(ve,U.draggable.measure);Ms({activeNode:k!=null?S.get(k):null,config:je.layoutShiftCompensation,initialRect:fe,measure:U.draggable.measure});let O=Ko(ve,U.draggable.measure,fe),Mt=Ko(ve?ve.parentElement:null),Ne=Ge.useRef({activatorEvent:null,active:null,activeNode:ve,collisionRect:null,collisions:null,droppableRects:ie,draggableNodes:S,draggingNode:null,draggingNodeRect:null,droppableContainers:R,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),J=R.getNodeFor((r=Ne.current.over)==null?void 0:r.id),re=Ss({measure:U.dragOverlay.measure}),at=(a=re.nodeRef.current)!=null?a:ve,it=h?(o=re.rect)!=null?o:O:null,fr=!!(re.nodeRef.current&&re.rect),Kt=bs(fr?null:O),$t=fa(at?he(at):null),Ce=hs(h?J??ve:null),bt=Ns(Ce),Lt=Ps(g,{transform:{x:I.x-Kt.x,y:I.y-Kt.y,scaleX:1,scaleY:1},activatorEvent:P,active:M,activeNodeRect:O,containerNodeRect:Mt,draggingNodeRect:it,over:Ne.current.over,overlayNodeRect:re.rect,scrollableAncestors:Ce,scrollableAncestorRects:bt,windowRect:$t}),yr=At?Et(At,I):null,br=xs(Ce),Jt=Qo(br),Zr=Qo(br,[O]),st=Et(Lt,Jt),E=it?ji(it,Lt):null,W=M&&E?u({active:M,collisionRect:E,droppableRects:ie,droppableContainers:Te,pointerCoordinates:yr}):null,_=oa(W,"id"),[ye,hr]=Ge.useState(null),xr=fr?Lt:Et(Lt,Zr),se=Ui(xr,(i=ye?.rect)!=null?i:null,O),Pe=Ge.useRef(null),uo=Ge.useCallback((pe,Se)=>{let{sensor:ke,options:lt}=Se;if(A.current==null)return;let Ae=S.get(A.current);if(!Ae)return;let Fe=pe.nativeEvent,_e=new ke({active:A.current,activeNode:Ae,event:Fe,options:lt,context:Ne,onAbort(de){if(!S.get(de))return;let{onDragAbort:qe}=K.current,Ke={id:de};qe?.(Ke),x({type:"onDragAbort",event:Ke});},onPending(de,ct,qe,Ke){if(!S.get(de))return;let{onDragPending:Zt}=K.current,dt={id:de,constraint:ct,initialCoordinates:qe,offset:Ke};Zt?.(dt),x({type:"onDragPending",event:dt});},onStart(de){let ct=A.current;if(ct==null)return;let qe=S.get(ct);if(!qe)return;let{onDragStart:Ke}=K.current,Qt={activatorEvent:Fe,active:{id:ct,data:qe.data,rect:F}};reactDom.unstable_batchedUpdates(()=>{Ke?.(Qt),C(yt.Initializing),f({type:oe.DragStart,initialCoordinates:de,active:ct}),x({type:"onDragStart",event:Qt}),T(Pe.current),z(Fe);});},onMove(de){f({type:oe.DragMove,coordinates:de});},onEnd:Bt(oe.DragEnd),onCancel:Bt(oe.DragCancel)});Pe.current=_e;function Bt(de){return async function(){let{active:qe,collisions:Ke,over:Qt,scrollAdjustedTranslate:Zt}=Ne.current,dt=null;if(qe&&Zt){let{cancelDrop:er}=K.current;dt={activatorEvent:Fe,active:qe,collisions:Ke,delta:Zt,over:Qt},de===oe.DragEnd&&typeof er=="function"&&await Promise.resolve(er(dt))&&(de=oe.DragCancel);}A.current=null,reactDom.unstable_batchedUpdates(()=>{f({type:de}),C(yt.Uninitialized),hr(null),T(null),z(null),Pe.current=null;let er=de===oe.DragEnd?"onDragEnd":"onDragCancel";if(dt){let en=K.current[er];en?.(dt),x({type:er,event:dt});}});}}},[S]),Aa=Ge.useCallback((pe,Se)=>(ke,lt)=>{let Ae=ke.nativeEvent,Fe=S.get(lt);if(A.current!==null||!Fe||Ae.dndKit||Ae.defaultPrevented)return;let _e={active:Fe};pe(ke,Se.options,_e)===true&&(Ae.dndKit={capturedBy:Se.sensor},A.current=lt,uo(ke,Se));},[S,uo]),mo=ms(d,Aa);vs(d),Be(()=>{O&&N===yt.Initializing&&C(yt.Initialized);},[O,N]),Ge.useEffect(()=>{let{onDragMove:pe}=K.current,{active:Se,activatorEvent:ke,collisions:lt,over:Ae}=Ne.current;if(!Se||!ke)return;let Fe={active:Se,activatorEvent:ke,collisions:lt,delta:{x:st.x,y:st.y},over:Ae};reactDom.unstable_batchedUpdates(()=>{pe?.(Fe),x({type:"onDragMove",event:Fe});});},[st.x,st.y]),Ge.useEffect(()=>{let{active:pe,activatorEvent:Se,collisions:ke,droppableContainers:lt,scrollAdjustedTranslate:Ae}=Ne.current;if(!pe||A.current==null||!Se||!Ae)return;let{onDragOver:Fe}=K.current,_e=lt.get(_),Bt=_e&&_e.rect.current?{id:_e.id,rect:_e.rect.current,data:_e.data,disabled:_e.disabled}:null,de={active:pe,activatorEvent:Se,collisions:ke,delta:{x:Ae.x,y:Ae.y},over:Bt};reactDom.unstable_batchedUpdates(()=>{hr(Bt),Fe?.(de),x({type:"onDragOver",event:de});});},[_]),Be(()=>{Ne.current={activatorEvent:P,active:M,activeNode:ve,collisionRect:E,collisions:W,droppableRects:ie,draggableNodes:S,draggingNode:at,draggingNodeRect:it,droppableContainers:R,over:ye,scrollableAncestors:Ce,scrollAdjustedTranslate:st},F.current={initial:it,translated:E};},[M,ve,W,E,S,at,it,ie,R,ye,Ce,st]),ls({...je,delta:I,draggingRect:E,pointerCoordinates:yr,scrollableAncestors:Ce,scrollableAncestorRects:bt});let Ma=Ge.useMemo(()=>({active:M,activeNode:ve,activeNodeRect:O,activatorEvent:P,collisions:W,containerNodeRect:Mt,dragOverlay:re,draggableNodes:S,droppableContainers:R,droppableRects:ie,over:ye,measureDroppableContainers:Xe,scrollableAncestors:Ce,scrollableAncestorRects:bt,measuringConfiguration:U,measuringScheduled:ot,windowRect:$t}),[M,ve,O,P,W,Mt,re,S,R,ie,ye,Xe,Ce,bt,U,ot,$t]),$a=Ge.useMemo(()=>({activatorEvent:P,activators:mo,active:M,activeNodeRect:O,ariaDescribedById:{draggable:Y},dispatch:f,draggableNodes:S,over:ye,measureDroppableContainers:Xe}),[P,mo,M,O,f,Y,S,ye,Xe]);return Ge__default.default.createElement(ta.Provider,{value:y},Ge__default.default.createElement(Yr.Provider,{value:$a},Ge__default.default.createElement(ya.Provider,{value:Ma},Ge__default.default.createElement(ba.Provider,{value:se},c)),Ge__default.default.createElement(Ts,{disabled:s?.restoreFocus===false})),Ge__default.default.createElement($i,{...s,hiddenTextDescribedById:Y}));function La(){let pe=D?.autoScrollEnabled===false,Se=typeof l=="object"?l.enabled===false:l===false,ke=h&&!pe&&!Se;return typeof l=="object"?{...l,enabled:ke}:{enabled:ke}}}),$s=Ge.createContext(null),ea="button",Ls="Draggable";function xa(e){let{id:t,data:r,disabled:a=false,attributes:o}=e,i=It(Ls),{activators:n,activatorEvent:s,active:l,activeNodeRect:c,ariaDescribedById:d,draggableNodes:u,over:p}=Ge.useContext(Yr),{role:g=ea,roleDescription:b="draggable",tabIndex:v=0}=o??{},w=l?.id===t,f=Ge.useContext(w?ba:$s),[x,y]=ir(),[N,C]=ir(),h=ws(n,t),k=qt(r);Be(()=>(u.set(t,{id:t,key:i,node:x,activatorNode:N,data:k}),()=>{let I=u.get(t);I&&I.key===i&&u.delete(t);}),[u,t]);let S=Ge.useMemo(()=>({role:g,tabIndex:v,"aria-disabled":a,"aria-pressed":w&&g===ea?true:void 0,"aria-roledescription":b,"aria-describedby":d.draggable}),[a,g,v,w,b,d.draggable]);return {active:l,activatorEvent:s,activeNodeRect:c,attributes:S,isDragging:w,listeners:a?void 0:h,node:x,over:p,setNodeRef:y,setActivatorNodeRef:C,transform:f}}function va(){return Ge.useContext(ya)}var Bs="Droppable",zs={timeout:25};function wa(e){let{data:t,disabled:r=false,id:a,resizeObserverConfig:o}=e,i=It(Bs),{active:n,dispatch:s,over:l,measureDroppableContainers:c}=Ge.useContext(Yr),d=Ge.useRef({disabled:r}),u=Ge.useRef(false),p=Ge.useRef(null),g=Ge.useRef(null),{disabled:b,updateMeasurementsFor:v,timeout:w}={...zs,...o},f=qt(v??a),x=Ge.useCallback(()=>{if(!u.current){u.current=true;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{c(Array.isArray(f.current)?f.current:[f.current]),g.current=null;},w);},[w]),y=Vr({callback:x,disabled:b||!n}),N=Ge.useCallback((S,I)=>{y&&(I&&(y.unobserve(I),u.current=false),S&&y.observe(S));},[y]),[C,h]=ir(N),k=qt(t);return Ge.useEffect(()=>{!y||!C.current||(y.disconnect(),u.current=false,y.observe(C.current));},[C,y]),Ge.useEffect(()=>(s({type:oe.RegisterDroppable,element:{id:a,key:i,disabled:r,node:C,rect:p,data:k}}),()=>s({type:oe.UnregisterDroppable,key:i,id:a})),[a]),Ge.useEffect(()=>{r!==d.current.disabled&&(s({type:oe.SetDroppableDisabled,id:a,key:i,disabled:r}),d.current.disabled=r);},[a,i,r,s]),{active:n,rect:p,isOver:l?.id===a,node:C,over:l,setNodeRef:h}}function Ca(e,t,r){let a=e.slice();return a.splice(r<0?a.length+r:r,0,a.splice(t,1)[0]),a}function Us(e,t){return e.reduce((r,a,o)=>{let i=t.get(a);return i&&(r[o]=i),r},Array(e.length))}function Gr(e){return e!==null&&e>=0}function Ws(e,t){if(e===t)return true;if(e.length!==t.length)return false;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return false;return true}function js(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}var Sa=e=>{let{rects:t,activeIndex:r,overIndex:a,index:o}=e,i=Ca(t,a,r),n=t[o],s=i[o];return !s||!n?null:{x:s.left-n.left,y:s.top-n.top,scaleX:s.width/n.width,scaleY:s.height/n.height}};var Xr={scaleX:1,scaleY:1},ka=e=>{var t;let{activeIndex:r,activeNodeRect:a,index:o,rects:i,overIndex:n}=e,s=(t=i[r])!=null?t:a;if(!s)return null;if(o===r){let c=i[n];return c?{x:0,y:r<n?c.top+c.height-(s.top+s.height):c.top-s.top,...Xr}:null}let l=_s(i,o,r);return o>r&&o<=n?{x:0,y:-s.height-l,...Xr}:o<r&&o>=n?{x:0,y:s.height+l,...Xr}:{x:0,y:0,...Xr}};function _s(e,t,r){let a=e[t],o=e[t-1],i=e[t+1];return a?r<t?o?a.top-(o.top+o.height):i?i.top-(a.top+a.height):0:i?i.top-(a.top+a.height):o?a.top-(o.top+o.height):0:0}var Fa="Sortable",Da=Ge__default.default.createContext({activeIndex:-1,containerId:Fa,disableTransforms:false,items:[],overIndex:-1,useDragOverlay:false,sortedRects:[],strategy:Sa,disabled:{draggable:false,droppable:false}});function Ia(e){let{children:t,id:r,items:a,strategy:o=Sa,disabled:i=false}=e,{active:n,dragOverlay:s,droppableRects:l,over:c,measureDroppableContainers:d}=va(),u=It(Fa,r),p=s.rect!==null,g=Ge.useMemo(()=>a.map(h=>typeof h=="object"&&"id"in h?h.id:h),[a]),b=n!=null,v=n?g.indexOf(n.id):-1,w=c?g.indexOf(c.id):-1,f=Ge.useRef(g),x=!Ws(g,f.current),y=w!==-1&&v===-1||x,N=js(i);Be(()=>{x&&b&&d(g);},[x,g,b,d]),Ge.useEffect(()=>{f.current=g;},[g]);let C=Ge.useMemo(()=>({activeIndex:v,containerId:u,disabled:N,disableTransforms:y,items:g,overIndex:w,useDragOverlay:p,sortedRects:Us(g,l),strategy:o}),[v,u,N.draggable,N.droppable,y,g,w,l,p,o]);return Ge__default.default.createElement(Da.Provider,{value:C},t)}var qs=e=>{let{id:t,items:r,activeIndex:a,overIndex:o}=e;return Ca(r,a,o).indexOf(t)},Vs=e=>{let{containerId:t,isSorting:r,wasDragging:a,index:o,items:i,newIndex:n,previousItems:s,previousContainerId:l,transition:c}=e;return !c||!a||s!==i&&o===n?false:r?true:n!==o&&t===l},Ys={duration:200,easing:"ease"},Ea="transform",Gs=ft.Transition.toString({property:Ea,duration:0,easing:"linear"}),Xs={roleDescription:"sortable"};function Ks(e){let{disabled:t,index:r,node:a,rect:o}=e,[i,n]=Ge.useState(null),s=Ge.useRef(r);return Be(()=>{if(!t&&r!==s.current&&a.current){let l=o.current;if(l){let c=Pt(a.current,{ignoreTransform:true}),d={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(d.x||d.y)&&n(d);}}r!==s.current&&(s.current=r);},[t,r,a,o]),Ge.useEffect(()=>{i&&n(null);},[i]),i}function Ra(e){let{animateLayoutChanges:t=Vs,attributes:r,disabled:a,data:o,getNewIndex:i=qs,id:n,strategy:s,resizeObserverConfig:l,transition:c=Ys}=e,{items:d,containerId:u,activeIndex:p,disabled:g,disableTransforms:b,sortedRects:v,overIndex:w,useDragOverlay:f,strategy:x}=Ge.useContext(Da),y=Js(a,g),N=d.indexOf(n),C=Ge.useMemo(()=>({sortable:{containerId:u,index:N,items:d},...o}),[u,o,N,d]),h=Ge.useMemo(()=>d.slice(d.indexOf(n)),[d,n]),{rect:k,node:S,isOver:I,setNodeRef:R}=wa({id:n,data:C,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:h,...l}}),{active:m,activatorEvent:F,activeNodeRect:M,attributes:A,setNodeRef:D,listeners:T,isDragging:P,over:z,setActivatorNodeRef:K,transform:Y}=xa({id:n,data:C,attributes:{...Xs,...r},disabled:y.draggable}),Te=Lo(R,D),U=!!m,ie=U&&!b&&Gr(p)&&Gr(w),Xe=!f&&P,ot=Xe&&ie?Y:null,At=ie?ot??(s??x)({rects:v,activeNodeRect:M,activeIndex:p,overIndex:w,index:N}):null,je=Gr(p)&&Gr(w)?i({id:n,items:d,activeIndex:p,overIndex:w}):N,fe=m?.id,O=Ge.useRef({activeId:fe,items:d,newIndex:je,containerId:u}),Mt=d!==O.current.items,Ne=t({active:m,containerId:u,isDragging:P,isSorting:U,id:n,index:N,items:d,newIndex:O.current.newIndex,previousItems:O.current.items,previousContainerId:O.current.containerId,transition:c,wasDragging:O.current.activeId!=null}),J=Ks({disabled:!Ne,index:N,node:S,rect:k});return Ge.useEffect(()=>{U&&O.current.newIndex!==je&&(O.current.newIndex=je),u!==O.current.containerId&&(O.current.containerId=u),d!==O.current.items&&(O.current.items=d);},[U,je,u,d]),Ge.useEffect(()=>{if(fe===O.current.activeId)return;if(fe!=null&&O.current.activeId==null){O.current.activeId=fe;return}let at=setTimeout(()=>{O.current.activeId=fe;},50);return ()=>clearTimeout(at)},[fe]),{active:m,activeIndex:p,attributes:A,data:C,rect:k,index:N,newIndex:je,items:d,isOver:I,isSorting:U,isDragging:P,listeners:T,node:S,overIndex:w,over:z,setNodeRef:Te,setActivatorNodeRef:K,setDroppableNodeRef:R,setDraggableNodeRef:D,transform:J??At,transition:re()};function re(){if(J||Mt&&O.current.newIndex===N)return Gs;if(!(Xe&&!sr(F)||!c)&&(U||Ne))return ft.Transition.toString({...c,property:Ea})}}function Js(e,t){var r,a;return typeof e=="boolean"?{draggable:e,droppable:false}:{draggable:(r=e?.draggable)!=null?r:t.draggable,droppable:(a=e?.droppable)!=null?a:t.droppable}}[B.Down,B.Right,B.Up,B.Left];function Zs({field:e,value:t,error:r,onChange:a,businessId:o,formId:i,styling:n}){let{attributes:s,listeners:l,setNodeRef:c,transform:d,transition:u,isDragging:p}=Ra({id:e.id}),g={transform:ft.Transform.toString(d),transition:u,opacity:p?.5:1};return jsxRuntime.jsxs("div",{ref:c,style:g,className:`relative group ${p?"z-50":""}`,children:[jsxRuntime.jsx("div",{...s,...l,className:"absolute -left-8 top-1/2 -translate-y-1/2 z-50 opacity-0 group-hover:opacity-100 transition-opacity cursor-grab active:cursor-grabbing",onClick:b=>b.stopPropagation(),children:jsxRuntime.jsx("div",{className:"flex items-center gap-1 bg-[#BCB4FF] text-black px-1.5 py-1 rounded-md shadow-lg border border-black/10",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-3 h-3"})})}),jsxRuntime.jsx("div",{className:"absolute inset-0 pointer-events-none transition-all rounded-lg group-hover:border border-[#BCB4FF]/30"}),jsxRuntime.jsx("div",{style:{pointerEvents:"auto"},children:jsxRuntime.jsx(Ar,{field:e,value:t,error:r,onChange:a,businessId:o,formId:i,styling:n})})]})}function Qr({block:e,formData:t,errors:r,onChange:a,businessId:o,formId:i,styling:n,previewMode:s,onFieldReorder:l}){let c=na(ra(Xt,{activationConstraint:{distance:8}})),d=u=>{let{active:p,over:g}=u;if(g&&p.id!==g.id&&l&&e.fields){let b=e.fields.findIndex(w=>w.id===p.id),v=e.fields.findIndex(w=>w.id===g.id);l(e.id,b,v);}};if(e.type==="section"){let u=e.fields||[];return s&&l?jsxRuntime.jsxs("div",{className:"border rounded-lg p-6",style:{backgroundColor:n?.sectionBackground||"#FFFFFF",borderColor:n?.fieldBorder?`${n.fieldBorder}30`:"#E5E7EB"},children:[e.title&&jsxRuntime.jsx("h2",{className:"text-xl font-semibold mb-2",style:{color:n?.labelColor||"#000000"},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"text-sm mb-6",style:{color:n?.textColor||"#000000"},children:e.description}),jsxRuntime.jsx(ha,{sensors:c,collisionDetection:aa,onDragEnd:d,children:jsxRuntime.jsx(Ia,{items:u.map(p=>p.id),strategy:ka,children:jsxRuntime.jsx("div",{className:"space-y-4",children:u.map(p=>jsxRuntime.jsx(Zs,{field:p,value:t[p.id],error:r[p.id],onChange:g=>a(p.id,g,p),businessId:o,formId:i,styling:n},p.id))})})})]}):jsxRuntime.jsxs("div",{className:"border rounded-lg p-6",style:{backgroundColor:n?.sectionBackground||"#FFFFFF",borderColor:n?.fieldBorder?`${n.fieldBorder}30`:"#E5E7EB"},children:[e.title&&jsxRuntime.jsx("h2",{className:"text-xl font-semibold mb-2",style:{color:n?.labelColor||"#000000"},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"text-sm mb-6",style:{color:n?.textColor||"#000000"},children:e.description}),jsxRuntime.jsx("div",{className:"space-y-4",children:u.map(p=>jsxRuntime.jsx(Ar,{field:p,value:t[p.id],error:r[p.id],onChange:g=>a(p.id,g,p),businessId:o,formId:i,styling:n},p.id))})]})}if(e.type==="text"){let u={left:"text-left",center:"text-center",right:"text-right"}[e.alignment||"left"];return jsxRuntime.jsx("div",{className:`prose prose-gray max-w-none ${u}`,children:jsxRuntime.jsx("p",{className:"whitespace-pre-wrap",style:{color:n?.textColor||"#000000"},children:e.content})})}if(e.type==="image"&&e.imageUrl){let u=e.imageSize||"medium",p=u==="full",g=p?"":{left:"mr-auto",center:"mx-auto",right:"ml-auto"}[e.alignment||"center"],b={small:"300px",medium:"500px",large:"700px"},v=p?"none":b[u]||b.medium,w={none:"0",sm:"0.25rem",md:"0.375rem",lg:"0.5rem",xl:"0.75rem",full:"9999px"},f=w[e.borderRadius]||w.lg,x={maxWidth:v,...p&&{width:"100vw",marginLeft:"50%",transform:"translateX(-50%)"}};return jsxRuntime.jsx("div",{className:g,style:x,children:jsxRuntime.jsx("img",{src:e.imageUrl,alt:"",className:"w-full h-auto",style:{borderRadius:f,objectFit:"cover"}})})}return null}function co(e,t){if(t.required){if(e==null||e==="")return {isValid:false,error:`${t.label} is required`};if(Array.isArray(e)&&e.length===0)return {isValid:false,error:`Please select at least one ${t.label.toLowerCase()}`};if(t.type==="photo"&&!e.data)return {isValid:false,error:`${t.label} is required`}}if(t.type==="email"&&e&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e))return {isValid:false,error:"Please enter a valid email address"};if(t.type==="tel"&&e&&(!/^[\d\s\-\+\(\)]+$/.test(e)||e.replace(/\D/g,"").length<10))return {isValid:false,error:"Please enter a valid phone number"};if(t.type==="date"&&e){let r=new Date(e);if(isNaN(r.getTime()))return {isValid:false,error:"Please enter a valid date"}}return {isValid:true}}function Ta(e,t){let r={},a=true;return t.forEach(o=>{let i=co(e[o.id],o);!i.isValid&&i.error&&(r[o.id]=i.error,a=false);}),{isValid:a,errors:r}}function $u(e){let t={};return Object.keys(e).forEach(r=>{let a=e[r];typeof a=="string"?t[r]=a.trim():(Array.isArray(a)||a&&typeof a=="object"&&a.data,t[r]=a);}),t}function Pa({form:e,businessId:t,onSuccess:r}){let[a,o]=Ge.useState({}),[i,n]=Ge.useState({}),[s,l]=Ge.useState(false),[c,d]=Ge.useState(false),[u,p]=Ge.useState(null),g=(x,y,N)=>{if(o(C=>({...C,[x]:y})),i[x]){let C=co(y,N);n(h=>{let k={...h};return C.isValid?delete k[x]:k[x]=C.error||"",k});}},b=async x=>{x.preventDefault(),p(null);let y=[];e.settings.blocks.forEach(C=>{C.type==="section"&&C.fields&&y.push(...C.fields);});let N=Ta(a,y);if(!N.isValid){n(N.errors);return}l(true);try{let h=typeof window<"u"&&undefined?"/api/forms/submit":`/api/studio/forms/${t}/${e.slug}/submit`,k=await fetch(h,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({formId:e.id,slug:e.slug,data:a})});if(!k.ok){let S=await k.json();throw new Error(S.message||"Failed to submit form")}d(!0),o({}),n({}),r&&r();}catch(C){console.error("Form submission error:",C),p(C.message||"Failed to submit form. Please try again.");}finally{l(false);}};if(c)return jsxRuntime.jsx("div",{className:"max-w-2xl mx-auto px-4 py-12",children:jsxRuntime.jsxs("div",{className:"bg-green-50 border border-green-200 rounded-lg p-8 text-center",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-4",children:jsxRuntime.jsx("svg",{className:"w-8 h-8 text-green-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),jsxRuntime.jsx("h3",{className:"text-xl font-semibold mb-2",style:{color:"#1a1a1a"},children:"Success!"}),jsxRuntime.jsx("p",{style:{color:"#374151"},children:e.settings.successMessage}),jsxRuntime.jsxs("div",{className:"mt-6 flex gap-3 justify-center",children:[jsxRuntime.jsx("button",{onClick:()=>window.location.href="/",className:"px-4 py-2 bg-gray-900 text-white rounded-lg hover:bg-gray-800 transition-colors",children:"Back to Home"}),jsxRuntime.jsx("button",{onClick:()=>d(false),className:"px-4 py-2 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-50 transition-colors",children:"Submit Another Response"})]})]})});let v=e.settings.styling?.alignment||"left",w=v==="center"?"text-center":v==="right"?"text-right":"text-left",f=e.settings.styling?.buttonColor||"#CAC426";return jsxRuntime.jsxs("div",{className:"max-w-2xl mx-auto px-4 py-12",children:[jsxRuntime.jsxs("div",{className:`mb-8 ${w}`,children:[jsxRuntime.jsx("h1",{className:"text-3xl font-bold mb-2",style:{color:e.settings.styling?.textColor||"#000000"},children:e.settings.title}),e.settings.description&&jsxRuntime.jsx("p",{style:{color:e.settings.styling?.textColor||"#000000"},children:e.settings.description})]}),jsxRuntime.jsxs("form",{onSubmit:b,className:"space-y-8",children:[e.settings.blocks.map(x=>jsxRuntime.jsx(Qr,{block:x,formData:a,errors:i,onChange:g,businessId:t,formId:e.id,styling:e.settings.styling},x.id)),u&&jsxRuntime.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4",children:jsxRuntime.jsx("p",{className:"text-sm text-red-600",children:u})}),jsxRuntime.jsx("div",{className:"pt-6",children:jsxRuntime.jsx("button",{type:"submit",disabled:s,className:"w-full px-6 py-3 text-white rounded-lg disabled:opacity-50 disabled:cursor-not-allowed transition-all font-medium hover:opacity-90",style:{backgroundColor:f},children:s?"Submitting...":e.settings.submitButtonText})})]})]})}exports.About=dn;exports.AddonsSelection=Wn;exports.BeforeAfter=Cn;exports.BookingFlow=Ro;exports.BookingSection=En;exports.BottomSheet=jn;exports.CYCLE_PHASES=Io;exports.Confirmation=Yn;exports.Contact=yn;exports.ContactForm=Vn;exports.CycleAwareDateSelection=pi;exports.DateSelection=nr;exports.FAQSection=$n;exports.FeatureContent=wn;exports.FeaturedLink=on;exports.FixedInfoCard=In;exports.FormBlock=Qr;exports.FormRenderer=Pa;exports.Gallery=mn;exports.Header=nn;exports.Hero=cn;exports.HoldTimer=Tr;exports.ImageSection=Mn;exports.InstagramFeed=Fn;exports.LinkList=sn;exports.LocationMap=An;exports.Logo=tn;exports.MinimalFooter=vn;exports.MinimalHeader=bn;exports.MinimalNavigation=xn;exports.Navbar=Bn;exports.PricingTable=Sn;exports.ScrollingTextDivider=Pn;exports.SectionRenderer=yi;exports.ServiceSelection=On;exports.ServicesPreview=un;exports.SocialBar=ln;exports.Team=fn;exports.Testimonials=gn;exports.TextSection=zn;exports.TimeSelection=Hn;exports.VideoSection=Rn;exports.animations=rr;exports.createEntranceAnimation=ge;exports.createStaggerAnimation=zc;exports.getAnimationDuration=$c;exports.getFadeVariants=Qa;exports.getSlideVariants=Ja;exports.getTransitionVariants=Lc;exports.sanitizeFormData=$u;exports.shouldReduceMotion=Bc;exports.validateField=co;exports.validateForm=Ta;//# sourceMappingURL=index.js.map
22
22
  //# sourceMappingURL=index.js.map