your-ai-workflow-firebase-os 2.0.9 → 2.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/dist/{Assets-COH4Ji57.js → Assets-BKXpQmMS.js} +2 -2
  2. package/dist/{Assets-D7fDckSi.cjs → Assets-DoZlHuud.cjs} +1 -1
  3. package/dist/{Billing-kk4ZMd3z.js → Billing-A6rwfQRT.js} +2 -2
  4. package/dist/{Billing-DkuJdls5.cjs → Billing-CBxVy-CG.cjs} +1 -1
  5. package/dist/{CopyLink-C5lKLyOU.cjs → CopyLink-D6QTWSoK.cjs} +1 -1
  6. package/dist/{CopyLink-CNjDLzOl.js → CopyLink-kROJG9Qf.js} +1 -1
  7. package/dist/{DashboardNav-GgEUpyTa.cjs → DashboardNav-Bc619nqn.cjs} +1 -1
  8. package/dist/{DashboardNav-CEd8gGPm.js → DashboardNav-CxS3Qnl-.js} +1 -1
  9. package/dist/{EmailAdmin-pbQ-f9Ge.js → EmailAdmin-DbWK_5Kw.js} +4 -4
  10. package/dist/{EmailAdmin-d_gWd48U.cjs → EmailAdmin-sa9C5jOw.cjs} +1 -1
  11. package/dist/{EventCard-DAsGsicK.cjs → EventCard-D57elnQo.cjs} +1 -1
  12. package/dist/{EventCard-BSGLYD64.js → EventCard-DnoR91KN.js} +1 -1
  13. package/dist/{FormsAdmin-5KTTp6zo.cjs → FormsAdmin-Ck7ssCHd.cjs} +1 -1
  14. package/dist/{FormsAdmin-BNI63vEk.js → FormsAdmin-DOes2Ajy.js} +4 -4
  15. package/dist/{Inbox-DjslBakx.cjs → Inbox-ChBLxjCi.cjs} +1 -1
  16. package/dist/{Inbox-D9Y5K8Se.js → Inbox-CyteB2LL.js} +2 -2
  17. package/dist/{MyBookings-CkEioQIj.cjs → MyBookings-B424zfVj.cjs} +1 -1
  18. package/dist/{MyBookings-B4DndHV6.js → MyBookings-DLQefkDS.js} +3 -3
  19. package/dist/{PageTitle-DQkvCB11.cjs → PageTitle-BL50s4qY.cjs} +1 -1
  20. package/dist/{PageTitle-DCoUQWw6.js → PageTitle-CkZriz8K.js} +1 -1
  21. package/dist/{PagesAdmin-YdYgmuEB.cjs → PagesAdmin-1U73GM_o.cjs} +1 -1
  22. package/dist/PagesAdmin-8smM_SDx.cjs +1 -0
  23. package/dist/{PagesAdmin-DzLJWKBJ.js → PagesAdmin-CORR24DJ.js} +8 -8
  24. package/dist/{PagesAdmin-D0qgoZtW.js → PagesAdmin-hhVAwuuy.js} +1 -1
  25. package/dist/{PaymentsAdmin-C3cEOeIs.js → PaymentsAdmin-CoaSATtY.js} +9 -9
  26. package/dist/{PaymentsAdmin-B5l-f0mp.cjs → PaymentsAdmin-DdP5FeXc.cjs} +1 -1
  27. package/dist/{ProviderMark--adeeajP.cjs → ProviderMark-BCQRu5Gs.cjs} +1 -1
  28. package/dist/{ProviderMark-BvEMlZAm.js → ProviderMark-Celkjuth.js} +1 -1
  29. package/dist/{PublishApp-Bc82Ijkq.cjs → PublishApp-CYHX36oo.cjs} +1 -1
  30. package/dist/{PublishApp-B9Fo6xN0.js → PublishApp-Dagc4TYm.js} +4 -4
  31. package/dist/{ScheduleAdmin-bk3GgxKP.js → ScheduleAdmin-D8siv7ZQ.js} +4 -4
  32. package/dist/{ScheduleAdmin-Dh_hW6p4.cjs → ScheduleAdmin-ohFzK-5E.cjs} +1 -1
  33. package/dist/{SchedulePicker-CN0755Ek.cjs → SchedulePicker-BpPGI5VZ.cjs} +1 -1
  34. package/dist/{SchedulePicker-DO4PewPJ.js → SchedulePicker-sZIZec9L.js} +1 -1
  35. package/dist/{Setup-_G-s5y5Q.js → Setup-DOGI-_8f.js} +2 -2
  36. package/dist/{Setup-R4r6_tbV.cjs → Setup-DiFnnzdd.cjs} +1 -1
  37. package/dist/{SetupPayments-CuFk9REC.cjs → SetupPayments-BLq0W5DU.cjs} +1 -1
  38. package/dist/{SetupPayments-CkolcOtv.js → SetupPayments-ICqCoZeQ.js} +3 -3
  39. package/dist/{SignInAdmin-BLEn0rId.js → SignInAdmin-CQzPqUui.js} +5 -5
  40. package/dist/{SignInAdmin-B1yLLaQu.cjs → SignInAdmin-JnhCefKY.cjs} +1 -1
  41. package/dist/{SupportBar-DI_XbEsG.js → SupportBar-0nIiQp-_.js} +105 -104
  42. package/dist/SupportBar-DR52UpBq.cjs +1 -0
  43. package/dist/{TemplateDrive-DNBwL0oy.js → TemplateDrive-6aV9Hmh3.js} +2 -2
  44. package/dist/{TemplateDrive-BJN-ReA_.cjs → TemplateDrive-ElNPzwv3.cjs} +1 -1
  45. package/dist/ThemeAdmin-B4CIxIjh.cjs +1 -0
  46. package/dist/ThemeAdmin-B9VnH5xH.js +2 -0
  47. package/dist/{ThemeAdmin-DkgmjW3g.cjs → ThemeAdmin-BhaTfgKX.cjs} +1 -1
  48. package/dist/{ThemeAdmin-Cnqefrz6.js → ThemeAdmin-C_8phTKX.js} +3 -3
  49. package/dist/{TransactionsAdmin-C5wQRR1g.cjs → TransactionsAdmin-BiV8VgD0.cjs} +1 -1
  50. package/dist/{TransactionsAdmin-Brs-CEcG.js → TransactionsAdmin-DAENRmVO.js} +3 -3
  51. package/dist/{Users-B16L9cKI.cjs → Users-Ayu_S4cd.cjs} +1 -1
  52. package/dist/{Users-CbI4K_Le.js → Users-CNRVFf3-.js} +5 -5
  53. package/dist/{appIcons-CCArfCDe.js → appIcons-DfjKL0tw.js} +1 -1
  54. package/dist/{appIcons-C90OKlV5.cjs → appIcons-Xjk-LuQ5.cjs} +1 -1
  55. package/dist/{arrivalRoads-Cc6AZM-d.cjs → arrivalRoads-1OeHArA0.cjs} +0 -0
  56. package/dist/{arrivalRoads-CGXm9Ntm.js → arrivalRoads-BZ4SWRAw.js} +0 -0
  57. package/dist/components/TutorialVideo.d.ts +3 -1
  58. package/dist/index.d.ts +1 -0
  59. package/dist/{paidSessions-D-zHC4oG.cjs → paidSessions-BK9qlIyL.cjs} +1 -1
  60. package/dist/{paidSessions-B8e5RHi4.js → paidSessions-C9392hZH.js} +2 -2
  61. package/dist/{recordsKey-C4E2vOti.cjs → recordsKey-B3lWGd8C.cjs} +1 -1
  62. package/dist/{recordsKey-Cd216nq1.js → recordsKey-CJL-dAYF.js} +1 -1
  63. package/dist/{roles-BBDIJzox.cjs → roles-BmnoAilb.cjs} +1 -1
  64. package/dist/{roles-DiwP6-WQ.js → roles-D3T8p-hA.js} +2 -2
  65. package/dist/server.cjs.js +1 -1
  66. package/dist/server.es.js +1 -1
  67. package/dist/vite.cjs.js +1 -1
  68. package/dist/vite.es.js +1 -1
  69. package/dist/your-ai-workflow-firebase-os.cjs.js +13 -13
  70. package/dist/your-ai-workflow-firebase-os.es.js +2184 -2189
  71. package/package.json +1 -1
  72. package/scripts/postinstall.js +2 -1
  73. package/src/pages/Home.tsx +11 -14
  74. package/dist/PagesAdmin-KUxCI1Mr.cjs +0 -1
  75. package/dist/SupportBar-DLWruzQb.cjs +0 -1
  76. package/dist/ThemeAdmin-CoE_c5-P.cjs +0 -1
  77. package/dist/ThemeAdmin-DI7QaZ-0.js +0 -2
@@ -113,7 +113,7 @@ export const pagesRegistry = pages;
113
113
  export const formsRegistry = forms;
114
114
  export const registrationRegistry = registration;
115
115
  export const microcomponentRegistry = microcomponents;
