import{j as e,r as f,b as de}from"./client-BbMi5ewG.js";import{u as Nt,A as Ct}from"./ActionButton-CK3Uoxvt.js";import{C as kt}from"./CrudLayout-Cx6KhKUY.js";import{F as V,T as q,a as Be,b as H,E as Se,c as Ce,S as ut,N as _e,H as oe,U as Ge,d as G,e as St}from"./Field-DfnhKY2X.js";import{C as Pt}from"./Calender-DPznisyw.js";import{C as Ke}from"./CreditCard-Bmei54hq.js";import{C as Me}from"./Cogs-DGuXlZ5Z.js";import{w as pt,C as Lt}from"./withIconDefaults-C8UfSjn1.js";import{B as At,m as Tt,A as Mt,j as It,L as _t,C as Et,l as We,h as Ft,u as Dt,R as Rt,g as $t}from"./index-CM0LBdHD.js";import{C as Bt,a as Ot,b as zt,d as Ht,e as Vt,f as Gt}from"./command-BMJPUla5.js";import{P as Kt,a as Wt,b as Zt}from"./popover-C75zZF26.js";import{B as le}from"./Button-1dacbE2T.js";import{B as xt}from"./badge-C2Ir4HoT.js";import{c as se,a as Ee,X as pe}from"./utils-Q0fnGDhj.js";import{C as ht}from"./check-DMod5j-l.js";import{S as qt}from"./switch-BXH9Uq5p.js";import{L as bt}from"./label-1wXMewvs.js";import{I as Fe}from"./input-DhCVOJC-.js";import{_ as ge,a as W}from"./index-D59bwJy3.js";import{C as ue}from"./calendar-CjyQ6Zau.js";import{C as Ut,b as gt,V as ft,S as Yt}from"./CalenderCheck-BuHSX8YD.js";import{P as te}from"./plus-DcvXjop0.js";import{P as Qt}from"./ProUpgradeBanner-j5GA7rlc.js";import{D as De}from"./dollar-sign-DRtWdm2i.js";import{L as Pe}from"./lock-DbcYKLM6.js";import{C as yt}from"./crown-BdDHOvET.js";import{E as Le}from"./eye-XZqBNmRu.js";import{E as jt}from"./external-link-DaS0YMlL.js";import{T as Re}from"./trash-2-wbt0ZJUy.js";import{S as vt}from"./save-CE8wXkbA.js";import{G as Xt}from"./grip-vertical-tAen9Usk.js";import{C as Jt}from"./index-BbWn2ja9.js";import{C as Ze}from"./checkbox-BS_fWNWw.js";import{S as es}from"./separator-DZRbPm0x.js";import{S as Ie}from"./skeleton-ImO4uxQ7.js";import{T as ts,a as ss,b as qe,c as Ue}from"./tabs-sf64UEkO.js";import{P as Ye}from"./progress-LiitFnHM.js";import"./apiConfig-D-T4C2Ae.js";import{D as Qe}from"./download-DYVVCiUT.js";import{L as re}from"./loader-circle--S58donA.js";import{C as Oe}from"./circle-alert-CG2uW-Df.js";import{F as as}from"./file-text-DLx-plKT.js";import{C as wt}from"./circle-check-B35mPstZ.js";import{u as ie,s as Y,a as Ae}from"./store-jX25q14N.js";import{s as $e,e as Z}from"./toast-1-c8k_LJ.js";import{C as ze}from"./ConfirmDialog-C2asEKXG.js";import{S as ls}from"./shield-Bmp_421z.js";import{I as rs}from"./ImageUpload-DbfzQEp2.js";import{u as is}from"./useMediaUploader-lszBTVoc.js";import{P as ns}from"./phone-input-CK3GNas0.js";import{v as He}from"./phoneValidation-D89G1rc_.js";import{P as fe}from"./ProBadge-Dxcpp0NN.js";import"./vendor-DDjlQeP6.js";import"./ArrowLeftIcon-DrGyoHe_.js";import"./preload-helper-Dp1pzeXC.js";import"./tag-CvsOfBQf.js";import"./proxy-DChtKkEh.js";import"./circle-check-big-uMTsaxsq.js";import"./dialog-C9IQloQy.js";import"./index-C4Ytkwtd.js";import"./search-C6CI7Qpa.js";import"./index-CeptMk_f.js";import"./index-BE6isdVb.js";import"./index-B5gX5Cyp.js";import"./lodash-Bd-B7UeG.js";import"./defineProperty-DbXIQDXj.js";import"./typeof-QjJsDpFa.js";import"./scroll-area-BldTLQYj.js";/**
 * @license lucide-react v0.525.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const os=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],ds=se("code-xml",os);/**
 * @license lucide-react v0.525.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const cs=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]],ms=se("file-up",cs);/**
 * @license lucide-react v0.525.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const us=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],ps=se("key",us);/**
 * @license lucide-react v0.525.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xs=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],hs=se("pencil",xs);/**
 * @license lucide-react v0.525.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const bs=[["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5",key:"4mh3h7"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5",key:"1mdrzq"}]],gs=se("percent",bs);/**
 * @license lucide-react v0.525.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const fs=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],ys=se("power",fs);/**
 * @license lucide-react v0.525.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const js=[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]],vs=se("refresh-ccw",js);/**
 * @license lucide-react v0.525.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ws=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],Ns=se("shield-alert",ws);function Cs(){return e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M16.667 0C18.5048 0.000176299 20 1.49512 20 3.33301V16.666C20 18.5039 18.5048 19.9998 16.667 20H3.33301C1.49516 19.9998 0 18.5039 0 16.666V3.33301C0 1.49512 1.49516 0.000176622 3.33301 0H16.667ZM1.33301 16.666C1.33301 17.7686 2.23049 18.6658 3.33301 18.666H9.33301V10.666H1.33301V16.666ZM10.667 18.666H16.667C17.7695 18.6658 18.667 17.7686 18.667 16.666V10.666H10.667V18.666ZM6.27637 12.7812C6.53703 12.5206 6.95808 12.5206 7.21875 12.7812C7.47917 13.0419 7.47934 13.463 7.21875 13.7236L6.27637 14.666L7.21875 15.6094C7.47933 15.87 7.47916 16.2911 7.21875 16.5518C7.08875 16.6818 6.91774 16.7471 6.74707 16.7471C6.57649 16.747 6.4063 16.6817 6.27637 16.5518L5.33301 15.6094L4.39062 16.5518C4.26063 16.6818 4.08961 16.7471 3.91895 16.7471C3.74841 16.747 3.57814 16.6817 3.44824 16.5518C3.18767 16.2911 3.18761 15.87 3.44824 15.6094L4.39062 14.666L3.44824 13.7236C3.1876 13.463 3.18766 13.0419 3.44824 12.7812C3.70891 12.5206 4.12996 12.5206 4.39062 12.7812L5.33301 13.7236L6.27637 12.7812ZM16.667 15.333C17.0355 15.3332 17.333 15.6321 17.333 16C17.3327 16.3677 17.0353 16.6658 16.667 16.666H12.667C12.2985 16.666 12.0003 16.3678 12 16C12 15.632 12.2983 15.333 12.667 15.333H16.667ZM16.667 12.666C17.0355 12.6662 17.333 12.9651 17.333 13.333C17.3329 13.7008 17.0355 13.9998 16.667 14H12.667C12.2984 14 12.0001 13.7009 12 13.333C12 12.965 12.2983 12.666 12.667 12.666H16.667ZM3.33301 1.33301C2.23049 1.33318 1.33301 2.23045 1.33301 3.33301V9.33301H9.33301V1.33301H3.33301ZM10.667 9.33301H18.667V3.33301C18.667 2.23045 17.7695 1.33318 16.667 1.33301H10.667V9.33301ZM5.33301 2.66602C5.70167 2.66602 6 2.96501 6 3.33301V4.66602H7.33301C7.70167 4.66602 8 4.96501 8 5.33301C7.99991 5.70093 7.70162 6 7.33301 6H6V7.33301C5.99991 7.70093 5.70162 8 5.33301 8C4.96455 7.99982 4.66708 7.70082 4.66699 7.33301V6H3.33301C2.96455 5.99982 2.66708 5.70082 2.66699 5.33301C2.66699 4.96512 2.96449 4.66619 3.33301 4.66602H4.66699V3.33301C4.66699 2.96512 4.96449 2.66619 5.33301 2.66602ZM16.667 4.66602C17.0355 4.66619 17.333 4.96512 17.333 5.33301C17.3329 5.70083 17.0355 5.99982 16.667 6H12.667C12.2984 6 12.0001 5.70093 12 5.33301C12 4.96501 12.2983 4.66602 12.667 4.66602H16.667Z",fill:"currentColor"})})}const ks=pt(Cs);function Ss(){return e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M1.84668 6.28027C1.55478 7.10616 1.40723 7.97453 1.40723 8.85938C1.40749 13.1239 4.87699 16.5938 9.1416 16.5938C10.7437 16.5937 12.2948 16.0934 13.5859 15.1875H11.915V13.7812H16.1338V18H14.7275V16.0928C13.139 17.3182 11.1752 17.9999 9.1416 18C4.08932 18 0.000263408 13.9109 0 8.85938C0 7.81465 0.175342 6.78918 0.520508 5.8125L1.84668 6.28027ZM9.7041 5.55469C10.1522 5.64605 10.5697 5.82289 10.9385 6.06738L11.9834 5.02246L12.9775 6.0166L11.9326 7.06152C12.1772 7.43042 12.354 7.84863 12.4453 8.29688H13.9229V9.70312H12.4453C12.3539 10.1512 12.1771 10.5687 11.9326 10.9375L12.9775 11.9824L11.9834 12.9766L10.9385 11.9316C10.5697 12.1761 10.1521 12.353 9.7041 12.4443V13.9219H8.29785V12.4443C7.84961 12.353 7.43139 12.1762 7.0625 11.9316L6.01758 12.9766L5.02344 11.9824L6.06836 10.9375C5.82387 10.5687 5.64703 10.1512 5.55566 9.70312H4.0791V8.29688H5.55566C5.647 7.84863 5.82378 7.43042 6.06836 7.06152L5.02344 6.0166L6.01758 5.02246L7.0625 6.06738C7.43139 5.8228 7.84964 5.64602 8.29785 5.55469V4.07812H9.7041V5.55469ZM3.27441 1.90527C4.86285 0.68029 6.82708 0 8.86035 0C13.9126 0.000263448 18.001 4.08905 18.001 9.14062C18.0009 10.1852 17.8255 11.21 17.4805 12.1865L16.1543 11.7188C16.4461 10.893 16.5947 10.0253 16.5947 9.14062C16.5947 4.87602 13.1249 1.40651 8.86035 1.40625C7.25807 1.40625 5.70636 1.90649 4.41504 2.8125H6.08691V4.21875H1.86816V0H3.27441V1.90527ZM9.00098 6.89062C7.83787 6.89062 6.8916 7.83689 6.8916 9C6.89187 10.1629 7.83803 11.1094 9.00098 11.1094C10.1637 11.1091 11.1101 10.1627 11.1104 9C11.1104 7.83705 10.1639 6.89089 9.00098 6.89062ZM9.00098 8.29688C9.38908 8.29714 9.7041 8.61184 9.7041 9C9.70384 9.38794 9.38891 9.70286 9.00098 9.70312C8.61281 9.70312 8.29812 9.3881 8.29785 9C8.29785 8.61167 8.61265 8.29688 9.00098 8.29688Z",fill:"currentColor"})})}const Ps=pt(Ss);function Ls({tabs:l=[],activeTab:t,onTabChange:o}){const n=f.useMemo(()=>l.map(s=>s.id),[l]),a=f.useMemo(()=>n.includes(t)?[t]:[],[n,t]),r=f.useMemo(()=>l.filter(s=>a.includes(s.id)),[l,a]);return e.jsx("div",{className:"border border-border bg-white rounded-t-xl",children:r.map(s=>e.jsxs("div",{className:"relative flex items-center gap-3 px-6 py-4",children:[e.jsx("div",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-[3px] h-8 bg-primary rounded-r-full"}),s.icon&&e.jsx("div",{className:"flex items-center justify-center w-9 h-9 rounded-lg bg-primary/8 text-primary",children:s.icon}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("h2",{className:" text-[20px] font-semibold text-title leading-tight",children:s.title}),s.description&&e.jsx("p",{className:"text-xs text-title2 mt-0.5 leading-snug",children:s.description})]})]},s.id))})}function As(l){const t=document.createElement("textarea");return t.innerHTML=l,t.value}var rt,it,nt,ot,dt,ct,mt;const Xe={tabs:[{id:"modules",title:"Modules",icon:e.jsx(At,{size:18})},{id:"general",title:"General Settings",icon:e.jsx(Me,{})},{id:"schedule",title:"Schedule Settings",icon:e.jsx(Pt,{})},{id:"tax",title:"Tax",icon:e.jsx(Me,{})},{id:"appointment-settings",title:"Appointment Settings",icon:e.jsx(ks,{})},{id:"integrations",title:"Integrations Settings",icon:e.jsx(Ps,{})},{id:"payment",title:"Payment Settings",icon:e.jsx(Ke,{})},{id:"chatbot",title:"AI Chatbot",icon:e.jsx(Tt,{size:18})},{id:"export-import",title:"Export / Import",icon:e.jsx(Mt,{size:18})},...(rt=window.radius_booking_param)!=null&&rt.is_cl_active?[{id:"payout",title:"Payout",icon:e.jsx(Ke,{})}]:[],...(it=window.radius_booking_param)!=null&&it.is_pro?[{id:"license",title:"License",icon:e.jsx(Me,{})}]:[]],sections:[{id:"currency",tab:"general",title:"Currency & Price",description:"Symbol placement and number formatting",cols:3,fields:[{key:"currency.symbol",type:"select2",label:"Currency symbol",options:Object.entries(window.radius_booking_param.currency_symbol).map(([l,t])=>({value:l,label:`${l} (${As(t)})`})),gridColumn:1},{key:"currency.symbolPosition",label:"Symbol position",type:"select",options:[{value:"before",label:"Before price"},{value:"after",label:"After price"},{value:"before_with_space",label:"Before with space"},{value:"after_with_space",label:"After with space"}],gridColumn:1},{key:"currency.decimals",label:"Number of decimals",type:"number",min:0,max:4,gridColumn:1},{key:"currency.thousand",label:"Thousand separator",type:"select",options:[{value:",",label:"Comma (1,000)"},{value:".",label:"Dot (1.000)"},{value:" ",label:"Space (1 000)"}],gridColumn:2},{key:"currency.decimal",label:"Decimal separator",type:"select",options:[{value:".",label:"Dot (0.99)"},{value:",",label:"Comma (0,99)"}],gridColumn:2}]},{id:"phone",tab:"general",title:"Phone Settings",description:"Country detection and validation",fields:[{key:"phone.showAllCountries",label:"Countries shown in phone field",type:"select",options:[{value:!0,label:"Show all countries"},{value:!1,label:"Show only selected countries"}],gridColumn:1},{key:"phone.showOnlyCountries",label:"Select countries available for phone number field",type:"select2",options:(nt=window.radius_booking_param)==null?void 0:nt.country,multiple:!0,gridColumn:1,condition:{key:"phone.showAllCountries",value:!1}},{key:"phone.defaultCountry",label:"Default Country",type:"select2",options:(ot=window.radius_booking_param)==null?void 0:ot.country,dependency:"showOnlyCountries",gridColumn:1},{key:"phone.formatOnInput",label:"Format phone number on input",type:"toggle"},{key:"phone.showDialCode",label:"Show country dial code next to flag",type:"toggle"}]},{id:"auth",tab:"general",title:"Authentication",description:"Customer accounts and login options",fields:[{key:"auth.useWordPressUsers",label:"Auto-create users on appointment confirmation",type:"toggle"},{key:"auth.allowCustomerRegistration",label:"Customer can register for an account",type:"toggle"}]},{id:"pages",tab:"general",title:"Setup Pages",description:"Select the pages that contain booking shortcodes",fields:[{key:"pages.bookingFormPage",label:"Booking Form Page",type:"select2",options:((dt=window.radius_booking_param)==null?void 0:dt.wp_pages)||[],hint:"Page containing [radius_booking_form] shortcode",gridColumn:1},{key:"pages.myBookingPage",label:"My Booking Page",type:"select2",options:((ct=window.radius_booking_param)==null?void 0:ct.wp_pages)||[],hint:"Page containing [rtrb_my_booking] shortcode",gridColumn:1}]},{id:"staff-permissions",tab:"general",title:"Staff Permissions",description:"Control what employees/staff can do from their dashboard",fields:[{key:"staffPermissions.canEditService",label:"Staff can edit their assigned services",type:"toggle",hint:"Allows employees to update service details like name, price, duration, and description"},{key:"staffPermissions.canCreateService",label:"Staff can create new services",type:"toggle",isPro:!0,hint:"Allows employees to add new services from their dashboard"},{key:"staffPermissions.canDeleteService",label:"Staff can delete their services",type:"toggle",isPro:!0,hint:"Allows employees to remove services they are assigned to"},{key:"staffPermissions.canManageStaff",label:"Staff can manage other staff members",type:"toggle",isPro:!0,hint:"Allows employees to create, edit, and manage other staff from their dashboard"},{key:"staffPermissions.canEditWorkSchedule",label:"Staff can update their work schedule",type:"toggle",isPro:!0,hint:"Allows employees to customize their work hours, days off, and special days from their dashboard"}]},{id:"business",tab:"general",title:"Business Information",description:"Used across your communications and calendar",fields:[{key:"business.companyName",label:"Company Name",type:"text",placeholder:"Company Name",gridColumn:1},{key:"business.phone",label:"Business Phone",type:"phone",placeholder:"(555) 555-5555",gridColumn:1},{key:"business.address",label:"Business Address",type:"text",placeholder:"Street, City, State, ZIP",gridColumn:1},{key:"business.logoUrl",label:"Company Logo URL",type:"image",placeholder:"https://..."}]},{id:"email",tab:"general",title:"Email Settings",description:"Configure the sender details for all outgoing emails",fields:[{key:"email.senderName",type:"text",label:"Sender Name",placeholder:"e.g. My Booking System",hint:"Leave empty to use Company Name or site name",gridColumn:1},{key:"email.senderEmail",type:"text",label:"Sender Email",placeholder:"e.g. noreply@example.com",hint:"Leave empty to use WordPress admin email",gridColumn:1},{key:"email.replyToEmail",type:"text",label:"Reply-to Email",placeholder:"e.g. support@example.com",hint:"Leave empty to use Sender Email",gridColumn:1}]},{id:"datetime",tab:"schedule",title:"Date & Time",description:"Set formats and intervals for scheduling",fields:[{key:"dateTime.timeSystem",label:"Time system",type:"select",options:[{value:"12h",label:"12-hour clock"},{value:"24h",label:"24-hour clock"}],gridColumn:1},{key:"dateTime.dateFormat",label:"Date format",type:"select",options:[{value:"Y-m-d",label:`${new Date().getFullYear()}-${String(new Date().getMonth()+1).padStart(2,"0")}-${String(new Date().getDate()).padStart(2,"0")} (yyyy-mm-dd)`},{value:"F j, Y",label:`${new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})} (F j, Y)`},{value:"m/d/Y",label:`${String(new Date().getMonth()+1).padStart(2,"0")}/${String(new Date().getDate()).padStart(2,"0")}/${new Date().getFullYear()} (mm/dd/yyyy)`},{value:"Y/m/d",label:`${new Date().getFullYear()}/${String(new Date().getMonth()+1).padStart(2,"0")}/${String(new Date().getDate()).padStart(2,"0")} (yyyy/mm/dd)`},{value:"Y.m.d",label:`${new Date().getFullYear()}.${String(new Date().getMonth()+1).padStart(2,"0")}.${String(new Date().getDate()).padStart(2,"0")} (yyyy.mm.dd)`}],gridColumn:1},{key:"dateTime.selectableInterval",label:"Default Time Duration Step (minutes)",type:"number",min:5,step:5,gridColumn:1}]},{id:"restrictions",tab:"schedule",title:"Booking Restrictions",description:"Limit how far in advance customers can book",cols:2,fields:[{key:"restrictions.earliest",label:"Minimum time before booking",type:"text",placeholder:"e.g. +1 hour, +30 minutes",hint:'Use "+1 month", "+2 weeks", "+5 days", "+3 hours", "+30 minutes" or a fixed date YYYY-MM-DD.',gridColumn:1},{key:"restrictions.latest",label:"Period available for booking in advance",type:"text",placeholder:"e.g. +6 months or 2025-12-31",gridColumn:1},{key:"restrictions.minCancelTime",label:"Minimum time required before canceling",type:"text",placeholder:"e.g. +24 hours",hint:'Use "+24 hours", "+2 days", etc.',gridColumn:1},{key:"restrictions.minRescheduleTime",label:"Minimum time required before rescheduling",type:"text",placeholder:"e.g. +12 hours",hint:'Use "+12 hours", "+1 day", etc.',gridColumn:1}]},{id:"weekly-schedule",tab:"schedule",title:"General Weekly Schedule",description:"Set default working hours for each day",component:"custom",render:()=>null},{id:"custom-schedules",tab:"schedule",title:"Days With Custom Schedules",description:"Override weekly schedule for specific dates",component:"custom",render:()=>null},{id:"holidays",tab:"schedule",title:"Holidays & Days Off",description:"Mark dates as unavailable for booking",component:"custom",render:()=>null},{id:"configure-tax",tab:"tax",title:"Configure Tax",description:"Configure tax calculation for bookings",isPro:!0,fields:[{key:"tax.enabled",label:"Enable Tax",type:"toggle",position:"top"},{key:"tax.label",label:"Tax Label",type:"text",placeholder:"e.g., VAT, GST, Sales Tax",condition:{key:"tax.enabled",value:!0}},{key:"tax.rate",label:"Tax Rate (%)",type:"number",min:0,step:.1,condition:{key:"tax.enabled",value:!0}},{key:"tax.inclusive",label:"Prices include tax",type:"toggle",description:"Enable if your service prices already include tax",condition:{key:"tax.enabled",value:!0}}]},{id:"offline-payment",tab:"payment",title:"Offline Payment",description:"Accept cash, check, or other offline payment methods",component:"custom"},{id:"paypal",tab:"payment",title:"PayPal",description:"Accept payments via PayPal",component:"custom"},{id:"stripe",tab:"payment",title:"Stripe",description:"Accept credit card payments via Stripe",component:"custom"},{id:"service-list",tab:"appointment-settings",title:"Service List Shortcode",description:"Configure the [rtrb_service_list] shortcode display",cols:2,fields:[{key:"serviceList.layout",label:"Default Layout",type:"select",options:[{value:"grid",label:"Grid"},{value:"list",label:"List"}],gridColumn:1},{key:"serviceList.columns",label:"Grid Columns",type:"select",options:[{value:2,label:"2 Columns"},{value:3,label:"3 Columns"},{value:4,label:"4 Columns"}],gridColumn:1},{key:"serviceList.perPage",label:"Services Per Page",type:"number",min:3,max:50,gridColumn:1},{key:"serviceList.buttonText",label:"Book Button Text",type:"text",placeholder:"Book Now",gridColumn:1},{key:"serviceList.primaryColor",label:"Primary Color",type:"color",gridColumn:2},{key:"serviceList.cardRadius",label:"Card Border Radius",type:"unit",units:["px","rem","em"],placeholder:"12",gridColumn:2},{key:"serviceList.showImage",label:"Show service image",type:"toggle"},{key:"serviceList.showPrice",label:"Show service price",type:"toggle"},{key:"serviceList.showDuration",label:"Show service duration",type:"toggle"},{key:"serviceList.showCategory",label:"Show category badge",type:"toggle"},{key:"serviceList.showDescription",label:"Show service description",type:"toggle"},{key:"serviceList.showCategoryFilter",label:"Show category filter",type:"toggle"},{key:"serviceList.showStaff",label:"Show assigned staff",type:"toggle"}]},{id:"statuses",tab:"appointment-settings",title:"Statuses",description:"Configure default and auxiliary statuses for appointments",fields:[{key:"statuses.default",label:"Default appointment status",type:"select",options:[{value:"confirmed",label:"Confirmed"},{value:"pending",label:"Pending"},{value:"canceled",label:"Canceled"},{value:"completed",label:"Completed"}],gridColumn:1}]},{id:"customer",tab:"appointment-settings",title:"Customer Settings",description:"Rescheduling and cancellations",isPro:!0,fields:[{key:"customer.allowReschedule",label:"Allow customers to reschedule",type:"toggle"},{key:"customer.allowCancel",label:"Allow customers to cancel their bookings",type:"toggle"}]},{id:"google-calendar-integration",tab:"integrations",title:"Google Calendar",description:"Sync appointments with Google Calendar",component:"custom"},{id:"zoom-integration",tab:"integrations",title:"Zoom",description:"Create and manage Zoom meetings for appointments",component:"custom"},{id:"apple-calendar-integration",tab:"integrations",title:"Apple Calendar",description:"Generate iCal files for Apple Calendar sync",component:"custom"},{id:"classified-listing-integration",tab:"integrations",title:"Classified Listing",description:"Turn classified listings into bookable services",component:"custom"},{id:"chatbot-general",tab:"chatbot",title:"General Settings",description:"Configure your AI booking assistant",isPro:!0,fields:[{key:"chatbot.enabled",label:"Enable AI Chatbot",type:"toggle",position:"top"},{key:"chatbot.showFormToggle",label:"Enable AI/Classic Toggle in Appointment",type:"toggle",hint:"Show a toggle in the appointment form to switch between AI Booking and Classic Form.",condition:{key:"chatbot.enabled",value:!0}},{key:"chatbot.provider",label:"AI Provider",type:"select",options:[{value:"openai",label:"OpenAI (GPT)"},{value:"gemini",label:"Google Gemini"}],gridColumn:1},{key:"chatbot.apiKey",label:"OpenAI API Key",type:"password",placeholder:"sk-...",hint:"Your OpenAI API key. Never shared with the browser.",gridColumn:1,condition:{key:"chatbot.provider",value:"openai"}},{key:"chatbot.model",label:"OpenAI Model",type:"select",options:[{value:"gpt-4o-mini",label:"GPT-4o Mini (Fast & Affordable)"},{value:"gpt-4o",label:"GPT-4o (Most Capable)"},{value:"gpt-3.5-turbo",label:"GPT-3.5 Turbo (Legacy)"}],gridColumn:1,condition:{key:"chatbot.provider",value:"openai"}},{key:"chatbot.geminiApiKey",label:"Gemini API Key",type:"password",placeholder:"AIza...",hint:"Your Google Gemini API key. Get one at aistudio.google.com",gridColumn:1,condition:{key:"chatbot.provider",value:"gemini"}},{key:"chatbot.geminiModel",label:"Gemini Model",type:"select",options:[{value:"gemini-2.5-pro",label:"Gemini 2.5 Pro (Most Capable - Stable)"},{value:"gemini-2.5-flash",label:"Gemini 2.5 Flash (Balanced - Stable)"},{value:"gemini-2.5-flash-lite",label:"Gemini 2.5 Flash Lite (Fast & Cost-Efficient)"},{value:"gemini-3.1-pro-preview",label:"Gemini 3.1 Pro (Next-Gen Preview)"},{value:"gemini-3-flash-preview",label:"Gemini 3 Flash (Fastest Reasoning Preview)"}],gridColumn:1,condition:{key:"chatbot.provider",value:"gemini"}},{key:"chatbot.responseStyle",label:"Response Style",type:"select",options:[{value:"modern",label:"Modern (Rich Cards & UI)"},{value:"text",label:"Text Only (Plain Messages)"}],gridColumn:1},{key:"chatbot.botName",label:"Bot Name",type:"text",placeholder:"Booking Assistant",gridColumn:1},{key:"chatbot.welcomeMessage",label:"Welcome Message",type:"textarea",placeholder:"Hi! How can I help you today?",rows:3,gridColumn:1}]},{id:"chatbot-display",tab:"chatbot",title:"Display Settings",description:"Control where the chatbot appears",isPro:!0,fields:[{key:"chatbot.displayMode",label:"Display Mode",type:"select",options:[{value:"all_pages",label:"All Pages"},{value:"booking_pages",label:"Booking Pages Only"},{value:"specific_pages",label:"Specific Pages"}],gridColumn:1},{key:"chatbot.specificPages",label:"Select Pages",type:"select2",options:((mt=window.radius_booking_param)==null?void 0:mt.wp_pages)||[],multiple:!0,gridColumn:1,condition:{key:"chatbot.displayMode",value:"specific_pages"}}]},{id:"chatbot-appearance",tab:"chatbot",title:"Appearance & Live Preview",description:"Customize the chatbot look and see changes in real time",component:"custom",isPro:!0,fields:[{key:"chatbot.bubbleIcon",label:"Bubble Icon",type:"select",options:[{value:"chat",label:"Chat Bubble"},{value:"headset",label:"Headset / Support"},{value:"bot",label:"Robot / AI"},{value:"help",label:"Help Circle"},{value:"custom",label:"Custom Image",isPro:!0}]},{key:"chatbot.bubbleImage",label:"Custom Icon Image",type:"image",isPro:!0,condition:{key:"chatbot.bubbleIcon",value:"custom"}},{key:"chatbot.primaryColor",label:"Primary Color",type:"color"},{key:"chatbot.position",label:"Widget Position",type:"select",options:[{value:"bottom-right",label:"Bottom Right"},{value:"bottom-left",label:"Bottom Left"}]},{key:"chatbot.poweredBy",label:"Powered By Text",type:"text",isPro:!0,placeholder:"Powered by Radius Booking",hint:"Leave empty to hide. Shown at the bottom of the chat window.",proText:"To update the text, Please upgrade to the Pro version."}]},{id:"chatbot-knowledge",tab:"chatbot",title:"Knowledge Base",description:"Manage FAQs and policies the chatbot can reference",component:"custom",isPro:!0},{id:"chatbot-advanced",tab:"chatbot",title:"Advanced Settings",description:"Fine-tune the AI model behavior",isPro:!0,fields:[{key:"chatbot.maxTokens",label:"Max Tokens",type:"number",min:256,max:4096,step:128,hint:"Maximum length of the AI response.",gridColumn:1},{key:"chatbot.temperature",label:"Temperature",type:"number",min:0,max:2,step:.1,hint:"Higher values make output more creative, lower values more focused.",gridColumn:1}]},{id:"payout-settings",tab:"payout",title:"Payout Configuration",description:"Configure commission rates, minimum payout amounts, and available payout methods for employees",component:"custom",isPro:!0},{id:"languages",tab:"localization",title:"Manage Languages",description:"Available languages for your booking system",component:"custom",render:()=>null}]};function Ts({options:l,value:t,onChange:o,multiple:n=!1,className:a=""}){const[r,s]=f.useState(!1),m=c=>n?Array.isArray(t)&&t.includes(c):t===c,u=c=>{if(n){const x=Array.isArray(t)?t:[],v=x.includes(c)?x.filter(w=>w!==c):[...x,c];o(v)}else o(c),s(!1)},p=(c,x)=>{c.stopPropagation(),n&&Array.isArray(t)&&o(t.filter(v=>v!==x))},d=()=>{if(n){const x=Array.isArray(t)?t:[];return x.length===0?e.jsx("span",{className:"text-muted-foreground",children:"Select countries"}):e.jsx("div",{className:"flex flex-wrap gap-1",children:x.map(v=>{const w=l.find(C=>C.value===v);return e.jsxs(xt,{variant:"secondary",className:"mr-1 mb-1",children:[(w==null?void 0:w.label)||v,e.jsx("span",{role:"button",tabIndex:0,className:"ml-1 ring-offset-background rounded-full outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 cursor-pointer hover:bg-muted",onMouseDown:C=>C.preventDefault(),onClick:C=>p(C,v),onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),p(C,v))},children:e.jsx(pe,{className:"h-3 w-3"})})]},v)})})}const c=l.find(x=>x.value===t);return(c==null?void 0:c.label)||e.jsx("span",{className:"text-muted-foreground",children:"Select country"})};return e.jsxs(Kt,{open:r,onOpenChange:s,children:[e.jsx(Wt,{asChild:!0,children:e.jsxs(le,{variant:"outline",role:"combobox","aria-expanded":r,className:Ee("w-[250px] justify-between h-[45px] shadow-none w-full",a,n&&"h-auto min-h-[40px]"),children:[e.jsx("div",{className:"flex-1 text-left",children:d()}),e.jsx(Bt,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(Zt,{className:"w-[250px] p-0 max-h-60 overflow-y-auto",children:e.jsxs(Ot,{children:[e.jsx(zt,{className:"!border-none !focus:outline-none !focus:border-none !shadow-none",placeholder:"Search ..."}),e.jsx(Ht,{children:"No country found."}),e.jsx(Vt,{children:l.map(c=>e.jsxs(Gt,{onSelect:()=>u(c.value),children:[e.jsx(ht,{className:Ee("mr-2 h-4 w-4",m(c.value)?"opacity-100":"opacity-0")}),c.label]},c.value))})]})})]})}function Ms({settings:l,onUpdate:t}){const o=[{key:"monday",label:"Monday",short:"Mon"},{key:"tuesday",label:"Tuesday",short:"Tue"},{key:"wednesday",label:"Wednesday",short:"Wed"},{key:"thursday",label:"Thursday",short:"Thu"},{key:"friday",label:"Friday",short:"Fri"},{key:"saturday",label:"Saturday",short:"Sat"},{key:"sunday",label:"Sunday",short:"Sun"}],n=(r,s)=>{t(`weeklySchedule.${r}.enabled`,s)},a=(r,s,m)=>{t(`weeklySchedule.${r}.${s}`,m)};return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"grid grid-cols-[1fr_60px_1fr_1fr] gap-3 items-center px-4 py-2.5 bg-slate-50 rounded-lg text-xs font-semibold text-slate-500 uppercase tracking-wider",children:[e.jsx("span",{children:ge("Day","radius-booking")}),e.jsx("span",{className:"text-center",children:ge("Open","radius-booking")}),e.jsx("span",{children:ge("Opens at","radius-booking")}),e.jsx("span",{children:ge("Closes at","radius-booking")})]}),o.map(r=>{var u;const s=((u=l.weeklySchedule)==null?void 0:u[r.key])||{enabled:!0,start:"08:00",end:"17:00"},m=r.key==="saturday"||r.key==="sunday";return e.jsxs("div",{className:`grid grid-cols-[1fr_60px_1fr_1fr] gap-3 items-center px-4 py-3 rounded-lg border transition-all duration-200 ${s.enabled?"border-slate-200 bg-white shadow-sm":"border-transparent bg-slate-50/50"}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`w-8 h-8 rounded-lg flex items-center justify-center text-xs font-bold ${s.enabled?m?"bg-orange-50 text-orange-600":"bg-blue-50 text-[#1d4ed8]":"bg-slate-100 text-slate-400"}`,children:r.short}),e.jsx(bt,{className:`text-sm font-medium ${s.enabled?"text-slate-900":"text-slate-400"}`,children:ge(r.label,"radius-booking")})]}),e.jsx("div",{className:"flex justify-center",children:e.jsx(qt,{checked:s.enabled,onCheckedChange:p=>n(r.key,p)})}),e.jsx(Fe,{type:"time",value:s.start||"08:00",onChange:p=>a(r.key,"start",p.target.value),disabled:!s.enabled,className:`h-[38px] text-sm ${s.enabled?"":"opacity-40"}`}),e.jsx(Fe,{type:"time",value:s.end||"17:00",onChange:p=>a(r.key,"end",p.target.value),disabled:!s.enabled,className:`h-[38px] text-sm ${s.enabled?"":"opacity-40"}`})]},r.key)})]})}function Is({settings:l,onUpdate:t}){const[o,n]=f.useState(!1),[a,r]=f.useState({date:"",start:"08:00",end:"17:00",label:""}),s=l.customSchedules||[],m=()=>{if(!a.date){alert("Please select a date");return}const d=[...s,{...a,id:Date.now()}];t("customSchedules",d),r({date:"",start:"08:00",end:"17:00",label:""}),n(!1)},u=d=>{const c=s.filter(x=>x.id!==d);t("customSchedules",c)},p=d=>new Date(d).toLocaleDateString("en-US",{weekday:"short",year:"numeric",month:"short",day:"numeric"});return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[s.length===0&&!o&&e.jsxs("div",{className:"rounded-lg border border-dashed border-slate-300 bg-slate-50 p-8 text-center",children:[e.jsx(ue,{className:"mx-auto h-8 w-8 text-slate-400 mb-2"}),e.jsx("p",{className:"text-sm text-small-font",children:"No custom schedules yet"}),e.jsx("p",{className:"text-xs text-slate-400 mt-1",children:"Override your weekly schedule for specific dates"})]}),s.map(d=>e.jsxs("div",{className:"flex items-center gap-4 rounded-lg border border-border bg-white p-4 transition-all hover:border-slate-300",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(ue,{className:"h-4 w-4 text-blue-600"}),e.jsx("span",{className:"text-sm font-medium text-title",children:p(d.date)})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-600",children:[e.jsx(Ut,{className:"h-3.5 w-3.5 text-slate-400"}),e.jsxs("span",{children:[d.start," - ",d.end]}),d.label&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-slate-300",children:"•"}),e.jsx("span",{className:"text-small-font",children:d.label})]})]})]}),e.jsx("button",{onClick:()=>u(d.id),className:"rounded-md p-2 text-slate-400 transition-colors hover:bg-red-50 hover:text-red-600",title:"Remove schedule",children:e.jsx(pe,{className:"h-4 w-4"})})]},d.id))]}),o?e.jsxs("div",{className:"rounded-lg border border-blue-200 bg-blue-50 p-4 space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs font-medium text-title2",children:"Date"}),e.jsx("input",{type:"date",value:a.date,onChange:d=>r({...a,date:d.target.value}),className:"w-full rounded-md border border-border bg-white px-3 py-2 text-sm text-title focus:outline-none focus:ring-2 focus:ring-blue-200"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs font-medium text-title2",children:"Label (optional)"}),e.jsx("input",{type:"text",value:a.label,onChange:d=>r({...a,label:d.target.value}),placeholder:"e.g., Holiday hours",className:"w-full rounded-md border border-border bg-white px-3 py-2 text-sm text-title placeholder:text-slate-400 focus:outline-none focus:ring-2 focus:ring-blue-200"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs font-medium text-title2",children:"Start Time"}),e.jsx("input",{type:"time",value:a.start,onChange:d=>r({...a,start:d.target.value}),className:"w-full rounded-md border border-border bg-white px-3 py-2 text-sm text-title focus:outline-none focus:ring-2 focus:ring-blue-200"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs font-medium text-title2",children:"End Time"}),e.jsx("input",{type:"time",value:a.end,onChange:d=>r({...a,end:d.target.value}),className:"w-full rounded-md border border-border bg-white px-3 py-2 text-sm text-title focus:outline-none focus:ring-2 focus:ring-blue-200"})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx("button",{onClick:()=>{n(!1),r({date:"",start:"08:00",end:"17:00",label:""})},className:"rounded-md border border-border bg-white px-3 py-1.5 text-sm font-medium text-title2 shadow-sm hover:bg-slate-50",children:"Cancel"}),e.jsx("button",{onClick:m,className:"rounded-md bg-primary px-3 py-1.5 text-sm font-semibold text-white shadow hover:bg-blue-700",children:"Add Schedule"})]})]}):e.jsxs("button",{onClick:()=>n(!0),className:"flex w-full items-center justify-center gap-2 rounded-md border border-dashed border-slate-300 bg-white px-4 py-3 text-sm font-medium text-slate-600 transition-colors hover:border-blue-300 hover:bg-blue-50 hover:text-blue-600",children:[e.jsx(te,{className:"h-4 w-4"}),"Add Custom Schedule"]})]})}function _s({settings:l,onUpdate:t}){const[o,n]=f.useState(!1),[a,r]=f.useState({date:"",label:""}),s=l.holidays||[],m=()=>{if(!a.date){alert("Please select a date");return}const d=[...s,{...a,id:Date.now()}];t("holidays",d),r({date:"",label:""}),n(!1)},u=d=>{const c=s.filter(x=>x.id!==d);t("holidays",c)},p=d=>new Date(d).toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"});return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[s.length===0&&!o&&e.jsxs("div",{className:"rounded-lg border border-dashed border-slate-300 bg-slate-50 p-8 text-center",children:[e.jsx(ue,{className:"mx-auto h-8 w-8 text-slate-400 mb-2"}),e.jsx("p",{className:"text-sm text-small-font",children:"No holidays or days off yet"}),e.jsx("p",{className:"text-xs text-slate-400 mt-1",children:"Mark dates as unavailable for booking"})]}),s.map(d=>e.jsxs("div",{className:"flex items-center gap-4 rounded-lg border border-red-200 bg-red-50 p-4 transition-all hover:border-red-300",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(ue,{className:"h-4 w-4 text-red-600"}),e.jsx("span",{className:"text-sm font-medium text-title",children:p(d.date)})]}),d.label&&e.jsx("p",{className:"text-sm text-slate-600 ml-6",children:d.label})]}),e.jsx("button",{onClick:()=>u(d.id),className:"rounded-md p-2 text-red-400 transition-colors hover:bg-red-100 hover:text-red-600",title:"Remove holiday",children:e.jsx(pe,{className:"h-4 w-4"})})]},d.id))]}),o?e.jsxs("div",{className:"rounded-lg border border-red-200 bg-red-50 p-4 space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs font-medium text-title2",children:"Date"}),e.jsx("input",{type:"date",value:a.date,onChange:d=>r({...a,date:d.target.value}),className:"w-full rounded-md border border-border bg-white px-3 py-2 text-sm text-title focus:outline-none focus:ring-2 focus:ring-red-200"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs font-medium text-title2",children:"Label (optional)"}),e.jsx("input",{type:"text",value:a.label,onChange:d=>r({...a,label:d.target.value}),placeholder:"e.g., Christmas Day",className:"w-full rounded-md border border-border bg-white px-3 py-2 text-sm text-title placeholder:text-slate-400 focus:outline-none focus:ring-2 focus:ring-red-200"})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx("button",{onClick:()=>{n(!1),r({date:"",label:""})},className:"rounded-md border border-border bg-white px-3 py-1.5 text-sm font-medium text-title2 shadow-sm hover:bg-slate-50",children:"Cancel"}),e.jsx("button",{onClick:m,className:"rounded-md bg-red-600 px-3 py-1.5 text-sm font-semibold text-white shadow hover:bg-red-700",children:"Add Holiday"})]})]}):e.jsxs("button",{onClick:()=>n(!0),className:"flex w-full items-center justify-center gap-2 rounded-md border border-dashed border-slate-300 bg-white px-4 py-3 text-sm font-medium text-slate-600 transition-colors hover:border-red-300 hover:bg-red-50 hover:text-red-600",children:[e.jsx(te,{className:"h-4 w-4"}),"Add Holiday / Day Off"]})]})}function Es({settings:l,onUpdate:t}){const[o,n]=f.useState(!1),[a,r]=f.useState(""),s=l.languages||[],m=()=>{if(!a.trim()){alert("Please enter a language name");return}if(s.includes(a.trim())){alert("This language is already added");return}const p=[...s,a.trim()];t("languages",p),r(""),n(!1)},u=p=>{const d=s.filter(c=>c!==p);t("languages",d)};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[s.length===0&&!o&&e.jsx("div",{className:"rounded-lg border border-dashed border-slate-300 bg-slate-50 p-8 text-center",children:e.jsx("p",{className:"text-sm text-small-font",children:"No languages configured"})}),s.map((p,d)=>e.jsxs("div",{className:"flex items-center gap-4 rounded-lg border border-border bg-white p-4 transition-all hover:border-slate-300",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-blue-100",children:e.jsx("span",{className:"text-sm font-medium text-blue-700",children:p.charAt(0).toUpperCase()})}),e.jsx("span",{className:"text-sm font-medium text-title",children:p})]}),e.jsx("button",{onClick:()=>u(p),className:"rounded-md p-2 text-slate-400 transition-colors hover:bg-red-50 hover:text-red-600",title:"Remove language",children:e.jsx(pe,{className:"h-4 w-4"})})]},d))]}),o?e.jsxs("div",{className:"rounded-lg border border-blue-200 bg-blue-50 p-4 space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs font-medium text-title2",children:"Language Name"}),e.jsx("input",{type:"text",value:a,onChange:p=>r(p.target.value),placeholder:"e.g., Spanish, French, Bengali",className:"w-full rounded-md border border-border bg-white px-3 py-2 text-sm text-title placeholder:text-slate-400 focus:outline-none focus:ring-2 focus:ring-blue-200",onKeyDown:p=>p.key==="Enter"&&m()})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>{n(!1),r("")},className:"rounded-md border border-border bg-white px-3 py-1.5 text-sm font-medium text-title2 shadow-sm hover:bg-slate-50",children:"Cancel"}),e.jsx("button",{onClick:m,className:"rounded-md bg-primary px-3 py-1.5 text-sm font-semibold text-white shadow hover:bg-blue-700",children:"Add Language"})]})]}):e.jsxs("button",{onClick:()=>n(!0),className:"flex w-full items-center justify-center gap-2 rounded-md border border-dashed border-slate-300 bg-white px-4 py-3 text-sm font-medium text-slate-600 transition-colors hover:border-blue-300 hover:bg-blue-50 hover:text-blue-600",children:[e.jsx(te,{className:"h-4 w-4"}),"Add Language"]})]})}function Ve(l){var v,w,C;const{title:t,description:o,icon:n,enabled:a,testMode:r,onToggleEnabled:s,onToggleTestMode:m,children:u,isPro:p=!1,disabled:d=!1}=l,c={bg:"bg-[#F5FAFF]",border:"border-blue-200",badge:"bg-primary"},x=d||p&&!((v=window.radius_booking_param)!=null&&v.is_pro);return e.jsxs("div",{className:`rounded-lg border ${a&&!x?c.border:"border-border"} ${a&&!x?c.bg:"bg-lighter-2"} p-6 transition-all ${x?"opacity-60":""}`,children:[e.jsxs("div",{className:"mb-4 flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`flex h-10 w-10 items-center justify-center rounded-lg ${a&&!x?c.badge:"bg-[#DFEEFB]"}`,children:e.jsx(n,{className:`h-5 w-5 ${a&&!x?"text-white":"text-primary"}`})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"text-base font-semibold text-title",children:t}),p&&!((w=window.radius_booking_param)!=null&&w.is_pro)&&e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-gradient-to-r from-amber-400 to-orange-500 px-2 py-0.5 text-xs font-semibold text-white shadow-sm",children:[e.jsx(yt,{className:"h-3 w-3"}),"PRO"]})]}),e.jsx("p",{className:"text-sm text-slate-600",children:o}),x&&p&&e.jsx("p",{className:"text-xs text-amber-600 mt-1 font-medium",children:"Upgrade to PRO to use this payment gateway"})]})]}),(t==="PayPal"||t==="Offline Payment")&&e.jsx(H,{checked:a,onChange:s,label:"",disabled:x,boxStyle:!1}),t==="Stripe"&&((C=window.radius_booking_param)==null?void 0:C.is_pro)&&e.jsx(H,{checked:a,onChange:s,label:"",boxStyle:!1,disabled:x})]}),a&&!x&&e.jsxs(e.Fragment,{children:[r!==void 0&&e.jsxs("div",{className:"mb-4 flex items-center gap-3 rounded-md border border-border bg-white p-3",children:[e.jsx(H,{checked:r,onChange:m,label:"",boxStyle:!1,variant:"square",checkedBg:"bg-amber-500",unCheckedBg:"bg-primary"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-title2",children:r?"Test Mode":"Live Mode"}),e.jsx(xt,{variant:`${r?"borer":"default"}`,className:"rounded-full px-2 py-0.5 text-xs font-medium",children:r?"Sandbox":"Production"})]}),e.jsx("p",{className:"text-xs text-small-font mt-0.5",children:r?"No real transactions will be processed":"Real transactions will be processed"})]})]}),e.jsx("div",{className:"space-y-4",children:u})]}),!a&&!x&&e.jsx("p",{className:"text-sm text-small-font italic",children:"Enable this payment method to configure settings"}),x&&p&&e.jsx(Qt,{title:t,type:"Payment"})]})}function ke({value:l,onChange:t,placeholder:o,label:n,isVisible:a,onToggleVisible:r,disabled:s=!1}){return e.jsxs("div",{children:[n&&e.jsx("label",{className:"mb-1.5 block text-xs font-medium text-title2",children:n}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:a?"text":"password",value:l||"",onChange:m=>t(m.target.value),placeholder:o,disabled:s,className:"w-full rounded-md border border-border bg-white px-3 py-2 pr-10 text-sm text-title placeholder:text-slate-400 focus:outline-none focus:ring-2 focus:ring-blue-200 disabled:bg-slate-50 disabled:text-small-font disabled:cursor-not-allowed"}),e.jsx("button",{type:"button",onClick:r,disabled:s,className:"absolute right-2 top-1/2 -translate-y-1/2 rounded p-1 text-slate-400 hover:text-slate-600 disabled:opacity-50 disabled:cursor-not-allowed",children:a?e.jsx(Se,{className:"h-4 w-4"}):e.jsx(Le,{className:"h-4 w-4"})})]})]})}function Fs({settings:l,onUpdate:t}){var n;const o=((n=l.payment)==null?void 0:n.offline)||{};return e.jsxs(Ve,{title:"Offline Payment",description:"Accept cash, check, or other offline methods",icon:De,enabled:o.enabled,onToggleEnabled:a=>t("payment.offline.enabled",a),isPro:!1,children:[e.jsx(V,{label:"Payment method label",children:e.jsx(q,{value:o.label||"",onChange:a=>t("payment.offline.label",a.target.value),placeholder:"e.g., Pay at venue, Cash on delivery"})}),e.jsx(V,{label:"Payment instructions",children:e.jsxs("div",{className:"flex flex-col w-full",children:[e.jsx(Be,{value:o.instructions||"",onChange:a=>t("payment.offline.instructions",a.target.value),placeholder:"Instructions shown to customers after booking...",rows:4}),e.jsx("p",{className:"mt-1 text-xs text-small-font",children:"These instructions will be displayed on the confirmation page"})]})})]})}function Ds({settings:l,onUpdate:t}){var s,m;const[o,n]=de.useState({liveClient:!1,liveSecret:!1,testClient:!1,testSecret:!1}),a=((s=l.payment)==null?void 0:s.paypal)||{},r=a.testMode;return(m=window.radius_booking_param)!=null&&m.is_pro,e.jsx(Ve,{title:"PayPal",description:"Accept payments via PayPal",icon:gt,enabled:a.enabled,testMode:a.testMode,onToggleEnabled:u=>t("payment.paypal.enabled",u),onToggleTestMode:u=>t("payment.paypal.testMode",u),children:e.jsxs("div",{className:`space-y-4 rounded-md border p-4 ${r?"border-amber-200 bg-amber-50":"border-green-200 bg-green-50"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(Pe,{className:"h-4 w-4 text-slate-600"}),e.jsx("span",{className:"text-sm font-medium text-title2",children:r?"Test Credentials (Sandbox)":"Live Credentials"})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[e.jsx(ke,{label:`${r?"Test":"Live"} Client ID`,value:r?a.testClientId:a.liveClientId,onChange:u=>t(r?"payment.paypal.testClientId":"payment.paypal.liveClientId",u),placeholder:`Enter your PayPal ${r?"sandbox":"live"} client ID`,isVisible:r?o.testClient:o.liveClient,onToggleVisible:()=>n(u=>({...u,[r?"testClient":"liveClient"]:!u[r?"testClient":"liveClient"]}))}),e.jsx(ke,{label:`${r?"Test":"Live"} Secret Key`,value:r?a.testSecretKey:a.liveSecretKey,onChange:u=>t(r?"payment.paypal.testSecretKey":"payment.paypal.liveSecretKey",u),placeholder:`Enter your PayPal ${r?"sandbox":"live"} secret key`,isVisible:r?o.testSecret:o.liveSecret,onToggleVisible:()=>n(u=>({...u,[r?"testSecret":"liveSecret"]:!u[r?"testSecret":"liveSecret"]}))})]})]})})}function Rs({settings:l,onUpdate:t}){var m,u;const[o,n]=de.useState({livePublishable:!1,liveSecret:!1,testPublishable:!1,testSecret:!1}),a=((m=l.payment)==null?void 0:m.stripe)||{},r=a.testMode,s=((u=window.radius_booking_param)==null?void 0:u.is_pro)||!1;return e.jsxs(Ve,{title:"Stripe",description:"Accept credit card payments",icon:gt,enabled:a.enabled,testMode:a.testMode,onToggleEnabled:p=>t("payment.stripe.enabled",p),onToggleTestMode:p=>t("payment.stripe.testMode",p),isPro:!0,children:[e.jsxs("div",{className:`space-y-4 rounded-md border p-4 ${r?"border-amber-200 bg-amber-50":"border-green-200 bg-green-50"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(Pe,{className:"h-4 w-4 text-slate-600"}),e.jsx("span",{className:"text-sm font-medium text-title2",children:r?"Test Credentials":"Live Credentials"})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[e.jsx(ke,{label:`${r?"Test":"Live"} Publishable Key`,value:r?a.testPublishableKey:a.livePublishableKey,onChange:p=>t(r?"payment.stripe.testPublishableKey":"payment.stripe.livePublishableKey",p),placeholder:`pk_${r?"test":"live"}_...`,isVisible:r?o.testPublishable:o.livePublishable,onToggleVisible:()=>n(p=>({...p,[r?"testPublishable":"livePublishable"]:!p[r?"testPublishable":"livePublishable"]})),disabled:!s}),e.jsx(ke,{label:`${r?"Test":"Live"} Secret Key`,value:r?a.testSecretKey:a.liveSecretKey,onChange:p=>t(r?"payment.stripe.testSecretKey":"payment.stripe.liveSecretKey",p),placeholder:`sk_${r?"test":"live"}_...`,isVisible:r?o.testSecret:o.liveSecret,onToggleVisible:()=>n(p=>({...p,[r?"testSecret":"liveSecret"]:!p[r?"testSecret":"liveSecret"]})),disabled:!s})]})]}),s&&e.jsxs("button",{onClick:()=>t("payment.stripe.testMode",!a.testMode),className:"text-sm text-blue-600 hover:text-blue-700 underline",children:["Switch to ",r?"Live":"Test"," credentials"]})]})}function Te(l){var x,v,w,C;const{title:t,description:o,icon:n,enabled:a,onToggleEnabled:r,children:s,docsLink:m,isPro:u=!1,disabled:p=!1}=l,d={bg:"bg-[#F5FAFF]",border:"border-blue-200",badge:"bg-primary"},c=p||u&&!((x=window.radius_booking_param)!=null&&x.is_pro);return e.jsxs("div",{className:`rounded-lg border ${a&&!c?d.border:"border-border"} ${a&&!c?d.bg:"bg-lighter-2"} p-6 transition-all ${c?"opacity-60":""}`,children:[e.jsxs("div",{className:"mb-4 flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`flex h-10 w-10 items-center justify-center rounded-lg ${a&&!c?d.badge:"bg-[#DFEEFB]"}`,children:e.jsx(n,{className:`h-5 w-5 ${a&&!c?"text-white":"text-primary"}`})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"text-base font-semibold text-title",children:t}),u&&!((v=window.radius_booking_param)!=null&&v.is_pro)&&e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-gradient-to-r from-amber-400 to-orange-500 px-2 py-0.5 text-xs font-semibold text-white shadow-sm",children:[e.jsx(yt,{className:"h-3 w-3"}),"PRO"]})]}),e.jsx("p",{className:"text-sm text-slate-600",children:o}),c&&u&&e.jsx("p",{className:"text-xs text-amber-600 mt-1 font-medium",children:"Upgrade to PRO to use this integration"})]})]}),t==="Google Calendar"&&e.jsx(H,{checked:a,onChange:r,label:"",disabled:c,boxStyle:!1}),(t==="Apple Calendar"||t==="Zoom")&&((w=window.radius_booking_param)==null?void 0:w.is_pro)&&e.jsx(H,{checked:a,onChange:r,label:"",boxStyle:!1}),t==="Classified Listing"&&((C=window.radius_booking_param)==null?void 0:C.is_pro)&&e.jsx(H,{checked:a,onChange:r,label:"",disabled:c,boxStyle:!1})]}),m&&a&&!c&&e.jsxs("a",{href:m,target:"_blank",rel:"noopener noreferrer",className:"mb-4 inline-flex items-center gap-1 text-xs text-blue-600 hover:text-blue-700",children:[e.jsx(jt,{className:"h-3 w-3"}),"View setup documentation"]}),a&&!c&&e.jsx("div",{className:"space-y-4",children:s}),!a&&!c&&e.jsx("p",{className:"text-sm text-small-font italic",children:"Enable this integration to configure settings"})]})}function je({value:l,onChange:t,placeholder:o,label:n,isVisible:a,onToggleVisible:r,disabled:s=!1}){return e.jsxs("div",{children:[n&&e.jsx("label",{className:"mb-1.5 block text-xs font-medium text-title2",children:n}),e.jsxs("div",{className:"relative max-w-[600px]",children:[e.jsx("input",{type:a?"text":"password",value:l||"",onChange:m=>t(m.target.value),placeholder:o,disabled:s,className:"w-full rounded-md border border-border bg-white px-3 py-2 pr-10 text-sm text-title placeholder:text-slate-400 focus:outline-none focus:ring-2 focus:ring-blue-200 disabled:bg-slate-50 disabled:text-small-font disabled:cursor-not-allowed"}),e.jsx("button",{type:"button",onClick:r,disabled:s,className:"absolute right-2 top-1/2 -translate-y-1/2 rounded p-1 text-slate-400 hover:text-slate-600 disabled:opacity-50 disabled:cursor-not-allowed",children:a?e.jsx(Se,{className:"h-4 w-4"}):e.jsx(Le,{className:"h-4 w-4"})})]})]})}function $s({settings:l,onUpdate:t}){var s,m;const[o,n]=de.useState({apiKey:!1,apiSecret:!1,sdkKey:!1,sdkSecret:!1}),a=((s=l.integrations)==null?void 0:s.zoom)||{},r=((m=window.radius_booking_param)==null?void 0:m.is_pro)||!1;return e.jsxs(Te,{title:"Zoom",description:"Create and manage Zoom meetings for appointments",icon:ft,enabled:a.enabled,onToggleEnabled:u=>t("integrations.zoom.enabled",u),docsLink:"https://marketplace.zoom.us/docs/guides",isPro:!0,children:[e.jsxs("div",{className:"rounded-md border border-blue-200 bg-white p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(Pe,{className:"h-4 w-4 text-slate-600"}),e.jsx("span",{className:"text-sm font-medium text-title2",children:"API Credentials"})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-4",children:[e.jsx(je,{label:"Account ID",value:a.accountId,onChange:u=>t("integrations.zoom.accountId",u),placeholder:"Enter your Zoom Account ID",isVisible:o.accountId,onToggleVisible:()=>n(u=>({...u,accountId:!u.accountId})),disabled:!r}),e.jsx(je,{label:"Client ID",value:a.clientId,onChange:u=>t("integrations.zoom.clientId",u),placeholder:"Enter your Zoom Client ID",isVisible:o.clientId,onToggleVisible:()=>n(u=>({...u,clientId:!u.clientId})),disabled:!r}),e.jsx(je,{label:"Client Secret",value:a.clientSecret,onChange:u=>t("integrations.zoom.clientSecret",u),placeholder:"Enter your Zoom Client Secret",isVisible:o.clientSecret,onToggleVisible:()=>n(u=>({...u,clientSecret:!u.clientSecret})),disabled:!r})]})]}),e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-3",children:[e.jsx(H,{checked:a.requirePassword,onChange:u=>t("integrations.zoom.requirePassword",u),label:"Require password for Zoom meetings",disabled:!r}),e.jsx(H,{checked:a.enableWaitingRoom,onChange:u=>t("integrations.zoom.enableWaitingRoom",u),label:"Enable waiting room for meetings",disabled:!r}),e.jsx(H,{checked:a.sendInviteEmail,onChange:u=>t("integrations.zoom.sendInviteEmail",u),label:"Send Zoom meeting invite to customers",disabled:!r})]}),e.jsx(V,{label:"Default meeting duration (minutes)",children:e.jsx("input",{type:"number",value:a.defaultDuration||60,onChange:u=>t("integrations.zoom.defaultDuration",Number(u.target.value)),min:"15",step:"15",disabled:!r,className:"w-full rounded-md border border-border bg-white px-3 py-2 text-sm text-title focus:outline-none focus:ring-2 focus:ring-blue-200 disabled:bg-slate-50 disabled:text-small-font disabled:cursor-not-allowed"})})]})}function Bs({settings:l,onUpdate:t,onSave:o}){var d;const[n,a]=de.useState({clientId:!1,clientSecret:!1}),[r,s]=de.useState(!1),m=((d=l.integrations)==null?void 0:d.googleCalendar)||{},u=de.useMemo(()=>!m.clientId||!m.redirectUri?"":"https://accounts.google.com/o/oauth2/v2/auth?"+new URLSearchParams({client_id:m.clientId,redirect_uri:m.redirectUri,response_type:"code",scope:"https://www.googleapis.com/auth/calendar https://www.googleapis.com/auth/calendar.events",access_type:"offline",prompt:"consent",state:m.oauth_nonce||""}).toString(),[m.clientId,m.redirectUri,m.oauth_nonce]),p=async c=>{if(c.preventDefault(),!(!u||r))try{s(!0),await o(),window.location.href=u}catch{s(!1)}};return e.jsx(Te,{title:"Google Calendar",description:"Sync appointments with Google Calendar",icon:ue,enabled:m.enabled,onToggleEnabled:c=>t("integrations.googleCalendar.enabled",c),docsLink:"https://developers.google.com/calendar/api/guides/overview",isPro:!1,children:e.jsxs("div",{className:"rounded-md border border-blue-200 bg-white p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(Pe,{className:"h-4 w-4 text-slate-600"}),e.jsx("span",{className:"text-sm font-medium text-title2",children:"OAuth 2.0 Credentials"})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-4",children:[e.jsx(je,{label:"Client ID",value:m.clientId,onChange:c=>t("integrations.googleCalendar.clientId",c),placeholder:"Enter your Google OAuth Client ID",isVisible:n.clientId,onToggleVisible:()=>a(c=>({...c,clientId:!c.clientId}))}),e.jsx(je,{label:"Client Secret",value:m.clientSecret,onChange:c=>t("integrations.googleCalendar.clientSecret",c),placeholder:"Enter your Google OAuth Client Secret",isVisible:n.clientSecret,onToggleVisible:()=>a(c=>({...c,clientSecret:!c.clientSecret}))}),e.jsx(V,{label:"Redirect URI",className:"max-w-[600px]",children:e.jsx(q,{value:m.redirectUri||"",onChange:c=>t("integrations.googleCalendar.redirectUri",c.target.value),placeholder:"https://yourdomain.com/oauth/callback",disabled:!0})}),m.clientId&&m.redirectUri&&m.clientSecret&&u&&e.jsxs("div",{className:"mt-4 pt-4 border-t border-indigo-200",children:[e.jsxs("button",{type:"button",onClick:p,disabled:r,className:"inline-flex items-center gap-2 px-4 py-2 bg-indigo-600 text-white text-sm font-medium rounded-md hover:bg-indigo-700 transition-colors disabled:opacity-60 cursor-pointer disabled:cursor-wait",children:[e.jsx(jt,{className:"h-4 w-4"}),r?"Saving & Redirecting...":"Configure Google Calendar Access"]}),e.jsx("p",{className:"mt-2 text-xs text-slate-600",children:"Settings will be saved automatically before redirecting to Google"})]})]})]})})}function Os({settings:l,onUpdate:t}){var a,r;const o=((a=l.integrations)==null?void 0:a.appleCalendar)||{},n=((r=window.radius_booking_param)==null?void 0:r.is_pro)||!1;return e.jsx(Te,{title:"Apple Calendar",description:"Generate iCal files for Apple Calendar sync",icon:ue,enabled:o.enabled,onToggleEnabled:s=>t("integrations.appleCalendar.enabled",s),isPro:!0,children:e.jsxs("div",{className:"rounded-md border border-border bg-white p-4 space-y-4",children:[e.jsx("p",{className:"text-sm text-slate-600",children:"Apple Calendar integration works via iCal (.ics) files. Enable this to allow customers to download calendar files or subscribe to calendar feeds."}),e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-3",children:[e.jsx(H,{checked:o.showDownloadLink,onChange:s=>t("integrations.appleCalendar.showDownloadLink",s),label:'Show "Add to Apple Calendar" download link',disabled:!n}),e.jsx(H,{checked:o.includeLocation,onChange:s=>t("integrations.appleCalendar.includeLocation",s),label:"Include location details in calendar events",disabled:!n}),e.jsx(H,{checked:o.includeDescription,onChange:s=>t("integrations.appleCalendar.includeDescription",s),label:"Include appointment details in calendar events",disabled:!n}),e.jsx(H,{checked:o.addReminders,onChange:s=>t("integrations.appleCalendar.addReminders",s),label:"Add reminders to calendar events",disabled:!n})]}),e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-x-3",children:[o.addReminders&&n&&e.jsx(V,{label:"Reminder time before appointment (minutes)",children:e.jsx("input",{type:"number",value:o.reminderMinutes||60,onChange:s=>t("integrations.appleCalendar.reminderMinutes",Number(s.target.value)),min:"0",step:"15",className:"w-full rounded-md border border-border bg-white px-3 py-2 text-sm text-title focus:outline-none focus:ring-2 focus:ring-blue-200"})}),e.jsx(V,{label:"Calendar Name",children:e.jsx("div",{className:"flex flex-col w-full",children:e.jsx(q,{value:o.calendarName||"",onChange:s=>t("integrations.appleCalendar.calendarName",s.target.value),placeholder:"My Business Appointments",disabled:!n})})}),e.jsx(V,{label:"Organizer Email",children:e.jsx("div",{className:"flex flex-col w-full",children:e.jsx(q,{value:o.organizerEmail||"",onChange:s=>t("integrations.appleCalendar.organizerEmail",s.target.value),placeholder:"bookings@yourbusiness.com",disabled:!n,type:"email"})})})]})]})})}function zs({settings:l,onUpdate:t}){var r;const o=((r=l.integrations)==null?void 0:r.classifiedListing)||{},a=(o.listingMappingMode||"service")==="staff";return window.radius_booking_param.is_cl_active?e.jsxs(Te,{title:"Classified Listing",description:"Turn classified listings into bookable services or staff members",icon:It,enabled:o.enabled,onToggleEnabled:s=>t("integrations.classifiedListing.enabled",s),isPro:!0,children:[e.jsxs("div",{className:"rounded-md border border-blue-200 bg-white p-4 space-y-4",children:[e.jsx("div",{className:"flex items-center gap-2 mb-2",children:e.jsx("span",{className:"text-sm font-medium text-title2",children:"Listing Mapping Mode"})}),e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-3",children:[e.jsxs("label",{className:`flex items-start gap-3 rounded-lg border p-3 cursor-pointer transition-all ${a?"border-border bg-white hover:border-slate-300":"border-primary bg-[#F5FAFF]"}`,children:[e.jsx("input",{type:"radio",name:"listingMappingMode",value:"service",checked:!a,onChange:()=>t("integrations.classifiedListing.listingMappingMode","service"),className:"mt-0.5 accent-primary"}),e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium text-title",children:"Listing as Service"}),e.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:"Each listing becomes a bookable service. The listing owner becomes the staff member."})]})]}),e.jsxs("label",{className:`flex items-start gap-3 rounded-lg border p-3 cursor-pointer transition-all ${a?"border-primary bg-[#F5FAFF]":"border-border bg-white hover:border-slate-300"}`,children:[e.jsx("input",{type:"radio",name:"listingMappingMode",value:"staff",checked:a,onChange:()=>t("integrations.classifiedListing.listingMappingMode","staff"),className:"mt-0.5 accent-primary"}),e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium text-title",children:"Listing as Staff"}),e.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:"Each listing becomes a staff member. A shared default service is used for all bookings."})]})]})]})]}),e.jsxs("div",{className:"rounded-md border border-blue-200 bg-white p-4 space-y-4",children:[e.jsx("div",{className:"flex items-center gap-2 mb-2",children:e.jsx("span",{className:"text-sm font-medium text-title2",children:"Integration Settings"})}),!a&&e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-3",children:[e.jsx(H,{checked:o.autoCreateEmployee,onChange:s=>t("integrations.classifiedListing.autoCreateEmployee",s),label:"Auto-create employee from listing owner"}),e.jsx(H,{checked:o.syncPrice,onChange:s=>t("integrations.classifiedListing.syncPrice",s),label:"Sync price from listing"}),e.jsx(H,{checked:o.syncDescription,onChange:s=>t("integrations.classifiedListing.syncDescription",s),label:"Sync description from listing"})]}),a&&e.jsx("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-3",children:e.jsx(H,{checked:o.syncPrice,onChange:s=>t("integrations.classifiedListing.syncPrice",s),label:"Use listing price as staff rate"})}),e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[a&&e.jsx(V,{label:"Default Service Name",children:e.jsx(q,{value:o.defaultServiceName||"Consultation",onChange:s=>t("integrations.classifiedListing.defaultServiceName",s.target.value),placeholder:"Consultation"})}),e.jsx(V,{label:"Default Duration (minutes)",children:e.jsx("input",{type:"number",value:o.defaultDuration||60,onChange:s=>t("integrations.classifiedListing.defaultDuration",Number(s.target.value)),min:"5",step:"5",className:"w-full rounded-md border border-border bg-white px-3 py-2 text-sm text-title focus:outline-none focus:ring-2 focus:ring-blue-200"})}),e.jsx(V,{label:"Book Now Button Text",children:e.jsx(q,{value:o.bookNowButtonText||"Book Now",onChange:s=>t("integrations.classifiedListing.bookNowButtonText",s.target.value),placeholder:"Book Now"})})]})]}),e.jsx("div",{className:"mt-3 p-3 rounded-md bg-blue-50 border border-blue-100",children:e.jsx("p",{className:"text-xs text-blue-700",children:a?'In "Listing as Staff" mode, each listing with booking enabled will create a staff member using the listing title and image. All staff share a single default service for bookings.':'When enabled, a "Radius Booking" meta box will appear on each listing edit screen. Listing owners can check "Enable Booking" to make their listing bookable. The listing will be synced as a service in Radius Booking automatically.'})})]}):null}const ve="/radius-booking/v1/chatbot/knowledge";function Hs(){const[l,t]=f.useState([]),[o,n]=f.useState(!0),[a,r]=f.useState(null),[s,m]=f.useState({question:"",answer:"",category:"general"}),[u,p]=f.useState(!1),d=f.useCallback(async()=>{try{n(!0);const b=await W({path:ve});t(b.data||[])}catch{}finally{n(!1)}},[]);f.useEffect(()=>{d()},[d]);const c=()=>{m({question:"",answer:"",category:"general"}),r(null),p(!1)},x=b=>{m({question:b.question,answer:b.answer,category:b.category||"general"}),r(b.id),p(!0)},v=async()=>{if(!(!s.question.trim()||!s.answer.trim()))try{a?await W({path:`${ve}/${a}`,method:"PUT",data:s}):await W({path:ve,method:"POST",data:s}),c(),d()}catch{}},w=async b=>{if(window.confirm("Are you sure you want to delete this entry?"))try{await W({path:`${ve}/${b}`,method:"DELETE"}),d()}catch{}},C={policy:"bg-blue-100 text-blue-700",payment:"bg-green-100 text-green-700",general:"bg-gray-100 text-gray-700",hours:"bg-yellow-100 text-yellow-700"};return o?e.jsx("div",{className:"py-6 text-center text-sm text-gray-400",children:"Loading knowledge base..."}):e.jsxs("div",{className:"space-y-4",children:[l.length>0&&e.jsx("div",{className:"border border-border rounded-lg divide-y divide-border",children:l.map(b=>{var S;return e.jsxs("div",{className:"flex items-start justify-between gap-4 p-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"font-medium text-sm text-title2 truncate",children:b.question}),e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded text-xs font-medium ${C[b.category]||C.general}`,children:b.category})]}),e.jsx("p",{className:"text-sm text-gray-500 line-clamp-2",children:b.answer})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx("button",{onClick:()=>x(b),className:"p-1.5 rounded hover:bg-slate-100 text-gray-400 hover:text-gray-600",title:"Edit",children:e.jsx(hs,{size:14})}),!((S=b.id)!=null&&S.startsWith("default-"))&&e.jsx("button",{onClick:()=>w(b.id),className:"p-1.5 rounded hover:bg-red-50 text-gray-400 hover:text-red-500",title:"Delete",children:e.jsx(Re,{size:14})})]})]},b.id)})}),l.length===0&&!u&&e.jsx("div",{className:"py-8 text-center text-sm text-gray-400",children:"No knowledge base entries yet. Add your first FAQ."}),u&&e.jsxs("div",{className:"border border-border rounded-lg p-4 space-y-3 bg-slate-50",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h4",{className:"text-sm font-medium text-title2",children:a?"Edit Entry":"Add New Entry"}),e.jsx("button",{onClick:c,className:"p-1 rounded hover:bg-slate-200 text-gray-400",children:e.jsx(pe,{size:16})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:"Question"}),e.jsx("input",{type:"text",value:s.question,onChange:b=>m({...s,question:b.target.value}),className:"w-full rounded-md border border-border px-3 py-2 text-sm",placeholder:"e.g. What are your business hours?"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:"Answer"}),e.jsx("textarea",{value:s.answer,onChange:b=>m({...s,answer:b.target.value}),rows:3,className:"w-full rounded-md border border-border px-3 py-2 text-sm",placeholder:"Provide the answer the chatbot should give..."})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:"Category"}),e.jsxs("select",{value:s.category,onChange:b=>m({...s,category:b.target.value}),className:"rounded-md border border-border px-3 py-2 text-sm",children:[e.jsx("option",{value:"general",children:"General"}),e.jsx("option",{value:"policy",children:"Policy"}),e.jsx("option",{value:"payment",children:"Payment"}),e.jsx("option",{value:"hours",children:"Hours"})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[e.jsx("button",{onClick:c,className:"rounded-md border border-border bg-white px-3 py-1.5 text-sm text-gray-600 hover:bg-slate-50",children:"Cancel"}),e.jsxs("button",{onClick:v,disabled:!s.question.trim()||!s.answer.trim(),className:"rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-white hover:bg-blue-700 disabled:opacity-50 flex items-center gap-1.5",children:[e.jsx(vt,{size:14}),a?"Update":"Save"]})]})]}),!u&&e.jsxs("button",{onClick:()=>p(!0),className:"flex items-center gap-1.5 rounded-md border border-dashed border-border px-3 py-2 text-sm text-gray-500 hover:text-primary hover:border-primary transition-colors",children:[e.jsx(te,{size:16}),"Add Knowledge Entry"]})]})}function Vs({settings:l,onChange:t}){const o=!!(l!=null&&l.enabled),n=(l==null?void 0:l.commissionType)||"percentage",a=(l==null?void 0:l.commissionRate)??0,r=(l==null?void 0:l.minimumPayoutAmount)??50,s=(l==null?void 0:l.payoutMethods)||{},[m,u]=f.useState(null),[p,d]=f.useState(""),[c,x]=f.useState(""),[v,w]=f.useState(!1),C=(h,y,k)=>{const L={...s,[h]:{...s[h],[y]:k}};t("payoutMethods",L)},b=(h,y)=>{C(h,"fields",y)},S=h=>{var k;const y=((k=s[h])==null?void 0:k.fields)||[];b(h,[...y,{key:"",label:"",type:"text"}])},P=(h,y,k,L)=>{var E;const M=[...((E=s[h])==null?void 0:E.fields)||[]];M[y]={...M[y],[k]:L},M[y].key=L.trim().toLowerCase().replace(/\s+/g,"_").replace(/[^a-z0-9_]/g,""),b(h,M)},A=(h,y)=>{var L;const k=[...((L=s[h])==null?void 0:L.fields)||[]];k.splice(y,1),b(h,k)},T=h=>{var y;C(h,"enabled",!((y=s[h])!=null&&y.enabled))},i=()=>{if(!p.trim()||!c.trim())return;const h=p.trim().toLowerCase().replace(/\s+/g,"_").replace(/[^a-z0-9_]/g,"");if(s[h])return;const y={...s,[h]:{enabled:!0,label:c.trim(),description:"",fields:[]}};t("payoutMethods",y),d(""),x(""),w(!1),u(h)},N=h=>{const y={...s};delete y[h],t("payoutMethods",y),m===h&&u(null)},B=h=>{u(m===h?null:h)},$=Object.entries(s);return e.jsxs("div",{className:"space-y-8",children:[e.jsx("div",{className:`rounded-lg border p-5 transition-all ${o?"border-green-200 bg-green-50/30":"border-border bg-lighter-2"}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`flex h-10 w-10 items-center justify-center rounded-lg transition-colors ${o?"bg-green-500":"bg-slate-200"}`,children:e.jsx(ys,{className:`h-5 w-5 ${o?"text-white":"text-slate-400"}`})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-semibold text-title",children:"Enable Payouts"}),e.jsx("p",{className:"text-xs text-small-font",children:o?"Employees can view their balance and request payouts.":"Payout feature is disabled. Employees will not see payout options."})]})]}),e.jsx(H,{checked:o,onChange:h=>t("enabled",h),label:"",boxStyle:!1})]})}),e.jsxs("div",{className:`space-y-8 ${o?"":"pointer-events-none select-none opacity-40"}`,children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-primary/10",children:e.jsx(gs,{className:"h-4 w-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-semibold text-title",children:"Commission"}),e.jsx("p",{className:"text-xs text-small-font",children:"Deduct a fee from each employee payout"})]})]}),e.jsxs(Ce,{cols:3,children:[e.jsx(V,{label:"Commission Type",children:e.jsx(ut,{value:n,onChange:h=>t("commissionType",h.target.value),options:[{value:"percentage",label:"Percentage (%)"},{value:"fixed",label:"Fixed Amount"}]})}),e.jsx(V,{label:n==="percentage"?"Rate (%)":"Amount (per payout)",children:e.jsx(_e,{value:a,onChange:h=>t("commissionRate",parseFloat(h.target.value)||0),min:0,step:n==="percentage"?.1:1,placeholder:"0"})}),e.jsx(V,{label:"Minimum Payout Amount",children:e.jsxs("div",{className:"flex flex-col w-full",children:[e.jsx(_e,{value:r,onChange:h=>t("minimumPayoutAmount",parseFloat(h.target.value)||0),min:0,placeholder:"50"}),e.jsx(oe,{children:"Employees must request at least this amount."})]})})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-primary/10",children:e.jsx(De,{className:"h-4 w-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-semibold text-title",children:"Payout Methods"}),e.jsx("p",{className:"text-xs text-small-font",children:"Methods employees can use to receive payouts"})]})]}),!v&&e.jsxs("button",{type:"button",onClick:()=>w(!0),className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-primary bg-primary/5 hover:bg-primary/10 border border-primary/20 rounded-lg transition-colors",children:[e.jsx(te,{className:"w-3.5 h-3.5"}),"Add Method"]})]}),e.jsxs("div",{className:"space-y-3",children:[$.map(([h,y])=>{const k=m===h,L=!!y.enabled;return e.jsxs("div",{className:`rounded-lg border transition-all ${L?"border-border bg-white":"border-border/60 bg-slate-50/50"}`,children:[e.jsxs("div",{className:"flex items-center gap-3 p-4",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx(Xt,{className:"w-4 h-4 text-slate-300 shrink-0"}),e.jsx(H,{checked:L,onChange:()=>T(h),label:"",boxStyle:!1}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`text-sm font-medium truncate ${L?"text-title":"text-slate-400"}`,children:y.label||h}),e.jsx("span",{className:"text-[10px] font-mono text-slate-300 bg-slate-100 px-1.5 py-0.5 rounded shrink-0",children:h})]}),!k&&y.description&&e.jsx("p",{className:"text-xs text-slate-400 truncate mt-0.5",children:y.description})]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx("button",{type:"button",onClick:()=>B(h),className:"p-1.5 text-slate-400 hover:text-slate-600 hover:bg-slate-100 rounded-md transition-colors",title:k?"Collapse":"Edit",children:k?e.jsx(Jt,{className:"w-4 h-4"}):e.jsx(Lt,{className:"w-4 h-4"})}),e.jsx("button",{type:"button",onClick:()=>N(h),className:"p-1.5 text-slate-300 hover:text-red-500 hover:bg-red-50 rounded-md transition-colors",title:"Remove method",children:e.jsx(Re,{className:"w-4 h-4"})})]})]}),k&&e.jsx("div",{className:"px-4 pb-4 pt-0 border-t border-border/50 mt-0",children:e.jsxs("div",{className:"space-y-4 pt-4",children:[e.jsx(V,{label:"Label",children:e.jsx(q,{value:y.label||"",onChange:M=>C(h,"label",M.target.value),placeholder:"e.g. Bank Transfer"})}),e.jsx(V,{label:"Description",children:e.jsx(Be,{value:y.description||"",onChange:M=>C(h,"description",M.target.value),placeholder:"Describe this payout method for employees...",rows:2})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("label",{className:"text-xs font-medium text-title2",children:"Required Fields"}),e.jsxs("button",{type:"button",onClick:()=>S(h),className:"inline-flex items-center gap-1 px-2 py-1 text-[11px] font-medium text-primary bg-primary/5 hover:bg-primary/10 border border-primary/20 rounded-md transition-colors",children:[e.jsx(te,{className:"w-3 h-3"}),"Add Field"]})]}),e.jsx("p",{className:"text-[11px] text-slate-400 mb-2",children:"Define what information staff need to provide for this method."}),(y.fields||[]).length>0?e.jsx("div",{className:"space-y-2",children:(y.fields||[]).map((M,E)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex-1",children:e.jsx(q,{value:M.label||"",onChange:D=>P(h,E,"label",D.target.value),placeholder:"Field label (e.g. Account Number)"})}),e.jsx("span",{className:"text-[10px] font-mono text-slate-300 bg-slate-100 px-1.5 py-1 rounded shrink-0 min-w-[60px] text-center",children:M.key||"auto"}),e.jsx("button",{type:"button",onClick:()=>A(h,E),className:"p-1.5 text-slate-300 hover:text-red-500 hover:bg-red-50 rounded-md transition-colors shrink-0",title:"Remove field",children:e.jsx(Re,{className:"w-3.5 h-3.5"})})]},E))}):e.jsx("p",{className:"text-[11px] text-slate-400 italic",children:"No fields configured. Staff won't need to provide details for this method."})]})]})})]},h)}),$.length===0&&!v&&e.jsxs("div",{className:"rounded-lg border border-dashed border-slate-200 p-8 text-center",children:[e.jsx(De,{className:"w-8 h-8 text-slate-300 mx-auto mb-2"}),e.jsx("p",{className:"text-sm text-slate-500 mb-3",children:"No payout methods configured"}),e.jsxs("button",{type:"button",onClick:()=>w(!0),className:"inline-flex items-center gap-1.5 px-4 py-2 text-sm font-medium text-primary bg-primary/5 hover:bg-primary/10 border border-primary/20 rounded-lg transition-colors",children:[e.jsx(te,{className:"w-4 h-4"}),"Add Your First Method"]})]}),v&&e.jsxs("div",{className:"rounded-lg border-2 border-dashed border-primary/30 bg-primary/[0.02] p-4",children:[e.jsx("h5",{className:"text-sm font-medium text-title mb-3",children:"Add New Payout Method"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 mb-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs font-medium text-title2",children:"Method Key"}),e.jsx(q,{value:p,onChange:h=>d(h.target.value),placeholder:"e.g. paypal, wise, crypto"}),e.jsx("p",{className:"text-[11px] text-slate-400 mt-1",children:"Unique identifier (lowercase, no spaces). Auto-formatted."})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs font-medium text-title2",children:"Display Label"}),e.jsx(q,{value:c,onChange:h=>x(h.target.value),placeholder:"e.g. PayPal, Wise, Cryptocurrency"}),e.jsx("p",{className:"text-[11px] text-slate-400 mt-1",children:"Shown to employees when requesting a payout."})]})]}),p.trim()&&s[p.trim().toLowerCase().replace(/\s+/g,"_").replace(/[^a-z0-9_]/g,"")]&&e.jsx("p",{className:"text-xs text-red-500 mb-2",children:"A method with this key already exists."}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:i,disabled:!p.trim()||!c.trim()||!!s[p.trim().toLowerCase().replace(/\s+/g,"_").replace(/[^a-z0-9_]/g,"")],className:"inline-flex items-center gap-1.5 px-4 py-2 text-sm font-medium text-white bg-primary hover:bg-primary/90 rounded-lg transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(te,{className:"w-4 h-4"}),"Add"]}),e.jsx("button",{type:"button",onClick:()=>{w(!1),d(""),x("")},className:"px-4 py-2 text-sm font-medium text-slate-600 hover:text-slate-800 hover:bg-slate-100 rounded-lg transition-colors",children:"Cancel"})]})]})]})]})]})]})}const we={chat:e.jsx("svg",{viewBox:"0 0 24 24",width:"24",height:"24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),headset:e.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M3 18v-6a9 9 0 0 1 18 0v6"}),e.jsx("path",{d:"M21 19a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3zM3 19a2 2 0 0 0 2 2h1a2 2 0 0 0 2-2v-3a2 2 0 0 0-2-2H3z"})]}),bot:e.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"11",width:"18",height:"10",rx:"2"}),e.jsx("circle",{cx:"12",cy:"5",r:"2"}),e.jsx("path",{d:"M12 7v4"}),e.jsx("line",{x1:"8",y1:"16",x2:"8",y2:"16"}),e.jsx("line",{x1:"16",y1:"16",x2:"16",y2:"16"})]}),help:e.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),e.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]})},Gs=e.jsxs("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]});function Ks({settings:l}){const[t,o]=f.useState(!0),n=(l==null?void 0:l.chatbot)||{},a=n.primaryColor||"#0040ff",r=n.botName||"Booking Assistant",s=n.welcomeMessage||"Hi! I'm your booking assistant. How can I help you today?",m=n.position||"bottom-right",u=n.bubbleIcon||"chat",p=n.bubbleImage||"",d=n.poweredBy??"Powered by Radius Booking",c=m==="bottom-right";return e.jsxs("div",{className:"relative rounded-xl border border-gray-200 overflow-hidden",style:{background:"repeating-conic-gradient(#f8f8f8 0% 25%, #fff 0% 50%) 50% / 20px 20px",minHeight:480},children:[e.jsx("div",{className:"absolute top-3 left-3 bg-white/90 backdrop-blur text-xs text-gray-500 px-2 py-1 rounded-md border border-gray-100 z-10",children:"Preview"}),t&&e.jsx("div",{className:"absolute z-10",style:{width:340,bottom:80,...c?{right:20}:{left:20}},children:e.jsxs("div",{style:{borderRadius:16,background:"#fff",boxShadow:"0 8px 30px rgba(0,0,0,0.12)",display:"flex",flexDirection:"column",overflow:"hidden",height:370},children:[e.jsxs("div",{style:{backgroundColor:a,padding:"14px 18px",display:"flex",alignItems:"center",justifyContent:"space-between",flexShrink:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx("div",{style:{width:32,height:32,borderRadius:"50%",background:"rgba(255,255,255,0.2)",display:"flex",alignItems:"center",justifyContent:"center",color:"#fff"},children:u==="custom"&&p?e.jsx("img",{src:p,alt:"",style:{width:"100%",height:"100%",borderRadius:"50%",objectFit:"cover"}}):we[u]||we.chat}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:15,fontWeight:600,color:"#fff"},children:r}),e.jsx("div",{style:{fontSize:11,color:"rgba(255,255,255,0.8)"},children:"Online"})]})]}),e.jsx("button",{onClick:()=>o(!1),style:{background:"rgba(255,255,255,0.15)",border:"none",borderRadius:"50%",width:28,height:28,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",color:"#fff"},children:Gs})]}),e.jsxs("div",{style:{flex:1,padding:"16px",overflowY:"auto"},children:[e.jsx("div",{style:{maxWidth:"85%",padding:"10px 14px",borderRadius:"12px 12px 12px 4px",background:"#f0f2f5",fontSize:13,lineHeight:1.5,color:"#1a1a1a"},children:s}),e.jsx("div",{style:{maxWidth:"85%",padding:"10px 14px",borderRadius:"12px 12px 4px 12px",backgroundColor:a,fontSize:13,lineHeight:1.5,color:"#fff",marginTop:12,marginLeft:"auto"},children:"What services do you offer?"}),e.jsx("div",{style:{maxWidth:"85%",padding:"10px 14px",borderRadius:"12px 12px 12px 4px",background:"#f0f2f5",fontSize:13,lineHeight:1.5,color:"#1a1a1a",marginTop:12},children:"We offer a variety of services! Let me check for you..."})]}),e.jsxs("div",{style:{padding:"12px 16px",borderTop:"1px solid #eee",display:"flex",alignItems:"center",gap:8,background:"#fff"},children:[e.jsx("input",{type:"text",placeholder:"Type a message...",disabled:!0,style:{flex:1,border:"1px solid #e0e0e0",borderRadius:24,padding:"8px 16px",fontSize:13,outline:"none",background:"#fafafa",fontFamily:"inherit"}}),e.jsx("button",{disabled:!0,style:{width:36,height:36,borderRadius:"50%",border:"none",backgroundColor:a,display:"flex",alignItems:"center",justifyContent:"center",opacity:.5,flexShrink:0},children:e.jsxs("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"#fff",strokeWidth:"2",children:[e.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),e.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]}),d&&e.jsx("div",{style:{textAlign:"center",padding:6,fontSize:10,color:"#bbb",background:"#fafafa"},children:d})]})}),e.jsx("button",{onClick:()=>o(x=>!x),className:"absolute z-10",style:{bottom:20,...c?{right:20}:{left:20},width:56,height:56,borderRadius:"50%",border:"none",backgroundColor:a,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",color:"#fff",transition:"transform 0.2s ease"},children:t?e.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}):u==="custom"&&p?e.jsx("img",{src:p,alt:"",style:{width:28,height:28,borderRadius:"50%",objectFit:"cover"}}):we[u]||we.chat})]})}const xe="/radius-booking/v1/export-import";async function Ws(){return W({path:`${xe}/modules`,method:"GET"})}async function Zs(l){return W({path:`${xe}/export/init`,method:"POST",data:{modules:l}})}async function Je(l,t=0,o=500){return W({path:`${xe}/export/batch?module=${l}&offset=${t}&limit=${o}`,method:"GET"})}async function qs(l){return W({path:`${xe}/import/init`,method:"POST",data:l})}async function et(l,t,o){return W({path:`${xe}/import/batch`,method:"POST",data:{session_key:l,module:t,records:o}})}async function tt(l){return W({path:`${xe}/import/cleanup`,method:"POST",data:{session_key:l}})}const Ne=500;function Us(){const[l,t]=f.useState([]),[o,n]=f.useState(!1),[a,r]=f.useState(!1),[s,m]=f.useState({label:"",current:0,total:0}),[u,p]=f.useState(!1),[d,c]=f.useState(!1),[x,v]=f.useState({label:"",current:0,total:0}),[w,C]=f.useState(null),[b,S]=f.useState(null),P=f.useRef(!1),A=f.useCallback(async()=>{var h;n(!0);try{const y=await Ws();t(((h=y.data)==null?void 0:h.modules)||[])}catch(y){console.error("Failed to load modules:",y)}finally{n(!1)}},[]),T=f.useCallback(async h=>{var y,k,L;if(h.length){r(!0),P.current=!1;try{const M=await Zs(h),{metadata:E,modules:D,counts:z}=M.data,g=Object.values(z).reduce((j,_)=>j+_,0);let F=0;const I={metadata:E,data:{}};for(const j of D){if(P.current)break;const _=z[j]||0;if(I.data[j]=[],j==="settings"){m({label:`Exporting ${j}...`,current:F,total:g});const K=await Je(j,0,1);I.data[j]=((y=K.data)==null?void 0:y.records)||{},F+=1}else{let K=0,be=!0;for(;be&&!P.current;){m({label:`Exporting ${j}...`,current:F,total:g});const J=await Je(j,K,Ne),ae=((k=J.data)==null?void 0:k.records)||[];I.data[j].push(...ae),F+=ae.length,be=((L=J.data)==null?void 0:L.has_more)||!1,K+=Ne}}}m({label:"Export complete!",current:g,total:g});const O=JSON.stringify(I,null,2),he=new Blob([O],{type:"application/json"}),X=URL.createObjectURL(he),Q=document.createElement("a"),U=new Date().toISOString().split("T")[0];Q.href=X,Q.download=`radius-booking-export-${U}.json`,document.body.appendChild(Q),Q.click(),document.body.removeChild(Q),URL.revokeObjectURL(X)}catch(M){console.error("Export failed:",M),m({label:"Export failed. Please try again.",current:0,total:0})}finally{r(!1)}}},[]),i=f.useCallback(async h=>new Promise((y,k)=>{const L=new FileReader;L.onload=async M=>{var E,D;try{const z=JSON.parse(M.target.result);S(z);const g=await qs(z);C({sessionKey:(E=g.data)==null?void 0:E.session_key,plan:((D=g.data)==null?void 0:D.plan)||[],metadata:z.metadata}),y(g.data)}catch(z){console.error("Failed to parse import file:",z),C(null),S(null),k(z)}},L.onerror=k,L.readAsText(h)}),[]),N=f.useCallback(async()=>{var M;if(!w||!b)return;p(!0),P.current=!1;const{sessionKey:h,plan:y}=w,k=y.reduce((E,D)=>E+D.count,0);let L=0;try{for(const E of y){if(P.current)break;const{module:D,count:z}=E,g=((M=b.data)==null?void 0:M[D])||[];if(D==="settings")v({label:`Importing ${D}...`,current:L,total:k}),await et(h,D,g),L+=1;else for(let F=0;F<g.length&&!P.current;F+=Ne){const I=g.slice(F,F+Ne);v({label:`Importing ${D}...`,current:L,total:k}),await et(h,D,I),L+=I.length}}await tt(h),v({label:"Import complete!",current:k,total:k}),c(!0)}catch(E){console.error("Import failed:",E),v({label:"Import failed. Please try again.",current:0,total:0});try{await tt(h)}catch{}}finally{p(!1)}},[w,b]),B=f.useCallback(()=>{P.current=!0},[]),$=f.useCallback(()=>{C(null),S(null),v({label:"",current:0,total:0}),c(!1)},[]);return{modules:l,modulesLoading:o,loadModules:A,exporting:a,exportProgress:s,runExport:T,importing:u,importComplete:d,importProgress:x,importPlan:w,parseImportFile:i,runImport:N,resetImport:$,abort:B}}function Ys(){var X,Q,U;const[l,t]=f.useState("export"),[o,n]=f.useState([]),a=f.useRef(null),[r,s]=f.useState(!1),[m,u]=f.useState(null),[p,d]=f.useState(null),[c,x]=f.useState(!1),{modules:v,modulesLoading:w,loadModules:C,exporting:b,exportProgress:S,runExport:P,importing:A,importComplete:T,importProgress:i,importPlan:N,parseImportFile:B,runImport:$,resetImport:h}=Us(),y=A||b;f.useEffect(()=>{C()},[C]),f.useEffect(()=>{v.length>0&&o.length===0&&n(v.map(j=>j.name))},[v]),f.useEffect(()=>{if(!y)return;const j=J=>{J.preventDefault(),J.returnValue=""};window.addEventListener("beforeunload",j);const _=J=>{const ae=J.target.closest("a[href]");ae&&(ae.href&&ae.href.startsWith("blob:")||ae.hasAttribute("download")||(J.preventDefault(),J.stopPropagation()))};document.addEventListener("click",_,!0);const K=window.location.hash,be=()=>{window.location.hash=K};return window.addEventListener("hashchange",be),()=>{window.removeEventListener("beforeunload",j),document.removeEventListener("click",_,!0),window.removeEventListener("hashchange",be)}},[y]);const k=v.length>0&&o.length===v.length,L=()=>n(k?[]:v.map(j=>j.name)),M=j=>n(_=>_.includes(j)?_.filter(K=>K!==j):[..._,j]),E=v.filter(j=>o.includes(j.name)).reduce((j,_)=>j+_.count,0),D=S.total>0?Math.round(S.current/S.total*100):0,z=f.useCallback(async j=>{if(d(null),u(j.name),!j.name.endsWith(".json")){d("Please select a valid .json file.");return}x(!0);try{await B(j)}catch(_){d((_==null?void 0:_.message)||"Failed to parse the file.")}finally{x(!1)}},[B]),g=j=>{var K;const _=(K=j.target.files)==null?void 0:K[0];_&&z(_)},F=j=>{var K;j.preventDefault(),s(!1);const _=(K=j.dataTransfer.files)==null?void 0:K[0];_&&z(_)},I=()=>{u(null),d(null),a.current&&(a.current.value=""),h()},O=i.total>0?Math.round(i.current/i.total*100):0,he=((X=N==null?void 0:N.plan)==null?void 0:X.reduce((j,_)=>j+_.count,0))||0;return e.jsxs("div",{className:"space-y-5",children:[y&&e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-amber-50 border border-amber-200 rounded-lg",children:[e.jsx(Ns,{className:"w-4 h-4 text-amber-600 shrink-0"}),e.jsxs("p",{className:"text-[13px] text-amber-800 font-medium",children:[A?"Import":"Export"," is in progress. Please do not close, reload, or navigate away from this page."]})]}),e.jsxs(ts,{value:l,onValueChange:j=>{A||t(j)},children:[e.jsxs(ss,{className:"h-10 p-0.5 bg-slate-100/80 rounded-lg w-auto inline-flex",children:[e.jsxs(qe,{value:"export",disabled:A,className:"gap-1.5 px-5 text-[13px] rounded-md data-[state=active]:bg-white data-[state=active]:shadow-sm",children:[e.jsx(Qe,{className:"w-3.5 h-3.5"})," Export"]}),e.jsxs(qe,{value:"import",className:"gap-1.5 px-5 text-[13px] rounded-md data-[state=active]:bg-white data-[state=active]:shadow-sm",children:[e.jsx(Ge,{className:"w-3.5 h-3.5"})," Import"]})]}),e.jsx(Ue,{value:"export",className:"mt-4",children:w?e.jsx("div",{className:"space-y-2.5",children:[1,2,3,4,5].map(j=>e.jsxs("div",{className:"flex items-center gap-3 py-2 px-1",children:[e.jsx(Ie,{className:"h-4 w-4 rounded-sm"}),e.jsx(Ie,{className:"h-4 flex-1 rounded"}),e.jsx(Ie,{className:"h-5 w-10 rounded-full"})]},j))}):e.jsxs("div",{className:"space-y-3",children:[e.jsxs("label",{className:"flex items-center gap-3 cursor-pointer group py-1",children:[e.jsx(Ze,{checked:k,onCheckedChange:L,disabled:b}),e.jsx("span",{className:"text-[13px] font-semibold text-title group-hover:text-primary transition-colors flex-1",children:"Select All"}),e.jsxs("span",{className:"text-xs text-small-font tabular-nums",children:[o.length,"/",v.length]})]}),e.jsx(es,{}),e.jsx("div",{className:"space-y-px max-h-[340px] overflow-y-auto -mx-1 px-1",children:v.map(j=>{const _=o.includes(j.name);return e.jsxs("label",{className:`flex items-center gap-3 py-2 px-3 rounded-md cursor-pointer transition-colors ${_?"bg-[#F5FAFF]":"hover:bg-slate-50"}`,children:[e.jsx(Ze,{checked:_,onCheckedChange:()=>M(j.name),disabled:b}),e.jsx("span",{className:"text-[13px] text-title flex-1",children:j.label}),e.jsx("span",{className:"text-[11px] text-small-font tabular-nums bg-slate-100 rounded-full px-2 py-0.5",children:j.count.toLocaleString()})]},j.name)})}),(b||S.total>0)&&e.jsxs("div",{className:"bg-[#F5FAFF] rounded-md p-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-[13px]",children:[e.jsxs("span",{className:"flex items-center gap-1.5 text-title font-medium",children:[b&&e.jsx(re,{className:"w-3.5 h-3.5 text-primary animate-spin"}),S.label]}),e.jsxs("span",{className:"font-semibold text-primary tabular-nums",children:[D,"%"]})]}),e.jsx(Ye,{value:D,className:"h-1.5"})]}),e.jsxs("div",{className:"flex items-center justify-between pt-1",children:[e.jsx("span",{className:"text-xs text-small-font",children:o.length>0?`${E.toLocaleString()} records`:"No modules selected"}),e.jsxs(le,{onClick:()=>P(o),disabled:b||!o.length,size:"sm",children:[e.jsx(Qe,{className:"w-3.5 h-3.5"}),b?"Exporting...":"Export"]})]})]})}),e.jsx(Ue,{value:"import",className:"mt-4",children:e.jsxs("div",{className:"space-y-4",children:[!N&&!T&&(c?e.jsx("div",{className:"border-2 border-primary/30 bg-[#F5FAFF] rounded-lg py-12 px-6 text-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-2.5",children:[e.jsx(re,{className:"w-8 h-8 text-primary animate-spin"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[13px] font-medium text-title",children:"Reading file..."}),e.jsx("p",{className:"text-xs text-small-font mt-0.5",children:m})]})]})}):e.jsxs("div",{onClick:()=>{var j;return(j=a.current)==null?void 0:j.click()},onDragOver:j=>{j.preventDefault(),s(!0)},onDragLeave:()=>s(!1),onDrop:F,className:`border-2 border-dashed rounded-lg py-12 px-6 text-center cursor-pointer transition-all ${r?"border-primary bg-[#F5FAFF]":"border-slate-200 hover:border-slate-300 hover:bg-slate-50/60"}`,children:[e.jsxs("div",{className:"flex flex-col items-center gap-2.5",children:[e.jsx("div",{className:`h-11 w-11 rounded-full flex items-center justify-center transition-colors ${r?"bg-primary/10":"bg-slate-100"}`,children:e.jsx(ms,{className:`w-5 h-5 ${r?"text-primary":"text-slate-400"}`})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[13px] font-medium text-title",children:"Click to select or drag & drop"}),e.jsx("p",{className:"text-xs text-small-font mt-0.5",children:".json export file from Radius Booking"})]})]}),e.jsx("input",{ref:a,type:"file",accept:".json",onChange:g,className:"hidden"})]})),p&&e.jsxs("div",{className:"flex items-center gap-2.5 text-sm p-3 bg-red-50 border border-red-200 rounded-md",children:[e.jsx(Oe,{className:"w-4 h-4 text-red-500 shrink-0"}),e.jsx("span",{className:"text-red-700 text-[13px]",children:p})]}),N&&!T&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-3 bg-slate-50 p-3 rounded-md",children:[e.jsx(as,{className:"w-4 h-4 text-primary shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-[13px] font-medium text-title truncate",children:m}),e.jsxs("p",{className:"text-xs text-small-font",children:[((Q=N.metadata)==null?void 0:Q.version)&&`v${N.metadata.version}`,((U=N.metadata)==null?void 0:U.exported_at)&&` · ${new Date(N.metadata.exported_at).toLocaleDateString()}`,` · ${he.toLocaleString()} records`]})]}),!A&&e.jsx("button",{onClick:I,className:"p-1 rounded hover:bg-slate-200 transition-colors",children:e.jsx(pe,{className:"w-3.5 h-3.5 text-small-font"})})]}),e.jsx("div",{className:"border border-border rounded-md divide-y divide-border",children:N.plan.map(j=>e.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[e.jsx("span",{className:"text-[13px] text-title capitalize",children:j.module.replace(/_/g," ")}),e.jsx("span",{className:"text-[11px] text-small-font tabular-nums bg-slate-100 rounded-full px-2 py-0.5",children:j.count.toLocaleString()})]},j.module))}),(A||i.total>0)&&e.jsxs("div",{className:"bg-[#F5FAFF] rounded-md p-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-[13px]",children:[e.jsxs("span",{className:"flex items-center gap-1.5 text-title font-medium",children:[A&&e.jsx(re,{className:"w-3.5 h-3.5 text-primary animate-spin"}),i.label]}),e.jsxs("span",{className:"font-semibold text-primary tabular-nums",children:[O,"%"]})]}),e.jsx(Ye,{value:O,className:"h-1.5"})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[!A&&e.jsx(le,{variant:"outline",size:"sm",onClick:I,children:"Cancel"}),e.jsx(le,{size:"sm",onClick:$,disabled:A,className:"bg-green-600 hover:bg-green-700",children:A?e.jsxs(e.Fragment,{children:[e.jsx(re,{className:"w-3.5 h-3.5 animate-spin"})," Importing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Ge,{className:"w-3.5 h-3.5"})," Start Import"]})})]})]}),T&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-3 p-4 bg-green-50 border border-green-200 rounded-md",children:[e.jsx(wt,{className:"w-5 h-5 text-green-600 shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[13px] font-semibold text-green-800",children:"Import completed successfully"}),e.jsx("p",{className:"text-xs text-green-600 mt-0.5",children:"All data has been imported into this site."})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(le,{variant:"outline",size:"sm",onClick:I,children:"Import Another File"})})]})]})})]}),e.jsxs("details",{className:"group border border-border rounded-md",children:[e.jsxs("summary",{className:"flex items-center gap-2 px-3 py-2 cursor-pointer text-xs font-semibold text-small-font uppercase tracking-wider select-none hover:bg-slate-50 transition-colors",children:[e.jsx(ds,{className:"w-3.5 h-3.5"}),"Developer API"]}),e.jsx("pre",{className:"text-xs p-3 border-t border-border overflow-x-auto leading-relaxed text-title bg-slate-50",children:`use RadiusTheme\\RadiusBooking\\Facades\\Export;
use RadiusTheme\\RadiusBooking\\Facades\\Import;

// Export
$data = Export::module('appointment')->export();
$data = Export::modules(['category', 'service', 'staff'])->export();

// Import
Import::module('appointment')->import($records);
Import::fromFile('/path/to/export.json')->import();`})]})]})}const st=[{key:"service",name:"Service Booking",description:"Traditional appointment booking with services, staff, and time slots. This is the core booking module.",icon:_t,color:"bg-blue-500",alwaysOn:!0},{key:"meeting",name:"Meeting Booking",description:"Calendly-style meeting scheduling. Create shareable booking links for 1-on-1 meetings with independent availability.",icon:ft,color:"bg-purple-500",alwaysOn:!1},{key:"event",name:"Event Booking",description:"Event management with ticket types, capacity limits, waitlists, and attendee registration.",icon:Et,color:"bg-orange-500",alwaysOn:!1}];function Qs({dirty:l=!1}){const t=ie(d=>d(Y).getSettings(),[]),{setSettingsFields:o}=Ae(Y),[n,a]=f.useState({service:!0,meeting:!1,event:!1}),[r,s]=f.useState(!1),[m,u]=f.useState(!1);f.useEffect(()=>{t!=null&&t.modules&&a({service:!0,meeting:!!t.modules.meeting,event:!!t.modules.event})},[t==null?void 0:t.modules]);const p=async d=>{var x;if(d==="service")return;const c={...n,[d]:!n[d]};a(c),s(!0);try{await W({path:"/radius-booking/v1/settings/modules",method:"PUT",data:c}),o("modules",c);const v=(x=st.find(w=>w.key===d))==null?void 0:x.name;if($e(c[d]?`${v} enabled`:`${v} disabled`),l){u(!0);return}setTimeout(()=>window.location.reload(),700)}catch{Z("Failed to save module settings"),a(v=>({...v,[d]:!c[d]}))}finally{s(!1)}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-title mb-1",children:"Booking Modules"}),e.jsx("p",{className:"text-sm text-small-font",children:"Enable or disable booking modules. Disabled modules are hidden from the sidebar and their features become inactive."})]}),e.jsx("div",{className:"grid gap-4",children:st.map(d=>{const c=d.icon,x=n[d.key];return e.jsxs("div",{className:`relative flex items-start gap-4 p-5 rounded-xl border-2 transition-all ${x?"border-primary/30 bg-primary/[0.02]":"border-border bg-white"}`,children:[e.jsx("div",{className:`flex items-center justify-center w-11 h-11 rounded-lg ${d.color} text-white shrink-0`,children:e.jsx(c,{className:"w-5 h-5"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h4",{className:"text-sm font-semibold text-title",children:d.name}),d.alwaysOn&&e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-medium bg-green-100 text-green-700",children:"Always Active"})]}),e.jsx("p",{className:"text-sm text-small-font leading-relaxed",children:d.description})]}),e.jsx("div",{className:"shrink-0 pt-1",children:d.alwaysOn?e.jsx("div",{className:"flex items-center justify-center w-10 h-6 rounded-full bg-green-500",children:e.jsx(ht,{className:"w-3.5 h-3.5 text-white"})}):e.jsx("button",{type:"button",role:"switch","aria-checked":x,disabled:r,onClick:()=>p(d.key),className:`relative inline-flex h-6 w-10 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 ${x?"bg-primary":"bg-gray-200"}`,children:e.jsx("span",{className:`pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ${x?"translate-x-4":"translate-x-0"}`})})})]},d.key)})}),e.jsx(ze,{open:m,onClose:()=>u(!1),onConfirm:()=>window.location.reload(),title:"Reload to update sidebar?",description:"Your module change is saved. Reloading will update the sidebar navigation, but any unsaved changes on other settings tabs will be lost.",confirmText:"Reload",cancelText:"Stay",confirmVariant:"default"})]})}function Xs(){const[l,t]=f.useState(""),[o,n]=f.useState(null),[a,r]=f.useState(""),[s,m]=f.useState(!0),[u,p]=f.useState(!1),[d,c]=f.useState(!1),[x,v]=f.useState(!1);f.useEffect(()=>{W({path:"/radius-booking/v1/license/status",method:"GET"}).then(P=>{P!=null&&P.data&&(t(P.data.license_key||""),n(P.data.status||null),r(P.data.message||""))}).catch(()=>{}).finally(()=>m(!1))},[]);const w=async()=>{var P,A,T,i;if(!l.trim()){Z("Please enter a license key.");return}p(!0);try{const N=await W({path:"/radius-booking/v1/license/activate",method:"POST",data:{license_key:l.trim()}});(P=N==null?void 0:N.data)!=null&&P.success?(n("valid"),r(N.data.message||"License activated successfully."),$e(N.data.message||"License activated!")):(n(((A=N==null?void 0:N.data)==null?void 0:A.status)||"invalid"),r(((T=N==null?void 0:N.data)==null?void 0:T.message)||"Activation failed."),Z(((i=N==null?void 0:N.data)==null?void 0:i.message)||"Activation failed."))}catch(N){Z((N==null?void 0:N.message)||"Failed to activate license.")}finally{p(!1)}},C=async()=>{var P,A;c(!0);try{const T=await W({path:"/radius-booking/v1/license/deactivate",method:"POST"});(P=T==null?void 0:T.data)!=null&&P.success?(n(null),t(""),r(""),$e(T.data.message||"License deactivated.")):Z(((A=T==null?void 0:T.data)==null?void 0:A.message)||"Deactivation failed.")}catch(T){Z((T==null?void 0:T.message)||"Failed to deactivate license.")}finally{c(!1)}},b={valid:{label:"Active",icon:wt,color:"text-green-600",bg:"bg-green-50 border-green-200"},invalid:{label:"Invalid",icon:We,color:"text-red-600",bg:"bg-red-50 border-red-200"},expired:{label:"Expired",icon:Oe,color:"text-amber-600",bg:"bg-amber-50 border-amber-200"}},S=o?b[o]||b.invalid:null;return s?e.jsx("div",{className:"flex items-center justify-center py-16",children:e.jsx(re,{className:"w-6 h-6 animate-spin text-primary"})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-title mb-1",children:"License Management"}),e.jsx("p",{className:"text-sm text-small-font",children:"Activate your Radius Booking Pro license to receive updates and premium support."})]}),S&&e.jsxs("div",{className:`flex items-center gap-3 p-4 rounded-xl border ${S.bg}`,children:[e.jsx(S.icon,{className:`w-5 h-5 ${S.color}`}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("p",{className:`text-sm font-semibold ${S.color}`,children:["License ",S.label]}),a&&e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:a})]})]}),e.jsxs("div",{className:"bg-white border border-border rounded-xl p-6 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3 pb-4 border-b border-border",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center",children:e.jsx(ps,{className:"w-5 h-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-semibold text-title",children:"License Key"}),e.jsx("p",{className:"text-xs text-small-font",children:"Enter your purchase license key"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(bt,{htmlFor:"license_key",children:"License Key"}),e.jsxs("div",{className:"relative",children:[e.jsx(Fe,{id:"license_key",type:x?"text":"password",placeholder:"Enter your license key...",value:l,onChange:P=>t(P.target.value),disabled:o==="valid",className:"h-11 font-mono text-sm pr-10"}),e.jsx("button",{type:"button",onClick:()=>v(!x),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-title transition-colors",children:x?e.jsx(Se,{className:"w-4 h-4"}):e.jsx(Le,{className:"w-4 h-4"})})]})]}),e.jsx("div",{className:"flex items-center gap-3",children:o==="valid"?e.jsx(le,{variant:"destructive",onClick:C,disabled:d,className:"h-10",children:d?e.jsxs(e.Fragment,{children:[e.jsx(re,{className:"w-4 h-4 mr-2 animate-spin"})," Deactivating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(We,{className:"w-4 h-4 mr-2"})," Deactivate License"]})}):e.jsx(le,{onClick:w,disabled:u||!l.trim(),className:"h-10",children:u?e.jsxs(e.Fragment,{children:[e.jsx(re,{className:"w-4 h-4 mr-2 animate-spin"})," Activating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(ls,{className:"w-4 h-4 mr-2"})," Activate License"]})})})]})]})}const R=({className:l,...t})=>e.jsx("div",{className:Ee("animate-pulse rounded-md bg-slate-200",l),...t}),ce=({type:l="text"})=>{switch(l){case"toggle":return e.jsxs("div",{className:"flex items-center justify-between py-3",children:[e.jsxs("div",{className:"space-y-1 flex-1",children:[e.jsx(R,{className:"h-4 w-40"}),e.jsx(R,{className:"h-3 w-64"})]}),e.jsx(R,{className:"h-6 w-11 rounded-full"})]});case"select":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(R,{className:"h-4 w-32"}),e.jsx(R,{className:"h-10 w-full rounded-md"})]});case"textarea":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(R,{className:"h-4 w-32"}),e.jsx(R,{className:"h-24 w-full rounded-md"})]});default:return e.jsxs("div",{className:"space-y-2",children:[e.jsx(R,{className:"h-4 w-32"}),e.jsx(R,{className:"h-10 w-full rounded-md"}),e.jsx(R,{className:"h-3 w-48"})]})}},at=({fieldCount:l=3,hasToggle:t=!1})=>e.jsxs("div",{className:"rounded-lg border border-border bg-white p-6 shadow-sm",children:[e.jsxs("div",{className:"mb-6 space-y-2 border-b border-slate-100 pb-4",children:[e.jsx(R,{className:"h-6 w-48"}),e.jsx(R,{className:"h-4 w-96"})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"space-y-4",children:Array.from({length:l}).map((o,n)=>e.jsx(ce,{type:"text"},n))}),t&&e.jsxs("div",{className:"border-t border-slate-100 pt-6 space-y-1",children:[e.jsx(ce,{type:"toggle"}),e.jsx(ce,{type:"toggle"})]})]})]}),Js=()=>e.jsxs("div",{className:"rounded-lg border border-border bg-white p-6 shadow-sm",children:[e.jsxs("div",{className:"mb-6 space-y-2 border-b border-slate-100 pb-4",children:[e.jsx(R,{className:"h-6 w-48"}),e.jsx(R,{className:"h-4 w-96"})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 sm:grid-cols-3",children:[e.jsx(ce,{type:"text"}),e.jsx(ce,{type:"text"}),e.jsx(ce,{type:"select"})]})]}),ea=()=>e.jsxs("div",{className:"rounded-lg border border-border bg-white p-6 shadow-sm",children:[e.jsxs("div",{className:"mb-6 space-y-2 border-b border-slate-100 pb-4",children:[e.jsx(R,{className:"h-6 w-48"}),e.jsx(R,{className:"h-4 w-96"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(R,{className:"h-5 w-32"}),e.jsx(R,{className:"h-9 w-24 rounded-md"})]}),Array.from({length:3}).map((l,t)=>e.jsx("div",{className:"rounded-md border border-border p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-2 flex-1",children:[e.jsx(R,{className:"h-4 w-40"}),e.jsx(R,{className:"h-3 w-64"})]}),e.jsx(R,{className:"h-8 w-8 rounded"})]})},t))]})]});function ta(){return e.jsx("div",{className:"min-h-screen",children:e.jsx("main",{className:"bg-white border-l border-b border-r border-border px-[50px] py-[20px] rounded-bl-[12px] rounded-br-[12px]",children:e.jsx("div",{className:"w-full",children:e.jsxs("section",{className:"space-y-8",children:[e.jsx(Js,{}),e.jsx(at,{fieldCount:4,hasToggle:!0}),e.jsx(ea,{}),e.jsx(at,{fieldCount:2,hasToggle:!1}),e.jsxs("div",{className:"flex items-center justify-end gap-3",children:[e.jsx(R,{className:"h-10 w-20 rounded-md"}),e.jsx(R,{className:"h-10 w-32 rounded-md"})]})]})})})})}const me=l=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(l);function ne(l,t){return t.split(".").reduce((o,n)=>o==null?void 0:o[n],l)}function ye(l,t){if(!l)return!0;const{key:o,value:n}=l,a=ne(t,o);return a===n?!0:typeof n=="boolean"&&typeof a=="string"?a===String(n):typeof a=="boolean"&&typeof n=="string"?String(a)===n:!1}function lt(l){return l==="true"?!0:l==="false"?!1:l}function sa({value:l,onChange:t,placeholder:o,disabled:n,hint:a}){const[r,s]=f.useState(!1);return e.jsxs("div",{className:"flex flex-col w-full",children:[e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:r?"text":"password",value:l||"",onChange:m=>t(m.target.value),placeholder:o,disabled:n,className:"w-full rounded-md border border-border bg-white px-3 py-2 pr-10 text-sm text-title placeholder:text-slate-400 focus:outline-none focus:ring-2 focus:ring-blue-200 disabled:bg-slate-50 disabled:text-small-font disabled:cursor-not-allowed"}),e.jsx("button",{type:"button",onClick:()=>s(!r),disabled:n,className:"absolute right-2 top-1/2 -translate-y-1/2 rounded p-1 text-slate-400 hover:text-slate-600 disabled:opacity-50 disabled:cursor-not-allowed",children:r?e.jsx(Se,{className:"h-4 w-4"}):e.jsx(Le,{className:"h-4 w-4"})})]}),a&&e.jsx(oe,{children:a})]})}function aa({value:l,onChange:t,units:o=["px","rem","em","%"],placeholder:n="0"}){const a=f.useMemo(()=>{const c=String(l||"").match(/^([\d.]*)\s*(px|rem|em|%|)$/i);return{num:c?c[1]:"",unit:c&&c[2]?c[2].toLowerCase():o[0]}},[l,o]),r=a.unit==="px"?1:.125,s=a.unit==="px"?0:3,m=(d,c)=>{t(d===""?"":`${d}${c}`)},u=()=>{const d=parseFloat(a.num)||0,c=parseFloat((d+r).toFixed(s));m(String(c),a.unit)},p=()=>{const d=parseFloat(a.num)||0,c=Math.max(0,parseFloat((d-r).toFixed(s)));m(String(c),a.unit)};return e.jsxs("div",{className:"flex items-center w-full rounded-md border border-border overflow-hidden focus-within:ring-2 focus-within:ring-blue-200",children:[e.jsx("button",{type:"button",onClick:p,className:"flex items-center justify-center w-9 h-9 shrink-0 bg-slate-50 text-slate-500 hover:bg-slate-100 hover:text-title border-r border-border transition-colors",children:e.jsx("svg",{width:"12",height:"2",viewBox:"0 0 12 2",fill:"none",children:e.jsx("path",{d:"M0.5 1H11.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),e.jsx("input",{type:"text",inputMode:"decimal",value:a.num,onChange:d=>{const c=d.target.value;(c===""||/^\d*\.?\d*$/.test(c))&&m(c,a.unit)},placeholder:n,className:"flex-1 min-w-0 bg-white px-3 py-2 text-sm text-title text-center placeholder:text-slate-400 focus:outline-none border-0"}),e.jsx("button",{type:"button",onClick:u,className:"flex items-center justify-center w-9 h-9 shrink-0 bg-slate-50 text-slate-500 hover:bg-slate-100 hover:text-title border-l border-r border-border transition-colors",children:e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:e.jsx("path",{d:"M6 0.5V11.5M0.5 6H11.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),e.jsx("select",{value:a.unit,onChange:d=>m(a.num,d.target.value),className:"h-9 bg-slate-50 px-2 text-sm font-medium text-title focus:outline-none cursor-pointer border-0 w-[30%]",children:o.map(d=>e.jsx("option",{value:d,children:d},d))})]})}function ee({field:l,value:t,onChange:o}){var c,x,v,w,C;const n=ie(b=>b(Y).settingsError(),[]),{setSettingsError:a}=Ae(Y),r=(c=l.transform)!=null&&c.toDisplay?l.transform.toDisplay(t):t,s=b=>{var P;const S=(P=l.transform)!=null&&P.toStore?l.transform.toStore(b):b;o(S)},m=!!((x=window.radius_booking_param)!=null&&x.is_pro),u=is(),p=f.useCallback(()=>{u({title:"Select Location Photo",onSelect:({id:b,url:S,sizes:P})=>{s(S)}})},[u]),d=f.useCallback(()=>{s("")},[]);switch(l.type){case"text":return e.jsxs("div",{className:"flex flex-col w-full",children:[e.jsx(q,{value:r||"",onChange:b=>s(b.target.value),placeholder:l.placeholder,disabled:l.disabled}),m&&l.hint&&e.jsx(oe,{children:l.hint}),l.proText&&!m&&e.jsx(oe,{children:l.proText})]});case"password":return e.jsx(sa,{value:r,onChange:s,placeholder:l.placeholder,disabled:l.disabled,hint:l.hint});case"image":return e.jsx(e.Fragment,{children:e.jsx(rs,{imagePath:r,onUpload:p,onRemove:d})});case"textarea":return e.jsxs("div",{className:"flex flex-col w-full",children:[e.jsx(Be,{value:r||"",onChange:b=>s(b.target.value),placeholder:l.placeholder,rows:l.rows}),l.hint&&e.jsx(oe,{children:l.hint})]});case"number":return e.jsx(_e,{value:t||"",onChange:b=>s(Math.max(0,Number(b.target.value))),min:l.min,max:l.max,step:l.step,placeholder:0});case"phone":return e.jsxs("div",{className:l.className||"flex flex-col w-full",children:[e.jsx(ns,{value:t||0,onChange:b=>{s(b);const S=He(b);a(S!==!0?{business:{phone:S}}:{business:{phone:""}})},error:(v=n==null?void 0:n.business)==null?void 0:v.phone}),((w=n==null?void 0:n.business)==null?void 0:w.phone)&&e.jsx("div",{children:e.jsxs("p",{className:"text-xs text-red-600 flex items-center gap-1",children:[e.jsx(Oe,{className:"h-3 w-3"}),(C=n==null?void 0:n.business)==null?void 0:C.phone]})})]});case"select":return e.jsx(ut,{value:t,onChange:b=>{const S=l.options.find(A=>A.value==b.target.value),P=S?S.value:b.target.value;s(lt(P))},options:l.options});case"select2":return e.jsx(Ts,{options:l.options,value:t,onChange:b=>{if(l.multiple)s(b);else{const S=l.options.find(A=>A.value==b),P=S?S.value:b;s(lt(P))}},multiple:l.multiple,className:""});case"color":return e.jsxs("div",{className:"flex items-center gap-3 w-full",children:[e.jsx("input",{type:"color",value:r||"#0040ff",onChange:b=>s(b.target.value),className:"w-10 h-10 rounded border border-gray-300 cursor-pointer p-0.5"}),e.jsx(q,{value:r||"",onChange:b=>s(b.target.value),placeholder:"#0040ff",className:"flex-1"})]});case"toggle":return e.jsxs("div",{className:"flex flex-col w-full",children:[e.jsx(H,{checked:t||!1,onChange:s,label:l.label}),l.hint&&e.jsx(oe,{children:l.hint})]});case"unit":return e.jsx(aa,{value:r,onChange:s,units:l.units,placeholder:l.placeholder});default:return e.jsxs("div",{children:["Unknown field type: ",l.type]})}}function la(){var S,P,A,T;const l=Ae(Y),t=ie(i=>i(Y).getSettings(),[]);ie(i=>i(Y).settingsLoading(),[]);const[o,n]=f.useState(!1),[a,r]=Ft(),s=a.get("tab")||"general",[m,u]=f.useState(!1),[p,d]=f.useState(!1);f.useEffect(()=>{d(!0)},[t]),f.useEffect(()=>{let i=!0;return(async()=>{i&&l.getSettings({})})(),()=>{i=!1}},[l]);const c=f.useMemo(()=>{var B,$,h,y,k;const i=(($=(B=t==null?void 0:t.integrations)==null?void 0:B.classifiedListing)==null?void 0:$.enabled)&&((y=(h=t==null?void 0:t.integrations)==null?void 0:h.classifiedListing)==null?void 0:y.is_cl_active)!==!1,N=!!((k=window.radius_booking_param)!=null&&k.is_cl_active);return Xe.sections.filter(L=>!(L.tab!==s||L.id==="staff-permissions"&&!i||L.tab==="payout"&&!N))},[s,(P=(S=t==null?void 0:t.integrations)==null?void 0:S.classifiedListing)==null?void 0:P.enabled,(T=(A=t==null?void 0:t.integrations)==null?void 0:A.classifiedListing)==null?void 0:T.is_cl_active]);function x(i,N){var B,$;if(i==="phone.showOnlyCountries"&&l.setSettingsFields("phone.defaultCountry",""),i==="phone.defaultCountry"&&(($=(B=t==null?void 0:t.phone)==null?void 0:B.showOnlyCountries)==null?void 0:$.length)>0){const y=t.phone.showOnlyCountries.find(k=>k===N);y?N=y:N=""}l.setSettingsFields(i,N)}async function v(){var i,N,B,$,h,y,k,L,M,E,D;try{if(((i=t==null?void 0:t.email)==null?void 0:i.senderEmail)!==""&&!me((N=t==null?void 0:t.email)==null?void 0:N.senderEmail)){Z("Invalid Email Sender Email");return}if(((B=t==null?void 0:t.email)==null?void 0:B.replyToEmail)!==""&&!me(($=t==null?void 0:t.email)==null?void 0:$.replyToEmail)){Z("Invalid Email Sender Reply-To Email");return}if(((y=(h=t==null?void 0:t.integrations)==null?void 0:h.appleCalendar)==null?void 0:y.enabled)===!0&&((L=(k=t==null?void 0:t.integrations)==null?void 0:k.appleCalendar)==null?void 0:L.organizerEmail)!==""&&!me((E=(M=t==null?void 0:t.integrations)==null?void 0:M.appleCalendar)==null?void 0:E.organizerEmail)){Z("Invalid Apple Calendar Organizer Email");return}const z=He((D=t==null?void 0:t.business)==null?void 0:D.phone);if(z!==!0){l.setSettingsError({business:{phone:z}});return}await l.saveSettings(t),u(!0),d(!1),setTimeout(()=>u(!1),1500)}catch{}}const w=()=>{n(!0)},C=async()=>{await l.restoreSettings()&&n(!1)};function b(i){var M,E,D,z;if(i.component==="custom"){if(i.id==="weekly-schedule")return e.jsx(G,{id:i.id,title:i.title,description:i.description,children:e.jsx(Ms,{settings:t,onUpdate:x})},i.id);if(i.id==="custom-schedules")return e.jsx(G,{id:i.id,title:i.title,description:i.description,children:e.jsx(Is,{settings:t,onUpdate:x})},i.id);if(i.id==="holidays")return e.jsx(G,{id:i.id,title:i.title,description:i.description,children:e.jsx(_s,{settings:t,onUpdate:x})},i.id);if(i.id==="languages")return e.jsx(G,{id:i.id,title:i.title,description:i.description,children:e.jsx(Es,{settings:t,onUpdate:x})},i.id);if(i.id==="offline-payment")return e.jsx(G,{id:i.id,title:i.title,description:i.description,children:e.jsx(Fs,{settings:t,onUpdate:x})},i.id);if(i.id==="paypal")return e.jsx(G,{id:i.id,title:i.title,description:i.description,children:e.jsx(Ds,{settings:t,onUpdate:x})},i.id);if(i.id==="stripe")return e.jsx(G,{id:i.id,title:i.title,description:i.description,children:e.jsx(Rs,{settings:t,onUpdate:x})},i.id);if(i.render)return e.jsx(G,{id:i.id,title:i.title,description:i.description,children:i.render()},i.id);if(i.id==="google-calendar-integration")return e.jsx(G,{id:i.id,title:i.title,description:i.description,children:e.jsx(Bs,{settings:t,onUpdate:x,onSave:v})},i.id);if(i.id==="zoom-integration")return e.jsx(G,{id:i.id,title:i.title,description:i.description,children:e.jsx($s,{settings:t,onUpdate:x})},i.id);if(i.id==="apple-calendar-integration")return e.jsx(G,{id:i.id,title:i.title,description:i.description,children:e.jsx(Os,{settings:t,onUpdate:x})},i.id);if(i.id==="classified-listing-integration")return window.radius_booking_param.is_cl_active?e.jsx(G,{id:i.id,title:i.title,description:i.description,children:e.jsx(zs,{settings:t,onUpdate:x})},i.id):null;if(i.id==="chatbot-appearance"){const g=i.fields||[],F=!!((M=window.radius_booking_param)!=null&&M.is_pro),I=i.isPro&&!F;return e.jsx(G,{id:i.id,title:i.title,description:i.description,badge:I?e.jsx(fe,{}):null,children:e.jsx("div",{className:I?"pointer-events-none select-none opacity-50":"",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[e.jsx("div",{className:"space-y-5",children:g.map(O=>{if(!ye(O.condition,t))return null;const he=ne(t,O.key),X=O.isPro&&!F,Q=O.type==="select"&&!F?{...O,options:O.options.map(U=>U.isPro?{...U,label:`${U.label} (Pro)`,disabled:!0}:U)}:O;return e.jsx("div",{className:X?"relative":"",children:e.jsx(V,{label:O.label,badge:X?e.jsx(fe,{}):null,children:e.jsx("div",{className:X?"pointer-events-none select-none opacity-50":"",children:e.jsx(ee,{field:Q,value:he,onChange:U=>x(O.key,U)})})})},O.key)})}),e.jsx("div",{children:e.jsx(Ks,{settings:t})})]})})},i.id)}if(i.id==="payout-settings"){const g=i.isPro&&!((E=window.radius_booking_param)!=null&&E.is_pro);return e.jsx(G,{id:i.id,title:i.title,description:i.description,badge:g?e.jsx(fe,{}):null,children:e.jsx("div",{className:g?"pointer-events-none select-none opacity-50":"",children:e.jsx(Vs,{settings:(t==null?void 0:t.payout)||{},onChange:(F,I)=>x(`payout.${F}`,I)})})},i.id)}if(i.id==="chatbot-knowledge"){const g=i.isPro&&!((D=window.radius_booking_param)!=null&&D.is_pro);return e.jsx(G,{id:i.id,title:i.title,description:i.description,badge:g?e.jsx(fe,{}):null,children:e.jsx("div",{className:g?"pointer-events-none select-none opacity-50":"",children:e.jsx(Hs,{})})},i.id)}}const N=i.fields||[],B=N.filter(g=>g.position==="top"),$=N.filter(g=>g.position!=="top"),h=$.some(g=>g.gridColumn),y=$.filter(g=>g.type==="toggle"&&!g.gridColumn),k=$.filter(g=>g.type!=="toggle"||g.gridColumn),L=i.isPro&&!((z=window.radius_booking_param)!=null&&z.is_pro);return e.jsx(G,{id:i.id,title:i.title,description:i.description,badge:L?e.jsx(fe,{}):null,children:e.jsxs("div",{className:L?"pointer-events-none select-none opacity-50":"",children:[B.length>0&&B.map(g=>{if(!ye(g.condition,t))return null;const F=ne(t,g.key);return e.jsx(Ce,{cols:"3",children:e.jsx("div",{className:"mb-5",children:e.jsx(ee,{field:g,value:F,onChange:I=>x(g.key,I)})},g.key)})}),h&&k.length>0&&e.jsx(Ce,{cols:i.cols,children:k.map((g,F)=>{if(!ye(g.condition,t))return null;const I=ne(t,g.key);return g.type==="toggle"?e.jsx("div",{className:"flex items-end",children:e.jsx(ee,{field:g,value:I,onChange:O=>x(g.key,O)})},g.key):g.fullWidth?e.jsx(V,{label:g.label,className:"sm:col-span-3",children:e.jsx(ee,{field:g,value:I,onChange:O=>x(g.key,O)})},g.key):e.jsx(V,{label:g.label,children:e.jsx(ee,{field:g,value:I,onChange:O=>x(g.key,O)})},g.key)})}),!h&&k.length>0&&e.jsx(St,{children:k.map(g=>{if(!ye(g.condition,t))return null;const F=ne(t,g.key);return g.label?e.jsx(V,{label:g.label,children:e.jsx(ee,{field:g,value:F,onChange:I=>x(g.key,I)})},g.key):e.jsx(ee,{field:g,value:F,onChange:I=>x(g.key,I)},g.key)})}),y.length>0&&e.jsx(Ce,{children:y.map(g=>{if(!ye(g.condition,t))return null;const F=ne(t,g.key);return e.jsx(ee,{field:g,value:F,onChange:I=>x(g.key,I)},g.key)})})]})},i.id)}return t.length===0?e.jsx(ta,{}):e.jsxs("div",{className:"min-h-screen",children:[e.jsx("div",{className:"",children:e.jsx(Ls,{tabs:Xe.tabs,activeTab:s,onTabChange:i=>r({tab:i})})}),e.jsx("main",{className:"bg-white border-l border-b border-r border-border px-[50px] py-[20px] rounded-bl-[12px] rounded-br-[12px]",children:e.jsx("div",{className:"w-full",children:s==="modules"?e.jsx(Qs,{dirty:p}):s==="export-import"?e.jsx(Ys,{}):s==="license"?e.jsx(Xs,{}):e.jsxs("section",{className:"space-y-8",children:[c.map(i=>b(i)),e.jsxs("div",{className:"flex items-center justify-end gap-3",children:[e.jsx("button",{onClick:w,className:"rounded-md border border-border bg-white px-4 py-2 text-sm font-medium text-title2 shadow-sm hover:bg-slate-50",children:"Reset"}),e.jsx("button",{onClick:v,className:"rounded-md bg-primary px-4 py-2 text-sm font-semibold text-white shadow hover:bg-blue-700",children:m?"Saved":"Save Changes"})]})]})})}),e.jsx(ze,{open:o,onClose:()=>n(!1),onConfirm:()=>C(),title:"Are you sure?",description:"This action will reset you settings.",confirmText:"Reset"})]})}function ra(){const l=Nt("/settings"),t=ie(w=>w(Y).isSettingsSaving(),[]),{mode:o}=l;Dt();const[n,a]=f.useState(!1),r=Ae(Y),s=()=>{switch(o){case"list":return e.jsx(la,{});default:return null}},m=ie(w=>w(Y).getSettings(),[]),u=ie(w=>w(Y).settingsError(),[]),p=async()=>{var C,b,S,P,A,T,i,N,B,$,h,y;if(((C=m==null?void 0:m.email)==null?void 0:C.senderEmail)!==""&&!me((b=m==null?void 0:m.email)==null?void 0:b.senderEmail)){Z("Invalid Email Sender Email");return}if(((S=m==null?void 0:m.email)==null?void 0:S.replyToEmail)!==""&&!me((P=m==null?void 0:m.email)==null?void 0:P.replyToEmail)){Z("Invalid Email Sender Reply-To Email");return}if(((T=(A=m==null?void 0:m.integrations)==null?void 0:A.appleCalendar)==null?void 0:T.enabled)===!0&&((N=(i=m==null?void 0:m.integrations)==null?void 0:i.appleCalendar)==null?void 0:N.organizerEmail)!==""&&!me(($=(B=m==null?void 0:m.integrations)==null?void 0:B.appleCalendar)==null?void 0:$.organizerEmail)){Z("Invalid Apple Calendar Organizer Email");return}const w=He((h=m==null?void 0:m.business)==null?void 0:h.phone);if(w!==!0){r.setSettingsError({business:{phone:w}}),Z(((y=u==null?void 0:u.business)==null?void 0:y.phone)||"Server error");return}await r.saveSettings(m)},d=()=>{a(!0)},c=async()=>{await r.restoreSettings()&&a(!1)},v=({list:[{key:"reset-settings",label:"Reset",icon:vs,onClick:d,variant:"cancel"},{key:"save-settings",label:"Save Settings",icon:vt,onClick:p,loading:t,variant:"primary"}]}[o]||[]).map(w=>e.jsx(Ct,{label:w.label,icon:w.icon,onClick:w.onClick,loading:w.loading||!1,variant:w.variant||"primary"},w.key));return e.jsxs("div",{children:[e.jsx(kt,{title:"Settings",description:"Configure scheduling, payments, customers, and more",showBack:o!=="list",onBack:l.navigateTo.list,actions:v,icon:e.jsx(Yt,{className:"w-5 h-5 text-primary-colordefault"}),children:s()}),e.jsx(ze,{open:n,onClose:()=>a(!1),onConfirm:()=>c(),title:"Are you sure?",description:"This action will reset you settings.",confirmText:"Reset"})]})}function jl(){return e.jsx(Rt,{children:e.jsx($t,{path:"/",element:e.jsx(ra,{})})})}export{jl as default};
//# sourceMappingURL=index-CAkJIy8z.js.map