116
- `}var ve=e=>_e(ee(e)),ye=/\b(?:useAiChat|askAi|useAiEnabled|useAiModels)\b|generativelanguage\.googleapis\.com|api\.anthropic\.com|api\.openai\.com|@google\/genai|@google\/generative-ai|@anthropic-ai\/sdk|from\s+['"]openai['"]|(?:GEMINI_API_KEY|GEMINI_KEY|CLAUDE_KEY|OPENAI_KEY|ANTHROPIC_API_KEY|OPENAI_API_KEY)\b|fetch\(\s*['"`]\/api\/ai/,be=(e,t)=>`${e}: ${t.trim()} puts AI on a page, and this app has no AI for pages right now — delete it and everything that draws it, and build the rest of the page as normal. Nothing is exported under useAiChat, askAi, useAiEnabled or useAiModels, and a page never calls Gemini, Claude or OpenAI itself or holds a key: a key in a page is published to everyone who opens it. If the owner asked for AI, tell them the app does not put AI on pages yet.`,xe=e=>e.match(ye)?.[0]??null,L=`AddressField.AddressParts.AdminNotifications.ArrivingEntry.ArrivingPayment.Article.ArticleProps.Bars.BarsItem.BarsProps.Basket.BasketButton.BasketButtonProps.BasketItem.BasketLine.BasketProps.BasketState.BlockedDate.Booking.BookingsState.Button.BuyButton.BuyButtonProps.Buyer.BuyerDetails.BuyerDetailsProps.CancelInput.Card.CaseRecord.CaseState.CasesFromFormOptions.CasesState.Checkout.CheckoutExtra.CheckoutItem.CheckoutOptions.CheckoutProps.CheckoutReturn.CheckoutReturnProps.ConfirmModal.ConfirmModalProps.ContactPopup.CountLimits.CustomSelect.DashboardNav.DataTable.DataTableColumn.DataTableProps.DayKey.EMPTY_ADDRESS.EVERYONE.EmailLook.EmailOptions.EmailStatus.EventCard.FileViewer.FileViewerPopup.FileViewerPopupProps.FileViewerProps.FirebaseOS.FirebaseOSConfig.FirebaseOSProps.HandOver.HandOverProps.History.HistoryLine.HistoryMore.HistoryProps.HistoryState.Holder.Input.Lightbox.LightboxPicture.LightboxProps.Loader.LoaderProps.MadeBy.MadeByProps.ManagePlanButton.MemberSchedule.MenuPage.MyPayment.MyPaymentsState.MySubscription.Navbar.NotifyInput.NumberStepper.NumberStepperProps.OrderRecord.PayButton.PaymentConfirmation.PeopleState.Person.PhoneInputField.Picture.PictureProps.Pipeline.PipelineProps.PipelineStage.PlanOnOffer.PlanPrice.PlanRhythm.Plans.PlansProps.PlansState.Popup.PopupProps.PublicMenu.PublicMenuProps.Reveal.RevealList.RevealListProps.RevealProps.SaleCharge.SaleSubscription.SalesState.SayOptions.SchedulesState.SectionHeading.SendTarget.Skeleton.Slot.SlotOptions.Sortable.SortableProps.StepBar.StepBarProps.StepInfo.StepsState.Stock.StockChange.StockFromOrdersOptions.StockOrder.StockVariant.Stocked.Swap.SwapProps.Swatch.SwatchField.SwatchFieldProps.SwatchProps.TALLY_COUNTERS.TakenTime.Tallies.TallyCounter.TallyCounts.TextArea.TextAreaProps.TimeChips.TimeWindow.UploadBox.UploadBoxProps.VideoPlayer.VideoPlayerProps.acceptBooking.auth.availableSlots.availableSlotsFor.barShares.blockedWindows.bookingPath.canEdit.canSee.cancelBooking.composeAddress.confirmPayment.countOf.dayBlocked.daysLine.db.emailAnyone.emailOwner.emailPerson.emailStatus.eventName.forPerson.forRole.hasAddress.historyCollection.holderOf.hoursSummary.isPublished.keysOf.logHistory.madeBy.meetPath.money.notify.oneEach.openBillingPortal.partySlots.payPath.publish.registerMicrocomponent.say.scheduleName.scheduleTitle.sendTo.shadeOf.shadesOf.slotsFor.startCheckout.storage.takeBack.tally.timeZoneLabel.togetherSlots.troubleSentence.unpublish.unsay.useAuth.useBasket.useBookings.useCase.useCases.useCasesFromForm.useConfig.useHistory.useMemberSchedules.useMyBookings.useMyPayments.usePaymentsEnabled.usePeople.usePlans.usePublicCopy.usePublished.useSales.useSteps.useStock.useStockFromOrders.useTakenSlots.useTallies.useTeamHours.useTheme.useVisitorState.whenWords.withAccess.withStockSetAt`.split(`.`),R=e=>{let t=e.split(``),n=[],r=``;for(let i=0;i<e.length;i++){let a=e[i];if(r){if(a===`\\`){t[i]=` `,e[i+1]!==`
116
+ `}var ve=e=>_e(ee(e)),ye=/\b(?:useAiChat|askAi|useAiEnabled|useAiModels)\b|generativelanguage\.googleapis\.com|api\.anthropic\.com|api\.openai\.com|@google\/genai|@google\/generative-ai|@anthropic-ai\/sdk|from\s+['"]openai['"]|(?:GEMINI_API_KEY|GEMINI_KEY|CLAUDE_KEY|OPENAI_KEY|ANTHROPIC_API_KEY|OPENAI_API_KEY)\b|fetch\(\s*['"`]\/api\/ai/,be=(e,t)=>`${e}: ${t.trim()} puts AI on a page, and this app has no AI for pages right now — delete it and everything that draws it, and build the rest of the page as normal. Nothing is exported under useAiChat, askAi, useAiEnabled or useAiModels, and a page never calls Gemini, Claude or OpenAI itself or holds a key: a key in a page is published to everyone who opens it. If the owner asked for AI, tell them the app does not put AI on pages yet.`,xe=e=>e.match(ye)?.[0]??null,L=`AddressField.AddressParts.AdminNotifications.ArrivingEntry.ArrivingPayment.Article.ArticleProps.Bars.BarsItem.BarsProps.Basket.BasketButton.BasketButtonProps.BasketItem.BasketLine.BasketProps.BasketState.BlockedDate.Booking.BookingsState.Button.BuyButton.BuyButtonProps.Buyer.BuyerDetails.BuyerDetailsProps.CancelInput.Card.CaseRecord.CaseState.CasesFromFormOptions.CasesState.Checkout.CheckoutExtra.CheckoutItem.CheckoutOptions.CheckoutProps.CheckoutReturn.CheckoutReturnProps.ConfirmModal.ConfirmModalProps.ContactPopup.CountLimits.CustomSelect.DashboardNav.DataTable.DataTableColumn.DataTableProps.DayKey.EMPTY_ADDRESS.EVERYONE.EmailLook.EmailOptions.EmailStatus.EventCard.FileViewer.FileViewerPopup.FileViewerPopupProps.FileViewerProps.FirebaseOS.FirebaseOSConfig.FirebaseOSProps.HandOver.HandOverProps.History.HistoryLine.HistoryMore.HistoryProps.HistoryState.Holder.Input.Lightbox.LightboxPicture.LightboxProps.Loader.LoaderProps.MadeBy.MadeByProps.ManagePlanButton.MemberSchedule.MenuPage.MyPayment.MyPaymentsState.MySubscription.Navbar.NotifyInput.NumberStepper.NumberStepperProps.OrderRecord.PayButton.PaymentConfirmation.PeopleState.Person.PhoneInputField.Picture.PictureProps.Pipeline.PipelineProps.PipelineStage.PlanOnOffer.PlanPrice.PlanRhythm.Plans.PlansProps.PlansState.Popup.PopupProps.PublicMenu.PublicMenuProps.Reveal.RevealList.RevealListProps.RevealProps.SaleCharge.SaleSubscription.SalesState.SayOptions.SchedulesState.SectionHeading.SendTarget.Skeleton.Slot.SlotOptions.Sortable.SortableProps.StepBar.StepBarProps.StepInfo.StepsState.Stock.StockChange.StockFromOrdersOptions.StockOrder.StockVariant.Stocked.Swap.SwapProps.Swatch.SwatchField.SwatchFieldProps.SwatchProps.TALLY_COUNTERS.TakenTime.Tallies.TallyCounter.TallyCounts.TextArea.TextAreaProps.TimeChips.TimeWindow.TutorialVideo.UploadBox.UploadBoxProps.VideoPlayer.VideoPlayerProps.acceptBooking.auth.availableSlots.availableSlotsFor.barShares.blockedWindows.bookingPath.canEdit.canSee.cancelBooking.composeAddress.confirmPayment.countOf.dayBlocked.daysLine.db.emailAnyone.emailOwner.emailPerson.emailStatus.eventName.forPerson.forRole.hasAddress.historyCollection.holderOf.hoursSummary.isPublished.keysOf.logHistory.madeBy.meetPath.money.notify.oneEach.openBillingPortal.partySlots.payPath.publish.registerMicrocomponent.say.scheduleName.scheduleTitle.sendTo.shadeOf.shadesOf.slotsFor.startCheckout.storage.takeBack.tally.timeZoneLabel.togetherSlots.troubleSentence.unpublish.unsay.useAuth.useBasket.useBookings.useCase.useCases.useCasesFromForm.useConfig.useHistory.useMemberSchedules.useMyBookings.useMyPayments.usePaymentsEnabled.usePeople.usePlans.usePublicCopy.usePublished.useSales.useSteps.useStock.useStockFromOrders.useTakenSlots.useTallies.useTeamHours.useTheme.useVisitorState.whenWords.withAccess.withStockSetAt`.split(`.`),R=e=>{let t=e.split(``),n=[],r=``;for(let i=0;i<e.length;i++){let a=e[i];if(r){if(a===`\\`){t[i]=` `,e[i+1]!==`
117
117
  `&&(t[i+1]=` `),i++;continue}if(a===r||a===`
118
118
  `){r=``;continue}t[i]=` `;continue}if(n.length>0&&n[n.length-1]===0){if(a===`\\`){t[i]=` `,e[i+1]!==`
119
119
  `&&(t[i+1]=` `),i++;continue}if(a==="`"){n.pop();continue}if(a===`$`&&e[i+1]===`{`){n[n.length-1]=1,i++;continue}a!==`
@@ -8,8 +8,10 @@ export declare const VIDEO_NOT_AVAILABLE = "Video not available";
8
8
  * box and no word why. A site's link may be either: its player is https.
9
9
  */
10
10
  export declare const playableTutorial: (href: string) => boolean;
11
- export declare function TutorialVideo({ open, href, onClose }: {
11
+ export declare function TutorialVideo({ open, href, onClose, autoPlay }: {
12
12
  open: boolean;
13
13
  href: string;
14
14
  onClose: () => void;
15
+ /** Start playing as the window opens, rather than on its still and a play button. */
16
+ autoPlay?: boolean;
15
17
  }): import("react/jsx-runtime").JSX.Element;
package/dist/index.d.ts CHANGED
@@ -115,6 +115,7 @@ export { Picture } from './components/media/Picture';
115
115
  export type { PictureProps } from './components/media/Picture';
116
116
  export { VideoPlayer } from './components/media/VideoPlayer';
117
117
  export type { VideoPlayerProps } from './components/media/VideoPlayer';
118
+ export { TutorialVideo } from './components/TutorialVideo';
118
119
  export { FileViewer } from './components/media/FileViewer';
119
120
  export type { FileViewerProps } from './components/media/FileViewer';
120
121
  export { FileViewerPopup } from './components/media/FileViewerPopup';
@@ -1 +1 @@
1
- require(`./chunk-CiTBaPhY.cjs`),require(`./PageTitle-DQkvCB11.cjs`);const e=require(`./TimeZoneField-Ckn1pKAL.cjs`),t=require(`./schedule-BAea6q8_.cjs`),n=require(`./chevron-down-lyDK1rfL.cjs`),r=require(`./scheduleData-BXjNXVHY.cjs`),i=require(`./BookingCalendar-BcvJiyaq.cjs`),a=require(`./EventCard-DAsGsicK.cjs`),o=require(`./chevron-left-DHTPst5Z.cjs`),s=require(`./x-Ci8c5p6T.cjs`),c=require(`./plus-zsWFCu4F.cjs`),l=require(`./trash-D-CpYHCs.cjs`),u=require(`./Button-Ccy4wFZ1.cjs`),d=require(`./bookingHold-DhS-tuuC.cjs`),f=require(`./ConfirmModal-BUNtss4a.cjs`);let p=require(`react`),m=require(`react/jsx-runtime`);var h={name:`clock-3`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]};h.node;var g=n.n(h),_={name:`paperclip`,size:24,node:[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]};_.node;var v=n.n(_),y=e=>{let t=e.replace(/_/g,` `).trim();return t.charAt(0).toUpperCase()+t.slice(1)};function b(e,t){let n=e.memberName.trim();if(e.partySize>1){let n=`${e.partyAccepted} of ${e.partySize} have accepted.`;return t?`${n} Yours is still to come.`:n}return t?`This is waiting for you to accept.`:n?`Waiting for ${n} to accept.`:`Waiting to be accepted.`}function x(e){let t=e.memberName.trim();return e.partySize>1?e.partyAccepted>0?`${e.partyAccepted} of ${e.partySize} have confirmed so far. You will hear once they all have.`:`Waiting to be confirmed. You will hear as soon as it is.`:t?`Waiting for ${t} to confirm. You will hear as soon as they do.`:`Waiting to be confirmed. You will hear as soon as it is.`}function S({open:t,onClose:n,children:r}){return(0,p.useEffect)(()=>{if(!t)return;let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t,n]),(0,m.jsx)(e.rt,{children:t&&(0,m.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center p-4`,children:[(0,m.jsx)(e.nt.div,{onClick:n,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:`absolute inset-0 bg-background/80 backdrop-blur-xl cursor-pointer`}),(0,m.jsx)(e.nt.div,{role:`dialog`,"aria-modal":`true`,initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:`w-full max-w-[420px] max-h-[85vh] overflow-y-auto styled-scrollbars-mini p-5 sm:p-6 rounded-3xl glass-popover border border-[var(--panel-border)] shadow-2xl relative z-10 text-left`,children:r})]})})}function C({color:e,title:n,line:r,cancelled:o,onClose:c}){return(0,m.jsxs)(`div`,{className:`flex items-start gap-3 mb-4`,children:[(0,m.jsx)(`span`,{"aria-hidden":!0,className:`w-1 self-stretch rounded-full shrink-0 ${o?`bg-foreground/15`:``}`,style:o?void 0:{background:t.at(e,85)}}),(0,m.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,m.jsx)(`h3`,{className:`text-[17px] font-extrabold tracking-tight leading-tight break-words ${o?`text-foreground/50 line-through`:`text-foreground`}`,children:n}),o&&(0,m.jsx)(a.t,{})]}),(0,m.jsx)(`p`,{className:`text-[12.5px] font-medium text-foreground/50 leading-snug mt-0.5`,children:r})]}),(0,m.jsx)(`button`,{type:`button`,onClick:c,"aria-label":`Close`,className:i.t,children:(0,m.jsx)(s.t,{className:`w-4 h-4`})})]})}function w({label:e,children:t}){return(0,m.jsxs)(`div`,{className:`flex items-start justify-between gap-3 px-3.5 py-2.5`,children:[(0,m.jsx)(`span`,{className:`text-[12px] font-medium text-foreground/45 shrink-0`,children:e}),(0,m.jsx)(`span`,{className:`text-[12.5px] font-semibold text-foreground/80 text-right break-words min-w-0`,children:t})]})}function T({booking:n,zone:r,chip:i,me:o=``,side:s=`host`,onClose:c,onColor:d,onAccept:h,onCancel:_,onDelete:T,onRelease:D}){let[O,k]=(0,p.useState)(!1),[A,j]=(0,p.useState)(!1),[M,N]=(0,p.useState)(``),[P,F]=(0,p.useState)(!1),[I,L]=(0,p.useState)(``),R=t.Zt(n,r),z=n.end<new Date().toISOString(),B=!n.own&&n.timeZone&&n.timeZone!==r?n.timeZone:``,V=Object.entries(n.answers).filter(([,e])=>e),H=s===`booker`,U=!n.heldOnly&&(V.length>0||!!B||!!i||!H&&!n.own&&(!!n.scheduleName||!!n.email||n.createdAt>0)),W=n.heldOnly,G=!W&&(n.own||n.cancelled||z),K=!H&&!!o&&n.memberId===o,q=a.s(n),J=!!q&&K&&!!h,Y=W?`Free this held time`:n.own?`Delete this event`:n.cancelled?`Remove this cancelled booking`:z?`Remove this booking`:q&&K?`Decline this booking`:`Cancel this booking`,X=W?!!D:G&&!!T,Z=!G&&!W,Q=!!q&&K&&!G;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(S,{open:!0,onClose:c,children:[(0,m.jsx)(C,{color:n.color,title:a.o(n,s),line:`${R.day} · ${R.time}`,cancelled:n.cancelled,onClose:c}),n.cancelled&&(0,m.jsxs)(`div`,{className:`mb-4 px-3.5 py-2.5 rounded-2xl border border-[var(--panel-border)] bg-foreground/[0.03] flex flex-col gap-1.5`,children:[(0,m.jsxs)(`p`,{className:`text-[12.5px] font-medium text-foreground/70 leading-snug`,children:[E(n),` The time is free again — it stays here so you have the record.`]}),!!n.cancelReason&&(0,m.jsxs)(`p`,{className:`text-[12.5px] font-semibold text-foreground/80 leading-snug border-l-2 border-[var(--panel-border)] pl-2.5`,children:[`“`,n.cancelReason,`”`]})]}),!!q&&(0,m.jsxs)(`div`,{className:`mb-4 px-3.5 py-3 rounded-2xl border border-amber-500/25 bg-amber-500/[0.07] flex flex-col gap-2.5`,children:[(0,m.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,m.jsx)(g,{className:`w-4 h-4 shrink-0 mt-[1px] text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,m.jsx)(`p`,{className:`text-[12.5px] font-semibold text-foreground/75 leading-snug flex-1 min-w-0`,children:H?x(n):b(n,K)}),n.partySize>1&&(0,m.jsx)(a.i,{label:q})]}),J&&!A&&(0,m.jsxs)(u.t,{onClick:async()=>{F(!0),L(``);let e=await h();F(!1),e&&L(e)},isLoading:P,className:`py-2 px-4 text-[13px] font-bold rounded-xl self-start`,children:[(0,m.jsx)(e.At,{className:`w-3.5 h-3.5 shrink-0`,"aria-hidden":!0}),`Accept`]})]}),W&&(0,m.jsx)(`p`,{className:`mb-4 px-3.5 py-2.5 rounded-2xl border border-[var(--panel-border)] bg-foreground/[0.03] text-[12.5px] font-medium text-foreground/70 leading-snug`,children:`This hour is held with no booking behind it — a booking that was started and never finished. Nobody can take the time until it is freed, and there is nothing here to cancel.`}),U&&(0,m.jsxs)(`div`,{className:`rounded-2xl border border-[var(--panel-border)]/60 bg-foreground/[0.015] divide-y divide-[var(--panel-border)]/40`,children:[!H&&!n.own&&n.scheduleName&&(0,m.jsx)(w,{label:`Meeting`,children:n.scheduleName}),!H&&n.email&&(0,m.jsx)(w,{label:`Email`,children:(0,m.jsx)(`a`,{href:`mailto:${n.email}`,className:`text-accent hover:underline break-all`,children:n.email})}),V.map(([t,n])=>(0,m.jsx)(w,{label:t===`note`?`Note`:y(t),children:e.I(n)?(0,m.jsx)(`span`,{className:`flex flex-col items-end gap-1 min-w-0`,children:e.P(n).map(t=>(0,m.jsxs)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,title:e.N(t),className:`inline-flex items-center gap-1.5 max-w-full min-w-0 text-accent hover:underline`,children:[(0,m.jsx)(v,{className:`w-3.5 h-3.5 shrink-0`}),(0,m.jsx)(`span`,{className:`truncate min-w-0`,children:e.N(t)})]},t))}):n},t)),B&&(0,m.jsxs)(w,{label:H?`The time you booked in`:`Their time`,children:[t.st(new Date(n.start),B),` — `,t.nn(B)]}),i&&(0,m.jsx)(w,{label:`Payment`,children:(0,m.jsx)(e._,{state:i.state,label:i.label})}),!H&&!n.own&&n.createdAt>0&&(0,m.jsx)(w,{label:`Booked`,children:new Intl.DateTimeFormat(void 0,{dateStyle:`medium`}).format(new Date(n.createdAt))})]}),!n.cancelled&&!W&&!!d&&(0,m.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2`,children:[(0,m.jsx)(`span`,{className:`text-[12.5px] sm:text-[13px] font-medium text-foreground/50 select-none ml-1`,children:`Colour`}),(0,m.jsx)(a.n,{value:n.color,onChange:async e=>{L(``);let t=await d(e);t&&L(t)}}),(0,m.jsx)(`p`,{className:`text-[11px] font-medium text-foreground/40 leading-snug ml-1 mt-0.5`,children:`Shown on the calendar and in the day beside it.`})]}),A&&(0,m.jsxs)(`div`,{className:`mt-4 flex flex-col gap-3 p-3.5 rounded-2xl border border-[var(--panel-border)] bg-foreground/[0.02]`,children:[(0,m.jsx)(e.y,{label:Q?`Why are you turning it down?`:H?`Why can you not make it?`:`Why are you cancelling?`,value:M,onChange:N,placeholder:H?`Something has come up — I would like to book another time.`:`Something has come up and I cannot make this time — do book another.`,hint:H?`${n.memberName.trim()||`Whoever you booked with`} will see this.`:`${n.name.trim()||`Whoever booked`} will see this on the meeting.`}),(0,m.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,m.jsx)(u.t,{variant:`secondary`,onClick:()=>{j(!1),L(``)},disabled:P,className:`flex-1 py-2.5 text-[13px] font-bold rounded-xl`,children:`Keep it`}),(0,m.jsx)(u.t,{onClick:async()=>{F(!0),L(``);let e=await _(M.trim());if(F(!1),e){L(e);return}j(!1),c()},isLoading:P,disabled:!M.trim(),className:`flex-1 py-2.5 text-[13px] font-bold rounded-xl bg-red-500 hover:bg-red-600 border-none text-white shadow-lg hover:shadow-red-500/20 disabled:opacity-40 disabled:hover:bg-red-500 disabled:hover:shadow-none`,children:Q?`Decline it`:`Cancel it`})]})]}),!A&&!Z&&!X&&!H&&!W&&(0,m.jsx)(`p`,{className:`text-[11px] sm:text-[11.5px] text-foreground/40 font-medium leading-snug mt-4 ml-1`,children:`Nothing left to do here — only an admin can take a booking off the calendar for good.`}),!!I&&(0,m.jsx)(`p`,{className:`text-[12px] font-semibold text-red-500 mt-3 ml-1`,children:I}),!A&&(0,m.jsxs)(`div`,{className:`mt-5 flex items-center gap-3 ${X||Z?`justify-between`:`justify-end`}`,children:[(X||Z)&&(0,m.jsx)(e.o,{icon:X?l.t:a.c,tone:`danger`,title:Y,onClick:()=>X?k(!0):j(!0),children:W?`Free the time`:n.own?`Delete`:X?`Remove`:Q?`Decline`:`Cancel booking`}),(0,m.jsx)(u.t,{variant:`secondary`,onClick:c,className:`py-2 px-4 text-[13px] font-bold rounded-xl`,children:`Close`})]})]}),(0,m.jsx)(f.t,{isOpen:O,title:`${Y}?`,message:W?`The hour goes back on offer. There is no booking behind it, so nothing else is lost.`:n.own?`It leaves your calendar and the time can be booked again.`:`It goes from the calendar for good, with everything it holds — in every diary it was booked into. This cannot be undone.`,confirmText:W?`Yes, free it`:n.own?`Yes, delete`:`Yes, remove`,cancelText:`Keep it`,isProcessing:P,onCancel:()=>k(!1),onConfirm:async()=>{F(!0);let e=await(W?D?.()??null:T?.()??null);F(!1),k(!1),e?L(e):c()}})]})}function E(e){let t=e.cancelledAt>0?` on ${new Intl.DateTimeFormat(void 0,{dateStyle:`medium`}).format(new Date(e.cancelledAt))}`:``,n=e.cancelledBy.trim();return e.cancelledSide===`booker`?`${n||`The person who booked`} cancelled this${t}.`:e.cancelledSide===`host`?`${n||`Your team`} cancelled this${t}.`:`This booking was cancelled${t}.`}var D=(e,n,r,i)=>({title:``,time:e===i?t.Tt(r,n):`09:00`,minutes:`60`,color:``,note:``});function O({dateKey:n,dayLabel:r,zone:i,today:o,now:s,onClose:c,onAdd:l}){let[d,f]=(0,p.useState)(()=>D(n,i,s?s():new Date,o)),[h,g]=(0,p.useState)(!1),[_,v]=(0,p.useState)(``),y=e=>f(t=>({...t,...e}));return(0,m.jsxs)(S,{open:!0,onClose:c,children:[(0,m.jsx)(C,{color:d.color,title:d.title.trim()||`Add an event`,line:`${r} · your time, ${t.nn(i)}`,onClose:c}),(0,m.jsxs)(`div`,{className:`flex flex-col gap-3.5`,children:[(0,m.jsx)(e.b,{label:`What is it?`,value:d.title,onChange:e=>y({title:e}),placeholder:`Lunch with Sam`,hint:`Leave it empty and the time simply shows as busy.`}),(0,m.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,m.jsx)(e.g,{label:`Starts at`,value:d.time,onChange:e=>y({time:e}),options:t.v,allowEmpty:!1}),(0,m.jsx)(e.g,{label:`Lasts`,value:d.minutes,onChange:e=>y({minutes:e}),options:t.p,allowEmpty:!1})]}),(0,m.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,m.jsx)(`span`,{className:`${e.u} ml-1`,children:`Colour`}),(0,m.jsx)(a.n,{value:d.color,onChange:e=>y({color:e})})]}),(0,m.jsx)(e.y,{label:`Note`,value:d.note,onChange:e=>y({note:e}),placeholder:`Anything to remember`})]}),(0,m.jsx)(`p`,{className:`text-[11.5px] font-medium text-foreground/40 leading-snug mt-3 ml-1`,children:`Nobody can book this time once it is here.`}),!!_&&(0,m.jsx)(`p`,{className:`text-[12px] font-semibold text-red-500 mt-3 ml-1`,children:_}),(0,m.jsxs)(`div`,{className:`mt-5 flex items-center gap-3`,children:[(0,m.jsx)(u.t,{variant:`secondary`,onClick:c,disabled:h,className:`flex-1 py-2.5 text-[13px] font-bold rounded-xl`,children:`Cancel`}),(0,m.jsx)(u.t,{onClick:async()=>{g(!0),v(``);let e=t.ln(n,d.time,i),r=new Date(e.getTime()+Number(d.minutes)*6e4),a=await l({title:d.title.trim(),start:e.toISOString(),end:r.toISOString(),color:d.color,note:d.note.trim()});g(!1),a?v(a):c()},isLoading:h,className:`flex-1 py-2.5 text-[13px] font-bold rounded-xl`,children:`Add it`})]})]})}var k=(e,t)=>new Intl.DateTimeFormat(t,{timeZone:`UTC`,weekday:`short`,day:`numeric`,month:`long`}).format(new Date(`${e}T00:00:00Z`)),A=[`M`,`T`,`W`,`T`,`F`,`S`,`S`],j=e=>e.slice(0,7),M=(e,n,r)=>t.st(e,n,r).replace(/[\s\u00a0\u202f]+/g,``).toLowerCase();function N(e,t=3){return e.length<=t?{shown:e,extra:0}:{shown:e.slice(0,t-1),extra:e.length-(t-1)}}var P=(e,t,n=`host`)=>n===`booker`?a.o(e,n):t&&e.memberName?`${a.a(e)} · ${e.memberName}`:a.a(e);function F(e,n){let r=new Map;for(let i of e){let e=t.cn(new Date(i.start),n).dateKey,a=r.get(e)||[];a.push(i),r.set(e,a)}for(let e of r.values())e.sort((e,t)=>e.start.localeCompare(t.start));return r}function I(e,t,n=!0){return!n||!e.paymentId&&!e.paymentSession?null:e.paymentSession?t===void 0?{state:`saving`,label:`Checking payment`}:t?{state:`saved`,label:`Paid`}:{state:`off`,label:`Awaiting payment`}:{state:`off`,label:`Not paid`}}var L=`h-8 px-3 rounded-xl border border-[var(--panel-border)]/60 inline-flex items-center gap-1.5 text-[12.5px] font-semibold text-foreground/60 hover:text-foreground hover:border-accent/40 hover:bg-foreground/5 active:scale-[0.98] transition-all cursor-pointer`;function R({bookings:n,zone:r,paid:s,openBookingId:l,onOpened:u,withMember:d=!1,me:f=``,side:h=`host`,onAccept:g,onCancel:_,onDelete:v,canDelete:y,onColor:b,onRelease:x,onAdd:S,now:C}){let w=t.cn(C?C():new Date,r).dateKey,E=(0,p.useMemo)(()=>F(n,r),[n,r]),[D,R]=(0,p.useState)(j(w)),[z,B]=(0,p.useState)(w),[V,H]=(0,p.useState)(null),[U,W]=(0,p.useState)(!1),G=(0,p.useRef)(``);(0,p.useEffect)(()=>{if(!l){G.current=``;return}if(G.current===l)return;let e=n.find(e=>e.id===l);if(!e)return;G.current=l;let i=t.cn(new Date(e.start),r).dateKey;R(j(i)),B(i),H(e.id),u?.()},[l,n,r,u]);let K=i.o(D),q=E.get(z)||[],J=(C?C():new Date).toISOString(),Y=k(z),X=V?n.find(e=>e.id===V):void 0,{ref:Z,moreBelow:Q}=i.s(q.length,z);return(0,m.jsxs)(`div`,{className:`flex flex-col md:flex-row gap-3 md:gap-4 w-full md:items-stretch`,children:[(0,m.jsxs)(`div`,{className:`${i.r} w-full md:flex-1 min-w-0`,children:[(0,m.jsxs)(`div`,{className:i.i,children:[(0,m.jsx)(`h4`,{className:`text-[14px] font-bold text-foreground tracking-tight truncate`,children:t.wt(D)}),(0,m.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,m.jsx)(`button`,{type:`button`,onClick:()=>{R(j(w)),B(w)},className:L,children:`Today`}),(0,m.jsx)(`button`,{type:`button`,"aria-label":`Previous month`,onClick:()=>R(e=>t.Kt(e,-1)),className:i.t,children:(0,m.jsx)(o.t,{className:`w-4 h-4`})}),(0,m.jsx)(`button`,{type:`button`,"aria-label":`Next month`,onClick:()=>R(e=>t.Kt(e,1)),className:i.t,children:(0,m.jsx)(e.kt,{className:`w-4 h-4`})})]})]}),(0,m.jsx)(`div`,{className:`p-2 sm:p-3`,children:(0,m.jsxs)(`div`,{className:`grid grid-cols-7 gap-1`,role:`grid`,"aria-label":t.wt(D),children:[A.map((e,t)=>(0,m.jsx)(`div`,{className:`text-center text-[10.5px] font-bold uppercase tracking-wider text-foreground/35 pb-1`,children:e},t)),K.map((e,n)=>{if(!e)return(0,m.jsx)(`div`,{"aria-hidden":!0},`blank-${n}`);let i=E.get(e)||[],{shown:a,extra:o}=N(i),s=e===z,c=e===w;return(0,m.jsxs)(`button`,{type:`button`,role:`gridcell`,"aria-label":`${e}${i.length?`, ${i.length} booked`:``}`,"aria-selected":s,onClick:()=>B(e),className:`relative flex flex-col items-center sm:items-stretch justify-center sm:justify-start h-10 sm:h-[86px] rounded-xl sm:p-1 text-left transition-all cursor-pointer border ${s?`border-accent/70 bg-accent/[0.08] shadow-sm shadow-accent/10`:i.length?`border-transparent hover:bg-foreground/[0.05] hover:border-[var(--panel-border)]/60`:`border-transparent hover:bg-foreground/[0.03]`} ${c&&!s?`ring-1 ring-inset ring-accent/45`:``}`,children:[(0,m.jsx)(`span`,{className:`text-[13px] tabular-nums leading-none sm:px-1 sm:pt-0.5 sm:pb-1 ${s||c?`font-bold text-accent`:i.length?`font-bold text-foreground`:`font-semibold text-foreground/35`}`,children:Number(e.slice(8,10))}),(0,m.jsxs)(`span`,{"aria-hidden":!0,className:`max-sm:hidden sm:flex flex-col gap-[2px] w-full min-w-0`,children:[a.map(e=>(0,m.jsxs)(`span`,{className:`flex items-center gap-1 min-w-0 rounded-md pr-1 py-[2px] leading-[1.2] overflow-hidden ${e.end<J&&!e.cancelled?`opacity-50`:``} ${e.cancelled?`bg-foreground/[0.04] line-through`:``}`,style:e.cancelled?void 0:{background:t.at(e.color,12)},children:[(0,m.jsx)(`span`,{className:`w-[3px] self-stretch rounded-full shrink-0 ${e.cancelled?`bg-foreground/15`:``}`,style:e.cancelled?void 0:{background:t.at(e.color,85)}}),(0,m.jsx)(`span`,{className:`text-[9.5px] font-bold tabular-nums shrink-0 ${e.cancelled?`text-foreground/40`:`text-foreground/85`}`,children:M(new Date(e.start),r)}),(0,m.jsx)(`span`,{className:`text-[9.5px] font-medium truncate ${e.cancelled?`text-foreground/40`:`text-foreground/60`}`,children:P(e,d,h)})]},e.id)),o>0&&(0,m.jsxs)(`span`,{className:`px-1 text-[9.5px] font-bold text-foreground/45 leading-[1.2]`,children:[`+`,o,` more`]})]})]},e)})]})})]}),(0,m.jsx)(`div`,{className:`w-full md:w-[320px] shrink-0 md:relative md:min-h-[360px]`,children:(0,m.jsxs)(`div`,{className:`${i.r} flex flex-col md:absolute md:inset-0`,children:[(0,m.jsxs)(`div`,{className:i.i,children:[(0,m.jsx)(`p`,{className:`text-[13px] font-bold text-foreground tracking-tight truncate`,children:Y}),(0,m.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[q.length>0&&(0,m.jsxs)(`span`,{className:`text-[11.5px] font-semibold text-foreground/40 tabular-nums max-sm:hidden`,children:[q.length,` `,q.length===1?`event`:`events`]}),S&&(0,m.jsxs)(`button`,{type:`button`,onClick:()=>W(!0),title:`Add an event on ${Y}`,className:L,children:[(0,m.jsx)(c.t,{className:`w-3.5 h-3.5 shrink-0`}),`Add`]})]})]}),(0,m.jsxs)(`div`,{className:`relative flex-1 min-h-0`,children:[(0,m.jsx)(`div`,{ref:Z,className:`p-3 h-full overflow-y-auto styled-scrollbars-mini flex flex-col gap-2`,children:q.length===0?(0,m.jsxs)(`div`,{className:`flex flex-col items-center justify-center text-center gap-2 py-8 px-2`,children:[(0,m.jsx)(i.d,{className:`w-5 h-5 text-foreground/25`,"aria-hidden":!0}),(0,m.jsx)(`p`,{className:`text-[12.5px] font-medium text-foreground/45 leading-relaxed`,children:`Nothing on this day yet.`})]}):q.map(e=>(0,m.jsx)(a.r,{booking:e,zone:r,now:C,chip:I(e,s?.[e.id],!!s),withMember:d,side:h,onOpen:()=>H(e.id)},e.id))}),Q&&(0,m.jsx)(i.a,{})]})]})}),X&&(0,m.jsx)(T,{booking:X,zone:r,chip:I(X,s?.[X.id],!!s),onClose:()=>H(null),me:f,side:h,onColor:b?e=>b(X.id,e):void 0,onAccept:g?()=>g(X):void 0,onCancel:e=>_(X,e),onDelete:v&&(!y||y(X))?()=>v(X):void 0,onRelease:x?()=>x(X):void 0}),U&&S&&(0,m.jsx)(O,{dateKey:z,dayLabel:Y,zone:r,today:w,now:C,onClose:()=>W(!1),onAdd:S})]})}var z=new Map,B=3,V=60*1e3;function H(t){let[n,i]=(0,p.useState)({}),a=(0,p.useRef)(new Set),o=(0,p.useRef)([]),s=(0,p.useRef)(0),c=(0,p.useRef)(!0),l=(0,p.useRef)(new Map),u=(0,p.useRef)(new Set),f=(e,t,n)=>{u.current.add(e),r.s(t,`paid`).then(({refused:r})=>{if(!r.length){l.current.delete(e),z.set(e,n);return}l.current.set(e,{passes:Object.fromEntries(r.map(e=>[e,t[e]])),forBookings:n})}).finally(()=>u.current.delete(e))},m=()=>{for(let[e,{passes:t,forBookings:n}]of l.current)u.current.has(e)||f(e,t,n)};return(0,p.useEffect)(()=>{c.current=!0;let e=setInterval(m,V);return()=>{c.current=!1,clearInterval(e)}},[]),(0,p.useEffect)(()=>{m();let n=()=>{for(;s.current<B&&o.current.length;){let t=o.current.shift();s.current+=1,e.An(t,{quiet:!0}).then(e=>{let n=[...new Set([...d.s(e.metadata),String(e.metadata?.bookingId||``)].filter(Boolean))],r=e.holdPasses||{};Object.keys(r).length?f(t,r,n):e.paid&&z.set(t,n),c.current&&i(r=>({...r,[t]:{paid:e.paid,forBookings:n,status:e.status??null}}))}).catch(()=>{}).finally(()=>{--s.current,c.current&&n()})}};for(let e of t){let t=e.paymentSession;!t||z.has(t)||a.current.has(t)||(a.current.add(t),o.current.push(t))}n()},[t]),(0,p.useMemo)(()=>{let e={},r={};for(let i of t){let t=i.paymentSession;if(!t)continue;let a=z.has(t)?{paid:!0,forBookings:z.get(t),status:`complete`}:n[t];if(!a)continue;let o=new Set([i.id,...i.copyIds||[]]);e[i.id]=a.paid&&a.forBookings.some(e=>o.has(e)),r[i.id]={paid:e[i.id],status:a.status}}return{paid:e,checkouts:r}},[n,t])}Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return H}});
1
+ require(`./chunk-CiTBaPhY.cjs`),require(`./PageTitle-BL50s4qY.cjs`);const e=require(`./TimeZoneField-Ckn1pKAL.cjs`),t=require(`./schedule-BAea6q8_.cjs`),n=require(`./chevron-down-lyDK1rfL.cjs`),r=require(`./scheduleData-BXjNXVHY.cjs`),i=require(`./BookingCalendar-BcvJiyaq.cjs`),a=require(`./EventCard-D57elnQo.cjs`),o=require(`./chevron-left-DHTPst5Z.cjs`),s=require(`./x-Ci8c5p6T.cjs`),c=require(`./plus-zsWFCu4F.cjs`),l=require(`./trash-D-CpYHCs.cjs`),u=require(`./Button-Ccy4wFZ1.cjs`),d=require(`./bookingHold-DhS-tuuC.cjs`),f=require(`./ConfirmModal-BUNtss4a.cjs`);let p=require(`react`),m=require(`react/jsx-runtime`);var h={name:`clock-3`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]};h.node;var g=n.n(h),_={name:`paperclip`,size:24,node:[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]};_.node;var v=n.n(_),y=e=>{let t=e.replace(/_/g,` `).trim();return t.charAt(0).toUpperCase()+t.slice(1)};function b(e,t){let n=e.memberName.trim();if(e.partySize>1){let n=`${e.partyAccepted} of ${e.partySize} have accepted.`;return t?`${n} Yours is still to come.`:n}return t?`This is waiting for you to accept.`:n?`Waiting for ${n} to accept.`:`Waiting to be accepted.`}function x(e){let t=e.memberName.trim();return e.partySize>1?e.partyAccepted>0?`${e.partyAccepted} of ${e.partySize} have confirmed so far. You will hear once they all have.`:`Waiting to be confirmed. You will hear as soon as it is.`:t?`Waiting for ${t} to confirm. You will hear as soon as they do.`:`Waiting to be confirmed. You will hear as soon as it is.`}function S({open:t,onClose:n,children:r}){return(0,p.useEffect)(()=>{if(!t)return;let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t,n]),(0,m.jsx)(e.rt,{children:t&&(0,m.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center p-4`,children:[(0,m.jsx)(e.nt.div,{onClick:n,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:`absolute inset-0 bg-background/80 backdrop-blur-xl cursor-pointer`}),(0,m.jsx)(e.nt.div,{role:`dialog`,"aria-modal":`true`,initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:`w-full max-w-[420px] max-h-[85vh] overflow-y-auto styled-scrollbars-mini p-5 sm:p-6 rounded-3xl glass-popover border border-[var(--panel-border)] shadow-2xl relative z-10 text-left`,children:r})]})})}function C({color:e,title:n,line:r,cancelled:o,onClose:c}){return(0,m.jsxs)(`div`,{className:`flex items-start gap-3 mb-4`,children:[(0,m.jsx)(`span`,{"aria-hidden":!0,className:`w-1 self-stretch rounded-full shrink-0 ${o?`bg-foreground/15`:``}`,style:o?void 0:{background:t.at(e,85)}}),(0,m.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,m.jsx)(`h3`,{className:`text-[17px] font-extrabold tracking-tight leading-tight break-words ${o?`text-foreground/50 line-through`:`text-foreground`}`,children:n}),o&&(0,m.jsx)(a.t,{})]}),(0,m.jsx)(`p`,{className:`text-[12.5px] font-medium text-foreground/50 leading-snug mt-0.5`,children:r})]}),(0,m.jsx)(`button`,{type:`button`,onClick:c,"aria-label":`Close`,className:i.t,children:(0,m.jsx)(s.t,{className:`w-4 h-4`})})]})}function w({label:e,children:t}){return(0,m.jsxs)(`div`,{className:`flex items-start justify-between gap-3 px-3.5 py-2.5`,children:[(0,m.jsx)(`span`,{className:`text-[12px] font-medium text-foreground/45 shrink-0`,children:e}),(0,m.jsx)(`span`,{className:`text-[12.5px] font-semibold text-foreground/80 text-right break-words min-w-0`,children:t})]})}function T({booking:n,zone:r,chip:i,me:o=``,side:s=`host`,onClose:c,onColor:d,onAccept:h,onCancel:_,onDelete:T,onRelease:D}){let[O,k]=(0,p.useState)(!1),[A,j]=(0,p.useState)(!1),[M,N]=(0,p.useState)(``),[P,F]=(0,p.useState)(!1),[I,L]=(0,p.useState)(``),R=t.Zt(n,r),z=n.end<new Date().toISOString(),B=!n.own&&n.timeZone&&n.timeZone!==r?n.timeZone:``,V=Object.entries(n.answers).filter(([,e])=>e),H=s===`booker`,U=!n.heldOnly&&(V.length>0||!!B||!!i||!H&&!n.own&&(!!n.scheduleName||!!n.email||n.createdAt>0)),W=n.heldOnly,G=!W&&(n.own||n.cancelled||z),K=!H&&!!o&&n.memberId===o,q=a.s(n),J=!!q&&K&&!!h,Y=W?`Free this held time`:n.own?`Delete this event`:n.cancelled?`Remove this cancelled booking`:z?`Remove this booking`:q&&K?`Decline this booking`:`Cancel this booking`,X=W?!!D:G&&!!T,Z=!G&&!W,Q=!!q&&K&&!G;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(S,{open:!0,onClose:c,children:[(0,m.jsx)(C,{color:n.color,title:a.o(n,s),line:`${R.day} · ${R.time}`,cancelled:n.cancelled,onClose:c}),n.cancelled&&(0,m.jsxs)(`div`,{className:`mb-4 px-3.5 py-2.5 rounded-2xl border border-[var(--panel-border)] bg-foreground/[0.03] flex flex-col gap-1.5`,children:[(0,m.jsxs)(`p`,{className:`text-[12.5px] font-medium text-foreground/70 leading-snug`,children:[E(n),` The time is free again — it stays here so you have the record.`]}),!!n.cancelReason&&(0,m.jsxs)(`p`,{className:`text-[12.5px] font-semibold text-foreground/80 leading-snug border-l-2 border-[var(--panel-border)] pl-2.5`,children:[`“`,n.cancelReason,`”`]})]}),!!q&&(0,m.jsxs)(`div`,{className:`mb-4 px-3.5 py-3 rounded-2xl border border-amber-500/25 bg-amber-500/[0.07] flex flex-col gap-2.5`,children:[(0,m.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,m.jsx)(g,{className:`w-4 h-4 shrink-0 mt-[1px] text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,m.jsx)(`p`,{className:`text-[12.5px] font-semibold text-foreground/75 leading-snug flex-1 min-w-0`,children:H?x(n):b(n,K)}),n.partySize>1&&(0,m.jsx)(a.i,{label:q})]}),J&&!A&&(0,m.jsxs)(u.t,{onClick:async()=>{F(!0),L(``);let e=await h();F(!1),e&&L(e)},isLoading:P,className:`py-2 px-4 text-[13px] font-bold rounded-xl self-start`,children:[(0,m.jsx)(e.At,{className:`w-3.5 h-3.5 shrink-0`,"aria-hidden":!0}),`Accept`]})]}),W&&(0,m.jsx)(`p`,{className:`mb-4 px-3.5 py-2.5 rounded-2xl border border-[var(--panel-border)] bg-foreground/[0.03] text-[12.5px] font-medium text-foreground/70 leading-snug`,children:`This hour is held with no booking behind it — a booking that was started and never finished. Nobody can take the time until it is freed, and there is nothing here to cancel.`}),U&&(0,m.jsxs)(`div`,{className:`rounded-2xl border border-[var(--panel-border)]/60 bg-foreground/[0.015] divide-y divide-[var(--panel-border)]/40`,children:[!H&&!n.own&&n.scheduleName&&(0,m.jsx)(w,{label:`Meeting`,children:n.scheduleName}),!H&&n.email&&(0,m.jsx)(w,{label:`Email`,children:(0,m.jsx)(`a`,{href:`mailto:${n.email}`,className:`text-accent hover:underline break-all`,children:n.email})}),V.map(([t,n])=>(0,m.jsx)(w,{label:t===`note`?`Note`:y(t),children:e.I(n)?(0,m.jsx)(`span`,{className:`flex flex-col items-end gap-1 min-w-0`,children:e.P(n).map(t=>(0,m.jsxs)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,title:e.N(t),className:`inline-flex items-center gap-1.5 max-w-full min-w-0 text-accent hover:underline`,children:[(0,m.jsx)(v,{className:`w-3.5 h-3.5 shrink-0`}),(0,m.jsx)(`span`,{className:`truncate min-w-0`,children:e.N(t)})]},t))}):n},t)),B&&(0,m.jsxs)(w,{label:H?`The time you booked in`:`Their time`,children:[t.st(new Date(n.start),B),` — `,t.nn(B)]}),i&&(0,m.jsx)(w,{label:`Payment`,children:(0,m.jsx)(e._,{state:i.state,label:i.label})}),!H&&!n.own&&n.createdAt>0&&(0,m.jsx)(w,{label:`Booked`,children:new Intl.DateTimeFormat(void 0,{dateStyle:`medium`}).format(new Date(n.createdAt))})]}),!n.cancelled&&!W&&!!d&&(0,m.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2`,children:[(0,m.jsx)(`span`,{className:`text-[12.5px] sm:text-[13px] font-medium text-foreground/50 select-none ml-1`,children:`Colour`}),(0,m.jsx)(a.n,{value:n.color,onChange:async e=>{L(``);let t=await d(e);t&&L(t)}}),(0,m.jsx)(`p`,{className:`text-[11px] font-medium text-foreground/40 leading-snug ml-1 mt-0.5`,children:`Shown on the calendar and in the day beside it.`})]}),A&&(0,m.jsxs)(`div`,{className:`mt-4 flex flex-col gap-3 p-3.5 rounded-2xl border border-[var(--panel-border)] bg-foreground/[0.02]`,children:[(0,m.jsx)(e.y,{label:Q?`Why are you turning it down?`:H?`Why can you not make it?`:`Why are you cancelling?`,value:M,onChange:N,placeholder:H?`Something has come up — I would like to book another time.`:`Something has come up and I cannot make this time — do book another.`,hint:H?`${n.memberName.trim()||`Whoever you booked with`} will see this.`:`${n.name.trim()||`Whoever booked`} will see this on the meeting.`}),(0,m.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,m.jsx)(u.t,{variant:`secondary`,onClick:()=>{j(!1),L(``)},disabled:P,className:`flex-1 py-2.5 text-[13px] font-bold rounded-xl`,children:`Keep it`}),(0,m.jsx)(u.t,{onClick:async()=>{F(!0),L(``);let e=await _(M.trim());if(F(!1),e){L(e);return}j(!1),c()},isLoading:P,disabled:!M.trim(),className:`flex-1 py-2.5 text-[13px] font-bold rounded-xl bg-red-500 hover:bg-red-600 border-none text-white shadow-lg hover:shadow-red-500/20 disabled:opacity-40 disabled:hover:bg-red-500 disabled:hover:shadow-none`,children:Q?`Decline it`:`Cancel it`})]})]}),!A&&!Z&&!X&&!H&&!W&&(0,m.jsx)(`p`,{className:`text-[11px] sm:text-[11.5px] text-foreground/40 font-medium leading-snug mt-4 ml-1`,children:`Nothing left to do here — only an admin can take a booking off the calendar for good.`}),!!I&&(0,m.jsx)(`p`,{className:`text-[12px] font-semibold text-red-500 mt-3 ml-1`,children:I}),!A&&(0,m.jsxs)(`div`,{className:`mt-5 flex items-center gap-3 ${X||Z?`justify-between`:`justify-end`}`,children:[(X||Z)&&(0,m.jsx)(e.o,{icon:X?l.t:a.c,tone:`danger`,title:Y,onClick:()=>X?k(!0):j(!0),children:W?`Free the time`:n.own?`Delete`:X?`Remove`:Q?`Decline`:`Cancel booking`}),(0,m.jsx)(u.t,{variant:`secondary`,onClick:c,className:`py-2 px-4 text-[13px] font-bold rounded-xl`,children:`Close`})]})]}),(0,m.jsx)(f.t,{isOpen:O,title:`${Y}?`,message:W?`The hour goes back on offer. There is no booking behind it, so nothing else is lost.`:n.own?`It leaves your calendar and the time can be booked again.`:`It goes from the calendar for good, with everything it holds — in every diary it was booked into. This cannot be undone.`,confirmText:W?`Yes, free it`:n.own?`Yes, delete`:`Yes, remove`,cancelText:`Keep it`,isProcessing:P,onCancel:()=>k(!1),onConfirm:async()=>{F(!0);let e=await(W?D?.()??null:T?.()??null);F(!1),k(!1),e?L(e):c()}})]})}function E(e){let t=e.cancelledAt>0?` on ${new Intl.DateTimeFormat(void 0,{dateStyle:`medium`}).format(new Date(e.cancelledAt))}`:``,n=e.cancelledBy.trim();return e.cancelledSide===`booker`?`${n||`The person who booked`} cancelled this${t}.`:e.cancelledSide===`host`?`${n||`Your team`} cancelled this${t}.`:`This booking was cancelled${t}.`}var D=(e,n,r,i)=>({title:``,time:e===i?t.Tt(r,n):`09:00`,minutes:`60`,color:``,note:``});function O({dateKey:n,dayLabel:r,zone:i,today:o,now:s,onClose:c,onAdd:l}){let[d,f]=(0,p.useState)(()=>D(n,i,s?s():new Date,o)),[h,g]=(0,p.useState)(!1),[_,v]=(0,p.useState)(``),y=e=>f(t=>({...t,...e}));return(0,m.jsxs)(S,{open:!0,onClose:c,children:[(0,m.jsx)(C,{color:d.color,title:d.title.trim()||`Add an event`,line:`${r} · your time, ${t.nn(i)}`,onClose:c}),(0,m.jsxs)(`div`,{className:`flex flex-col gap-3.5`,children:[(0,m.jsx)(e.b,{label:`What is it?`,value:d.title,onChange:e=>y({title:e}),placeholder:`Lunch with Sam`,hint:`Leave it empty and the time simply shows as busy.`}),(0,m.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,m.jsx)(e.g,{label:`Starts at`,value:d.time,onChange:e=>y({time:e}),options:t.v,allowEmpty:!1}),(0,m.jsx)(e.g,{label:`Lasts`,value:d.minutes,onChange:e=>y({minutes:e}),options:t.p,allowEmpty:!1})]}),(0,m.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,m.jsx)(`span`,{className:`${e.u} ml-1`,children:`Colour`}),(0,m.jsx)(a.n,{value:d.color,onChange:e=>y({color:e})})]}),(0,m.jsx)(e.y,{label:`Note`,value:d.note,onChange:e=>y({note:e}),placeholder:`Anything to remember`})]}),(0,m.jsx)(`p`,{className:`text-[11.5px] font-medium text-foreground/40 leading-snug mt-3 ml-1`,children:`Nobody can book this time once it is here.`}),!!_&&(0,m.jsx)(`p`,{className:`text-[12px] font-semibold text-red-500 mt-3 ml-1`,children:_}),(0,m.jsxs)(`div`,{className:`mt-5 flex items-center gap-3`,children:[(0,m.jsx)(u.t,{variant:`secondary`,onClick:c,disabled:h,className:`flex-1 py-2.5 text-[13px] font-bold rounded-xl`,children:`Cancel`}),(0,m.jsx)(u.t,{onClick:async()=>{g(!0),v(``);let e=t.ln(n,d.time,i),r=new Date(e.getTime()+Number(d.minutes)*6e4),a=await l({title:d.title.trim(),start:e.toISOString(),end:r.toISOString(),color:d.color,note:d.note.trim()});g(!1),a?v(a):c()},isLoading:h,className:`flex-1 py-2.5 text-[13px] font-bold rounded-xl`,children:`Add it`})]})]})}var k=(e,t)=>new Intl.DateTimeFormat(t,{timeZone:`UTC`,weekday:`short`,day:`numeric`,month:`long`}).format(new Date(`${e}T00:00:00Z`)),A=[`M`,`T`,`W`,`T`,`F`,`S`,`S`],j=e=>e.slice(0,7),M=(e,n,r)=>t.st(e,n,r).replace(/[\s\u00a0\u202f]+/g,``).toLowerCase();function N(e,t=3){return e.length<=t?{shown:e,extra:0}:{shown:e.slice(0,t-1),extra:e.length-(t-1)}}var P=(e,t,n=`host`)=>n===`booker`?a.o(e,n):t&&e.memberName?`${a.a(e)} · ${e.memberName}`:a.a(e);function F(e,n){let r=new Map;for(let i of e){let e=t.cn(new Date(i.start),n).dateKey,a=r.get(e)||[];a.push(i),r.set(e,a)}for(let e of r.values())e.sort((e,t)=>e.start.localeCompare(t.start));return r}function I(e,t,n=!0){return!n||!e.paymentId&&!e.paymentSession?null:e.paymentSession?t===void 0?{state:`saving`,label:`Checking payment`}:t?{state:`saved`,label:`Paid`}:{state:`off`,label:`Awaiting payment`}:{state:`off`,label:`Not paid`}}var L=`h-8 px-3 rounded-xl border border-[var(--panel-border)]/60 inline-flex items-center gap-1.5 text-[12.5px] font-semibold text-foreground/60 hover:text-foreground hover:border-accent/40 hover:bg-foreground/5 active:scale-[0.98] transition-all cursor-pointer`;function R({bookings:n,zone:r,paid:s,openBookingId:l,onOpened:u,withMember:d=!1,me:f=``,side:h=`host`,onAccept:g,onCancel:_,onDelete:v,canDelete:y,onColor:b,onRelease:x,onAdd:S,now:C}){let w=t.cn(C?C():new Date,r).dateKey,E=(0,p.useMemo)(()=>F(n,r),[n,r]),[D,R]=(0,p.useState)(j(w)),[z,B]=(0,p.useState)(w),[V,H]=(0,p.useState)(null),[U,W]=(0,p.useState)(!1),G=(0,p.useRef)(``);(0,p.useEffect)(()=>{if(!l){G.current=``;return}if(G.current===l)return;let e=n.find(e=>e.id===l);if(!e)return;G.current=l;let i=t.cn(new Date(e.start),r).dateKey;R(j(i)),B(i),H(e.id),u?.()},[l,n,r,u]);let K=i.o(D),q=E.get(z)||[],J=(C?C():new Date).toISOString(),Y=k(z),X=V?n.find(e=>e.id===V):void 0,{ref:Z,moreBelow:Q}=i.s(q.length,z);return(0,m.jsxs)(`div`,{className:`flex flex-col md:flex-row gap-3 md:gap-4 w-full md:items-stretch`,children:[(0,m.jsxs)(`div`,{className:`${i.r} w-full md:flex-1 min-w-0`,children:[(0,m.jsxs)(`div`,{className:i.i,children:[(0,m.jsx)(`h4`,{className:`text-[14px] font-bold text-foreground tracking-tight truncate`,children:t.wt(D)}),(0,m.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,m.jsx)(`button`,{type:`button`,onClick:()=>{R(j(w)),B(w)},className:L,children:`Today`}),(0,m.jsx)(`button`,{type:`button`,"aria-label":`Previous month`,onClick:()=>R(e=>t.Kt(e,-1)),className:i.t,children:(0,m.jsx)(o.t,{className:`w-4 h-4`})}),(0,m.jsx)(`button`,{type:`button`,"aria-label":`Next month`,onClick:()=>R(e=>t.Kt(e,1)),className:i.t,children:(0,m.jsx)(e.kt,{className:`w-4 h-4`})})]})]}),(0,m.jsx)(`div`,{className:`p-2 sm:p-3`,children:(0,m.jsxs)(`div`,{className:`grid grid-cols-7 gap-1`,role:`grid`,"aria-label":t.wt(D),children:[A.map((e,t)=>(0,m.jsx)(`div`,{className:`text-center text-[10.5px] font-bold uppercase tracking-wider text-foreground/35 pb-1`,children:e},t)),K.map((e,n)=>{if(!e)return(0,m.jsx)(`div`,{"aria-hidden":!0},`blank-${n}`);let i=E.get(e)||[],{shown:a,extra:o}=N(i),s=e===z,c=e===w;return(0,m.jsxs)(`button`,{type:`button`,role:`gridcell`,"aria-label":`${e}${i.length?`, ${i.length} booked`:``}`,"aria-selected":s,onClick:()=>B(e),className:`relative flex flex-col items-center sm:items-stretch justify-center sm:justify-start h-10 sm:h-[86px] rounded-xl sm:p-1 text-left transition-all cursor-pointer border ${s?`border-accent/70 bg-accent/[0.08] shadow-sm shadow-accent/10`:i.length?`border-transparent hover:bg-foreground/[0.05] hover:border-[var(--panel-border)]/60`:`border-transparent hover:bg-foreground/[0.03]`} ${c&&!s?`ring-1 ring-inset ring-accent/45`:``}`,children:[(0,m.jsx)(`span`,{className:`text-[13px] tabular-nums leading-none sm:px-1 sm:pt-0.5 sm:pb-1 ${s||c?`font-bold text-accent`:i.length?`font-bold text-foreground`:`font-semibold text-foreground/35`}`,children:Number(e.slice(8,10))}),(0,m.jsxs)(`span`,{"aria-hidden":!0,className:`max-sm:hidden sm:flex flex-col gap-[2px] w-full min-w-0`,children:[a.map(e=>(0,m.jsxs)(`span`,{className:`flex items-center gap-1 min-w-0 rounded-md pr-1 py-[2px] leading-[1.2] overflow-hidden ${e.end<J&&!e.cancelled?`opacity-50`:``} ${e.cancelled?`bg-foreground/[0.04] line-through`:``}`,style:e.cancelled?void 0:{background:t.at(e.color,12)},children:[(0,m.jsx)(`span`,{className:`w-[3px] self-stretch rounded-full shrink-0 ${e.cancelled?`bg-foreground/15`:``}`,style:e.cancelled?void 0:{background:t.at(e.color,85)}}),(0,m.jsx)(`span`,{className:`text-[9.5px] font-bold tabular-nums shrink-0 ${e.cancelled?`text-foreground/40`:`text-foreground/85`}`,children:M(new Date(e.start),r)}),(0,m.jsx)(`span`,{className:`text-[9.5px] font-medium truncate ${e.cancelled?`text-foreground/40`:`text-foreground/60`}`,children:P(e,d,h)})]},e.id)),o>0&&(0,m.jsxs)(`span`,{className:`px-1 text-[9.5px] font-bold text-foreground/45 leading-[1.2]`,children:[`+`,o,` more`]})]})]},e)})]})})]}),(0,m.jsx)(`div`,{className:`w-full md:w-[320px] shrink-0 md:relative md:min-h-[360px]`,children:(0,m.jsxs)(`div`,{className:`${i.r} flex flex-col md:absolute md:inset-0`,children:[(0,m.jsxs)(`div`,{className:i.i,children:[(0,m.jsx)(`p`,{className:`text-[13px] font-bold text-foreground tracking-tight truncate`,children:Y}),(0,m.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[q.length>0&&(0,m.jsxs)(`span`,{className:`text-[11.5px] font-semibold text-foreground/40 tabular-nums max-sm:hidden`,children:[q.length,` `,q.length===1?`event`:`events`]}),S&&(0,m.jsxs)(`button`,{type:`button`,onClick:()=>W(!0),title:`Add an event on ${Y}`,className:L,children:[(0,m.jsx)(c.t,{className:`w-3.5 h-3.5 shrink-0`}),`Add`]})]})]}),(0,m.jsxs)(`div`,{className:`relative flex-1 min-h-0`,children:[(0,m.jsx)(`div`,{ref:Z,className:`p-3 h-full overflow-y-auto styled-scrollbars-mini flex flex-col gap-2`,children:q.length===0?(0,m.jsxs)(`div`,{className:`flex flex-col items-center justify-center text-center gap-2 py-8 px-2`,children:[(0,m.jsx)(i.d,{className:`w-5 h-5 text-foreground/25`,"aria-hidden":!0}),(0,m.jsx)(`p`,{className:`text-[12.5px] font-medium text-foreground/45 leading-relaxed`,children:`Nothing on this day yet.`})]}):q.map(e=>(0,m.jsx)(a.r,{booking:e,zone:r,now:C,chip:I(e,s?.[e.id],!!s),withMember:d,side:h,onOpen:()=>H(e.id)},e.id))}),Q&&(0,m.jsx)(i.a,{})]})]})}),X&&(0,m.jsx)(T,{booking:X,zone:r,chip:I(X,s?.[X.id],!!s),onClose:()=>H(null),me:f,side:h,onColor:b?e=>b(X.id,e):void 0,onAccept:g?()=>g(X):void 0,onCancel:e=>_(X,e),onDelete:v&&(!y||y(X))?()=>v(X):void 0,onRelease:x?()=>x(X):void 0}),U&&S&&(0,m.jsx)(O,{dateKey:z,dayLabel:Y,zone:r,today:w,now:C,onClose:()=>W(!1),onAdd:S})]})}var z=new Map,B=3,V=60*1e3;function H(t){let[n,i]=(0,p.useState)({}),a=(0,p.useRef)(new Set),o=(0,p.useRef)([]),s=(0,p.useRef)(0),c=(0,p.useRef)(!0),l=(0,p.useRef)(new Map),u=(0,p.useRef)(new Set),f=(e,t,n)=>{u.current.add(e),r.s(t,`paid`).then(({refused:r})=>{if(!r.length){l.current.delete(e),z.set(e,n);return}l.current.set(e,{passes:Object.fromEntries(r.map(e=>[e,t[e]])),forBookings:n})}).finally(()=>u.current.delete(e))},m=()=>{for(let[e,{passes:t,forBookings:n}]of l.current)u.current.has(e)||f(e,t,n)};return(0,p.useEffect)(()=>{c.current=!0;let e=setInterval(m,V);return()=>{c.current=!1,clearInterval(e)}},[]),(0,p.useEffect)(()=>{m();let n=()=>{for(;s.current<B&&o.current.length;){let t=o.current.shift();s.current+=1,e.An(t,{quiet:!0}).then(e=>{let n=[...new Set([...d.s(e.metadata),String(e.metadata?.bookingId||``)].filter(Boolean))],r=e.holdPasses||{};Object.keys(r).length?f(t,r,n):e.paid&&z.set(t,n),c.current&&i(r=>({...r,[t]:{paid:e.paid,forBookings:n,status:e.status??null}}))}).catch(()=>{}).finally(()=>{--s.current,c.current&&n()})}};for(let e of t){let t=e.paymentSession;!t||z.has(t)||a.current.has(t)||(a.current.add(t),o.current.push(t))}n()},[t]),(0,p.useMemo)(()=>{let e={},r={};for(let i of t){let t=i.paymentSession;if(!t)continue;let a=z.has(t)?{paid:!0,forBookings:z.get(t),status:`complete`}:n[t];if(!a)continue;let o=new Set([i.id,...i.copyIds||[]]);e[i.id]=a.paid&&a.forBookings.some(e=>o.has(e)),r[i.id]={paid:e[i.id],status:a.status}}return{paid:e,checkouts:r}},[n,t])}Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return H}});
@@ -1,10 +1,10 @@
1
- import "./PageTitle-DCoUQWw6.js";
1
+ import "./PageTitle-CkZriz8K.js";
2
2
  import { An as e, At as t, I as n, N as r, P as i, _ as a, b as o, g as s, kt as c, nt as l, o as u, rt as d, u as f, y as p } from "./TimeZoneField-oIMwb5_X.js";
3
3
  import { Kt as m, Tt as h, Zt as g, at as _, cn as v, ln as y, nn as b, p as x, st as S, v as C, wt as w } from "./schedule-C13m_kiO.js";
4
4
  import { n as T } from "./chevron-down--LwXEv9w.js";
5
5
  import { s as E } from "./scheduleData-DR6A-Q7Z.js";
6
6
  import { a as D, d as O, i as k, o as A, r as j, s as ee, t as M } from "./BookingCalendar-Bej__mIs.js";
7
- import { a as N, c as te, i as ne, n as P, o as F, r as I, s as re, t as L } from "./EventCard-BSGLYD64.js";
7
+ import { a as N, c as te, i as ne, n as P, o as F, r as I, s as re, t as L } from "./EventCard-DnoR91KN.js";
8
8
  import { t as R } from "./chevron-left-By8iIdje.js";
9
9
  import { t as z } from "./x-hax8aKt8.js";
10
10
  import { t as B } from "./plus-BKrt0Qx5.js";
@@ -1 +1 @@
1
- require(`./chunk-CiTBaPhY.cjs`);const e=require(`./TimeZoneField-Ckn1pKAL.cjs`),t=require(`./DashboardNav-GgEUpyTa.cjs`),n=require(`./schedule-BAea6q8_.cjs`);let r=require(`react`),i=require(`firebase/firestore`);var a=[{id:`home`,title:`Home`,path:`/`,audience:`public`},{id:`contact`,title:`Contact`,path:`/contact`,audience:`public`},{id:`dashboard`,title:`Dashboard`,path:`/dashboard`,audience:`user`},{id:`support`,title:`Support`,path:`/support`,audience:`user`}],o=new Set([`home`,`drive`,`assets`,`contact`,`guide`,`templates`,`setup`,`support`,`theme`,`page_order`,`tab_order`]),s={public:0,user:1,internal:2,admin:3},c=(e,t)=>{let n=String(e||``).trim();return n?n.startsWith(`/`)?n:`/${n}`:`/${t}`},l=e=>new Set((Array.isArray(e?.order)?e.order:[]).filter(e=>e&&typeof e==`object`&&e.removed).map(e=>String(e.id)));function u(e,r,i,l,u=t.x()){let d=[...a];for(let{id:t,data:n}of e)o.has(t)||d.push({id:t,title:String(n?.pageName||n?.title||t),path:c(n?.route,t),brief:String(n?.brief||``),config:n,audience:`public`});for(let{id:e,data:t}of r)o.has(e)||d.push({id:e,title:String(t?.tabName||t?.title||e),path:c(t?.route,e),brief:String(t?.brief||``),config:t,audience:n.jn(t?.pageType)});for(let[e,t]of u){if(o.has(e)||d.some(t=>t.id===e)||d.some(t=>String(t.config?.fileId||``)===e))continue;let r=!!t.isPublic;if((r?i:l).has(e))continue;let a=t.config||{},s=c(a.route,e);d.some(e=>e.path===s)||d.push({id:e,title:String(r?a.pageName||a.pageTitle||a.title||e:a.tabName||a.tabTitle||a.title||e),path:s,brief:String(a.brief||``),config:a,audience:r?`public`:n.jn(a.pageType)})}return d.sort((e,t)=>(s[e.audience||`public`]??9)-(s[t.audience||`public`]??9)||e.title.localeCompare(t.title))}function d(){let[t,n]=(0,r.useState)(null),[a,o]=(0,r.useState)(null),[s,c]=(0,r.useState)(new Set),[d,f]=(0,r.useState)(new Set);return(0,r.useEffect)(()=>{let t=e=>{let t=[];return e.forEach(e=>t.push({id:e.id,data:e.data()})),t},r=[(0,i.onSnapshot)((0,i.collection)(e.ui,`sys_pages`),e=>n(t(e)),()=>n([])),(0,i.onSnapshot)((0,i.collection)(e.ui,`sys_tabs`),e=>o(t(e)),()=>o([])),(0,i.onSnapshot)((0,i.doc)(e.ui,`sys_configs`,`page_order`),e=>c(l(e.exists()?e.data():null)),()=>{}),(0,i.onSnapshot)((0,i.doc)(e.ui,`sys_configs`,`tab_order`),e=>f(l(e.exists()?e.data():null)),()=>{})];return()=>r.forEach(e=>e())},[]),t===null||a===null?null:u(t,a,s,d)}var f=[`board`,`table`,`calendar`,`drive`],p=[`inline_form`,`popup_form`],m=e=>typeof e!=`string`||e===``||e===`none`||e===`custom`||![...f,...p].includes(e),h=(e,t)=>m(e)||t&&!g(e),g=e=>typeof e==`string`&&f.includes(e),_=e=>String(e??``).toLowerCase().replace(/[^a-z0-9]+/g,`_`),v=(e,t)=>String(e?.recordsKey??``).trim()||_(e?.tabName||e?.pageId||t),y=(e,t)=>{let n=String(e?.recordsKey??``).trim();if(n)return n;let r=String(e?.pageName??``).toLowerCase().replace(/\s+/g,`_`)||e?.pageId||`custom_page`;return t&&e?.pageId||r},b={board:`tasks`,table:`table`,calendar:`events`,drive:`files`};function x(e,t,n=``){let r=b[String(e?.template??``)];return r?`${t}${y({...e,pageId:e?.pageId||n},!0)}_${r}`:t===`case_`?w(e,t):`${t}${v(e,t===`admin_`?`admin_page`:t===`mem_`?`internal_page`:`user_page`)}_records`}function S(e,t,n){let r=String(e?.recordsKey??``).trim();if(r)return r;let i=g(String(e?.template??``));return n?i?y({...e,pageId:t},!1):``:i?t:v(e,t)}var C=e=>(String(e?.recordsKey??``).trim()||String(e?.tabName||e?.contentKey||`page`)).toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``)||`page`,w=(e,t=n.pn)=>`${t}${C(e)}_entries`;Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return d}});
1
+ require(`./chunk-CiTBaPhY.cjs`);const e=require(`./TimeZoneField-Ckn1pKAL.cjs`),t=require(`./DashboardNav-Bc619nqn.cjs`),n=require(`./schedule-BAea6q8_.cjs`);let r=require(`react`),i=require(`firebase/firestore`);var a=[{id:`home`,title:`Home`,path:`/`,audience:`public`},{id:`contact`,title:`Contact`,path:`/contact`,audience:`public`},{id:`dashboard`,title:`Dashboard`,path:`/dashboard`,audience:`user`},{id:`support`,title:`Support`,path:`/support`,audience:`user`}],o=new Set([`home`,`drive`,`assets`,`contact`,`guide`,`templates`,`setup`,`support`,`theme`,`page_order`,`tab_order`]),s={public:0,user:1,internal:2,admin:3},c=(e,t)=>{let n=String(e||``).trim();return n?n.startsWith(`/`)?n:`/${n}`:`/${t}`},l=e=>new Set((Array.isArray(e?.order)?e.order:[]).filter(e=>e&&typeof e==`object`&&e.removed).map(e=>String(e.id)));function u(e,r,i,l,u=t.x()){let d=[...a];for(let{id:t,data:n}of e)o.has(t)||d.push({id:t,title:String(n?.pageName||n?.title||t),path:c(n?.route,t),brief:String(n?.brief||``),config:n,audience:`public`});for(let{id:e,data:t}of r)o.has(e)||d.push({id:e,title:String(t?.tabName||t?.title||e),path:c(t?.route,e),brief:String(t?.brief||``),config:t,audience:n.jn(t?.pageType)});for(let[e,t]of u){if(o.has(e)||d.some(t=>t.id===e)||d.some(t=>String(t.config?.fileId||``)===e))continue;let r=!!t.isPublic;if((r?i:l).has(e))continue;let a=t.config||{},s=c(a.route,e);d.some(e=>e.path===s)||d.push({id:e,title:String(r?a.pageName||a.pageTitle||a.title||e:a.tabName||a.tabTitle||a.title||e),path:s,brief:String(a.brief||``),config:a,audience:r?`public`:n.jn(a.pageType)})}return d.sort((e,t)=>(s[e.audience||`public`]??9)-(s[t.audience||`public`]??9)||e.title.localeCompare(t.title))}function d(){let[t,n]=(0,r.useState)(null),[a,o]=(0,r.useState)(null),[s,c]=(0,r.useState)(new Set),[d,f]=(0,r.useState)(new Set);return(0,r.useEffect)(()=>{let t=e=>{let t=[];return e.forEach(e=>t.push({id:e.id,data:e.data()})),t},r=[(0,i.onSnapshot)((0,i.collection)(e.ui,`sys_pages`),e=>n(t(e)),()=>n([])),(0,i.onSnapshot)((0,i.collection)(e.ui,`sys_tabs`),e=>o(t(e)),()=>o([])),(0,i.onSnapshot)((0,i.doc)(e.ui,`sys_configs`,`page_order`),e=>c(l(e.exists()?e.data():null)),()=>{}),(0,i.onSnapshot)((0,i.doc)(e.ui,`sys_configs`,`tab_order`),e=>f(l(e.exists()?e.data():null)),()=>{})];return()=>r.forEach(e=>e())},[]),t===null||a===null?null:u(t,a,s,d)}var f=[`board`,`table`,`calendar`,`drive`],p=[`inline_form`,`popup_form`],m=e=>typeof e!=`string`||e===``||e===`none`||e===`custom`||![...f,...p].includes(e),h=(e,t)=>m(e)||t&&!g(e),g=e=>typeof e==`string`&&f.includes(e),_=e=>String(e??``).toLowerCase().replace(/[^a-z0-9]+/g,`_`),v=(e,t)=>String(e?.recordsKey??``).trim()||_(e?.tabName||e?.pageId||t),y=(e,t)=>{let n=String(e?.recordsKey??``).trim();if(n)return n;let r=String(e?.pageName??``).toLowerCase().replace(/\s+/g,`_`)||e?.pageId||`custom_page`;return t&&e?.pageId||r},b={board:`tasks`,table:`table`,calendar:`events`,drive:`files`};function x(e,t,n=``){let r=b[String(e?.template??``)];return r?`${t}${y({...e,pageId:e?.pageId||n},!0)}_${r}`:t===`case_`?w(e,t):`${t}${v(e,t===`admin_`?`admin_page`:t===`mem_`?`internal_page`:`user_page`)}_records`}function S(e,t,n){let r=String(e?.recordsKey??``).trim();if(r)return r;let i=g(String(e?.template??``));return n?i?y({...e,pageId:t},!1):``:i?t:v(e,t)}var C=e=>(String(e?.recordsKey??``).trim()||String(e?.tabName||e?.contentKey||`page`)).toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``)||`page`,w=(e,t=n.pn)=>`${t}${C(e)}_entries`;Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return d}});
@@ -1,5 +1,5 @@
1
1
  import { ui as e } from "./TimeZoneField-oIMwb5_X.js";
2
- import { x as t } from "./DashboardNav-CEd8gGPm.js";
2
+ import { x as t } from "./DashboardNav-CxS3Qnl-.js";
3
3
  import { jn as n, pn as r } from "./schedule-C13m_kiO.js";
4
4
  import { useEffect as i, useState as a } from "react";
5
5
  import { collection as o, doc as s, onSnapshot as c } from "firebase/firestore";
@@ -1 +1 @@
1
- require(`./chunk-CiTBaPhY.cjs`);const e=require(`./PageTitle-DQkvCB11.cjs`),t=require(`./TimeZoneField-Ckn1pKAL.cjs`),n=require(`./DashboardNav-GgEUpyTa.cjs`),r=require(`./schedule-BAea6q8_.cjs`);let i=require(`react`),a=require(`firebase/firestore`);var o=new Set([`users`,`users-round`,`user`,`user-round`,`circle-user`,`contact-round`]),s=new Map,c=t=>{let n=String(t||``).trim();if(!n)return``;if(!s.has(n)){let t=e.u(n,8,void 0,!1);s.set(n,t.find(e=>!o.has(e))||t[0]||``)}return s.get(n)||``},l=(e,n=t.Kr())=>String(n.find(t=>t.id===e)?.icon||``).trim()||(t.Gr(e)?t.Wr(e)||t.zr[e]:c(t.qr(e,n))||`id-card`),u=`sys_roles`,d=(e,t)=>({id:e,name:String(t?.name||e),...String(t?.icon||``).trim()?{icon:String(t.icon).trim()}:{},...typeof t?.createdAt==`number`?{createdAt:t.createdAt}:{},...Array.isArray(t?.sees)?{sees:t.sees.filter(e=>typeof e==`string`&&!!e)}:{}}),f=(e,t)=>e.name.localeCompare(t.name);function p(e,n=t.Kr()){let i=String(e||``).trim();if(!i)return`Type a name for the role first — Client, say, or Supplier.`;let a=r.Ln(i);if(a.length<2||!/^[a-z]/.test(a))return`Use a name with at least two letters in it.`;if(r.hn.has(a)||!r.Dn(a))return`${i} is a word the app already uses. Pick another.`;if(n.some(e=>e.id===a))return`You already have a role called ${n.find(e=>e.id===a).name}.`;let o=t.Ur(n).find(e=>e.name.trim().toLowerCase()===i.toLowerCase());return o?`You already have a role called ${o.name}.`:``}async function m(e){let n=String(e||``).trim().slice(0,48),i={id:r.Ln(n),name:n,createdAt:Date.now()};return await(0,a.setDoc)((0,a.doc)(t.ui,u,i.id),{name:i.name,createdAt:i.createdAt}),i}async function h(e,n){let i=String(n||``).trim().slice(0,48);if(i){if(t.Gr(e)){if(i===t.Vr[e]){if(t.Wr(e)){await(0,a.setDoc)((0,a.doc)(t.ui,u,e),{name:``,builtIn:!0},{merge:!0});return}await(0,a.deleteDoc)((0,a.doc)(t.ui,u,e)).catch(()=>{});return}await(0,a.setDoc)((0,a.doc)(t.ui,u,e),{name:i,builtIn:!0},{merge:!0});return}r.Dn(e)&&await(0,a.setDoc)((0,a.doc)(t.ui,u,e),{name:i},{merge:!0})}}async function g(e,n){let i=String(n||``).trim();!t.Gr(e)&&!r.Dn(e)||await(0,a.setDoc)((0,a.doc)(t.ui,u,e),{icon:i,...t.Gr(e)?{builtIn:!0}:{}},{merge:!0})}function _(e,n,r=t.Kr()){let i=String(n||``).trim();if(!i)return`A role needs a name.`;let a=t.Ur(r).find(t=>t.id!==e&&t.name.trim().toLowerCase()===i.toLowerCase());return a?`You already have a role called ${a.name}.`:``}var v=(e,t)=>(Array.isArray(e?.plans)?e.plans:[]).filter(e=>e?.roleId===t);async function y(e){let n={people:[],pages:[],plans:[]};return r.Dn(e)?((await(0,a.getDocs)((0,a.query)((0,a.collection)(t.ui,`user_profiles`),(0,a.where)(`role`,`==`,e)))).forEach(e=>n.people.push(e.id)),(await(0,a.getDocs)((0,a.collection)(t.ui,`sys_tabs`))).forEach(t=>{r._n(t.data()?.roles).includes(e)&&n.pages.push(t.id)}),(await(0,a.getDocs)((0,a.collection)(t.ui,t.Qn))).forEach(t=>{if(t.id!==`_settings`)for(let r of v(t.data(),e))n.plans.push(String(r?.name||``).trim()||`A plan`)}),n):n}async function b(e){if(!r.Dn(e))return;let i=await(0,a.getDocs)((0,a.query)((0,a.collection)(t.ui,`user_profiles`),(0,a.where)(`role`,`==`,e)));for(let e of i.docs)await(0,a.updateDoc)((0,a.doc)(t.ui,`user_profiles`,e.id),{role:r.In(`free`),...t.Wn()});let o=await(0,a.getDocs)((0,a.collection)(t.ui,t.Qn));for(let n of o.docs){if(n.id===`_settings`||!v(n.data(),e).length)continue;let r=n.data().plans.map(t=>t?.roleId===e?{...t,roleId:``}:t);await(0,a.setDoc)((0,a.doc)(t.ui,t.Qn,n.id),{plans:r},{merge:!0})}let s=await(0,a.getDocs)((0,a.collection)(t.ui,`sys_tabs`));for(let n of s.docs){let i=r._n(n.data()?.roles);if(!i.includes(e))continue;let o=i.filter(t=>t!==e);await(0,a.setDoc)((0,a.doc)(t.ui,`sys_tabs`,n.id),{roles:o.length?o:[`user`]},{merge:!0})}await n.p(e),await(0,a.deleteDoc)((0,a.doc)(t.ui,u,e))}function x(){let[e,n]=(0,i.useState)(()=>t.Kr());return(0,i.useEffect)(()=>(0,a.onSnapshot)((0,a.collection)(t.ui,u),e=>{let i=[],a={},o={};e.forEach(e=>{if(t.Gr(e.id)){let t=String(e.data()?.name||``).trim();t&&(a[e.id]=t);let n=String(e.data()?.icon||``).trim();n&&(o[e.id]=n);return}r.Dn(e.id)&&i.push(d(e.id,e.data()))}),i.sort(f),t.Xr(a),t.Jr(o),t.Yr(i),n(i)},()=>{}),[]),e}var S=(e=t.Kr())=>t.Br.map(n=>({id:n,name:t.qr(n,e)}));Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return l}});
1
+ require(`./chunk-CiTBaPhY.cjs`);const e=require(`./PageTitle-BL50s4qY.cjs`),t=require(`./TimeZoneField-Ckn1pKAL.cjs`),n=require(`./DashboardNav-Bc619nqn.cjs`),r=require(`./schedule-BAea6q8_.cjs`);let i=require(`react`),a=require(`firebase/firestore`);var o=new Set([`users`,`users-round`,`user`,`user-round`,`circle-user`,`contact-round`]),s=new Map,c=t=>{let n=String(t||``).trim();if(!n)return``;if(!s.has(n)){let t=e.u(n,8,void 0,!1);s.set(n,t.find(e=>!o.has(e))||t[0]||``)}return s.get(n)||``},l=(e,n=t.Kr())=>String(n.find(t=>t.id===e)?.icon||``).trim()||(t.Gr(e)?t.Wr(e)||t.zr[e]:c(t.qr(e,n))||`id-card`),u=`sys_roles`,d=(e,t)=>({id:e,name:String(t?.name||e),...String(t?.icon||``).trim()?{icon:String(t.icon).trim()}:{},...typeof t?.createdAt==`number`?{createdAt:t.createdAt}:{},...Array.isArray(t?.sees)?{sees:t.sees.filter(e=>typeof e==`string`&&!!e)}:{}}),f=(e,t)=>e.name.localeCompare(t.name);function p(e,n=t.Kr()){let i=String(e||``).trim();if(!i)return`Type a name for the role first — Client, say, or Supplier.`;let a=r.Ln(i);if(a.length<2||!/^[a-z]/.test(a))return`Use a name with at least two letters in it.`;if(r.hn.has(a)||!r.Dn(a))return`${i} is a word the app already uses. Pick another.`;if(n.some(e=>e.id===a))return`You already have a role called ${n.find(e=>e.id===a).name}.`;let o=t.Ur(n).find(e=>e.name.trim().toLowerCase()===i.toLowerCase());return o?`You already have a role called ${o.name}.`:``}async function m(e){let n=String(e||``).trim().slice(0,48),i={id:r.Ln(n),name:n,createdAt:Date.now()};return await(0,a.setDoc)((0,a.doc)(t.ui,u,i.id),{name:i.name,createdAt:i.createdAt}),i}async function h(e,n){let i=String(n||``).trim().slice(0,48);if(i){if(t.Gr(e)){if(i===t.Vr[e]){if(t.Wr(e)){await(0,a.setDoc)((0,a.doc)(t.ui,u,e),{name:``,builtIn:!0},{merge:!0});return}await(0,a.deleteDoc)((0,a.doc)(t.ui,u,e)).catch(()=>{});return}await(0,a.setDoc)((0,a.doc)(t.ui,u,e),{name:i,builtIn:!0},{merge:!0});return}r.Dn(e)&&await(0,a.setDoc)((0,a.doc)(t.ui,u,e),{name:i},{merge:!0})}}async function g(e,n){let i=String(n||``).trim();!t.Gr(e)&&!r.Dn(e)||await(0,a.setDoc)((0,a.doc)(t.ui,u,e),{icon:i,...t.Gr(e)?{builtIn:!0}:{}},{merge:!0})}function _(e,n,r=t.Kr()){let i=String(n||``).trim();if(!i)return`A role needs a name.`;let a=t.Ur(r).find(t=>t.id!==e&&t.name.trim().toLowerCase()===i.toLowerCase());return a?`You already have a role called ${a.name}.`:``}var v=(e,t)=>(Array.isArray(e?.plans)?e.plans:[]).filter(e=>e?.roleId===t);async function y(e){let n={people:[],pages:[],plans:[]};return r.Dn(e)?((await(0,a.getDocs)((0,a.query)((0,a.collection)(t.ui,`user_profiles`),(0,a.where)(`role`,`==`,e)))).forEach(e=>n.people.push(e.id)),(await(0,a.getDocs)((0,a.collection)(t.ui,`sys_tabs`))).forEach(t=>{r._n(t.data()?.roles).includes(e)&&n.pages.push(t.id)}),(await(0,a.getDocs)((0,a.collection)(t.ui,t.Qn))).forEach(t=>{if(t.id!==`_settings`)for(let r of v(t.data(),e))n.plans.push(String(r?.name||``).trim()||`A plan`)}),n):n}async function b(e){if(!r.Dn(e))return;let i=await(0,a.getDocs)((0,a.query)((0,a.collection)(t.ui,`user_profiles`),(0,a.where)(`role`,`==`,e)));for(let e of i.docs)await(0,a.updateDoc)((0,a.doc)(t.ui,`user_profiles`,e.id),{role:r.In(`free`),...t.Wn()});let o=await(0,a.getDocs)((0,a.collection)(t.ui,t.Qn));for(let n of o.docs){if(n.id===`_settings`||!v(n.data(),e).length)continue;let r=n.data().plans.map(t=>t?.roleId===e?{...t,roleId:``}:t);await(0,a.setDoc)((0,a.doc)(t.ui,t.Qn,n.id),{plans:r},{merge:!0})}let s=await(0,a.getDocs)((0,a.collection)(t.ui,`sys_tabs`));for(let n of s.docs){let i=r._n(n.data()?.roles);if(!i.includes(e))continue;let o=i.filter(t=>t!==e);await(0,a.setDoc)((0,a.doc)(t.ui,`sys_tabs`,n.id),{roles:o.length?o:[`user`]},{merge:!0})}await n.p(e),await(0,a.deleteDoc)((0,a.doc)(t.ui,u,e))}function x(){let[e,n]=(0,i.useState)(()=>t.Kr());return(0,i.useEffect)(()=>(0,a.onSnapshot)((0,a.collection)(t.ui,u),e=>{let i=[],a={},o={};e.forEach(e=>{if(t.Gr(e.id)){let t=String(e.data()?.name||``).trim();t&&(a[e.id]=t);let n=String(e.data()?.icon||``).trim();n&&(o[e.id]=n);return}r.Dn(e.id)&&i.push(d(e.id,e.data()))}),i.sort(f),t.Xr(a),t.Jr(o),t.Yr(i),n(i)},()=>{}),[]),e}var S=(e=t.Kr())=>t.Br.map(n=>({id:n,name:t.qr(n,e)}));Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return l}});
@@ -1,6 +1,6 @@
1
- import { u as e } from "./PageTitle-DCoUQWw6.js";
1
+ import { u as e } from "./PageTitle-CkZriz8K.js";
2
2
  import { Br as t, Gr as n, Jr as r, Kr as i, Qn as a, Ur as o, Vr as s, Wn as c, Wr as l, Xr as u, Yr as d, qr as f, ui as p, zr as m } from "./TimeZoneField-oIMwb5_X.js";
3
- import { p as h } from "./DashboardNav-CEd8gGPm.js";
3
+ import { p as h } from "./DashboardNav-CxS3Qnl-.js";
4
4
  import { Dn as g, In as _, Ln as v, _n as y, hn as b } from "./schedule-C13m_kiO.js";
5
5
  import { useEffect as x, useState as S } from "react";
6
6
  import { collection as C, deleteDoc as w, doc as T, getDocs as E, onSnapshot as D, query as O, setDoc as k, updateDoc as A, where as j } from "firebase/firestore";
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./chunk-CiTBaPhY.cjs`),t=require(`./schedule-BAea6q8_.cjs`),n=require(`./bookingHold-DhS-tuuC.cjs`),r=require(`./tabAudience-2fJAN1aD.cjs`),i=require(`./soldLines-BGtA9Oub.cjs`),a=require(`./recordPrice-Cy7Km-eX.cjs`),o=require(`./appIcons-C90OKlV5.cjs`),s=require(`./aiModels-DzYPysSf.cjs`);let c=require(`node:fs`);c=e.a(c,1);let l=require(`express`);l=e.a(l,1);let u=require(`node:crypto`),d=require(`stripe`);d=e.a(d,1);var f=`https://www.googleapis.com/robot/v1/metadata/x509/securetoken@system.gserviceaccount.com`,p=60;function m(e,t,n,r=Math.floor(Date.now()/1e3)){return n?e.alg===`RS256`?e.kid?t.aud===n?t.iss===`https://securetoken.google.com/${n}`?t.sub?t.sub.length>128?`Token subject is not a valid uid.`:typeof t.exp!=`number`||t.exp<=r?`Token has expired.`:typeof t.iat!=`number`||t.iat>r+p?`Token was issued in the future.`:null:`Token has no subject.`:`Token has the wrong issuer.`:`Token was issued for a different Firebase project.`:`Token has no key id.`:`Token is not signed with RS256.`:`The server does not know its Firebase project id.`}function h(e){return Buffer.from(e.replace(/-/g,`+`).replace(/_/g,`/`),`base64`)}function g(e){let t=String(e||``).split(`.`);if(t.length!==3)return null;try{return{header:JSON.parse(h(t[0]).toString(`utf8`)),claims:JSON.parse(h(t[1]).toString(`utf8`)),signed:`${t[0]}.${t[1]}`,signature:h(t[2])}}catch{return null}}var _=null,v=null;async function y(){if(_&&_.expiresAt>Date.now())return _.keys;v||=b().finally(()=>{v=null});try{return await v}catch(e){if(_)return _.keys;throw e}}async function b(){let e=await fetch(f,{signal:AbortSignal.timeout(5e3)});if(!e.ok)throw Error(`Could not fetch Google signing keys (${e.status}).`);let t=await e.json(),n=/max-age=(\d+)/.exec(e.headers.get(`cache-control`)||``);return _={keys:t,expiresAt:Date.now()+(n?Number(n[1]):3600)*1e3},t}async function x(e,t){let n=g(e);if(!n)throw Error(`That is not a valid sign-in token.`);let r=m(n.header,n.claims,t);if(r)throw Error(r);let i=(await y())[n.header.kid];if(!i)throw Error(`Token was signed with a key Google no longer publishes.`);let a=(0,u.createVerify)(`RSA-SHA256`);if(a.update(n.signed),a.end(),!a.verify(i,n.signature))throw Error(`Token signature does not check out.`);return{uid:n.claims.sub,email:n.claims.email||null,emailVerified:!!n.claims.email_verified,signInProvider:n.claims.firebase?.sign_in_provider||null}}function S(){return(process.env.VITE_FIREBASE_PROJECT_ID||process.env.FIREBASE_PROJECT_ID||``).trim()}var ee=`https://firestore.googleapis.com/v1`;function te(e){return e==null?null:`stringValue`in e?e.stringValue:`integerValue`in e?Number(e.integerValue):`doubleValue`in e?e.doubleValue:`booleanValue`in e?e.booleanValue:`timestampValue`in e?e.timestampValue:`nullValue`in e?null:`mapValue`in e?ne(e.mapValue?.fields||{}):`arrayValue`in e?(e.arrayValue?.values||[]).map(te):null}function ne(e){let t={};for(let[n,r]of Object.entries(e||{}))t[n]=te(r);return t}function re(e,t){let n=`${e}/${t}`.split(`/`);if(n.length%2!=0)return`That is not a document path.`;for(let e of n)if(!e||e===`.`||e===`..`||!/^[A-Za-z0-9_.@~+-]+$/.test(e))return`That is not a document path.`;return null}var ie=1e4;async function C(e,t,n,r){let i=re(t,n);if(i)throw Error(i);let a=`${ee}/projects/${e}/databases/(default)/documents/${t}/${n}`,o=await fetch(a,{headers:r?{Authorization:`Bearer ${r}`}:{},signal:AbortSignal.timeout(ie)});if(o.status===404)return null;if(o.status===403)throw Error(`You do not have permission to read that record.`);if(!o.ok)throw Error(`Firestore refused the read (${o.status}).`);return ne((await o.json()).fields||{})}var ae=50;async function oe(e,t,n){if(!/^[A-Za-z0-9_.@~+-]+$/.test(t)||t===`.`||t===`..`)throw Error(`That is not a collection.`);let r=[],i=``;for(let a=0;a<ae;a++){let a=`${ee}/projects/${e}/databases/(default)/documents/${t}?pageSize=300${i?`&pageToken=${encodeURIComponent(i)}`:``}`,o=await fetch(a,{headers:n?{Authorization:`Bearer ${n}`}:{},signal:AbortSignal.timeout(ie)});if(o.status===403)throw Error(`You do not have permission to read those records.`);if(!o.ok)throw Error(`Firestore refused the read (${o.status}).`);let s=await o.json();for(let e of s.documents||[])r.push({id:String(e.name||``).split(`/`).pop()||``,data:ne(e.fields||{})});let c=typeof s.nextPageToken==`string`?s.nextPageToken:``;if(!c)return r;if(c===i)break;i=c}throw Error(`There are too many records to read.`)}var se=[`email`,`Email`,`emailAddress`,`email_address`,`userEmail`,`contactEmail`,`submitterEmail`];function ce(e){let t=[];for(let n of se){let r=e[n];typeof r==`string`&&r.includes(`@`)&&t.push(r.trim())}return t}function le(e){for(let t of se){let n=e[t];if(typeof n==`string`&&n.includes(`@`))return n.trim()}return null}var ue=4320*60*1e3,de=new Set([`user`,`users`,`free`,`guest`,`guests`,`internal`,`admin`,`admins`,`public`,`owner`,`team`,`member`,`members`,`none`,`role`,`roles`]),fe=e=>typeof e==`string`&&/^[a-z][a-z0-9]{1,23}$/.test(e)&&!de.has(e),pe=e=>(0,u.createHmac)(`sha256`,e).update(`your-ai-firebase plan roles v1`).digest(`hex`),me=(e,t,n,r)=>(0,u.createHash)(`sha256`).update(`${e}:${t}:${n}:${r}`).digest(`hex`);function he(e){let t=new Map;for(let n of e){let e=Array.isArray(n?.plans)?n.plans:[];for(let n of e){let e=String(n?.roleId||``);if(fe(e))for(let r of[n?.monthly,n?.yearly])for(let n of[r?.priceId,r?.livePriceId]){let r=String(n||``).trim();r&&t.set(r,e)}}}return t}var ge=e=>he(e).size>0;function _e(e,t,n){let r=null;for(let i of e){if(!i.active||!i.priceId)continue;let e=t.get(i.priceId);if(!e)continue;let a=typeof i.currentPeriodEnd==`number`?i.currentPeriodEnd*1e3:n,o=Math.round(Math.max(a,n)+ue);(!r||o>r.until)&&(r={role:e,until:o})}return r}var ve=null;function w(){return(process.env.STRIPE_SECRET_KEY||``).trim()}function ye(){let e=w();return e?e.startsWith(`sk_live_`)?`live`:`test`:null}function T(){let e=w();if(!e)throw Error(`STRIPE_SECRET_KEY is not set.`);return ve||=new d.default(e),ve}var be=4e3,xe=null;async function Se(e=T,t=Date.now()){let n=w();if(!n)return null;xe?.key!==n&&(xe={key:n,currency:null,failedAt:null,pending:null});let r=xe;return r.currency?r.currency:r.pending?r.pending:r.failedAt!==null&&t-r.failedAt<6e4?null:(r.pending=Promise.resolve().then(()=>e().accounts.retrieveCurrent(void 0,{timeout:be,maxNetworkRetries:0})).then(e=>{let t=String(e?.default_currency||``).trim().toLowerCase();if(!/^[a-z]{3}$/.test(t))throw Error(`The account named no currency.`);return r.currency=t,r.failedAt=null,t}).catch(()=>(r.failedAt=t,null)).finally(()=>{r.pending=null}),r.pending)}async function Ce(e,t=T){return(typeof e==`string`?e.trim().toLowerCase():``)||await Se(t)||`usd`}function we(e){let t=e.currency,n=0;for(let r of Array.isArray(e.lines)?e.lines:[]){let e=Number(r?.amount),i=Number(r?.quantity);if(!Number.isFinite(e)||!Number.isInteger(i))return NaN;n+=E(e,t)*i}for(let r of Array.isArray(e.extras)?e.extras:[]){let e=Number(r?.amount);if(!Number.isFinite(e))return NaN;n+=e<0?-E(-e,t):E(e,t)}return D(n,t)}var Te=Number(process.env.STRIPE_MAX_ADHOC_AMOUNT||1e4),Ee=.5;function De(e){let{priceId:t,amount:n,mode:r=`payment`,quantity:i=1}=e||{};if(!t&&n===void 0)return`This button does not say what is being sold.`;if(t&&n!==void 0)return`A payment has either a Stripe price or an amount, not both.`;if(r!==`payment`&&r!==`subscription`)return`A payment is either one-time or a subscription.`;if(!Number.isInteger(i)||i<1||i>999)return`Quantity must be a whole number between 1 and 999.`;if(n!==void 0){if(r===`subscription`)return`A subscription needs a price created in Stripe — a typed amount cannot recur.`;if(typeof n!=`number`||!Number.isFinite(n))return`That amount is not a number.`;if(n<.5)return`The smallest amount that can be charged is ${Ee}.`;if(n>Te)return`That amount is above the ${Te} limit for typed prices. Use a price created in Stripe.`;if(!e.productName||!String(e.productName).trim())return`A typed amount needs a name for what is being bought.`}if(t&&!/^price_[A-Za-z0-9]+$/.test(t))return`That does not look like a Stripe price id.`;if(e.lines!==void 0){if(t)return`A basket of lines is charged by its amounts, not a Stripe price.`;if(!Array.isArray(e.lines)||!e.lines.length)return`The basket has no lines in it.`;if(e.lines.length>100)return`A basket can hold at most 100 lines.`;for(let t of e.lines){if(!t||typeof t!=`object`)return`A basket line is not a line.`;if(!String(t.name||``).trim())return`A basket line has no name.`;let e=Number(t.amount);if(!Number.isFinite(e)||e<0)return`A basket line has a price that is not a number.`;if(!Number.isInteger(t.quantity)||t.quantity<1||t.quantity>999)return`A basket line needs a whole quantity between 1 and 999.`;if(t.collection!==void 0&&!/^pub_[A-Za-z0-9_]{1,120}$/.test(String(t.collection)))return`A basket line names a collection that is not a public one.`}if(e.extras!==void 0&&!Array.isArray(e.extras))return`The extras on the basket are not a list.`;for(let t of e.extras||[])if(!t||typeof t!=`object`||!Number.isFinite(Number(t.amount)))return`An extra on the basket is not a number.`;if(Math.abs(we(e)-Number(n))>.011)return`The basket’s lines do not add up to its total.`}return null}var Oe=new Set([`bif`,`clp`,`djf`,`gnf`,`jpy`,`kmf`,`krw`,`mga`,`pyg`,`rwf`,`ugx`,`vnd`,`vuv`,`xaf`,`xof`,`xpf`]),ke=new Set([`bhd`,`jod`,`kwd`,`omr`,`tnd`]),Ae=e=>String(e||`usd`).toLowerCase();function E(e,t){let n=Ae(t);return Oe.has(n)?Math.round(e):ke.has(n)?Math.round(e*100)*10:Math.round(e*100)}function D(e,t){if(e==null)return null;let n=Ae(t);return Oe.has(n)?e:ke.has(n)?e/1e3:e/100}function je(e,t,n){let r=String(e||``).replace(/\/+$/,``),i=(e,t)=>{let n=String(e||t);return n.startsWith(`/`)?n:`/${n}`},a=i(t,`/payment-complete`);return{success:`${r}${a}${a.includes(`?`)?`&`:`?`}session_id={CHECKOUT_SESSION_ID}`,cancel:`${r}${i(n,`/payment-cancelled`)}`}}function Me(e){return e===`active`||e===`trialing`||e===`past_due`}var Ne=(e,t,r,i)=>(0,u.createHash)(`sha256`).update(n.d(e,t,r,i)).digest(`hex`),Pe=(e,t)=>`${e}__${String(t).replace(/[-:]/g,``).slice(0,15)}`,Fe=/^[A-Za-z0-9_-]{1,100}$/,Ie=/^cs_[A-Za-z0-9_]{1,250}$/,Le=12,O=(e,t)=>({status:e,error:t});function Re(e){if(!Array.isArray(e)||!e.length)return`Say which times are being paid for.`;if(e.length>Le)return`That is more people than one meeting can hold.`;let t=[];for(let r of e){let e=String(r?.bookingId||``),i=String(r?.scheduleId||``);if(!n.p(e)||!Fe.test(i))return`One of those times could not be read.`;if(t.some(t=>t.bookingId===e))return`The same time was named twice.`;t.push({bookingId:e,scheduleId:i})}return t}async function ze(e,t){let r=Re(e.legs);if(typeof r==`string`)return O(400,r);let i=String(e.when||``).trim().slice(0,300),a=(t.now||Date.now)(),[o,s]=await Promise.all([Promise.all(r.map(e=>t.read(`pub_bookings`,e.bookingId))),Promise.all(r.map(e=>t.read(`sys_schedules`,e.scheduleId)))]),c=-1;for(let e=0;e<r.length;e+=1){let t=o[e],i=s[e];if(!t)return O(409,`That time is no longer held for you — pick it again.`);if(!i)return O(404,`That booking link is no longer open.`);let a=String(t.memberId||``);if(!a||a!==String(i.memberId||``)||Pe(a,String(t.start||``))!==r[e].bookingId)return O(400,`That time does not belong to that booking link.`);if(i.enabled!==!0)return O(409,`This is not taking bookings at the moment.`);if(n.u(t)||t.letGo)return O(409,`That time is no longer held for you — pick it again.`);let l=n.c(t);if(c!==-1&&l!==c)return O(400,`Those times were not held together — pick them again.`);c=l}let l=c-a;if(c&&(l<21e5||l>216e5))return O(400,`The time could not be held long enough to pay. Check the date and time on this device, then try again.`);let u=n._(s.map(e=>({paymentId:String(e?.paymentId||``)})));if(!u.length)return O(400,`There is nothing to pay for this booking.`);let d=await Promise.all(u.map(e=>t.read(`sys_payments`,e))),f=e=>[...new Set(s.filter(t=>String(t?.paymentId||``)===e).map(e=>String(e?.memberName||``).trim()).filter(Boolean))].join(`, `),p=t.currency?await t.currency():`usd`,m=[],h=0;for(let e=0;e<u.length;e+=1){let t=n.g(d[e]);if(!t)return O(409,`The payment for this booking is not set up yet — ask whoever sent you the link.`);let i=f(u[e]),a=`${n.h(d[e])}${r.length>1&&i?` — ${i}`:``}`.slice(0,250),o=E(t,p);m.push({quantity:1,price_data:{currency:p,product_data:{name:a},unit_amount:o}}),h+=o}let g=D(h,p);if(h<50)return O(409,`The payment for this booking is below what can be charged by card.`);let _=s[0]||{},v=`${String(_.name||``).trim()||n.h(d[0])}${i?` — ${i}`:``}`.slice(0,450),y=e=>s.some(t=>t?.[e]!==!1)?`yes`:`no`,b=String(e.email||``).trim().slice(0,254),x=String(e.name||``).trim().slice(0,200);return{lineItems:m,metadata:{bookingId:r[0].bookingId,[n.t]:r.map(e=>e.bookingId).join(`,`).slice(0,500),...c?{[n.o]:String(c)}:{},scheduleId:r[0].scheduleId,productName:v,...i?{when:i}:{},...x?{name:x}:{},...b?{email:b}:{},emailReceipt:y(`confirmBooker`),notifyOwner:y(`notifyOwner`)},expiresAt:Math.floor((a+n.n)/1e3),total:g,currency:p,productName:v}}async function Be(e,t){try{await e.checkout.sessions.expire(t)}catch{}}var Ve=10;async function He(e,t,r){let i=Math.floor((r-n.r-10*6e4)/1e3),a=Math.ceil((r-n.i+10*6e4)/1e3),o=[],s;for(let c=0;c<Ve;c+=1){let c=await e.checkout.sessions.list({created:{gte:i,lte:a},limit:100,starting_after:s});for(let e of c.data)n.s(e.metadata).includes(t)&&n.f(e.metadata)===r&&o.push(e);if(!c.has_more||!c.data.length)break;s=c.data[c.data.length-1].id}return o}async function Ue(e,t,r){if(!n.p(e))return O(400,`That time could not be read.`);if(t&&!Ie.test(t))return O(400,`That payment could not be read.`);let i=(r.now||Date.now)(),a=await r.read(`pub_bookings`,e);if(!a)return{state:`gone`};let o=n.c(a);if(!o||n.u(a))return{state:`kept`};let s=r.stripe();if(t){let r=await s.checkout.sessions.retrieve(t),i=r.metadata||{};if(!n.s(i).includes(e)||n.f(i)!==o)return O(404,`That payment is not for this time.`);r.status===`open`&&await Be(s,t)}let c=await He(s,e,o);if(c.some(e=>e.status===`complete`))return{state:`paid`,pass:Ne(r.key(),e,o,`paid`)};let l=c.filter(e=>e.status===`open`&&e.id!==t);if(l.length){if(i<o)return{state:`open`};for(let e of l)await Be(s,e.id)}return!c.length&&i<o?{state:`open`}:{state:`free`,pass:Ne(r.key(),e,o,`free`)}}function We(e,t){if(e.status!==`complete`||!t)return{};let r=e.metadata||{},i=n.f(r);if(!i)return{};let a={};for(let e of n.s(r))a[e]=Ne(t,e,i,`paid`);return a}function Ge(e,t){e.post(`/payments/booking-checkout`,async(e,n)=>{let r=e.body||{},i=await t.paymentsOff()||await t.limited(e);if(i)return t.fail(n,i.status,i.error);let a=await t.origin(e,r.origin);if(!a)return t.fail(n,400,`The page did not say where to send the payer back to.`);try{let i=await ze(r,t);if(`error`in i)return t.fail(n,i.status,i.error);let{uid:o,...s}=await t.payer(e,i.metadata),c=String(r.successPath||``).split(`?`)[0].slice(0,200),l={...i.metadata,...c?{page:c}:{},...o?{uid:o}:{}};t.stamp(l);let u=t.returnUrls(a,String(r.successPath||``),String(r.cancelPath||``)),d={mode:`payment`,line_items:i.lineItems,success_url:u.success,cancel_url:u.cancel,expires_at:i.expiresAt,allow_promotion_codes:!0,...s,metadata:l,payment_intent_data:{metadata:l,description:i.productName}},f=t.stripe(),p=await f.checkout.sessions.create(d).catch(e=>{if(!d.customer_email||e?.param!==`customer_email`)throw e;return f.checkout.sessions.create({...d,customer_email:void 0})});return n.json({success:!0,sessionId:p.id,url:p.url,amount:i.total,currency:i.currency})}catch(e){return t.sendError(n,e)}}),e.post(`/payments/booking-hold`,async(e,n)=>{let r=e.body||{},i=await t.holdLimited(e);if(i)return t.fail(n,i.status,i.error);try{let e=await Ue(String(r.bookingId||``),String(r.sessionId||``),t);return`error`in e?t.fail(n,e.status,e.error):n.json({success:!0,...e})}catch(e){return t.sendError(n,e)}})}var Ke=`https://api.resend.com`;function k(){return(process.env.RESEND_KEY||process.env.RESEND_API_KEY||``).trim()}var qe=`onboarding@resend.dev`,Je=e=>String(e||``).trim().toLowerCase().endsWith(`@resend.dev`);function A(e){let t=String(e??``).trim(),n=t.match(/<([^<>]*)>/);if(n&&(t=n[1]),t=t.replace(/^["'\s]+|["'\s]+$/g,``),!/^[^\s@<>"',;()]+@[^\s@<>"',;()]+\.[^\s@<>"',;()]+$/.test(t))return``;let r=t.lastIndexOf(`@`);return`${t.slice(0,r)}@${t.slice(r+1).toLowerCase()}`}var Ye=e=>{let t=A(e);return t?t.slice(t.lastIndexOf(`@`)+1):``};function Xe(e){let t=String(e??``).trim().toLowerCase();return t=t.replace(/^[a-z]+:\/\//,``).replace(/[/?#].*$/,``).replace(/:\d+$/,``).replace(/\.$/,``),t.includes(`@`)&&(t=t.slice(t.lastIndexOf(`@`)+1)),t=t.replace(/^www\./,``),/^(?=.{4,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z][a-z0-9-]{0,62}[a-z0-9]$/.test(t)?t:``}function j(){let e=(process.env.ADMIN_EMAILS||process.env.VITE_ADMIN_EMAILS||``).match(/[^\s<>,;"'()]+@[^\s<>,;"'()]+/g)||[];return[...new Set(e.map(e=>A(e).toLowerCase()).filter(Boolean))]}var Ze=e=>{let[t,n]=String(e).split(`@`);return n?`${t.slice(0,1)}•••@${n}`:`•••`},Qe=15e3,$e=null;async function M(e=!1){if(!e&&$e&&Date.now()-$e.at<Qe)return $e.data;let t;try{t=await C(S(),`sys_configs`,`email`)}catch{t=$e?.data??null}return $e={at:Date.now(),data:t},t}var et=e=>e?.enabled!==!1;async function tt(){let e=await M();return{receipts:e?.receipts!==!1,saleAlerts:e?.saleAlerts!==!1}}async function nt(e,t={}){let n=await fetch(`${Ke}${e}`,{method:t.method||`GET`,headers:{Authorization:`Bearer ${k()}`,...t.body===void 0?{}:{"Content-Type":`application/json`}},...t.body===void 0?{}:{body:JSON.stringify(t.body)},signal:AbortSignal.timeout(1e4)}),r=await n.json().catch(()=>({}));return{status:n.status,body:r}}function rt(e,t){if(e>=200&&e<300)return`works`;let n=String(t?.name||``);return e===401&&n===`restricted_api_key`?`sending-only`:e===401||e===403||e===400&&/api key/i.test(String(t?.message||``))?`refused`:`unknown`}var it=e=>(Array.isArray(e?.data)?e.data:[]).map(e=>({id:String(e?.id||``),name:Xe(e?.name),status:String(e?.status||``)})).filter(e=>e.id&&e.name),at=6e4,ot=1e4,st=e=>(0,u.createHash)(`sha256`).update(e).digest(`hex`).slice(0,16),N=null,ct=null,lt=null;async function ut(e=!1){let t=k();if(!t)return{key:`refused`,domains:[]};let n=st(t);if(!e&&N&&N.mark===n){let e=N.answer.key===`unknown`?ot:at;if(Date.now()-N.at<e)return N.answer}if(lt)return lt;lt=(async()=>{let e;try{let{status:t,body:n}=await nt(`/domains?limit=100`),r=rt(t,n);e={key:r,domains:r===`works`?it(n):[]}}catch{e={key:`unknown`,domains:[]}}return e.key===`unknown`&&ct?.mark===n?e=ct.answer:e.key!==`unknown`&&(ct={mark:n,answer:e}),N={at:Date.now(),mark:n,answer:e},e})();try{return await lt}finally{lt=null}}function dt(e){let t=Xe(e?.name),n=(Array.isArray(e?.records)?e.records:[]).filter(e=>String(e?.record||``).toLowerCase()!==`tracking`).map(e=>{let n=String(e?.name||``).trim().toLowerCase().replace(/\.$/,``),r=!n||n===`@`||n===t?t:n.endsWith(`.${t}`)?n:`${n}.${t}`,i=e?.priority===void 0||e?.priority===null||e?.priority===``?null:Number(e.priority);return{record:String(e?.record||``),type:String(e?.type||``).toUpperCase(),name:r===t?`@`:r.slice(0,-(t.length+1)),fullName:r,value:String(e?.value||``),priority:Number.isFinite(i)?i:null,status:String(e?.status||``)}}).filter(e=>e.type&&e.value);return{id:String(e?.id||``),name:t,status:String(e?.status||``),records:n}}function ft(){N=null}var pt=null,mt=(e,t)=>!!t&&e.some(e=>e.name===t&&e.status===`verified`);async function ht(){let e=k(),t=A(process.env.EMAIL_FROM),n=e?await M():null,r=A(n?.from),i=Xe(n?.domain),a={from:qe,verified:!1,how:`practice`};if(!e)return t&&!Je(t)?{from:t,verified:!1,how:`env`}:a;let o=await ut(),s=st(e);if(o.key===`unknown`&&pt?.mark===s)return pt.sender;let c;if(t)c={from:t,verified:Je(t)?!1:o.key===`works`?mt(o.domains,Ye(t)):o.key!==`refused`,how:`env`};else if(o.key===`works`){let e=o.domains.filter(e=>e.status===`verified`).map(e=>e.name);c=r&&e.includes(Ye(r))?{from:r,verified:!0,how:`chosen`}:i&&e.includes(i)?{from:`hello@${i}`,verified:!0,how:`domain`}:a}else c=o.key===`sending-only`&&r&&!Je(r)?{from:r,verified:!0,how:`chosen`}:a;return o.key!==`unknown`&&(pt={mark:s,sender:c}),c}function gt(){return pt?.sender.from||A(process.env.EMAIL_FROM)||`onboarding@resend.dev`}async function _t(){return!k()||!et(await M())||(await ut()).key===`refused`?!1:(await ht()).verified}var vt=e=>e?.ownerMailWho===`me`?`me`:`admins`,yt=e=>(0,u.createHmac)(`sha256`,e).update(`your-ai-firebase owner mail v1`).digest();function bt(e,t){let n=(0,u.randomBytes)(12),r=(0,u.createCipheriv)(`aes-256-gcm`,t,n);return[`v1`,n,Buffer.concat([r.update(JSON.stringify({me:e.me,admins:e.admins}),`utf8`),r.final()]),r.getAuthTag()].map(e=>typeof e==`string`?e:e.toString(`base64url`)).join(`.`)}function xt(e,t){let n=typeof e==`string`?e.split(`.`):[];if(n.length!==4||n[0]!==`v1`)return null;try{let[e,r,i]=n.slice(1).map(e=>Buffer.from(e,`base64url`)),a=(0,u.createDecipheriv)(`aes-256-gcm`,t,e,{authTagLength:16});a.setAuthTag(i);let o=JSON.parse(Buffer.concat([a.update(r),a.final()]).toString(`utf8`));return{me:A(o?.me).toLowerCase(),admins:(Array.isArray(o?.admins)?o.admins:[]).map(e=>A(e).toLowerCase()).filter(Boolean)}}catch{return null}}var St=(e,t)=>{let n=new Set(e?.me?[e.me]:[]);return j().forEach(e=>n.add(e)),e&&t===`admins`&&e.admins.forEach(e=>n.add(e)),[...n]};async function Ct(){let e=k(),t=e?await M():null;return St(e?xt(t?.ownerMail,yt(e)):null,vt(t))}async function wt(){let e=A(process.env.EMAIL_REPLY_TO);if(e)return e;let t=k();return(t?xt((await M())?.ownerMail,yt(t)):null)?.me||j()[0]||void 0}var Tt=e=>e?.role===`admin`&&e?.inactive!==!0&&e?.removed!==!0?A(e.email).toLowerCase():``;async function Et(e,t,n){let r=yt(k()),i=await M(!0),a=xt(i?.ownerMail,r),o=e.email&&e.emailVerified?A(e.email).toLowerCase():``;o||=A((await C(S(),`user_profiles`,e.uid,t).catch(()=>null))?.email).toLowerCase();let s;try{s=(await oe(S(),`user_profiles`,t)).map(e=>Tt(e.data)).filter(Boolean)}catch{s=a?.admins||[]}o&&!s.includes(o)&&s.push(o),s=[...new Set(s)].sort();let c=j().map(e=>e.toLowerCase()),l=a?.me&&(s.includes(a.me)||c.includes(a.me))?a.me:``,u=n?o||l:l||o,d=n||vt(i);return{sealed:a&&a.me===u&&a.admins.join(`,`)===s.join(`,`)&&d===vt(i)?null:bt({me:u,admins:s},r),who:d,me:u,count:St({me:u,admins:s},d).length}}var P={"no-key":`Email is not connected yet: RESEND_KEY is not in your app’s secrets.`,off:`Email is switched off on the Email screen.`,"wrong-key":`Resend did not accept your key. Make a new one in Resend with Full access and paste it as RESEND_KEY.`,unverified:`Your domain is not verified yet, so Resend will not send from it. Check its three records on the Email screen.`,practice:`Mail still goes out from Resend’s practice address, which only reaches the address your Resend account was made with. Verify your domain on the Email screen to reach anyone else.`,"too-many":`Too many emails went out in a short time. Wait a few minutes and try again.`,unreachable:`Resend could not be reached. Try again in a moment.`,nobody:`There was nobody to send it to.`,other:`Resend would not send this email. Try again in a moment.`};function Dt(e,t){let n=String(t?.name||``),r=String(t?.message||``);return e===429?`too-many`:/testing emails|your own email address/i.test(r)?`practice`:/not verified|verify a domain/i.test(r)?`unverified`:/api.?key/i.test(n)||/api key/i.test(r)||e===401?`wrong-key`:e>=500?`unreachable`:`other`}var Ot=null;function kt(e,t){Ot={at:Date.now(),to:e.map(Ze).join(`, `),cause:t,reason:P[t]}}var At=()=>Ot;function jt(){$e=null,N=null,ct=null,lt=null,pt=null,Ot=null}var Mt=`https://api.resend.com/emails`;function Nt(){return gt()}var Pt={appName:``,logoUrl:``,appUrl:``,accent:`#7c3aed`,foreground:`#1e1b4b`,buttonText:``,buttonGradient:[],panelBg:``,panelBorder:``};function Ft(e,t){let n=String(e??``).trim();return/^#(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(n)?n:t}function It(e){let t=String(e??``).trim();return t.length>2e3||/[\s"'<>]/.test(t)?``:/^https?:\/\/[^/]+/i.test(t)?t:``}function Lt(e){return String(e??``).replace(/[\r\n\t<>]/g,` `).replace(/\s+/g,` `).trim().slice(0,60)}function Rt(e){let t=e&&typeof e==`object`?e:{},n=Array.isArray(t.buttonGradient)?t.buttonGradient.map(e=>Ft(e,``)).filter(Boolean).slice(0,2):[];return{appName:Lt(t.appName),logoUrl:It(t.logoUrl),appUrl:It(t.appUrl),accent:Ft(t.accent,Pt.accent),foreground:Ft(t.foreground,Pt.foreground),buttonText:Ft(t.buttonText,``),buttonGradient:n,panelBg:Ft(t.panelBg,``),panelBorder:Ft(t.panelBorder,``)}}function zt(e){let t=e.replace(`#`,``);if(t.length===3&&(t=t.split(``).map(e=>e+e).join(``)),t.length<6)return null;let n=parseInt(t.slice(0,6),16);return Number.isNaN(n)?null:[n>>16&255,n>>8&255,n&255]}function Bt(e,t,n=[255,255,255]){let r=zt(e);return r?`#`+r.map((e,r)=>Math.round(e+(n[r]-e)*t)).map(e=>e.toString(16).padStart(2,`0`)).join(``):e}function Vt(e){let t=zt(e);return t?(.299*t[0]+.587*t[1]+.114*t[2])/255:1}function Ht(e,t=`#1f2937`,n=`#ffffff`){return Vt(e)>.6?t:n}function Ut(e){let t=e.accent,n=Vt(e.foreground)>.55?Pt.foreground:e.foreground,r=e.buttonGradient[0]||Bt(t,.22,[0,0,0]),i=e.buttonGradient[1]||(e.buttonGradient[0]?e.buttonGradient[0]:t),a=e.panelBg||Bt(t,.94);return{accent:t,text:n,muted:`#6b7280`,faint:`#9ca3af`,g0:r,g1:i,btnFg:e.buttonText||Ht(r),panelBg:a,panelBorder:e.panelBorder||(e.panelBg?Bt(e.panelBg,.12,[0,0,0]):Bt(t,.84)),hr:Bt(t,.88)}}var F={test:{audience:`admins`,look:`notification`,kicker:`Test`,subject:`Test email from {{appName}}`,title:`{{appName}} can send email`,opener:`{{appName}} can send email`,body:`This is a test. If you are reading it, the connection works and every email your app sends will look like this one.
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./chunk-CiTBaPhY.cjs`),t=require(`./schedule-BAea6q8_.cjs`),n=require(`./bookingHold-DhS-tuuC.cjs`),r=require(`./tabAudience-2fJAN1aD.cjs`),i=require(`./soldLines-BGtA9Oub.cjs`),a=require(`./recordPrice-Cy7Km-eX.cjs`),o=require(`./appIcons-Xjk-LuQ5.cjs`),s=require(`./aiModels-DzYPysSf.cjs`);let c=require(`node:fs`);c=e.a(c,1);let l=require(`express`);l=e.a(l,1);let u=require(`node:crypto`),d=require(`stripe`);d=e.a(d,1);var f=`https://www.googleapis.com/robot/v1/metadata/x509/securetoken@system.gserviceaccount.com`,p=60;function m(e,t,n,r=Math.floor(Date.now()/1e3)){return n?e.alg===`RS256`?e.kid?t.aud===n?t.iss===`https://securetoken.google.com/${n}`?t.sub?t.sub.length>128?`Token subject is not a valid uid.`:typeof t.exp!=`number`||t.exp<=r?`Token has expired.`:typeof t.iat!=`number`||t.iat>r+p?`Token was issued in the future.`:null:`Token has no subject.`:`Token has the wrong issuer.`:`Token was issued for a different Firebase project.`:`Token has no key id.`:`Token is not signed with RS256.`:`The server does not know its Firebase project id.`}function h(e){return Buffer.from(e.replace(/-/g,`+`).replace(/_/g,`/`),`base64`)}function g(e){let t=String(e||``).split(`.`);if(t.length!==3)return null;try{return{header:JSON.parse(h(t[0]).toString(`utf8`)),claims:JSON.parse(h(t[1]).toString(`utf8`)),signed:`${t[0]}.${t[1]}`,signature:h(t[2])}}catch{return null}}var _=null,v=null;async function y(){if(_&&_.expiresAt>Date.now())return _.keys;v||=b().finally(()=>{v=null});try{return await v}catch(e){if(_)return _.keys;throw e}}async function b(){let e=await fetch(f,{signal:AbortSignal.timeout(5e3)});if(!e.ok)throw Error(`Could not fetch Google signing keys (${e.status}).`);let t=await e.json(),n=/max-age=(\d+)/.exec(e.headers.get(`cache-control`)||``);return _={keys:t,expiresAt:Date.now()+(n?Number(n[1]):3600)*1e3},t}async function x(e,t){let n=g(e);if(!n)throw Error(`That is not a valid sign-in token.`);let r=m(n.header,n.claims,t);if(r)throw Error(r);let i=(await y())[n.header.kid];if(!i)throw Error(`Token was signed with a key Google no longer publishes.`);let a=(0,u.createVerify)(`RSA-SHA256`);if(a.update(n.signed),a.end(),!a.verify(i,n.signature))throw Error(`Token signature does not check out.`);return{uid:n.claims.sub,email:n.claims.email||null,emailVerified:!!n.claims.email_verified,signInProvider:n.claims.firebase?.sign_in_provider||null}}function S(){return(process.env.VITE_FIREBASE_PROJECT_ID||process.env.FIREBASE_PROJECT_ID||``).trim()}var ee=`https://firestore.googleapis.com/v1`;function te(e){return e==null?null:`stringValue`in e?e.stringValue:`integerValue`in e?Number(e.integerValue):`doubleValue`in e?e.doubleValue:`booleanValue`in e?e.booleanValue:`timestampValue`in e?e.timestampValue:`nullValue`in e?null:`mapValue`in e?ne(e.mapValue?.fields||{}):`arrayValue`in e?(e.arrayValue?.values||[]).map(te):null}function ne(e){let t={};for(let[n,r]of Object.entries(e||{}))t[n]=te(r);return t}function re(e,t){let n=`${e}/${t}`.split(`/`);if(n.length%2!=0)return`That is not a document path.`;for(let e of n)if(!e||e===`.`||e===`..`||!/^[A-Za-z0-9_.@~+-]+$/.test(e))return`That is not a document path.`;return null}var ie=1e4;async function C(e,t,n,r){let i=re(t,n);if(i)throw Error(i);let a=`${ee}/projects/${e}/databases/(default)/documents/${t}/${n}`,o=await fetch(a,{headers:r?{Authorization:`Bearer ${r}`}:{},signal:AbortSignal.timeout(ie)});if(o.status===404)return null;if(o.status===403)throw Error(`You do not have permission to read that record.`);if(!o.ok)throw Error(`Firestore refused the read (${o.status}).`);return ne((await o.json()).fields||{})}var ae=50;async function oe(e,t,n){if(!/^[A-Za-z0-9_.@~+-]+$/.test(t)||t===`.`||t===`..`)throw Error(`That is not a collection.`);let r=[],i=``;for(let a=0;a<ae;a++){let a=`${ee}/projects/${e}/databases/(default)/documents/${t}?pageSize=300${i?`&pageToken=${encodeURIComponent(i)}`:``}`,o=await fetch(a,{headers:n?{Authorization:`Bearer ${n}`}:{},signal:AbortSignal.timeout(ie)});if(o.status===403)throw Error(`You do not have permission to read those records.`);if(!o.ok)throw Error(`Firestore refused the read (${o.status}).`);let s=await o.json();for(let e of s.documents||[])r.push({id:String(e.name||``).split(`/`).pop()||``,data:ne(e.fields||{})});let c=typeof s.nextPageToken==`string`?s.nextPageToken:``;if(!c)return r;if(c===i)break;i=c}throw Error(`There are too many records to read.`)}var se=[`email`,`Email`,`emailAddress`,`email_address`,`userEmail`,`contactEmail`,`submitterEmail`];function ce(e){let t=[];for(let n of se){let r=e[n];typeof r==`string`&&r.includes(`@`)&&t.push(r.trim())}return t}function le(e){for(let t of se){let n=e[t];if(typeof n==`string`&&n.includes(`@`))return n.trim()}return null}var ue=4320*60*1e3,de=new Set([`user`,`users`,`free`,`guest`,`guests`,`internal`,`admin`,`admins`,`public`,`owner`,`team`,`member`,`members`,`none`,`role`,`roles`]),fe=e=>typeof e==`string`&&/^[a-z][a-z0-9]{1,23}$/.test(e)&&!de.has(e),pe=e=>(0,u.createHmac)(`sha256`,e).update(`your-ai-firebase plan roles v1`).digest(`hex`),me=(e,t,n,r)=>(0,u.createHash)(`sha256`).update(`${e}:${t}:${n}:${r}`).digest(`hex`);function he(e){let t=new Map;for(let n of e){let e=Array.isArray(n?.plans)?n.plans:[];for(let n of e){let e=String(n?.roleId||``);if(fe(e))for(let r of[n?.monthly,n?.yearly])for(let n of[r?.priceId,r?.livePriceId]){let r=String(n||``).trim();r&&t.set(r,e)}}}return t}var ge=e=>he(e).size>0;function _e(e,t,n){let r=null;for(let i of e){if(!i.active||!i.priceId)continue;let e=t.get(i.priceId);if(!e)continue;let a=typeof i.currentPeriodEnd==`number`?i.currentPeriodEnd*1e3:n,o=Math.round(Math.max(a,n)+ue);(!r||o>r.until)&&(r={role:e,until:o})}return r}var ve=null;function w(){return(process.env.STRIPE_SECRET_KEY||``).trim()}function ye(){let e=w();return e?e.startsWith(`sk_live_`)?`live`:`test`:null}function T(){let e=w();if(!e)throw Error(`STRIPE_SECRET_KEY is not set.`);return ve||=new d.default(e),ve}var be=4e3,xe=null;async function Se(e=T,t=Date.now()){let n=w();if(!n)return null;xe?.key!==n&&(xe={key:n,currency:null,failedAt:null,pending:null});let r=xe;return r.currency?r.currency:r.pending?r.pending:r.failedAt!==null&&t-r.failedAt<6e4?null:(r.pending=Promise.resolve().then(()=>e().accounts.retrieveCurrent(void 0,{timeout:be,maxNetworkRetries:0})).then(e=>{let t=String(e?.default_currency||``).trim().toLowerCase();if(!/^[a-z]{3}$/.test(t))throw Error(`The account named no currency.`);return r.currency=t,r.failedAt=null,t}).catch(()=>(r.failedAt=t,null)).finally(()=>{r.pending=null}),r.pending)}async function Ce(e,t=T){return(typeof e==`string`?e.trim().toLowerCase():``)||await Se(t)||`usd`}function we(e){let t=e.currency,n=0;for(let r of Array.isArray(e.lines)?e.lines:[]){let e=Number(r?.amount),i=Number(r?.quantity);if(!Number.isFinite(e)||!Number.isInteger(i))return NaN;n+=E(e,t)*i}for(let r of Array.isArray(e.extras)?e.extras:[]){let e=Number(r?.amount);if(!Number.isFinite(e))return NaN;n+=e<0?-E(-e,t):E(e,t)}return D(n,t)}var Te=Number(process.env.STRIPE_MAX_ADHOC_AMOUNT||1e4),Ee=.5;function De(e){let{priceId:t,amount:n,mode:r=`payment`,quantity:i=1}=e||{};if(!t&&n===void 0)return`This button does not say what is being sold.`;if(t&&n!==void 0)return`A payment has either a Stripe price or an amount, not both.`;if(r!==`payment`&&r!==`subscription`)return`A payment is either one-time or a subscription.`;if(!Number.isInteger(i)||i<1||i>999)return`Quantity must be a whole number between 1 and 999.`;if(n!==void 0){if(r===`subscription`)return`A subscription needs a price created in Stripe — a typed amount cannot recur.`;if(typeof n!=`number`||!Number.isFinite(n))return`That amount is not a number.`;if(n<.5)return`The smallest amount that can be charged is ${Ee}.`;if(n>Te)return`That amount is above the ${Te} limit for typed prices. Use a price created in Stripe.`;if(!e.productName||!String(e.productName).trim())return`A typed amount needs a name for what is being bought.`}if(t&&!/^price_[A-Za-z0-9]+$/.test(t))return`That does not look like a Stripe price id.`;if(e.lines!==void 0){if(t)return`A basket of lines is charged by its amounts, not a Stripe price.`;if(!Array.isArray(e.lines)||!e.lines.length)return`The basket has no lines in it.`;if(e.lines.length>100)return`A basket can hold at most 100 lines.`;for(let t of e.lines){if(!t||typeof t!=`object`)return`A basket line is not a line.`;if(!String(t.name||``).trim())return`A basket line has no name.`;let e=Number(t.amount);if(!Number.isFinite(e)||e<0)return`A basket line has a price that is not a number.`;if(!Number.isInteger(t.quantity)||t.quantity<1||t.quantity>999)return`A basket line needs a whole quantity between 1 and 999.`;if(t.collection!==void 0&&!/^pub_[A-Za-z0-9_]{1,120}$/.test(String(t.collection)))return`A basket line names a collection that is not a public one.`}if(e.extras!==void 0&&!Array.isArray(e.extras))return`The extras on the basket are not a list.`;for(let t of e.extras||[])if(!t||typeof t!=`object`||!Number.isFinite(Number(t.amount)))return`An extra on the basket is not a number.`;if(Math.abs(we(e)-Number(n))>.011)return`The basket’s lines do not add up to its total.`}return null}var Oe=new Set([`bif`,`clp`,`djf`,`gnf`,`jpy`,`kmf`,`krw`,`mga`,`pyg`,`rwf`,`ugx`,`vnd`,`vuv`,`xaf`,`xof`,`xpf`]),ke=new Set([`bhd`,`jod`,`kwd`,`omr`,`tnd`]),Ae=e=>String(e||`usd`).toLowerCase();function E(e,t){let n=Ae(t);return Oe.has(n)?Math.round(e):ke.has(n)?Math.round(e*100)*10:Math.round(e*100)}function D(e,t){if(e==null)return null;let n=Ae(t);return Oe.has(n)?e:ke.has(n)?e/1e3:e/100}function je(e,t,n){let r=String(e||``).replace(/\/+$/,``),i=(e,t)=>{let n=String(e||t);return n.startsWith(`/`)?n:`/${n}`},a=i(t,`/payment-complete`);return{success:`${r}${a}${a.includes(`?`)?`&`:`?`}session_id={CHECKOUT_SESSION_ID}`,cancel:`${r}${i(n,`/payment-cancelled`)}`}}function Me(e){return e===`active`||e===`trialing`||e===`past_due`}var Ne=(e,t,r,i)=>(0,u.createHash)(`sha256`).update(n.d(e,t,r,i)).digest(`hex`),Pe=(e,t)=>`${e}__${String(t).replace(/[-:]/g,``).slice(0,15)}`,Fe=/^[A-Za-z0-9_-]{1,100}$/,Ie=/^cs_[A-Za-z0-9_]{1,250}$/,Le=12,O=(e,t)=>({status:e,error:t});function Re(e){if(!Array.isArray(e)||!e.length)return`Say which times are being paid for.`;if(e.length>Le)return`That is more people than one meeting can hold.`;let t=[];for(let r of e){let e=String(r?.bookingId||``),i=String(r?.scheduleId||``);if(!n.p(e)||!Fe.test(i))return`One of those times could not be read.`;if(t.some(t=>t.bookingId===e))return`The same time was named twice.`;t.push({bookingId:e,scheduleId:i})}return t}async function ze(e,t){let r=Re(e.legs);if(typeof r==`string`)return O(400,r);let i=String(e.when||``).trim().slice(0,300),a=(t.now||Date.now)(),[o,s]=await Promise.all([Promise.all(r.map(e=>t.read(`pub_bookings`,e.bookingId))),Promise.all(r.map(e=>t.read(`sys_schedules`,e.scheduleId)))]),c=-1;for(let e=0;e<r.length;e+=1){let t=o[e],i=s[e];if(!t)return O(409,`That time is no longer held for you — pick it again.`);if(!i)return O(404,`That booking link is no longer open.`);let a=String(t.memberId||``);if(!a||a!==String(i.memberId||``)||Pe(a,String(t.start||``))!==r[e].bookingId)return O(400,`That time does not belong to that booking link.`);if(i.enabled!==!0)return O(409,`This is not taking bookings at the moment.`);if(n.u(t)||t.letGo)return O(409,`That time is no longer held for you — pick it again.`);let l=n.c(t);if(c!==-1&&l!==c)return O(400,`Those times were not held together — pick them again.`);c=l}let l=c-a;if(c&&(l<21e5||l>216e5))return O(400,`The time could not be held long enough to pay. Check the date and time on this device, then try again.`);let u=n._(s.map(e=>({paymentId:String(e?.paymentId||``)})));if(!u.length)return O(400,`There is nothing to pay for this booking.`);let d=await Promise.all(u.map(e=>t.read(`sys_payments`,e))),f=e=>[...new Set(s.filter(t=>String(t?.paymentId||``)===e).map(e=>String(e?.memberName||``).trim()).filter(Boolean))].join(`, `),p=t.currency?await t.currency():`usd`,m=[],h=0;for(let e=0;e<u.length;e+=1){let t=n.g(d[e]);if(!t)return O(409,`The payment for this booking is not set up yet — ask whoever sent you the link.`);let i=f(u[e]),a=`${n.h(d[e])}${r.length>1&&i?` — ${i}`:``}`.slice(0,250),o=E(t,p);m.push({quantity:1,price_data:{currency:p,product_data:{name:a},unit_amount:o}}),h+=o}let g=D(h,p);if(h<50)return O(409,`The payment for this booking is below what can be charged by card.`);let _=s[0]||{},v=`${String(_.name||``).trim()||n.h(d[0])}${i?` — ${i}`:``}`.slice(0,450),y=e=>s.some(t=>t?.[e]!==!1)?`yes`:`no`,b=String(e.email||``).trim().slice(0,254),x=String(e.name||``).trim().slice(0,200);return{lineItems:m,metadata:{bookingId:r[0].bookingId,[n.t]:r.map(e=>e.bookingId).join(`,`).slice(0,500),...c?{[n.o]:String(c)}:{},scheduleId:r[0].scheduleId,productName:v,...i?{when:i}:{},...x?{name:x}:{},...b?{email:b}:{},emailReceipt:y(`confirmBooker`),notifyOwner:y(`notifyOwner`)},expiresAt:Math.floor((a+n.n)/1e3),total:g,currency:p,productName:v}}async function Be(e,t){try{await e.checkout.sessions.expire(t)}catch{}}var Ve=10;async function He(e,t,r){let i=Math.floor((r-n.r-10*6e4)/1e3),a=Math.ceil((r-n.i+10*6e4)/1e3),o=[],s;for(let c=0;c<Ve;c+=1){let c=await e.checkout.sessions.list({created:{gte:i,lte:a},limit:100,starting_after:s});for(let e of c.data)n.s(e.metadata).includes(t)&&n.f(e.metadata)===r&&o.push(e);if(!c.has_more||!c.data.length)break;s=c.data[c.data.length-1].id}return o}async function Ue(e,t,r){if(!n.p(e))return O(400,`That time could not be read.`);if(t&&!Ie.test(t))return O(400,`That payment could not be read.`);let i=(r.now||Date.now)(),a=await r.read(`pub_bookings`,e);if(!a)return{state:`gone`};let o=n.c(a);if(!o||n.u(a))return{state:`kept`};let s=r.stripe();if(t){let r=await s.checkout.sessions.retrieve(t),i=r.metadata||{};if(!n.s(i).includes(e)||n.f(i)!==o)return O(404,`That payment is not for this time.`);r.status===`open`&&await Be(s,t)}let c=await He(s,e,o);if(c.some(e=>e.status===`complete`))return{state:`paid`,pass:Ne(r.key(),e,o,`paid`)};let l=c.filter(e=>e.status===`open`&&e.id!==t);if(l.length){if(i<o)return{state:`open`};for(let e of l)await Be(s,e.id)}return!c.length&&i<o?{state:`open`}:{state:`free`,pass:Ne(r.key(),e,o,`free`)}}function We(e,t){if(e.status!==`complete`||!t)return{};let r=e.metadata||{},i=n.f(r);if(!i)return{};let a={};for(let e of n.s(r))a[e]=Ne(t,e,i,`paid`);return a}function Ge(e,t){e.post(`/payments/booking-checkout`,async(e,n)=>{let r=e.body||{},i=await t.paymentsOff()||await t.limited(e);if(i)return t.fail(n,i.status,i.error);let a=await t.origin(e,r.origin);if(!a)return t.fail(n,400,`The page did not say where to send the payer back to.`);try{let i=await ze(r,t);if(`error`in i)return t.fail(n,i.status,i.error);let{uid:o,...s}=await t.payer(e,i.metadata),c=String(r.successPath||``).split(`?`)[0].slice(0,200),l={...i.metadata,...c?{page:c}:{},...o?{uid:o}:{}};t.stamp(l);let u=t.returnUrls(a,String(r.successPath||``),String(r.cancelPath||``)),d={mode:`payment`,line_items:i.lineItems,success_url:u.success,cancel_url:u.cancel,expires_at:i.expiresAt,allow_promotion_codes:!0,...s,metadata:l,payment_intent_data:{metadata:l,description:i.productName}},f=t.stripe(),p=await f.checkout.sessions.create(d).catch(e=>{if(!d.customer_email||e?.param!==`customer_email`)throw e;return f.checkout.sessions.create({...d,customer_email:void 0})});return n.json({success:!0,sessionId:p.id,url:p.url,amount:i.total,currency:i.currency})}catch(e){return t.sendError(n,e)}}),e.post(`/payments/booking-hold`,async(e,n)=>{let r=e.body||{},i=await t.holdLimited(e);if(i)return t.fail(n,i.status,i.error);try{let e=await Ue(String(r.bookingId||``),String(r.sessionId||``),t);return`error`in e?t.fail(n,e.status,e.error):n.json({success:!0,...e})}catch(e){return t.sendError(n,e)}})}var Ke=`https://api.resend.com`;function k(){return(process.env.RESEND_KEY||process.env.RESEND_API_KEY||``).trim()}var qe=`onboarding@resend.dev`,Je=e=>String(e||``).trim().toLowerCase().endsWith(`@resend.dev`);function A(e){let t=String(e??``).trim(),n=t.match(/<([^<>]*)>/);if(n&&(t=n[1]),t=t.replace(/^["'\s]+|["'\s]+$/g,``),!/^[^\s@<>"',;()]+@[^\s@<>"',;()]+\.[^\s@<>"',;()]+$/.test(t))return``;let r=t.lastIndexOf(`@`);return`${t.slice(0,r)}@${t.slice(r+1).toLowerCase()}`}var Ye=e=>{let t=A(e);return t?t.slice(t.lastIndexOf(`@`)+1):``};function Xe(e){let t=String(e??``).trim().toLowerCase();return t=t.replace(/^[a-z]+:\/\//,``).replace(/[/?#].*$/,``).replace(/:\d+$/,``).replace(/\.$/,``),t.includes(`@`)&&(t=t.slice(t.lastIndexOf(`@`)+1)),t=t.replace(/^www\./,``),/^(?=.{4,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z][a-z0-9-]{0,62}[a-z0-9]$/.test(t)?t:``}function j(){let e=(process.env.ADMIN_EMAILS||process.env.VITE_ADMIN_EMAILS||``).match(/[^\s<>,;"'()]+@[^\s<>,;"'()]+/g)||[];return[...new Set(e.map(e=>A(e).toLowerCase()).filter(Boolean))]}var Ze=e=>{let[t,n]=String(e).split(`@`);return n?`${t.slice(0,1)}•••@${n}`:`•••`},Qe=15e3,$e=null;async function M(e=!1){if(!e&&$e&&Date.now()-$e.at<Qe)return $e.data;let t;try{t=await C(S(),`sys_configs`,`email`)}catch{t=$e?.data??null}return $e={at:Date.now(),data:t},t}var et=e=>e?.enabled!==!1;async function tt(){let e=await M();return{receipts:e?.receipts!==!1,saleAlerts:e?.saleAlerts!==!1}}async function nt(e,t={}){let n=await fetch(`${Ke}${e}`,{method:t.method||`GET`,headers:{Authorization:`Bearer ${k()}`,...t.body===void 0?{}:{"Content-Type":`application/json`}},...t.body===void 0?{}:{body:JSON.stringify(t.body)},signal:AbortSignal.timeout(1e4)}),r=await n.json().catch(()=>({}));return{status:n.status,body:r}}function rt(e,t){if(e>=200&&e<300)return`works`;let n=String(t?.name||``);return e===401&&n===`restricted_api_key`?`sending-only`:e===401||e===403||e===400&&/api key/i.test(String(t?.message||``))?`refused`:`unknown`}var it=e=>(Array.isArray(e?.data)?e.data:[]).map(e=>({id:String(e?.id||``),name:Xe(e?.name),status:String(e?.status||``)})).filter(e=>e.id&&e.name),at=6e4,ot=1e4,st=e=>(0,u.createHash)(`sha256`).update(e).digest(`hex`).slice(0,16),N=null,ct=null,lt=null;async function ut(e=!1){let t=k();if(!t)return{key:`refused`,domains:[]};let n=st(t);if(!e&&N&&N.mark===n){let e=N.answer.key===`unknown`?ot:at;if(Date.now()-N.at<e)return N.answer}if(lt)return lt;lt=(async()=>{let e;try{let{status:t,body:n}=await nt(`/domains?limit=100`),r=rt(t,n);e={key:r,domains:r===`works`?it(n):[]}}catch{e={key:`unknown`,domains:[]}}return e.key===`unknown`&&ct?.mark===n?e=ct.answer:e.key!==`unknown`&&(ct={mark:n,answer:e}),N={at:Date.now(),mark:n,answer:e},e})();try{return await lt}finally{lt=null}}function dt(e){let t=Xe(e?.name),n=(Array.isArray(e?.records)?e.records:[]).filter(e=>String(e?.record||``).toLowerCase()!==`tracking`).map(e=>{let n=String(e?.name||``).trim().toLowerCase().replace(/\.$/,``),r=!n||n===`@`||n===t?t:n.endsWith(`.${t}`)?n:`${n}.${t}`,i=e?.priority===void 0||e?.priority===null||e?.priority===``?null:Number(e.priority);return{record:String(e?.record||``),type:String(e?.type||``).toUpperCase(),name:r===t?`@`:r.slice(0,-(t.length+1)),fullName:r,value:String(e?.value||``),priority:Number.isFinite(i)?i:null,status:String(e?.status||``)}}).filter(e=>e.type&&e.value);return{id:String(e?.id||``),name:t,status:String(e?.status||``),records:n}}function ft(){N=null}var pt=null,mt=(e,t)=>!!t&&e.some(e=>e.name===t&&e.status===`verified`);async function ht(){let e=k(),t=A(process.env.EMAIL_FROM),n=e?await M():null,r=A(n?.from),i=Xe(n?.domain),a={from:qe,verified:!1,how:`practice`};if(!e)return t&&!Je(t)?{from:t,verified:!1,how:`env`}:a;let o=await ut(),s=st(e);if(o.key===`unknown`&&pt?.mark===s)return pt.sender;let c;if(t)c={from:t,verified:Je(t)?!1:o.key===`works`?mt(o.domains,Ye(t)):o.key!==`refused`,how:`env`};else if(o.key===`works`){let e=o.domains.filter(e=>e.status===`verified`).map(e=>e.name);c=r&&e.includes(Ye(r))?{from:r,verified:!0,how:`chosen`}:i&&e.includes(i)?{from:`hello@${i}`,verified:!0,how:`domain`}:a}else c=o.key===`sending-only`&&r&&!Je(r)?{from:r,verified:!0,how:`chosen`}:a;return o.key!==`unknown`&&(pt={mark:s,sender:c}),c}function gt(){return pt?.sender.from||A(process.env.EMAIL_FROM)||`onboarding@resend.dev`}async function _t(){return!k()||!et(await M())||(await ut()).key===`refused`?!1:(await ht()).verified}var vt=e=>e?.ownerMailWho===`me`?`me`:`admins`,yt=e=>(0,u.createHmac)(`sha256`,e).update(`your-ai-firebase owner mail v1`).digest();function bt(e,t){let n=(0,u.randomBytes)(12),r=(0,u.createCipheriv)(`aes-256-gcm`,t,n);return[`v1`,n,Buffer.concat([r.update(JSON.stringify({me:e.me,admins:e.admins}),`utf8`),r.final()]),r.getAuthTag()].map(e=>typeof e==`string`?e:e.toString(`base64url`)).join(`.`)}function xt(e,t){let n=typeof e==`string`?e.split(`.`):[];if(n.length!==4||n[0]!==`v1`)return null;try{let[e,r,i]=n.slice(1).map(e=>Buffer.from(e,`base64url`)),a=(0,u.createDecipheriv)(`aes-256-gcm`,t,e,{authTagLength:16});a.setAuthTag(i);let o=JSON.parse(Buffer.concat([a.update(r),a.final()]).toString(`utf8`));return{me:A(o?.me).toLowerCase(),admins:(Array.isArray(o?.admins)?o.admins:[]).map(e=>A(e).toLowerCase()).filter(Boolean)}}catch{return null}}var St=(e,t)=>{let n=new Set(e?.me?[e.me]:[]);return j().forEach(e=>n.add(e)),e&&t===`admins`&&e.admins.forEach(e=>n.add(e)),[...n]};async function Ct(){let e=k(),t=e?await M():null;return St(e?xt(t?.ownerMail,yt(e)):null,vt(t))}async function wt(){let e=A(process.env.EMAIL_REPLY_TO);if(e)return e;let t=k();return(t?xt((await M())?.ownerMail,yt(t)):null)?.me||j()[0]||void 0}var Tt=e=>e?.role===`admin`&&e?.inactive!==!0&&e?.removed!==!0?A(e.email).toLowerCase():``;async function Et(e,t,n){let r=yt(k()),i=await M(!0),a=xt(i?.ownerMail,r),o=e.email&&e.emailVerified?A(e.email).toLowerCase():``;o||=A((await C(S(),`user_profiles`,e.uid,t).catch(()=>null))?.email).toLowerCase();let s;try{s=(await oe(S(),`user_profiles`,t)).map(e=>Tt(e.data)).filter(Boolean)}catch{s=a?.admins||[]}o&&!s.includes(o)&&s.push(o),s=[...new Set(s)].sort();let c=j().map(e=>e.toLowerCase()),l=a?.me&&(s.includes(a.me)||c.includes(a.me))?a.me:``,u=n?o||l:l||o,d=n||vt(i);return{sealed:a&&a.me===u&&a.admins.join(`,`)===s.join(`,`)&&d===vt(i)?null:bt({me:u,admins:s},r),who:d,me:u,count:St({me:u,admins:s},d).length}}var P={"no-key":`Email is not connected yet: RESEND_KEY is not in your app’s secrets.`,off:`Email is switched off on the Email screen.`,"wrong-key":`Resend did not accept your key. Make a new one in Resend with Full access and paste it as RESEND_KEY.`,unverified:`Your domain is not verified yet, so Resend will not send from it. Check its three records on the Email screen.`,practice:`Mail still goes out from Resend’s practice address, which only reaches the address your Resend account was made with. Verify your domain on the Email screen to reach anyone else.`,"too-many":`Too many emails went out in a short time. Wait a few minutes and try again.`,unreachable:`Resend could not be reached. Try again in a moment.`,nobody:`There was nobody to send it to.`,other:`Resend would not send this email. Try again in a moment.`};function Dt(e,t){let n=String(t?.name||``),r=String(t?.message||``);return e===429?`too-many`:/testing emails|your own email address/i.test(r)?`practice`:/not verified|verify a domain/i.test(r)?`unverified`:/api.?key/i.test(n)||/api key/i.test(r)||e===401?`wrong-key`:e>=500?`unreachable`:`other`}var Ot=null;function kt(e,t){Ot={at:Date.now(),to:e.map(Ze).join(`, `),cause:t,reason:P[t]}}var At=()=>Ot;function jt(){$e=null,N=null,ct=null,lt=null,pt=null,Ot=null}var Mt=`https://api.resend.com/emails`;function Nt(){return gt()}var Pt={appName:``,logoUrl:``,appUrl:``,accent:`#7c3aed`,foreground:`#1e1b4b`,buttonText:``,buttonGradient:[],panelBg:``,panelBorder:``};function Ft(e,t){let n=String(e??``).trim();return/^#(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(n)?n:t}function It(e){let t=String(e??``).trim();return t.length>2e3||/[\s"'<>]/.test(t)?``:/^https?:\/\/[^/]+/i.test(t)?t:``}function Lt(e){return String(e??``).replace(/[\r\n\t<>]/g,` `).replace(/\s+/g,` `).trim().slice(0,60)}function Rt(e){let t=e&&typeof e==`object`?e:{},n=Array.isArray(t.buttonGradient)?t.buttonGradient.map(e=>Ft(e,``)).filter(Boolean).slice(0,2):[];return{appName:Lt(t.appName),logoUrl:It(t.logoUrl),appUrl:It(t.appUrl),accent:Ft(t.accent,Pt.accent),foreground:Ft(t.foreground,Pt.foreground),buttonText:Ft(t.buttonText,``),buttonGradient:n,panelBg:Ft(t.panelBg,``),panelBorder:Ft(t.panelBorder,``)}}function zt(e){let t=e.replace(`#`,``);if(t.length===3&&(t=t.split(``).map(e=>e+e).join(``)),t.length<6)return null;let n=parseInt(t.slice(0,6),16);return Number.isNaN(n)?null:[n>>16&255,n>>8&255,n&255]}function Bt(e,t,n=[255,255,255]){let r=zt(e);return r?`#`+r.map((e,r)=>Math.round(e+(n[r]-e)*t)).map(e=>e.toString(16).padStart(2,`0`)).join(``):e}function Vt(e){let t=zt(e);return t?(.299*t[0]+.587*t[1]+.114*t[2])/255:1}function Ht(e,t=`#1f2937`,n=`#ffffff`){return Vt(e)>.6?t:n}function Ut(e){let t=e.accent,n=Vt(e.foreground)>.55?Pt.foreground:e.foreground,r=e.buttonGradient[0]||Bt(t,.22,[0,0,0]),i=e.buttonGradient[1]||(e.buttonGradient[0]?e.buttonGradient[0]:t),a=e.panelBg||Bt(t,.94);return{accent:t,text:n,muted:`#6b7280`,faint:`#9ca3af`,g0:r,g1:i,btnFg:e.buttonText||Ht(r),panelBg:a,panelBorder:e.panelBorder||(e.panelBg?Bt(e.panelBg,.12,[0,0,0]):Bt(t,.84)),hr:Bt(t,.88)}}var F={test:{audience:`admins`,look:`notification`,kicker:`Test`,subject:`Test email from {{appName}}`,title:`{{appName}} can send email`,opener:`{{appName}} can send email`,body:`This is a test. If you are reading it, the connection works and every email your app sends will look like this one.
2
2
 
3
3
  Sent {{now}}.`,button:{label:`Open the app`},description:`Proves the connection works. Goes to whoever pressed Send yourself a test email.`},new_submission:{audience:`admins`,look:`notification`,kicker:`New form entry`,subject:`New {{formName}} submission`,title:`Someone filled in {{formName}}`,opener:`Someone filled in {{formName}}`,body:`{{summary}}`,facts:[[`Name`,`{{name}}`],[`Email`,`{{email}}`]],button:{label:`Open the inbox`,path:`/inbox`},description:`Lets you know someone filled in a form.`},submission_received:{audience:`record`,look:`text`,kicker:`Received`,subject:`We got your message`,title:`We got your message`,greeting:`Hi {{name}},`,body:`{{note}}`,stock:`Thanks for getting in touch — we have your message and will come back to you shortly.`,description:`Tells the person who wrote in that their message arrived.`},booking_requested:{audience:`record`,look:`text`,kicker:`Requested`,subject:`We have your booking request — {{when}}`,title:`Your booking request is in`,greeting:`Hi {{name}},`,body:`You asked for {{when}} with {{memberName}}. The time is held for you while it is confirmed — we will let you know as soon as it is.`,facts:[[`When`,`{{when}}`],[`With`,`{{memberName}}`],[`What`,`{{scheduleName}}`]],description:`Tells the person who booked that the request is in and the time is held.`},booking_confirmed:{audience:`record`,look:`text`,kicker:`Booked`,subject:`Your booking is confirmed — {{when}}`,title:`Your booking is confirmed`,greeting:`Hi {{name}},`,body:`Your time is booked: {{when}} with {{memberName}}. We look forward to seeing you.`,facts:[[`When`,`{{when}}`],[`With`,`{{memberName}}`],[`What`,`{{scheduleName}}`]],description:`Tells the person who booked that the time is theirs.`},booking_cancelled:{audience:`record`,look:`text`,kicker:`Cancelled`,subject:`Your booking was cancelled — {{when}}`,title:`Your booking was cancelled`,greeting:`Hi {{name}},`,body:`{{when}} with {{memberName}} is no longer going ahead.
4
4
 
package/dist/server.es.js CHANGED
@@ -3,7 +3,7 @@ import { _ as l, c as u, d, f, g as p, h as m, i as h, n as g, o as _, p as v, r
3
3
  import { a as te, t as ne } from "./tabAudience-DJ6H5Uth.js";
4
4
  import { a as re, o as ie, r as ae, t as oe } from "./soldLines-Ci-FLIrS.js";
5
5
  import { t as se } from "./recordPrice-C4nFKZLy.js";
6
- import { a as ce, g as le, m as ue, o as de, t as fe, v as pe, y as me } from "./appIcons-CCArfCDe.js";
6
+ import { a as ce, g as le, m as ue, o as de, t as fe, v as pe, y as me } from "./appIcons-DfjKL0tw.js";
7
7
  import { a as he, c as ge, i as _e, l as ve, n as ye, o as be, r as xe, s as Se, t as Ce } from "./aiModels-DuNFHWRS.js";
8
8
  import * as we from "node:fs";
9
9
  import Te from "express";
package/dist/vite.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./chunk-CiTBaPhY.cjs`),t=require(`./appIcons-C90OKlV5.cjs`);let n=require(`node:fs`);n=e.a(n,1);let r=require(`node:path`);r=e.a(r,1);var i=`// OWNED BY YOUR AI FIREBASE — edits to this file are discarded by the build.`,a=`virtual:your-ai-firebase/registries`,o=`${i}
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./chunk-CiTBaPhY.cjs`),t=require(`./appIcons-Xjk-LuQ5.cjs`);let n=require(`node:fs`);n=e.a(n,1);let r=require(`node:path`);r=e.a(r,1);var i=`// OWNED BY YOUR AI FIREBASE — edits to this file are discarded by the build.`,a=`virtual:your-ai-firebase/registries`,o=`${i}
2
2
  import { lazy, type ComponentType } from 'react';
3
3
  import { FirebaseOS } from 'your-ai-workflow-firebase-os';
4
4
 
package/dist/vite.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { C as e, D as t, E as n, S as r, T as i, _ as a, a as o, b as s, c, d as l, f as u, g as d, h as f, i as p, l as m, m as h, n as g, p as _, r as v, s as y, t as b, u as x, v as S, w as C, x as w, y as T } from "./appIcons-CCArfCDe.js";
1
+ import { C as e, D as t, E as n, S as r, T as i, _ as a, a as o, b as s, c, d as l, f as u, g as d, h as f, i as p, l as m, m as h, n as g, p as _, r as v, s as y, t as b, u as x, v as S, w as C, x as w, y as T } from "./appIcons-DfjKL0tw.js";
2
2
  import * as E from "node:fs";
3
3
  import * as D from "node:path";
4
4
  //#region src/vite/canonical.ts