@powerportalspro/react-calendar 12.0.0 → 13.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/appointment-click.ts","../src/calendar-context.tsx","../src/recurrence-pattern.ts","../src/recurrence-edit.tsx","../src/appointment-details.tsx","../src/core/styles.ts","../src/core/events.ts","../src/core/options.ts","../src/core/state.ts","../src/core/new-appointment.ts","../src/core/summary.ts","../src/appointment-tooltip.tsx","../src/appointment-record.ts","../src/calendar-rows.ts","../src/calendar-query.ts","../../../node_modules/.pnpm/@fullcalendar+react@7.1.3_react-dom@19.2.5_react@19.2.5__react@19.2.5_temporal-polyfill@1.0.6/node_modules/@fullcalendar/react/skeleton.css","../../../node_modules/.pnpm/@fullcalendar+react@7.1.3_react-dom@19.2.5_react@19.2.5__react@19.2.5_temporal-polyfill@1.0.6/node_modules/@fullcalendar/react/themes/forma/theme.css","../src/fullcalendar-styles.ts","../src/persisted-calendar-state.ts","../src/calendar.tsx","../src/calendar-button.tsx"],"names":["createContext","useContext","makeStyles","tokens","usePrefixedT","useId","useRef","useEffect","jsxs","jsx","Field","Dropdown","Option","Fragment","SpinButton","Text","Checkbox","ToggleButton","RadioGroup","Radio","Input","useStyles","newAppointment","useT","RecordDialogShell","RecordContext","RecordDialogFrame","SaveContextButton","Button","Dialog","DialogSurface","DialogBody","DialogTitle","DialogContent","DialogActions","usePowerPortalsPro","useState","TableSecurityPermission","useRecordContext","useDialogService","useRunWithOverlay","DeleteContextButton","Menu","MenuTrigger","ChevronDownRegular","MenuPopover","MenuList","MenuItem","useLocalization","useLocalizationLoaded","QueryStatus","ArrowRepeatAllRegular","ColumnEdit","StatusReasonEdit","MessageBar","MessageBarBody","Spinner","useUserTimeZone","useMainContext","getRecordReferenceId","document","Tooltip","SERIES_TABLE","MINUTE_MS","DAY_MS","valueOf","stored","defaultViewId","isViewHidden","STYLE_ID","DATE","GUID","formaTheme","dayGridPlugin","timeGridPlugin","listPlugin","interactionPlugin","ViewSort","useLocale","useCalendarController","useThemeClassName","useMemo","savedViewControl","SavedViewControlKind","useSavedViews","useMultiTableViews","known","view","options","useCallback","MultiTableViewType","tables","multiTableFilterQueries","multiTableFilterTabs","dialog","applyMultiTableFilter","userDefaultViewId","shownViewTables","Toolbar","mergeClasses","ToolbarButton","ChevronRightRegular","ChevronLeftRegular","MenuButton","MenuItemRadio","SearchBox","ViewFilterMenu","ArrowClockwiseRegular","GridSaveViewDialog","GridManageViewsPanel","MultiTableFilterDialog","MessageBarActions","FullCalendar","MultiTableRecordPanel","series","AddRegular"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,IAAM,IAAA,GAAO,iEAAA;AAON,SAAS,iBAAA,CACd,OACA,gBAAA,EACwB;AACxB,EAAA,IAAI,oBAAoB,CAAC,IAAA,CAAK,KAAK,KAAA,CAAM,EAAE,GAAG,OAAO,IAAA;AACrD,EAAA,OAAO,EAAE,EAAA,EAAI,KAAA,CAAM,EAAA,EAAI,OAAA,EAAS,KAAA,CAAM,KAAA,EAAO,SAAA,EAAW,OAAA,CAAQ,KAAA,CAAM,aAAA,CAAc,WAAW,CAAC,CAAA,EAAE;AACpG;ACgBO,IAAM,eAAA,GAAkBA,oBAA2C,IAAI,CAAA;AAGvE,SAAS,kBAAA,GAA2C;AACzD,EAAA,MAAM,OAAA,GAAUC,iBAAW,eAAe,CAAA;AAC1C,EAAA,IAAI,CAAC,OAAA,EAAS,MAAM,IAAI,MAAM,2EAA2E,CAAA;AACzG,EAAA,OAAO,OAAA;AACT;;;AC9CO,IAAM,mBAAA,GAAsB;AAAA,EACjC,KAAA,EAAO,CAAA;AAAA,EACP,MAAA,EAAQ,CAAA;AAAA,EACR,OAAA,EAAS,CAAA;AAAA,EACT,MAAA,EAAQ;AACV,CAAA;AAIO,IAAM,aAAA,GAAgB;AAAA;AAAA,EAE3B,KAAA,EAAO,CAAA;AAAA,EACP,gBAAA,EAA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AAEJ;AAoBO,SAAS,4BAAA,CAA6B;AAAA,EAC3C,KAAA;AAAA,EACA,IAAA;AAAA,EACA,OAAA;AAAA,EACA,UAAA,GAAa;AACf,CAAA,EAAsC;AACpC,EAAA,MAAM,WAAW,kBAAA,EAAmB;AACpC,EAAA,MAAM,IAAItC,YAAAA,EAAK;AACf,EAAA,IAAI,CAAC,QAAA,CAAS,qBAAA,EAAuB,OAAO,IAAA;AAC5C,EAAA,uBACEd,cAAAA;AAAA,IAAC,cAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAU,kBAAA;AAAA,MACV,KAAA,EAAO,KAAA,IAAS,CAAA,CAAE,uBAAuB,CAAA;AAAA,MACzC,IAAA,EAAM,IAAA,oBAAQA,cAAAA,CAAC0G,qBAAA,EAAA,EAAW,CAAA;AAAA,MAC1B,UAAA;AAAA,MACC,GAAI,OAAA,KAAY,MAAA,IAAa,EAAE,OAAA,EAAQ;AAAA,MACxC,OAAA,EAAS,CAAC,OAAA,KAAY,OAAA,CAAQ,iBAAA;AAAkB;AAAA,GAClD;AAEJ","file":"index.cjs","sourcesContent":["// Which clicks on an appointment open its details. Framework-free.\n\n/**\n * The appointment a details dialog is open on: what the calendar drew of it. An occurrence carries\n * the series it is of; a series opens as one (`isSeries`), its `id` the series'.\n */\nexport interface OpenAppointment {\n id: string;\n subject: string;\n recurring: boolean;\n seriesId?: string | null;\n isSeries?: boolean;\n}\n\nconst GUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\n/**\n * The appointment a click on an event opens the details of, or null for none: appointments the\n * host gives the calendar are the host's to show, and an event that isn't a Dataverse record has\n * none to read. The Blazor Calendar's OnAppointmentClickAsync is its twin.\n */\nexport function appointmentToOpen(\n event: { id: string; title: string; extendedProps: Record<string, unknown> },\n hostAppointments: boolean,\n): OpenAppointment | null {\n if (hostAppointments || !GUID.test(event.id)) return null;\n return { id: event.id, subject: event.title, recurring: Boolean(event.extendedProps['recurring']) };\n}\n","import type { TableRecordReference } from '@powerportalspro/core';\nimport { createContext, useContext } from 'react';\nimport type { CalendarLayout } from './core/index.js';\n\n/** A time to start a new appointment over: what selecting a range in the calendar gives. */\nexport interface CalendarRange {\n start: Date;\n end: Date;\n allDay: boolean;\n}\n\n/**\n * A `<Calendar>` as a control in its toolbar sees it: the period it shows, the record it is about,\n * and what it can be asked to do. Read it with {@link useCalendarContext}; a `<CalendarButton>`\n * hands it to its click. The Blazor `CalendarContext` is its twin.\n */\nexport interface CalendarContextValue {\n /** The layout shown. */\n layout: CalendarLayout;\n /** The first moment shown; undefined until the calendar has drawn. */\n start: Date | undefined;\n /** The moment after the last one shown; undefined until the calendar has drawn. */\n end: Date | undefined;\n /** The record the calendar is about: its `regarding`. */\n regarding: TableRecordReference | undefined;\n /**\n * Whether {@link createAppointment} has something to start: an `editable` calendar whose host\n * handles `onRangeSelect`, or that loads its own appointments for a user who may create them.\n * False until that is known.\n */\n canCreateAppointments: boolean;\n /**\n * Starts a new appointment, as selecting a time does in an `editable` calendar: the host's to\n * handle when it handles `onRangeSelect`; otherwise, in a calendar that loads its own\n * appointments, a form to create one, when the user may. Without a range, the appointment starts\n * at the next half hour when the period shown takes in today, and otherwise at 8:00 on its first\n * day, and lasts half an hour. Does nothing unless the calendar is `editable`.\n */\n createAppointment: (range?: CalendarRange) => Promise<void>;\n /** Reads the appointments of the range shown again. */\n refresh: () => void;\n}\n\nexport const CalendarContext = createContext<CalendarContextValue | null>(null);\n\n/** The calendar a control in its toolbar sits in. Throws outside a `<Calendar>`'s toolbar. */\nexport function useCalendarContext(): CalendarContextValue {\n const context = useContext(CalendarContext);\n if (!context) throw new Error('useCalendarContext must be used in a <Calendar>, among its toolbar items.');\n return context;\n}\n","// How an appointment series repeats, as a recurringappointmentmaster holds it. Framework-free.\nimport type { TableRecord } from '@powerportalspro/core';\n\n/** How often a series repeats: Dataverse's `recurrencepatterntype`. */\nexport const RecurrenceFrequency = {\n Daily: 0,\n Weekly: 1,\n Monthly: 2,\n Yearly: 3,\n} as const;\nexport type RecurrenceFrequency = (typeof RecurrenceFrequency)[keyof typeof RecurrenceFrequency];\n\n/** How a series ends: Dataverse's `patternendtype`. */\nexport const RecurrenceEnd = {\n /** Never: Dataverse adds occurrences up to a year ahead, and more as time passes. */\n Never: 1,\n AfterOccurrences: 2,\n /** On a date, its last occurrence on or before it. */\n OnDate: 3,\n} as const;\nexport type RecurrenceEnd = (typeof RecurrenceEnd)[keyof typeof RecurrenceEnd];\n\n/** Days of the week, as Dataverse's `daysofweekmask` holds them: Sunday 1, Monday 2 … Saturday 64. */\nexport const RecurrenceDays = {\n Sunday: 1,\n Monday: 2,\n Tuesday: 4,\n Wednesday: 8,\n Thursday: 16,\n Friday: 32,\n Saturday: 64,\n} as const;\n\n/** A yes-or-no column's value, as a record carries it. */\nexport function boolColumn(value: boolean): { $type: number; value: boolean } {\n return { $type: BOOL, value };\n}\n\n/** The table a series is a record of. */\nexport const SERIES_TABLE = 'recurringappointmentmaster';\n\n// The columns only some shapes of pattern use, cleared from a series changing to one that doesn't.\nconst SHAPE_COLUMNS = ['daysofweekmask', 'dayofmonth', 'instance', 'monthofyear', 'occurrences', 'patternenddate'];\n\n// A weekday pattern's days: Monday to Friday.\nconst WEEKDAYS = 62;\n// The `instance` Dataverse names the last week of a month by.\nconst LAST_INSTANCE = 5;\n\n// The wire discriminators of the values a series is written with (ColumnType's numbers).\nconst BOOL = 0;\nconst DATE = 2;\nconst INT = 5;\nconst CHOICE = 11;\n\n/**\n * How a series repeats. What depends on the day it starts — the day of the month, the month, which\n * week of it — is taken from that day rather than chosen apart from it, as Outlook offers it. The\n * Blazor Calendar's `RecurrencePattern` is its twin.\n */\nexport interface RecurrencePattern {\n frequency: RecurrenceFrequency;\n /** Every how many days, weeks, months or years: one or more. */\n interval: number;\n /**\n * For a daily series, on weekdays only, every week — as Dataverse keeps it, a weekly series on\n * Monday to Friday, which takes no interval.\n */\n weekdaysOnly: boolean;\n /** For a weekly series, the days it falls on, as a `RecurrenceDays` mask. */\n days: number;\n /** For a monthly or yearly series, on the start's weekday in its week of the month rather than its date. */\n byWeekday: boolean;\n end: RecurrenceEnd;\n /** How many times it takes place, when it ends after a number of occurrences. */\n occurrences: number;\n /** The day it ends on (`yyyy-mm-dd`), when it ends on a date. */\n endDate: string | null;\n}\n\n/** A day as a time zone has it: its date, and its day of the week (0 for Sunday). */\nexport interface LocalDay {\n year: number;\n month: number;\n day: number;\n weekday: number;\n}\n\n/** The day an instant falls on in a time zone, or the browser's. */\nexport function localDay(instant: Date, timeZone?: string): LocalDay {\n const { year, month, day } = zonedParts(instant, timeZone);\n return { year, month, day, weekday: new Date(Date.UTC(year, month - 1, day)).getUTCDay() };\n}\n\n/** The day of the week as a `RecurrenceDays` flag. */\nexport function dayOf(weekday: number): number {\n return 1 << weekday;\n}\n\n/** A series repeating as `frequency` says from `start`: a weekly one on its day of the week. */\nexport function startingPattern(frequency: RecurrenceFrequency, start: LocalDay): RecurrencePattern {\n return {\n frequency,\n interval: 1,\n weekdaysOnly: false,\n days: dayOf(start.weekday),\n byWeekday: false,\n end: RecurrenceEnd.Never,\n occurrences: 10,\n endDate: null,\n };\n}\n\n/** Which week of its month a day is in: 1 to 4, or 5 for one in the month's last seven days. */\nexport function instanceOf(day: LocalDay): number {\n const daysInMonth = new Date(Date.UTC(day.year, day.month, 0)).getUTCDate();\n return day.day + 7 > daysInMonth ? LAST_INSTANCE : Math.floor((day.day - 1) / 7) + 1;\n}\n\n/**\n * The pattern's columns for a series running from `start` to `end`, in the user's `timeZone`: what\n * it repeats on, its times, and the day it starts — as a moment, that day's midnight in the zone,\n * since Dataverse reads the day in the series' zone. For a series that had another shape\n * (`existing`), the columns of that one this one doesn't use are cleared (null), so Dataverse doesn't\n * read them into this one.\n */\nexport function seriesColumns(\n pattern: RecurrencePattern,\n start: Date,\n end: Date,\n timeZone?: string,\n existing?: TableRecord,\n): Record<string, { $type: number; value: unknown } | null> {\n const local = localDay(start, timeZone);\n const day = dayOf(local.weekday);\n const weekdaysOnly = pattern.frequency === RecurrenceFrequency.Daily && pattern.weekdaysOnly;\n const yearlyOrMonthly =\n pattern.frequency === RecurrenceFrequency.Monthly || pattern.frequency === RecurrenceFrequency.Yearly;\n const byWeekday = yearlyOrMonthly && pattern.byWeekday;\n\n // Every weekday is, to Dataverse, a weekly series on Monday to Friday marked as the weekday\n // pattern: a daily one can't be limited to weekdays.\n const columns: Record<string, { $type: number; value: unknown }> = {\n recurrencepatterntype: { $type: CHOICE, value: weekdaysOnly ? RecurrenceFrequency.Weekly : pattern.frequency },\n interval: { $type: INT, value: weekdaysOnly ? 1 : Math.max(1, pattern.interval) },\n starttime: { $type: DATE, value: start.toISOString() },\n endtime: { $type: DATE, value: end.toISOString() },\n patternstartdate: { $type: DATE, value: midnight(local, timeZone).toISOString() },\n isweekdaypattern: { $type: BOOL, value: weekdaysOnly },\n isnthmonthly: { $type: BOOL, value: byWeekday && pattern.frequency === RecurrenceFrequency.Monthly },\n isnthyearly: { $type: BOOL, value: byWeekday && pattern.frequency === RecurrenceFrequency.Yearly },\n };\n\n if (weekdaysOnly) columns['daysofweekmask'] = { $type: INT, value: WEEKDAYS };\n else if (pattern.frequency === RecurrenceFrequency.Weekly)\n columns['daysofweekmask'] = { $type: INT, value: pattern.days === 0 ? day : pattern.days };\n\n if (yearlyOrMonthly) {\n if (byWeekday) {\n columns['instance'] = { $type: CHOICE, value: instanceOf(local) };\n columns['daysofweekmask'] = { $type: INT, value: day };\n } else {\n columns['dayofmonth'] = { $type: INT, value: local.day };\n }\n if (pattern.frequency === RecurrenceFrequency.Yearly) columns['monthofyear'] = { $type: CHOICE, value: local.month };\n }\n\n columns['patternendtype'] = { $type: CHOICE, value: pattern.end };\n if (pattern.end === RecurrenceEnd.AfterOccurrences)\n columns['occurrences'] = { $type: INT, value: Math.max(1, pattern.occurrences) };\n else if (pattern.end === RecurrenceEnd.OnDate && pattern.endDate) {\n const [year, month, date] = pattern.endDate.split('-').map(Number) as [number, number, number];\n columns['patternenddate'] = {\n $type: DATE,\n value: midnight({ year, month, day: date }, timeZone).toISOString(),\n };\n }\n const held = (existing?.properties ?? {}) as Record<string, { value?: unknown } | null | undefined>;\n const cleared = SHAPE_COLUMNS.filter((column) => !(column in columns) && held[column] != null);\n return { ...columns, ...Object.fromEntries(cleared.map((column) => [column, null])) };\n}\n\n/** The series to create of an appointment from `start` to `end`, in the user's `timeZone`. */\nexport function toSeries(pattern: RecurrencePattern, start: Date, end: Date, timeZone?: string): TableRecord {\n return { tableName: SERIES_TABLE, properties: seriesColumns(pattern, start, end, timeZone) } as TableRecord;\n}\n\ntype Properties = Record<string, { value?: unknown } | null | undefined>;\n\n/** The pattern a series holds, read in the user's `timeZone`; null when it holds none Dataverse defines. */\nexport function fromSeries(series: TableRecord, timeZone?: string): RecurrencePattern | null {\n const properties = series.properties as Properties;\n const value = (column: string) => properties[column]?.value;\n const type = value('recurrencepatterntype');\n if (typeof type !== 'number' || !Object.values(RecurrenceFrequency).includes(type as RecurrenceFrequency)) return null;\n\n const endType = value('patternendtype');\n const end = Object.values(RecurrenceEnd).includes(endType as RecurrenceEnd) ? (endType as RecurrenceEnd) : RecurrenceEnd.Never;\n const endMoment = value('patternenddate');\n const endDay = typeof endMoment === 'string' ? localDay(new Date(endMoment), timeZone) : null;\n\n // The weekday pattern, which Dataverse keeps as a weekly one, is every weekday.\n const weekdaysOnly = value('isweekdaypattern') === true;\n return {\n frequency: weekdaysOnly ? RecurrenceFrequency.Daily : (type as RecurrenceFrequency),\n interval: weekdaysOnly ? 1 : Math.max(1, Number(value('interval') ?? 1)),\n weekdaysOnly,\n days: weekdaysOnly ? 0 : Number(value('daysofweekmask') ?? 0),\n byWeekday: value('isnthmonthly') === true || value('isnthyearly') === true,\n end,\n occurrences: Number(value('occurrences') ?? 10),\n endDate: endDay ? isoDate(endDay) : null,\n };\n}\n\n/** Translates a key under `app.components.calendar.recurrence`, with its arguments. */\nexport type RecurrenceText = (key: string, args?: readonly unknown[]) => string;\n\n/**\n * On which day of the month a monthly series falls, in words — \"on day 5\", \"on the second Tuesday\" —\n * by the strings under `phrases`: `summary` within a sentence, `options` on its own.\n */\nexport function monthlyOn(pattern: RecurrencePattern, start: LocalDay, locale: string, t: RecurrenceText, phrases = 'summary'): string {\n return pattern.byWeekday\n ? t(`${phrases}.on-the-weekday`, [t(`instances.${instanceOf(start)}`), dayName(start.weekday, locale)])\n : t(`${phrases}.on-day`, [start.day]);\n}\n\n/**\n * On which day of the year a yearly series falls, in words — \"on March 5\", \"on the second Tuesday of\n * March\" — by the strings under `phrases`, as `monthlyOn`.\n */\nexport function yearlyOn(pattern: RecurrencePattern, start: LocalDay, locale: string, t: RecurrenceText, phrases = 'summary'): string {\n return pattern.byWeekday\n ? t(`${phrases}.on-the-weekday-of`, [\n t(`instances.${instanceOf(start)}`),\n dayName(start.weekday, locale),\n monthName(start.month, locale),\n ])\n : t(`${phrases}.on-date`, [\n new Intl.DateTimeFormat(locale, { month: 'long', day: 'numeric', timeZone: 'UTC' }).format(\n Date.UTC(2000, start.month - 1, start.day),\n ),\n ]);\n}\n\n/** The pattern in words, for a series starting on `start`: \"Every 2 weeks on Monday, Wednesday, 6 times\". */\nexport function describeRecurrence(pattern: RecurrencePattern, start: LocalDay, locale: string, t: RecurrenceText): string {\n const interval = Math.max(1, pattern.interval);\n const many = interval > 1;\n const days = () => dayNames(pattern.days === 0 ? dayOf(start.weekday) : pattern.days, locale);\n\n let repeats: string;\n switch (pattern.frequency) {\n case RecurrenceFrequency.Daily:\n repeats = pattern.weekdaysOnly\n ? t('summary.every-weekday')\n : many\n ? t('summary.every-n-days', [interval])\n : t('summary.every-day');\n break;\n case RecurrenceFrequency.Weekly:\n repeats = many ? t('summary.every-n-weeks', [interval, days()]) : t('summary.every-week', [days()]);\n break;\n case RecurrenceFrequency.Monthly:\n repeats = many\n ? t('summary.every-n-months', [interval, monthlyOn(pattern, start, locale, t)])\n : t('summary.every-month', [monthlyOn(pattern, start, locale, t)]);\n break;\n default:\n repeats = many\n ? t('summary.every-n-years', [interval, yearlyOn(pattern, start, locale, t)])\n : t('summary.every-year', [yearlyOn(pattern, start, locale, t)]);\n }\n\n if (pattern.end === RecurrenceEnd.AfterOccurrences) return t('summary.times', [repeats, Math.max(1, pattern.occurrences)]);\n if (pattern.end === RecurrenceEnd.OnDate && pattern.endDate) {\n const [year, month, day] = pattern.endDate.split('-').map(Number) as [number, number, number];\n return t('summary.until', [repeats, new Intl.DateTimeFormat(locale, { timeZone: 'UTC' }).format(Date.UTC(year, month - 1, day))]);\n }\n return repeats;\n}\n\n/** The first day of the locale's week, 0 for Sunday, where the browser says; Sunday where it doesn't. */\nexport function firstDayOfWeek(locale: string): number {\n try {\n const intlLocale = new Intl.Locale(locale) as Intl.Locale & {\n getWeekInfo?: () => { firstDay: number };\n weekInfo?: { firstDay: number };\n };\n const firstDay = intlLocale.getWeekInfo?.().firstDay ?? intlLocale.weekInfo?.firstDay;\n return firstDay === undefined ? 0 : firstDay % 7;\n } catch {\n return 0;\n }\n}\n\n/** The days of the week in the order of the locale's week. */\nexport function weekOrder(locale: string): number[] {\n const first = firstDayOfWeek(locale);\n return Array.from({ length: 7 }, (_, i) => (first + i) % 7);\n}\n\n/** A day of the week's name, long or as short as the locale writes it. */\nexport function dayName(weekday: number, locale: string, width: 'long' | 'narrow' | 'short' = 'long'): string {\n // 1 November 2026 is a Sunday.\n return new Intl.DateTimeFormat(locale, { weekday: width, timeZone: 'UTC' }).format(Date.UTC(2026, 10, 1 + weekday));\n}\n\nfunction monthName(month: number, locale: string): string {\n return new Intl.DateTimeFormat(locale, { month: 'long', timeZone: 'UTC' }).format(Date.UTC(2000, month - 1, 1));\n}\n\n// The days named in the order of the locale's week.\nfunction dayNames(days: number, locale: string): string {\n return weekOrder(locale)\n .filter((weekday) => (days & dayOf(weekday)) !== 0)\n .map((weekday) => dayName(weekday, locale))\n .join(', ');\n}\n\n/** A day as `yyyy-mm-dd`. */\nexport function isoDate(day: Pick<LocalDay, 'year' | 'month' | 'day'>): string {\n return `${String(day.year).padStart(4, '0')}-${String(day.month).padStart(2, '0')}-${String(day.day).padStart(2, '0')}`;\n}\n\nfunction zonedParts(instant: Date, timeZone?: string) {\n const parts = new Intl.DateTimeFormat('en-US', {\n ...(timeZone ? { timeZone } : {}),\n year: 'numeric',\n month: 'numeric',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n hourCycle: 'h23',\n }).formatToParts(instant);\n const part = (type: Intl.DateTimeFormatPartTypes) => Number(parts.find((x) => x.type === type)?.value ?? 0);\n return { year: part('year'), month: part('month'), day: part('day'), hour: part('hour'), minute: part('minute') };\n}\n\n/**\n * The times an appointment or series takes when All day is switched. On: the whole days its times\n * fall on, from midnight on the day it starts to midnight after the last day it takes in — one day at\n * least. Off: nine o'clock on the day it started, for half an hour. The Blazor Calendar's AllDayTimes\n * is its twin.\n */\nexport function allDayTimes(start: Date, end: Date, allDay: boolean, timeZone?: string): { start: Date; end: Date } {\n const first = localDay(start, timeZone);\n if (!allDay) {\n const at = hourOn(first, 9, timeZone);\n return { start: at, end: new Date(at.getTime() + 30 * 60 * 1000) };\n }\n // The day the end stops before: a midnight is its own day's start; any later moment takes its day in.\n const last = zonedParts(end, timeZone);\n const endsAtMidnight = last.hour === 0 && last.minute === 0;\n const after = addDays(last, endsAtMidnight ? 0 : 1);\n const dayAfter = isoDate(after) > isoDate(first) ? after : addDays(first, 1);\n return { start: midnight(first, timeZone), end: midnight(dayAfter, timeZone) };\n}\n\n// A day so many days later.\nfunction addDays(day: Pick<LocalDay, 'year' | 'month' | 'day'>, days: number): Pick<LocalDay, 'year' | 'month' | 'day'> {\n const moved = new Date(Date.UTC(day.year, day.month - 1, day.day + days));\n return { year: moved.getUTCFullYear(), month: moved.getUTCMonth() + 1, day: moved.getUTCDate() };\n}\n\n// The moment a day starts in the zone: its midnight, or the first moment after it when the clocks\n// skip midnight.\nfunction midnight(day: Pick<LocalDay, 'year' | 'month' | 'day'>, timeZone?: string): Date {\n return hourOn(day, 0, timeZone);\n}\n\n// The moment an hour of a day starts in the zone, or the first moment after it when the clocks skip it.\nfunction hourOn(day: Pick<LocalDay, 'year' | 'month' | 'day'>, hour: number, timeZone?: string): Date {\n const target = Date.UTC(day.year, day.month - 1, day.day, hour);\n let guess = target;\n // The zone's offset at the guess, applied until the guess reads as the target there.\n for (let i = 0; i < 3; i++) {\n const p = zonedParts(new Date(guess), timeZone);\n const shown = Date.UTC(p.year, p.month - 1, p.day, p.hour, p.minute);\n if (shown === target) return new Date(guess);\n guess += target - shown;\n }\n // No such moment that day: the first half hour after it.\n while (Date.UTC(...partsOf(zonedParts(new Date(guess), timeZone))) < target) guess += 30 * 60 * 1000;\n return new Date(guess);\n}\n\n// A zone's reading of a moment, as the arguments Date.UTC takes.\nfunction partsOf(p: ReturnType<typeof zonedParts>): [number, number, number, number, number] {\n return [p.year, p.month - 1, p.day, p.hour, p.minute];\n}\n","import {\n Checkbox,\n Dropdown,\n Field,\n Input,\n makeStyles,\n Option,\n Radio,\n RadioGroup,\n SpinButton,\n Text,\n tokens,\n ToggleButton,\n} from '@fluentui/react-components';\nimport { usePrefixedT } from '@powerportalspro/react';\nimport { useEffect, useId, useRef } from 'react';\nimport {\n dayName,\n dayOf,\n describeRecurrence,\n isoDate,\n type LocalDay,\n monthlyOn,\n RecurrenceEnd,\n RecurrenceFrequency,\n type RecurrencePattern,\n startingPattern,\n weekOrder,\n yearlyOn,\n} from './recurrence-pattern.js';\n\nconst MAX_INTERVAL = 99;\nconst MAX_OCCURRENCES = 999;\n// The dropdown's value for an appointment that doesn't repeat.\nconst NO_REPEAT = 'none';\n\nconst FREQUENCY_NAMES: Record<RecurrenceFrequency, string> = {\n [RecurrenceFrequency.Daily]: 'daily',\n [RecurrenceFrequency.Weekly]: 'weekly',\n [RecurrenceFrequency.Monthly]: 'monthly',\n [RecurrenceFrequency.Yearly]: 'yearly',\n};\n\nconst useStyles = makeStyles({\n root: {\n display: 'flex',\n flexDirection: 'column',\n gap: tokens.spacingVerticalM,\n },\n // A radio with a field beside it: apart from the radios above and below, which its field would\n // otherwise touch.\n row: {\n display: 'flex',\n alignItems: 'center',\n flexWrap: 'wrap',\n gap: tokens.spacingHorizontalS,\n marginTop: tokens.spacingVerticalS,\n marginBottom: tokens.spacingVerticalS,\n },\n every: {\n display: 'flex',\n alignItems: 'flex-end',\n flexWrap: 'wrap',\n gap: tokens.spacingHorizontalS,\n },\n number: {\n width: '96px',\n },\n unit: {\n color: tokens.colorNeutralForeground2,\n },\n days: {\n display: 'flex',\n alignItems: 'center',\n flexWrap: 'wrap',\n gap: tokens.spacingHorizontalXS,\n },\n note: {\n color: tokens.colorNeutralForeground3,\n },\n});\n\nexport interface RecurrenceEditProps {\n /** How it repeats, or null when it doesn't. */\n value: RecurrencePattern | null;\n /** Called with the pattern the user picked, or null for none. */\n onChange: (pattern: RecurrencePattern | null) => void;\n /** The day the appointment starts, in the user's time zone. */\n start: LocalDay;\n /** Whether \"doesn't repeat\" is offered: not for a series, which repeats by being one. */\n allowNone?: boolean;\n /** Whether the pattern is only shown. */\n readOnly?: boolean;\n /** The language its words are in; the browser's when omitted. */\n locale?: string;\n}\n\n/**\n * Picks how an appointment repeats, if it does: daily, on days of the week, monthly or yearly, every\n * so many, and until when. What depends on the day it starts — the day of the month, the month —\n * follows `start`. The Blazor Calendar's `RecurrenceEdit` is its twin.\n */\nexport function RecurrenceEdit({ value, onChange, start, allowNone = true, readOnly = false, locale }: RecurrenceEditProps) {\n const styles = useStyles();\n const t = usePrefixedT('app.components.calendar.recurrence');\n const id = useId();\n const language = locale ?? navigator.language;\n\n // A weekly series on the day it started on follows the start to another day: one left behind would\n // lose the appointment's own occurrence. Days the user chose stay as they are.\n const startDay = useRef(start.weekday);\n useEffect(() => {\n const was = startDay.current;\n startDay.current = start.weekday;\n if (was !== start.weekday && value?.frequency === RecurrenceFrequency.Weekly && value.days === dayOf(was)) {\n onChange({ ...value, days: dayOf(start.weekday) });\n }\n // Only when the start moves to another day.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [start.weekday]);\n\n const frequencies = Object.values(RecurrenceFrequency);\n const chosen = value ? String(value.frequency) : NO_REPEAT;\n const frequencyLabel = (option: string) =>\n option === NO_REPEAT ? t('never') : t(`frequencies.${FREQUENCY_NAMES[Number(option) as RecurrenceFrequency]}`);\n\n // Another frequency starts afresh from the start, keeping how it ends.\n const changeFrequency = (option: string) => {\n if (option === NO_REPEAT) return onChange(null);\n const frequency = Number(option) as RecurrenceFrequency;\n if (value?.frequency === frequency) return;\n const pattern = startingPattern(frequency, start);\n onChange(value ? { ...pattern, end: value.end, occurrences: value.occurrences, endDate: value.endDate } : pattern);\n };\n\n return (\n <div className={styles.root}>\n <Field label={t('label')}>\n <Dropdown\n value={frequencyLabel(chosen)}\n selectedOptions={[chosen]}\n disabled={readOnly}\n onOptionSelect={(_, data) => data.optionValue !== undefined && changeFrequency(data.optionValue)}\n >\n {[...(allowNone ? [NO_REPEAT] : []), ...frequencies.map(String)].map((option) => (\n <Option key={option} value={option}>\n {frequencyLabel(option)}\n </Option>\n ))}\n </Dropdown>\n </Field>\n {value && <PatternFields value={value} onChange={onChange} start={start} readOnly={readOnly} locale={language} id={id} />}\n </div>\n );\n}\n\n// The same day a month on, or the month's last when it is shorter, as .NET's AddMonths has it.\nfunction monthOn(day: LocalDay): string {\n const year = day.month === 12 ? day.year + 1 : day.year;\n const month = (day.month % 12) + 1;\n const daysInMonth = new Date(Date.UTC(year, month, 0)).getUTCDate();\n return isoDate({ year, month, day: Math.min(day.day, daysInMonth) });\n}\n\nfunction PatternFields({\n value,\n onChange,\n start,\n readOnly,\n locale,\n id,\n}: {\n value: RecurrencePattern;\n onChange: (pattern: RecurrencePattern) => void;\n start: LocalDay;\n readOnly: boolean;\n locale: string;\n id: string;\n}) {\n const styles = useStyles();\n const t = usePrefixedT('app.components.calendar.recurrence');\n const clamp = (n: number | null | undefined, max: number) => Math.min(max, Math.max(1, Math.round(n ?? 1)));\n const number = (displayValue: string | undefined, picked: number | null | undefined) =>\n picked ?? (displayValue === undefined ? undefined : Number(displayValue));\n\n // Ending on a date starts from the start's day, a month on, so there is a date to change.\n const changeEnd = (end: RecurrenceEnd) =>\n onChange({\n ...value,\n end,\n endDate: end === RecurrenceEnd.OnDate ? (value.endDate ?? monthOn(start)) : value.endDate,\n });\n\n return (\n <>\n <div className={styles.every}>\n <Field label={t('every')}>\n <SpinButton\n className={styles.number}\n value={value.interval}\n min={1}\n max={MAX_INTERVAL}\n // The weekday pattern is every week.\n disabled={readOnly || (value.frequency === RecurrenceFrequency.Daily && value.weekdaysOnly)}\n onChange={(_, data) => onChange({ ...value, interval: clamp(number(data.displayValue, data.value), MAX_INTERVAL) })}\n />\n </Field>\n <Text className={styles.unit}>{t(`units.${FREQUENCY_NAMES[value.frequency]}`)}</Text>\n </div>\n\n {value.frequency === RecurrenceFrequency.Daily && (\n <Checkbox\n label={t('weekdays-only')}\n checked={value.weekdaysOnly}\n disabled={readOnly}\n onChange={(_, data) => onChange({ ...value, weekdaysOnly: data.checked === true })}\n />\n )}\n\n {value.frequency === RecurrenceFrequency.Weekly && (\n <div className={styles.days} role=\"group\" aria-label={t('days')}>\n <Text>{t('days')}</Text>\n {weekOrder(locale).map((weekday) => {\n const flag = dayOf(weekday);\n const pressed = (value.days & flag) !== 0;\n return (\n <ToggleButton\n key={weekday}\n shape=\"circular\"\n size=\"small\"\n checked={pressed}\n disabled={readOnly}\n title={dayName(weekday, locale)}\n aria-label={dayName(weekday, locale)}\n // The last day stays on: a weekly series falls on a day.\n onClick={() => {\n const days = value.days ^ flag;\n if (days !== 0) onChange({ ...value, days });\n }}\n >\n {dayName(weekday, locale, 'narrow')}\n </ToggleButton>\n );\n })}\n </div>\n )}\n\n {(value.frequency === RecurrenceFrequency.Monthly || value.frequency === RecurrenceFrequency.Yearly) && (\n <RadioGroup\n value={value.byWeekday ? 'weekday' : 'date'}\n disabled={readOnly}\n onChange={(_, data) => onChange({ ...value, byWeekday: data.value === 'weekday' })}\n >\n {(['date', 'weekday'] as const).map((by) => {\n const option = { ...value, byWeekday: by === 'weekday' };\n return (\n <Radio\n key={by}\n value={by}\n label={\n value.frequency === RecurrenceFrequency.Monthly\n ? monthlyOn(option, start, locale, t, 'options')\n : yearlyOn(option, start, locale, t, 'options')\n }\n />\n );\n })}\n </RadioGroup>\n )}\n\n <Field label={t('ends')}>\n <RadioGroup value={String(value.end)} disabled={readOnly} onChange={(_, data) => changeEnd(Number(data.value) as RecurrenceEnd)}>\n <Radio value={String(RecurrenceEnd.Never)} label={t('end-never')} />\n <div className={styles.row}>\n <Radio value={String(RecurrenceEnd.AfterOccurrences)} label={t('end-after')} />\n <SpinButton\n className={styles.number}\n aria-label={t('end-after-unit')}\n value={value.occurrences}\n min={1}\n max={MAX_OCCURRENCES}\n disabled={readOnly}\n onChange={(_, data) =>\n onChange({ ...value, end: RecurrenceEnd.AfterOccurrences, occurrences: clamp(number(data.displayValue, data.value), MAX_OCCURRENCES) })\n }\n />\n <Text className={styles.unit}>{t('end-after-unit')}</Text>\n </div>\n <div className={styles.row}>\n <Radio value={String(RecurrenceEnd.OnDate)} label={t('end-on')} />\n <Input\n type=\"date\"\n id={`${id}-end`}\n aria-label={t('end-on')}\n value={value.endDate ?? ''}\n min={isoDate(start)}\n disabled={readOnly}\n onChange={(_, data) => data.value && onChange({ ...value, end: RecurrenceEnd.OnDate, endDate: data.value })}\n />\n </div>\n </RadioGroup>\n </Field>\n\n <Text aria-live=\"polite\">{describeRecurrence(value, start, locale, t)}</Text>\n {value.end === RecurrenceEnd.Never && (\n <Text size={200} className={styles.note}>\n {t('never-ends')}\n </Text>\n )}\n </>\n );\n}\n","import {\n Button,\n Dialog,\n DialogActions,\n DialogBody,\n DialogContent,\n DialogSurface,\n DialogTitle,\n makeStyles,\n Menu,\n MenuItem,\n MenuList,\n MenuPopover,\n MenuTrigger,\n MessageBar,\n MessageBarBody,\n Spinner,\n Text,\n tokens,\n} from '@fluentui/react-components';\nimport { ArrowRepeatAllRegular, ChevronDownRegular } from '@fluentui/react-icons';\nimport {\n getRecordReferenceId,\n TableSecurityPermission,\n type AddRecurrenceRequest,\n type OrganizationRequest,\n type TableRecord,\n} from '@powerportalspro/core';\nimport {\n QueryStatus,\n RecordContext,\n useDialogService,\n useLocalization,\n useLocalizationLoaded,\n useMainContext,\n usePowerPortalsPro,\n usePrefixedT,\n useRecordContext,\n useRunWithOverlay,\n useT,\n useUserTimeZone,\n} from '@powerportalspro/react';\nimport {\n ColumnEdit,\n DeleteContextButton,\n RecordDialogFrame,\n RecordDialogShell,\n SaveContextButton,\n StatusReasonEdit,\n type RecordDialogLocation,\n} from '@powerportalspro/react-fluent';\nimport { useEffect, useRef, useState, type ReactNode } from 'react';\nimport type { OpenAppointment } from './appointment-click.js';\nimport { RecurrenceEdit } from './recurrence-edit.js';\nimport {\n allDayTimes,\n boolColumn,\n fromSeries,\n localDay,\n type RecurrencePattern,\n SERIES_TABLE,\n seriesColumns,\n toSeries,\n} from './recurrence-pattern.js';\n\n// The appointment table's strings: its columns' labels and its choices; and the series table's.\nconst APPOINTMENT_STRINGS = ['tables.appointment'] as const;\nconst SERIES_STRINGS = [`tables.${SERIES_TABLE}`] as const;\n\n// A value a form's column takes.\ntype ColumnValue = Parameters<ReturnType<typeof useRecordContext>['setColumnValue']>[1];\n\n// An appointment that is open (0) or scheduled (3) can still change; completed or canceled can't.\nconst OPEN_STATES = new Set([0, 3]);\n\nconst useStyles = makeStyles({\n fields: {\n display: 'flex',\n flexDirection: 'column',\n gap: tokens.spacingVerticalM,\n },\n // The form stays out until the appointment is read, rather than showing empty fields.\n loading: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n minHeight: '160px',\n },\n recurring: {\n display: 'flex',\n alignItems: 'center',\n gap: tokens.spacingHorizontalXS,\n color: tokens.colorNeutralForeground2,\n },\n});\n\nexport interface AppointmentDetailsDialogProps {\n /** The appointment to show, or null while the dialog is closed or a new one is open. */\n appointment: OpenAppointment | null;\n /** A new appointment to create, as the selected range starts it, or null. */\n newAppointment?: TableRecord | null;\n /** Whether the appointment can be edited and saved, as far as the user may change it. */\n editable?: boolean;\n /** The tables its Regarding offers records of; every one Regarding can point to when omitted. */\n regardingTables?: readonly string[] | undefined;\n onClose: () => void;\n /** An appointment was saved or deleted: the calendar reads its range again. */\n onSaved?: () => void;\n /** The fields to show in place of the calendar's own, bound to the appointment's record. */\n children?: ReactNode;\n /** Where it opens: centered (the default), or a side panel on the right (`panel`) or the left (`panel-left`). */\n location?: RecordDialogLocation;\n}\n\n/**\n * An appointment's details, read from Dataverse as a record page reads a record — so the same table\n * access and column security apply: read-only, or, in a calendar that is `editable`, a form to change\n * and save it, make it a series, or delete it. A range selected in such a calendar opens it on a new\n * appointment to create; a series opens as one, with how it repeats. The record's context is\n * isolated: a field the page puts in the dialog doesn't join a form around the calendar. The Blazor\n * Calendar's details dialog is its twin.\n */\nexport function AppointmentDetailsDialog({\n appointment,\n newAppointment = null,\n editable = false,\n regardingTables,\n onClose,\n onSaved,\n children,\n location = 'center',\n}: AppointmentDetailsDialogProps) {\n const t = usePrefixedT('app.components.calendar');\n const tAll = useT();\n const open = appointment !== null || newAppointment !== null;\n const isSeries = appointment?.isSeries === true;\n const mayCreateSeries = useMayCreateSeries(open && editable && !isSeries && appointment?.recurring !== true);\n const saved = () => {\n onClose();\n onSaved?.();\n };\n\n return (\n <RecordDialogShell\n open={open}\n onOpenChange={(next) => !next && onClose()}\n location={location}\n tableName={isSeries ? SERIES_TABLE : 'appointment'}\n enablePanelResizing\n >\n {open && (\n <RecordContext\n table={isSeries ? SERIES_TABLE : 'appointment'}\n {...(appointment ? { id: appointment.id } : { initialRecord: newAppointment! })}\n isolated\n >\n <RecordDialogFrame\n location={location}\n title={appointment ? appointment.subject : t('new-appointment')}\n actions={\n editable ? (\n <>\n <DeleteAction seriesId={appointment?.seriesId ?? null} onDeleted={saved} />\n <SaveContextButton appearance=\"primary\" onSaved={saved} />\n <Button onClick={onClose}>{tAll('app.buttons.cancel.label')}</Button>\n </>\n ) : (\n <Button appearance=\"primary\" onClick={onClose}>\n {t('close')}\n </Button>\n )\n }\n >\n {isSeries ? (\n <SeriesRecord editable={editable} regardingTables={regardingTables} />\n ) : (\n <AppointmentRecord\n recurring={appointment?.recurring ?? false}\n editable={editable}\n creating={!appointment}\n regardingTables={regardingTables}\n mayCreateSeries={mayCreateSeries}\n >\n {children}\n </AppointmentRecord>\n )}\n </RecordDialogFrame>\n </RecordContext>\n )}\n </RecordDialogShell>\n );\n}\n\nexport interface RecurringChoiceDialogProps {\n /** The recurring appointment clicked, or null while the dialog is closed. */\n appointment: OpenAppointment | null;\n /** The user said which they meant: the appointment, or its series. */\n onChoose: (series: boolean) => void;\n onClose: () => void;\n}\n\n/**\n * One of a series was clicked: the user says whether they mean it or the whole series, as Outlook\n * asks. The Blazor Calendar asks the same.\n */\nexport function RecurringChoiceDialog({ appointment, onChoose, onClose }: RecurringChoiceDialogProps) {\n const t = usePrefixedT('app.components.calendar.open-recurring');\n const tAll = useT();\n return (\n <Dialog open={appointment !== null} onOpenChange={(_, data) => !data.open && onClose()} modalType=\"modal\">\n <DialogSurface>\n <DialogBody>\n <DialogTitle>{t('title')}</DialogTitle>\n <DialogContent>{t('message')}</DialogContent>\n {/* Fluid, so the actions span the dialog: by default they get its right half only, where\n three buttons wrap their labels. */}\n <DialogActions fluid>\n <Button appearance=\"primary\" onClick={() => onChoose(false)}>\n {t('occurrence')}\n </Button>\n <Button onClick={() => onChoose(true)}>{t('series')}</Button>\n <Button appearance=\"subtle\" onClick={onClose}>\n {tAll('app.buttons.cancel.label')}\n </Button>\n </DialogActions>\n </DialogBody>\n </DialogSurface>\n </Dialog>\n );\n}\n\n/**\n * Whether the user may create series, once asked: asked when `asked` first holds, and again only for\n * another user, rather than on every appointment opened.\n */\nfunction useMayCreateSeries(asked: boolean): boolean {\n const { ppp, authState } = usePowerPortalsPro();\n const user = authState.status === 'authenticated' ? authState.user?.userId : null;\n const [answer, setAnswer] = useState<{ user: string | null | undefined; mayCreate: boolean } | null>(null);\n const asking = useRef<string | null | undefined>(undefined);\n const known = answer?.user === user;\n useEffect(() => {\n if (!asked || known || asking.current === user) return;\n asking.current = user;\n ppp\n .retrieveTablePermissionsAsync(SERIES_TABLE)\n .then((permissions) => setAnswer({ user, mayCreate: (Number(permissions) & TableSecurityPermission.Create) !== 0 }))\n // Asked again on the next appointment opened.\n .catch(() => (asking.current = undefined));\n }, [asked, known, user, ppp]);\n return answer !== null && known && answer.mayCreate;\n}\n\n/** Whether the form's record grants every permission in `permissions`. */\nfunction grants(record: TableRecord | undefined, permissions: number): boolean {\n return record?.permissions !== undefined && (Number(record.permissions) & permissions) === permissions;\n}\n\n// Whether the user may delete the series `seriesId`, as its own access says: false until read.\nfunction useMayDeleteSeries(seriesId: string | null): boolean {\n const { ppp } = usePowerPortalsPro();\n const [mayDelete, setMayDelete] = useState(false);\n useEffect(() => {\n setMayDelete(false);\n if (!seriesId) return;\n let current = true;\n ppp\n .retrieveRecordAsync(SERIES_TABLE, seriesId, ['activityid'])\n .then((series) => current && setMayDelete(grants(series, TableSecurityPermission.Delete)))\n .catch(() => current && setMayDelete(false));\n return () => {\n current = false;\n };\n }, [ppp, seriesId]);\n return mayDelete;\n}\n\n// Delete, where the user may delete what the dialog shows: an occurrence offers it or, where its own\n// access allows, its series.\nfunction DeleteAction({ seriesId, onDeleted }: { seriesId: string | null; onDeleted: () => void }) {\n const { record } = useRecordContext();\n const t = usePrefixedT('app.components.calendar');\n const tAll = useT();\n const { ppp } = usePowerPortalsPro();\n const dialog = useDialogService();\n const runWithOverlay = useRunWithOverlay();\n const mayDeleteSeries = useMayDeleteSeries(seriesId);\n const mayDelete = !!record?.id && grants(record, TableSecurityPermission.Delete);\n if (!seriesId) return mayDelete ? <DeleteContextButton appearance=\"secondary\" onDeleted={onDeleted} /> : null;\n if (!record?.id || (!mayDelete && !mayDeleteSeries)) return null;\n\n const remove = async (table: string, id: string, message: string) => {\n const confirmation = await dialog.showConfirmationAsync(message, {\n title: tAll('app.messages.delete-title'),\n primaryText: tAll('app.buttons.delete.label'),\n secondaryText: tAll('app.buttons.cancel.label'),\n });\n if (confirmation.canceled) return;\n try {\n await runWithOverlay({ description: tAll('app.messages.deleting-record') }, () => ppp.deleteRecordAsync(table, id));\n onDeleted();\n } catch (error) {\n await dialog.showErrorAsync(error instanceof Error ? error.message : String(error), { title: tAll('app.errors.record-delete') });\n }\n };\n\n return (\n <Menu>\n <MenuTrigger disableButtonEnhancement>\n <Button icon={<ChevronDownRegular />} iconPosition=\"after\">\n {tAll('app.buttons.delete.label')}\n </Button>\n </MenuTrigger>\n <MenuPopover>\n <MenuList>\n {mayDelete && (\n <MenuItem onClick={() => void remove('appointment', record.id!, tAll('app.messages.delete-record-confirmation'))}>\n {t('delete-occurrence')}\n </MenuItem>\n )}\n {mayDeleteSeries && (\n <MenuItem onClick={() => void remove(SERIES_TABLE, seriesId, t('delete-series-confirmation'))}>{t('delete-series')}</MenuItem>\n )}\n </MenuList>\n </MenuPopover>\n </Menu>\n );\n}\n\nfunction AppointmentRecord({\n recurring,\n editable,\n creating,\n regardingTables,\n mayCreateSeries,\n children,\n}: {\n recurring: boolean;\n editable: boolean;\n creating: boolean;\n regardingTables: readonly string[] | undefined;\n mayCreateSeries: boolean;\n children?: ReactNode;\n}) {\n const styles = useStyles();\n const t = usePrefixedT('app.components.calendar');\n const { status } = useRecordContext();\n useAllDayTimes('scheduledstart', 'scheduledend');\n // The fields wait for their labels too, rather than show their keys.\n useLocalization(APPOINTMENT_STRINGS);\n const labeled = useLocalizationLoaded(APPOINTMENT_STRINGS);\n\n if (status !== QueryStatus.Success || !labeled) return <Loading status={status} />;\n if (children) return <>{children}</>;\n // Read-only unless the calendar is editable; then the record's own access decides each field.\n const readOnly = !editable;\n return (\n <div className={styles.fields}>\n {recurring && (\n <Text className={styles.recurring}>\n <ArrowRepeatAllRegular />\n {t('recurring')}\n </Text>\n )}\n {editable && <ColumnEdit columnName=\"subject\" />}\n <ColumnEdit columnName=\"scheduledstart\" readOnly={readOnly} />\n <ColumnEdit columnName=\"scheduledend\" readOnly={readOnly} />\n <ColumnEdit columnName=\"isalldayevent\" readOnly={readOnly} />\n {editable && !recurring && mayCreateSeries && <AppointmentRepeat creating={creating} />}\n <ColumnEdit columnName=\"location\" readOnly={readOnly} />\n {!creating && <ColumnEdit columnName=\"organizer\" readOnly />}\n <ColumnEdit columnName=\"requiredattendees\" readOnly={readOnly} />\n <ColumnEdit columnName=\"optionalattendees\" readOnly={readOnly} />\n <ColumnEdit columnName=\"regardingobjectid\" readOnly={readOnly} {...(regardingTables && { targetTables: regardingTables })} />\n {/* Every reason, each moving the appointment to its state: Free or Tentative to Open, Busy or\n Out of Office to Scheduled, Completed or Canceled to close it. */}\n {!creating && <StatusReasonEdit columnName=\"statuscode\" allowStateChange readOnly={readOnly} />}\n <ColumnEdit columnName=\"description\" readOnly={readOnly} />\n </div>\n );\n}\n\n// The appointment or series being read, or why it couldn't be.\nfunction Loading({ status }: { status: QueryStatus }) {\n const styles = useStyles();\n const t = usePrefixedT('app.components.calendar');\n if (status === QueryStatus.Error) {\n return (\n <MessageBar intent=\"error\">\n <MessageBarBody>{t('details-error')}</MessageBarBody>\n </MessageBar>\n );\n }\n return (\n <div className={styles.loading} role=\"status\" aria-live=\"polite\">\n <Spinner label={t('details-loading')} />\n </div>\n );\n}\n\n/**\n * Switching All day moves the record's times to fit, as Outlook does: on, to the whole days they fall\n * on; off, to nine o'clock on the first of them, for half an hour (see allDayTimes). Every switch the\n * user makes, back to the value as read too; the value as read, or as a new appointment starts, leaves\n * the times alone.\n */\nexport function useAllDayTimes(startColumn: string, endColumn: string) {\n const ctx = useRecordContext();\n const timeZone = useUserTimeZone() ?? undefined;\n // Undefined until the record holds it, so a record arriving isn't taken for a switch.\n const read = valueOf(ctx.record, 'isalldayevent');\n const allDay = typeof read === 'boolean' ? read : undefined;\n const previous = useRef<boolean | undefined>(undefined);\n useEffect(() => {\n const was = previous.current;\n previous.current = allDay;\n if (was === undefined || allDay === undefined || was === allDay) return;\n const start = valueOf(ctx.record, startColumn);\n const end = valueOf(ctx.record, endColumn);\n if (typeof start !== 'string') return;\n const times = allDayTimes(new Date(start), new Date(typeof end === 'string' ? end : start), allDay, timeZone);\n ctx.setColumnValue(startColumn, { $type: 2, value: times.start.toISOString() } as ColumnValue);\n ctx.setColumnValue(endColumn, { $type: 2, value: times.end.toISOString() } as ColumnValue);\n // Only the switch: the times it sets are read from the record as it is then.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [allDay]);\n}\n\n/** A record value's raw value, by column. */\nfunction valueOf(record: TableRecord | undefined, column: string): unknown {\n return (record?.properties as Record<string, { value?: unknown } | null | undefined> | undefined)?.[column]?.value;\n}\n\n/**\n * Makes the appointment in the form a series, in the save that saves it, when the user picks how it\n * repeats: shown to a user who may create series, and offered for one that exists where they may\n * change and delete it, as it becomes the series, while it is still open.\n */\nfunction AppointmentRepeat({ creating }: { creating: boolean }) {\n const ctx = useRecordContext();\n const main = useMainContext();\n const timeZone = useUserTimeZone() ?? undefined;\n const [pattern, setPattern] = useState<RecurrencePattern | null>(null);\n\n // Read through refs by the registration, which stays put while the user picks.\n const patternRef = useRef(pattern);\n patternRef.current = pattern;\n const recordRef = useRef(ctx.record);\n recordRef.current = ctx.record;\n const timeZoneRef = useRef(timeZone);\n timeZoneRef.current = timeZone;\n\n // The series joins the form's save, after the appointment's own create or update.\n const register = main?.registerDescendant;\n useEffect(() => {\n if (!register) return;\n return register({\n getRequests: () => seriesRequests(patternRef.current, recordRef.current, timeZoneRef.current),\n validate: () => true,\n refresh: async () => {},\n resetState: () => setPattern(null),\n isDirty: () => patternRef.current !== null,\n });\n }, [register]);\n const notify = main?.notifyDescendantDirtyChanged;\n useEffect(() => notify?.(), [notify, pattern]);\n\n const record = ctx.record;\n const state = valueOf(record, 'statecode');\n const offered =\n creating ||\n (grants(record, TableSecurityPermission.Write | TableSecurityPermission.Delete) &&\n (state === undefined || state === null || OPEN_STATES.has(Number(state))));\n if (!offered) return null;\n\n const start = valueOf(record, 'scheduledstart');\n return (\n <RecurrenceEdit\n value={pattern}\n onChange={setPattern}\n start={localDay(typeof start === 'string' ? new Date(start) : new Date(), timeZone)}\n />\n );\n}\n\n/** The request that makes the appointment a series as it is saved: laid out from its times, all day when it is. */\nexport function seriesRequests(\n pattern: RecurrencePattern | null,\n appointment: TableRecord | undefined,\n timeZone: string | undefined,\n): OrganizationRequest[] {\n const start = valueOf(appointment, 'scheduledstart');\n const end = valueOf(appointment, 'scheduledend');\n const id = getRecordReferenceId(appointment);\n if (!pattern || !appointment || typeof start !== 'string' || typeof end !== 'string' || !id) return [];\n\n const series = toSeries(pattern, new Date(start), new Date(end), timeZone);\n if (valueOf(appointment, 'isalldayevent') === true) {\n (series.properties as Record<string, unknown>)['isalldayevent'] = boolColumn(true);\n }\n const request: AddRecurrenceRequest = {\n $type: 'AddRecurrenceRequest',\n appointment: { tableName: 'appointment', id },\n series,\n } as AddRecurrenceRequest;\n return [request as OrganizationRequest];\n}\n\n// A series' form: what its occurrences share, and how it repeats.\nfunction SeriesRecord({ editable, regardingTables }: { editable: boolean; regardingTables: readonly string[] | undefined }) {\n const styles = useStyles();\n const t = usePrefixedT('app.components.calendar');\n const ctx = useRecordContext();\n const timeZone = useUserTimeZone() ?? undefined;\n useLocalization(SERIES_STRINGS);\n const labeled = useLocalizationLoaded(SERIES_STRINGS);\n const [pattern, setPattern] = useState<RecurrencePattern | null>(null);\n const [edited, setEdited] = useState(false);\n useAllDayTimes('starttime', 'endtime');\n\n // How the series repeats, once it is read — read again when the user's zone arrives, which its end\n // date is a day in, until the user changes it.\n const loaded = ctx.status === QueryStatus.Success ? ctx.record : undefined;\n const loadedId = loaded?.id;\n useEffect(() => {\n if (loaded && !edited) setPattern(fromSeries(loaded, timeZone));\n // The series as read, not each change the form makes to it.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [loadedId, timeZone, edited]);\n\n // The pattern written into the series, laid out from its times, for the form to save.\n const start = valueOf(ctx.record, 'starttime');\n const end = valueOf(ctx.record, 'endtime');\n const write = (next: RecurrencePattern) => {\n if (typeof start !== 'string' || typeof end !== 'string') return;\n for (const [column, value] of Object.entries(seriesColumns(next, new Date(start), new Date(end), timeZone, ctx.record))) {\n ctx.setColumnValue(column, value as ColumnValue);\n }\n };\n // New times lay the pattern out from them again, so the day it starts on follows its first\n // occurrence.\n const timesChanged = ctx.dirtyColumns.has('starttime') || ctx.dirtyColumns.has('endtime');\n useEffect(() => {\n if (timesChanged && pattern) write(pattern);\n // Only when the times change: writing the pattern changes neither.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [timesChanged, start, end]);\n\n if (ctx.status !== QueryStatus.Success || !labeled) return <Loading status={ctx.status} />;\n\n const change = (next: RecurrencePattern | null) => {\n if (!next) return;\n setEdited(true);\n setPattern(next);\n write(next);\n };\n const readOnly = !editable;\n return (\n <div className={styles.fields}>\n <Text className={styles.recurring}>\n <ArrowRepeatAllRegular />\n {t('open-recurring.series')}\n </Text>\n {editable && <ColumnEdit columnName=\"subject\" />}\n <ColumnEdit columnName=\"starttime\" readOnly={readOnly} />\n <ColumnEdit columnName=\"endtime\" readOnly={readOnly} />\n <ColumnEdit columnName=\"isalldayevent\" readOnly={readOnly} />\n {pattern && (\n <RecurrenceEdit\n value={pattern}\n onChange={change}\n start={localDay(typeof start === 'string' ? new Date(start) : new Date(), timeZone)}\n allowNone={false}\n readOnly={readOnly}\n />\n )}\n <ColumnEdit columnName=\"location\" readOnly={readOnly} />\n <ColumnEdit columnName=\"organizer\" readOnly />\n <ColumnEdit columnName=\"requiredattendees\" readOnly={readOnly} />\n <ColumnEdit columnName=\"optionalattendees\" readOnly={readOnly} />\n <ColumnEdit columnName=\"regardingobjectid\" readOnly={readOnly} {...(regardingTables && { targetTables: regardingTables })} />\n <ColumnEdit columnName=\"description\" readOnly={readOnly} />\n </div>\n );\n}\n","// The calendar's Fluent look. FullCalendar's Forma theme is drawn from Fluent's own palette, so\n// pointing its palette variables at Fluent's tokens is most of the theme: the tokens switch with\n// light and dark and follow a site's accent color, and nothing here names a color of its own.\n// Forma's palette stylesheets aren't loaded; the variables are set on the calendar instead, and on\n// the \"+ more\" popover, which FullCalendar draws at the end of the page rather than inside it.\n//\n// Framework-free: the React Calendar and the Blazor Calendar's script both inject it.\n\nconst STYLE_ID = 'ppp-calendar-styles';\n\nexport const calendarStyles = `\n.ppp-calendar,\n.ppp-calendar-popover {\n --fc-forma-primary: var(--colorBrandBackground);\n --fc-forma-primary-over: var(--colorBrandBackgroundHover);\n --fc-forma-primary-down: var(--colorBrandBackgroundPressed);\n --fc-forma-primary-foreground: var(--colorNeutralForegroundOnBrand);\n\n --fc-forma-event: var(--colorBrandBackground);\n --fc-forma-event-contrast: var(--colorNeutralForegroundOnBrand);\n --fc-forma-background-event: var(--colorBrandBackground2);\n --fc-forma-highlight: color-mix(in srgb, var(--colorBrandBackground) 25%, transparent);\n\n --fc-forma-background: var(--colorNeutralBackground1);\n --fc-forma-faint: var(--colorNeutralBackground2);\n --fc-forma-muted: var(--colorNeutralBackground1Hover);\n --fc-forma-strong: var(--colorNeutralBackground1Selected);\n --fc-forma-stronger: var(--colorNeutralBackground1Pressed);\n --fc-forma-strongest: var(--colorNeutralBackground1Pressed);\n\n --fc-forma-foreground: var(--colorNeutralForeground1);\n --fc-forma-muted-foreground: var(--colorNeutralForeground3);\n --fc-forma-faint-foreground: var(--colorNeutralForeground4);\n\n --fc-forma-border: var(--colorNeutralStroke2);\n --fc-forma-muted-border: var(--colorNeutralStroke3);\n --fc-forma-strong-border: var(--colorNeutralStroke1);\n --fc-forma-ring-color: var(--colorStrokeFocus2);\n\n color: var(--colorNeutralForeground1);\n background-color: var(--colorNeutralBackground1);\n}\n\n/* Forma sets 16px type on its root; Fluent's body text is 14px in its own family. Doubling the\n class outranks Forma's (hashed, single-class) rule without naming it. */\n.ppp-calendar.ppp-calendar,\n.ppp-calendar-popover.ppp-calendar-popover {\n font-family: var(--fontFamilyBase);\n font-size: var(--fontSizeBase300);\n line-height: var(--lineHeightBase300);\n}\n\n/* No taller than the appointment's box, which FullCalendar doesn't clip: a short appointment shows\n what fits of its subject and place, as Outlook's do. */\n.ppp-calendar-event {\n display: flex;\n flex-direction: column;\n min-width: 0;\n min-height: 0;\n max-height: 100%;\n overflow: hidden;\n padding-inline: var(--spacingHorizontalXS);\n}\n\n.ppp-calendar-event-title {\n display: flex;\n align-items: center;\n gap: var(--spacingHorizontalXXS);\n font-weight: var(--fontWeightSemibold);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.ppp-calendar-event-detail {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n font-size: var(--fontSizeBase200);\n}\n\n.ppp-calendar-event-compact {\n flex-direction: row;\n align-items: center;\n gap: var(--spacingHorizontalXS);\n}\n\n.ppp-calendar-event-compact .ppp-calendar-event-title {\n font-weight: var(--fontWeightRegular);\n}\n\n.ppp-calendar-event-compact .ppp-calendar-event-detail {\n flex: none;\n}\n\n.ppp-calendar-event-icon,\n.ppp-calendar-event-icon > svg {\n flex: none;\n width: 12px;\n height: 12px;\n}\n\n/* How an appointment shows its time, as Outlook draws it. Busy is FullCalendar's own drawing: a tint\n of the appointment's color with a bar in it. Out of office is that in purple; free is the bar\n outlined on no tint, staying free under the pointer, and tentative the tint striped. Only a block\n has a fill to draw free and tentative in: a month's dots and the agenda's rows show the color. */\n.ppp-calendar .ppp-calendar-appointment-out-of-office,\n.ppp-calendar-popover .ppp-calendar-appointment-out-of-office {\n /* Over the color FullCalendar sets on the appointment itself. */\n --fc-event-color: var(--colorPalettePurpleBorderActive, #8764b8) !important;\n}\n\n.ppp-calendar .ppp-calendar-appointment-free.ppp-calendar-appointment-block,\n.ppp-calendar-popover .ppp-calendar-appointment-free.ppp-calendar-appointment-block {\n background-color: var(--fc-forma-background);\n}\n\n.ppp-calendar .ppp-calendar-appointment-free.ppp-calendar-appointment-block:hover,\n.ppp-calendar-popover .ppp-calendar-appointment-free.ppp-calendar-appointment-block:hover {\n background-color: color-mix(in srgb, var(--fc-event-color) 8%, var(--fc-forma-background));\n}\n\n/* A focused one keeps FullCalendar's focus outline. */\n.ppp-calendar .ppp-calendar-appointment-free.ppp-calendar-appointment-block:not(:focus-visible),\n.ppp-calendar-popover .ppp-calendar-appointment-free.ppp-calendar-appointment-block:not(:focus-visible) {\n outline: var(--strokeWidthThin) solid color-mix(in srgb, var(--fc-event-color) 50%, transparent);\n outline-offset: calc(var(--strokeWidthThin) * -1);\n}\n\n.ppp-calendar .ppp-calendar-appointment-tentative.ppp-calendar-appointment-block,\n.ppp-calendar-popover .ppp-calendar-appointment-tentative.ppp-calendar-appointment-block {\n background-image: repeating-linear-gradient(\n -45deg,\n transparent 0 4px,\n color-mix(in srgb, var(--fc-event-color) 30%, transparent) 4px 6px\n );\n}\n\n.ppp-calendar-appointment-canceled .ppp-calendar-event-title {\n text-decoration: line-through;\n}\n\n/* An appointment's tooltip: its subject, then when, where and whether it repeats. */\n.ppp-calendar-tooltip {\n display: flex;\n flex-direction: column;\n gap: var(--spacingVerticalXXS);\n}\n\n.ppp-calendar-tooltip-subject {\n font-weight: var(--fontWeightSemibold);\n}\n`;\n\n/** Adds the calendar's stylesheet to the document once. */\nexport function ensureCalendarStyles(document: Document): void {\n ensureStyleSheet(document, STYLE_ID, calendarStyles);\n}\n\n/** Adds a stylesheet to the document once, by its id. */\nexport function ensureStyleSheet(document: Document, id: string, css: string): void {\n if (document.getElementById(id)) return;\n const style = document.createElement('style');\n style.id = id;\n style.textContent = css;\n document.head.appendChild(style);\n}\n","// An appointment as the calendar draws it, and the change the user asks for when they drag or\n// resize one. Framework-free.\n\n/**\n * How an appointment shows the time it takes, as Outlook's \"Show as\" does: busy as appointments are\n * drawn, free hollow, tentative striped, out of office in purple. The values are those of\n * `AppointmentShowAs` in C#, which the Blazor Calendar sends, and of the one `@powerportalspro/core`\n * exports, which React code passes: this folder can't import that package.\n */\nexport const AppointmentShowAs = {\n Busy: 0,\n Free: 1,\n Tentative: 2,\n OutOfOffice: 3,\n} as const;\nexport type AppointmentShowAs = (typeof AppointmentShowAs)[keyof typeof AppointmentShowAs];\n\n// The class an appointment is drawn with for each, which the calendar's stylesheet styles.\nconst SHOW_AS_CLASS: Record<AppointmentShowAs, string> = {\n [AppointmentShowAs.Busy]: 'ppp-calendar-appointment-busy',\n [AppointmentShowAs.Free]: 'ppp-calendar-appointment-free',\n [AppointmentShowAs.Tentative]: 'ppp-calendar-appointment-tentative',\n [AppointmentShowAs.OutOfOffice]: 'ppp-calendar-appointment-out-of-office',\n};\n\nexport interface CalendarAppointment {\n id: string;\n subject: string;\n start: Date | string;\n end: Date | string;\n allDay?: boolean;\n location?: string | null;\n /** An occurrence of a recurring series. */\n recurring?: boolean;\n /** False when the user may not move or resize this appointment; null or absent follows the calendar. */\n editable?: boolean | null;\n /** False when it can be moved but not resized: its table keeps no end it may change. */\n durationEditable?: boolean | null;\n /** The table of the row behind it, for a calendar that shows several. Absent for an appointment of the host's. */\n table?: string | null;\n /** The CSS color it is drawn in, its table's. Absent for the calendar's own. */\n color?: string | null;\n /** How it shows the time it takes. Busy when absent. */\n showAs?: AppointmentShowAs | null;\n /** Whether it was canceled: its subject is struck through. */\n canceled?: boolean | null;\n /**\n * The record behind it — for one the calendar loaded, every column of the view or query — for a\n * tooltip that shows more. A `TableRecord` in React; this folder can't import its type.\n */\n record?: unknown;\n}\n\n/** A move or resize the user made, which the host saves or refuses. */\nexport interface CalendarAppointmentChange {\n id: string;\n start: Date;\n end: Date | null;\n allDay: boolean;\n /** The table of the row moved, when the calendar loaded it. */\n table?: string | null;\n}\n\n/** FullCalendar's input for an appointment. */\nexport function toEventInput(appointment: CalendarAppointment) {\n return {\n id: appointment.id,\n title: appointment.subject,\n start: appointment.start,\n end: appointment.end,\n allDay: appointment.allDay ?? false,\n ...(appointment.editable == null ? {} : { editable: appointment.editable }),\n ...(appointment.durationEditable == null ? {} : { durationEditable: appointment.durationEditable }),\n ...(appointment.color ? { backgroundColor: appointment.color, borderColor: appointment.color } : {}),\n extendedProps: {\n table: appointment.table ?? null,\n location: appointment.location ?? null,\n recurring: appointment.recurring ?? false,\n // Read by the calendar's eventClass, which draws it: busy when it says nothing.\n showAs: appointment.showAs ?? null,\n canceled: appointment.canceled ?? false,\n record: appointment.record ?? null,\n },\n };\n}\n\n/** What FullCalendar keeps of an appointment, as its event. */\ninterface DrawnEvent {\n id: string;\n title: string;\n start: Date | null;\n end: Date | null;\n allDay: boolean;\n extendedProps: Record<string, unknown>;\n}\n\n/** An appointment as the calendar drew it, from its FullCalendar event: what a tooltip of the host's is given. */\nexport function appointmentFromEvent(event: DrawnEvent): CalendarAppointment {\n return {\n id: event.id,\n subject: event.title,\n start: event.start ?? new Date(Number.NaN),\n end: event.end ?? event.start ?? new Date(Number.NaN),\n allDay: event.allDay,\n location: (event.extendedProps['location'] as string | null | undefined) ?? null,\n recurring: event.extendedProps['recurring'] === true,\n showAs: (event.extendedProps['showAs'] as AppointmentShowAs | null | undefined) ?? null,\n canceled: event.extendedProps['canceled'] === true,\n record: event.extendedProps['record'] ?? null,\n table: (event.extendedProps['table'] as string | null | undefined) ?? null,\n };\n}\n\n/**\n * The classes an appointment is drawn with — how it shows its time, and whether it was canceled —\n * from what it says of both (an appointment's own fields, or the extended props they are drawn from).\n */\nexport function appointmentClassName(appointment: { showAs?: unknown; canceled?: unknown }): string {\n const showAs = SHOW_AS_CLASS[(appointment.showAs ?? AppointmentShowAs.Busy) as AppointmentShowAs] ?? SHOW_AS_CLASS[AppointmentShowAs.Busy];\n return appointment.canceled === true ? `${showAs} ppp-calendar-appointment-canceled` : showAs;\n}\n\ninterface ChangedEvent {\n id: string;\n start: Date | null;\n end: Date | null;\n allDay: boolean;\n extendedProps?: Record<string, unknown>;\n}\n\n/** The change FullCalendar reports after a drop or resize. */\nexport function toAppointmentChange(event: ChangedEvent): CalendarAppointmentChange {\n return {\n id: event.id,\n start: event.start ?? new Date(Number.NaN),\n end: event.end,\n allDay: event.allDay,\n table: (event.extendedProps?.['table'] as string | null | undefined) ?? null,\n };\n}\n","// What both stacks hand FullCalendar, apart from its plugins: each stack imports those from its\n// own FullCalendar package (React's or the vanilla one), which are separate builds of the same\n// views. Framework-free.\n\nimport { appointmentClassName } from './events.js';\n\n/**\n * How the calendar lays out its appointments — by the hour over a day or a week, a month of days, or\n * a list — named as the calendar's API names them on both stacks. A layout, not a view: a view is\n * the saved query that decides which appointments are shown. FullCalendar calls these views.\n */\nexport type CalendarLayout = 'day' | 'workWeek' | 'week' | 'month' | 'agenda';\n\nexport const calendarLayouts: readonly CalendarLayout[] = ['day', 'workWeek', 'week', 'month', 'agenda'];\n\n/** The layouts a calendar offers: those named, once each and in their order, or every one when none are. */\nexport function offeredLayouts(layouts?: readonly CalendarLayout[] | null): readonly CalendarLayout[] {\n const named = [...new Set((layouts ?? []).filter((layout) => calendarLayouts.includes(layout)))];\n return named.length > 0 ? named : calendarLayouts;\n}\n\n/** The layout a calendar opens in: the first of `preferred` it offers, else the first it offers. */\nexport function openingLayout(\n offered: readonly CalendarLayout[],\n ...preferred: (CalendarLayout | undefined)[]\n): CalendarLayout {\n return preferred.find((layout) => layout !== undefined && offered.includes(layout)) ?? offered[0]!;\n}\n\nconst fullCalendarViewNames: Record<CalendarLayout, string> = {\n day: 'timeGridDay',\n workWeek: 'pppWorkWeek',\n week: 'timeGridWeek',\n month: 'dayGridMonth',\n agenda: 'listWeek',\n};\n\n/** FullCalendar's name for the view that draws one of the calendar's layouts. */\nexport function toFullCalendarView(layout: CalendarLayout): string {\n return fullCalendarViewNames[layout];\n}\n\n/** The calendar's layout a FullCalendar view draws, or undefined for one it doesn't offer. */\nexport function fromFullCalendarView(name: string): CalendarLayout | undefined {\n return calendarLayouts.find((layout) => fullCalendarViewNames[layout] === name);\n}\n\n/**\n * Whether an appointment in this FullCalendar view is drawn on one line — its time, then its\n * subject — as Outlook draws them in a month's cells, where a taller one would leave room for none.\n */\nexport function isCompactView(fullCalendarViewType: string): boolean {\n return fullCalendarViewType.startsWith('dayGrid');\n}\n\n/** The strings FullCalendar draws itself, already localized. */\nexport interface CalendarText {\n allDay: string;\n noEvents: string;\n close: string;\n /** \"+{n} more\" in a month cell with more appointments than fit. */\n more: (count: number) => string;\n}\n\nexport interface CalendarOptionsInput {\n /** The layout it opens in. */\n layout: CalendarLayout;\n /**\n * The layouts it offers. A day's number opens that day only while `day` is one of them: otherwise\n * it would leave the layouts the calendar is limited to.\n */\n layouts: readonly CalendarLayout[];\n /** A local date (`2026-11-01`) in the period it opens on; today's when omitted. */\n date?: string | undefined;\n /**\n * The user's time zone (an IANA name), which the calendar shows its times and days in, as the\n * portal shows every date; the browser's when omitted.\n */\n timeZone?: string | undefined;\n editable: boolean;\n locale: string;\n direction: 'ltr' | 'rtl';\n text: CalendarText;\n}\n\n/** The options both stacks give FullCalendar. */\nexport function calendarOptions(input: CalendarOptionsInput) {\n return {\n initialView: toFullCalendarView(input.layout),\n timeZone: input.timeZone ?? 'local',\n ...(input.date ? { initialDate: input.date } : {}),\n views: {\n pppWorkWeek: { type: 'timeGridWeek', weekends: false },\n },\n class: 'ppp-calendar',\n // FullCalendar draws the \"+ more\" popover at the end of the page, outside the calendar, so it\n // carries the calendar's styles by a class of its own.\n popoverClass: 'ppp-calendar-popover',\n // The toolbar is each stack's own Fluent toolbar, driven through FullCalendar's controller.\n headerToolbar: false as const,\n height: '100%',\n locale: input.locale,\n direction: input.direction,\n editable: input.editable,\n selectable: input.editable,\n selectMirror: true,\n nowIndicator: true,\n dayMaxEvents: true,\n // Appointments at the same time sit side by side, as Outlook draws them, not cascaded.\n slotEventOverlap: false,\n navLinks: input.layouts.includes('day'),\n scrollTime: '08:00:00',\n slotDuration: '00:30:00',\n snapDuration: '00:15:00',\n // Each appointment's class says how it shows its time; a block (not a month's dot nor the\n // agenda's row) is marked too, for only a block has the fill free and tentative are drawn in.\n // FullCalendar joins these with its theme's own classes.\n eventClass: (info: { event: { extendedProps: Record<string, unknown> } }) =>\n `ppp-calendar-event-host ${appointmentClassName(info.event.extendedProps)}`,\n blockEventClass: 'ppp-calendar-appointment-block',\n allDayText: input.text.allDay,\n noEventsText: input.text.noEvents,\n closeHint: input.text.close,\n moreLinkText: (count: number) => input.text.more(count),\n };\n}\n","// What both stacks keep of the period on screen, in the URL. Framework-free.\n\nconst DAY_MS = 24 * 60 * 60 * 1000;\n\n/**\n * The date the URL keeps for the period a view shows: a date in its middle (`2026-11-04` for the\n * week of 1 November), as the calendar's time zone has it, or undefined while the period takes in\n * today — so a link to the current week or month keeps following today, as the Today button does.\n * The middle rather than the first day, because which day a week starts on depends on the locale: a\n * link opened under another one then shows the week that holds that day, not the week before.\n *\n * @param timeZone The calendar's time zone (an IANA name); the browser's when omitted.\n */\nexport function periodDate(\n currentStart: Date,\n currentEnd: Date,\n now: Date = new Date(),\n timeZone?: string,\n): string | undefined {\n if (now >= currentStart && now < currentEnd) return undefined;\n // Days, not milliseconds, so a change of clocks inside the period doesn't move the middle; and\n // the middle day's noon, which no change of clocks moves into another day.\n const days = Math.round((currentEnd.getTime() - currentStart.getTime()) / DAY_MS);\n const middle = new Date(currentStart.getTime() + Math.floor(days / 2) * DAY_MS + DAY_MS / 2);\n return localDate(middle, timeZone);\n}\n\n/** The date an instant falls on in a time zone, or the browser's, as `yyyy-mm-dd`. */\nexport function localDate(instant: Date, timeZone?: string): string {\n const parts = new Intl.DateTimeFormat('en-US', {\n ...(timeZone ? { timeZone } : {}),\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n }).formatToParts(instant);\n const part = (type: Intl.DateTimeFormatPartTypes) => parts.find((x) => x.type === type)?.value ?? '';\n return `${part('year').padStart(4, '0')}-${part('month')}-${part('day')}`;\n}\n","// Where a New button starts an appointment. Framework-free.\n\nconst MINUTE_MS = 60 * 1000;\n\n/** How long a new appointment lasts: one of the calendar's slots, as Outlook's does. */\nconst LENGTH_MINUTES = 30;\n\n/** The hour a new appointment on a day other than today starts at: where the calendar scrolls to. */\nconst DAY_START_MINUTES = 8 * 60;\n\n/**\n * The time a New button gives a new appointment, as Outlook does: from the next half hour when the\n * period shown takes in today, and otherwise from 8:00 on its first day — half an hour, in the\n * calendar's time zone.\n *\n * @param currentStart The first moment of the period shown (a view's `currentStart`).\n * @param currentEnd The moment after it (a view's `currentEnd`).\n * @param timeZone The calendar's time zone (an IANA name); the browser's when omitted.\n */\nexport function newAppointmentRange(\n currentStart: Date,\n currentEnd: Date,\n now: Date = new Date(),\n timeZone?: string,\n): { start: Date; end: Date; allDay: false } {\n let start: Date;\n if (now >= currentStart && now < currentEnd) {\n // The next half hour on the clock of the time zone — now itself when it is one.\n const past = (minutesOfDay(now, timeZone) % LENGTH_MINUTES) * MINUTE_MS + (now.getTime() % MINUTE_MS);\n start = new Date(now.getTime() + (past === 0 ? 0 : LENGTH_MINUTES * MINUTE_MS - past));\n } else {\n // 8:00 on the first day: eight hours on, less any change of clocks in between.\n const guess = new Date(currentStart.getTime() + DAY_START_MINUTES * MINUTE_MS);\n start = new Date(guess.getTime() - (minutesOfDay(guess, timeZone) - DAY_START_MINUTES) * MINUTE_MS);\n }\n return { start, end: new Date(start.getTime() + LENGTH_MINUTES * MINUTE_MS), allDay: false };\n}\n\n/** The minutes since midnight an instant shows on a time zone's clock, or the browser's. */\nfunction minutesOfDay(instant: Date, timeZone?: string): number {\n const parts = new Intl.DateTimeFormat('en-US', {\n ...(timeZone ? { timeZone } : {}),\n hourCycle: 'h23',\n hour: '2-digit',\n minute: '2-digit',\n }).formatToParts(instant);\n const part = (type: Intl.DateTimeFormatPartTypes) => Number(parts.find((x) => x.type === type)?.value ?? 0);\n return part('hour') * 60 + part('minute');\n}\n","// What both stacks show of an appointment when it is hovered: its subject, when it is, where, and\n// whether it is part of a series. Framework-free.\n\n// Formatters by locale, zone and kind, as building one costs far more than using it and a month\n// can hold hundreds of appointments.\nconst formatters = new Map<string, Intl.DateTimeFormat>();\n\nfunction formatter(locale: string, timeZone: string | undefined, allDay: boolean): Intl.DateTimeFormat {\n const key = `${locale}|${timeZone ?? ''}|${allDay}`;\n let format = formatters.get(key);\n if (!format) {\n format = new Intl.DateTimeFormat(locale, {\n ...(timeZone ? { timeZone } : {}),\n ...(allDay\n ? { weekday: 'short', month: 'short', day: 'numeric', year: 'numeric' }\n : { weekday: 'short', month: 'short', day: 'numeric', hour: 'numeric', minute: '2-digit' }),\n });\n formatters.set(key, format);\n }\n return format;\n}\n\n/**\n * When an appointment is, in the user's language and time zone: `Tue, Oct 27, 9:00 – 10:30 AM`.\n *\n * @param timeZone The calendar's time zone (an IANA name); the browser's when omitted.\n */\nexport function formatAppointmentWhen(\n start: Date,\n end: Date | null,\n allDay: boolean,\n locale: string,\n timeZone?: string,\n): string {\n if (allDay) {\n // An all-day appointment ends at the start of the day after its last; a range within one day\n // is written as that day.\n const last = end && end > start ? new Date(end.getTime() - 1) : start;\n return formatter(locale, timeZone, true).formatRange(start, last);\n }\n const times = formatter(locale, timeZone, false);\n return end && end > start ? times.formatRange(start, end) : times.format(start);\n}\n\n/** The lines of an appointment's tooltip, the subject first. */\nexport interface AppointmentSummary {\n subject: string;\n when: string;\n location: string | null;\n /** The text saying it is part of a series, or null when it isn't. */\n recurring: string | null;\n}\n\n/** The summary of a FullCalendar event the calendar drew from an appointment. */\nexport function summarizeAppointment(\n event: {\n title: string;\n start: Date | null;\n end: Date | null;\n allDay: boolean;\n extendedProps: Record<string, unknown>;\n },\n locale: string,\n recurringText: string,\n timeZone?: string,\n): AppointmentSummary {\n return {\n subject: event.title,\n when: event.start ? formatAppointmentWhen(event.start, event.end, event.allDay, locale, timeZone) : '',\n location: (event.extendedProps['location'] as string | null | undefined) ?? null,\n recurring: event.extendedProps['recurring'] ? recurringText : null,\n };\n}\n\n/** How long the pointer rests on an appointment before its tooltip shows, in milliseconds. */\nexport const APPOINTMENT_TOOLTIP_DELAY_MS = 300;\n","import { Tooltip } from '@fluentui/react-components';\nimport { useEffect, useRef, useState, type ReactElement, type ReactNode } from 'react';\nimport { APPOINTMENT_TOOLTIP_DELAY_MS, type AppointmentSummary } from './core/index.js';\n\n/**\n * An appointment's tooltip, once the pointer or the focus has rested on it a moment: the calendar's\n * summary, always there to describe the appointment to a screen reader as it takes the focus; or the\n * host's own, drawn only while it shows (`content` a function), so a busy month doesn't draw a\n * template for every appointment on it.\n *\n * The wait is the calendar's, not Fluent's. Fluent shows a tooltip at once while another is up, so\n * that moving along a toolbar doesn't wait at each button — but moving across a busy week would then\n * pop every appointment's tooltip up as the pointer passes over it. The Blazor Calendar's, a Fluent\n * web component given the same delay, waits each time.\n */\nexport function AppointmentTooltip({ content, children }: { content: ReactNode | (() => ReactNode); children: ReactElement }) {\n const [visible, setVisible] = useState(false);\n const wait = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n useEffect(() => () => clearTimeout(wait.current), []);\n\n return (\n <Tooltip\n relationship=\"description\"\n withArrow\n visible={visible}\n showDelay={0}\n hideDelay={0}\n onVisibleChange={(_, data) => {\n clearTimeout(wait.current);\n if (data.visible) wait.current = setTimeout(() => setVisible(true), APPOINTMENT_TOOLTIP_DELAY_MS);\n else setVisible(false);\n }}\n content={\n typeof content !== 'function' ? (\n <div className=\"ppp-calendar-tooltip\">{content}</div>\n ) : visible ? (\n <div className=\"ppp-calendar-tooltip\">{content()}</div>\n ) : (\n ''\n )\n }\n >\n {children}\n </Tooltip>\n );\n}\n\n/** The calendar's own tooltip: the appointment's subject, then when, where and whether it repeats. */\nexport function AppointmentSummaryContent({ summary }: { summary: AppointmentSummary }) {\n return (\n <>\n <span className=\"ppp-calendar-tooltip-subject\">{summary.subject}</span>\n <span>{summary.when}</span>\n {summary.location && <span>{summary.location}</span>}\n {summary.recurring && <span>{summary.recurring}</span>}\n </>\n );\n}\n","import type { TableRecord, TableRecordReference } from '@powerportalspro/core';\n\n/**\n * A new appointment, as a range selected in an editable calendar starts it: its start and end, all\n * day when the range is whole days, and about the record the calendar is regarding, by the name its\n * lookup shows. The Blazor Calendar's NewAppointmentAsync is its twin.\n */\nexport function newAppointment(\n range: { start: Date; end: Date; allDay: boolean },\n regarding?: (TableRecordReference & { name?: string | null }) | null,\n): TableRecord {\n return {\n tableName: 'appointment',\n properties: {\n scheduledstart: { $type: 2, value: range.start.toISOString() },\n scheduledend: { $type: 2, value: range.end.toISOString() },\n isalldayevent: { $type: 0, value: range.allDay },\n ...(regarding?.id\n ? {\n regardingobjectid: {\n $type: 6,\n value: regarding.id,\n tableName: regarding.tableName,\n ...(regarding.name ? { name: regarding.name } : {}),\n },\n }\n : {}),\n },\n } as TableRecord;\n}\n","import {\n TableSecurityPermission,\n type MultiTableItem,\n type MultiTableTableInfo,\n type MultiTableViewTable,\n type TableRecord,\n} from '@powerportalspro/core';\nimport type { CalendarAppointment } from './calendar-appointment.js';\nimport { AppointmentShowAs, type CalendarAppointmentChange } from './core/index.js';\nimport { localDate } from './core/state.js';\n\n// The rows a calendar reads of several tables: how a row becomes what the calendar draws, and what\n// saving a row the user moved writes. The Blazor Calendar's Calendar.Tables.cs is the twin of these.\n\n/** The table a calendar creates appointments in, and whose rows open in its details dialog. */\nexport const APPOINTMENT_TABLE = 'appointment';\n\n/** The view of every table, offered when the page names no view: its id stands for none. */\nexport const EVERY_TABLE_VIEW_ID = '00000000-0000-0000-0000-000000000000';\n\n/** The table of a recurring appointment's series, which a calendar showing each series once shows. */\nexport const SERIES_TABLE = 'recurringappointmentmaster';\n\n/** The tables shown at first when the calendar shows every table. */\nexport const DEFAULT_CALENDAR_TABLES: readonly string[] = [APPOINTMENT_TABLE, 'task'];\n\n/**\n * The appointment's columns the calendar draws beyond the registration's, and every table's state,\n * which says whether a row is closed.\n */\nexport const CALENDAR_COLUMNS: Readonly<Record<string, string[]>> = {\n [APPOINTMENT_TABLE]: ['location', 'seriesid', 'instancetypecode', 'statecode', 'statuscode'],\n '*': ['statecode'],\n};\n\nconst MINUTE_MS = 60 * 1000;\nconst DAY_MS = 24 * 60 * MINUTE_MS;\n\nfunction valueOf(record: TableRecord | null | undefined, column: string): unknown {\n return (record?.properties?.[column] as { value?: unknown } | null | undefined)?.value;\n}\n\nfunction stateOf(item: MultiTableItem): number | null {\n const state = valueOf(item.record, 'statecode');\n return typeof state === 'number' ? state : null;\n}\n\n/** Whether a row is closed — completed or canceled, or an inactive row — which Dataverse refuses to change. */\nexport function isClosed(item: MultiTableItem): boolean {\n const state = stateOf(item);\n return state === 1 || state === 2;\n}\n\n/**\n * How an appointment shows its time, from its status reason. Dataverse's own: 1 Free and\n * 2 Tentative (open), 5 Busy and 6 Out of Office (scheduled), 3 Completed and 4 Canceled — a\n * completed one shows as busy, a canceled one as free. One added to an environment shows as its\n * state's: free when open or canceled, otherwise busy.\n */\nexport function showAsOf(statusCode: number | null, stateCode: number | null): AppointmentShowAs {\n switch (statusCode) {\n case 1:\n case 4:\n return AppointmentShowAs.Free;\n case 2:\n return AppointmentShowAs.Tentative;\n case 3:\n case 5:\n return AppointmentShowAs.Busy;\n case 6:\n return AppointmentShowAs.OutOfOffice;\n default:\n return stateCode === 0 || stateCode === 2 ? AppointmentShowAs.Free : AppointmentShowAs.Busy;\n }\n}\n\n/** The moment a day starts in a time zone, or the browser's. */\nexport function zonedMidnight(date: string, timeZone?: string): Date {\n const [year, month, day] = date.split('-').map(Number) as [number, number, number];\n const wanted = Date.UTC(year, month - 1, day);\n let guess = wanted;\n // Twice: the zone's offset at the first guess can differ from the one at midnight.\n for (let i = 0; i < 2; i++) {\n const parts = new Intl.DateTimeFormat('en-US', {\n ...(timeZone ? { timeZone } : {}),\n hourCycle: 'h23',\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit',\n }).formatToParts(new Date(guess));\n const part = (type: Intl.DateTimeFormatPartTypes) => Number(parts.find((x) => x.type === type)?.value ?? 0);\n const shown = Date.UTC(part('year'), part('month') - 1, part('day'), part('hour'), part('minute'));\n guess = wanted - (shown - guess);\n }\n return new Date(guess);\n}\n\n/**\n * Where a row is drawn: a date-only row on its day in the user's zone, which its UTC midnight isn't\n * west of Greenwich; any other at its moments.\n */\nexport function drawnTimes(item: MultiTableItem, dateOnly: boolean, timeZone?: string): { start: Date; end: Date } {\n const start = new Date(item.start);\n const end = new Date(item.end);\n if (!dateOnly) return { start, end };\n const first = start.toISOString().slice(0, 10);\n let after = end.toISOString().slice(0, 10);\n if (after <= first) after = new Date(start.getTime() + DAY_MS).toISOString().slice(0, 10);\n return { start: zonedMidnight(first, timeZone), end: zonedMidnight(after, timeZone) };\n}\n\n/**\n * What the calendar draws of a row. It can be moved when the user may write it, it isn't closed, and\n * they may change its start; resized when they may change its end too. An appointment keeps how it\n * shows its time, whether it was canceled and its series. The Blazor Calendar's `ToAppointment` is\n * its twin.\n */\nexport function fromMultiTableItem(\n item: MultiTableItem,\n info: MultiTableTableInfo | undefined,\n drawn: { start: Date; end: Date },\n): CalendarAppointment {\n const definition = info?.definition;\n const changeable = new Set((info?.changeableColumns ?? []).map((x) => x.toLowerCase()));\n const movable =\n (Number(item.permissions ?? 0) & TableSecurityPermission.Write) !== 0 &&\n !isClosed(item) &&\n !!definition?.start &&\n changeable.has(definition.start.toLowerCase());\n const resizable = movable && !!definition?.end && changeable.has(definition.end.toLowerCase());\n const isAppointment = item.table === APPOINTMENT_TABLE;\n const state = stateOf(item);\n const location = valueOf(item.record, 'location');\n const status = valueOf(item.record, 'statuscode');\n return {\n id: item.id,\n table: item.table,\n subject: item.title ?? '',\n start: drawn.start,\n end: drawn.end,\n allDay: item.isAllDay ?? false,\n location: isAppointment && typeof location === 'string' ? location : null,\n recurring: item.table === SERIES_TABLE || (isAppointment && !!valueOf(item.record, 'seriesid')),\n editable: movable ? null : false,\n durationEditable: resizable ? null : false,\n showAs: isAppointment ? showAsOf(typeof status === 'number' ? status : null, state) : AppointmentShowAs.Busy,\n canceled: state === 2,\n color: definition?.color ?? null,\n record: item.record ?? null,\n };\n}\n\n/** A moment as a column keeps it: a date-only column, the day it falls on in the user's zone. */\nfunction stored(moment: Date, dateOnly: boolean, timeZone?: string): string {\n return dateOnly ? `${localDate(moment, timeZone)}T00:00:00.000Z` : moment.toISOString();\n}\n\n/**\n * What saving a row the user moved or resized writes: its start, its end when it has one or its\n * length changed, and whether it takes whole days, where its table keeps that. Null for a move the\n * calendar refuses: between whole days and times its table can't keep. The Blazor Calendar's\n * `SaveMoveAsync` is its twin.\n */\nexport function moveRecord(\n change: CalendarAppointmentChange,\n item: MultiTableItem,\n info: MultiTableTableInfo | undefined,\n dateOnly: boolean,\n timeZone?: string,\n): TableRecord | null {\n const definition = info?.definition;\n if (!definition?.start) return null;\n const changeable = new Set((info?.changeableColumns ?? []).map((x) => x.toLowerCase()));\n const allDayColumn = definition.allDay && changeable.has(definition.allDay.toLowerCase()) ? definition.allDay : null;\n if (change.allDay !== (item.isAllDay ?? false) && !allDayColumn) return null;\n if (dateOnly && !change.allDay) return null;\n\n // A drop with no end: a day for one taking whole days, else the calendar's half hour.\n const end = change.end ?? new Date(change.start.getTime() + (change.allDay ? DAY_MS : 30 * MINUTE_MS));\n const drawn = drawnTimes(item, dateOnly, timeZone);\n const lengthChanged = end.getTime() - change.start.getTime() !== drawn.end.getTime() - drawn.start.getTime();\n const properties: Record<string, unknown> = {\n [definition.start]: { $type: 2, value: stored(change.start, dateOnly, timeZone) },\n };\n if (definition.end && (!item.hasNoEnd || lengthChanged))\n properties[definition.end] = { $type: 2, value: stored(end, dateOnly, timeZone) };\n if (allDayColumn) properties[allDayColumn] = { $type: 0, value: change.allDay };\n return { tableName: item.table, id: item.id, properties } as TableRecord;\n}\n\n/**\n * The tables a view shows the user: those it names that are registered and readable — a view of\n * every activity, each activity table — narrowed to the calendar's. Every registered table for the\n * view of every table; null for a view kept in Dataverse not read yet, whose tables the server knows.\n */\nexport function tablesOf(\n tables: readonly MultiTableViewTable[] | null,\n registered: readonly MultiTableTableInfo[],\n allowed: ReadonlySet<string> | null,\n stored: readonly string[] | null | undefined,\n isStoredView: boolean,\n): string[] | null {\n let named: string[];\n if (tables) named = tables.map((x) => x.table ?? '');\n else if (isStoredView) {\n if (!stored) return null;\n named = [...stored];\n } else named = registered.map((x) => x.table ?? '');\n const expanded = named.flatMap((table) =>\n table.toLowerCase() === 'activitypointer'\n ? registered.filter((x) => x.isActivity).map((x) => x.table ?? '')\n : [table.toLowerCase()],\n );\n return [...new Set(expanded)].filter(\n (table) => registered.some((x) => x.table === table) && (!allowed || allowed.has(table)),\n );\n}\n\n/**\n * The tables switched off at first in a view: those of every table not among the defaults, when any\n * default is there to show.\n */\nexport function hiddenByDefault(viewId: string | undefined, shown: readonly string[], defaults: ReadonlySet<string>): string[] {\n if (viewId !== EVERY_TABLE_VIEW_ID || !shown.some((table) => defaults.has(table))) return [];\n return shown.filter((table) => !defaults.has(table));\n}\n","import {\n defaultViewId,\n isViewHidden,\n type MultiTableViewDefinition,\n type SavedViewControl,\n type UserViewSetting,\n} from '@powerportalspro/core';\nimport type { CalendarLayout } from './core/index.js';\nimport { EVERY_TABLE_VIEW_ID } from './calendar-rows.js';\n\n// Which views the calendar offers. The Blazor Calendar's OfferedViewIds and PageViewIds are the twins\n// of these; its filter is react-fluent's multi-table-filters, as the timeline's is.\n\n/**\n * The page's views on offer, by lowercase id, the one the calendar opens on first: its Dataverse\n * views, views of several tables and views defined in code — or, with none, the view of every table.\n */\nexport function offeredViewIds(\n defaultViewId: string | undefined,\n viewIds: readonly string[] | undefined,\n multiTableViewIds: readonly string[] | undefined,\n customViews: readonly MultiTableViewDefinition[] | undefined,\n): string[] {\n const ids = [\n ...(defaultViewId ? [defaultViewId] : []),\n ...(viewIds ?? []),\n ...(multiTableViewIds ?? []),\n ...(customViews ?? []).map((view) => view.id),\n ].map((id) => id.toLowerCase());\n return ids.length === 0 ? [EVERY_TABLE_VIEW_ID] : [...new Set(ids)];\n}\n\n/** The view defined in code with this id, if it is one. */\nexport function findCustomView(\n id: string | undefined,\n customViews: readonly MultiTableViewDefinition[] | undefined,\n): MultiTableViewDefinition | undefined {\n if (!id) return undefined;\n return customViews?.find((view) => view.id.toLowerCase() === id.toLowerCase());\n}\n\n/** The view shown: the one picked while it is on offer, otherwise the first offered. */\nexport function selectedViewId(offered: readonly string[], picked: string | undefined): string | undefined {\n return picked && offered.includes(picked.toLowerCase()) ? picked.toLowerCase() : offered[0];\n}\n\n/**\n * Whether views are on offer that a link can name: the page's or the user's, not only the view of\n * every table a page that names none shows — it may name them later.\n */\nexport function offersViews(offered: readonly string[]): boolean {\n return offered.some((id) => id !== EVERY_TABLE_VIEW_ID);\n}\n\n/** An entity of a table with no filter of its own: every row the user may read. */\nexport function everyRow(table: string): string {\n return `<fetch><entity name=\"${table}\" /></fetch>`;\n}\n\n/**\n * The views on offer with the user's saved ones: the page's and theirs, the one the calendar opens on\n * first — the user's default, or the page's — without the ones they hid, unless it shows one.\n * Without saved views offered, the page's. The Blazor Calendar's WithSavedViews is its twin.\n */\nexport function withSavedViews(\n pageViews: readonly string[],\n savedViews: readonly string[],\n settings: readonly UserViewSetting[],\n control: SavedViewControl,\n shown: string | undefined,\n offersSavedViews: boolean,\n): string[] {\n if (!offersSavedViews) return [...pageViews];\n let all = [...new Set([...pageViews, ...savedViews].map((id) => id.toLowerCase()))];\n const userDefault = defaultViewId(settings, all, control);\n if (userDefault) all = [userDefault, ...all.filter((id) => id !== userDefault)];\n const offered = all.filter((id) => id === shown?.toLowerCase() || !isViewHidden(settings, id, control));\n return offered.length > 0 ? offered : all;\n}\n\nconst LAYOUTS: readonly CalendarLayout[] = ['day', 'workWeek', 'week', 'month', 'agenda'];\n\n/**\n * The layout a saved view opens the calendar in, kept in its calendar layout column as\n * `{\"version\":1,\"layout\":\"month\"}`: undefined for none, or one that can't be read. The Blazor\n * Calendar's ReadSavedLayout is its twin.\n */\nexport function readSavedLayout(json: string | undefined): CalendarLayout | undefined {\n if (!json?.trim()) return undefined;\n try {\n const layout = (JSON.parse(json) as { layout?: unknown }).layout;\n return LAYOUTS.find((x) => x === layout);\n } catch {\n return undefined;\n }\n}\n\n/** The JSON a saved view keeps the calendar's layout in. */\nexport function writeSavedLayout(layout: CalendarLayout): string {\n return JSON.stringify({ version: 1, layout });\n}\n","\n:root {\n --fc-sticky-header-footer-z: 3;\n --fc-popover-z: 4;\n}\n\n.fc-rk {\n z-index: var(--fc-popover-z) !important;\n}\n\n.fc-gE {\n isolation: isolate;\n}\n\n/*\nThis will prevent all ancestors from customizing their box size unless they use .contentBox\n*/\n.fc-wY,\n.fc-wY *,\n.fc-wY *:before,\n.fc-wY *:after {\n box-sizing: border-box !important;\n}\n\n/* classes attached to <body> */\n.fc-8m,\n.fc-8m * {\n cursor: not-allowed !important;\n}\n\n.fc-Is {\n -ms-overflow-style: none !important; /* IE and Edge */\n scrollbar-width: none !important; /* Firefox */\n}\n\n/* Hide scrollbar for Chrome, Safari and Opera */\n.fc-Is::-webkit-scrollbar {\n display: none !important;\n}\n\n.fc-Ps {\n flex-shrink: 0 !important;\n}\n\n.fc-qC .fc-VR {\n display: flex !important;\n flex-direction: row !important;\n flex-wrap: wrap !important;\n}\n\n/* HACK for Safari. Can't do break-inside:avoid with flexbox items, likely b/c it's not standard:\n https://stackoverflow.com/a/60256345 */\n.fc-hF .fc-VR > * {\n float: left !important;\n}\n\n[dir=rtl] .fc-hF .fc-VR > *,\n.fc-hF[dir=rtl] .fc-VR > * {\n float: right !important;\n}\n\n.fc-hF .fc-VR::after {\n content: \"\" !important;\n display: block !important;\n clear: both !important;\n}\n\n.fc-Zu {\n cursor: pointer !important;\n}\n\n.fc-Hs {\n cursor: n-resize !important;\n}\n\n.fc-J0 {\n cursor: s-resize !important;\n}\n\n.fc-jI {\n cursor: w-resize !important;\n}\n\n[dir=rtl] .fc-jI {\n cursor: e-resize !important;\n}\n\n.fc-Nk {\n cursor: e-resize !important;\n}\n\n[dir=rtl] .fc-Nk {\n cursor: w-resize !important;\n}\n\n.fc-Mg {\n cursor: col-resize !important;\n}\n\n.fc-0r,\n.fc-Zc,\n.fc-yR {\n position: absolute !important;\n box-sizing: content-box !important;\n width: 100% !important;\n height: 100% !important;\n}\n\n.fc-0r {\n padding: 10px !important;\n margin: -10px !important;\n}\n\n.fc-Zc {\n padding-left: 10px !important;\n padding-right: 10px !important;\n margin-left: -10px !important;\n margin-right: -10px !important;\n}\n\n.fc-yR {\n padding-top: 10px !important;\n padding-bottom: 10px !important;\n margin-top: -10px !important;\n margin-bottom: -10px !important;\n}\n\n/* QUESTION: why not use -left -right instead of negative margins/padding for ALL? */\n.fc-JB {\n position: absolute;\n top: 0;\n bottom: 0;\n left: -5px;\n right: -5px;\n}\n\n.fc-uv {\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n}\n\n.fc-B9 {\n visibility: hidden;\n}\n\n/* Border Utils */\n/* ------------------------------------------------------------------------------------------------- */\n\n.fc-13 {\n border: 0 !important;\n}\n\n.fc-MT {\n border-left: 0 !important;\n border-right: 0 !important;\n}\n\n.fc-60 {\n border-top: 0 !important;\n border-bottom: 0 !important;\n}\n\n.fc-qy {\n border-top: 0 !important;\n}\n\n.fc-lE {\n border-bottom: 0 !important;\n}\n\n.fc-MR {\n border-inline-start: 0 !important;\n}\n\n.fc-li {\n border-inline-end: 0 !important;\n}\n\n/* Flexbox Utils */\n/* ------------------------------------------------------------------------------------------------- */\n\n.fc-mN {\n display: flex !important;\n flex-direction: row !important;\n}\n\n.fc-mU {\n display: flex !important;\n flex-direction: column !important;\n}\n\n.fc-l7 {\n flex-grow: 1 !important;\n}\n\n.fc-OV {\n flex-grow: 1 !important;\n flex-basis: 0 !important;\n min-width: 0 !important;\n min-height: 0 !important;\n}\n\n.fc-bW {\n min-height: 0 !important;\n}\n\n/*\nTODO: use liquidX/Y elsewhere because frees up min other dimension; less collisions\n*/\n.fc-cq {\n flex-grow: 1 !important;\n flex-basis: 0 !important;\n min-width: 0 !important;\n}\n\n/* Semantic Print Table */\n/* ------------------------------------------------------------------------------------------------- */\n\n.fc-A8 {\n width: 100% !important;\n table-layout: fixed !important;\n border: 0 !important;\n border-collapse: separate !important;\n border-spacing: 0 !important;\n}\n\n.fc-A8 > thead {\n /* Both properties are needed for cross-browser repeated headers across printed pages. */\n -moz-column-break-inside: avoid !important;\n break-inside: avoid !important;\n page-break-inside: avoid !important;\n}\n\n.fc-A8 > tbody {\n /* Timeline print-layout hack (resource and non-resource): lets shared absolute backgrounds show through. */\n background: transparent !important;\n}\n\n.fc-A8 > thead > tr > th,\n.fc-A8 > tbody > tr > th,\n.fc-A8 > tbody > tr > td {\n vertical-align: top !important;\n font-weight: inherit;\n text-align: inherit;\n}\n\n/* Table Utils */\n/* ------------------------------------------------------------------------------------------------- */\n\n.fc-Ju {\n padding: 0 !important;\n}\n\n.fc-Eh {\n padding-top: 0 !important;\n padding-bottom: 0 !important;\n}\n\n.fc-yU {\n margin: 0 !important;\n}\n\n.fc-6S {\n margin-top: 0 !important;\n margin-bottom: 0 !important;\n}\n\n.fc-ve {\n margin-left: 0 !important;\n margin-right: 0 !important;\n}\n\n.fc-aG {\n white-space: nowrap !important;\n}\n\n.fc-v9 {\n white-space: pre !important;\n}\n\n/* Misc Utils */\n/* ------------------------------------------------------------------------------------------------- */\n\n.fc-C4 {\n overflow-anchor: none;\n}\n\n.fc-rX {\n pointer-events: none !important;\n}\n\n.fc-mR {\n overflow: hidden !important;\n}\n\n/*\nTODO: eventually use this on daygrid/timegrid events' inner, time, and title, FOR PRINT\nNeeded to prevent wrapping to multiple lines, increasing height, throwing off print-positioning,\nwhich can't rely on dynamic height detection after print-flag activated.\n*/\n.fc-Kv {\n white-space: nowrap !important;\n overflow: hidden !important;\n}\n\n.fc-Ru {\n position: relative !important;\n}\n\n.fc-r6 {\n position: absolute !important;\n}\n\n.fc-2W {\n inset-inline-start: 0 !important;\n}\n\n.fc-0D {\n inset-inline-end: 0 !important;\n}\n\n.fc-9b {\n position: absolute !important;\n top: 0 !important;\n left: 0 !important;\n right: 0 !important;\n bottom: 0 !important;\n}\n\n.fc-6Q,\n.fc-zm {\n position: absolute !important;\n left: 0 !important;\n right: 0 !important;\n}\n\n.fc-9F,\n.fc-Ma {\n position: absolute !important;\n top: 0 !important;\n bottom: 0 !important;\n}\n\n.fc-6Q {\n top: 0 !important;\n}\n\n.fc-Ma {\n left: 0 !important;\n right: 0 !important;\n width: 0 !important;\n}\n\n@media not print {\n .fc-Yy {\n position: sticky !important;\n }\n\n .fc-DR {\n position: sticky !important;\n top: 0 !important;\n }\n\n /* Sticks to either left or right (the flex \"start\") depending on ltr/rtl */\n .fc-QU {\n position: sticky !important;\n inset-inline-start: 0 !important;\n }\n\n .fc-5M {\n position: sticky !important;\n top: 0 !important;\n z-index: var(--fc-sticky-header-footer-z) !important;\n }\n}\n\n/* Only needed when padding/border must be separate from width/height */\n.fc-qN {\n box-sizing: content-box !important;\n}\n\n/* Out of view but keeps its real size, for measurement probes. For screen-reader text, use .srOnly.\nHidden also means not focusable, clickable, or read by screen readers */\n.fc-rU {\n position: absolute !important;\n left: -10000px !important;\n visibility: hidden !important;\n}\n\n/* Visually hidden but read by screen readers. Unlike .offscreen, never causes scroll overflow */\n.fc-og {\n position: absolute !important;\n width: 1px !important;\n height: 1px !important;\n margin: 0 !important;\n padding: 0 !important;\n border: 0 !important;\n overflow: hidden !important;\n clip-path: inset(50%) !important;\n white-space: nowrap !important;\n}\n\n.fc-hm {\n align-items: center !important;\n}\n\n.fc-cI {\n align-items: flex-start !important;\n}\n\n.fc-Qq {\n align-items: flex-end !important;\n}\n\n/* Footer Scrollbar */\n/* ------------------------------------------------------------------------------------------------- */\n\n.fc-se {\n position: sticky !important;\n bottom: 0 !important;\n z-index: var(--fc-sticky-header-footer-z) !important;\n}\n\n.fc-Vd > * {\n margin-top: -1px !important;\n}\n\n.fc-Vd > * > * {\n height: 1px !important;\n}\n\n/* Print Utils */\n/* ------------------------------------------------------------------------------------------------- */\n\n.fc-or {\n -moz-column-break-inside: avoid !important;\n break-inside: avoid !important;\n page-break-inside: avoid !important;\n}\n\n.fc-Lx {\n min-height: 4em !important;\n}\n\n.fc-vn {\n display: flow-root !important;\n}\n\n/* Z-index */\n/* ------------------------------------------------------------------------------------------------- */\n\n.fc-mP {\n z-index: 0;\n}\n\n.fc-NW {\n z-index: 1;\n}\n\n.fc-Zs {\n z-index: 2;\n}\n\n.fc-D7 {\n z-index: 3;\n}\n\n.fc-Se {\n z-index: 4;\n}\n\n.fc-kE {\n z-index: 5;\n}\n\n.fc-Y9 {\n z-index: 1000;\n}\n\n.fc-DP {\n z-index: 9999;\n}\n\n.fc-Xr:focus-visible {\n z-index: 2;\n}\n\n/* INTERNAL MARKER -- used to mark an element for internal significance */\n/* ------------------------------------------------------------------------------------------------- */\n\n.fc-8W {}\n\n.fc-Ad {}\n.fc-oG {}\n.fc-Yb {}\n.fc-JA {}\n.fc-4p {}\n.fc-IR {}\n.fc-tW {}\n.fc-8h {}\n\n.fc-Jv {}\n\n.fc-XX {}\n\n.fc-89 {}\n\n.fc-wF {}\n\n.fc-tw {}\n\n.fc-ox {}\n",".fc-forma-n5m {\n font-size: 16px;\n line-height: 1.5;\n --fc-forma-border-style: solid;\n}\n\n.fc-forma-Z9U {\n appearance: button;\n font: inherit;\n font-feature-settings: inherit;\n font-variation-settings: inherit;\n letter-spacing: inherit;\n color: inherit;\n opacity: 1;\n background-color: #0000;\n border-radius: 0;\n margin: 0;\n border: 0;\n padding: 0\n}\n\n.fc-forma-JiE {\n color: inherit;\n text-decoration: inherit;\n}\n\n.fc-forma-3Lc {\n pointer-events: none\n}\n\n.fc-forma-1EY {\n position: absolute\n}\n\n.fc-forma-eYX {\n position: relative\n}\n\n.fc-forma-MaV {\n inset-inline: 0\n}\n\n.fc-forma-AWB {\n inset-block: 0\n}\n\n.fc-forma-0fm {\n inset-inline-start: -8px\n}\n\n.fc-forma-Tuc {\n inset-inline-end: -4px\n}\n\n.fc-forma-iD1 {\n inset-inline-end: 0\n}\n\n.fc-forma-SyR {\n inset-inline-end: 4px\n}\n\n.fc-forma-dnf {\n inset-inline-end: -3px\n}\n\n.fc-forma-YDC {\n top: -4px\n}\n\n.fc-forma-n9G {\n top: 0\n}\n\n.fc-forma-2ik {\n top: 2px\n}\n\n.fc-forma-ZnE {\n top: 4px\n}\n\n.fc-forma-ERR {\n top: 50%\n}\n\n.fc-forma-fJL {\n bottom: -4px\n}\n\n.fc-forma-1V6 {\n left: 50%\n}\n\n.fc-forma-aAW {\n margin: -6px\n}\n\n.fc-forma-CH7 {\n margin: -1px\n}\n\n.fc-forma-gMS {\n margin: 4px\n}\n\n.fc-forma-bvX {\n margin: 8px\n}\n\n.fc-forma-jD5 {\n margin: 16px\n}\n\n.fc-forma-cKZ {\n margin-inline: 2px\n}\n\n.fc-forma-148 {\n margin-inline: 1px\n}\n\n.fc-forma-cJ3 {\n margin-block: 2px\n}\n\n.fc-forma-V9v {\n margin-block: 4px\n}\n\n.fc-forma-SEP {\n margin-block: 1px\n}\n\n.fc-forma-Jzj {\n margin-inline-start: 2px\n}\n\n.fc-forma-Wga {\n margin-inline-start: 4px\n}\n\n.fc-forma-qvL {\n margin-inline-start: 1px\n}\n\n.fc-forma-p9t {\n margin-inline-end: -6px\n}\n\n.fc-forma-3e1 {\n margin-inline-end: 2px\n}\n\n.fc-forma-KYn {\n margin-inline-end: 4px\n}\n\n.fc-forma-B3G {\n margin-inline-end: 2.5%\n}\n\n.fc-forma-9hC {\n margin-inline-end: 1px\n}\n\n.fc-forma-Dq8 {\n margin-top: -4px\n}\n\n.fc-forma-Ika {\n margin-bottom: 1px\n}\n\n.fc-forma-F99 {\n margin-left: -4px\n}\n\n.fc-forma-I48 {\n display: block\n}\n\n.fc-forma-dl1 {\n display: flex\n}\n\n.fc-forma-i3N {\n display: grid\n}\n\n.fc-forma-pps {\n display: none\n}\n\n.fc-forma-63n {\n width: 0;\n height: 0\n}\n\n.fc-forma-3wQ {\n width: 8px;\n height: 8px\n}\n\n.fc-forma-vnf {\n width: 16px;\n height: 16px\n}\n\n.fc-forma-XUJ {\n width: 20px;\n height: 20px\n}\n\n.fc-forma-uuA {\n height: 8px\n}\n\n.fc-forma-vYi {\n height: 10px\n}\n\n.fc-forma-oM6 {\n height: 20px\n}\n\n.fc-forma-TFV {\n height: 24px\n}\n\n.fc-forma-84e {\n min-height: 2px\n}\n\n.fc-forma-jgW {\n min-height: 16px\n}\n\n.fc-forma-toR {\n min-height: 1px\n}\n\n.fc-forma-roZ {\n width: 50%\n}\n\n.fc-forma-vVE {\n width: 25%\n}\n\n.fc-forma-hza {\n width: 8px\n}\n\n.fc-forma-79F {\n width: 20px\n}\n\n.fc-forma-ilz {\n width: 24px\n}\n\n.fc-forma-4Tv {\n width: 5px\n}\n\n.fc-forma-aHX {\n max-width: 160px\n}\n\n.fc-forma-2KU {\n min-width: 0\n}\n\n.fc-forma-aNc {\n min-width: 220px\n}\n\n.fc-forma-yi0 {\n flex-shrink: 0\n}\n\n.fc-forma-1Zl {\n flex-shrink: 1\n}\n\n.fc-forma-OLq {\n flex-shrink: 100\n}\n\n.fc-forma-1El {\n flex-grow: 1\n}\n\n.fc-forma-QX7 {\n rotate: -45deg\n}\n\n.fc-forma-KxI {\n rotate: -90deg\n}\n\n.fc-forma-ABq {\n rotate: 45deg\n}\n\n.fc-forma-z44 {\n rotate: 90deg\n}\n\n.fc-forma-jmT {\n rotate: 180deg\n}\n\n.fc-forma-sgX {\n flex-direction: column\n}\n\n.fc-forma-1sP {\n flex-direction: row\n}\n\n.fc-forma-dNl {\n flex-wrap: wrap\n}\n\n.fc-forma-XpK {\n align-items: center\n}\n\n.fc-forma-RNn {\n align-items: flex-end\n}\n\n.fc-forma-EF4 {\n align-items: flex-start\n}\n\n.fc-forma-N2M {\n justify-content: space-between\n}\n\n.fc-forma-E9P {\n justify-content: center\n}\n\n.fc-forma-LMv {\n justify-content: flex-end\n}\n\n.fc-forma-NWN {\n gap: 4px\n}\n\n.fc-forma-tgZ {\n gap: 8px\n}\n\n.fc-forma-wwb {\n gap: 12px\n}\n\n.fc-forma-Pms {\n gap: 16px\n}\n\n.fc-forma-sI7 {\n align-self: flex-start\n}\n\n.fc-forma-pKG {\n overflow: hidden\n}\n\n.fc-forma-AAA {\n border-radius: 3.40282e38px\n}\n\n.fc-forma-Fvv {\n border-radius: 4px\n}\n\n.fc-forma-kmj {\n border-start-start-radius: 4px;\n border-end-start-radius: 4px\n}\n\n.fc-forma-Skl {\n border-start-end-radius: 4px;\n border-end-end-radius: 4px\n}\n\n.fc-forma-Z7Q {\n border-top-left-radius: 4px;\n border-top-right-radius: 4px\n}\n\n.fc-forma-2qh {\n border-bottom-right-radius: 4px;\n border-bottom-left-radius: 4px\n}\n\n.fc-forma-wsy,\n.fc-forma-qQW {\n border-style: var(--fc-forma-border-style);\n border-width: 1px\n}\n\n.fc-forma-5JF {\n border-style: var(--fc-forma-border-style);\n border-width: 4px\n}\n\n.fc-forma-Vpk {\n border-style: var(--fc-forma-border-style);\n border-width: 6px\n}\n\n.fc-forma-1Wx {\n border-inline-style: var(--fc-forma-border-style);\n border-inline-width: 1px\n}\n\n.fc-forma-8UH {\n border-inline-start-style: var(--fc-forma-border-style);\n border-inline-start-width: 1px\n}\n\n.fc-forma-iSi {\n border-inline-start-style: var(--fc-forma-border-style);\n border-inline-start-width: 4px\n}\n\n.fc-forma-riO {\n border-inline-start-style: var(--fc-forma-border-style);\n border-inline-start-width: 6px\n}\n\n.fc-forma-USt,\n.fc-forma-lzW {\n border-inline-end-style: var(--fc-forma-border-style);\n border-inline-end-width: 1px\n}\n\n.fc-forma-ku3,\n.fc-forma-u78 {\n border-top-style: var(--fc-forma-border-style);\n border-top-width: 1px\n}\n\n.fc-forma-tb8 {\n border-top-style: var(--fc-forma-border-style);\n border-top-width: 4px\n}\n\n.fc-forma-zi1 {\n border-bottom-style: var(--fc-forma-border-style);\n border-bottom-width: 1px\n}\n\n.fc-forma-TN2 {\n --fc-forma-border-style: dotted;\n border-style: dotted\n}\n\n.fc-forma-lNM {\n border-color: var(--fc-event-color)\n}\n\n.fc-forma-tfB {\n border-color: var(--fc-forma-border)\n}\n\n.fc-forma-MlZ {\n border-color: var(--fc-forma-muted-foreground)\n}\n\n.fc-forma-Baf {\n border-color: var(--fc-forma-primary)\n}\n\n.fc-forma-BST {\n border-color: var(--fc-forma-strong-border)\n}\n\n.fc-forma-d0j {\n border-color: #0000\n}\n\n.fc-forma-RJG {\n background-color: var(--fc-forma-background)\n}\n\n.fc-forma-zNL {\n background-color: var(--fc-forma-faint)\n}\n\n.fc-forma-rRL {\n background-color: var(--fc-forma-highlight)\n}\n\n.fc-forma-Wv4 {\n background-color: var(--fc-forma-muted)\n}\n\n.fc-forma-7I6 {\n background-color: var(--fc-forma-primary)\n}\n\n@media not print {\n @supports (color:color-mix(in lab, red, red)) {\n .fc-forma-gTC {\n background-color: color-mix(in oklab, var(--fc-event-color)15%, transparent)\n }\n }\n @supports not (color:color-mix(in lab, red, red)) {\n .fc-forma-gTC {\n position: relative;\n isolation: isolate\n }\n .fc-forma-gTC:before {\n content: '';\n position: absolute;\n inset: 0;\n background-color: var(--fc-event-color);\n opacity: 0.15;\n z-index: -1\n }\n }\n}\n\n.fc-forma-lrD {\n background-color: var(--fc-event-color);\n color: var(--fc-event-contrast-color)\n}\n\n@supports (color:color-mix(in lab, red, red)) {\n .fc-forma-lrD {\n background-color: color-mix(in oklab, var(--fc-event-color)20%, var(--fc-forma-background));\n color: inherit\n }\n}\n\n.fc-forma-i6P {\n background-color: var(--fc-event-color);\n color: var(--fc-event-contrast-color)\n}\n\n@supports (color:color-mix(in lab, red, red)) {\n .fc-forma-i6P {\n background-color: color-mix(in oklab, var(--fc-event-color)30%, var(--fc-forma-background));\n color: inherit\n }\n}\n\n.fc-forma-KUX {\n padding: 2px\n}\n\n.fc-forma-iS4 {\n padding: 4px\n}\n\n.fc-forma-3N5 {\n padding: 8px\n}\n\n.fc-forma-IJJ {\n padding: 12px\n}\n\n.fc-forma-lqx {\n padding: 16px\n}\n\n.fc-forma-7A6 {\n padding: 1px\n}\n\n.fc-forma-oQ2 {\n padding-inline: 2px\n}\n\n.fc-forma-aCI {\n padding-inline: 4px\n}\n\n.fc-forma-Nca {\n padding-inline: 8px\n}\n\n.fc-forma-Apf {\n padding-inline: 12px\n}\n\n.fc-forma-2rx {\n padding-block: 2px\n}\n\n.fc-forma-Jhn {\n padding-block: 4px\n}\n\n.fc-forma-End {\n padding-block: 6px\n}\n\n.fc-forma-dl6 {\n padding-block: 8px\n}\n\n.fc-forma-P9h {\n padding-block: 60px\n}\n\n.fc-forma-s0x {\n padding-block: 3px\n}\n\n.fc-forma-z5u {\n padding-block: 1px\n}\n\n.fc-forma-a7i {\n padding-inline-start: 2px\n}\n\n.fc-forma-C2j {\n padding-inline-start: 4px\n}\n\n.fc-forma-166 {\n padding-top: 2px\n}\n\n.fc-forma-4dx {\n padding-top: 4px\n}\n\n.fc-forma-cM0 {\n padding-bottom: 16px\n}\n\n.fc-forma-2HE {\n text-align: end\n}\n\n.fc-forma-vQz {\n font-size: 11px;\n line-height: 1.09091\n}\n\n.fc-forma-9ZS {\n font-size: 18px;\n line-height: calc(1.75/1.125)\n}\n\n.fc-forma-1Po {\n font-size: 16px;\n line-height: calc(1.5/1)\n}\n\n.fc-forma-9yp {\n font-size: 14px;\n line-height: calc(1.25/.875)\n}\n\n.fc-forma-2rA {\n font-size: 20px;\n line-height: calc(1.75/1.25)\n}\n\n.fc-forma-a3B {\n font-size: 12px;\n line-height: calc(1/.75)\n}\n\n.fc-forma-DIS {\n font-weight: 700\n}\n\n.fc-forma-1OT {\n font-weight: 500\n}\n\n.fc-forma-C8a {\n font-weight: 600\n}\n\n.fc-forma-IPx {\n text-overflow: ellipsis\n}\n\n.fc-forma-TZ4 {\n white-space: nowrap\n}\n\n.fc-forma-jm6 {\n white-space: pre\n}\n\n.fc-forma-b7K {\n color: var(--fc-forma-foreground)\n}\n\n.fc-forma-cOV {\n color: var(--fc-forma-faint-foreground)\n}\n\n.fc-forma-V1v {\n color: var(--fc-forma-muted-foreground)\n}\n\n.fc-forma-TSf {\n color: var(--fc-forma-primary-foreground)\n}\n\n.fc-forma-L1Y {\n font-style: italic\n}\n\n.fc-forma-lMo {\n opacity: .5\n}\n\n.fc-forma-iTG {\n opacity: .75\n}\n\n.fc-forma-1kP {\n box-shadow: 0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a\n}\n\n.fc-forma-tkw {\n box-shadow: 0 4px 6px -1px #0000001a, 0 2px 4px -2px #0000001a\n}\n\n.fc-forma-eSM {\n box-shadow: 0 1px 2px 0 #0000000d\n}\n\n.fc-forma-A3h {\n box-shadow: 0 0 0 1px var(--fc-forma-ring-color, currentcolor)\n}\n\n.fc-forma-GBJ {\n box-shadow: 0 0 0 2px var(--fc-forma-ring-color, currentcolor)\n}\n\n.fc-forma-c3P {\n --fc-forma-ring-color: var(--fc-forma-background)\n}\n\n.fc-forma-2R2 {\n outline-style: solid;\n outline-width: 1px\n}\n\n.fc-forma-0Bj {\n outline-style: solid;\n outline-width: 2px\n}\n\n.fc-forma-07j {\n outline-offset: -1px\n}\n\n.fc-forma-fFh {\n outline-offset: -2px\n}\n\n.fc-forma-3Xj {\n outline-offset: 2px\n}\n\n.fc-forma-Fmy {\n outline-color: var(--fc-forma-primary)\n}\n\n.fc-forma-mr2 {\n background: linear-gradient(var(--fc-forma-strong), var(--fc-forma-strong))var(--fc-forma-background)\n}\n\n.fc-forma-iCr:not(:last-child) {\n border-bottom-style: var(--fc-forma-border-style);\n border-bottom-width: 1px\n}\n\n@media not print {\n .fc-forma-530 {\n padding-block: 1px\n }\n\n .fc-forma-ZNR {\n padding-inline-end: 1px\n }\n\n .fc-forma-jVY {\n padding-top: 1px\n }\n\n .fc-forma-K3J {\n padding-bottom: 1px\n }\n}\n\n@media (hover:hover) {\n .fc-forma-vs6:is(:where(.fc-forma-bCs):hover *) {\n display: block\n }\n\n .fc-forma-sS4:is(:where(.fc-forma-bCs):hover *) {\n color: var(--fc-forma-primary)\n }\n\n .fc-forma-Ogp:is(:where(.fc-forma-bCs):hover *) {\n text-decoration-line: underline\n }\n}\n\n.fc-forma-Di9:is(:where(.fc-forma-bCs):focus-visible *) {\n color: var(--fc-forma-primary)\n}\n\n@media (hover:hover) {\n .fc-forma-cBw:hover {\n border-color: var(--fc-forma-strong-border)\n }\n\n .fc-forma-ShG:hover {\n background-color: var(--fc-forma-muted)\n }\n\n .fc-forma-2Qu:hover {\n background-color: var(--fc-forma-primary-over)\n }\n\n .fc-forma-mcn:hover {\n background-color: var(--fc-forma-strong)\n }\n\n .fc-forma-rom:hover {\n background-color: var(--fc-event-color)\n }\n\n @supports (color:color-mix(in lab, red, red)) {\n .fc-forma-rom:hover {\n background-color: color-mix(in oklab, var(--fc-event-color)25%, var(--fc-forma-background))\n }\n }\n\n .fc-forma-SWh:hover {\n background-color: var(--fc-event-color)\n }\n\n @supports (color:color-mix(in lab, red, red)) {\n .fc-forma-SWh:hover {\n background-color: color-mix(in oklab, var(--fc-event-color)35%, var(--fc-forma-background))\n }\n }\n\n .fc-forma-Eu0:hover {\n text-decoration-line: underline\n }\n\n .fc-forma-Vyz:hover {\n background: linear-gradient(var(--fc-forma-stronger), var(--fc-forma-stronger))var(--fc-forma-background)\n }\n}\n\n.fc-forma-nge:focus-visible {\n background-color: var(--fc-forma-muted)\n}\n\n.fc-forma-lgp:focus-visible {\n background-color: var(--fc-forma-primary-over)\n}\n\n.fc-forma-uqo:focus-visible {\n outline-style: solid;\n outline-width: 2px\n}\n\n.fc-forma-PQx:active {\n background-color: var(--fc-forma-primary-down)\n}\n\n.fc-forma-rKU:active {\n background-color: var(--fc-forma-strong)\n}\n\n.fc-forma-0sn:active {\n background-color: var(--fc-forma-stronger)\n}\n\n.fc-forma-DUE:active {\n background-color: var(--fc-event-color)\n}\n\n@supports (color:color-mix(in lab, red, red)) {\n .fc-forma-DUE:active {\n background-color: color-mix(in oklab, var(--fc-event-color)30%, var(--fc-forma-background))\n }\n}\n\n.fc-forma-RHy:active {\n background-color: var(--fc-event-color)\n}\n\n@supports (color:color-mix(in lab, red, red)) {\n .fc-forma-RHy:active {\n background-color: color-mix(in oklab, var(--fc-event-color)40%, var(--fc-forma-background))\n }\n}\n\n.fc-forma-pgt:active {\n background: linear-gradient(var(--fc-forma-strongest), var(--fc-forma-strongest))var(--fc-forma-background)\n}\n\n@media print {\n .fc-forma-2dx {\n border-block-style: var(--fc-forma-border-style);\n border-block-width: 1px\n }\n\n .fc-forma-9wT {\n border-inline-end-style: var(--fc-forma-border-style);\n border-inline-end-width: 1px\n }\n\n .fc-forma-Qex {\n border-top-style: var(--fc-forma-border-style);\n border-top-width: 1px\n }\n\n .fc-forma-wZV {\n border-bottom-style: var(--fc-forma-border-style);\n border-bottom-width: 1px\n }\n\n .fc-forma-jsy {\n border-width: 1px\n }\n\n .fc-forma-DO7 {\n border-color: var(--fc-event-color)\n }\n\n .fc-forma-4MR {\n border-color: #000\n }\n\n .fc-forma-vwH {\n background-color: #fff\n }\n}\n\n[dir=rtl] .fc-forma-qIw {\n rotate: -45deg\n}\n\n[dir=rtl] .fc-forma-keW {\n rotate: -90deg\n}\n\n[dir=rtl] .fc-forma-jY6 {\n rotate: none\n}\n\n[dir=rtl] .fc-forma-vk6 {\n rotate: 45deg\n}\n\n[dir=rtl] .fc-forma-ZW3 {\n rotate: 90deg\n}\n\n[dir=rtl] .fc-forma-asP {\n rotate: 180deg\n}\n","// FullCalendar's stylesheets, carried as text and added to the page when a calendar first renders.\n// Leaving them as imports would hand them to the consumer's bundler, which a library build — a\n// samples bundle, a design system — pulls out into a stylesheet nobody loads.\nimport skeleton from '@fullcalendar/react/skeleton.css';\nimport formaTheme from '@fullcalendar/react/themes/forma/theme.css';\nimport { ensureStyleSheet } from './core/index.js';\n\nconst STYLE_ID = 'ppp-calendar-fullcalendar-styles';\n\n/** Adds FullCalendar's skeleton and Forma theme stylesheets to the document once. */\nexport function ensureFullCalendarStyles(document: Document): void {\n ensureStyleSheet(document, STYLE_ID, `${skeleton}\\n${formaTheme}`);\n}\n","import { calendarLayouts, type CalendarLayout } from './core/index.js';\n\n/**\n * Wire shape for `<Calendar persistedStateQueryParameter>`: a JSON object in one URL query\n * parameter, as the grid keeps its state, with the grid's keys for what the two share (`v`, `q`).\n * Kept in lockstep with the Blazor Calendar's `PersistedState` — same keys, same values, same\n * order — so a link made on one stack opens the same calendar on the other. Update both sides\n * together.\n */\nexport interface PersistedCalendarState {\n /** The calendar's layout. Omitted while it is the one the calendar opens in. */\n l?: CalendarLayout;\n /** A local date in the middle of the period shown (`2026-11-04`). Omitted while it takes in today. */\n d?: string;\n /** The appointment view picked, by its id (lowercase). Omitted while it is the one the calendar opens on. */\n v?: string;\n /** The search, when the calendar keeps it. */\n q?: string;\n}\n\nconst DATE = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\nconst GUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\n/** Whether a value is a real local date in the `yyyy-mm-dd` form the URL keeps. */\nfunction isDate(value: unknown): value is string {\n if (typeof value !== 'string') return false;\n const match = DATE.exec(value);\n if (!match) return false;\n const [year, month, day] = [Number(match[1]), Number(match[2]), Number(match[3])];\n const date = new Date(year, month - 1, day);\n return date.getFullYear() === year && date.getMonth() === month - 1 && date.getDate() === day;\n}\n\n/**\n * The state the named query parameter holds, or an empty one when it is missing or can't be read.\n * A layout that isn't one, a date that isn't one or a view id that isn't a GUID is left out, so the\n * calendar opens as it would anyway. (Whether the calendar offers the layout is the calendar's to judge.)\n */\nexport function readPersistedCalendarState(queryParameterName: string | undefined): PersistedCalendarState {\n if (!queryParameterName || typeof window === 'undefined') return {};\n const raw = new URLSearchParams(window.location.search).get(queryParameterName);\n if (!raw) return {};\n try {\n const parsed = JSON.parse(raw) as unknown;\n if (!parsed || typeof parsed !== 'object') return {};\n const { l, d, v, q } = parsed as Record<string, unknown>;\n const state: PersistedCalendarState = {};\n if (calendarLayouts.includes(l as CalendarLayout)) state.l = l as CalendarLayout;\n if (isDate(d)) state.d = d;\n if (typeof v === 'string' && GUID.test(v)) state.v = v.toLowerCase();\n if (typeof q === 'string' && q.trim()) state.q = q;\n return state;\n } catch {\n return {};\n }\n}\n\n/** The state's canonical form in the URL, or null when there is nothing to keep. */\nexport function encodePersistedCalendarState(state: PersistedCalendarState): string | null {\n const compact: PersistedCalendarState = {};\n if (state.l) compact.l = state.l;\n if (state.d) compact.d = state.d;\n if (state.v) compact.v = state.v;\n if (state.q?.trim()) compact.q = state.q;\n return Object.keys(compact).length > 0 ? JSON.stringify(compact) : null;\n}\n\n/**\n * Writes the state to the named query parameter, or takes the parameter away when there is nothing\n * to keep. It replaces the history entry, so Back leaves the page rather than stepping back through\n * every week shown, and writes nothing when the URL already holds it.\n */\nexport function writePersistedCalendarState(queryParameterName: string | undefined, state: PersistedCalendarState): void {\n if (!queryParameterName || typeof window === 'undefined') return;\n const encoded = encodePersistedCalendarState(state);\n const params = new URLSearchParams(window.location.search);\n if (params.get(queryParameterName) === encoded) return;\n if (encoded === null) params.delete(queryParameterName);\n else params.set(queryParameterName, encoded);\n const query = params.toString();\n window.history.replaceState(\n window.history.state,\n '',\n `${window.location.pathname}${query ? `?${query}` : ''}${window.location.hash}`,\n );\n}\n","import {\n Dropdown,\n makeStyles,\n mergeClasses,\n Menu,\n MenuButton,\n MenuItemRadio,\n MenuList,\n MenuPopover,\n MenuTrigger,\n Button,\n MessageBar,\n MessageBarActions,\n MessageBarBody,\n Option,\n SearchBox,\n Spinner,\n Text,\n Toolbar,\n ToolbarButton,\n Tooltip,\n tokens,\n useThemeClassName,\n type MenuProps,\n} from '@fluentui/react-components';\nimport {\n ArrowClockwiseRegular,\n ArrowRepeatAllRegular,\n ChevronLeftRegular,\n ChevronRightRegular,\n} from '@fluentui/react-icons';\nimport FullCalendar, {\n useCalendarController,\n type EventChangeInfo,\n type EventDisplayInfo,\n type EventSourceFuncInfo,\n} from '@fullcalendar/react';\nimport dayGridPlugin from '@fullcalendar/react/daygrid';\nimport interactionPlugin from '@fullcalendar/react/interaction';\nimport listPlugin from '@fullcalendar/react/list';\nimport timeGridPlugin from '@fullcalendar/react/timegrid';\nimport formaTheme from '@fullcalendar/react/themes/forma';\nimport {\n defaultViewId as userDefaultViewId,\n savedViewControl,\n SavedViewControlKind,\n shownViewTables,\n isViewHidden,\n MultiTableSeries,\n MultiTableViewType,\n TableSecurityPermission,\n type MultiTableFailure,\n type MultiTableItem,\n type MultiTableRangeRequest,\n type MultiTableTablesResponse,\n type MultiTableViewDefinition,\n type MultiTableViewTable,\n type TableRecord,\n type TableRecordReference,\n type ViewMetadata,\n} from '@powerportalspro/core';\nimport {\n useDialogService,\n useLocale,\n useLocalization,\n usePowerPortalsPro,\n usePrefixedT,\n useT,\n useUserTimeZone,\n} from '@powerportalspro/react';\nimport {\n applyMultiTableFilter,\n GridManageViewsPanel,\n GridSaveViewDialog,\n MultiTableFilterDialog,\n multiTableFilterQueries,\n multiTableFilterTabs,\n MultiTableRecordPanel,\n useMultiTableViews,\n useSavedViews,\n ViewFilterMenu,\n ViewSort,\n type GridManagedView,\n type MultiTableFilterQuery,\n type MultiTableFilterTab,\n type MultiTableForms,\n} from '@powerportalspro/react-fluent';\nimport { useCallback, useEffect, useMemo, useRef, useState, type CSSProperties, type ReactNode } from 'react';\nimport { appointmentToOpen, type OpenAppointment } from './appointment-click.js';\nimport { CalendarContext, type CalendarContextValue, type CalendarRange } from './calendar-context.js';\nimport { AppointmentDetailsDialog, RecurringChoiceDialog } from './appointment-details.js';\nimport type { CalendarAppointment } from './calendar-appointment.js';\nimport { AppointmentSummaryContent, AppointmentTooltip } from './appointment-tooltip.js';\nimport { newAppointment } from './appointment-record.js';\nimport {\n everyRow,\n findCustomView,\n offeredViewIds,\n offersViews,\n readSavedLayout,\n selectedViewId,\n withSavedViews,\n writeSavedLayout,\n} from './calendar-query.js';\nimport {\n APPOINTMENT_TABLE,\n CALENDAR_COLUMNS,\n DEFAULT_CALENDAR_TABLES,\n drawnTimes,\n EVERY_TABLE_VIEW_ID,\n fromMultiTableItem,\n hiddenByDefault,\n moveRecord,\n SERIES_TABLE,\n tablesOf,\n} from './calendar-rows.js';\nimport { ensureFullCalendarStyles } from './fullcalendar-styles.js';\nimport {\n appointmentFromEvent,\n calendarOptions,\n ensureCalendarStyles,\n fromFullCalendarView,\n isCompactView,\n newAppointmentRange,\n offeredLayouts,\n openingLayout,\n periodDate,\n summarizeAppointment,\n toAppointmentChange,\n toEventInput,\n toFullCalendarView,\n type CalendarAppointmentChange,\n type CalendarLayout,\n} from './core/index.js';\nimport {\n readPersistedCalendarState,\n writePersistedCalendarState,\n} from './persisted-calendar-state.js';\n\nconst plugins = [formaTheme, dayGridPlugin, timeGridPlugin, listPlugin, interactionPlugin];\n\n// The table a calendar reads.\n\n// How long typing pauses before a search goes out, as the grid waits.\nconst SEARCH_DEBOUNCE_MS = 300;\n\nconst layoutKeys: Record<CalendarLayout, string> = {\n day: 'layouts.day',\n workWeek: 'layouts.work-week',\n week: 'layouts.week',\n month: 'layouts.month',\n agenda: 'layouts.agenda',\n};\n\nconst useStyles = makeStyles({\n root: {\n display: 'flex',\n flexDirection: 'column',\n gap: tokens.spacingVerticalS,\n minHeight: 0,\n },\n // Two groups: the views, navigation and title, then search and the rest at the end. On a narrow\n // screen the end group wraps below the first as a whole rather than squeezing the title.\n toolbar: {\n alignItems: 'center',\n flexWrap: 'wrap',\n justifyContent: 'space-between',\n rowGap: tokens.spacingVerticalXS,\n columnGap: tokens.spacingHorizontalS,\n paddingInline: 0,\n },\n toolbarStart: {\n display: 'flex',\n alignItems: 'center',\n gap: tokens.spacingHorizontalXS,\n flex: '1 1 auto',\n minWidth: 0,\n },\n toolbarEnd: {\n display: 'flex',\n flexWrap: 'wrap',\n alignItems: 'center',\n justifyContent: 'flex-end',\n gap: tokens.spacingHorizontalXS,\n marginInlineStart: 'auto',\n minWidth: 0,\n },\n // The period and the moves through it, kept together.\n navigation: {\n display: 'flex',\n alignItems: 'center',\n gap: tokens.spacingHorizontalXS,\n minWidth: 0,\n },\n title: {\n flex: '0 1 auto',\n minWidth: 0,\n // A heading, which a page's own styles may give margins: none above or below, so it stays\n // centered on the toolbar's buttons.\n marginTop: 0,\n marginBottom: 0,\n marginInlineStart: tokens.spacingHorizontalS,\n fontSize: tokens.fontSizeBase400,\n fontWeight: tokens.fontWeightSemibold,\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n },\n // As wide as a grid's view picker.\n viewPicker: {\n minWidth: '220px',\n },\n search: {\n width: '220px',\n maxWidth: '100%',\n },\n // The appointments, and the overlay over them while a range loads.\n body: {\n position: 'relative',\n flex: 1,\n minHeight: 0,\n display: 'flex',\n flexDirection: 'column',\n },\n surface: {\n flex: 1,\n minHeight: 0,\n },\n // As a grid's loading overlay: the appointments dimmed under a spinner.\n loadingOverlay: {\n position: 'absolute',\n inset: 0,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n zIndex: 4,\n '::before': {\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n backgroundColor: tokens.colorNeutralBackground2,\n opacity: 0.7,\n zIndex: -1,\n },\n },\n visuallyHidden: {\n position: 'absolute',\n width: '1px',\n height: '1px',\n margin: '-1px',\n padding: 0,\n overflow: 'hidden',\n clip: 'rect(0 0 0 0)',\n whiteSpace: 'nowrap',\n border: 0,\n },\n});\n\n/** Where a {@link Calendar} opens an appointment's details and another table's form. */\nexport type CalendarFormLocation = 'center' | 'left' | 'right';\n\nexport interface CalendarProps {\n /**\n * The appointments to show, when the host has them. Without it, the calendar loads the rows of\n * each range it shows from Dataverse — appointments, tasks and the other tables the server\n * registered — as the view picked, {@link regarding} and the user's access allow.\n */\n appointments?: readonly CalendarAppointment[];\n /**\n * Only the rows about this record, when the calendar loads its own: through each table's\n * regarding column, and the activities it takes part in (see {@link matchParties}).\n */\n regarding?: TableRecordReference;\n /**\n * The tables the calendar may show, by logical name: of those the server registered\n * (`AddMultiTableSource`, or notes and activities by default) and the user may read. Every one when\n * omitted.\n */\n tables?: readonly string[];\n /**\n * The tables shown at first when the calendar shows every table — no view of its own: the others\n * the user may read are offered in the table menu, switched off. Defaults to appointments and tasks.\n * With none of them to show, every table is.\n */\n defaultTables?: readonly string[];\n /**\n * Dataverse views the user can pick from, by id: each shows its own table's rows that it picks.\n * With more than one view on offer — these, {@link multiTableViewIds} and\n * {@link customViewDefinitions} — the toolbar has a picker. With none, the calendar shows every\n * table (see {@link defaultTables}).\n */\n viewIds?: readonly string[];\n /**\n * Views of several tables the user can pick from: ones the server registered (`AddMultiTableView`)\n * or kept in Dataverse (`ppp_multitableview`), by id.\n */\n multiTableViewIds?: readonly string[];\n /**\n * The view the calendar opens on, one of those offered. Without it, the first of {@link viewIds},\n * then of {@link multiTableViewIds}, then of {@link customViewDefinitions}.\n */\n defaultViewId?: string;\n /**\n * Views defined in code, of one table or several, offered beside {@link viewIds}: each table with\n * which of its rows show.\n */\n customViewDefinitions?: readonly MultiTableViewDefinition[];\n /**\n * Whether activities the {@link regarding} record takes part in — as a sender, recipient or\n * attendee — show beside those about it. Unset, each table's setting, else the server's.\n */\n matchParties?: boolean;\n /** How recurring appointments show. Unset, each table's setting: each occurrence on its own. */\n series?: MultiTableSeries;\n /**\n * Draws a table's rows the page's own way, by logical name: the row, with the whole record read in\n * its `record`, in place of all the calendar draws of it — its time, subject, place and repeat icon.\n * For the rows the calendar loads, not `appointments` the host gives it. A row is drawn as its range\n * is read, so a change to what a template shows reaches it with the next range or refresh.\n */\n templates?: Readonly<Record<string, (item: MultiTableItem) => ReactNode>>;\n /**\n * The forms a row of another table than appointments opens in, by table, in place of the default\n * one: `{ task: { edit: TaskForm } }`.\n */\n forms?: Readonly<Record<string, MultiTableForms>>;\n /**\n * Where an appointment's details and another table's form open: a dialog in the `center` (the\n * default), or a side panel on the `left` or the `right`.\n */\n formLocation?: CalendarFormLocation;\n /** The order of the views in the picker. Defaults to `ViewSort.NameAscending`. */\n viewSort?: ViewSort;\n /**\n * When `true`, the toolbar has a Filter button, which opens the view's filters to change, as a\n * grid's does — a tab for each table shown: conditions on its columns, nested in groups, and\n * related tables to filter by — every filter FetchXML can express, over the columns and tables the\n * user may read. The changes last while the calendar shows the view; another view starts from its\n * own filters. Not offered for {@link appointments} the host gives the calendar, nor for a view of\n * several tables kept in Dataverse. Defaults to `false`: the user can take away every filter the\n * view has, which a view meant to narrow a page's rows may not want.\n */\n allowFiltering?: boolean;\n /**\n * Lets signed-in users save the calendar as they've arranged it — the view it shows with their\n * filter, and its layout — as views of their own, offered in the view picker beside the page's,\n * and choose their default view and hide the views they don't use. A view saved on a calendar or a\n * grid of appointments with no {@link savedViewsKey} is offered on both, each keeping its own\n * layout of it. Off by default. Needs the Power Portals Pro Core solution's saved-view tables; an\n * internal user also needs the `Power Portals Pro Saved Views` security role.\n */\n allowSavedViews?: boolean;\n /**\n * Names this calendar among the controls of appointments, so the views saved on it and the user's\n * default and hidden views are its own: it offers the views saved on it as well as the views saved on\n * controls with no key, and its default and hidden views are set for it alone. Without one, the\n * calendar shares its views with every grid and calendar of appointments that has none, and its\n * default and hidden views with every calendar that has none. Letters, digits, `-`, `_` and `.`.\n */\n savedViewsKey?: string;\n /**\n * Where a user who isn't signed in is sent to sign in, from the saved views' menu, which asks them\n * to first; they come back to this page (`ReturnUrl`). Defaults to `/Account/Login`.\n */\n signInUrl?: string;\n /**\n * Whether the toolbar has a search box, when the calendar loads its own appointments. A search\n * finds each table's search columns as a grid's search does. Defaults to `true`.\n */\n allowSearch?: boolean;\n /**\n * Whether the search is kept in the URL with the rest of the calendar's state. Off by default:\n * what users search for can be sensitive, and stays in the browser's history and in referrers.\n * Has no effect without {@link persistedStateQueryParameter}.\n */\n includeSearchInPersistedState?: boolean;\n /**\n * The layout it opens in: the hours of a `day`, a `workWeek` or a `week`, a `month` of days, or an\n * `agenda` list. Defaults to `week`; the first of {@link layouts} when that leaves it out.\n */\n defaultLayout?: CalendarLayout;\n /**\n * The layouts the user can switch between, in the order the picker lists them. With one, the\n * picker is hidden and the calendar stays in it: a link naming another is ignored, and a day's\n * number no longer opens that day unless `day` is offered. Every layout when omitted.\n */\n layouts?: readonly CalendarLayout[];\n /**\n * Whether appointments can be moved, resized and created by selecting a range. A loaded row can be\n * moved when the user may change it and its start, and it isn't closed — completed, canceled or\n * inactive; resized when they may change its end too. The calendar saves the move, unless\n * {@link onAppointmentChange} does.\n */\n editable?: boolean;\n /**\n * The tables an appointment's Regarding can name a record of, in the order its form's table\n * picker lists them. Tables Regarding can't point to are ignored. Every one it can when omitted;\n * either way, only the tables whose records the user may read and point a lookup to are offered.\n * The Blazor Calendar's\n * `RegardingTables` is its twin.\n */\n regardingTables?: readonly string[];\n /** Height of the whole calendar, toolbar included. Defaults to `600px`. */\n height?: CSSProperties['height'];\n /**\n * An appointment was clicked or activated from the keyboard. Without it, an appointment the\n * calendar loaded opens in a dialog of its details.\n */\n onAppointmentClick?: (id: string) => void;\n /**\n * The fields the details dialog shows, in place of the calendar's own: column edits and the like,\n * read from the appointment's record as on a record page. The calendar's own show when it is,\n * where, what it is regarding, its status and its description, read-only.\n */\n appointmentDetails?: ReactNode;\n /**\n * What an appointment's tooltip shows, in place of its subject, when, where and whether it\n * repeats: given the appointment, whose `record` holds every column of the view for one the\n * calendar loaded. A tooltip isn't interactive, so it shows what this draws, not controls to use.\n */\n appointmentTooltip?: (appointment: CalendarAppointment) => ReactNode;\n /** A range was selected to create an appointment in, or a New button clicked. */\n onRangeSelect?: (range: CalendarRange) => void;\n /**\n * An appointment was moved or resized. Resolve false to put it back, as when the save is\n * refused.\n */\n onAppointmentChange?: (change: CalendarAppointmentChange) => boolean | Promise<boolean>;\n /** The visible range changed, by navigation or a change of layout. */\n onRangeChange?: (range: { start: Date; end: Date; layout: CalendarLayout }) => void;\n /**\n * Controls for the toolbar: `<CalendarButton>`s, such as `<NewAppointmentCalendarButton>`, or any\n * other element. They appear in the order given, ahead of the search box, as a grid's toolbar\n * buttons do, and read the calendar through `useCalendarContext`. The Blazor Calendar's\n * `ToolbarItems` is its twin.\n */\n children?: ReactNode;\n /**\n * The name of a URL query parameter to keep the calendar's state in — its layout, the period it\n * shows, the appointment view picked and (with {@link includeSearchInPersistedState}) the search —\n * so a reload or a link opens it where it was left. Each change replaces the browser's history\n * entry rather than adding one. What the calendar would open on anyway is left out: the layout\n * while it is the one it opens in, the appointment view while it is the default one, and the date while\n * the period shown takes in today, so a link to the current week keeps following today. The URL is\n * read once, when the calendar opens; a value it can't read is ignored.\n *\n * The Blazor Calendar keeps the same value, so a link made on one stack opens the same calendar\n * on the other.\n */\n persistedStateQueryParameter?: string;\n}\n\n/**\n * An Outlook-style calendar of appointments — and of tasks and any other table it is given — laid out\n * by day, week or month, or as an agenda.\n */\nexport function Calendar({\n appointments,\n regarding,\n tables,\n defaultTables = DEFAULT_CALENDAR_TABLES,\n viewIds,\n multiTableViewIds,\n defaultViewId,\n customViewDefinitions,\n matchParties,\n series,\n templates,\n forms,\n formLocation = 'center',\n viewSort = ViewSort.NameAscending,\n allowFiltering = false,\n allowSavedViews = false,\n savedViewsKey,\n signInUrl = '/Account/Login',\n allowSearch = true,\n includeSearchInPersistedState = false,\n defaultLayout = 'week',\n layouts,\n editable = false,\n regardingTables,\n height = '600px',\n onAppointmentClick,\n appointmentDetails,\n appointmentTooltip,\n onRangeSelect,\n onAppointmentChange,\n onRangeChange,\n persistedStateQueryParameter,\n children,\n}: CalendarProps) {\n const styles = useStyles();\n const dialog = useDialogService();\n const dialogLocation = formLocation === 'left' ? 'panel-left' : formLocation === 'right' ? 'panel' : 'center';\n const t = usePrefixedT('app.components.calendar');\n const tAll = useT();\n // The calendar shows its times and days in the user's zone, as the portal shows every date.\n const timeZone = useUserTimeZone();\n const { locale } = useLocale();\n const { ppp, authState, tableMetadataCache, viewMetadataCache } = usePowerPortalsPro();\n // The zone comes with the session: the calendar waits for it rather than read and draw a range in\n // the browser's zone first, then again in the user's.\n const awaitsTimeZone = authState.status === 'loading';\n const controller = useCalendarController();\n const themeClassName = useThemeClassName();\n const [direction, setDirection] = useState<'ltr' | 'rtl'>('ltr');\n const [loading, setLoading] = useState(false);\n const [failed, setFailed] = useState(false);\n const [truncated, setTruncated] = useState(false);\n // Where a link or a reload left the calendar, read once.\n const [persisted] = useState(() => readPersistedCalendarState(persistedStateQueryParameter));\n // The layouts on offer; the one the calendar opens in with no link, which the URL leaves out; and\n // the one it opens in now, a link's while that is on offer.\n const layoutsKey = (layouts ?? []).join(',');\n // The key covers the list's content, so a list passed inline doesn't rebuild it each render.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const layoutsOffered = useMemo(() => offeredLayouts(layouts), [layoutsKey]);\n // The user's own views, kept where a grid keeps its saved views, under the calendar's key.\n const savedViewsControl = useMemo(\n () => savedViewControl(SavedViewControlKind.Calendar, allowSavedViews ? savedViewsKey : undefined),\n [allowSavedViews, savedViewsKey],\n );\n const saved = useSavedViews({\n enabled: allowSavedViews && !appointments,\n tableName: APPOINTMENT_TABLE,\n control: savedViewsControl,\n });\n // The user's views of several tables, offered beside their views of appointments.\n const multiSaved = useMultiTableViews({ enabled: allowSavedViews && !appointments && saved.available, control: savedViewsControl });\n // Whether the view the calendar opens on is known: the user, and then their views, read.\n // Once known it stays known: saved views read again later — after a sign-in, for another key —\n // don't take the calendar off the page.\n const settledRef = useRef(false);\n if (!awaitsTimeZone && !saved.loading && !multiSaved.loading) settledRef.current = true;\n const viewSettled = settledRef.current;\n const findSaved = (id: string | undefined) => (id ? saved.views.find((x) => x.id.toLowerCase() === id.toLowerCase()) : undefined);\n const findSavedMulti = (id: string | undefined) =>\n id ? multiSaved.views.find((x) => x.id.toLowerCase() === id.toLowerCase()) : undefined;\n // Every view the user saved, of appointments or of several tables, by id.\n const savedIds = useMemo(\n () => [...saved.views.map((x) => x.id), ...multiSaved.views.map((x) => x.id)],\n [saved.views, multiSaved.views],\n );\n // The layout a saved view opens in, as kept.\n const savedCalendarLayout = (id: string | undefined) => findSaved(id)?.calendarLayout ?? findSavedMulti(id)?.calendarLayout;\n\n // The views on offer, and the one shown: what the user picked, or a link named, while it is on\n // offer. With none of the page's, the view of every table.\n const viewIdsKey = (viewIds ?? []).join(',');\n const multiTableKey = (multiTableViewIds ?? []).map((id) => id.toLowerCase()).join(',');\n const customViewsKey = JSON.stringify(customViewDefinitions ?? []);\n const isMultiTableView = (id: string | undefined) => !!id && multiTableKey.split(',').includes(id.toLowerCase());\n const pageViews = useMemo(\n () => offeredViewIds(defaultViewId, viewIds, multiTableViewIds, customViewDefinitions),\n // The keys cover the lists' content, so lists passed inline don't rebuild it each render.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [defaultViewId, viewIdsKey, multiTableKey, customViewsKey],\n );\n const [pickedViewId, setPickedViewId] = useState(persisted.v);\n // The view the calendar opened on, kept while the user picks none, so a default made or a view\n // hidden in Manage views doesn't change the one shown.\n const openedViewRef = useRef<string | undefined>(undefined);\n const shownViewId = pickedViewId ?? openedViewRef.current;\n const offered = useMemo(\n () => withSavedViews(pageViews, savedIds, saved.settings, savedViewsControl, shownViewId, saved.available),\n [pageViews, savedIds, saved.settings, savedViewsControl, shownViewId, saved.available],\n );\n const viewId = selectedViewId(offered, shownViewId);\n if (viewSettled) openedViewRef.current ??= viewId;\n\n // The layout the calendar opens in, once the view it opens on is known: a link's, a saved view's\n // own, or the page's.\n const openingLayoutRef = useRef<CalendarLayout | undefined>(undefined);\n if (openingLayoutRef.current === undefined && viewSettled) {\n const savedLayout = persisted.l ? undefined : readSavedLayout(savedCalendarLayout(viewId));\n openingLayoutRef.current = openingLayout(layoutsOffered, persisted.l ?? savedLayout, defaultLayout);\n }\n const initialLayout = openingLayoutRef.current ?? openingLayout(layoutsOffered, persisted.l, defaultLayout);\n // The layout a view opens in: a saved view's own, else the calendar's.\n const viewOpeningLayout = (id: string | undefined) =>\n openingLayout(layoutsOffered, readSavedLayout(savedCalendarLayout(id)), defaultLayout);\n\n // The picker and the search box choose among the appointments the calendar loads, so neither is\n // offered for appointments the host gives it.\n const showsSearch = !appointments && allowSearch;\n // What the box shows, and — once typing pauses — what is searched for.\n const [searchText, setSearchText] = useState(() => (includeSearchInPersistedState ? (persisted.q ?? '') : ''));\n const [search, setSearch] = useState(searchText);\n\n // The views' labels — for a picker, and for the saved views' menu and panel, which name every view,\n // the hidden ones and the one a picker isn't shown for among them: a Dataverse view's strings are\n // loaded only when asked, and its name in Dataverse stands in for one it has none in.\n const picksViews = !appointments && offered.length > 1;\n const namesViews = picksViews || (!appointments && saved.available);\n const namedViewIds = saved.available ? [...new Set([...offered, ...pageViews])] : offered;\n const dataverseViewIds = namedViewIds.filter(\n (id) =>\n id !== EVERY_TABLE_VIEW_ID && !isMultiTableView(id) && !findCustomView(id, customViewDefinitions) && !findSaved(id) && !findSavedMulti(id),\n );\n useLocalization(namesViews ? dataverseViewIds.map((id) => `views.${id}`) : []);\n // What the labels are read from: the Dataverse views' metadata, and the names of the views of\n // several tables, the server's or kept in Dataverse — each read once.\n const [viewNames, setViewNames] = useState<{\n dataverse: ReadonlyMap<string, ViewMetadata | null>;\n multiTable: ReadonlyMap<string, string | null>;\n }>({ dataverse: new Map(), multiTable: new Map() });\n const multiTableIds = namedViewIds.filter(isMultiTableView);\n const namesKey = [...dataverseViewIds, '|', ...multiTableIds].join(',');\n useEffect(() => {\n if (!namesViews) return;\n let current = true;\n void (async () => {\n const dataverse = new Map(viewNames.dataverse);\n for (const id of dataverseViewIds.filter((x) => !dataverse.has(x)))\n dataverse.set(id, await viewMetadataCache.getAsync(id).catch(() => null));\n const multiTable = new Map(viewNames.multiTable);\n const missing = multiTableIds.filter((x) => !multiTable.has(x));\n if (missing.length > 0) {\n const registeredViews = (await registeredAsync().catch(() => null))?.views ?? [];\n for (const id of missing) {\n const known = registeredViews.find((view) => view.id?.toLowerCase() === id);\n multiTable.set(id, known ? (known.name ?? null) : await storedViewName(id));\n }\n }\n if (current) setViewNames({ dataverse, multiTable });\n })();\n return () => {\n current = false;\n };\n // `namesKey` covers the views to name; what is known is kept.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [namesViews, namesKey, ppp]);\n // A view's label; `null` while a Dataverse view's isn't known yet.\n const labelOf = (id: string): string | null => {\n if (id === EVERY_TABLE_VIEW_ID) return t('every-table');\n const custom = findCustomView(id, customViewDefinitions);\n if (custom) return custom.displayName?.trim() ? custom.displayName : id;\n // A view of several tables is no table's: its name is the user's.\n const ownMulti = findSavedMulti(id);\n if (ownMulti) return ownMulti.name;\n const own = findSaved(id);\n if (own) {\n const key = `tables.${APPOINTMENT_TABLE}.views.${id}.label`;\n const localized = tAll(key);\n return localized !== key ? localized : own.name;\n }\n if (isMultiTableView(id)) {\n if (!viewNames.multiTable.has(id)) return null;\n return viewNames.multiTable.get(id) ?? id;\n }\n if (!viewNames.dataverse.has(id)) return null;\n const metadata = viewNames.dataverse.get(id);\n if (metadata) {\n const key = `tables.${metadata.tableName}.views.${id}.label`;\n const localized = tAll(key);\n if (localized !== key) return localized;\n }\n return metadata?.displayName ?? metadata?.name ?? id;\n };\n // A choice of one where the user saves views: the picker is how they reach theirs.\n const showsSavedViewsMenu = allowSavedViews && !appointments && (saved.available || saved.needsSignIn);\n const viewOptions = useMemo(() => {\n if (offered.length < (showsSavedViewsMenu ? 1 : 2)) return [];\n // Not yet known: the picker waits rather than show an id.\n const labeled = offered.map((id) => {\n const label = labelOf(id);\n return label === null ? null : { id, label };\n });\n if (labeled.some((option) => option === null)) return [];\n const options = labeled as { id: string; label: string }[];\n // In the user's language, as the Blazor Calendar sorts them.\n if (viewSort === ViewSort.NameAscending) options.sort((a, b) => a.label.localeCompare(b.label, locale));\n if (viewSort === ViewSort.NameDescending) options.sort((a, b) => b.label.localeCompare(a.label, locale));\n return options;\n // `customViewsKey` covers the custom views' content, `viewNames` the rest of the labels'.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [offered, customViewsKey, saved.views, multiSaved.views, viewNames, viewSort, tAll, locale, showsSavedViewsMenu]);\n const showsViewPicker = !appointments && viewOptions.length > (showsSavedViewsMenu ? 0 : 1);\n\n useEffect(() => {\n ensureFullCalendarStyles(document);\n ensureCalendarStyles(document);\n setDirection(document.dir === 'rtl' ? 'rtl' : 'ltr');\n }, []);\n\n const options = useMemo(\n () =>\n calendarOptions({\n layout: initialLayout,\n layouts: layoutsOffered,\n date: persisted.d,\n timeZone,\n editable,\n locale,\n direction,\n text: {\n allDay: t('all-day'),\n noEvents: t('no-events'),\n close: t('close'),\n more: (count) => t('more', [count]),\n },\n }),\n [initialLayout, layoutsOffered, persisted.d, timeZone, editable, locale, direction, t],\n );\n\n // The appointment whose details are open.\n const [openAppointment, setOpenAppointment] = useState<OpenAppointment | null>(null);\n // A recurring appointment clicked, until the user says whether to open it or its series; and the\n // series each occurrence on screen is of, by the occurrence's id.\n const [recurringChoice, setRecurringChoice] = useState<OpenAppointment | null>(null);\n const seriesOf = useRef(new Map<string, string>());\n // A new appointment, over a range selected in an editable calendar: when the user may create\n // appointments, about the regarding record by the name its lookup shows.\n const [creating, setCreating] = useState<TableRecord | null>(null);\n // Asked once per user and per regarding record, not on every selection; and the latest selection,\n // so one the user has moved on from (or a calendar no longer there) opens nothing.\n const mayCreate = useRef<{ user: string | null | undefined; answer: Promise<boolean> } | null>(null);\n const regardingName = useRef<{ key: string; name: Promise<string | null> } | null>(null);\n const latestStart = useRef(0);\n useEffect(() => () => void (latestStart.current = -1), []);\n const user = authState.status === 'authenticated' ? authState.user?.userId : null;\n const tablesKey = (tables ?? []).map((table) => table.trim().toLowerCase()).join(',');\n const allowedTables = tablesKey ? new Set(tablesKey.split(',')) : null;\n const mayCreateAppointments = () => {\n let asked = mayCreate.current;\n if (!asked || asked.user !== user) {\n asked = mayCreate.current = {\n user,\n // Only where the calendar may show appointments.\n answer: (allowedTables && !allowedTables.has(APPOINTMENT_TABLE)\n ? Promise.resolve(TableSecurityPermission.None)\n : ppp.retrieveTablePermissionsAsync(APPOINTMENT_TABLE))\n .then((permissions) => (Number(permissions) & TableSecurityPermission.Create) !== 0)\n .catch(() => {\n mayCreate.current = null;\n return false;\n }),\n };\n }\n return asked.answer;\n };\n const startAppointment = async (range: CalendarRange) => {\n const start = ++latestStart.current;\n if (!(await mayCreateAppointments())) return;\n\n let name: string | null = null;\n if (regarding?.id) {\n const key = `${regarding.tableName}:${regarding.id}`;\n if (regardingName.current?.key !== key) {\n regardingName.current = { key, name: readName(regarding.tableName, regarding.id) };\n }\n name = await regardingName.current.name;\n }\n if (start === latestStart.current) setCreating(newAppointment(range, regarding ? { ...regarding, name } : null));\n };\n // A record's name, as its lookup shows it: null when the user may not read it.\n const readName = async (tableName: string, id: string): Promise<string | null> => {\n try {\n const table = await tableMetadataCache.getAsync(tableName);\n if (!table) return null;\n const record = await ppp.retrieveRecordAsync(tableName, id, [table.primaryNameColumn]);\n const value = (record.properties?.[table.primaryNameColumn] as { value?: unknown } | undefined)?.value;\n return typeof value === 'string' ? value : null;\n } catch {\n return null;\n }\n };\n\n // Each appointment — drawn by the page's template for its row's table, or the calendar's own way —\n // with its tooltip: what it is, when, where and whether it repeats, or the host's own. Both are read\n // through refs, so a host passing new functions each render doesn't have every appointment on screen\n // drawn again; the tables with a template are part of what it is drawn for.\n const recurringText = t('recurring');\n const customTooltip = appointmentTooltip !== undefined;\n const appointmentTooltipRef = useRef(appointmentTooltip);\n appointmentTooltipRef.current = appointmentTooltip;\n const templatesRef = useRef(templates);\n templatesRef.current = templates;\n const templatedTables = Object.keys(templates ?? {})\n .map((x) => x.trim().toLowerCase())\n .sort()\n .join();\n const renderAppointment = useCallback(\n (info: EventDisplayInfo) => {\n const content = customTooltip\n ? () => appointmentTooltipRef.current?.(appointmentFromEvent(info.event) as CalendarAppointment)\n : <AppointmentSummaryContent summary={summarizeAppointment(info.event, locale, recurringText, timeZone)} />;\n const table = info.event.extendedProps['table'] as string | null | undefined;\n const template = table ? templateFor(templatesRef.current, table) : undefined;\n const row = template ? rows.current.get(info.event.id) : undefined;\n return (\n <AppointmentTooltip content={content}>\n {template && row ? templateContent(info, template(row)) : appointmentContent(info)}\n </AppointmentTooltip>\n );\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [locale, recurringText, timeZone, customTooltip, templatedTables],\n );\n\n // Each refresh, so the range shown is read again.\n const [refreshes, setRefreshes] = useState(0);\n\n // The range being loaded, so a newer one can abandon it.\n const latestLoad = useRef<AbortController | null>(null);\n useEffect(() => () => latestLoad.current?.abort(), []);\n\n // ---- The tables it reads ----\n // The registered tables the user may read and the server's views, read once per user.\n const registeredRef = useRef<{ user: string | null | undefined; answer: Promise<MultiTableTablesResponse> } | null>(null);\n const [registered, setRegistered] = useState<MultiTableTablesResponse | null>(null);\n const registeredAsync = () => {\n let asked = registeredRef.current;\n if (!asked || asked.user !== user) {\n const answer = ppp.getMultiTableTablesAsync();\n asked = registeredRef.current = { user, answer };\n answer.then(\n (response) => registeredRef.current?.answer === answer && setRegistered(response),\n () => {\n if (registeredRef.current?.answer === answer) registeredRef.current = null;\n },\n );\n }\n return asked.answer;\n };\n const infoOf = (table: string) => registered?.tables?.find((x) => x.table === table);\n // The name of a view kept in Dataverse: null when the user may not read it.\n const storedViewName = async (id: string): Promise<string | null> => {\n try {\n const stored = await ppp.retrieveRecordAsync('ppp_multitableview', id, ['ppp_name']);\n const name = (stored.properties?.['ppp_name'] as { value?: unknown } | undefined)?.value;\n return typeof name === 'string' ? name : null;\n } catch {\n return null;\n }\n };\n // The tables of the views kept in Dataverse, as the server said when it read them.\n const storedViewTables = useRef(new Map<string, readonly string[]>());\n const isStoredView = (id: string | undefined, response: MultiTableTablesResponse) =>\n isMultiTableView(id) && !(response.views ?? []).some((view) => view.id?.toLowerCase() === id);\n\n /**\n * The tables a view reads, each with which of its rows: null for every table, or for a view of\n * several tables kept in Dataverse, which the server reads by its id; none for a Dataverse view\n * that doesn't exist.\n */\n const viewTablesAsync = async (id: string): Promise<readonly MultiTableViewTable[] | null> => {\n if (id === EVERY_TABLE_VIEW_ID) return null;\n if (isMultiTableView(id))\n return (await registeredAsync()).views?.find((view) => view.id?.toLowerCase() === id)?.tables ?? null;\n const custom = findCustomView(id, customViewDefinitions);\n if (custom) return custom.tables;\n const ownMulti = findSavedMulti(id);\n if (ownMulti) return ownMulti.tables;\n const own = findSaved(id);\n if (own) return [{ table: APPOINTMENT_TABLE, viewType: MultiTableViewType.FetchXml, fetchXml: own.definition.fetchXml }];\n const view = await viewMetadataCache.getAsync(id);\n if (view) return [{ table: view.tableName.toLowerCase(), viewType: MultiTableViewType.SystemView, viewId: id }];\n console.warn(`[Calendar] The view ${id} doesn't exist or is on a table the user may not read, so it shows nothing.`);\n return [];\n };\n\n // The tables of the view shown that the user may choose among, as the last range read them; and\n // those the user switched off in it — none chosen yet, the defaults.\n const defaultsKey = defaultTables.map((table) => table.trim().toLowerCase()).join(',');\n const [knownTables, setKnownTables] = useState<{ viewId: string | undefined; tables: readonly string[] }>({ viewId: undefined, tables: [] });\n const known = knownTables.viewId === viewId ? knownTables.tables : [];\n const [hiddenChoice, setHiddenChoice] = useState<{ viewId: string | undefined; tables: readonly string[] } | null>(null);\n const hiddenIn = (id: string | undefined, of: readonly string[]) =>\n hiddenChoice && hiddenChoice.viewId === id\n ? hiddenChoice.tables\n : hiddenByDefault(id, of, new Set(defaultsKey.split(',').filter(Boolean)));\n const hidden = hiddenIn(viewId, known);\n // The tables shown of those a view reads: all but those switched off, by the user or — `byView` —\n // by the view's own defaults.\n const shownIn = (id: string | undefined, of: readonly string[], byView = false) => {\n const off = byView ? hiddenByDefault(id, of, new Set(defaultsKey.split(',').filter(Boolean))) : hiddenIn(id, of);\n return of.length < 2 ? [...of] : of.filter((table) => !off.includes(table));\n };\n const shownTables = shownIn(viewId, known);\n const kinds = known.length > 1 ? known : [];\n // Whether the user switched a table on or off since the view opened, which shows its defaults.\n const hiddenAtOpen = hiddenByDefault(viewId, known, new Set(defaultsKey.split(',').filter(Boolean)));\n const tablesChanged = kinds.some((table) => hidden.includes(table) !== hiddenAtOpen.includes(table));\n const showTable = (table: string, shown: boolean) => {\n const next = shown ? hidden.filter((x) => x !== table) : [...new Set([...hidden, table])];\n setHiddenChoice({ viewId, tables: next });\n };\n useLocalization(known.map((table) => `tables.${table}`));\n const tableLabel = (table: string) => {\n const key = `tables.${table}.label`;\n const label = tAll(key);\n return label !== key ? label : table;\n };\n\n // The rows of the range on screen, by id, for a click or a move; and which tables' start columns\n // keep only a date.\n const rows = useRef(new Map<string, MultiTableItem>());\n const dateOnly = useRef(new Map<string, boolean>());\n const learnDateOnly = async (tables: readonly string[], response: MultiTableTablesResponse) => {\n for (const table of [...new Set(tables)].filter((x) => !dateOnly.current.has(x))) {\n const start = response.tables?.find((x) => x.table === table)?.definition?.start;\n try {\n const metadata = await tableMetadataCache.getAsync(table);\n const column = metadata?.columns?.find((x) => x.columnName === start) as { dateTimeBehavior?: unknown } | undefined;\n // DateTimeBehavior.DateOnly.\n dateOnly.current.set(table, column?.dateTimeBehavior === 1);\n } catch {\n dateOnly.current.set(table, false);\n }\n }\n };\n const [failures, setFailures] = useState<readonly MultiTableFailure[]>([]);\n\n // The user's filter, a tab for each table in the grid's own dialog: each table's taken from its\n // query and put back in its place. Kept with the view it was made for, in memory rather than the\n // URL, as a filter can be any length; another view starts from its own, and so does this one when\n // the calendar comes back to it.\n const showsFilterButton =\n !appointments && allowFiltering && !(registered && isStoredView(viewId, registered));\n const [userFilter, setUserFilter] = useState<{\n viewId: string | undefined;\n tables: readonly MultiTableViewTable[];\n criteria: Readonly<Record<string, string>>;\n } | null>(null);\n useEffect(() => {\n setUserFilter((current) => (current && current.viewId !== viewId ? null : current));\n setHiddenChoice((current) => (current && current.viewId !== viewId ? null : current));\n }, [viewId]);\n const filtered = userFilter && userFilter.viewId === viewId ? userFilter : null;\n const [filterDialog, setFilterDialog] = useState<{\n viewId: string | undefined;\n tables: readonly MultiTableFilterQuery[];\n tabs: readonly MultiTableFilterTab[];\n viewTabs: readonly MultiTableFilterTab[];\n } | null>(null);\n // The tables of the view shown, each with its own query — null where the calendar can't read it,\n // a saved or personal view inside a view of several tables, which has no filter to change.\n const filterTablesAsync = async (id: string) => {\n const response = await registeredAsync();\n const tablesShown: readonly MultiTableViewTable[] =\n (await viewTablesAsync(id)) ??\n (id === EVERY_TABLE_VIEW_ID\n ? (tablesOf(null, response.tables ?? [], allowedTables, null, false) ?? []).map((table): MultiTableViewTable => ({ table }))\n : []);\n return multiTableFilterQueries(tablesShown, async (viewOf) => (await viewMetadataCache.getAsync(viewOf))?.fetchXml);\n };\n // Whether a view's table is among those shown: a view of every activity, when any activity is.\n const isShownTable = (table: string, named: readonly string[], shownNow: readonly string[], response: MultiTableTablesResponse) => {\n const lower = (x: string) => x.toLowerCase();\n return lower(table) === 'activitypointer'\n ? shownNow.some((x) => response.tables?.find((info) => info.table === x)?.isActivity && !named.map(lower).includes(lower(x)))\n : shownNow.map(lower).includes(lower(table));\n };\n const openFilter = async () => {\n const id = viewId;\n if (!id) return;\n try {\n const response = await registeredAsync();\n const tablesShown = await filterTablesAsync(id);\n const knownNow = tablesOf(\n (await viewTablesAsync(id)) ?? null,\n response.tables ?? [],\n allowedTables,\n storedViewTables.current.get(id),\n isStoredView(id, response),\n ) ?? [];\n const shownNow = shownIn(id, knownNow);\n const named = tablesShown.map((x) => x.table.table ?? '');\n const tabs = multiTableFilterTabs(\n tablesShown,\n (table) => isShownTable(table, named, shownNow, response),\n tableLabel,\n filtered?.criteria,\n );\n // What Reset to view goes back to: the tables the view shows by itself, on its own criteria.\n const shownByView = shownIn(id, knownNow, true);\n const viewTabs = multiTableFilterTabs(tablesShown, (table) => isShownTable(table, named, shownByView, response), tableLabel);\n if (tabs.length > 0 && id === viewId) setFilterDialog({ viewId: id, tables: tablesShown, tabs, viewTabs });\n } catch (error) {\n console.warn('[Calendar] The filters of the view shown could not be read.', error);\n }\n };\n // Each table's own criteria again leave its query as it is; any others are put in it. After Reset\n // to view, the view is put back as it opens: the tables it shows by itself, and its layout.\n const applyFilter = (criteria: Readonly<Record<string, string>>, restoreView: boolean) => {\n const dialog = filterDialog;\n setFilterDialog(null);\n if (!dialog || dialog.viewId !== viewId) return;\n const filter = applyMultiTableFilter(dialog.tables, restoreView ? dialog.viewTabs : dialog.tabs, criteria);\n setUserFilter(filter ? { viewId, tables: filter.tables, criteria: filter.criteria } : null);\n if (!restoreView) return;\n setHiddenChoice(null);\n const layout = viewOpeningLayout(viewId);\n if (layout !== currentLayout && layoutsOffered.includes(layout)) controller.changeView(toFullCalendarView(layout));\n };\n\n // What the rows read depend on, so a new object with the same content doesn't reload the calendar.\n const searched = showsSearch ? search.trim() : '';\n const sourceKey = JSON.stringify([\n regarding ?? null,\n viewId ?? null,\n findSaved(viewId)?.definition.fetchXml ?? null,\n findSavedMulti(viewId)?.tables ?? null,\n customViewsKey,\n filtered?.tables ?? null,\n searched,\n hiddenChoice,\n tablesKey,\n defaultsKey,\n matchParties ?? null,\n series ?? null,\n multiTableKey,\n user ?? null,\n ]);\n // The calendar's part of the URL state, as the period shown last left it; the rest is worked out\n // as it is written, from the latest render — a write can come from a timer or a handler set up\n // renders earlier, after the user picked another view.\n // The layout and period shown, as the calendar last drew them.\n const shownState = useRef<{ layout?: CalendarLayout; d?: string }>({});\n const persistRef = useRef<(next?: { viewId?: string | undefined; search?: string }) => void>(() => {});\n persistRef.current = (next = {}) => {\n // A view a link named stays in the URL until the page offers its views.\n const v = 'viewId' in next ? next.viewId : !offersViews(offered) ? pickedViewId : viewId;\n const q = next.search ?? search;\n // The layout needs no link while it is the one the view shown opens in: a saved view's own,\n // else the calendar's.\n const shown = shownState.current;\n const opens = viewOpeningLayout('viewId' in next ? next.viewId : viewId);\n writePersistedCalendarState(persistedStateQueryParameter, {\n ...(shown.layout && shown.layout !== opens ? { l: shown.layout } : {}),\n ...(shown.d ? { d: shown.d } : {}),\n ...(v && v !== offered[0] ? { v } : {}),\n ...(includeSearchInPersistedState && showsSearch && q.trim() ? { q } : {}),\n });\n };\n const persist = (next?: { viewId?: string | undefined; search?: string }) => persistRef.current(next);\n\n // The URL leaves out the view the calendar opens on: when the user's default makes another that\n // view, it is written again, so a reload or a link opens the view shown.\n const openingViewRef = useRef(offered[0]);\n useEffect(() => {\n const previous = openingViewRef.current;\n openingViewRef.current = offered[0];\n if (viewSettled && previous !== undefined && previous !== offered[0]) persist();\n // `persist` writes from the latest render.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [offered[0]]);\n\n // The search goes out once typing pauses.\n useEffect(() => {\n if (searchText === search) return;\n const timer = setTimeout(() => {\n setSearch(searchText);\n persist({ search: searchText });\n }, SEARCH_DEBOUNCE_MS);\n return () => clearTimeout(timer);\n // Only typing starts the wait; `persist` writes from the latest render.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [searchText]);\n\n const events = useMemo(() => {\n if (appointments) return appointments.map(toEventInput);\n return async (info: EventSourceFuncInfo) => {\n // A range left before its rows arrive is dropped: its request is abandoned, so the server\n // stops reading it, and what it brings back can't speak for the range on screen.\n latestLoad.current?.abort();\n const load = new AbortController();\n latestLoad.current = load;\n const id = viewId;\n try {\n if (!id) return [];\n const response = await registeredAsync();\n const viewTables = await viewTablesAsync(id);\n const stored = isStoredView(id, response);\n let knownNow = tablesOf(viewTables, response.tables ?? [], allowedTables, storedViewTables.current.get(id), stored);\n if (latestLoad.current === load && knownNow) setKnownTables({ viewId: id, tables: knownNow });\n if (knownNow?.length === 0) {\n if (latestLoad.current === load) {\n setFailed(false);\n setTruncated(false);\n setFailures([]);\n }\n rows.current = new Map();\n return [];\n }\n const request = {\n start: info.start.toISOString(),\n end: info.end.toISOString(),\n viewId: filtered || !isMultiTableView(id) ? null : id,\n tables: filtered ? [...filtered.tables] : viewTables && viewTables.length > 0 ? [...viewTables] : null,\n // A view whose tables aren't known yet is read as the calendar allows.\n includeTables: knownNow ? shownIn(id, knownNow) : allowedTables ? [...allowedTables] : null,\n regarding: regarding ? { tableName: regarding.tableName, id: regarding.id } : null,\n matchParties: matchParties ?? null,\n series: series ?? null,\n search: searched || null,\n columns: CALENDAR_COLUMNS,\n } as MultiTableRangeRequest;\n const range = await ppp.loadMultiTableRangeAsync(request, load.signal);\n // A view kept in Dataverse is read for the first time without knowing its tables: the\n // server says which they were.\n if (!knownNow && stored) {\n storedViewTables.current.set(id, range.tables ?? []);\n knownNow = tablesOf(null, response.tables ?? [], allowedTables, range.tables ?? [], true) ?? [];\n if (latestLoad.current === load) setKnownTables({ viewId: id, tables: knownNow });\n }\n const items = range.items ?? [];\n await learnDateOnly(items.map((item) => item.table ?? ''), response);\n if (latestLoad.current === load) {\n setFailed(false);\n setTruncated((range.truncated ?? []).length > 0);\n setFailures(range.failures ?? []);\n rows.current = new Map(items.map((item) => [item.id, item] as const));\n seriesOf.current = new Map(\n items.flatMap((item) => {\n const seriesId = (item.record?.properties?.['seriesid'] as { value?: unknown } | undefined)?.value;\n return item.table === APPOINTMENT_TABLE && typeof seriesId === 'string' ? [[item.id, seriesId] as const] : [];\n }),\n );\n }\n return items.map((item) =>\n toEventInput(\n fromMultiTableItem(\n item,\n response.tables?.find((x) => x.table === item.table),\n drawnTimes(item, dateOnly.current.get(item.table ?? '') ?? false, timeZone),\n ),\n ),\n );\n } catch {\n if (latestLoad.current === load) {\n setFailed(true);\n setTruncated(false);\n setFailures([]);\n }\n return [];\n }\n };\n // What the rows depend on is read through `sourceKey`, so a new object with the same content\n // keeps the source; a refresh gives it a new one, which FullCalendar reads again.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [appointments, ppp, sourceKey, refreshes, timeZone]);\n\n // A move or resize: saved by the host's handler, else — for a row the calendar loaded — by the\n // calendar, which puts it back when the save fails or it can't keep the move.\n const handleChange = async (info: EventChangeInfo) => {\n const change = toAppointmentChange(info.event);\n if (onAppointmentChange) {\n if (!(await onAppointmentChange(change))) info.revert();\n return;\n }\n if (appointments) return;\n const item = rows.current.get(change.id);\n const record = item\n ? moveRecord(change, item, infoOf(item.table ?? ''), dateOnly.current.get(item.table ?? '') ?? false, timeZone)\n : null;\n if (!record) {\n info.revert();\n return;\n }\n try {\n await ppp.updateRecordAsync(record);\n // Read again, so the next move of the row starts from it as saved.\n setRefreshes((count) => count + 1);\n } catch (error) {\n console.error('[Calendar] The move could not be saved.', error);\n info.revert();\n await dialog.showErrorAsync(t('move-failed'));\n }\n };\n\n // A row of another table than appointments, in its form: one to change in an editable calendar,\n // else to read, as an appointment's details are.\n const [panelRow, setPanelRow] = useState<{ table: string; id: string; record: TableRecord } | null>(null);\n const openRow = async (table: string, id: string) => {\n try {\n const record = await ppp.retrieveRecordAsync(table, id);\n const permissions = Number(record.permissions ?? 0);\n setPanelRow({\n table,\n id,\n record: editable\n ? record\n : ({ ...record, permissions: permissions & ~(TableSecurityPermission.Write | TableSecurityPermission.Delete) } as TableRecord),\n });\n } catch (error) {\n console.error(`[Calendar] The ${table} ${id} could not be read for its form.`, error);\n await dialog.showErrorAsync(t('open-failed'));\n }\n };\n\n const view = controller.view;\n const currentLayout = (view && fromFullCalendarView(view.type)) ?? initialLayout;\n const buttons = view ? controller.getButtonState() : undefined;\n\n // Whether a New button starts something: in an editable calendar, the host's selection handler,\n // or a form for a user who may create appointments in one that loads its own.\n const [mayCreateHere, setMayCreateHere] = useState(false);\n const asksPermission = editable && !onRangeSelect && !appointments;\n useEffect(() => {\n if (!asksPermission) return;\n let current = true;\n void mayCreateAppointments().then((answer) => current && setMayCreateHere(answer));\n return () => {\n current = false;\n };\n // Asked again for another user; the answer is kept per user.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [asksPermission, user]);\n const canCreateAppointments = editable && (onRangeSelect !== undefined || (asksPermission && mayCreateHere));\n\n // A new appointment, as selecting a time starts one: the host's when it handles the selection,\n // otherwise a form in a calendar that loads its own appointments.\n const createAppointment = async (range?: CalendarRange) => {\n if (!editable) return;\n const shown = controller.view;\n const chosen = range ?? (shown && newAppointmentRange(shown.currentStart, shown.currentEnd, new Date(), timeZone));\n if (!chosen) return;\n if (onRangeSelect) onRangeSelect(chosen);\n else if (!appointments) await startAppointment(chosen);\n };\n const calendarContext: CalendarContextValue = {\n layout: currentLayout,\n start: view?.activeStart,\n end: view?.activeEnd,\n regarding,\n canCreateAppointments,\n createAppointment,\n refresh: () => setRefreshes((count) => count + 1),\n };\n\n const onLayoutChecked: MenuProps['onCheckedValueChange'] = (_, data) => {\n const next = data.checkedItems[0] as CalendarLayout | undefined;\n if (next && layoutsOffered.includes(next)) controller.changeView(toFullCalendarView(next));\n };\n\n // A view picked reloads the range shown, as any change of what it shows does; a saved view opens\n // in its own layout.\n const pickView = (next: string | undefined) => {\n if (!next || next === viewId) return;\n setPickedViewId(next);\n const layout = readSavedLayout(savedCalendarLayout(next));\n if (layout && layout !== currentLayout && layoutsOffered.includes(layout)) controller.changeView(toFullCalendarView(layout));\n persist({ viewId: next });\n };\n\n // ---- Saved views: the user's own, in the Filter menu as a grid's are ----\n const shownSaved = findSaved(viewId);\n const shownSavedMulti = findSavedMulti(viewId);\n // What the calendar shows can be saved: any table it shows, by queries it can read — not a view of\n // several tables kept in Dataverse that it reads by its id. Appointments alone are saved as a view\n // of that table, shared with the grids of appointments; several tables as a view of them.\n const showsAppointmentsAlone = shownTables.length === 1 && shownTables[0] === APPOINTMENT_TABLE;\n const canSaveView = shownTables.length > 0 && !(registered && isStoredView(viewId, registered));\n // The view shown, changed, so there is something to save: the user's filter, the tables they switched\n // on or off, or another layout than it opens in — its own, or the calendar's for one saved without.\n // It fills the Filter button.\n const viewChanged = !!filtered || tablesChanged || currentLayout !== viewOpeningLayout(viewId);\n const savedViewChanged = (!!shownSaved || !!shownSavedMulti) && canSaveView && viewChanged;\n const isUserDefault = !!viewId && userDefaultViewId(saved.settings, offered, savedViewsControl) === viewId;\n const [savingView, setSavingView] = useState(false);\n const [nameDialog, setNameDialog] = useState<{ kind: 'saveAs' | 'rename' | 'clone'; viewId: string; name: string } | null>(null);\n const [manageViewsOpen, setManageViewsOpen] = useState(false);\n\n // The query to save: the appointments' own, or with the user's filter in it; none while the\n // calendar shows other tables.\n const currentQuery = async (): Promise<string | undefined> => {\n if (!showsAppointmentsAlone || !viewId) return undefined;\n const own = filtered?.tables.find((x) => x.table === APPOINTMENT_TABLE);\n if (own && (own.viewType ?? MultiTableViewType.FetchXml) === MultiTableViewType.FetchXml && own.fetchXml) return own.fetchXml;\n return (await filterTablesAsync(viewId)).find((x) => x.table.table === APPOINTMENT_TABLE)?.fetchXml ?? undefined;\n };\n\n // The tables the calendar shows now, as a view of several tables keeps them: each with its query —\n // the user's filter in it — or its view, the tables switched off left out.\n const currentTables = async (): Promise<MultiTableViewTable[]> => {\n if (!viewId) return [];\n const response = await registeredAsync();\n const tablesNow = filtered ? [...filtered.tables] : (await filterTablesAsync(viewId)).map((x) => x.table);\n return shownViewTables(tablesNow, known, shownTables, (table) => !!response.tables?.find((info) => info.table === table)?.isActivity);\n };\n\n // One change at a time, and a failure told to the user rather than taking the calendar down.\n const runSavedViewChange = async (change: () => Promise<void>) => {\n if (savingView) return;\n setSavingView(true);\n try {\n await change();\n } catch (error) {\n // eslint-disable-next-line no-console\n console.warn('[Calendar] A change to the user\\u2019s saved views failed.', error);\n await dialog.showErrorAsync(tAll('app.components.grid.saved-views-error'));\n } finally {\n setSavingView(false);\n }\n };\n\n // Does what the saved views' menu was asked to — or, for a user who isn't signed in, asks them to\n // sign in first, and takes them to the sign-in page and back to this one.\n const signedIn = async (action: () => void | Promise<void>) => {\n if (!saved.needsSignIn) {\n await action();\n return;\n }\n const result = await dialog.showConfirmationAsync(tAll('app.components.grid.saved-views-sign-in-message'), {\n title: tAll('app.components.grid.saved-views-sign-in-title'),\n primaryText: tAll('app.buttons.login.label'),\n secondaryText: tAll('app.buttons.cancel.label'),\n });\n if (result.canceled) return;\n const returnUrl = window.location.pathname + window.location.search + window.location.hash;\n window.location.assign(`${signInUrl}${signInUrl.includes('?') ? '&' : '?'}ReturnUrl=${encodeURIComponent(returnUrl)}`);\n };\n\n // Shows a view of the user's in place of the one shown and its filter, the filter its own now.\n const showSavedView = (id: string) => {\n setUserFilter(null);\n setHiddenChoice(null);\n setPickedViewId(id);\n persist({ viewId: id });\n };\n\n const saveView = () =>\n runSavedViewChange(async () => {\n if (shownSavedMulti) {\n const tables = await currentTables();\n if (tables.length === 0) return;\n await multiSaved.update(shownSavedMulti.id, { tables, calendarLayout: writeSavedLayout(currentLayout) });\n } else {\n if (!shownSaved) return;\n const fetchXml = await currentQuery();\n if (!fetchXml) return;\n await saved.update(shownSaved.id, { fetchXml, calendarLayout: writeSavedLayout(currentLayout) });\n }\n // The filter and the tables shown are the view's own now.\n setUserFilter(null);\n setHiddenChoice(null);\n });\n\n const saveViewAs = (name: string) =>\n runSavedViewChange(async () => {\n const fetchXml = showsAppointmentsAlone ? await currentQuery() : undefined;\n if (fetchXml) {\n const view = await saved.create(name, fetchXml, { calendarLayout: writeSavedLayout(currentLayout) });\n showSavedView(view.id.toLowerCase());\n return;\n }\n const tables = await currentTables();\n if (tables.length === 0) return;\n const view = await multiSaved.create(name, tables, { calendarLayout: writeSavedLayout(currentLayout) });\n showSavedView(view.id.toLowerCase());\n });\n\n const cloneView = (id: string, name: string) =>\n runSavedViewChange(async () => {\n // A view of appointments alone: one the user saved, one of the page's, or a Dataverse view.\n const own = findSaved(id);\n const custom = findCustomView(id, customViewDefinitions)?.tables;\n const only = custom?.length === 1 && custom[0]!.table === APPOINTMENT_TABLE &&\n (custom[0]!.viewType ?? MultiTableViewType.FetchXml) === MultiTableViewType.FetchXml\n ? (custom[0]!.fetchXml ?? everyRow(APPOINTMENT_TABLE))\n : undefined;\n const ownMulti = findSavedMulti(id);\n const dataverse = own || only || ownMulti || custom ? undefined : await viewMetadataCache.getAsync(id);\n const fetchXml =\n own?.definition.fetchXml ?? only ?? (dataverse?.tableName.toLowerCase() === APPOINTMENT_TABLE ? dataverse.fetchXml : undefined);\n if (fetchXml) {\n await saved.create(name, fetchXml, { gridLayout: own?.gridLayout, calendarLayout: own?.calendarLayout });\n return;\n }\n // Of several tables, or another table's: copied as a view of its tables.\n const tables =\n ownMulti?.tables ??\n (await viewTablesAsync(id)) ??\n (id === EVERY_TABLE_VIEW_ID ? known.map((table): MultiTableViewTable => ({ table })) : null);\n if (!tables || tables.length === 0) return;\n await multiSaved.create(name, tables, { calendarLayout: ownMulti?.calendarLayout });\n });\n\n const renameView = (id: string, name: string) =>\n runSavedViewChange(async () => void (findSavedMulti(id) ? await multiSaved.update(id, { name }) : await saved.update(id, { name })));\n\n const deleteView = async (id: string) => {\n const result = await dialog.showConfirmationAsync(\n tAll('app.components.grid.saved-views-delete-message', [findSaved(id)?.name ?? findSavedMulti(id)?.name ?? '']),\n {\n title: tAll('app.components.grid.saved-views-delete-title'),\n primaryText: tAll('app.components.grid.saved-views-delete'),\n secondaryText: tAll('app.buttons.cancel.label'),\n },\n );\n if (result.canceled) return;\n await runSavedViewChange(async () => {\n if (findSavedMulti(id)) {\n await multiSaved.remove(id);\n await saved.reloadSettings();\n } else {\n await saved.remove(id);\n }\n if (id.toLowerCase() === viewId) setUserFilter(null);\n });\n };\n\n const setDefault = (id: string, isDefault: boolean) =>\n runSavedViewChange(() => saved.setDefault(id, isDefault, viewLabel(id)));\n const setHidden = (id: string, isHidden: boolean) => runSavedViewChange(() => saved.setHidden(id, isHidden, viewLabel(id)));\n\n // A view's name as the picker shows it, or would, or the user's own name for it.\n function viewLabel(id: string): string {\n return labelOf(id.toLowerCase()) ?? findSaved(id)?.name ?? findSavedMulti(id)?.name ?? id;\n }\n\n // Every view for the Manage views panel, the hidden ones among them.\n const managedViews: GridManagedView[] = useMemo(() => {\n if (!manageViewsOpen) return [];\n const all = [...new Set([...pageViews, ...savedIds.map((x) => x.toLowerCase())])];\n const userDefault = userDefaultViewId(saved.settings, all, savedViewsControl);\n return all.map((id) => ({\n id,\n name: viewLabel(id),\n isSaved: !!findSaved(id) || !!findSavedMulti(id),\n isDefault: id === userDefault,\n isHidden: isViewHidden(saved.settings, id, savedViewsControl),\n isShown: id === viewId,\n }));\n // The labels follow the views' metadata and the picker's.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [manageViewsOpen, pageViews, savedIds, saved.settings, savedViewsControl, viewId, viewOptions, viewNames]);\n\n const onNameDialogSave = (name: string) => {\n const asked = nameDialog;\n setNameDialog(null);\n if (!asked) return;\n if (asked.kind === 'rename') void renameView(asked.viewId, name);\n else if (asked.kind === 'clone') void cloneView(asked.viewId, name);\n else void saveViewAs(name);\n };\n\n return (\n <div className={styles.root} style={{ height }}>\n {/* The toolbar as a grid's and a timeline's: the view picker on its own at the start; at the end\n the period and the moves through it, the host's controls, the layout, the search, then\n Filter — the view's filters, its tables and the user's own views — and Refresh. */}\n <Toolbar className={styles.toolbar} aria-label={t('toolbar')}>\n <div className={styles.toolbarStart}>\n {showsViewPicker && (\n <Dropdown\n className={mergeClasses('ppp-calendar-view-picker', styles.viewPicker)}\n aria-label={tAll('app.components.view-selector.view-name')}\n value={viewOptions.find((option) => option.id === viewId)?.label ?? ''}\n selectedOptions={viewId ? [viewId] : []}\n onOptionSelect={(_, data) => pickView(data.optionValue)}\n >\n {viewOptions.map((option) => (\n <Option key={option.id} value={option.id} text={option.label}>\n {option.label}\n </Option>\n ))}\n </Dropdown>\n )}\n </div>\n <div className={styles.toolbarEnd}>\n <div className={mergeClasses('ppp-calendar-navigation', styles.navigation)}>\n <ToolbarButton\n appearance=\"subtle\"\n disabled={buttons?.today?.isDisabled ?? false}\n onClick={() => controller.today()}\n >\n {t('today')}\n </ToolbarButton>\n <ToolbarButton\n appearance=\"subtle\"\n icon={direction === 'rtl' ? <ChevronRightRegular /> : <ChevronLeftRegular />}\n aria-label={t('previous')}\n onClick={() => controller.prev()}\n />\n <ToolbarButton\n appearance=\"subtle\"\n icon={direction === 'rtl' ? <ChevronLeftRegular /> : <ChevronRightRegular />}\n aria-label={t('next')}\n onClick={() => controller.next()}\n />\n <Text className={styles.title} as=\"h2\" aria-live=\"polite\">\n {view?.title}\n </Text>\n </div>\n {children !== undefined && (\n <CalendarContext.Provider value={calendarContext}>{children}</CalendarContext.Provider>\n )}\n {/* With one layout there is nothing to pick. */}\n {layoutsOffered.length > 1 && (\n <Menu checkedValues={{ layout: [currentLayout] }} onCheckedValueChange={onLayoutChecked}>\n <MenuTrigger disableButtonEnhancement>\n <MenuButton className=\"ppp-calendar-layout\" appearance=\"subtle\">\n {t(layoutKeys[currentLayout])}\n </MenuButton>\n </MenuTrigger>\n <MenuPopover>\n <MenuList>\n {layoutsOffered.map((layout) => (\n <MenuItemRadio key={layout} name=\"layout\" value={layout}>\n {t(layoutKeys[layout])}\n </MenuItemRadio>\n ))}\n </MenuList>\n </MenuPopover>\n </Menu>\n )}\n {showsSearch && (\n <SearchBox\n className={mergeClasses('ppp-calendar-search', styles.search)}\n placeholder={t('search-placeholder')}\n aria-label={t('search-placeholder')}\n value={searchText}\n onChange={(_, data) => setSearchText(data.value)}\n />\n )}\n {/* The view's filters, the tables it shows, and the user's own views — saving the view shown,\n with their filter, tables and layout. A visitor who isn't signed in is asked to sign in\n for any of their views. */}\n <ViewFilterMenu\n changed={viewChanged}\n onEditFilters={showsFilterButton ? () => void openFilter() : undefined}\n tables={appointments ? undefined : kinds.map((table) => ({ table, label: tableLabel(table), shown: !hidden.includes(table) }))}\n onTableShownChange={showTable}\n savedViews={\n showsSavedViewsMenu\n ? {\n canSave: savedViewChanged,\n canSaveAs: canSaveView && viewChanged,\n canSetDefault: !!viewId && !isUserDefault,\n busy: savingView,\n onSave: () => void signedIn(saveView),\n onSaveAs: () => void signedIn(() => setNameDialog({ kind: 'saveAs', viewId: viewId ?? '', name: '' })),\n onSetDefault: () => void signedIn(() => (viewId ? setDefault(viewId, true) : undefined)),\n onManage: () => void signedIn(() => setManageViewsOpen(true)),\n }\n : undefined\n }\n />\n {/* Last, as on a grid. Appointments the host gives the calendar are the host's to read again. */}\n {!appointments && (\n <Tooltip content={tAll('app.buttons.refresh.label')} relationship=\"label\" withArrow>\n <ToolbarButton\n className=\"ppp-calendar-refresh\"\n appearance=\"subtle\"\n icon={<ArrowClockwiseRegular />}\n disabled={loading}\n onClick={() => setRefreshes((count) => count + 1)}\n />\n </Tooltip>\n )}\n </div>\n </Toolbar>\n <GridSaveViewDialog\n open={nameDialog !== null}\n title={tAll(\n nameDialog?.kind === 'rename'\n ? 'app.components.grid.saved-views-rename-title'\n : nameDialog?.kind === 'clone'\n ? 'app.components.grid.saved-views-clone-title'\n : 'app.components.grid.saved-views-save-as-title',\n )}\n name={nameDialog?.name ?? ''}\n onSave={onNameDialogSave}\n onCancel={() => setNameDialog(null)}\n />\n {saved.available && (\n <GridManageViewsPanel\n open={manageViewsOpen}\n onOpenChange={setManageViewsOpen}\n views={managedViews}\n busy={savingView}\n onOpenView={(id) => {\n setManageViewsOpen(false);\n pickView(id);\n }}\n onSetDefault={(id, isDefault) => void setDefault(id, isDefault)}\n onSetHidden={(id, isHidden) => void setHidden(id, isHidden)}\n onRename={(id) => setNameDialog({ kind: 'rename', viewId: id, name: findSaved(id)?.name ?? findSavedMulti(id)?.name ?? '' })}\n onClone={(id) =>\n setNameDialog({ kind: 'clone', viewId: id, name: tAll('app.components.grid.saved-views-copy-of', [viewLabel(id)]) })\n }\n onDelete={(id) => void deleteView(id)}\n />\n )}\n <MultiTableFilterDialog\n open={filterDialog !== null}\n tabs={filterDialog?.tabs ?? []}\n viewTabs={filterDialog?.viewTabs}\n onApply={applyFilter}\n onCancel={() => setFilterDialog(null)}\n />\n {failed ? (\n <MessageBar intent=\"error\">\n <MessageBarBody>{t('error')}</MessageBarBody>\n </MessageBar>\n ) : (\n failures.length > 0 && (\n // A table that couldn't be read leaves the rest of the range as it is.\n <MessageBar intent=\"warning\">\n <MessageBarBody>{t('failed-tables', [failures.map((x) => tableLabel(x.table ?? '')).join(', ')])}</MessageBarBody>\n <MessageBarActions>\n <Button size=\"small\" onClick={() => setRefreshes((count) => count + 1)}>\n {t('retry')}\n </Button>\n </MessageBarActions>\n </MessageBar>\n )\n )}\n {truncated && (\n <MessageBar intent=\"warning\">\n <MessageBarBody>{t('truncated')}</MessageBarBody>\n </MessageBar>\n )}\n {/* The appointments, under an overlay while a range loads, as a grid's rows are. Only they\n are covered: the toolbar stays free, so the user can move on, change the view or search\n while the range on screen is still loading. */}\n <div className={styles.body}>\n <div className={styles.surface}>\n {viewSettled && (\n <FullCalendar\n {...options}\n // Fluent's tokens are set on its provider's element, which the popover isn't inside: its\n // theme class sets them on the popover, as Fluent's own portals do.\n popoverClass={`${options.popoverClass} ${themeClassName}`}\n plugins={plugins}\n controller={controller}\n events={events}\n loading={setLoading}\n eventContent={renderAppointment}\n eventClick={(info) => {\n info.jsEvent.preventDefault();\n const table = info.event.extendedProps['table'] as string | null | undefined;\n if (onAppointmentClick) onAppointmentClick(info.event.id);\n else if (table === SERIES_TABLE && !appointments) {\n // A series shown once opens as the series.\n latestStart.current++;\n setOpenAppointment({ id: info.event.id, subject: info.event.title, recurring: false, isSeries: true });\n } else if (table && table !== APPOINTMENT_TABLE && !appointments) {\n // Another table's row opens in its form.\n latestStart.current++;\n void openRow(table, info.event.id);\n } else {\n const opened = appointmentToOpen(info.event, appointments !== undefined);\n if (opened) {\n // A new appointment still being started gives way to the one clicked.\n latestStart.current++;\n const seriesId = opened.recurring ? seriesOf.current.get(opened.id) : undefined;\n // One of a series: the user says whether they mean it or the series.\n if (seriesId) setRecurringChoice({ ...opened, seriesId });\n else setOpenAppointment(opened);\n }\n }\n }}\n select={(info) => {\n const range = { start: info.start, end: info.end, allDay: info.allDay };\n // The host's to handle when it says so; otherwise a calendar that loads its own\n // appointments opens a new one to create over the range.\n if (onRangeSelect) onRangeSelect(range);\n else if (!appointments) void startAppointment(range);\n info.view.calendar.unselect();\n }}\n eventDrop={handleChange}\n eventResize={handleChange}\n datesSet={(info) => {\n const layout = fromFullCalendarView(info.view.type);\n if (!layout) return;\n const date = periodDate(info.view.currentStart, info.view.currentEnd, new Date(), timeZone);\n shownState.current = { layout, ...(date ? { d: date } : {}) };\n persist();\n onRangeChange?.({ start: info.start, end: info.end, layout });\n }}\n />\n )}\n </div>\n {(loading || awaitsTimeZone || saved.loading || multiSaved.loading) && (\n <div className={styles.loadingOverlay}>\n <Spinner size=\"large\" />\n </div>\n )}\n </div>\n {/* What a screen reader announces while a range loads: always mounted, since a live region\n announces a change to what it holds, not its arrival. */}\n <span className={styles.visuallyHidden} role=\"status\" aria-live=\"polite\">\n {loading ? t('loading') : ''}\n </span>\n {/* In an editable calendar, a form: the appointment opened, or a new one over a range. Saving\n reads the range again. */}\n <AppointmentDetailsDialog\n appointment={openAppointment}\n newAppointment={creating}\n editable={editable}\n regardingTables={regardingTables}\n location={dialogLocation}\n onClose={() => {\n setOpenAppointment(null);\n setCreating(null);\n }}\n onSaved={() => setRefreshes((count) => count + 1)}\n >\n {appointmentDetails}\n </AppointmentDetailsDialog>\n {panelRow && infoOf(panelRow.table)?.definition && (\n <MultiTableRecordPanel\n key={`${panelRow.table}:${panelRow.id}`}\n title={tableLabel(panelRow.table)}\n existing={{ table: panelRow.table, id: panelRow.id }}\n loaded={panelRow.record}\n form={forms?.[panelRow.table]?.edit}\n location={dialogLocation}\n definition={infoOf(panelRow.table)!.definition!}\n onSaved={() => {\n setPanelRow(null);\n setRefreshes((count) => count + 1);\n }}\n onClose={() => setPanelRow(null)}\n />\n )}\n <RecurringChoiceDialog\n appointment={recurringChoice}\n onChoose={(series) => {\n const chosen = recurringChoice;\n setRecurringChoice(null);\n if (!chosen?.seriesId) return;\n setOpenAppointment(series ? { id: chosen.seriesId, subject: chosen.subject, recurring: false, isSeries: true } : chosen);\n }}\n onClose={() => setRecurringChoice(null)}\n />\n </div>\n );\n}\n\n/** The page's template for a table, its name matched as the Blazor Calendar matches it: ignoring case. */\nfunction templateFor(\n templates: Readonly<Record<string, (item: MultiTableItem) => ReactNode>> | undefined,\n table: string,\n): ((item: MultiTableItem) => ReactNode) | undefined {\n if (!templates) return undefined;\n const name = table.toLowerCase();\n return templates[table] ?? Object.entries(templates).find(([key]) => key.trim().toLowerCase() === name)?.[1];\n}\n\n/** A row drawn by the page's template, in place of all the calendar draws of it. */\nfunction templateContent(info: EventDisplayInfo, content: ReactNode) {\n return (\n <div className={isCompactView(info.view.type) ? 'ppp-calendar-event ppp-calendar-event-compact' : 'ppp-calendar-event'}>\n {content}\n </div>\n );\n}\n\nfunction appointmentContent(info: EventDisplayInfo) {\n const { event } = info;\n const location = event.extendedProps['location'] as string | null;\n const recurring = event.extendedProps['recurring'] as boolean;\n const title = (\n <span className=\"ppp-calendar-event-title\">\n {recurring && <ArrowRepeatAllRegular className=\"ppp-calendar-event-icon\" />}\n {event.title}\n </span>\n );\n if (isCompactView(info.view.type)) {\n // One line, as Outlook draws a month's cells: the time, then the subject.\n return (\n <div className=\"ppp-calendar-event ppp-calendar-event-compact\">\n {info.timeText && <span className=\"ppp-calendar-event-detail\">{info.timeText}</span>}\n {title}\n </div>\n );\n }\n // The subject, then the place, as Outlook draws them: the time is where the appointment sits in a\n // day's hours, and in the agenda's own column.\n return (\n <div className=\"ppp-calendar-event\">\n {title}\n {location && <span className=\"ppp-calendar-event-detail\">{location}</span>}\n </div>\n );\n}\n","import { ToolbarButton, Tooltip, mergeClasses, type ToolbarButtonProps } from '@fluentui/react-components';\nimport { AddRegular } from '@fluentui/react-icons';\nimport { useT } from '@powerportalspro/react';\nimport { useState, type ReactElement } from 'react';\nimport { useCalendarContext, type CalendarContextValue } from './calendar-context.js';\n\nexport interface CalendarButtonProps {\n /** Called when the button is clicked, with the calendar as it is then. */\n onClick?: (calendar: CalendarContextValue) => void | Promise<void>;\n /** The text on the button. */\n label?: string;\n /** An icon shown before the text, such as `<ArrowDownloadRegular />`. */\n icon?: ReactElement;\n /** Shown when the pointer rests on the button; also its name for a screen reader when it has no label. */\n tooltip?: string;\n /** How the button is drawn. `subtle` by default, as the calendar's own toolbar buttons are. */\n appearance?: ToolbarButtonProps['appearance'];\n /** Whether the button can't be clicked. */\n disabled?: boolean;\n /** A class added to the button. */\n className?: string;\n}\n\n/**\n * A button for a `<Calendar>`'s toolbar: place it among the calendar's children, and a click hands\n * it the calendar as it is then — the period shown, the record it is about, and what it can be\n * asked to do. The grid's `<GridButton>` is its counterpart, and the Blazor `CalendarButton` its\n * twin.\n *\n * ```tsx\n * <Calendar regarding={account} editable>\n * <NewAppointmentCalendarButton />\n * <CalendarButton label=\"Export\" icon={<ArrowDownloadRegular />} onClick={(calendar) => exportRange(calendar.start, calendar.end)} />\n * </Calendar>\n * ```\n */\nexport function CalendarButton({\n onClick,\n label,\n icon,\n tooltip,\n appearance = 'subtle',\n disabled = false,\n className,\n}: CalendarButtonProps) {\n const calendar = useCalendarContext();\n // Set while a click is handled, so a second click doesn't run it again.\n const [working, setWorking] = useState(false);\n const click = async () => {\n if (working || !onClick) return;\n setWorking(true);\n try {\n await onClick(calendar);\n } finally {\n setWorking(false);\n }\n };\n\n const button = (\n <ToolbarButton\n className={mergeClasses('ppp-calendar-button', className)}\n appearance={appearance}\n disabled={disabled || working}\n icon={icon ?? null}\n aria-label={label === undefined ? tooltip : undefined}\n onClick={() => void click()}\n >\n {label}\n </ToolbarButton>\n );\n return tooltip ? (\n <Tooltip content={tooltip} relationship={label === undefined ? 'label' : 'description'} withArrow>\n {button}\n </Tooltip>\n ) : (\n button\n );\n}\n\nexport interface NewAppointmentCalendarButtonProps {\n /** The text on the button. \"New\" by default. */\n label?: string;\n /** The icon shown before the text. A plus by default. */\n icon?: ReactElement;\n /** Shown when the pointer rests on the button. */\n tooltip?: string;\n /** How the button is drawn. `subtle` by default. */\n appearance?: ToolbarButtonProps['appearance'];\n}\n\n/**\n * A New button for a `<Calendar>`'s toolbar: it starts a new appointment as selecting a time does —\n * from the next half hour when the period shown takes in today, and otherwise from 8:00 on its\n * first day. Shown only where that starts something: in an `editable` calendar whose host handles\n * `onRangeSelect`, or that loads its own appointments for a user who may create them. The Blazor\n * `NewAppointmentCalendarButton` is its twin.\n */\nexport function NewAppointmentCalendarButton({\n label,\n icon,\n tooltip,\n appearance = 'subtle',\n}: NewAppointmentCalendarButtonProps) {\n const calendar = useCalendarContext();\n const t = useT();\n if (!calendar.canCreateAppointments) return null;\n return (\n <CalendarButton\n className=\"ppp-calendar-new\"\n label={label ?? t('app.buttons.new.label')}\n icon={icon ?? <AddRegular />}\n appearance={appearance}\n {...(tooltip !== undefined && { tooltip })}\n onClick={(context) => context.createAppointment()}\n />\n );\n}\n"]}
1
+ {"version":3,"sources":["../src/appointment-click.ts","../src/calendar-context.tsx","../src/recurrence-pattern.ts","../src/recurrence-edit.tsx","../src/appointment-details.tsx","../src/core/styles.ts","../src/core/events.ts","../src/core/options.ts","../src/core/state.ts","../src/core/new-appointment.ts","../src/core/summary.ts","../src/appointment-tooltip.tsx","../src/appointment-record.ts","../src/calendar-query.ts","../src/calendar-rows.ts","../../../node_modules/.pnpm/@fullcalendar+react@7.1.3_react-dom@19.2.5_react@19.2.5__react@19.2.5_temporal-polyfill@1.0.6/node_modules/@fullcalendar/react/skeleton.css","../../../node_modules/.pnpm/@fullcalendar+react@7.1.3_react-dom@19.2.5_react@19.2.5__react@19.2.5_temporal-polyfill@1.0.6/node_modules/@fullcalendar/react/themes/forma/theme.css","../src/fullcalendar-styles.ts","../src/persisted-calendar-state.ts","../src/calendar.tsx","../src/calendar-button.tsx"],"names":["createContext","useContext","firstDayOfWeek","makeStyles","tokens","usePrefixedT","useId","useRef","useEffect","jsx","SharedTooltip","Field","Dropdown","Option","jsxs","Fragment","SpinButton","Text","Checkbox","ToggleButton","RadioGroup","Radio","Input","useStyles","newAppointment","useT","useRecordPages","findRecordPage","recordPageUrl","Button","followRecordLink","RecordDialogShell","RecordContext","RecordDialogFrame","SaveContextButton","Dialog","DialogSurface","DialogBody","DialogTitle","DialogContent","DialogActions","usePowerPortalsPro","useState","TableSecurityPermission","useRecordContext","useDialogService","useRunWithOverlay","DeleteContextButton","Menu","MenuTrigger","ChevronDownRegular","MenuPopover","MenuList","MenuItem","useLocalization","useLocalizationLoaded","QueryStatus","ArrowRepeatAllRegular","ColumnEdit","StatusReasonEdit","MessageBar","MessageBarBody","Spinner","useUserTimeZone","useMainContext","getRecordReferenceId","document","Tooltip","defaultViewId","EVERY_TABLE_VIEW_ID","isViewHidden","SERIES_TABLE","MINUTE_MS","DAY_MS","valueOf","STYLE_ID","DATE","GUID","replaceQueryParam","formaTheme","dayGridPlugin","timeGridPlugin","listPlugin","interactionPlugin","ViewSort","useLocale","useCalendarController","useThemeClassName","useMemo","savedViewControl","SavedViewControlKind","useSavedViews","useMultiTableViews","useMultiTableTableSet","MultiTableUses","known","view","viewLabelOf","useCallback","MultiTableViewType","tables","stored","userDefaultViewId","shownViewTables","useSavedViewSession","everyRow","ViewToolbar","ViewPicker","mergeClasses","ToolbarButton","ChevronRightRegular","ChevronLeftRegular","MenuButton","MenuItemRadio","ViewSearchBox","ViewFilterMenu","ViewRefreshButton","SavedViewDialogs","MultiTableFilterDialog","ViewLoadMessages","FullCalendar","MultiTableRecordPanel","series","AddRegular"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,IAAM,IAAA,GAAO,iEAAA;AAON,SAAS,iBAAA,CACd,OACA,gBAAA,EACwB;AACxB,EAAA,IAAI,oBAAoB,CAAC,IAAA,CAAK,KAAK,KAAA,CAAM,EAAE,GAAG,OAAO,IAAA;AACrD,EAAA,OAAO,EAAE,EAAA,EAAI,KAAA,CAAM,EAAA,EAAI,OAAA,EAAS,KAAA,CAAM,KAAA,EAAO,SAAA,EAAW,OAAA,CAAQ,KAAA,CAAM,aAAA,CAAc,WAAW,CAAC,CAAA,EAAE;AACpG;ACgBO,IAAM,eAAA,GAAkBA,oBAA2C,IAAI,CAAA;AAGvE,SAAS,kBAAA,GAA2C;AACzD,EAAA,MAAM,OAAA,GAAUC,iBAAW,eAAe,CAAA;AAC1C,EAAA,IAAI,CAAC,OAAA,EAAS,MAAM,IAAI,MAAM,2EAA2E,CAAA;AACzG,EAAA,OAAO,OAAA;AACT;AC9CO,IAAM,mBAAA,GAAsB;AAAA,EACjC,KAAA,EAAO,CAAA;AAAA,EACP,MAAA,EAAQ,CAAA;AAAA,EACR,OAAA,EAAS,CAAA;AAAA,EACT,MAAA,EAAQ;AACV,CAAA;AAIO,IAAM,aAAA,GAAgB;AAAA;AAAA,EAE3B,KAAA,EAAO,CAAA;AAAA,EAC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S,CAAA,CAAE,uBAAuB,CAAA;AAAA,MACzC,IAAA,EAAM,IAAA,oBAAQA,cAAAA,CAACkH,qBAAA,EAAA,EAAW,CAAA;AAAA,MAC1B,UAAA;AAAA,MACC,GAAI,OAAA,KAAY,MAAA,IAAa,EAAE,OAAA,EAAQ;AAAA,MACxC,OAAA,EAAS,CAAC,OAAA,KAAY,OAAA,CAAQ,iBAAA;AAAkB;AAAA,GAClD;AAEJ","file":"index.cjs","sourcesContent":["// Which clicks on an appointment open its details. Framework-free.\n\n/**\n * The appointment a details dialog is open on: what the calendar drew of it. An occurrence carries\n * the series it is of; a series opens as one (`isSeries`), its `id` the series'.\n */\nexport interface OpenAppointment {\n id: string;\n subject: string;\n recurring: boolean;\n seriesId?: string | null;\n isSeries?: boolean;\n}\n\nconst GUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\n/**\n * The appointment a click on an event opens the details of, or null for none: appointments the\n * host gives the calendar are the host's to show, and an event that isn't a Dataverse record has\n * none to read. The Blazor Calendar's OnAppointmentClickAsync is its twin.\n */\nexport function appointmentToOpen(\n event: { id: string; title: string; extendedProps: Record<string, unknown> },\n hostAppointments: boolean,\n): OpenAppointment | null {\n if (hostAppointments || !GUID.test(event.id)) return null;\n return { id: event.id, subject: event.title, recurring: Boolean(event.extendedProps['recurring']) };\n}\n","import type { TableRecordReference } from '@powerportalspro/core';\nimport { createContext, useContext } from 'react';\nimport type { CalendarLayout } from './core/index.js';\n\n/** A time to start a new appointment over: what selecting a range in the calendar gives. */\nexport interface CalendarRange {\n start: Date;\n end: Date;\n allDay: boolean;\n}\n\n/**\n * A `<Calendar>` as a control in its toolbar sees it: the period it shows, the record it is about,\n * and what it can be asked to do. Read it with {@link useCalendarContext}; a `<CalendarButton>`\n * hands it to its click. The Blazor `CalendarContext` is its twin.\n */\nexport interface CalendarContextValue {\n /** The layout shown. */\n layout: CalendarLayout;\n /** The first moment shown; undefined until the calendar has drawn. */\n start: Date | undefined;\n /** The moment after the last one shown; undefined until the calendar has drawn. */\n end: Date | undefined;\n /** The record the calendar is about: its `regarding`. */\n regarding: TableRecordReference | undefined;\n /**\n * Whether {@link createAppointment} has something to start: an `editable` calendar whose host\n * handles `onRangeSelect`, or that loads its own appointments for a user who may create them.\n * False until that is known.\n */\n canCreateAppointments: boolean;\n /**\n * Starts a new appointment, as selecting a time does in an `editable` calendar: the host's to\n * handle when it handles `onRangeSelect`; otherwise, in a calendar that loads its own\n * appointments, a form to create one, when the user may. Without a range, the appointment starts\n * at the next half hour when the period shown takes in today, and otherwise at 8:00 on its first\n * day, and lasts half an hour. Does nothing unless the calendar is `editable`.\n */\n createAppointment: (range?: CalendarRange) => Promise<void>;\n /** Reads the appointments of the range shown again. */\n refresh: () => void;\n}\n\nexport const CalendarContext = createContext<CalendarContextValue | null>(null);\n\n/** The calendar a control in its toolbar sits in. Throws outside a `<Calendar>`'s toolbar. */\nexport function useCalendarContext(): CalendarContextValue {\n const context = useContext(CalendarContext);\n if (!context) throw new Error('useCalendarContext must be used in a <Calendar>, among its toolbar items.');\n return context;\n}\n","// How an appointment series repeats, as a recurringappointmentmaster holds it. Framework-free.\nimport { firstDayOfWeek, type TableRecord } from '@powerportalspro/core';\n\n/** How often a series repeats: Dataverse's `recurrencepatterntype`. */\nexport const RecurrenceFrequency = {\n Daily: 0,\n Weekly: 1,\n Monthly: 2,\n Yearly: 3,\n} as const;\nexport type RecurrenceFrequency = (typeof RecurrenceFrequency)[keyof typeof RecurrenceFrequency];\n\n/** How a series ends: Dataverse's `patternendtype`. */\nexport const RecurrenceEnd = {\n /** Never: Dataverse adds occurrences up to a year ahead, and more as time passes. */\n Never: 1,\n AfterOccurrences: 2,\n /** On a date, its last occurrence on or before it. */\n OnDate: 3,\n} as const;\nexport type RecurrenceEnd = (typeof RecurrenceEnd)[keyof typeof RecurrenceEnd];\n\n/** Days of the week, as Dataverse's `daysofweekmask` holds them: Sunday 1, Monday 2 … Saturday 64. */\nexport const RecurrenceDays = {\n Sunday: 1,\n Monday: 2,\n Tuesday: 4,\n Wednesday: 8,\n Thursday: 16,\n Friday: 32,\n Saturday: 64,\n} as const;\n\n/** A yes-or-no column's value, as a record carries it. */\nexport function boolColumn(value: boolean): { $type: number; value: boolean } {\n return { $type: BOOL, value };\n}\n\n/** The table a series is a record of. */\nexport const SERIES_TABLE = 'recurringappointmentmaster';\n\n// The columns only some shapes of pattern use, cleared from a series changing to one that doesn't.\nconst SHAPE_COLUMNS = ['daysofweekmask', 'dayofmonth', 'instance', 'monthofyear', 'occurrences', 'patternenddate'];\n\n// A weekday pattern's days: Monday to Friday.\nconst WEEKDAYS = 62;\n// The `instance` Dataverse names the last week of a month by.\nconst LAST_INSTANCE = 5;\n\n// The wire discriminators of the values a series is written with (ColumnType's numbers).\nconst BOOL = 0;\nconst DATE = 2;\nconst INT = 5;\nconst CHOICE = 11;\n\n/**\n * How a series repeats. What depends on the day it starts — the day of the month, the month, which\n * week of it — is taken from that day rather than chosen apart from it, as Outlook offers it. The\n * Blazor Calendar's `RecurrencePattern` is its twin.\n */\nexport interface RecurrencePattern {\n frequency: RecurrenceFrequency;\n /** Every how many days, weeks, months or years: one or more. */\n interval: number;\n /**\n * For a daily series, on weekdays only, every week — as Dataverse keeps it, a weekly series on\n * Monday to Friday, which takes no interval.\n */\n weekdaysOnly: boolean;\n /** For a weekly series, the days it falls on, as a `RecurrenceDays` mask. */\n days: number;\n /** For a monthly or yearly series, on the start's weekday in its week of the month rather than its date. */\n byWeekday: boolean;\n end: RecurrenceEnd;\n /** How many times it takes place, when it ends after a number of occurrences. */\n occurrences: number;\n /** The day it ends on (`yyyy-mm-dd`), when it ends on a date. */\n endDate: string | null;\n}\n\n/** A day as a time zone has it: its date, and its day of the week (0 for Sunday). */\nexport interface LocalDay {\n year: number;\n month: number;\n day: number;\n weekday: number;\n}\n\n/** The day an instant falls on in a time zone, or the browser's. */\nexport function localDay(instant: Date, timeZone?: string): LocalDay {\n const { year, month, day } = zonedParts(instant, timeZone);\n return { year, month, day, weekday: new Date(Date.UTC(year, month - 1, day)).getUTCDay() };\n}\n\n/** The day of the week as a `RecurrenceDays` flag. */\nexport function dayOf(weekday: number): number {\n return 1 << weekday;\n}\n\n/** A series repeating as `frequency` says from `start`: a weekly one on its day of the week. */\nexport function startingPattern(frequency: RecurrenceFrequency, start: LocalDay): RecurrencePattern {\n return {\n frequency,\n interval: 1,\n weekdaysOnly: false,\n days: dayOf(start.weekday),\n byWeekday: false,\n end: RecurrenceEnd.Never,\n occurrences: 10,\n endDate: null,\n };\n}\n\n/** Which week of its month a day is in: 1 to 4, or 5 for one in the month's last seven days. */\nexport function instanceOf(day: LocalDay): number {\n const daysInMonth = new Date(Date.UTC(day.year, day.month, 0)).getUTCDate();\n return day.day + 7 > daysInMonth ? LAST_INSTANCE : Math.floor((day.day - 1) / 7) + 1;\n}\n\n/**\n * The pattern's columns for a series running from `start` to `end`, in the user's `timeZone`: what\n * it repeats on, its times, and the day it starts — as a moment, that day's midnight in the zone,\n * since Dataverse reads the day in the series' zone. For a series that had another shape\n * (`existing`), the columns of that one this one doesn't use are cleared (null), so Dataverse doesn't\n * read them into this one.\n */\nexport function seriesColumns(\n pattern: RecurrencePattern,\n start: Date,\n end: Date,\n timeZone?: string,\n existing?: TableRecord,\n): Record<string, { $type: number; value: unknown } | null> {\n const local = localDay(start, timeZone);\n const day = dayOf(local.weekday);\n const weekdaysOnly = pattern.frequency === RecurrenceFrequency.Daily && pattern.weekdaysOnly;\n const yearlyOrMonthly =\n pattern.frequency === RecurrenceFrequency.Monthly || pattern.frequency === RecurrenceFrequency.Yearly;\n const byWeekday = yearlyOrMonthly && pattern.byWeekday;\n\n // Every weekday is, to Dataverse, a weekly series on Monday to Friday marked as the weekday\n // pattern: a daily one can't be limited to weekdays.\n const columns: Record<string, { $type: number; value: unknown }> = {\n recurrencepatterntype: { $type: CHOICE, value: weekdaysOnly ? RecurrenceFrequency.Weekly : pattern.frequency },\n interval: { $type: INT, value: weekdaysOnly ? 1 : Math.max(1, pattern.interval) },\n starttime: { $type: DATE, value: start.toISOString() },\n endtime: { $type: DATE, value: end.toISOString() },\n patternstartdate: { $type: DATE, value: midnight(local, timeZone).toISOString() },\n isweekdaypattern: { $type: BOOL, value: weekdaysOnly },\n isnthmonthly: { $type: BOOL, value: byWeekday && pattern.frequency === RecurrenceFrequency.Monthly },\n isnthyearly: { $type: BOOL, value: byWeekday && pattern.frequency === RecurrenceFrequency.Yearly },\n };\n\n if (weekdaysOnly) columns['daysofweekmask'] = { $type: INT, value: WEEKDAYS };\n else if (pattern.frequency === RecurrenceFrequency.Weekly)\n columns['daysofweekmask'] = { $type: INT, value: pattern.days === 0 ? day : pattern.days };\n\n if (yearlyOrMonthly) {\n if (byWeekday) {\n columns['instance'] = { $type: CHOICE, value: instanceOf(local) };\n columns['daysofweekmask'] = { $type: INT, value: day };\n } else {\n columns['dayofmonth'] = { $type: INT, value: local.day };\n }\n if (pattern.frequency === RecurrenceFrequency.Yearly) columns['monthofyear'] = { $type: CHOICE, value: local.month };\n }\n\n columns['patternendtype'] = { $type: CHOICE, value: pattern.end };\n if (pattern.end === RecurrenceEnd.AfterOccurrences)\n columns['occurrences'] = { $type: INT, value: Math.max(1, pattern.occurrences) };\n else if (pattern.end === RecurrenceEnd.OnDate && pattern.endDate) {\n const [year, month, date] = pattern.endDate.split('-').map(Number) as [number, number, number];\n columns['patternenddate'] = {\n $type: DATE,\n value: midnight({ year, month, day: date }, timeZone).toISOString(),\n };\n }\n const held = (existing?.properties ?? {}) as Record<string, { value?: unknown } | null | undefined>;\n const cleared = SHAPE_COLUMNS.filter((column) => !(column in columns) && held[column] != null);\n return { ...columns, ...Object.fromEntries(cleared.map((column) => [column, null])) };\n}\n\n/** The series to create of an appointment from `start` to `end`, in the user's `timeZone`. */\nexport function toSeries(pattern: RecurrencePattern, start: Date, end: Date, timeZone?: string): TableRecord {\n return { tableName: SERIES_TABLE, properties: seriesColumns(pattern, start, end, timeZone) } as TableRecord;\n}\n\ntype Properties = Record<string, { value?: unknown } | null | undefined>;\n\n/** The pattern a series holds, read in the user's `timeZone`; null when it holds none Dataverse defines. */\nexport function fromSeries(series: TableRecord, timeZone?: string): RecurrencePattern | null {\n const properties = series.properties as Properties;\n const value = (column: string) => properties[column]?.value;\n const type = value('recurrencepatterntype');\n if (typeof type !== 'number' || !Object.values(RecurrenceFrequency).includes(type as RecurrenceFrequency)) return null;\n\n const endType = value('patternendtype');\n const end = Object.values(RecurrenceEnd).includes(endType as RecurrenceEnd) ? (endType as RecurrenceEnd) : RecurrenceEnd.Never;\n const endMoment = value('patternenddate');\n const endDay = typeof endMoment === 'string' ? localDay(new Date(endMoment), timeZone) : null;\n\n // The weekday pattern, which Dataverse keeps as a weekly one, is every weekday.\n const weekdaysOnly = value('isweekdaypattern') === true;\n return {\n frequency: weekdaysOnly ? RecurrenceFrequency.Daily : (type as RecurrenceFrequency),\n interval: weekdaysOnly ? 1 : Math.max(1, Number(value('interval') ?? 1)),\n weekdaysOnly,\n days: weekdaysOnly ? 0 : Number(value('daysofweekmask') ?? 0),\n byWeekday: value('isnthmonthly') === true || value('isnthyearly') === true,\n end,\n occurrences: Number(value('occurrences') ?? 10),\n endDate: endDay ? isoDate(endDay) : null,\n };\n}\n\n/** Translates a key under `app.components.calendar.recurrence`, with its arguments. */\nexport type RecurrenceText = (key: string, args?: readonly unknown[]) => string;\n\n/**\n * On which day of the month a monthly series falls, in words — \"on day 5\", \"on the second Tuesday\" —\n * by the strings under `phrases`: `summary` within a sentence, `options` on its own.\n */\nexport function monthlyOn(pattern: RecurrencePattern, start: LocalDay, locale: string, t: RecurrenceText, phrases = 'summary'): string {\n return pattern.byWeekday\n ? t(`${phrases}.on-the-weekday`, [t(`instances.${instanceOf(start)}`), dayName(start.weekday, locale)])\n : t(`${phrases}.on-day`, [start.day]);\n}\n\n/**\n * On which day of the year a yearly series falls, in words — \"on March 5\", \"on the second Tuesday of\n * March\" — by the strings under `phrases`, as `monthlyOn`.\n */\nexport function yearlyOn(pattern: RecurrencePattern, start: LocalDay, locale: string, t: RecurrenceText, phrases = 'summary'): string {\n return pattern.byWeekday\n ? t(`${phrases}.on-the-weekday-of`, [\n t(`instances.${instanceOf(start)}`),\n dayName(start.weekday, locale),\n monthName(start.month, locale),\n ])\n : t(`${phrases}.on-date`, [\n new Intl.DateTimeFormat(locale, { month: 'long', day: 'numeric', timeZone: 'UTC' }).format(\n Date.UTC(2000, start.month - 1, start.day),\n ),\n ]);\n}\n\n/** The pattern in words, for a series starting on `start`: \"Every 2 weeks on Monday, Wednesday, 6 times\". */\nexport function describeRecurrence(pattern: RecurrencePattern, start: LocalDay, locale: string, t: RecurrenceText): string {\n const interval = Math.max(1, pattern.interval);\n const many = interval > 1;\n const days = () => dayNames(pattern.days === 0 ? dayOf(start.weekday) : pattern.days, locale);\n\n let repeats: string;\n switch (pattern.frequency) {\n case RecurrenceFrequency.Daily:\n repeats = pattern.weekdaysOnly\n ? t('summary.every-weekday')\n : many\n ? t('summary.every-n-days', [interval])\n : t('summary.every-day');\n break;\n case RecurrenceFrequency.Weekly:\n repeats = many ? t('summary.every-n-weeks', [interval, days()]) : t('summary.every-week', [days()]);\n break;\n case RecurrenceFrequency.Monthly:\n repeats = many\n ? t('summary.every-n-months', [interval, monthlyOn(pattern, start, locale, t)])\n : t('summary.every-month', [monthlyOn(pattern, start, locale, t)]);\n break;\n default:\n repeats = many\n ? t('summary.every-n-years', [interval, yearlyOn(pattern, start, locale, t)])\n : t('summary.every-year', [yearlyOn(pattern, start, locale, t)]);\n }\n\n if (pattern.end === RecurrenceEnd.AfterOccurrences) return t('summary.times', [repeats, Math.max(1, pattern.occurrences)]);\n if (pattern.end === RecurrenceEnd.OnDate && pattern.endDate) {\n const [year, month, day] = pattern.endDate.split('-').map(Number) as [number, number, number];\n return t('summary.until', [repeats, new Intl.DateTimeFormat(locale, { timeZone: 'UTC' }).format(Date.UTC(year, month - 1, day))]);\n }\n return repeats;\n}\n\n// The first day of the locale's week, now core's: shared with the Kanban board's date lanes.\nexport { firstDayOfWeek };\n\n/** The days of the week in the order of the locale's week. */\nexport function weekOrder(locale: string): number[] {\n const first = firstDayOfWeek(locale);\n return Array.from({ length: 7 }, (_, i) => (first + i) % 7);\n}\n\n/** A day of the week's name, long or as short as the locale writes it. */\nexport function dayName(weekday: number, locale: string, width: 'long' | 'narrow' | 'short' = 'long'): string {\n // 1 November 2026 is a Sunday.\n return new Intl.DateTimeFormat(locale, { weekday: width, timeZone: 'UTC' }).format(Date.UTC(2026, 10, 1 + weekday));\n}\n\nfunction monthName(month: number, locale: string): string {\n return new Intl.DateTimeFormat(locale, { month: 'long', timeZone: 'UTC' }).format(Date.UTC(2000, month - 1, 1));\n}\n\n// The days named in the order of the locale's week.\nfunction dayNames(days: number, locale: string): string {\n return weekOrder(locale)\n .filter((weekday) => (days & dayOf(weekday)) !== 0)\n .map((weekday) => dayName(weekday, locale))\n .join(', ');\n}\n\n/** A day as `yyyy-mm-dd`. */\nexport function isoDate(day: Pick<LocalDay, 'year' | 'month' | 'day'>): string {\n return `${String(day.year).padStart(4, '0')}-${String(day.month).padStart(2, '0')}-${String(day.day).padStart(2, '0')}`;\n}\n\nfunction zonedParts(instant: Date, timeZone?: string) {\n const parts = new Intl.DateTimeFormat('en-US', {\n ...(timeZone ? { timeZone } : {}),\n year: 'numeric',\n month: 'numeric',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n hourCycle: 'h23',\n }).formatToParts(instant);\n const part = (type: Intl.DateTimeFormatPartTypes) => Number(parts.find((x) => x.type === type)?.value ?? 0);\n return { year: part('year'), month: part('month'), day: part('day'), hour: part('hour'), minute: part('minute') };\n}\n\n/**\n * The times an appointment or series takes when All day is switched. On: the whole days its times\n * fall on, from midnight on the day it starts to midnight after the last day it takes in — one day at\n * least. Off: nine o'clock on the day it started, for half an hour. The Blazor Calendar's AllDayTimes\n * is its twin.\n */\nexport function allDayTimes(start: Date, end: Date, allDay: boolean, timeZone?: string): { start: Date; end: Date } {\n const first = localDay(start, timeZone);\n if (!allDay) {\n const at = hourOn(first, 9, timeZone);\n return { start: at, end: new Date(at.getTime() + 30 * 60 * 1000) };\n }\n // The day the end stops before: a midnight is its own day's start; any later moment takes its day in.\n const last = zonedParts(end, timeZone);\n const endsAtMidnight = last.hour === 0 && last.minute === 0;\n const after = addDays(last, endsAtMidnight ? 0 : 1);\n const dayAfter = isoDate(after) > isoDate(first) ? after : addDays(first, 1);\n return { start: midnight(first, timeZone), end: midnight(dayAfter, timeZone) };\n}\n\n// A day so many days later.\nfunction addDays(day: Pick<LocalDay, 'year' | 'month' | 'day'>, days: number): Pick<LocalDay, 'year' | 'month' | 'day'> {\n const moved = new Date(Date.UTC(day.year, day.month - 1, day.day + days));\n return { year: moved.getUTCFullYear(), month: moved.getUTCMonth() + 1, day: moved.getUTCDate() };\n}\n\n// The moment a day starts in the zone: its midnight, or the first moment after it when the clocks\n// skip midnight.\nfunction midnight(day: Pick<LocalDay, 'year' | 'month' | 'day'>, timeZone?: string): Date {\n return hourOn(day, 0, timeZone);\n}\n\n// The moment an hour of a day starts in the zone, or the first moment after it when the clocks skip it.\nfunction hourOn(day: Pick<LocalDay, 'year' | 'month' | 'day'>, hour: number, timeZone?: string): Date {\n const target = Date.UTC(day.year, day.month - 1, day.day, hour);\n let guess = target;\n // The zone's offset at the guess, applied until the guess reads as the target there.\n for (let i = 0; i < 3; i++) {\n const p = zonedParts(new Date(guess), timeZone);\n const shown = Date.UTC(p.year, p.month - 1, p.day, p.hour, p.minute);\n if (shown === target) return new Date(guess);\n guess += target - shown;\n }\n // No such moment that day: the first half hour after it.\n while (Date.UTC(...partsOf(zonedParts(new Date(guess), timeZone))) < target) guess += 30 * 60 * 1000;\n return new Date(guess);\n}\n\n// A zone's reading of a moment, as the arguments Date.UTC takes.\nfunction partsOf(p: ReturnType<typeof zonedParts>): [number, number, number, number, number] {\n return [p.year, p.month - 1, p.day, p.hour, p.minute];\n}\n","import {\n Checkbox,\n Dropdown,\n Field,\n Input,\n makeStyles,\n Option,\n Radio,\n RadioGroup,\n SpinButton,\n Text,\n tokens,\n ToggleButton,\n} from '@fluentui/react-components';\nimport { usePrefixedT } from '@powerportalspro/react';\nimport { SharedTooltip } from '@powerportalspro/react-fluent';\nimport { useEffect, useId, useRef } from 'react';\nimport {\n dayName,\n dayOf,\n describeRecurrence,\n isoDate,\n type LocalDay,\n monthlyOn,\n RecurrenceEnd,\n RecurrenceFrequency,\n type RecurrencePattern,\n startingPattern,\n weekOrder,\n yearlyOn,\n} from './recurrence-pattern.js';\n\nconst MAX_INTERVAL = 99;\nconst MAX_OCCURRENCES = 999;\n// The dropdown's value for an appointment that doesn't repeat.\nconst NO_REPEAT = 'none';\n\nconst FREQUENCY_NAMES: Record<RecurrenceFrequency, string> = {\n [RecurrenceFrequency.Daily]: 'daily',\n [RecurrenceFrequency.Weekly]: 'weekly',\n [RecurrenceFrequency.Monthly]: 'monthly',\n [RecurrenceFrequency.Yearly]: 'yearly',\n};\n\nconst useStyles = makeStyles({\n root: {\n display: 'flex',\n flexDirection: 'column',\n gap: tokens.spacingVerticalM,\n },\n // A radio with a field beside it: apart from the radios above and below, which its field would\n // otherwise touch.\n row: {\n display: 'flex',\n alignItems: 'center',\n flexWrap: 'wrap',\n gap: tokens.spacingHorizontalS,\n marginTop: tokens.spacingVerticalS,\n marginBottom: tokens.spacingVerticalS,\n },\n every: {\n display: 'flex',\n alignItems: 'flex-end',\n flexWrap: 'wrap',\n gap: tokens.spacingHorizontalS,\n },\n number: {\n width: '96px',\n },\n unit: {\n color: tokens.colorNeutralForeground2,\n },\n days: {\n display: 'flex',\n alignItems: 'center',\n flexWrap: 'wrap',\n gap: tokens.spacingHorizontalXS,\n },\n note: {\n color: tokens.colorNeutralForeground3,\n },\n});\n\nexport interface RecurrenceEditProps {\n /** How it repeats, or null when it doesn't. */\n value: RecurrencePattern | null;\n /** Called with the pattern the user picked, or null for none. */\n onChange: (pattern: RecurrencePattern | null) => void;\n /** The day the appointment starts, in the user's time zone. */\n start: LocalDay;\n /** Whether \"doesn't repeat\" is offered: not for a series, which repeats by being one. */\n allowNone?: boolean;\n /** Whether the pattern is only shown. */\n readOnly?: boolean;\n /** The language its words are in; the browser's when omitted. */\n locale?: string;\n}\n\n/**\n * Picks how an appointment repeats, if it does: daily, on days of the week, monthly or yearly, every\n * so many, and until when. What depends on the day it starts — the day of the month, the month —\n * follows `start`. The Blazor Calendar's `RecurrenceEdit` is its twin.\n */\nexport function RecurrenceEdit({ value, onChange, start, allowNone = true, readOnly = false, locale }: RecurrenceEditProps) {\n const styles = useStyles();\n const t = usePrefixedT('app.components.calendar.recurrence');\n const id = useId();\n const language = locale ?? navigator.language;\n // One tooltip for the days' full names, rather than one for each.\n const rootRef = useRef<HTMLDivElement>(null);\n\n // A weekly series on the day it started on follows the start to another day: one left behind would\n // lose the appointment's own occurrence. Days the user chose stay as they are.\n const startDay = useRef(start.weekday);\n useEffect(() => {\n const was = startDay.current;\n startDay.current = start.weekday;\n if (was !== start.weekday && value?.frequency === RecurrenceFrequency.Weekly && value.days === dayOf(was)) {\n onChange({ ...value, days: dayOf(start.weekday) });\n }\n // Only when the start moves to another day.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [start.weekday]);\n\n const frequencies = Object.values(RecurrenceFrequency);\n const chosen = value ? String(value.frequency) : NO_REPEAT;\n const frequencyLabel = (option: string) =>\n option === NO_REPEAT ? t('never') : t(`frequencies.${FREQUENCY_NAMES[Number(option) as RecurrenceFrequency]}`);\n\n // Another frequency starts afresh from the start, keeping how it ends.\n const changeFrequency = (option: string) => {\n if (option === NO_REPEAT) return onChange(null);\n const frequency = Number(option) as RecurrenceFrequency;\n if (value?.frequency === frequency) return;\n const pattern = startingPattern(frequency, start);\n onChange(value ? { ...pattern, end: value.end, occurrences: value.occurrences, endDate: value.endDate } : pattern);\n };\n\n return (\n <div ref={rootRef} className={styles.root}>\n <SharedTooltip containerRef={rootRef} />\n <Field label={t('label')}>\n <Dropdown\n value={frequencyLabel(chosen)}\n selectedOptions={[chosen]}\n disabled={readOnly}\n onOptionSelect={(_, data) => data.optionValue !== undefined && changeFrequency(data.optionValue)}\n >\n {[...(allowNone ? [NO_REPEAT] : []), ...frequencies.map(String)].map((option) => (\n <Option key={option} value={option}>\n {frequencyLabel(option)}\n </Option>\n ))}\n </Dropdown>\n </Field>\n {value && <PatternFields value={value} onChange={onChange} start={start} readOnly={readOnly} locale={language} id={id} />}\n </div>\n );\n}\n\n// The same day a month on, or the month's last when it is shorter, as .NET's AddMonths has it.\nfunction monthOn(day: LocalDay): string {\n const year = day.month === 12 ? day.year + 1 : day.year;\n const month = (day.month % 12) + 1;\n const daysInMonth = new Date(Date.UTC(year, month, 0)).getUTCDate();\n return isoDate({ year, month, day: Math.min(day.day, daysInMonth) });\n}\n\nfunction PatternFields({\n value,\n onChange,\n start,\n readOnly,\n locale,\n id,\n}: {\n value: RecurrencePattern;\n onChange: (pattern: RecurrencePattern) => void;\n start: LocalDay;\n readOnly: boolean;\n locale: string;\n id: string;\n}) {\n const styles = useStyles();\n const t = usePrefixedT('app.components.calendar.recurrence');\n const clamp = (n: number | null | undefined, max: number) => Math.min(max, Math.max(1, Math.round(n ?? 1)));\n const number = (displayValue: string | undefined, picked: number | null | undefined) =>\n picked ?? (displayValue === undefined ? undefined : Number(displayValue));\n\n // Ending on a date starts from the start's day, a month on, so there is a date to change.\n const changeEnd = (end: RecurrenceEnd) =>\n onChange({\n ...value,\n end,\n endDate: end === RecurrenceEnd.OnDate ? (value.endDate ?? monthOn(start)) : value.endDate,\n });\n\n return (\n <>\n <div className={styles.every}>\n <Field label={t('every')}>\n <SpinButton\n className={styles.number}\n value={value.interval}\n min={1}\n max={MAX_INTERVAL}\n // The weekday pattern is every week.\n disabled={readOnly || (value.frequency === RecurrenceFrequency.Daily && value.weekdaysOnly)}\n onChange={(_, data) => onChange({ ...value, interval: clamp(number(data.displayValue, data.value), MAX_INTERVAL) })}\n />\n </Field>\n <Text className={styles.unit}>{t(`units.${FREQUENCY_NAMES[value.frequency]}`)}</Text>\n </div>\n\n {value.frequency === RecurrenceFrequency.Daily && (\n <Checkbox\n label={t('weekdays-only')}\n checked={value.weekdaysOnly}\n disabled={readOnly}\n onChange={(_, data) => onChange({ ...value, weekdaysOnly: data.checked === true })}\n />\n )}\n\n {value.frequency === RecurrenceFrequency.Weekly && (\n <div className={styles.days} role=\"group\" aria-label={t('days')}>\n <Text>{t('days')}</Text>\n {weekOrder(locale).map((weekday) => {\n const flag = dayOf(weekday);\n const pressed = (value.days & flag) !== 0;\n return (\n <ToggleButton\n key={weekday}\n shape=\"circular\"\n size=\"small\"\n checked={pressed}\n disabled={readOnly}\n data-ppp-tooltip={dayName(weekday, locale)}\n aria-label={dayName(weekday, locale)}\n // The last day stays on: a weekly series falls on a day.\n onClick={() => {\n const days = value.days ^ flag;\n if (days !== 0) onChange({ ...value, days });\n }}\n >\n {dayName(weekday, locale, 'narrow')}\n </ToggleButton>\n );\n })}\n </div>\n )}\n\n {(value.frequency === RecurrenceFrequency.Monthly || value.frequency === RecurrenceFrequency.Yearly) && (\n <RadioGroup\n value={value.byWeekday ? 'weekday' : 'date'}\n disabled={readOnly}\n onChange={(_, data) => onChange({ ...value, byWeekday: data.value === 'weekday' })}\n >\n {(['date', 'weekday'] as const).map((by) => {\n const option = { ...value, byWeekday: by === 'weekday' };\n return (\n <Radio\n key={by}\n value={by}\n label={\n value.frequency === RecurrenceFrequency.Monthly\n ? monthlyOn(option, start, locale, t, 'options')\n : yearlyOn(option, start, locale, t, 'options')\n }\n />\n );\n })}\n </RadioGroup>\n )}\n\n <Field label={t('ends')}>\n <RadioGroup value={String(value.end)} disabled={readOnly} onChange={(_, data) => changeEnd(Number(data.value) as RecurrenceEnd)}>\n <Radio value={String(RecurrenceEnd.Never)} label={t('end-never')} />\n <div className={styles.row}>\n <Radio value={String(RecurrenceEnd.AfterOccurrences)} label={t('end-after')} />\n <SpinButton\n className={styles.number}\n aria-label={t('end-after-unit')}\n value={value.occurrences}\n min={1}\n max={MAX_OCCURRENCES}\n disabled={readOnly}\n onChange={(_, data) =>\n onChange({ ...value, end: RecurrenceEnd.AfterOccurrences, occurrences: clamp(number(data.displayValue, data.value), MAX_OCCURRENCES) })\n }\n />\n <Text className={styles.unit}>{t('end-after-unit')}</Text>\n </div>\n <div className={styles.row}>\n <Radio value={String(RecurrenceEnd.OnDate)} label={t('end-on')} />\n <Input\n type=\"date\"\n id={`${id}-end`}\n aria-label={t('end-on')}\n value={value.endDate ?? ''}\n min={isoDate(start)}\n disabled={readOnly}\n onChange={(_, data) => data.value && onChange({ ...value, end: RecurrenceEnd.OnDate, endDate: data.value })}\n />\n </div>\n </RadioGroup>\n </Field>\n\n <Text aria-live=\"polite\">{describeRecurrence(value, start, locale, t)}</Text>\n {value.end === RecurrenceEnd.Never && (\n <Text size={200} className={styles.note}>\n {t('never-ends')}\n </Text>\n )}\n </>\n );\n}\n","import {\n Button,\n Dialog,\n DialogActions,\n DialogBody,\n DialogContent,\n DialogSurface,\n DialogTitle,\n makeStyles,\n Menu,\n MenuItem,\n MenuList,\n MenuPopover,\n MenuTrigger,\n MessageBar,\n MessageBarBody,\n Spinner,\n Text,\n tokens,\n} from '@fluentui/react-components';\nimport { ArrowRepeatAllRegular, ChevronDownRegular } from '@fluentui/react-icons';\nimport {\n findRecordPage,\n getRecordReferenceId,\n recordPageUrl,\n TableSecurityPermission,\n type AddRecurrenceRequest,\n type OrganizationRequest,\n type TableRecord,\n} from '@powerportalspro/core';\nimport {\n QueryStatus,\n RecordContext,\n useDialogService,\n useLocalization,\n useLocalizationLoaded,\n useMainContext,\n usePowerPortalsPro,\n usePrefixedT,\n useRecordContext,\n useRecordPages,\n useRunWithOverlay,\n useT,\n useUserTimeZone,\n} from '@powerportalspro/react';\nimport {\n ColumnEdit,\n DeleteContextButton,\n followRecordLink,\n RecordDialogFrame,\n RecordDialogShell,\n SaveContextButton,\n StatusReasonEdit,\n type RecordDialogLocation,\n} from '@powerportalspro/react-fluent';\nimport { useEffect, useRef, useState, type MouseEvent, type ReactNode } from 'react';\nimport type { OpenAppointment } from './appointment-click.js';\nimport { RecurrenceEdit } from './recurrence-edit.js';\nimport {\n allDayTimes,\n boolColumn,\n fromSeries,\n localDay,\n type RecurrencePattern,\n SERIES_TABLE,\n seriesColumns,\n toSeries,\n} from './recurrence-pattern.js';\n\n// The appointment table's strings: its columns' labels and its choices; and the series table's.\nconst APPOINTMENT_STRINGS = ['tables.appointment'] as const;\nconst SERIES_STRINGS = [`tables.${SERIES_TABLE}`] as const;\n\n// A value a form's column takes.\ntype ColumnValue = Parameters<ReturnType<typeof useRecordContext>['setColumnValue']>[1];\n\n// An appointment that is open (0) or scheduled (3) can still change; completed or canceled can't.\nconst OPEN_STATES = new Set([0, 3]);\n\nconst useStyles = makeStyles({\n fields: {\n display: 'flex',\n flexDirection: 'column',\n gap: tokens.spacingVerticalM,\n },\n // The form stays out until the appointment is read, rather than showing empty fields.\n loading: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n minHeight: '160px',\n },\n recurring: {\n display: 'flex',\n alignItems: 'center',\n gap: tokens.spacingHorizontalXS,\n color: tokens.colorNeutralForeground2,\n },\n});\n\n// How a details form's Regarding links to its record's page.\ninterface RegardingLinks {\n readonly showRecordLinks: boolean;\n readonly onNavigate?: (url: string) => void;\n}\n\nexport interface AppointmentDetailsDialogProps {\n /** The appointment to show, or null while the dialog is closed or a new one is open. */\n appointment: OpenAppointment | null;\n /** A new appointment to create, as the selected range starts it, or null. */\n newAppointment?: TableRecord | null;\n /** Whether the appointment can be edited and saved, as far as the user may change it. */\n editable?: boolean;\n /** The tables its Regarding offers records of; every one Regarding can point to when omitted. */\n regardingTables?: readonly string[] | undefined;\n onClose: () => void;\n /** An appointment was saved or deleted: the calendar reads its range again. */\n onSaved?: () => void;\n /** The fields to show in place of the calendar's own, bound to the appointment's record. */\n children?: ReactNode;\n /** Where it opens: centered (the default), or a side panel on the right (`panel`) or the left (`panel-left`). */\n location?: RecordDialogLocation;\n /**\n * Whether the details link to the appointment's page, and its Regarding to the record's page,\n * registered with `AddRecordPage`. Default `true`; a table with no page shows no link.\n */\n showRecordLinks?: boolean;\n /**\n * Follows those links in the app — `(url) => navigate(url)` for react-router — on a plain click.\n * Without it, and for a click that opens a new tab, the browser follows them.\n */\n onNavigate?: ((url: string) => void) | undefined;\n}\n\n/**\n * An appointment's details, read from Dataverse as a record page reads a record — so the same table\n * access and column security apply: read-only, or, in a calendar that is `editable`, a form to change\n * and save it, make it a series, or delete it. A range selected in such a calendar opens it on a new\n * appointment to create; a series opens as one, with how it repeats. The record's context is\n * isolated: a field the page puts in the dialog doesn't join a form around the calendar. The Blazor\n * Calendar's details dialog is its twin.\n */\nexport function AppointmentDetailsDialog({\n appointment,\n newAppointment = null,\n editable = false,\n regardingTables,\n onClose,\n onSaved,\n children,\n location = 'center',\n showRecordLinks = true,\n onNavigate,\n}: AppointmentDetailsDialogProps) {\n const t = usePrefixedT('app.components.calendar');\n const tAll = useT();\n const open = appointment !== null || newAppointment !== null;\n const isSeries = appointment?.isSeries === true;\n // The appointment's own page, registered with AddRecordPage: a saved one's, not a series'.\n const recordPages = useRecordPages({ enabled: showRecordLinks });\n const appointmentPage = showRecordLinks && appointment && !isSeries ? findRecordPage(recordPages, 'appointment') : undefined;\n const pageUrl = appointmentPage && appointment ? recordPageUrl(appointmentPage, appointment.id) : undefined;\n const openPage = pageUrl !== undefined && (\n <Button\n as=\"a\"\n href={pageUrl}\n className=\"ppp-calendar-open-record\"\n onClick={(event) => followRecordLink(event as MouseEvent<HTMLAnchorElement>, pageUrl, onNavigate)}\n >\n {tAll('app.buttons.open.label')}\n </Button>\n );\n // The Regarding's link to its record's page, as the calendar says.\n const regardingLinks = { showRecordLinks, ...(onNavigate && { onNavigate }) };\n const mayCreateSeries = useMayCreateSeries(open && editable && !isSeries && appointment?.recurring !== true);\n const saved = () => {\n onClose();\n onSaved?.();\n };\n\n return (\n <RecordDialogShell\n open={open}\n onOpenChange={(next) => !next && onClose()}\n location={location}\n tableName={isSeries ? SERIES_TABLE : 'appointment'}\n enablePanelResizing\n >\n {open && (\n <RecordContext\n table={isSeries ? SERIES_TABLE : 'appointment'}\n {...(appointment ? { id: appointment.id } : { initialRecord: newAppointment! })}\n isolated\n >\n <RecordDialogFrame\n location={location}\n title={appointment ? appointment.subject : t('new-appointment')}\n actions={\n editable ? (\n <>\n <DeleteAction seriesId={appointment?.seriesId ?? null} onDeleted={saved} />\n {openPage}\n <SaveContextButton appearance=\"primary\" onSaved={saved} />\n <Button onClick={onClose}>{tAll('app.buttons.cancel.label')}</Button>\n </>\n ) : (\n <>\n {openPage}\n <Button appearance=\"primary\" onClick={onClose}>\n {t('close')}\n </Button>\n </>\n )\n }\n >\n {isSeries ? (\n <SeriesRecord editable={editable} regardingTables={regardingTables} regardingLinks={regardingLinks} />\n ) : (\n <AppointmentRecord\n recurring={appointment?.recurring ?? false}\n editable={editable}\n creating={!appointment}\n regardingTables={regardingTables}\n regardingLinks={regardingLinks}\n mayCreateSeries={mayCreateSeries}\n >\n {children}\n </AppointmentRecord>\n )}\n </RecordDialogFrame>\n </RecordContext>\n )}\n </RecordDialogShell>\n );\n}\n\nexport interface RecurringChoiceDialogProps {\n /** The recurring appointment clicked, or null while the dialog is closed. */\n appointment: OpenAppointment | null;\n /** The user said which they meant: the appointment, or its series. */\n onChoose: (series: boolean) => void;\n onClose: () => void;\n}\n\n/**\n * One of a series was clicked: the user says whether they mean it or the whole series, as Outlook\n * asks. The Blazor Calendar asks the same.\n */\nexport function RecurringChoiceDialog({ appointment, onChoose, onClose }: RecurringChoiceDialogProps) {\n const t = usePrefixedT('app.components.calendar.open-recurring');\n const tAll = useT();\n return (\n <Dialog open={appointment !== null} onOpenChange={(_, data) => !data.open && onClose()} modalType=\"modal\">\n <DialogSurface>\n <DialogBody>\n <DialogTitle>{t('title')}</DialogTitle>\n <DialogContent>{t('message')}</DialogContent>\n {/* Fluid, so the actions span the dialog: by default they get its right half only, where\n three buttons wrap their labels. */}\n <DialogActions fluid>\n <Button appearance=\"primary\" onClick={() => onChoose(false)}>\n {t('occurrence')}\n </Button>\n <Button onClick={() => onChoose(true)}>{t('series')}</Button>\n <Button appearance=\"subtle\" onClick={onClose}>\n {tAll('app.buttons.cancel.label')}\n </Button>\n </DialogActions>\n </DialogBody>\n </DialogSurface>\n </Dialog>\n );\n}\n\n/**\n * Whether the user may create series, once asked: asked when `asked` first holds, and again only for\n * another user, rather than on every appointment opened.\n */\nfunction useMayCreateSeries(asked: boolean): boolean {\n const { ppp, authState } = usePowerPortalsPro();\n const user = authState.status === 'authenticated' ? authState.user?.userId : null;\n const [answer, setAnswer] = useState<{ user: string | null | undefined; mayCreate: boolean } | null>(null);\n const asking = useRef<string | null | undefined>(undefined);\n const known = answer?.user === user;\n useEffect(() => {\n if (!asked || known || asking.current === user) return;\n asking.current = user;\n ppp\n .retrieveTablePermissionsAsync(SERIES_TABLE)\n .then((permissions) => setAnswer({ user, mayCreate: (Number(permissions) & TableSecurityPermission.Create) !== 0 }))\n // Asked again on the next appointment opened.\n .catch(() => (asking.current = undefined));\n }, [asked, known, user, ppp]);\n return answer !== null && known && answer.mayCreate;\n}\n\n/** Whether the form's record grants every permission in `permissions`. */\nfunction grants(record: TableRecord | undefined, permissions: number): boolean {\n return record?.permissions !== undefined && (Number(record.permissions) & permissions) === permissions;\n}\n\n// Whether the user may delete the series `seriesId`, as its own access says: false until read.\nfunction useMayDeleteSeries(seriesId: string | null): boolean {\n const { ppp } = usePowerPortalsPro();\n const [mayDelete, setMayDelete] = useState(false);\n useEffect(() => {\n setMayDelete(false);\n if (!seriesId) return;\n let current = true;\n ppp\n .retrieveRecordAsync(SERIES_TABLE, seriesId, ['activityid'])\n .then((series) => current && setMayDelete(grants(series, TableSecurityPermission.Delete)))\n .catch(() => current && setMayDelete(false));\n return () => {\n current = false;\n };\n }, [ppp, seriesId]);\n return mayDelete;\n}\n\n// Delete, where the user may delete what the dialog shows: an occurrence offers it or, where its own\n// access allows, its series.\nfunction DeleteAction({ seriesId, onDeleted }: { seriesId: string | null; onDeleted: () => void }) {\n const { record } = useRecordContext();\n const t = usePrefixedT('app.components.calendar');\n const tAll = useT();\n const { ppp } = usePowerPortalsPro();\n const dialog = useDialogService();\n const runWithOverlay = useRunWithOverlay();\n const mayDeleteSeries = useMayDeleteSeries(seriesId);\n const mayDelete = !!record?.id && grants(record, TableSecurityPermission.Delete);\n if (!seriesId) return mayDelete ? <DeleteContextButton appearance=\"secondary\" onDeleted={onDeleted} /> : null;\n if (!record?.id || (!mayDelete && !mayDeleteSeries)) return null;\n\n const remove = async (table: string, id: string, message: string) => {\n const confirmation = await dialog.showConfirmationAsync(message, {\n title: tAll('app.messages.delete-title'),\n primaryText: tAll('app.buttons.delete.label'),\n secondaryText: tAll('app.buttons.cancel.label'),\n });\n if (confirmation.canceled) return;\n try {\n await runWithOverlay({ description: tAll('app.messages.deleting-record') }, () => ppp.deleteRecordAsync(table, id));\n onDeleted();\n } catch (error) {\n await dialog.showErrorAsync(error instanceof Error ? error.message : String(error), { title: tAll('app.errors.record-delete') });\n }\n };\n\n return (\n <Menu>\n <MenuTrigger disableButtonEnhancement>\n <Button icon={<ChevronDownRegular />} iconPosition=\"after\">\n {tAll('app.buttons.delete.label')}\n </Button>\n </MenuTrigger>\n <MenuPopover>\n <MenuList>\n {mayDelete && (\n <MenuItem onClick={() => void remove('appointment', record.id!, tAll('app.messages.delete-record-confirmation'))}>\n {t('delete-occurrence')}\n </MenuItem>\n )}\n {mayDeleteSeries && (\n <MenuItem onClick={() => void remove(SERIES_TABLE, seriesId, t('delete-series-confirmation'))}>{t('delete-series')}</MenuItem>\n )}\n </MenuList>\n </MenuPopover>\n </Menu>\n );\n}\n\nfunction AppointmentRecord({\n recurring,\n editable,\n creating,\n regardingTables,\n regardingLinks,\n mayCreateSeries,\n children,\n}: {\n recurring: boolean;\n editable: boolean;\n creating: boolean;\n regardingTables: readonly string[] | undefined;\n regardingLinks: RegardingLinks;\n mayCreateSeries: boolean;\n children?: ReactNode;\n}) {\n const styles = useStyles();\n const t = usePrefixedT('app.components.calendar');\n const { status } = useRecordContext();\n useAllDayTimes('scheduledstart', 'scheduledend');\n // The fields wait for their labels too, rather than show their keys.\n useLocalization(APPOINTMENT_STRINGS);\n const labeled = useLocalizationLoaded(APPOINTMENT_STRINGS);\n\n if (status !== QueryStatus.Success || !labeled) return <Loading status={status} />;\n if (children) return <>{children}</>;\n // Read-only unless the calendar is editable; then the record's own access decides each field.\n const readOnly = !editable;\n return (\n <div className={styles.fields}>\n {recurring && (\n <Text className={styles.recurring}>\n <ArrowRepeatAllRegular />\n {t('recurring')}\n </Text>\n )}\n {editable && <ColumnEdit columnName=\"subject\" />}\n <ColumnEdit columnName=\"scheduledstart\" readOnly={readOnly} />\n <ColumnEdit columnName=\"scheduledend\" readOnly={readOnly} />\n <ColumnEdit columnName=\"isalldayevent\" readOnly={readOnly} />\n {editable && !recurring && mayCreateSeries && <AppointmentRepeat creating={creating} />}\n <ColumnEdit columnName=\"location\" readOnly={readOnly} />\n {!creating && <ColumnEdit columnName=\"organizer\" readOnly />}\n <ColumnEdit columnName=\"requiredattendees\" readOnly={readOnly} />\n <ColumnEdit columnName=\"optionalattendees\" readOnly={readOnly} />\n <ColumnEdit columnName=\"regardingobjectid\" readOnly={readOnly} {...(regardingTables && { targetTables: regardingTables })} {...regardingLinks} />\n {/* Every reason, each moving the appointment to its state: Free or Tentative to Open, Busy or\n Out of Office to Scheduled, Completed or Canceled to close it. */}\n {!creating && <StatusReasonEdit columnName=\"statuscode\" allowStateChange readOnly={readOnly} />}\n <ColumnEdit columnName=\"description\" readOnly={readOnly} />\n </div>\n );\n}\n\n// The appointment or series being read, or why it couldn't be.\nfunction Loading({ status }: { status: QueryStatus }) {\n const styles = useStyles();\n const t = usePrefixedT('app.components.calendar');\n if (status === QueryStatus.Error) {\n return (\n <MessageBar intent=\"error\">\n <MessageBarBody>{t('details-error')}</MessageBarBody>\n </MessageBar>\n );\n }\n return (\n <div className={styles.loading} role=\"status\" aria-live=\"polite\">\n <Spinner label={t('details-loading')} />\n </div>\n );\n}\n\n/**\n * Switching All day moves the record's times to fit, as Outlook does: on, to the whole days they fall\n * on; off, to nine o'clock on the first of them, for half an hour (see allDayTimes). Every switch the\n * user makes, back to the value as read too; the value as read, or as a new appointment starts, leaves\n * the times alone.\n */\nexport function useAllDayTimes(startColumn: string, endColumn: string) {\n const ctx = useRecordContext();\n const timeZone = useUserTimeZone() ?? undefined;\n // Undefined until the record holds it, so a record arriving isn't taken for a switch.\n const read = valueOf(ctx.record, 'isalldayevent');\n const allDay = typeof read === 'boolean' ? read : undefined;\n const previous = useRef<boolean | undefined>(undefined);\n useEffect(() => {\n const was = previous.current;\n previous.current = allDay;\n if (was === undefined || allDay === undefined || was === allDay) return;\n const start = valueOf(ctx.record, startColumn);\n const end = valueOf(ctx.record, endColumn);\n if (typeof start !== 'string') return;\n const times = allDayTimes(new Date(start), new Date(typeof end === 'string' ? end : start), allDay, timeZone);\n ctx.setColumnValue(startColumn, { $type: 2, value: times.start.toISOString() } as ColumnValue);\n ctx.setColumnValue(endColumn, { $type: 2, value: times.end.toISOString() } as ColumnValue);\n // Only the switch: the times it sets are read from the record as it is then.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [allDay]);\n}\n\n/** A record value's raw value, by column. */\nfunction valueOf(record: TableRecord | undefined, column: string): unknown {\n return (record?.properties as Record<string, { value?: unknown } | null | undefined> | undefined)?.[column]?.value;\n}\n\n/**\n * Makes the appointment in the form a series, in the save that saves it, when the user picks how it\n * repeats: shown to a user who may create series, and offered for one that exists where they may\n * change and delete it, as it becomes the series, while it is still open.\n */\nfunction AppointmentRepeat({ creating }: { creating: boolean }) {\n const ctx = useRecordContext();\n const main = useMainContext();\n const timeZone = useUserTimeZone() ?? undefined;\n const [pattern, setPattern] = useState<RecurrencePattern | null>(null);\n\n // Read through refs by the registration, which stays put while the user picks.\n const patternRef = useRef(pattern);\n patternRef.current = pattern;\n const recordRef = useRef(ctx.record);\n recordRef.current = ctx.record;\n const timeZoneRef = useRef(timeZone);\n timeZoneRef.current = timeZone;\n\n // The series joins the form's save, after the appointment's own create or update.\n const register = main?.registerDescendant;\n useEffect(() => {\n if (!register) return;\n return register({\n getRequests: () => seriesRequests(patternRef.current, recordRef.current, timeZoneRef.current),\n validate: () => true,\n refresh: async () => {},\n resetState: () => setPattern(null),\n isDirty: () => patternRef.current !== null,\n });\n }, [register]);\n const notify = main?.notifyDescendantDirtyChanged;\n useEffect(() => notify?.(), [notify, pattern]);\n\n const record = ctx.record;\n const state = valueOf(record, 'statecode');\n const offered =\n creating ||\n (grants(record, TableSecurityPermission.Write | TableSecurityPermission.Delete) &&\n (state === undefined || state === null || OPEN_STATES.has(Number(state))));\n if (!offered) return null;\n\n const start = valueOf(record, 'scheduledstart');\n return (\n <RecurrenceEdit\n value={pattern}\n onChange={setPattern}\n start={localDay(typeof start === 'string' ? new Date(start) : new Date(), timeZone)}\n />\n );\n}\n\n/** The request that makes the appointment a series as it is saved: laid out from its times, all day when it is. */\nexport function seriesRequests(\n pattern: RecurrencePattern | null,\n appointment: TableRecord | undefined,\n timeZone: string | undefined,\n): OrganizationRequest[] {\n const start = valueOf(appointment, 'scheduledstart');\n const end = valueOf(appointment, 'scheduledend');\n const id = getRecordReferenceId(appointment);\n if (!pattern || !appointment || typeof start !== 'string' || typeof end !== 'string' || !id) return [];\n\n const series = toSeries(pattern, new Date(start), new Date(end), timeZone);\n if (valueOf(appointment, 'isalldayevent') === true) {\n (series.properties as Record<string, unknown>)['isalldayevent'] = boolColumn(true);\n }\n const request: AddRecurrenceRequest = {\n $type: 'AddRecurrenceRequest',\n appointment: { tableName: 'appointment', id },\n series,\n } as AddRecurrenceRequest;\n return [request as OrganizationRequest];\n}\n\n// A series' form: what its occurrences share, and how it repeats.\nfunction SeriesRecord({\n editable,\n regardingTables,\n regardingLinks,\n}: {\n editable: boolean;\n regardingTables: readonly string[] | undefined;\n regardingLinks: RegardingLinks;\n}) {\n const styles = useStyles();\n const t = usePrefixedT('app.components.calendar');\n const ctx = useRecordContext();\n const timeZone = useUserTimeZone() ?? undefined;\n useLocalization(SERIES_STRINGS);\n const labeled = useLocalizationLoaded(SERIES_STRINGS);\n const [pattern, setPattern] = useState<RecurrencePattern | null>(null);\n const [edited, setEdited] = useState(false);\n useAllDayTimes('starttime', 'endtime');\n\n // How the series repeats, once it is read — read again when the user's zone arrives, which its end\n // date is a day in, until the user changes it.\n const loaded = ctx.status === QueryStatus.Success ? ctx.record : undefined;\n const loadedId = loaded?.id;\n useEffect(() => {\n if (loaded && !edited) setPattern(fromSeries(loaded, timeZone));\n // The series as read, not each change the form makes to it.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [loadedId, timeZone, edited]);\n\n // The pattern written into the series, laid out from its times, for the form to save.\n const start = valueOf(ctx.record, 'starttime');\n const end = valueOf(ctx.record, 'endtime');\n const write = (next: RecurrencePattern) => {\n if (typeof start !== 'string' || typeof end !== 'string') return;\n for (const [column, value] of Object.entries(seriesColumns(next, new Date(start), new Date(end), timeZone, ctx.record))) {\n ctx.setColumnValue(column, value as ColumnValue);\n }\n };\n // New times lay the pattern out from them again, so the day it starts on follows its first\n // occurrence.\n const timesChanged = ctx.dirtyColumns.has('starttime') || ctx.dirtyColumns.has('endtime');\n useEffect(() => {\n if (timesChanged && pattern) write(pattern);\n // Only when the times change: writing the pattern changes neither.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [timesChanged, start, end]);\n\n if (ctx.status !== QueryStatus.Success || !labeled) return <Loading status={ctx.status} />;\n\n const change = (next: RecurrencePattern | null) => {\n if (!next) return;\n setEdited(true);\n setPattern(next);\n write(next);\n };\n const readOnly = !editable;\n return (\n <div className={styles.fields}>\n <Text className={styles.recurring}>\n <ArrowRepeatAllRegular />\n {t('open-recurring.series')}\n </Text>\n {editable && <ColumnEdit columnName=\"subject\" />}\n <ColumnEdit columnName=\"starttime\" readOnly={readOnly} />\n <ColumnEdit columnName=\"endtime\" readOnly={readOnly} />\n <ColumnEdit columnName=\"isalldayevent\" readOnly={readOnly} />\n {pattern && (\n <RecurrenceEdit\n value={pattern}\n onChange={change}\n start={localDay(typeof start === 'string' ? new Date(start) : new Date(), timeZone)}\n allowNone={false}\n readOnly={readOnly}\n />\n )}\n <ColumnEdit columnName=\"location\" readOnly={readOnly} />\n <ColumnEdit columnName=\"organizer\" readOnly />\n <ColumnEdit columnName=\"requiredattendees\" readOnly={readOnly} />\n <ColumnEdit columnName=\"optionalattendees\" readOnly={readOnly} />\n <ColumnEdit columnName=\"regardingobjectid\" readOnly={readOnly} {...(regardingTables && { targetTables: regardingTables })} {...regardingLinks} />\n <ColumnEdit columnName=\"description\" readOnly={readOnly} />\n </div>\n );\n}\n","// The calendar's Fluent look. FullCalendar's Forma theme is drawn from Fluent's own palette, so\n// pointing its palette variables at Fluent's tokens is most of the theme: the tokens switch with\n// light and dark and follow a site's accent color, and nothing here names a color of its own.\n// Forma's palette stylesheets aren't loaded; the variables are set on the calendar instead, and on\n// the \"+ more\" popover, which FullCalendar draws at the end of the page rather than inside it.\n//\n// Framework-free: the React Calendar and the Blazor Calendar's script both inject it.\n\nconst STYLE_ID = 'ppp-calendar-styles';\n\nexport const calendarStyles = `\n.ppp-calendar,\n.ppp-calendar-popover {\n --fc-forma-primary: var(--colorBrandBackground);\n --fc-forma-primary-over: var(--colorBrandBackgroundHover);\n --fc-forma-primary-down: var(--colorBrandBackgroundPressed);\n --fc-forma-primary-foreground: var(--colorNeutralForegroundOnBrand);\n\n --fc-forma-event: var(--colorBrandBackground);\n --fc-forma-event-contrast: var(--colorNeutralForegroundOnBrand);\n --fc-forma-background-event: var(--colorBrandBackground2);\n --fc-forma-highlight: color-mix(in srgb, var(--colorBrandBackground) 25%, transparent);\n\n --fc-forma-background: var(--colorNeutralBackground1);\n --fc-forma-faint: var(--colorNeutralBackground2);\n --fc-forma-muted: var(--colorNeutralBackground1Hover);\n --fc-forma-strong: var(--colorNeutralBackground1Selected);\n --fc-forma-stronger: var(--colorNeutralBackground1Pressed);\n --fc-forma-strongest: var(--colorNeutralBackground1Pressed);\n\n --fc-forma-foreground: var(--colorNeutralForeground1);\n --fc-forma-muted-foreground: var(--colorNeutralForeground3);\n --fc-forma-faint-foreground: var(--colorNeutralForeground4);\n\n --fc-forma-border: var(--colorNeutralStroke2);\n --fc-forma-muted-border: var(--colorNeutralStroke3);\n --fc-forma-strong-border: var(--colorNeutralStroke1);\n --fc-forma-ring-color: var(--colorStrokeFocus2);\n\n color: var(--colorNeutralForeground1);\n background-color: var(--colorNeutralBackground1);\n}\n\n/* Forma sets 16px type on its root; Fluent's body text is 14px in its own family. Doubling the\n class outranks Forma's (hashed, single-class) rule without naming it. */\n.ppp-calendar.ppp-calendar,\n.ppp-calendar-popover.ppp-calendar-popover {\n font-family: var(--fontFamilyBase);\n font-size: var(--fontSizeBase300);\n line-height: var(--lineHeightBase300);\n}\n\n/* No taller than the appointment's box, which FullCalendar doesn't clip: a short appointment shows\n what fits of its subject and place, as Outlook's do. */\n.ppp-calendar-event {\n display: flex;\n flex-direction: column;\n min-width: 0;\n min-height: 0;\n max-height: 100%;\n overflow: hidden;\n padding-inline: var(--spacingHorizontalXS);\n}\n\n.ppp-calendar-event-title {\n display: flex;\n align-items: center;\n gap: var(--spacingHorizontalXXS);\n font-weight: var(--fontWeightSemibold);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.ppp-calendar-event-detail {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n font-size: var(--fontSizeBase200);\n}\n\n.ppp-calendar-event-compact {\n flex-direction: row;\n align-items: center;\n gap: var(--spacingHorizontalXS);\n}\n\n.ppp-calendar-event-compact .ppp-calendar-event-title {\n font-weight: var(--fontWeightRegular);\n}\n\n.ppp-calendar-event-compact .ppp-calendar-event-detail {\n flex: none;\n}\n\n.ppp-calendar-event-icon,\n.ppp-calendar-event-icon > svg {\n flex: none;\n width: 12px;\n height: 12px;\n}\n\n/* How an appointment shows its time, as Outlook draws it. Busy is FullCalendar's own drawing: a tint\n of the appointment's color with a bar in it. Out of office is that in purple; free is the bar\n outlined on no tint, staying free under the pointer, and tentative the tint striped. Only a block\n has a fill to draw free and tentative in: a month's dots and the agenda's rows show the color. */\n.ppp-calendar .ppp-calendar-appointment-out-of-office,\n.ppp-calendar-popover .ppp-calendar-appointment-out-of-office {\n /* Over the color FullCalendar sets on the appointment itself. */\n --fc-event-color: var(--colorPalettePurpleBorderActive, #8764b8) !important;\n}\n\n.ppp-calendar .ppp-calendar-appointment-free.ppp-calendar-appointment-block,\n.ppp-calendar-popover .ppp-calendar-appointment-free.ppp-calendar-appointment-block {\n background-color: var(--fc-forma-background);\n}\n\n.ppp-calendar .ppp-calendar-appointment-free.ppp-calendar-appointment-block:hover,\n.ppp-calendar-popover .ppp-calendar-appointment-free.ppp-calendar-appointment-block:hover {\n background-color: color-mix(in srgb, var(--fc-event-color) 8%, var(--fc-forma-background));\n}\n\n/* A focused one keeps FullCalendar's focus outline. */\n.ppp-calendar .ppp-calendar-appointment-free.ppp-calendar-appointment-block:not(:focus-visible),\n.ppp-calendar-popover .ppp-calendar-appointment-free.ppp-calendar-appointment-block:not(:focus-visible) {\n outline: var(--strokeWidthThin) solid color-mix(in srgb, var(--fc-event-color) 50%, transparent);\n outline-offset: calc(var(--strokeWidthThin) * -1);\n}\n\n.ppp-calendar .ppp-calendar-appointment-tentative.ppp-calendar-appointment-block,\n.ppp-calendar-popover .ppp-calendar-appointment-tentative.ppp-calendar-appointment-block {\n background-image: repeating-linear-gradient(\n -45deg,\n transparent 0 4px,\n color-mix(in srgb, var(--fc-event-color) 30%, transparent) 4px 6px\n );\n}\n\n.ppp-calendar-appointment-canceled .ppp-calendar-event-title {\n text-decoration: line-through;\n}\n\n/* An appointment's tooltip: its subject, then when, where and whether it repeats. */\n.ppp-calendar-tooltip {\n display: flex;\n flex-direction: column;\n gap: var(--spacingVerticalXXS);\n}\n\n.ppp-calendar-tooltip-subject {\n font-weight: var(--fontWeightSemibold);\n}\n`;\n\n/** Adds the calendar's stylesheet to the document once. */\nexport function ensureCalendarStyles(document: Document): void {\n ensureStyleSheet(document, STYLE_ID, calendarStyles);\n}\n\n/** Adds a stylesheet to the document once, by its id. */\nexport function ensureStyleSheet(document: Document, id: string, css: string): void {\n if (document.getElementById(id)) return;\n const style = document.createElement('style');\n style.id = id;\n style.textContent = css;\n document.head.appendChild(style);\n}\n","// An appointment as the calendar draws it, and the change the user asks for when they drag or\n// resize one. Framework-free.\n\n/**\n * How an appointment shows the time it takes, as Outlook's \"Show as\" does: busy as appointments are\n * drawn, free hollow, tentative striped, out of office in purple. The values are those of\n * `AppointmentShowAs` in C#, which the Blazor Calendar sends, and of the one `@powerportalspro/core`\n * exports, which React code passes: this folder can't import that package.\n */\nexport const AppointmentShowAs = {\n Busy: 0,\n Free: 1,\n Tentative: 2,\n OutOfOffice: 3,\n} as const;\nexport type AppointmentShowAs = (typeof AppointmentShowAs)[keyof typeof AppointmentShowAs];\n\n// The class an appointment is drawn with for each, which the calendar's stylesheet styles.\nconst SHOW_AS_CLASS: Record<AppointmentShowAs, string> = {\n [AppointmentShowAs.Busy]: 'ppp-calendar-appointment-busy',\n [AppointmentShowAs.Free]: 'ppp-calendar-appointment-free',\n [AppointmentShowAs.Tentative]: 'ppp-calendar-appointment-tentative',\n [AppointmentShowAs.OutOfOffice]: 'ppp-calendar-appointment-out-of-office',\n};\n\nexport interface CalendarAppointment {\n id: string;\n subject: string;\n start: Date | string;\n end: Date | string;\n allDay?: boolean;\n location?: string | null;\n /** An occurrence of a recurring series. */\n recurring?: boolean;\n /** False when the user may not move or resize this appointment; null or absent follows the calendar. */\n editable?: boolean | null;\n /** False when it can be moved but not resized: its table keeps no end it may change. */\n durationEditable?: boolean | null;\n /** The table of the row behind it, for a calendar that shows several. Absent for an appointment of the host's. */\n table?: string | null;\n /** The CSS color it is drawn in, its table's. Absent for the calendar's own. */\n color?: string | null;\n /** How it shows the time it takes. Busy when absent. */\n showAs?: AppointmentShowAs | null;\n /** Whether it was canceled: its subject is struck through. */\n canceled?: boolean | null;\n /**\n * The record behind it — for one the calendar loaded, every column of the view or query — for a\n * tooltip that shows more. A `TableRecord` in React; this folder can't import its type.\n */\n record?: unknown;\n}\n\n/** A move or resize the user made, which the host saves or refuses. */\nexport interface CalendarAppointmentChange {\n id: string;\n start: Date;\n end: Date | null;\n allDay: boolean;\n /** The table of the row moved, when the calendar loaded it. */\n table?: string | null;\n}\n\n/** FullCalendar's input for an appointment. */\nexport function toEventInput(appointment: CalendarAppointment) {\n return {\n id: appointment.id,\n title: appointment.subject,\n start: appointment.start,\n end: appointment.end,\n allDay: appointment.allDay ?? false,\n ...(appointment.editable == null ? {} : { editable: appointment.editable }),\n ...(appointment.durationEditable == null ? {} : { durationEditable: appointment.durationEditable }),\n ...(appointment.color ? { backgroundColor: appointment.color, borderColor: appointment.color } : {}),\n extendedProps: {\n table: appointment.table ?? null,\n location: appointment.location ?? null,\n recurring: appointment.recurring ?? false,\n // Read by the calendar's eventClass, which draws it: busy when it says nothing.\n showAs: appointment.showAs ?? null,\n canceled: appointment.canceled ?? false,\n record: appointment.record ?? null,\n },\n };\n}\n\n/** What FullCalendar keeps of an appointment, as its event. */\ninterface DrawnEvent {\n id: string;\n title: string;\n start: Date | null;\n end: Date | null;\n allDay: boolean;\n extendedProps: Record<string, unknown>;\n}\n\n/** An appointment as the calendar drew it, from its FullCalendar event: what a tooltip of the host's is given. */\nexport function appointmentFromEvent(event: DrawnEvent): CalendarAppointment {\n return {\n id: event.id,\n subject: event.title,\n start: event.start ?? new Date(Number.NaN),\n end: event.end ?? event.start ?? new Date(Number.NaN),\n allDay: event.allDay,\n location: (event.extendedProps['location'] as string | null | undefined) ?? null,\n recurring: event.extendedProps['recurring'] === true,\n showAs: (event.extendedProps['showAs'] as AppointmentShowAs | null | undefined) ?? null,\n canceled: event.extendedProps['canceled'] === true,\n record: event.extendedProps['record'] ?? null,\n table: (event.extendedProps['table'] as string | null | undefined) ?? null,\n };\n}\n\n/**\n * The classes an appointment is drawn with — how it shows its time, and whether it was canceled —\n * from what it says of both (an appointment's own fields, or the extended props they are drawn from).\n */\nexport function appointmentClassName(appointment: { showAs?: unknown; canceled?: unknown }): string {\n const showAs = SHOW_AS_CLASS[(appointment.showAs ?? AppointmentShowAs.Busy) as AppointmentShowAs] ?? SHOW_AS_CLASS[AppointmentShowAs.Busy];\n return appointment.canceled === true ? `${showAs} ppp-calendar-appointment-canceled` : showAs;\n}\n\ninterface ChangedEvent {\n id: string;\n start: Date | null;\n end: Date | null;\n allDay: boolean;\n extendedProps?: Record<string, unknown>;\n}\n\n/** The change FullCalendar reports after a drop or resize. */\nexport function toAppointmentChange(event: ChangedEvent): CalendarAppointmentChange {\n return {\n id: event.id,\n start: event.start ?? new Date(Number.NaN),\n end: event.end,\n allDay: event.allDay,\n table: (event.extendedProps?.['table'] as string | null | undefined) ?? null,\n };\n}\n","// What both stacks hand FullCalendar, apart from its plugins: each stack imports those from its\n// own FullCalendar package (React's or the vanilla one), which are separate builds of the same\n// views. Framework-free.\n\nimport { appointmentClassName } from './events.js';\n\n/**\n * How the calendar lays out its appointments — by the hour over a day or a week, a month of days, or\n * a list — named as the calendar's API names them on both stacks. A layout, not a view: a view is\n * the saved query that decides which appointments are shown. FullCalendar calls these views.\n */\nexport type CalendarLayout = 'day' | 'workWeek' | 'week' | 'month' | 'agenda';\n\nexport const calendarLayouts: readonly CalendarLayout[] = ['day', 'workWeek', 'week', 'month', 'agenda'];\n\n/** The layouts a calendar offers: those named, once each and in their order, or every one when none are. */\nexport function offeredLayouts(layouts?: readonly CalendarLayout[] | null): readonly CalendarLayout[] {\n const named = [...new Set((layouts ?? []).filter((layout) => calendarLayouts.includes(layout)))];\n return named.length > 0 ? named : calendarLayouts;\n}\n\n/** The layout a calendar opens in: the first of `preferred` it offers, else the first it offers. */\nexport function openingLayout(\n offered: readonly CalendarLayout[],\n ...preferred: (CalendarLayout | undefined)[]\n): CalendarLayout {\n return preferred.find((layout) => layout !== undefined && offered.includes(layout)) ?? offered[0]!;\n}\n\nconst fullCalendarViewNames: Record<CalendarLayout, string> = {\n day: 'timeGridDay',\n workWeek: 'pppWorkWeek',\n week: 'timeGridWeek',\n month: 'dayGridMonth',\n agenda: 'listWeek',\n};\n\n/** FullCalendar's name for the view that draws one of the calendar's layouts. */\nexport function toFullCalendarView(layout: CalendarLayout): string {\n return fullCalendarViewNames[layout];\n}\n\n/** The calendar's layout a FullCalendar view draws, or undefined for one it doesn't offer. */\nexport function fromFullCalendarView(name: string): CalendarLayout | undefined {\n return calendarLayouts.find((layout) => fullCalendarViewNames[layout] === name);\n}\n\n/**\n * Whether an appointment in this FullCalendar view is drawn on one line — its time, then its\n * subject — as Outlook draws them in a month's cells, where a taller one would leave room for none.\n */\nexport function isCompactView(fullCalendarViewType: string): boolean {\n return fullCalendarViewType.startsWith('dayGrid');\n}\n\n/** The strings FullCalendar draws itself, already localized. */\nexport interface CalendarText {\n allDay: string;\n noEvents: string;\n close: string;\n /** \"+{n} more\" in a month cell with more appointments than fit. */\n more: (count: number) => string;\n}\n\nexport interface CalendarOptionsInput {\n /** The layout it opens in. */\n layout: CalendarLayout;\n /**\n * The layouts it offers. A day's number opens that day only while `day` is one of them: otherwise\n * it would leave the layouts the calendar is limited to.\n */\n layouts: readonly CalendarLayout[];\n /** A local date (`2026-11-01`) in the period it opens on; today's when omitted. */\n date?: string | undefined;\n /**\n * The user's time zone (an IANA name), which the calendar shows its times and days in, as the\n * portal shows every date; the browser's when omitted.\n */\n timeZone?: string | undefined;\n editable: boolean;\n locale: string;\n direction: 'ltr' | 'rtl';\n text: CalendarText;\n}\n\n/** The options both stacks give FullCalendar. */\nexport function calendarOptions(input: CalendarOptionsInput) {\n return {\n initialView: toFullCalendarView(input.layout),\n timeZone: input.timeZone ?? 'local',\n ...(input.date ? { initialDate: input.date } : {}),\n views: {\n pppWorkWeek: { type: 'timeGridWeek', weekends: false },\n },\n class: 'ppp-calendar',\n // FullCalendar draws the \"+ more\" popover at the end of the page, outside the calendar, so it\n // carries the calendar's styles by a class of its own.\n popoverClass: 'ppp-calendar-popover',\n // The toolbar is each stack's own Fluent toolbar, driven through FullCalendar's controller.\n headerToolbar: false as const,\n height: '100%',\n locale: input.locale,\n direction: input.direction,\n editable: input.editable,\n selectable: input.editable,\n selectMirror: true,\n nowIndicator: true,\n dayMaxEvents: true,\n // Appointments at the same time sit side by side, as Outlook draws them, not cascaded.\n slotEventOverlap: false,\n navLinks: input.layouts.includes('day'),\n scrollTime: '08:00:00',\n slotDuration: '00:30:00',\n snapDuration: '00:15:00',\n // Each appointment's class says how it shows its time; a block (not a month's dot nor the\n // agenda's row) is marked too, for only a block has the fill free and tentative are drawn in.\n // FullCalendar joins these with its theme's own classes.\n eventClass: (info: { event: { extendedProps: Record<string, unknown> } }) =>\n `ppp-calendar-event-host ${appointmentClassName(info.event.extendedProps)}`,\n blockEventClass: 'ppp-calendar-appointment-block',\n allDayText: input.text.allDay,\n noEventsText: input.text.noEvents,\n closeHint: input.text.close,\n moreLinkText: (count: number) => input.text.more(count),\n };\n}\n","// What both stacks keep of the period on screen, in the URL. Framework-free.\n\nconst DAY_MS = 24 * 60 * 60 * 1000;\n\n/**\n * The date the URL keeps for the period a view shows: a date in its middle (`2026-11-04` for the\n * week of 1 November), as the calendar's time zone has it, or undefined while the period takes in\n * today — so a link to the current week or month keeps following today, as the Today button does.\n * The middle rather than the first day, because which day a week starts on depends on the locale: a\n * link opened under another one then shows the week that holds that day, not the week before.\n *\n * @param timeZone The calendar's time zone (an IANA name); the browser's when omitted.\n */\nexport function periodDate(\n currentStart: Date,\n currentEnd: Date,\n now: Date = new Date(),\n timeZone?: string,\n): string | undefined {\n if (now >= currentStart && now < currentEnd) return undefined;\n // Days, not milliseconds, so a change of clocks inside the period doesn't move the middle; and\n // the middle day's noon, which no change of clocks moves into another day.\n const days = Math.round((currentEnd.getTime() - currentStart.getTime()) / DAY_MS);\n const middle = new Date(currentStart.getTime() + Math.floor(days / 2) * DAY_MS + DAY_MS / 2);\n return localDate(middle, timeZone);\n}\n\n/** The date an instant falls on in a time zone, or the browser's, as `yyyy-mm-dd`. */\nexport function localDate(instant: Date, timeZone?: string): string {\n const parts = new Intl.DateTimeFormat('en-US', {\n ...(timeZone ? { timeZone } : {}),\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n }).formatToParts(instant);\n const part = (type: Intl.DateTimeFormatPartTypes) => parts.find((x) => x.type === type)?.value ?? '';\n return `${part('year').padStart(4, '0')}-${part('month')}-${part('day')}`;\n}\n","// Where a New button starts an appointment. Framework-free.\n\nconst MINUTE_MS = 60 * 1000;\n\n/** How long a new appointment lasts: one of the calendar's slots, as Outlook's does. */\nconst LENGTH_MINUTES = 30;\n\n/** The hour a new appointment on a day other than today starts at: where the calendar scrolls to. */\nconst DAY_START_MINUTES = 8 * 60;\n\n/**\n * The time a New button gives a new appointment, as Outlook does: from the next half hour when the\n * period shown takes in today, and otherwise from 8:00 on its first day — half an hour, in the\n * calendar's time zone.\n *\n * @param currentStart The first moment of the period shown (a view's `currentStart`).\n * @param currentEnd The moment after it (a view's `currentEnd`).\n * @param timeZone The calendar's time zone (an IANA name); the browser's when omitted.\n */\nexport function newAppointmentRange(\n currentStart: Date,\n currentEnd: Date,\n now: Date = new Date(),\n timeZone?: string,\n): { start: Date; end: Date; allDay: false } {\n let start: Date;\n if (now >= currentStart && now < currentEnd) {\n // The next half hour on the clock of the time zone — now itself when it is one.\n const past = (minutesOfDay(now, timeZone) % LENGTH_MINUTES) * MINUTE_MS + (now.getTime() % MINUTE_MS);\n start = new Date(now.getTime() + (past === 0 ? 0 : LENGTH_MINUTES * MINUTE_MS - past));\n } else {\n // 8:00 on the first day: eight hours on, less any change of clocks in between.\n const guess = new Date(currentStart.getTime() + DAY_START_MINUTES * MINUTE_MS);\n start = new Date(guess.getTime() - (minutesOfDay(guess, timeZone) - DAY_START_MINUTES) * MINUTE_MS);\n }\n return { start, end: new Date(start.getTime() + LENGTH_MINUTES * MINUTE_MS), allDay: false };\n}\n\n/** The minutes since midnight an instant shows on a time zone's clock, or the browser's. */\nfunction minutesOfDay(instant: Date, timeZone?: string): number {\n const parts = new Intl.DateTimeFormat('en-US', {\n ...(timeZone ? { timeZone } : {}),\n hourCycle: 'h23',\n hour: '2-digit',\n minute: '2-digit',\n }).formatToParts(instant);\n const part = (type: Intl.DateTimeFormatPartTypes) => Number(parts.find((x) => x.type === type)?.value ?? 0);\n return part('hour') * 60 + part('minute');\n}\n","// What both stacks show of an appointment when it is hovered: its subject, when it is, where, and\n// whether it is part of a series. Framework-free.\n\n// Formatters by locale, zone and kind, as building one costs far more than using it and a month\n// can hold hundreds of appointments.\nconst formatters = new Map<string, Intl.DateTimeFormat>();\n\nfunction formatter(locale: string, timeZone: string | undefined, allDay: boolean): Intl.DateTimeFormat {\n const key = `${locale}|${timeZone ?? ''}|${allDay}`;\n let format = formatters.get(key);\n if (!format) {\n format = new Intl.DateTimeFormat(locale, {\n ...(timeZone ? { timeZone } : {}),\n ...(allDay\n ? { weekday: 'short', month: 'short', day: 'numeric', year: 'numeric' }\n : { weekday: 'short', month: 'short', day: 'numeric', hour: 'numeric', minute: '2-digit' }),\n });\n formatters.set(key, format);\n }\n return format;\n}\n\n/**\n * When an appointment is, in the user's language and time zone: `Tue, Oct 27, 9:00 – 10:30 AM`.\n *\n * @param timeZone The calendar's time zone (an IANA name); the browser's when omitted.\n */\nexport function formatAppointmentWhen(\n start: Date,\n end: Date | null,\n allDay: boolean,\n locale: string,\n timeZone?: string,\n): string {\n if (allDay) {\n // An all-day appointment ends at the start of the day after its last; a range within one day\n // is written as that day.\n const last = end && end > start ? new Date(end.getTime() - 1) : start;\n return formatter(locale, timeZone, true).formatRange(start, last);\n }\n const times = formatter(locale, timeZone, false);\n return end && end > start ? times.formatRange(start, end) : times.format(start);\n}\n\n/** The lines of an appointment's tooltip, the subject first. */\nexport interface AppointmentSummary {\n subject: string;\n when: string;\n location: string | null;\n /** The text saying it is part of a series, or null when it isn't. */\n recurring: string | null;\n}\n\n/** The summary of a FullCalendar event the calendar drew from an appointment. */\nexport function summarizeAppointment(\n event: {\n title: string;\n start: Date | null;\n end: Date | null;\n allDay: boolean;\n extendedProps: Record<string, unknown>;\n },\n locale: string,\n recurringText: string,\n timeZone?: string,\n): AppointmentSummary {\n return {\n subject: event.title,\n when: event.start ? formatAppointmentWhen(event.start, event.end, event.allDay, locale, timeZone) : '',\n location: (event.extendedProps['location'] as string | null | undefined) ?? null,\n recurring: event.extendedProps['recurring'] ? recurringText : null,\n };\n}\n\n/** How long the pointer rests on an appointment before its tooltip shows, in milliseconds. */\nexport const APPOINTMENT_TOOLTIP_DELAY_MS = 300;\n","import { Tooltip } from '@fluentui/react-components';\nimport { useEffect, useRef, useState, type ReactElement, type ReactNode } from 'react';\nimport { APPOINTMENT_TOOLTIP_DELAY_MS, type AppointmentSummary } from './core/index.js';\n\n/**\n * An appointment's tooltip, once the pointer or the focus has rested on it a moment: the calendar's\n * summary, always there to describe the appointment to a screen reader as it takes the focus; or the\n * host's own, drawn only while it shows (`content` a function), so a busy month doesn't draw a\n * template for every appointment on it.\n *\n * The wait is the calendar's, not Fluent's. Fluent shows a tooltip at once while another is up, so\n * that moving along a toolbar doesn't wait at each button — but moving across a busy week would then\n * pop every appointment's tooltip up as the pointer passes over it. The Blazor Calendar's, a Fluent\n * web component given the same delay, waits each time.\n */\nexport function AppointmentTooltip({ content, children }: { content: ReactNode | (() => ReactNode); children: ReactElement }) {\n const [visible, setVisible] = useState(false);\n const wait = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n useEffect(() => () => clearTimeout(wait.current), []);\n\n return (\n <Tooltip\n relationship=\"description\"\n withArrow\n visible={visible}\n showDelay={0}\n hideDelay={0}\n onVisibleChange={(_, data) => {\n clearTimeout(wait.current);\n if (data.visible) wait.current = setTimeout(() => setVisible(true), APPOINTMENT_TOOLTIP_DELAY_MS);\n else setVisible(false);\n }}\n content={\n typeof content !== 'function' ? (\n <div className=\"ppp-calendar-tooltip\">{content}</div>\n ) : visible ? (\n <div className=\"ppp-calendar-tooltip\">{content()}</div>\n ) : (\n ''\n )\n }\n >\n {children}\n </Tooltip>\n );\n}\n\n/** The calendar's own tooltip: the appointment's subject, then when, where and whether it repeats. */\nexport function AppointmentSummaryContent({ summary }: { summary: AppointmentSummary }) {\n return (\n <>\n <span className=\"ppp-calendar-tooltip-subject\">{summary.subject}</span>\n <span>{summary.when}</span>\n {summary.location && <span>{summary.location}</span>}\n {summary.recurring && <span>{summary.recurring}</span>}\n </>\n );\n}\n","import type { TableRecord, TableRecordReference } from '@powerportalspro/core';\n\n/**\n * A new appointment, as a range selected in an editable calendar starts it: its start and end, all\n * day when the range is whole days, and about the record the calendar is regarding, by the name its\n * lookup shows. The Blazor Calendar's NewAppointmentAsync is its twin.\n */\nexport function newAppointment(\n range: { start: Date; end: Date; allDay: boolean },\n regarding?: (TableRecordReference & { name?: string | null }) | null,\n): TableRecord {\n return {\n tableName: 'appointment',\n properties: {\n scheduledstart: { $type: 2, value: range.start.toISOString() },\n scheduledend: { $type: 2, value: range.end.toISOString() },\n isalldayevent: { $type: 0, value: range.allDay },\n ...(regarding?.id\n ? {\n regardingobjectid: {\n $type: 6,\n value: regarding.id,\n tableName: regarding.tableName,\n ...(regarding.name ? { name: regarding.name } : {}),\n },\n }\n : {}),\n },\n } as TableRecord;\n}\n","import {\n defaultViewId,\n isViewHidden,\n type MultiTableViewDefinition,\n type SavedViewControl,\n type UserViewSetting,\n} from '@powerportalspro/core';\nimport type { CalendarLayout } from './core/index.js';\nimport { EVERY_TABLE_VIEW_ID } from '@powerportalspro/react-fluent';\n\n// Which views the calendar offers. The Blazor Calendar's OfferedViewIds and PageViewIds are the twins\n// of these; its filter is react-fluent's multi-table-filters, as the timeline's is.\n\n/**\n * The page's views on offer, by lowercase id, the one the calendar opens on first: its Dataverse\n * views, views of several tables and views defined in code — or, with none, the view of every table.\n */\nexport function offeredViewIds(\n defaultViewId: string | undefined,\n viewIds: readonly string[] | undefined,\n multiTableViewIds: readonly string[] | undefined,\n customViews: readonly MultiTableViewDefinition[] | undefined,\n): string[] {\n const ids = [\n ...(defaultViewId ? [defaultViewId] : []),\n ...(viewIds ?? []),\n ...(multiTableViewIds ?? []),\n ...(customViews ?? []).map((view) => view.id),\n ].map((id) => id.toLowerCase());\n return ids.length === 0 ? [EVERY_TABLE_VIEW_ID] : [...new Set(ids)];\n}\n\n/** The view defined in code with this id, if it is one. */\nexport function findCustomView(\n id: string | undefined,\n customViews: readonly MultiTableViewDefinition[] | undefined,\n): MultiTableViewDefinition | undefined {\n if (!id) return undefined;\n return customViews?.find((view) => view.id.toLowerCase() === id.toLowerCase());\n}\n\n/** The view shown: the one picked while it is on offer, otherwise the first offered. */\nexport function selectedViewId(offered: readonly string[], picked: string | undefined): string | undefined {\n return picked && offered.includes(picked.toLowerCase()) ? picked.toLowerCase() : offered[0];\n}\n\n/**\n * Whether views are on offer that a link can name: the page's or the user's, not only the view of\n * every table a page that names none shows — it may name them later.\n */\nexport function offersViews(offered: readonly string[]): boolean {\n return offered.some((id) => id !== EVERY_TABLE_VIEW_ID);\n}\n\n/**\n * The views on offer with the user's saved ones: the page's and theirs, the one the calendar opens on\n * first — the user's default, or the page's — without the ones they hid, unless it shows one.\n * Without saved views offered, the page's. The Blazor Calendar's WithSavedViews is its twin.\n */\nexport function withSavedViews(\n pageViews: readonly string[],\n savedViews: readonly string[],\n settings: readonly UserViewSetting[],\n control: SavedViewControl,\n shown: string | undefined,\n offersSavedViews: boolean,\n): string[] {\n if (!offersSavedViews) return [...pageViews];\n let all = [...new Set([...pageViews, ...savedViews].map((id) => id.toLowerCase()))];\n const userDefault = defaultViewId(settings, all, control);\n if (userDefault) all = [userDefault, ...all.filter((id) => id !== userDefault)];\n const offered = all.filter((id) => id === shown?.toLowerCase() || !isViewHidden(settings, id, control));\n return offered.length > 0 ? offered : all;\n}\n\nconst LAYOUTS: readonly CalendarLayout[] = ['day', 'workWeek', 'week', 'month', 'agenda'];\n\n/**\n * The layout a saved view opens the calendar in, kept in its calendar layout column as\n * `{\"version\":1,\"layout\":\"month\"}`: undefined for none, or one that can't be read. The Blazor\n * Calendar's ReadSavedLayout is its twin.\n */\nexport function readSavedLayout(json: string | undefined): CalendarLayout | undefined {\n if (!json?.trim()) return undefined;\n try {\n const layout = (JSON.parse(json) as { layout?: unknown }).layout;\n return LAYOUTS.find((x) => x === layout);\n } catch {\n return undefined;\n }\n}\n\n/** The JSON a saved view keeps the calendar's layout in. */\nexport function writeSavedLayout(layout: CalendarLayout): string {\n return JSON.stringify({ version: 1, layout });\n}\n","import {\n TableSecurityPermission,\n type MultiTableItem,\n type MultiTableTableInfo,\n type TableRecord,\n} from '@powerportalspro/core';\nimport type { CalendarAppointment } from './calendar-appointment.js';\nimport { AppointmentShowAs, type CalendarAppointmentChange } from './core/index.js';\nimport { localDate } from './core/state.js';\n\n// The rows a calendar reads of several tables: how a row becomes what the calendar draws, and what\n// saving a row the user moved writes. The Blazor Calendar's Calendar.Tables.cs is the twin of these.\n\n/** The table a calendar creates appointments in, and whose rows open in its details dialog. */\nexport const APPOINTMENT_TABLE = 'appointment';\n\n/** The table of a recurring appointment's series, which a calendar showing each series once shows. */\nexport const SERIES_TABLE = 'recurringappointmentmaster';\n\n/** The tables shown at first when the calendar shows every table. */\nexport const DEFAULT_CALENDAR_TABLES: readonly string[] = [APPOINTMENT_TABLE, 'task'];\n\n/**\n * The appointment's columns the calendar draws beyond the registration's, and every table's state,\n * which says whether a row is closed.\n */\nexport const CALENDAR_COLUMNS: Readonly<Record<string, string[]>> = {\n [APPOINTMENT_TABLE]: ['location', 'seriesid', 'instancetypecode', 'statecode', 'statuscode'],\n '*': ['statecode'],\n};\n\nconst MINUTE_MS = 60 * 1000;\nconst DAY_MS = 24 * 60 * MINUTE_MS;\n\nfunction valueOf(record: TableRecord | null | undefined, column: string): unknown {\n return (record?.properties?.[column] as { value?: unknown } | null | undefined)?.value;\n}\n\nfunction stateOf(item: MultiTableItem): number | null {\n const state = valueOf(item.record, 'statecode');\n return typeof state === 'number' ? state : null;\n}\n\n/** Whether a row is closed — completed or canceled, or an inactive row — which Dataverse refuses to change. */\nexport function isClosed(item: MultiTableItem): boolean {\n const state = stateOf(item);\n return state === 1 || state === 2;\n}\n\n/**\n * How an appointment shows its time, from its status reason. Dataverse's own: 1 Free and\n * 2 Tentative (open), 5 Busy and 6 Out of Office (scheduled), 3 Completed and 4 Canceled — a\n * completed one shows as busy, a canceled one as free. One added to an environment shows as its\n * state's: free when open or canceled, otherwise busy.\n */\nexport function showAsOf(statusCode: number | null, stateCode: number | null): AppointmentShowAs {\n switch (statusCode) {\n case 1:\n case 4:\n return AppointmentShowAs.Free;\n case 2:\n return AppointmentShowAs.Tentative;\n case 3:\n case 5:\n return AppointmentShowAs.Busy;\n case 6:\n return AppointmentShowAs.OutOfOffice;\n default:\n return stateCode === 0 || stateCode === 2 ? AppointmentShowAs.Free : AppointmentShowAs.Busy;\n }\n}\n\n/** The moment a day starts in a time zone, or the browser's. */\nexport function zonedMidnight(date: string, timeZone?: string): Date {\n const [year, month, day] = date.split('-').map(Number) as [number, number, number];\n const wanted = Date.UTC(year, month - 1, day);\n let guess = wanted;\n // Twice: the zone's offset at the first guess can differ from the one at midnight.\n for (let i = 0; i < 2; i++) {\n const parts = new Intl.DateTimeFormat('en-US', {\n ...(timeZone ? { timeZone } : {}),\n hourCycle: 'h23',\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit',\n }).formatToParts(new Date(guess));\n const part = (type: Intl.DateTimeFormatPartTypes) => Number(parts.find((x) => x.type === type)?.value ?? 0);\n const shown = Date.UTC(part('year'), part('month') - 1, part('day'), part('hour'), part('minute'));\n guess = wanted - (shown - guess);\n }\n return new Date(guess);\n}\n\n/**\n * Where a row is drawn: a date-only row on its day in the user's zone, which its UTC midnight isn't\n * west of Greenwich; any other at its moments.\n */\nexport function drawnTimes(item: MultiTableItem, dateOnly: boolean, timeZone?: string): { start: Date; end: Date } {\n const start = new Date(item.start);\n const end = new Date(item.end);\n if (!dateOnly) return { start, end };\n const first = start.toISOString().slice(0, 10);\n let after = end.toISOString().slice(0, 10);\n if (after <= first) after = new Date(start.getTime() + DAY_MS).toISOString().slice(0, 10);\n return { start: zonedMidnight(first, timeZone), end: zonedMidnight(after, timeZone) };\n}\n\n/**\n * What the calendar draws of a row. It can be moved when the user may write it, it isn't closed, and\n * they may change its start; resized when they may change its end too. An appointment keeps how it\n * shows its time, whether it was canceled and its series. The Blazor Calendar's `ToAppointment` is\n * its twin.\n */\nexport function fromMultiTableItem(\n item: MultiTableItem,\n info: MultiTableTableInfo | undefined,\n drawn: { start: Date; end: Date },\n): CalendarAppointment {\n // The table's calendar dates: what a move or a resize writes.\n const dates = info?.definition?.calendar;\n const changeable = new Set((info?.changeableColumns ?? []).map((x) => x.toLowerCase()));\n const movable =\n (Number(item.permissions ?? 0) & TableSecurityPermission.Write) !== 0 &&\n !isClosed(item) &&\n !!dates?.start &&\n changeable.has(dates.start.toLowerCase());\n const resizable = movable && !!dates?.end && changeable.has(dates.end.toLowerCase());\n const isAppointment = item.table === APPOINTMENT_TABLE;\n const state = stateOf(item);\n const location = valueOf(item.record, 'location');\n const status = valueOf(item.record, 'statuscode');\n return {\n id: item.id,\n table: item.table,\n subject: item.title ?? '',\n start: drawn.start,\n end: drawn.end,\n allDay: item.isAllDay ?? false,\n location: isAppointment && typeof location === 'string' ? location : null,\n recurring: item.table === SERIES_TABLE || (isAppointment && !!valueOf(item.record, 'seriesid')),\n editable: movable ? null : false,\n durationEditable: resizable ? null : false,\n showAs: isAppointment ? showAsOf(typeof status === 'number' ? status : null, state) : AppointmentShowAs.Busy,\n canceled: state === 2,\n color: info?.definition?.color ?? null,\n record: item.record ?? null,\n };\n}\n\n/** A moment as a column keeps it: a date-only column, the day it falls on in the user's zone. */\nfunction stored(moment: Date, dateOnly: boolean, timeZone?: string): string {\n return dateOnly ? `${localDate(moment, timeZone)}T00:00:00.000Z` : moment.toISOString();\n}\n\n/**\n * What saving a row the user moved or resized writes: its start, its end when it has one or its\n * length changed, and whether it takes whole days, where its table keeps that. Null for a move the\n * calendar refuses: between whole days and times its table can't keep. The Blazor Calendar's\n * `SaveMoveAsync` is its twin.\n */\nexport function moveRecord(\n change: CalendarAppointmentChange,\n item: MultiTableItem,\n info: MultiTableTableInfo | undefined,\n dateOnly: boolean,\n timeZone?: string,\n): TableRecord | null {\n const dates = info?.definition?.calendar;\n if (!dates?.start) return null;\n const changeable = new Set((info?.changeableColumns ?? []).map((x) => x.toLowerCase()));\n const allDayColumn = dates.allDay && changeable.has(dates.allDay.toLowerCase()) ? dates.allDay : null;\n if (change.allDay !== (item.isAllDay ?? false) && !allDayColumn) return null;\n if (dateOnly && !change.allDay) return null;\n\n // A drop with no end: a day for one taking whole days, else the calendar's half hour.\n const end = change.end ?? new Date(change.start.getTime() + (change.allDay ? DAY_MS : 30 * MINUTE_MS));\n const drawn = drawnTimes(item, dateOnly, timeZone);\n const lengthChanged = end.getTime() - change.start.getTime() !== drawn.end.getTime() - drawn.start.getTime();\n const properties: Record<string, unknown> = {\n [dates.start]: { $type: 2, value: stored(change.start, dateOnly, timeZone) },\n };\n if (dates.end && (!item.hasNoEnd || lengthChanged))\n properties[dates.end] = { $type: 2, value: stored(end, dateOnly, timeZone) };\n if (allDayColumn) properties[allDayColumn] = { $type: 0, value: change.allDay };\n return { tableName: item.table, id: item.id, properties } as TableRecord;\n}\n","\n:root {\n --fc-sticky-header-footer-z: 3;\n --fc-popover-z: 4;\n}\n\n.fc-rk {\n z-index: var(--fc-popover-z) !important;\n}\n\n.fc-gE {\n isolation: isolate;\n}\n\n/*\nThis will prevent all ancestors from customizing their box size unless they use .contentBox\n*/\n.fc-wY,\n.fc-wY *,\n.fc-wY *:before,\n.fc-wY *:after {\n box-sizing: border-box !important;\n}\n\n/* classes attached to <body> */\n.fc-8m,\n.fc-8m * {\n cursor: not-allowed !important;\n}\n\n.fc-Is {\n -ms-overflow-style: none !important; /* IE and Edge */\n scrollbar-width: none !important; /* Firefox */\n}\n\n/* Hide scrollbar for Chrome, Safari and Opera */\n.fc-Is::-webkit-scrollbar {\n display: none !important;\n}\n\n.fc-Ps {\n flex-shrink: 0 !important;\n}\n\n.fc-qC .fc-VR {\n display: flex !important;\n flex-direction: row !important;\n flex-wrap: wrap !important;\n}\n\n/* HACK for Safari. Can't do break-inside:avoid with flexbox items, likely b/c it's not standard:\n https://stackoverflow.com/a/60256345 */\n.fc-hF .fc-VR > * {\n float: left !important;\n}\n\n[dir=rtl] .fc-hF .fc-VR > *,\n.fc-hF[dir=rtl] .fc-VR > * {\n float: right !important;\n}\n\n.fc-hF .fc-VR::after {\n content: \"\" !important;\n display: block !important;\n clear: both !important;\n}\n\n.fc-Zu {\n cursor: pointer !important;\n}\n\n.fc-Hs {\n cursor: n-resize !important;\n}\n\n.fc-J0 {\n cursor: s-resize !important;\n}\n\n.fc-jI {\n cursor: w-resize !important;\n}\n\n[dir=rtl] .fc-jI {\n cursor: e-resize !important;\n}\n\n.fc-Nk {\n cursor: e-resize !important;\n}\n\n[dir=rtl] .fc-Nk {\n cursor: w-resize !important;\n}\n\n.fc-Mg {\n cursor: col-resize !important;\n}\n\n.fc-0r,\n.fc-Zc,\n.fc-yR {\n position: absolute !important;\n box-sizing: content-box !important;\n width: 100% !important;\n height: 100% !important;\n}\n\n.fc-0r {\n padding: 10px !important;\n margin: -10px !important;\n}\n\n.fc-Zc {\n padding-left: 10px !important;\n padding-right: 10px !important;\n margin-left: -10px !important;\n margin-right: -10px !important;\n}\n\n.fc-yR {\n padding-top: 10px !important;\n padding-bottom: 10px !important;\n margin-top: -10px !important;\n margin-bottom: -10px !important;\n}\n\n/* QUESTION: why not use -left -right instead of negative margins/padding for ALL? */\n.fc-JB {\n position: absolute;\n top: 0;\n bottom: 0;\n left: -5px;\n right: -5px;\n}\n\n.fc-uv {\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n}\n\n.fc-B9 {\n visibility: hidden;\n}\n\n/* Border Utils */\n/* ------------------------------------------------------------------------------------------------- */\n\n.fc-13 {\n border: 0 !important;\n}\n\n.fc-MT {\n border-left: 0 !important;\n border-right: 0 !important;\n}\n\n.fc-60 {\n border-top: 0 !important;\n border-bottom: 0 !important;\n}\n\n.fc-qy {\n border-top: 0 !important;\n}\n\n.fc-lE {\n border-bottom: 0 !important;\n}\n\n.fc-MR {\n border-inline-start: 0 !important;\n}\n\n.fc-li {\n border-inline-end: 0 !important;\n}\n\n/* Flexbox Utils */\n/* ------------------------------------------------------------------------------------------------- */\n\n.fc-mN {\n display: flex !important;\n flex-direction: row !important;\n}\n\n.fc-mU {\n display: flex !important;\n flex-direction: column !important;\n}\n\n.fc-l7 {\n flex-grow: 1 !important;\n}\n\n.fc-OV {\n flex-grow: 1 !important;\n flex-basis: 0 !important;\n min-width: 0 !important;\n min-height: 0 !important;\n}\n\n.fc-bW {\n min-height: 0 !important;\n}\n\n/*\nTODO: use liquidX/Y elsewhere because frees up min other dimension; less collisions\n*/\n.fc-cq {\n flex-grow: 1 !important;\n flex-basis: 0 !important;\n min-width: 0 !important;\n}\n\n/* Semantic Print Table */\n/* ------------------------------------------------------------------------------------------------- */\n\n.fc-A8 {\n width: 100% !important;\n table-layout: fixed !important;\n border: 0 !important;\n border-collapse: separate !important;\n border-spacing: 0 !important;\n}\n\n.fc-A8 > thead {\n /* Both properties are needed for cross-browser repeated headers across printed pages. */\n -moz-column-break-inside: avoid !important;\n break-inside: avoid !important;\n page-break-inside: avoid !important;\n}\n\n.fc-A8 > tbody {\n /* Timeline print-layout hack (resource and non-resource): lets shared absolute backgrounds show through. */\n background: transparent !important;\n}\n\n.fc-A8 > thead > tr > th,\n.fc-A8 > tbody > tr > th,\n.fc-A8 > tbody > tr > td {\n vertical-align: top !important;\n font-weight: inherit;\n text-align: inherit;\n}\n\n/* Table Utils */\n/* ------------------------------------------------------------------------------------------------- */\n\n.fc-Ju {\n padding: 0 !important;\n}\n\n.fc-Eh {\n padding-top: 0 !important;\n padding-bottom: 0 !important;\n}\n\n.fc-yU {\n margin: 0 !important;\n}\n\n.fc-6S {\n margin-top: 0 !important;\n margin-bottom: 0 !important;\n}\n\n.fc-ve {\n margin-left: 0 !important;\n margin-right: 0 !important;\n}\n\n.fc-aG {\n white-space: nowrap !important;\n}\n\n.fc-v9 {\n white-space: pre !important;\n}\n\n/* Misc Utils */\n/* ------------------------------------------------------------------------------------------------- */\n\n.fc-C4 {\n overflow-anchor: none;\n}\n\n.fc-rX {\n pointer-events: none !important;\n}\n\n.fc-mR {\n overflow: hidden !important;\n}\n\n/*\nTODO: eventually use this on daygrid/timegrid events' inner, time, and title, FOR PRINT\nNeeded to prevent wrapping to multiple lines, increasing height, throwing off print-positioning,\nwhich can't rely on dynamic height detection after print-flag activated.\n*/\n.fc-Kv {\n white-space: nowrap !important;\n overflow: hidden !important;\n}\n\n.fc-Ru {\n position: relative !important;\n}\n\n.fc-r6 {\n position: absolute !important;\n}\n\n.fc-2W {\n inset-inline-start: 0 !important;\n}\n\n.fc-0D {\n inset-inline-end: 0 !important;\n}\n\n.fc-9b {\n position: absolute !important;\n top: 0 !important;\n left: 0 !important;\n right: 0 !important;\n bottom: 0 !important;\n}\n\n.fc-6Q,\n.fc-zm {\n position: absolute !important;\n left: 0 !important;\n right: 0 !important;\n}\n\n.fc-9F,\n.fc-Ma {\n position: absolute !important;\n top: 0 !important;\n bottom: 0 !important;\n}\n\n.fc-6Q {\n top: 0 !important;\n}\n\n.fc-Ma {\n left: 0 !important;\n right: 0 !important;\n width: 0 !important;\n}\n\n@media not print {\n .fc-Yy {\n position: sticky !important;\n }\n\n .fc-DR {\n position: sticky !important;\n top: 0 !important;\n }\n\n /* Sticks to either left or right (the flex \"start\") depending on ltr/rtl */\n .fc-QU {\n position: sticky !important;\n inset-inline-start: 0 !important;\n }\n\n .fc-5M {\n position: sticky !important;\n top: 0 !important;\n z-index: var(--fc-sticky-header-footer-z) !important;\n }\n}\n\n/* Only needed when padding/border must be separate from width/height */\n.fc-qN {\n box-sizing: content-box !important;\n}\n\n/* Out of view but keeps its real size, for measurement probes. For screen-reader text, use .srOnly.\nHidden also means not focusable, clickable, or read by screen readers */\n.fc-rU {\n position: absolute !important;\n left: -10000px !important;\n visibility: hidden !important;\n}\n\n/* Visually hidden but read by screen readers. Unlike .offscreen, never causes scroll overflow */\n.fc-og {\n position: absolute !important;\n width: 1px !important;\n height: 1px !important;\n margin: 0 !important;\n padding: 0 !important;\n border: 0 !important;\n overflow: hidden !important;\n clip-path: inset(50%) !important;\n white-space: nowrap !important;\n}\n\n.fc-hm {\n align-items: center !important;\n}\n\n.fc-cI {\n align-items: flex-start !important;\n}\n\n.fc-Qq {\n align-items: flex-end !important;\n}\n\n/* Footer Scrollbar */\n/* ------------------------------------------------------------------------------------------------- */\n\n.fc-se {\n position: sticky !important;\n bottom: 0 !important;\n z-index: var(--fc-sticky-header-footer-z) !important;\n}\n\n.fc-Vd > * {\n margin-top: -1px !important;\n}\n\n.fc-Vd > * > * {\n height: 1px !important;\n}\n\n/* Print Utils */\n/* ------------------------------------------------------------------------------------------------- */\n\n.fc-or {\n -moz-column-break-inside: avoid !important;\n break-inside: avoid !important;\n page-break-inside: avoid !important;\n}\n\n.fc-Lx {\n min-height: 4em !important;\n}\n\n.fc-vn {\n display: flow-root !important;\n}\n\n/* Z-index */\n/* ------------------------------------------------------------------------------------------------- */\n\n.fc-mP {\n z-index: 0;\n}\n\n.fc-NW {\n z-index: 1;\n}\n\n.fc-Zs {\n z-index: 2;\n}\n\n.fc-D7 {\n z-index: 3;\n}\n\n.fc-Se {\n z-index: 4;\n}\n\n.fc-kE {\n z-index: 5;\n}\n\n.fc-Y9 {\n z-index: 1000;\n}\n\n.fc-DP {\n z-index: 9999;\n}\n\n.fc-Xr:focus-visible {\n z-index: 2;\n}\n\n/* INTERNAL MARKER -- used to mark an element for internal significance */\n/* ------------------------------------------------------------------------------------------------- */\n\n.fc-8W {}\n\n.fc-Ad {}\n.fc-oG {}\n.fc-Yb {}\n.fc-JA {}\n.fc-4p {}\n.fc-IR {}\n.fc-tW {}\n.fc-8h {}\n\n.fc-Jv {}\n\n.fc-XX {}\n\n.fc-89 {}\n\n.fc-wF {}\n\n.fc-tw {}\n\n.fc-ox {}\n",".fc-forma-n5m {\n font-size: 16px;\n line-height: 1.5;\n --fc-forma-border-style: solid;\n}\n\n.fc-forma-Z9U {\n appearance: button;\n font: inherit;\n font-feature-settings: inherit;\n font-variation-settings: inherit;\n letter-spacing: inherit;\n color: inherit;\n opacity: 1;\n background-color: #0000;\n border-radius: 0;\n margin: 0;\n border: 0;\n padding: 0\n}\n\n.fc-forma-JiE {\n color: inherit;\n text-decoration: inherit;\n}\n\n.fc-forma-3Lc {\n pointer-events: none\n}\n\n.fc-forma-1EY {\n position: absolute\n}\n\n.fc-forma-eYX {\n position: relative\n}\n\n.fc-forma-MaV {\n inset-inline: 0\n}\n\n.fc-forma-AWB {\n inset-block: 0\n}\n\n.fc-forma-0fm {\n inset-inline-start: -8px\n}\n\n.fc-forma-Tuc {\n inset-inline-end: -4px\n}\n\n.fc-forma-iD1 {\n inset-inline-end: 0\n}\n\n.fc-forma-SyR {\n inset-inline-end: 4px\n}\n\n.fc-forma-dnf {\n inset-inline-end: -3px\n}\n\n.fc-forma-YDC {\n top: -4px\n}\n\n.fc-forma-n9G {\n top: 0\n}\n\n.fc-forma-2ik {\n top: 2px\n}\n\n.fc-forma-ZnE {\n top: 4px\n}\n\n.fc-forma-ERR {\n top: 50%\n}\n\n.fc-forma-fJL {\n bottom: -4px\n}\n\n.fc-forma-1V6 {\n left: 50%\n}\n\n.fc-forma-aAW {\n margin: -6px\n}\n\n.fc-forma-CH7 {\n margin: -1px\n}\n\n.fc-forma-gMS {\n margin: 4px\n}\n\n.fc-forma-bvX {\n margin: 8px\n}\n\n.fc-forma-jD5 {\n margin: 16px\n}\n\n.fc-forma-cKZ {\n margin-inline: 2px\n}\n\n.fc-forma-148 {\n margin-inline: 1px\n}\n\n.fc-forma-cJ3 {\n margin-block: 2px\n}\n\n.fc-forma-V9v {\n margin-block: 4px\n}\n\n.fc-forma-SEP {\n margin-block: 1px\n}\n\n.fc-forma-Jzj {\n margin-inline-start: 2px\n}\n\n.fc-forma-Wga {\n margin-inline-start: 4px\n}\n\n.fc-forma-qvL {\n margin-inline-start: 1px\n}\n\n.fc-forma-p9t {\n margin-inline-end: -6px\n}\n\n.fc-forma-3e1 {\n margin-inline-end: 2px\n}\n\n.fc-forma-KYn {\n margin-inline-end: 4px\n}\n\n.fc-forma-B3G {\n margin-inline-end: 2.5%\n}\n\n.fc-forma-9hC {\n margin-inline-end: 1px\n}\n\n.fc-forma-Dq8 {\n margin-top: -4px\n}\n\n.fc-forma-Ika {\n margin-bottom: 1px\n}\n\n.fc-forma-F99 {\n margin-left: -4px\n}\n\n.fc-forma-I48 {\n display: block\n}\n\n.fc-forma-dl1 {\n display: flex\n}\n\n.fc-forma-i3N {\n display: grid\n}\n\n.fc-forma-pps {\n display: none\n}\n\n.fc-forma-63n {\n width: 0;\n height: 0\n}\n\n.fc-forma-3wQ {\n width: 8px;\n height: 8px\n}\n\n.fc-forma-vnf {\n width: 16px;\n height: 16px\n}\n\n.fc-forma-XUJ {\n width: 20px;\n height: 20px\n}\n\n.fc-forma-uuA {\n height: 8px\n}\n\n.fc-forma-vYi {\n height: 10px\n}\n\n.fc-forma-oM6 {\n height: 20px\n}\n\n.fc-forma-TFV {\n height: 24px\n}\n\n.fc-forma-84e {\n min-height: 2px\n}\n\n.fc-forma-jgW {\n min-height: 16px\n}\n\n.fc-forma-toR {\n min-height: 1px\n}\n\n.fc-forma-roZ {\n width: 50%\n}\n\n.fc-forma-vVE {\n width: 25%\n}\n\n.fc-forma-hza {\n width: 8px\n}\n\n.fc-forma-79F {\n width: 20px\n}\n\n.fc-forma-ilz {\n width: 24px\n}\n\n.fc-forma-4Tv {\n width: 5px\n}\n\n.fc-forma-aHX {\n max-width: 160px\n}\n\n.fc-forma-2KU {\n min-width: 0\n}\n\n.fc-forma-aNc {\n min-width: 220px\n}\n\n.fc-forma-yi0 {\n flex-shrink: 0\n}\n\n.fc-forma-1Zl {\n flex-shrink: 1\n}\n\n.fc-forma-OLq {\n flex-shrink: 100\n}\n\n.fc-forma-1El {\n flex-grow: 1\n}\n\n.fc-forma-QX7 {\n rotate: -45deg\n}\n\n.fc-forma-KxI {\n rotate: -90deg\n}\n\n.fc-forma-ABq {\n rotate: 45deg\n}\n\n.fc-forma-z44 {\n rotate: 90deg\n}\n\n.fc-forma-jmT {\n rotate: 180deg\n}\n\n.fc-forma-sgX {\n flex-direction: column\n}\n\n.fc-forma-1sP {\n flex-direction: row\n}\n\n.fc-forma-dNl {\n flex-wrap: wrap\n}\n\n.fc-forma-XpK {\n align-items: center\n}\n\n.fc-forma-RNn {\n align-items: flex-end\n}\n\n.fc-forma-EF4 {\n align-items: flex-start\n}\n\n.fc-forma-N2M {\n justify-content: space-between\n}\n\n.fc-forma-E9P {\n justify-content: center\n}\n\n.fc-forma-LMv {\n justify-content: flex-end\n}\n\n.fc-forma-NWN {\n gap: 4px\n}\n\n.fc-forma-tgZ {\n gap: 8px\n}\n\n.fc-forma-wwb {\n gap: 12px\n}\n\n.fc-forma-Pms {\n gap: 16px\n}\n\n.fc-forma-sI7 {\n align-self: flex-start\n}\n\n.fc-forma-pKG {\n overflow: hidden\n}\n\n.fc-forma-AAA {\n border-radius: 3.40282e38px\n}\n\n.fc-forma-Fvv {\n border-radius: 4px\n}\n\n.fc-forma-kmj {\n border-start-start-radius: 4px;\n border-end-start-radius: 4px\n}\n\n.fc-forma-Skl {\n border-start-end-radius: 4px;\n border-end-end-radius: 4px\n}\n\n.fc-forma-Z7Q {\n border-top-left-radius: 4px;\n border-top-right-radius: 4px\n}\n\n.fc-forma-2qh {\n border-bottom-right-radius: 4px;\n border-bottom-left-radius: 4px\n}\n\n.fc-forma-wsy,\n.fc-forma-qQW {\n border-style: var(--fc-forma-border-style);\n border-width: 1px\n}\n\n.fc-forma-5JF {\n border-style: var(--fc-forma-border-style);\n border-width: 4px\n}\n\n.fc-forma-Vpk {\n border-style: var(--fc-forma-border-style);\n border-width: 6px\n}\n\n.fc-forma-1Wx {\n border-inline-style: var(--fc-forma-border-style);\n border-inline-width: 1px\n}\n\n.fc-forma-8UH {\n border-inline-start-style: var(--fc-forma-border-style);\n border-inline-start-width: 1px\n}\n\n.fc-forma-iSi {\n border-inline-start-style: var(--fc-forma-border-style);\n border-inline-start-width: 4px\n}\n\n.fc-forma-riO {\n border-inline-start-style: var(--fc-forma-border-style);\n border-inline-start-width: 6px\n}\n\n.fc-forma-USt,\n.fc-forma-lzW {\n border-inline-end-style: var(--fc-forma-border-style);\n border-inline-end-width: 1px\n}\n\n.fc-forma-ku3,\n.fc-forma-u78 {\n border-top-style: var(--fc-forma-border-style);\n border-top-width: 1px\n}\n\n.fc-forma-tb8 {\n border-top-style: var(--fc-forma-border-style);\n border-top-width: 4px\n}\n\n.fc-forma-zi1 {\n border-bottom-style: var(--fc-forma-border-style);\n border-bottom-width: 1px\n}\n\n.fc-forma-TN2 {\n --fc-forma-border-style: dotted;\n border-style: dotted\n}\n\n.fc-forma-lNM {\n border-color: var(--fc-event-color)\n}\n\n.fc-forma-tfB {\n border-color: var(--fc-forma-border)\n}\n\n.fc-forma-MlZ {\n border-color: var(--fc-forma-muted-foreground)\n}\n\n.fc-forma-Baf {\n border-color: var(--fc-forma-primary)\n}\n\n.fc-forma-BST {\n border-color: var(--fc-forma-strong-border)\n}\n\n.fc-forma-d0j {\n border-color: #0000\n}\n\n.fc-forma-RJG {\n background-color: var(--fc-forma-background)\n}\n\n.fc-forma-zNL {\n background-color: var(--fc-forma-faint)\n}\n\n.fc-forma-rRL {\n background-color: var(--fc-forma-highlight)\n}\n\n.fc-forma-Wv4 {\n background-color: var(--fc-forma-muted)\n}\n\n.fc-forma-7I6 {\n background-color: var(--fc-forma-primary)\n}\n\n@media not print {\n @supports (color:color-mix(in lab, red, red)) {\n .fc-forma-gTC {\n background-color: color-mix(in oklab, var(--fc-event-color)15%, transparent)\n }\n }\n @supports not (color:color-mix(in lab, red, red)) {\n .fc-forma-gTC {\n position: relative;\n isolation: isolate\n }\n .fc-forma-gTC:before {\n content: '';\n position: absolute;\n inset: 0;\n background-color: var(--fc-event-color);\n opacity: 0.15;\n z-index: -1\n }\n }\n}\n\n.fc-forma-lrD {\n background-color: var(--fc-event-color);\n color: var(--fc-event-contrast-color)\n}\n\n@supports (color:color-mix(in lab, red, red)) {\n .fc-forma-lrD {\n background-color: color-mix(in oklab, var(--fc-event-color)20%, var(--fc-forma-background));\n color: inherit\n }\n}\n\n.fc-forma-i6P {\n background-color: var(--fc-event-color);\n color: var(--fc-event-contrast-color)\n}\n\n@supports (color:color-mix(in lab, red, red)) {\n .fc-forma-i6P {\n background-color: color-mix(in oklab, var(--fc-event-color)30%, var(--fc-forma-background));\n color: inherit\n }\n}\n\n.fc-forma-KUX {\n padding: 2px\n}\n\n.fc-forma-iS4 {\n padding: 4px\n}\n\n.fc-forma-3N5 {\n padding: 8px\n}\n\n.fc-forma-IJJ {\n padding: 12px\n}\n\n.fc-forma-lqx {\n padding: 16px\n}\n\n.fc-forma-7A6 {\n padding: 1px\n}\n\n.fc-forma-oQ2 {\n padding-inline: 2px\n}\n\n.fc-forma-aCI {\n padding-inline: 4px\n}\n\n.fc-forma-Nca {\n padding-inline: 8px\n}\n\n.fc-forma-Apf {\n padding-inline: 12px\n}\n\n.fc-forma-2rx {\n padding-block: 2px\n}\n\n.fc-forma-Jhn {\n padding-block: 4px\n}\n\n.fc-forma-End {\n padding-block: 6px\n}\n\n.fc-forma-dl6 {\n padding-block: 8px\n}\n\n.fc-forma-P9h {\n padding-block: 60px\n}\n\n.fc-forma-s0x {\n padding-block: 3px\n}\n\n.fc-forma-z5u {\n padding-block: 1px\n}\n\n.fc-forma-a7i {\n padding-inline-start: 2px\n}\n\n.fc-forma-C2j {\n padding-inline-start: 4px\n}\n\n.fc-forma-166 {\n padding-top: 2px\n}\n\n.fc-forma-4dx {\n padding-top: 4px\n}\n\n.fc-forma-cM0 {\n padding-bottom: 16px\n}\n\n.fc-forma-2HE {\n text-align: end\n}\n\n.fc-forma-vQz {\n font-size: 11px;\n line-height: 1.09091\n}\n\n.fc-forma-9ZS {\n font-size: 18px;\n line-height: calc(1.75/1.125)\n}\n\n.fc-forma-1Po {\n font-size: 16px;\n line-height: calc(1.5/1)\n}\n\n.fc-forma-9yp {\n font-size: 14px;\n line-height: calc(1.25/.875)\n}\n\n.fc-forma-2rA {\n font-size: 20px;\n line-height: calc(1.75/1.25)\n}\n\n.fc-forma-a3B {\n font-size: 12px;\n line-height: calc(1/.75)\n}\n\n.fc-forma-DIS {\n font-weight: 700\n}\n\n.fc-forma-1OT {\n font-weight: 500\n}\n\n.fc-forma-C8a {\n font-weight: 600\n}\n\n.fc-forma-IPx {\n text-overflow: ellipsis\n}\n\n.fc-forma-TZ4 {\n white-space: nowrap\n}\n\n.fc-forma-jm6 {\n white-space: pre\n}\n\n.fc-forma-b7K {\n color: var(--fc-forma-foreground)\n}\n\n.fc-forma-cOV {\n color: var(--fc-forma-faint-foreground)\n}\n\n.fc-forma-V1v {\n color: var(--fc-forma-muted-foreground)\n}\n\n.fc-forma-TSf {\n color: var(--fc-forma-primary-foreground)\n}\n\n.fc-forma-L1Y {\n font-style: italic\n}\n\n.fc-forma-lMo {\n opacity: .5\n}\n\n.fc-forma-iTG {\n opacity: .75\n}\n\n.fc-forma-1kP {\n box-shadow: 0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a\n}\n\n.fc-forma-tkw {\n box-shadow: 0 4px 6px -1px #0000001a, 0 2px 4px -2px #0000001a\n}\n\n.fc-forma-eSM {\n box-shadow: 0 1px 2px 0 #0000000d\n}\n\n.fc-forma-A3h {\n box-shadow: 0 0 0 1px var(--fc-forma-ring-color, currentcolor)\n}\n\n.fc-forma-GBJ {\n box-shadow: 0 0 0 2px var(--fc-forma-ring-color, currentcolor)\n}\n\n.fc-forma-c3P {\n --fc-forma-ring-color: var(--fc-forma-background)\n}\n\n.fc-forma-2R2 {\n outline-style: solid;\n outline-width: 1px\n}\n\n.fc-forma-0Bj {\n outline-style: solid;\n outline-width: 2px\n}\n\n.fc-forma-07j {\n outline-offset: -1px\n}\n\n.fc-forma-fFh {\n outline-offset: -2px\n}\n\n.fc-forma-3Xj {\n outline-offset: 2px\n}\n\n.fc-forma-Fmy {\n outline-color: var(--fc-forma-primary)\n}\n\n.fc-forma-mr2 {\n background: linear-gradient(var(--fc-forma-strong), var(--fc-forma-strong))var(--fc-forma-background)\n}\n\n.fc-forma-iCr:not(:last-child) {\n border-bottom-style: var(--fc-forma-border-style);\n border-bottom-width: 1px\n}\n\n@media not print {\n .fc-forma-530 {\n padding-block: 1px\n }\n\n .fc-forma-ZNR {\n padding-inline-end: 1px\n }\n\n .fc-forma-jVY {\n padding-top: 1px\n }\n\n .fc-forma-K3J {\n padding-bottom: 1px\n }\n}\n\n@media (hover:hover) {\n .fc-forma-vs6:is(:where(.fc-forma-bCs):hover *) {\n display: block\n }\n\n .fc-forma-sS4:is(:where(.fc-forma-bCs):hover *) {\n color: var(--fc-forma-primary)\n }\n\n .fc-forma-Ogp:is(:where(.fc-forma-bCs):hover *) {\n text-decoration-line: underline\n }\n}\n\n.fc-forma-Di9:is(:where(.fc-forma-bCs):focus-visible *) {\n color: var(--fc-forma-primary)\n}\n\n@media (hover:hover) {\n .fc-forma-cBw:hover {\n border-color: var(--fc-forma-strong-border)\n }\n\n .fc-forma-ShG:hover {\n background-color: var(--fc-forma-muted)\n }\n\n .fc-forma-2Qu:hover {\n background-color: var(--fc-forma-primary-over)\n }\n\n .fc-forma-mcn:hover {\n background-color: var(--fc-forma-strong)\n }\n\n .fc-forma-rom:hover {\n background-color: var(--fc-event-color)\n }\n\n @supports (color:color-mix(in lab, red, red)) {\n .fc-forma-rom:hover {\n background-color: color-mix(in oklab, var(--fc-event-color)25%, var(--fc-forma-background))\n }\n }\n\n .fc-forma-SWh:hover {\n background-color: var(--fc-event-color)\n }\n\n @supports (color:color-mix(in lab, red, red)) {\n .fc-forma-SWh:hover {\n background-color: color-mix(in oklab, var(--fc-event-color)35%, var(--fc-forma-background))\n }\n }\n\n .fc-forma-Eu0:hover {\n text-decoration-line: underline\n }\n\n .fc-forma-Vyz:hover {\n background: linear-gradient(var(--fc-forma-stronger), var(--fc-forma-stronger))var(--fc-forma-background)\n }\n}\n\n.fc-forma-nge:focus-visible {\n background-color: var(--fc-forma-muted)\n}\n\n.fc-forma-lgp:focus-visible {\n background-color: var(--fc-forma-primary-over)\n}\n\n.fc-forma-uqo:focus-visible {\n outline-style: solid;\n outline-width: 2px\n}\n\n.fc-forma-PQx:active {\n background-color: var(--fc-forma-primary-down)\n}\n\n.fc-forma-rKU:active {\n background-color: var(--fc-forma-strong)\n}\n\n.fc-forma-0sn:active {\n background-color: var(--fc-forma-stronger)\n}\n\n.fc-forma-DUE:active {\n background-color: var(--fc-event-color)\n}\n\n@supports (color:color-mix(in lab, red, red)) {\n .fc-forma-DUE:active {\n background-color: color-mix(in oklab, var(--fc-event-color)30%, var(--fc-forma-background))\n }\n}\n\n.fc-forma-RHy:active {\n background-color: var(--fc-event-color)\n}\n\n@supports (color:color-mix(in lab, red, red)) {\n .fc-forma-RHy:active {\n background-color: color-mix(in oklab, var(--fc-event-color)40%, var(--fc-forma-background))\n }\n}\n\n.fc-forma-pgt:active {\n background: linear-gradient(var(--fc-forma-strongest), var(--fc-forma-strongest))var(--fc-forma-background)\n}\n\n@media print {\n .fc-forma-2dx {\n border-block-style: var(--fc-forma-border-style);\n border-block-width: 1px\n }\n\n .fc-forma-9wT {\n border-inline-end-style: var(--fc-forma-border-style);\n border-inline-end-width: 1px\n }\n\n .fc-forma-Qex {\n border-top-style: var(--fc-forma-border-style);\n border-top-width: 1px\n }\n\n .fc-forma-wZV {\n border-bottom-style: var(--fc-forma-border-style);\n border-bottom-width: 1px\n }\n\n .fc-forma-jsy {\n border-width: 1px\n }\n\n .fc-forma-DO7 {\n border-color: var(--fc-event-color)\n }\n\n .fc-forma-4MR {\n border-color: #000\n }\n\n .fc-forma-vwH {\n background-color: #fff\n }\n}\n\n[dir=rtl] .fc-forma-qIw {\n rotate: -45deg\n}\n\n[dir=rtl] .fc-forma-keW {\n rotate: -90deg\n}\n\n[dir=rtl] .fc-forma-jY6 {\n rotate: none\n}\n\n[dir=rtl] .fc-forma-vk6 {\n rotate: 45deg\n}\n\n[dir=rtl] .fc-forma-ZW3 {\n rotate: 90deg\n}\n\n[dir=rtl] .fc-forma-asP {\n rotate: 180deg\n}\n","// FullCalendar's stylesheets, carried as text and added to the page when a calendar first renders.\n// Leaving them as imports would hand them to the consumer's bundler, which a library build — a\n// samples bundle, a design system — pulls out into a stylesheet nobody loads.\nimport skeleton from '@fullcalendar/react/skeleton.css';\nimport formaTheme from '@fullcalendar/react/themes/forma/theme.css';\nimport { ensureStyleSheet } from './core/index.js';\n\nconst STYLE_ID = 'ppp-calendar-fullcalendar-styles';\n\n/** Adds FullCalendar's skeleton and Forma theme stylesheets to the document once. */\nexport function ensureFullCalendarStyles(document: Document): void {\n ensureStyleSheet(document, STYLE_ID, `${skeleton}\\n${formaTheme}`);\n}\n","import { replaceQueryParam } from '@powerportalspro/react';\nimport { calendarLayouts, type CalendarLayout } from './core/index.js';\n\n/**\n * Wire shape for `<Calendar persistedStateQueryParameter>`: a JSON object in one URL query\n * parameter, as the grid keeps its state, with the grid's keys for what the two share (`v`, `q`).\n * Kept in lockstep with the Blazor Calendar's `PersistedState` — same keys, same values, same\n * order — so a link made on one stack opens the same calendar on the other. Update both sides\n * together.\n */\nexport interface PersistedCalendarState {\n /** The calendar's layout. Omitted while it is the one the calendar opens in. */\n l?: CalendarLayout;\n /** A local date in the middle of the period shown (`2026-11-04`). Omitted while it takes in today. */\n d?: string;\n /** The appointment view picked, by its id (lowercase). Omitted while it is the one the calendar opens on. */\n v?: string;\n /** The search, when the calendar keeps it. */\n q?: string;\n}\n\nconst DATE = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\nconst GUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\n/** Whether a value is a real local date in the `yyyy-mm-dd` form the URL keeps. */\nfunction isDate(value: unknown): value is string {\n if (typeof value !== 'string') return false;\n const match = DATE.exec(value);\n if (!match) return false;\n const [year, month, day] = [Number(match[1]), Number(match[2]), Number(match[3])];\n const date = new Date(year, month - 1, day);\n return date.getFullYear() === year && date.getMonth() === month - 1 && date.getDate() === day;\n}\n\n/**\n * The state the named query parameter holds, or an empty one when it is missing or can't be read.\n * A layout that isn't one, a date that isn't one or a view id that isn't a GUID is left out, so the\n * calendar opens as it would anyway. (Whether the calendar offers the layout is the calendar's to judge.)\n */\nexport function readPersistedCalendarState(queryParameterName: string | undefined): PersistedCalendarState {\n if (!queryParameterName || typeof window === 'undefined') return {};\n const raw = new URLSearchParams(window.location.search).get(queryParameterName);\n if (!raw) return {};\n try {\n const parsed = JSON.parse(raw) as unknown;\n if (!parsed || typeof parsed !== 'object') return {};\n const { l, d, v, q } = parsed as Record<string, unknown>;\n const state: PersistedCalendarState = {};\n if (calendarLayouts.includes(l as CalendarLayout)) state.l = l as CalendarLayout;\n if (isDate(d)) state.d = d;\n if (typeof v === 'string' && GUID.test(v)) state.v = v.toLowerCase();\n if (typeof q === 'string' && q.trim()) state.q = q;\n return state;\n } catch {\n return {};\n }\n}\n\n/** The state's canonical form in the URL, or null when there is nothing to keep. */\nexport function encodePersistedCalendarState(state: PersistedCalendarState): string | null {\n const compact: PersistedCalendarState = {};\n if (state.l) compact.l = state.l;\n if (state.d) compact.d = state.d;\n if (state.v) compact.v = state.v;\n if (state.q?.trim()) compact.q = state.q;\n return Object.keys(compact).length > 0 ? JSON.stringify(compact) : null;\n}\n\n/**\n * Writes the state to the named query parameter, or takes the parameter away when there is nothing\n * to keep, as a grid writes its state. It replaces the history entry, so Back leaves the page rather\n * than stepping back through every week shown, and writes nothing when the URL already holds it.\n */\nexport function writePersistedCalendarState(queryParameterName: string | undefined, state: PersistedCalendarState): void {\n if (!queryParameterName) return;\n replaceQueryParam(queryParameterName, encodePersistedCalendarState(state) ?? undefined);\n}\n","import {\n makeStyles,\n mergeClasses,\n Menu,\n MenuButton,\n MenuItemRadio,\n MenuList,\n MenuPopover,\n MenuTrigger,\n MessageBar,\n MessageBarBody,\n Spinner,\n Text,\n ToolbarButton,\n tokens,\n useThemeClassName,\n type MenuProps,\n} from '@fluentui/react-components';\nimport {\n ArrowRepeatAllRegular,\n ChevronLeftRegular,\n ChevronRightRegular,\n} from '@fluentui/react-icons';\nimport FullCalendar, {\n useCalendarController,\n type EventChangeInfo,\n type EventDisplayInfo,\n type EventSourceFuncInfo,\n} from '@fullcalendar/react';\nimport dayGridPlugin from '@fullcalendar/react/daygrid';\nimport interactionPlugin from '@fullcalendar/react/interaction';\nimport listPlugin from '@fullcalendar/react/list';\nimport timeGridPlugin from '@fullcalendar/react/timegrid';\nimport formaTheme from '@fullcalendar/react/themes/forma';\nimport {\n MultiTableUses,\n defaultViewId as userDefaultViewId,\n savedViewControl,\n SavedViewControlKind,\n shownViewTables,\n isViewHidden,\n MultiTableSeries,\n MultiTableViewType,\n TableSecurityPermission,\n type MultiTableFailure,\n type MultiTableItem,\n type MultiTableRangeRequest,\n type MultiTableTablesResponse,\n type MultiTableViewDefinition,\n type MultiTableViewTable,\n type TableRecord,\n type TableRecordReference,\n type ViewMetadata,\n} from '@powerportalspro/core';\nimport {\n useDialogService,\n useLocale,\n useLocalization,\n usePowerPortalsPro,\n usePrefixedT,\n useT,\n useUserTimeZone,\n} from '@powerportalspro/react';\nimport {\n everyRow,\n EVERY_TABLE_VIEW_ID,\n MultiTableFilterDialog,\n MultiTableRecordPanel,\n SavedViewDialogs,\n useMultiTableTableSet,\n useMultiTableViews,\n useSavedViews,\n useSavedViewSession,\n ViewFilterMenu,\n ViewLoadMessages,\n viewLabelOf,\n ViewPicker,\n ViewRefreshButton,\n ViewSearchBox,\n ViewSort,\n ViewToolbar,\n type GridManagedView,\n type MultiTableForms,\n} from '@powerportalspro/react-fluent';\nimport { useCallback, useEffect, useMemo, useRef, useState, type CSSProperties, type ReactNode } from 'react';\nimport { appointmentToOpen, type OpenAppointment } from './appointment-click.js';\nimport { CalendarContext, type CalendarContextValue, type CalendarRange } from './calendar-context.js';\nimport { AppointmentDetailsDialog, RecurringChoiceDialog } from './appointment-details.js';\nimport type { CalendarAppointment } from './calendar-appointment.js';\nimport { AppointmentSummaryContent, AppointmentTooltip } from './appointment-tooltip.js';\nimport { newAppointment } from './appointment-record.js';\nimport {\n findCustomView,\n offeredViewIds,\n offersViews,\n readSavedLayout,\n selectedViewId,\n withSavedViews,\n writeSavedLayout,\n} from './calendar-query.js';\nimport {\n APPOINTMENT_TABLE,\n CALENDAR_COLUMNS,\n DEFAULT_CALENDAR_TABLES,\n drawnTimes,\n fromMultiTableItem,\n moveRecord,\n SERIES_TABLE,\n} from './calendar-rows.js';\nimport { ensureFullCalendarStyles } from './fullcalendar-styles.js';\nimport {\n appointmentFromEvent,\n calendarOptions,\n ensureCalendarStyles,\n fromFullCalendarView,\n isCompactView,\n newAppointmentRange,\n offeredLayouts,\n openingLayout,\n periodDate,\n summarizeAppointment,\n toAppointmentChange,\n toEventInput,\n toFullCalendarView,\n type CalendarAppointmentChange,\n type CalendarLayout,\n} from './core/index.js';\nimport {\n readPersistedCalendarState,\n writePersistedCalendarState,\n} from './persisted-calendar-state.js';\n\nconst plugins = [formaTheme, dayGridPlugin, timeGridPlugin, listPlugin, interactionPlugin];\n\nconst layoutKeys: Record<CalendarLayout, string> = {\n day: 'layouts.day',\n workWeek: 'layouts.work-week',\n week: 'layouts.week',\n month: 'layouts.month',\n agenda: 'layouts.agenda',\n};\n\nconst useStyles = makeStyles({\n root: {\n display: 'flex',\n flexDirection: 'column',\n gap: tokens.spacingVerticalS,\n minHeight: 0,\n },\n // The period and the moves through it, kept together.\n navigation: {\n display: 'flex',\n alignItems: 'center',\n gap: tokens.spacingHorizontalXS,\n minWidth: 0,\n },\n title: {\n flex: '0 1 auto',\n minWidth: 0,\n // A heading, which a page's own styles may give margins: none above or below, so it stays\n // centered on the toolbar's buttons.\n marginTop: 0,\n marginBottom: 0,\n marginInlineStart: tokens.spacingHorizontalS,\n fontSize: tokens.fontSizeBase400,\n fontWeight: tokens.fontWeightSemibold,\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n },\n search: {\n width: '220px',\n maxWidth: '100%',\n },\n // The appointments, and the overlay over them while a range loads.\n body: {\n position: 'relative',\n flex: 1,\n minHeight: 0,\n display: 'flex',\n flexDirection: 'column',\n },\n surface: {\n flex: 1,\n minHeight: 0,\n },\n // As a grid's loading overlay: the appointments dimmed under a spinner.\n loadingOverlay: {\n position: 'absolute',\n inset: 0,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n zIndex: 4,\n '::before': {\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n backgroundColor: tokens.colorNeutralBackground2,\n opacity: 0.7,\n zIndex: -1,\n },\n },\n visuallyHidden: {\n position: 'absolute',\n width: '1px',\n height: '1px',\n margin: '-1px',\n padding: 0,\n overflow: 'hidden',\n clip: 'rect(0 0 0 0)',\n whiteSpace: 'nowrap',\n border: 0,\n },\n});\n\n/** Where a {@link Calendar} opens an appointment's details and another table's form. */\nexport type CalendarFormLocation = 'center' | 'left' | 'right';\n\nexport interface CalendarProps {\n /**\n * The appointments to show, when the host has them. Without it, the calendar loads the rows of\n * each range it shows from Dataverse — appointments, tasks and the other tables the server\n * registered — as the view picked, {@link regarding} and the user's access allow.\n */\n appointments?: readonly CalendarAppointment[];\n /**\n * Only the rows about this record, when the calendar loads its own: through each table's\n * regarding column, and the activities it takes part in (see {@link matchParties}).\n */\n regarding?: TableRecordReference;\n /**\n * The tables the calendar may show, by logical name: of those the server registered\n * (`AddMultiTableSource`, or notes and activities by default) and the user may read. Every one when\n * omitted.\n */\n tables?: readonly string[];\n /**\n * The tables shown at first when the calendar shows every table — no view of its own: the others\n * the user may read are offered in the table menu, switched off. Defaults to appointments and tasks.\n * With none of them to show, every table is.\n */\n defaultTables?: readonly string[];\n /**\n * Dataverse views the user can pick from, by id: each shows its own table's rows that it picks.\n * With more than one view on offer — these, {@link multiTableViewIds} and\n * {@link customViewDefinitions} — the toolbar has a picker. With none, the calendar shows every\n * table (see {@link defaultTables}).\n */\n viewIds?: readonly string[];\n /**\n * Views of several tables the user can pick from: ones the server registered (`AddMultiTableView`)\n * or kept in Dataverse (`ppp_multitableview`), by id.\n */\n multiTableViewIds?: readonly string[];\n /**\n * The view the calendar opens on, one of those offered. Without it, the first of {@link viewIds},\n * then of {@link multiTableViewIds}, then of {@link customViewDefinitions}.\n */\n defaultViewId?: string;\n /**\n * Views defined in code, of one table or several, offered beside {@link viewIds}: each table with\n * which of its rows show.\n */\n customViewDefinitions?: readonly MultiTableViewDefinition[];\n /**\n * Whether activities the {@link regarding} record takes part in — as a sender, recipient or\n * attendee — show beside those about it. Unset, each table's setting, else the server's.\n */\n matchParties?: boolean;\n /** How recurring appointments show. Unset, each table's setting: each occurrence on its own. */\n series?: MultiTableSeries;\n /**\n * Draws a table's rows the page's own way, by logical name: the row, with the whole record read in\n * its `record`, in place of all the calendar draws of it — its time, subject, place and repeat icon.\n * For the rows the calendar loads, not `appointments` the host gives it. A row is drawn as its range\n * is read, so a change to what a template shows reaches it with the next range or refresh.\n */\n templates?: Readonly<Record<string, (item: MultiTableItem) => ReactNode>>;\n /**\n * The forms a row of another table than appointments opens in, by table, in place of the default\n * one: `{ task: { edit: TaskForm } }`.\n */\n forms?: Readonly<Record<string, MultiTableForms>>;\n /**\n * Where an appointment's details and another table's form open: a dialog in the `center` (the\n * default), or a side panel on the `left` or the `right`.\n */\n formLocation?: CalendarFormLocation;\n /** The order of the views in the picker. Defaults to `ViewSort.NameAscending`. */\n viewSort?: ViewSort;\n /**\n * When `true`, the toolbar has a Filter button, which opens the view's filters to change, as a\n * grid's does — a tab for each table shown: conditions on its columns, nested in groups, and\n * related tables to filter by — every filter FetchXML can express, over the columns and tables the\n * user may read. The changes last while the calendar shows the view; another view starts from its\n * own filters. Not offered for {@link appointments} the host gives the calendar, nor for a view of\n * several tables kept in Dataverse. Defaults to `false`: the user can take away every filter the\n * view has, which a view meant to narrow a page's rows may not want.\n */\n allowFiltering?: boolean;\n /**\n * Lets signed-in users save the calendar as they've arranged it — the view it shows with their\n * filter, and its layout — as views of their own, offered in the view picker beside the page's,\n * and choose their default view and hide the views they don't use. A view saved on a calendar or a\n * grid of appointments with no {@link savedViewsKey} is offered on both, each keeping its own\n * layout of it. Off by default. Needs the Power Portals Pro Core solution's saved-view tables; an\n * internal user also needs the `Power Portals Pro Saved Views` security role.\n */\n allowSavedViews?: boolean;\n /**\n * Names this calendar among the controls of appointments, so the views saved on it and the user's\n * default and hidden views are its own: it offers the views saved on it as well as the views saved on\n * controls with no key, and its default and hidden views are set for it alone. Without one, the\n * calendar shares its views with every grid and calendar of appointments that has none, and its\n * default and hidden views with every calendar that has none. Letters, digits, `-`, `_` and `.`.\n */\n savedViewsKey?: string;\n /**\n * Where a user who isn't signed in is sent to sign in, from the saved views' menu, which asks them\n * to first; they come back to this page (`ReturnUrl`). Defaults to `/Account/Login`.\n */\n signInUrl?: string;\n /**\n * Whether the toolbar has a search box, when the calendar loads its own appointments. A search\n * finds each table's search columns as a grid's search does. Defaults to `true`.\n */\n allowSearch?: boolean;\n /**\n * Whether the search is kept in the URL with the rest of the calendar's state. Off by default:\n * what users search for can be sensitive, and stays in the browser's history and in referrers.\n * Has no effect without {@link persistedStateQueryParameter}.\n */\n includeSearchInPersistedState?: boolean;\n /**\n * The layout it opens in: the hours of a `day`, a `workWeek` or a `week`, a `month` of days, or an\n * `agenda` list. Defaults to `week`; the first of {@link layouts} when that leaves it out.\n */\n defaultLayout?: CalendarLayout;\n /**\n * The layouts the user can switch between, in the order the picker lists them. With one, the\n * picker is hidden and the calendar stays in it: a link naming another is ignored, and a day's\n * number no longer opens that day unless `day` is offered. Every layout when omitted.\n */\n layouts?: readonly CalendarLayout[];\n /**\n * Whether appointments can be moved, resized and created by selecting a range. A loaded row can be\n * moved when the user may change it and its start, and it isn't closed — completed, canceled or\n * inactive; resized when they may change its end too. The calendar saves the move, unless\n * {@link onAppointmentChange} does.\n */\n editable?: boolean;\n /**\n * Whether an appointment's details link to its page, and its Regarding to the record's page,\n * registered with `AddRecordPage`. Default `true`; a table with no page shows no link. The Blazor\n * Calendar's `ShowRecordLinks` is its twin.\n */\n showRecordLinks?: boolean;\n /**\n * Follows those links in the app — `(url) => navigate(url)` for react-router — on a plain click.\n * Without it, and for a click that opens a new tab, the browser follows them.\n */\n onNavigate?: (url: string) => void;\n /**\n * The tables an appointment's Regarding can name a record of, in the order its form's table\n * picker lists them. Tables Regarding can't point to are ignored. Every one it can when omitted;\n * either way, only the tables whose records the user may read and point a lookup to are offered.\n * The Blazor Calendar's\n * `RegardingTables` is its twin.\n */\n regardingTables?: readonly string[];\n /** Height of the whole calendar, toolbar included. Defaults to `600px`. */\n height?: CSSProperties['height'];\n /**\n * An appointment was clicked or activated from the keyboard. Without it, an appointment the\n * calendar loaded opens in a dialog of its details.\n */\n onAppointmentClick?: (id: string) => void;\n /**\n * The fields the details dialog shows, in place of the calendar's own: column edits and the like,\n * read from the appointment's record as on a record page. The calendar's own show when it is,\n * where, what it is regarding, its status and its description, read-only.\n */\n appointmentDetails?: ReactNode;\n /**\n * What an appointment's tooltip shows, in place of its subject, when, where and whether it\n * repeats: given the appointment, whose `record` holds every column of the view for one the\n * calendar loaded. A tooltip isn't interactive, so it shows what this draws, not controls to use.\n */\n appointmentTooltip?: (appointment: CalendarAppointment) => ReactNode;\n /** A range was selected to create an appointment in, or a New button clicked. */\n onRangeSelect?: (range: CalendarRange) => void;\n /**\n * An appointment was moved or resized. Resolve false to put it back, as when the save is\n * refused.\n */\n onAppointmentChange?: (change: CalendarAppointmentChange) => boolean | Promise<boolean>;\n /** The visible range changed, by navigation or a change of layout. */\n onRangeChange?: (range: { start: Date; end: Date; layout: CalendarLayout }) => void;\n /**\n * Controls for the toolbar: `<CalendarButton>`s, such as `<NewAppointmentCalendarButton>`, or any\n * other element. They appear in the order given, ahead of the search box, as a grid's toolbar\n * buttons do, and read the calendar through `useCalendarContext`. The Blazor Calendar's\n * `ToolbarItems` is its twin.\n */\n children?: ReactNode;\n /**\n * The name of a URL query parameter to keep the calendar's state in — its layout, the period it\n * shows, the appointment view picked and (with {@link includeSearchInPersistedState}) the search —\n * so a reload or a link opens it where it was left. Each change replaces the browser's history\n * entry rather than adding one. What the calendar would open on anyway is left out: the layout\n * while it is the one it opens in, the appointment view while it is the default one, and the date while\n * the period shown takes in today, so a link to the current week keeps following today. The URL is\n * read once, when the calendar opens; a value it can't read is ignored.\n *\n * The Blazor Calendar keeps the same value, so a link made on one stack opens the same calendar\n * on the other.\n */\n persistedStateQueryParameter?: string;\n}\n\n/**\n * An Outlook-style calendar of appointments — and of tasks and any other table it is given — laid out\n * by day, week or month, or as an agenda.\n */\nexport function Calendar({\n appointments,\n regarding,\n tables,\n defaultTables = DEFAULT_CALENDAR_TABLES,\n viewIds,\n multiTableViewIds,\n defaultViewId,\n customViewDefinitions,\n matchParties,\n series,\n templates,\n forms,\n formLocation = 'center',\n viewSort = ViewSort.NameAscending,\n allowFiltering = false,\n allowSavedViews = false,\n savedViewsKey,\n signInUrl = '/Account/Login',\n allowSearch = true,\n includeSearchInPersistedState = false,\n defaultLayout = 'week',\n layouts,\n editable = false,\n showRecordLinks = true,\n onNavigate,\n regardingTables,\n height = '600px',\n onAppointmentClick,\n appointmentDetails,\n appointmentTooltip,\n onRangeSelect,\n onAppointmentChange,\n onRangeChange,\n persistedStateQueryParameter,\n children,\n}: CalendarProps) {\n const styles = useStyles();\n const dialog = useDialogService();\n const dialogLocation = formLocation === 'left' ? 'panel-left' : formLocation === 'right' ? 'panel' : 'center';\n const t = usePrefixedT('app.components.calendar');\n const tAll = useT();\n // The calendar shows its times and days in the user's zone, as the portal shows every date.\n const timeZone = useUserTimeZone();\n const { locale } = useLocale();\n const { ppp, authState, tableMetadataCache, viewMetadataCache } = usePowerPortalsPro();\n // The zone comes with the session: the calendar waits for it rather than read and draw a range in\n // the browser's zone first, then again in the user's.\n const awaitsTimeZone = authState.status === 'loading';\n const controller = useCalendarController();\n const themeClassName = useThemeClassName();\n const [direction, setDirection] = useState<'ltr' | 'rtl'>('ltr');\n const [loading, setLoading] = useState(false);\n const [failed, setFailed] = useState(false);\n const [truncated, setTruncated] = useState(false);\n // Where a link or a reload left the calendar, read once.\n const [persisted] = useState(() => readPersistedCalendarState(persistedStateQueryParameter));\n // The layouts on offer; the one the calendar opens in with no link, which the URL leaves out; and\n // the one it opens in now, a link's while that is on offer.\n const layoutsKey = (layouts ?? []).join(',');\n // The key covers the list's content, so a list passed inline doesn't rebuild it each render.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const layoutsOffered = useMemo(() => offeredLayouts(layouts), [layoutsKey]);\n // The user's own views, kept where a grid keeps its saved views, under the calendar's key.\n const savedViewsControl = useMemo(\n () => savedViewControl(SavedViewControlKind.Calendar, allowSavedViews ? savedViewsKey : undefined),\n [allowSavedViews, savedViewsKey],\n );\n const saved = useSavedViews({\n enabled: allowSavedViews && !appointments,\n tableName: APPOINTMENT_TABLE,\n control: savedViewsControl,\n });\n // The user's views of several tables, offered beside their views of appointments.\n const multiSaved = useMultiTableViews({ enabled: allowSavedViews && !appointments && saved.available, control: savedViewsControl });\n // Whether the view the calendar opens on is known: the user, and then their views, read.\n // Once known it stays known: saved views read again later — after a sign-in, for another key —\n // don't take the calendar off the page.\n const settledRef = useRef(false);\n if (!awaitsTimeZone && !saved.loading && !multiSaved.loading) settledRef.current = true;\n const viewSettled = settledRef.current;\n const findSaved = (id: string | undefined) => (id ? saved.views.find((x) => x.id.toLowerCase() === id.toLowerCase()) : undefined);\n const findSavedMulti = (id: string | undefined) =>\n id ? multiSaved.views.find((x) => x.id.toLowerCase() === id.toLowerCase()) : undefined;\n // Every view the user saved, of appointments or of several tables, by id.\n const savedIds = useMemo(\n () => [...saved.views.map((x) => x.id), ...multiSaved.views.map((x) => x.id)],\n [saved.views, multiSaved.views],\n );\n // The layout a saved view opens in, as kept.\n const savedCalendarLayout = (id: string | undefined) => findSaved(id)?.calendarLayout ?? findSavedMulti(id)?.calendarLayout;\n\n // The views on offer, and the one shown: what the user picked, or a link named, while it is on\n // offer. With none of the page's, the view of every table.\n const viewIdsKey = (viewIds ?? []).join(',');\n const multiTableKey = (multiTableViewIds ?? []).map((id) => id.toLowerCase()).join(',');\n const customViewsKey = JSON.stringify(customViewDefinitions ?? []);\n const isMultiTableView = (id: string | undefined) => !!id && multiTableKey.split(',').includes(id.toLowerCase());\n const pageViews = useMemo(\n () => offeredViewIds(defaultViewId, viewIds, multiTableViewIds, customViewDefinitions),\n // The keys cover the lists' content, so lists passed inline don't rebuild it each render.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [defaultViewId, viewIdsKey, multiTableKey, customViewsKey],\n );\n const [pickedViewId, setPickedViewId] = useState(persisted.v);\n // The view the calendar opened on, kept while the user picks none, so a default made or a view\n // hidden in Manage views doesn't change the one shown.\n const openedViewRef = useRef<string | undefined>(undefined);\n const shownViewId = pickedViewId ?? openedViewRef.current;\n const offered = useMemo(\n () => withSavedViews(pageViews, savedIds, saved.settings, savedViewsControl, shownViewId, saved.available),\n [pageViews, savedIds, saved.settings, savedViewsControl, shownViewId, saved.available],\n );\n const viewId = selectedViewId(offered, shownViewId);\n if (viewSettled) openedViewRef.current ??= viewId;\n\n // The tables it reads, as a timeline reads them: those registered that the user may read, the ones\n // the view shown shows, the ones the user switched off in it, and their filter of it — kept for the\n // view it was made in, in memory rather than the URL, as a filter can be any length: another view\n // starts from its own, and so does this one when the calendar comes back to it.\n const tableSet = useMultiTableTableSet({ use: MultiTableUses.Calendar, viewId, tables, defaultTables });\n\n // The layout the calendar opens in, once the view it opens on is known: a link's, a saved view's\n // own, or the page's.\n const openingLayoutRef = useRef<CalendarLayout | undefined>(undefined);\n if (openingLayoutRef.current === undefined && viewSettled) {\n const savedLayout = persisted.l ? undefined : readSavedLayout(savedCalendarLayout(viewId));\n openingLayoutRef.current = openingLayout(layoutsOffered, persisted.l ?? savedLayout, defaultLayout);\n }\n const initialLayout = openingLayoutRef.current ?? openingLayout(layoutsOffered, persisted.l, defaultLayout);\n // The layout a view opens in: a saved view's own, else the calendar's.\n const viewOpeningLayout = (id: string | undefined) =>\n openingLayout(layoutsOffered, readSavedLayout(savedCalendarLayout(id)), defaultLayout);\n\n // The picker and the search box choose among the appointments the calendar loads, so neither is\n // offered for appointments the host gives it.\n const showsSearch = !appointments && allowSearch;\n // What is searched for, once typing pauses.\n const [search, setSearch] = useState(() => (includeSearchInPersistedState ? (persisted.q ?? '') : ''));\n\n // The views' labels — for a picker, and for the saved views' menu and panel, which name every view,\n // the hidden ones and the one a picker isn't shown for among them: a Dataverse view's strings are\n // loaded only when asked, and its name in Dataverse stands in for one it has none in.\n const picksViews = !appointments && offered.length > 1;\n const namesViews = picksViews || (!appointments && saved.available);\n const namedViewIds = saved.available ? [...new Set([...offered, ...pageViews])] : offered;\n const dataverseViewIds = namedViewIds.filter(\n (id) =>\n id !== EVERY_TABLE_VIEW_ID && !isMultiTableView(id) && !findCustomView(id, customViewDefinitions) && !findSaved(id) && !findSavedMulti(id),\n );\n useLocalization(namesViews ? dataverseViewIds.map((id) => `views.${id}`) : []);\n // What the labels are read from: the Dataverse views' metadata, and the names of the views of\n // several tables, the server's or kept in Dataverse — each read once.\n const [viewNames, setViewNames] = useState<{\n dataverse: ReadonlyMap<string, ViewMetadata | null>;\n multiTable: ReadonlyMap<string, string | null>;\n }>({ dataverse: new Map(), multiTable: new Map() });\n const multiTableIds = namedViewIds.filter(isMultiTableView);\n const namesKey = [...dataverseViewIds, '|', ...multiTableIds].join(',');\n useEffect(() => {\n if (!namesViews) return;\n let current = true;\n void (async () => {\n const dataverse = new Map(viewNames.dataverse);\n for (const id of dataverseViewIds.filter((x) => !dataverse.has(x)))\n dataverse.set(id, await viewMetadataCache.getAsync(id).catch(() => null));\n const multiTable = new Map(viewNames.multiTable);\n const missing = multiTableIds.filter((x) => !multiTable.has(x));\n if (missing.length > 0) {\n const registeredViews = (await tableSet.registeredAsync().catch(() => null))?.views ?? [];\n for (const id of missing) {\n const known = registeredViews.find((view) => view.id?.toLowerCase() === id);\n multiTable.set(id, known ? (known.name ?? null) : (await tableSet.storedViewName(id)).name);\n }\n }\n if (current) setViewNames({ dataverse, multiTable });\n })();\n return () => {\n current = false;\n };\n // `namesKey` covers the views to name; what is known is kept.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [namesViews, namesKey, ppp]);\n // A view's label; `null` while a Dataverse view's isn't known yet.\n const labelOf = (id: string): string | null => {\n if (id === EVERY_TABLE_VIEW_ID) return t('every-table');\n const custom = findCustomView(id, customViewDefinitions);\n if (custom) return custom.displayName?.trim() ? custom.displayName : id;\n // A view of several tables is no table's: its name is the user's.\n const ownMulti = findSavedMulti(id);\n if (ownMulti) return ownMulti.name;\n const own = findSaved(id);\n if (own) {\n const key = `tables.${APPOINTMENT_TABLE}.views.${id}.label`;\n const localized = tAll(key);\n return localized !== key ? localized : own.name;\n }\n if (isMultiTableView(id)) {\n if (!viewNames.multiTable.has(id)) return null;\n return viewNames.multiTable.get(id) ?? id;\n }\n if (!viewNames.dataverse.has(id)) return null;\n const metadata = viewNames.dataverse.get(id);\n // Named as a grid names a view: its label in the user's language, else its own names.\n return metadata ? viewLabelOf({ ...metadata, id }, tAll) : id;\n };\n // A choice of one where the user saves views: the picker is how they reach theirs.\n const showsSavedViewsMenu = allowSavedViews && !appointments && (saved.available || saved.needsSignIn);\n const viewOptions = useMemo(() => {\n if (offered.length < (showsSavedViewsMenu ? 1 : 2)) return [];\n // Not yet known: the picker waits rather than show an id.\n const labeled = offered.map((id) => {\n const label = labelOf(id);\n return label === null ? null : { id, label };\n });\n // In the order offered: the picker lists them in the calendar's `viewSort`.\n if (labeled.some((option) => option === null)) return [];\n return labeled as { id: string; label: string }[];\n // `customViewsKey` covers the custom views' content, `viewNames` the rest of the labels'.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [offered, customViewsKey, saved.views, multiSaved.views, viewNames, tAll, showsSavedViewsMenu]);\n const showsViewPicker = !appointments && viewOptions.length > (showsSavedViewsMenu ? 0 : 1);\n\n useEffect(() => {\n ensureFullCalendarStyles(document);\n ensureCalendarStyles(document);\n setDirection(document.dir === 'rtl' ? 'rtl' : 'ltr');\n }, []);\n\n const options = useMemo(\n () =>\n calendarOptions({\n layout: initialLayout,\n layouts: layoutsOffered,\n date: persisted.d,\n timeZone,\n editable,\n locale,\n direction,\n text: {\n allDay: t('all-day'),\n noEvents: t('no-events'),\n close: t('close'),\n more: (count) => t('more', [count]),\n },\n }),\n [initialLayout, layoutsOffered, persisted.d, timeZone, editable, locale, direction, t],\n );\n\n // The appointment whose details are open.\n const [openAppointment, setOpenAppointment] = useState<OpenAppointment | null>(null);\n // A recurring appointment clicked, until the user says whether to open it or its series; and the\n // series each occurrence on screen is of, by the occurrence's id.\n const [recurringChoice, setRecurringChoice] = useState<OpenAppointment | null>(null);\n const seriesOf = useRef(new Map<string, string>());\n // A new appointment, over a range selected in an editable calendar: when the user may create\n // appointments, about the regarding record by the name its lookup shows.\n const [creating, setCreating] = useState<TableRecord | null>(null);\n // Asked once per user and per regarding record, not on every selection; and the latest selection,\n // so one the user has moved on from (or a calendar no longer there) opens nothing.\n const mayCreate = useRef<{ user: string | null | undefined; answer: Promise<boolean> } | null>(null);\n const regardingName = useRef<{ key: string; name: Promise<string | null> } | null>(null);\n const latestStart = useRef(0);\n useEffect(() => () => void (latestStart.current = -1), []);\n const user = authState.status === 'authenticated' ? authState.user?.userId : null;\n const tablesKey = (tables ?? []).map((table) => table.trim().toLowerCase()).join(',');\n const allowedTables = tableSet.allowed;\n const mayCreateAppointments = () => {\n let asked = mayCreate.current;\n if (!asked || asked.user !== user) {\n asked = mayCreate.current = {\n user,\n // Only where the calendar may show appointments.\n answer: (allowedTables && !allowedTables.has(APPOINTMENT_TABLE)\n ? Promise.resolve(TableSecurityPermission.None)\n : ppp.retrieveTablePermissionsAsync(APPOINTMENT_TABLE))\n .then((permissions) => (Number(permissions) & TableSecurityPermission.Create) !== 0)\n .catch(() => {\n mayCreate.current = null;\n return false;\n }),\n };\n }\n return asked.answer;\n };\n const startAppointment = async (range: CalendarRange) => {\n const start = ++latestStart.current;\n if (!(await mayCreateAppointments())) return;\n\n let name: string | null = null;\n if (regarding?.id) {\n const key = `${regarding.tableName}:${regarding.id}`;\n if (regardingName.current?.key !== key) {\n regardingName.current = { key, name: readName(regarding.tableName, regarding.id) };\n }\n name = await regardingName.current.name;\n }\n if (start === latestStart.current) setCreating(newAppointment(range, regarding ? { ...regarding, name } : null));\n };\n // A record's name, as its lookup shows it: null when the user may not read it.\n const readName = async (tableName: string, id: string): Promise<string | null> => {\n try {\n const table = await tableMetadataCache.getAsync(tableName);\n if (!table) return null;\n const record = await ppp.retrieveRecordAsync(tableName, id, [table.primaryNameColumn]);\n const value = (record.properties?.[table.primaryNameColumn] as { value?: unknown } | undefined)?.value;\n return typeof value === 'string' ? value : null;\n } catch {\n return null;\n }\n };\n\n // Each appointment — drawn by the page's template for its row's table, or the calendar's own way —\n // with its tooltip: what it is, when, where and whether it repeats, or the host's own. Both are read\n // through refs, so a host passing new functions each render doesn't have every appointment on screen\n // drawn again; the tables with a template are part of what it is drawn for.\n const recurringText = t('recurring');\n const customTooltip = appointmentTooltip !== undefined;\n const appointmentTooltipRef = useRef(appointmentTooltip);\n appointmentTooltipRef.current = appointmentTooltip;\n const templatesRef = useRef(templates);\n templatesRef.current = templates;\n const templatedTables = Object.keys(templates ?? {})\n .map((x) => x.trim().toLowerCase())\n .sort()\n .join();\n const renderAppointment = useCallback(\n (info: EventDisplayInfo) => {\n const content = customTooltip\n ? () => appointmentTooltipRef.current?.(appointmentFromEvent(info.event) as CalendarAppointment)\n : <AppointmentSummaryContent summary={summarizeAppointment(info.event, locale, recurringText, timeZone)} />;\n const table = info.event.extendedProps['table'] as string | null | undefined;\n const template = table ? templateFor(templatesRef.current, table) : undefined;\n const row = template ? rows.current.get(info.event.id) : undefined;\n return (\n <AppointmentTooltip content={content}>\n {template && row ? templateContent(info, template(row)) : appointmentContent(info)}\n </AppointmentTooltip>\n );\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [locale, recurringText, timeZone, customTooltip, templatedTables],\n );\n\n // Each refresh, so the range shown is read again.\n const [refreshes, setRefreshes] = useState(0);\n\n // The range being loaded, so a newer one can abandon it.\n const latestLoad = useRef<AbortController | null>(null);\n useEffect(() => () => latestLoad.current?.abort(), []);\n\n // ---- The tables it reads ----\n const registeredAsync = tableSet.registeredAsync;\n const infoOf = tableSet.infoOf;\n const tableLabel = tableSet.tableLabel;\n const isStoredView = (id: string | undefined, response: MultiTableTablesResponse) =>\n isMultiTableView(id) && !(response.views ?? []).some((view) => view.id?.toLowerCase() === id);\n\n /**\n * The tables a view reads, each with which of its rows: null for every table, or for a view of\n * several tables kept in Dataverse, which the server reads by its id; none for a Dataverse view\n * that doesn't exist.\n */\n const viewTablesAsync = async (id: string): Promise<readonly MultiTableViewTable[] | null> => {\n if (id === EVERY_TABLE_VIEW_ID) return null;\n if (isMultiTableView(id))\n return (await registeredAsync()).views?.find((view) => view.id?.toLowerCase() === id)?.tables ?? null;\n const custom = findCustomView(id, customViewDefinitions);\n if (custom) return custom.tables;\n const ownMulti = findSavedMulti(id);\n if (ownMulti) return ownMulti.tables;\n const own = findSaved(id);\n if (own) return [{ table: APPOINTMENT_TABLE, viewType: MultiTableViewType.FetchXml, fetchXml: own.definition.fetchXml }];\n const view = await viewMetadataCache.getAsync(id);\n if (view) return [{ table: view.tableName.toLowerCase(), viewType: MultiTableViewType.SystemView, viewId: id }];\n console.warn(`[Calendar] The view ${id} doesn't exist or is on a table the user may not read, so it shows nothing.`);\n return [];\n };\n // The tables a view shows the user, of the registered ones read last: null for a view kept in\n // Dataverse the server hasn't read yet.\n const knownTablesOf = (id: string, viewTables: readonly MultiTableViewTable[] | null, response: MultiTableTablesResponse) =>\n tableSet.tablesOf(viewTables, isStoredView(id, response) ? id : null);\n\n // The tables of the view shown that the user may choose among, as the last range read them; and\n // those the user switched off in it — none chosen yet, the defaults.\n const defaultsKey = defaultTables.map((table) => table.trim().toLowerCase()).join(',');\n const known = tableSet.known;\n const shownTables = tableSet.shown;\n\n // The rows of the range on screen, by id, for a click or a move; and which tables' start columns\n // keep only a date.\n const rows = useRef(new Map<string, MultiTableItem>());\n const dateOnly = useRef(new Map<string, boolean>());\n const learnDateOnly = async (tables: readonly string[], response: MultiTableTablesResponse) => {\n for (const table of [...new Set(tables)].filter((x) => !dateOnly.current.has(x))) {\n const start = response.tables?.find((x) => x.table === table)?.definition?.calendar?.start;\n try {\n const metadata = await tableMetadataCache.getAsync(table);\n const column = metadata?.columns?.find((x) => x.columnName === start) as { dateTimeBehavior?: unknown } | undefined;\n // DateTimeBehavior.DateOnly.\n dateOnly.current.set(table, column?.dateTimeBehavior === 1);\n } catch {\n dateOnly.current.set(table, false);\n }\n }\n };\n const [failures, setFailures] = useState<readonly MultiTableFailure[]>([]);\n\n // The user's filter, a tab for each table in the grid's own dialog: each table's taken from its\n // query and put back in its place.\n const showsFilterButton =\n !appointments && allowFiltering && !(tableSet.registered && isStoredView(viewId, tableSet.registered));\n const filtered = tableSet.filter;\n // The tables of the view shown, each with its own query — null where the calendar can't read it,\n // a saved or personal view inside a view of several tables, which has no filter to change.\n const filterTablesAsync = async (id: string) => {\n await registeredAsync();\n const tablesShown: readonly MultiTableViewTable[] =\n (await viewTablesAsync(id)) ??\n (id === EVERY_TABLE_VIEW_ID ? (tableSet.tablesOf(null) ?? []).map((table): MultiTableViewTable => ({ table })) : []);\n return tableSet.filterQueries(tablesShown);\n };\n const openFilter = async () => {\n const id = viewId;\n if (!id) return;\n try {\n const response = await registeredAsync();\n const tablesShown = await filterTablesAsync(id);\n const knownNow = knownTablesOf(id, (await viewTablesAsync(id)) ?? null, response) ?? [];\n // Opened for the view only if it is still shown once its queries are read.\n tableSet.openFilter(id, tablesShown, knownNow, tableLabel);\n } catch (error) {\n console.warn('[Calendar] The filters of the view shown could not be read.', error);\n }\n };\n // Each table's own criteria again leave its query as it is; any others are put in it. After Reset\n // to view, the view is put back as it opens: the tables it shows by itself, and its layout.\n const applyFilter = (criteria: Readonly<Record<string, string>>, restoreView: boolean) => {\n if (!tableSet.applyFilter(criteria, restoreView) || !restoreView) return;\n const layout = viewOpeningLayout(viewId);\n if (layout !== currentLayout && layoutsOffered.includes(layout)) controller.changeView(toFullCalendarView(layout));\n };\n\n // What the rows read depend on, so a new object with the same content doesn't reload the calendar.\n const searched = showsSearch ? search.trim() : '';\n const sourceKey = JSON.stringify([\n regarding ?? null,\n viewId ?? null,\n findSaved(viewId)?.definition.fetchXml ?? null,\n findSavedMulti(viewId)?.tables ?? null,\n customViewsKey,\n filtered?.tables ?? null,\n searched,\n tableSet.hiddenChoice,\n tablesKey,\n defaultsKey,\n matchParties ?? null,\n series ?? null,\n multiTableKey,\n user ?? null,\n ]);\n // The calendar's part of the URL state, as the period shown last left it; the rest is worked out\n // as it is written, from the latest render — a write can come from a timer or a handler set up\n // renders earlier, after the user picked another view.\n // The layout and period shown, as the calendar last drew them.\n const shownState = useRef<{ layout?: CalendarLayout; d?: string }>({});\n const persistRef = useRef<(next?: { viewId?: string | undefined; search?: string }) => void>(() => {});\n persistRef.current = (next = {}) => {\n // A view a link named stays in the URL until the page offers its views.\n const v = 'viewId' in next ? next.viewId : !offersViews(offered) ? pickedViewId : viewId;\n const q = next.search ?? search;\n // The layout needs no link while it is the one the view shown opens in: a saved view's own,\n // else the calendar's.\n const shown = shownState.current;\n const opens = viewOpeningLayout('viewId' in next ? next.viewId : viewId);\n writePersistedCalendarState(persistedStateQueryParameter, {\n ...(shown.layout && shown.layout !== opens ? { l: shown.layout } : {}),\n ...(shown.d ? { d: shown.d } : {}),\n ...(v && v !== offered[0] ? { v } : {}),\n ...(includeSearchInPersistedState && showsSearch && q.trim() ? { q } : {}),\n });\n };\n const persist = (next?: { viewId?: string | undefined; search?: string }) => persistRef.current(next);\n\n // The URL leaves out the view the calendar opens on: when the user's default makes another that\n // view, it is written again, so a reload or a link opens the view shown.\n const openingViewRef = useRef(offered[0]);\n useEffect(() => {\n const previous = openingViewRef.current;\n openingViewRef.current = offered[0];\n if (viewSettled && previous !== undefined && previous !== offered[0]) persist();\n // `persist` writes from the latest render.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [offered[0]]);\n\n // The search goes out once typing pauses, into the URL with it.\n const searchFor = (text: string) => {\n setSearch(text);\n persist({ search: text });\n };\n\n const events = useMemo(() => {\n if (appointments) return appointments.map(toEventInput);\n return async (info: EventSourceFuncInfo) => {\n // A range left before its rows arrive is dropped: its request is abandoned, so the server\n // stops reading it, and what it brings back can't speak for the range on screen.\n latestLoad.current?.abort();\n const load = new AbortController();\n latestLoad.current = load;\n const id = viewId;\n try {\n if (!id) return [];\n const response = await registeredAsync();\n const viewTables = await viewTablesAsync(id);\n const stored = isStoredView(id, response);\n let knownNow = knownTablesOf(id, viewTables, response);\n if (latestLoad.current === load && knownNow) tableSet.setKnown(id, knownNow);\n if (knownNow?.length === 0) {\n if (latestLoad.current === load) {\n setFailed(false);\n setTruncated(false);\n setFailures([]);\n }\n rows.current = new Map();\n return [];\n }\n const request = {\n start: info.start.toISOString(),\n end: info.end.toISOString(),\n viewId: filtered || !isMultiTableView(id) ? null : id,\n tables: filtered ? [...filtered.tables] : viewTables && viewTables.length > 0 ? [...viewTables] : null,\n // A view whose tables aren't known yet is read as the calendar allows.\n includeTables: knownNow ? tableSet.shownIn(id, knownNow) : allowedTables ? [...allowedTables] : null,\n regarding: regarding ? { tableName: regarding.tableName, id: regarding.id } : null,\n matchParties: matchParties ?? null,\n series: series ?? null,\n search: searched || null,\n columns: CALENDAR_COLUMNS,\n } as MultiTableRangeRequest;\n const range = await ppp.loadMultiTableRangeAsync(request, load.signal);\n // A view kept in Dataverse is read for the first time without knowing its tables: the\n // server says which they were.\n if (!knownNow && stored) {\n knownNow = tableSet.learnTables(id, range.tables ?? []);\n if (latestLoad.current === load) tableSet.setKnown(id, knownNow);\n }\n const items = range.items ?? [];\n await learnDateOnly(items.map((item) => item.table ?? ''), response);\n if (latestLoad.current === load) {\n setFailed(false);\n setTruncated((range.truncated ?? []).length > 0);\n setFailures(range.failures ?? []);\n rows.current = new Map(items.map((item) => [item.id, item] as const));\n seriesOf.current = new Map(\n items.flatMap((item) => {\n const seriesId = (item.record?.properties?.['seriesid'] as { value?: unknown } | undefined)?.value;\n return item.table === APPOINTMENT_TABLE && typeof seriesId === 'string' ? [[item.id, seriesId] as const] : [];\n }),\n );\n }\n return items.map((item) =>\n toEventInput(\n fromMultiTableItem(\n item,\n response.tables?.find((x) => x.table === item.table),\n drawnTimes(item, dateOnly.current.get(item.table ?? '') ?? false, timeZone),\n ),\n ),\n );\n } catch {\n if (latestLoad.current === load) {\n setFailed(true);\n setTruncated(false);\n setFailures([]);\n }\n return [];\n }\n };\n // What the rows depend on is read through `sourceKey`, so a new object with the same content\n // keeps the source; a refresh gives it a new one, which FullCalendar reads again.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [appointments, ppp, sourceKey, refreshes, timeZone]);\n\n // A move or resize: saved by the host's handler, else — for a row the calendar loaded — by the\n // calendar, which puts it back when the save fails or it can't keep the move.\n const handleChange = async (info: EventChangeInfo) => {\n const change = toAppointmentChange(info.event);\n if (onAppointmentChange) {\n if (!(await onAppointmentChange(change))) info.revert();\n return;\n }\n if (appointments) return;\n const item = rows.current.get(change.id);\n const record = item\n ? moveRecord(change, item, infoOf(item.table ?? ''), dateOnly.current.get(item.table ?? '') ?? false, timeZone)\n : null;\n if (!record) {\n info.revert();\n return;\n }\n try {\n await ppp.updateRecordAsync(record);\n // Read again, so the next move of the row starts from it as saved.\n setRefreshes((count) => count + 1);\n } catch (error) {\n console.error('[Calendar] The move could not be saved.', error);\n info.revert();\n await dialog.showErrorAsync(t('move-failed'));\n }\n };\n\n // A row of another table than appointments, in its form: one to change in an editable calendar,\n // else to read, as an appointment's details are.\n const [panelRow, setPanelRow] = useState<{ table: string; id: string; record: TableRecord } | null>(null);\n const openRow = async (table: string, id: string) => {\n try {\n const record = await ppp.retrieveRecordAsync(table, id);\n const permissions = Number(record.permissions ?? 0);\n setPanelRow({\n table,\n id,\n record: editable\n ? record\n : ({ ...record, permissions: permissions & ~(TableSecurityPermission.Write | TableSecurityPermission.Delete) } as TableRecord),\n });\n } catch (error) {\n console.error(`[Calendar] The ${table} ${id} could not be read for its form.`, error);\n await dialog.showErrorAsync(t('open-failed'));\n }\n };\n\n const view = controller.view;\n const currentLayout = (view && fromFullCalendarView(view.type)) ?? initialLayout;\n const buttons = view ? controller.getButtonState() : undefined;\n\n // Whether a New button starts something: in an editable calendar, the host's selection handler,\n // or a form for a user who may create appointments in one that loads its own.\n const [mayCreateHere, setMayCreateHere] = useState(false);\n const asksPermission = editable && !onRangeSelect && !appointments;\n useEffect(() => {\n if (!asksPermission) return;\n let current = true;\n void mayCreateAppointments().then((answer) => current && setMayCreateHere(answer));\n return () => {\n current = false;\n };\n // Asked again for another user; the answer is kept per user.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [asksPermission, user]);\n const canCreateAppointments = editable && (onRangeSelect !== undefined || (asksPermission && mayCreateHere));\n\n // A new appointment, as selecting a time starts one: the host's when it handles the selection,\n // otherwise a form in a calendar that loads its own appointments.\n const createAppointment = async (range?: CalendarRange) => {\n if (!editable) return;\n const shown = controller.view;\n const chosen = range ?? (shown && newAppointmentRange(shown.currentStart, shown.currentEnd, new Date(), timeZone));\n if (!chosen) return;\n if (onRangeSelect) onRangeSelect(chosen);\n else if (!appointments) await startAppointment(chosen);\n };\n const calendarContext: CalendarContextValue = {\n layout: currentLayout,\n start: view?.activeStart,\n end: view?.activeEnd,\n regarding,\n canCreateAppointments,\n createAppointment,\n refresh: () => setRefreshes((count) => count + 1),\n };\n\n const onLayoutChecked: MenuProps['onCheckedValueChange'] = (_, data) => {\n const next = data.checkedItems[0] as CalendarLayout | undefined;\n if (next && layoutsOffered.includes(next)) controller.changeView(toFullCalendarView(next));\n };\n\n // A view picked reloads the range shown, as any change of what it shows does; a saved view opens\n // in its own layout.\n const pickView = (next: string | undefined) => {\n if (!next || next === viewId) return;\n setPickedViewId(next);\n const layout = readSavedLayout(savedCalendarLayout(next));\n if (layout && layout !== currentLayout && layoutsOffered.includes(layout)) controller.changeView(toFullCalendarView(layout));\n persist({ viewId: next });\n };\n\n // ---- Saved views: the user's own, in the Filter menu as a grid's are ----\n const shownSaved = findSaved(viewId);\n const shownSavedMulti = findSavedMulti(viewId);\n // What the calendar shows can be saved: any table it shows, by queries it can read — not a view of\n // several tables kept in Dataverse that it reads by its id. Appointments alone are saved as a view\n // of that table, shared with the grids of appointments; several tables as a view of them.\n const showsAppointmentsAlone = shownTables.length === 1 && shownTables[0] === APPOINTMENT_TABLE;\n const canSaveView = shownTables.length > 0 && !(tableSet.registered && isStoredView(viewId, tableSet.registered));\n // The view shown, changed, so there is something to save: the user's filter, the tables they switched\n // on or off, or another layout than it opens in — its own, or the calendar's for one saved without.\n // It fills the Filter button.\n const viewChanged = !!filtered || tableSet.tablesChanged || currentLayout !== viewOpeningLayout(viewId);\n const savedViewChanged = (!!shownSaved || !!shownSavedMulti) && canSaveView && viewChanged;\n const isUserDefault = !!viewId && userDefaultViewId(saved.settings, offered, savedViewsControl) === viewId;\n\n // The query to save: the appointments' own, or with the user's filter in it; none while the\n // calendar shows other tables.\n const currentQuery = async (): Promise<string | undefined> => {\n if (!showsAppointmentsAlone || !viewId) return undefined;\n const own = filtered?.tables.find((x) => x.table === APPOINTMENT_TABLE);\n if (own && (own.viewType ?? MultiTableViewType.FetchXml) === MultiTableViewType.FetchXml && own.fetchXml) return own.fetchXml;\n return (await filterTablesAsync(viewId)).find((x) => x.table.table === APPOINTMENT_TABLE)?.fetchXml ?? undefined;\n };\n\n // The tables the calendar shows now, as a view of several tables keeps them: each with its query —\n // the user's filter in it — or its view, the tables switched off left out.\n const currentTables = async (): Promise<MultiTableViewTable[]> => {\n if (!viewId) return [];\n const response = await registeredAsync();\n const tablesNow = filtered ? [...filtered.tables] : (await filterTablesAsync(viewId)).map((x) => x.table);\n return shownViewTables(tablesNow, known, shownTables, (table) => !!response.tables?.find((info) => info.table === table)?.isActivity);\n };\n\n // Shows a view of the user's in place of the one shown and its filter, the filter its own now.\n const showSavedView = (id: string) => {\n tableSet.reset();\n setPickedViewId(id);\n persist({ viewId: id });\n };\n\n // A view's name as the picker shows it, or would, or the user's own name for it.\n function viewLabel(id: string): string {\n return labelOf(id.toLowerCase()) ?? findSaved(id)?.name ?? findSavedMulti(id)?.name ?? id;\n }\n\n // What the user does with their views — the dialogs, signing in first, one change at a time — is\n // shared with the grids and timelines; what saving one writes is the calendar's.\n const session = useSavedViewSession({\n saved,\n signInUrl,\n operations: {\n shownViewId: viewId,\n savedViewName: (id) => findSaved(id)?.name ?? findSavedMulti(id)?.name,\n managedViewName: viewLabel,\n // Every view for the Manage views panel, the hidden ones among them.\n managedViews: (): GridManagedView[] => {\n const all = [...new Set([...pageViews, ...savedIds.map((x) => x.toLowerCase())])];\n const userDefault = userDefaultViewId(saved.settings, all, savedViewsControl);\n return all.map((id) => ({\n id,\n name: viewLabel(id),\n isSaved: !!findSaved(id) || !!findSavedMulti(id),\n isDefault: id === userDefault,\n isHidden: isViewHidden(saved.settings, id, savedViewsControl),\n isShown: id === viewId,\n }));\n },\n save: async () => {\n if (shownSavedMulti) {\n const tables = await currentTables();\n if (tables.length === 0) return;\n await multiSaved.update(shownSavedMulti.id, { tables, calendarLayout: writeSavedLayout(currentLayout) });\n } else {\n if (!shownSaved) return;\n const fetchXml = await currentQuery();\n if (!fetchXml) return;\n await saved.update(shownSaved.id, { fetchXml, calendarLayout: writeSavedLayout(currentLayout) });\n }\n // The filter and the tables shown are the view's own now.\n tableSet.reset();\n },\n saveAs: async (name) => {\n const fetchXml = showsAppointmentsAlone ? await currentQuery() : undefined;\n if (fetchXml) {\n const view = await saved.create(name, fetchXml, { calendarLayout: writeSavedLayout(currentLayout) });\n showSavedView(view.id.toLowerCase());\n return;\n }\n const tables = await currentTables();\n if (tables.length === 0) return;\n const view = await multiSaved.create(name, tables, { calendarLayout: writeSavedLayout(currentLayout) });\n showSavedView(view.id.toLowerCase());\n },\n clone: async (id, name) => {\n // A view of appointments alone: one the user saved, one of the page's, or a Dataverse view.\n const own = findSaved(id);\n const custom = findCustomView(id, customViewDefinitions)?.tables;\n const only = custom?.length === 1 && custom[0]!.table === APPOINTMENT_TABLE &&\n (custom[0]!.viewType ?? MultiTableViewType.FetchXml) === MultiTableViewType.FetchXml\n ? (custom[0]!.fetchXml ?? everyRow(APPOINTMENT_TABLE))\n : undefined;\n const ownMulti = findSavedMulti(id);\n const dataverse = own || only || ownMulti || custom ? undefined : await viewMetadataCache.getAsync(id);\n const fetchXml =\n own?.definition.fetchXml ?? only ?? (dataverse?.tableName.toLowerCase() === APPOINTMENT_TABLE ? dataverse.fetchXml : undefined);\n if (fetchXml) {\n await saved.create(name, fetchXml, { gridLayout: own?.gridLayout, calendarLayout: own?.calendarLayout });\n return;\n }\n // Of several tables, or another table's: copied as a view of its tables.\n const tables =\n ownMulti?.tables ??\n (await viewTablesAsync(id)) ??\n (id === EVERY_TABLE_VIEW_ID ? known.map((table): MultiTableViewTable => ({ table })) : null);\n if (!tables || tables.length === 0) return;\n await multiSaved.create(name, tables, { calendarLayout: ownMulti?.calendarLayout });\n },\n rename: async (id, name) => void (findSavedMulti(id) ? await multiSaved.update(id, { name }) : await saved.update(id, { name })),\n remove: async (id) => {\n if (findSavedMulti(id)) {\n await multiSaved.remove(id);\n await saved.reloadSettings();\n } else {\n await saved.remove(id);\n }\n if (id.toLowerCase() === viewId) tableSet.clearFilter();\n },\n openView: (id) => pickView(id),\n },\n });\n\n return (\n <div className={styles.root} style={{ height }}>\n {/* The toolbar as a grid's and a timeline's: the view picker on its own at the start; at the end\n the period and the moves through it, the host's controls, the layout, the search, then\n Filter — the view's filters, its tables and the user's own views — and Refresh. */}\n <ViewToolbar\n className=\"ppp-calendar-toolbar\"\n ariaLabel={t('toolbar')}\n start={\n showsViewPicker && (\n <ViewPicker\n className=\"ppp-calendar-view-picker\"\n options={viewOptions}\n sort={viewSort}\n value={viewId}\n onChange={pickView}\n // The user's own views in a group of their own, below the page's, as a grid lists them.\n isUserView={(id) => saved.available && (!!findSaved(id) || !!findSavedMulti(id))}\n />\n )\n }\n >\n <div className={mergeClasses('ppp-calendar-navigation', styles.navigation)}>\n <ToolbarButton\n appearance=\"subtle\"\n disabled={buttons?.today?.isDisabled ?? false}\n onClick={() => controller.today()}\n >\n {t('today')}\n </ToolbarButton>\n <ToolbarButton\n appearance=\"subtle\"\n icon={direction === 'rtl' ? <ChevronRightRegular /> : <ChevronLeftRegular />}\n aria-label={t('previous')}\n onClick={() => controller.prev()}\n />\n <ToolbarButton\n appearance=\"subtle\"\n icon={direction === 'rtl' ? <ChevronLeftRegular /> : <ChevronRightRegular />}\n aria-label={t('next')}\n onClick={() => controller.next()}\n />\n <Text className={styles.title} as=\"h2\" aria-live=\"polite\">\n {view?.title}\n </Text>\n </div>\n {children !== undefined && (\n <CalendarContext.Provider value={calendarContext}>{children}</CalendarContext.Provider>\n )}\n {/* With one layout there is nothing to pick. */}\n {layoutsOffered.length > 1 && (\n <Menu checkedValues={{ layout: [currentLayout] }} onCheckedValueChange={onLayoutChecked}>\n <MenuTrigger disableButtonEnhancement>\n <MenuButton className=\"ppp-calendar-layout\" appearance=\"subtle\">\n {t(layoutKeys[currentLayout])}\n </MenuButton>\n </MenuTrigger>\n <MenuPopover>\n <MenuList>\n {layoutsOffered.map((layout) => (\n <MenuItemRadio key={layout} name=\"layout\" value={layout}>\n {t(layoutKeys[layout])}\n </MenuItemRadio>\n ))}\n </MenuList>\n </MenuPopover>\n </Menu>\n )}\n {showsSearch && (\n <ViewSearchBox\n className={mergeClasses('ppp-calendar-search', styles.search)}\n placeholder={t('search-placeholder')}\n value={search}\n onChange={searchFor}\n />\n )}\n {/* The view's filters, the tables it shows, and the user's own views — saving the view shown,\n with their filter, tables and layout. A visitor who isn't signed in is asked to sign in\n for any of their views. */}\n <ViewFilterMenu\n changed={viewChanged}\n onEditFilters={showsFilterButton ? () => void openFilter() : undefined}\n tables={appointments ? undefined : tableSet.menuTables(tableLabel)}\n onTableShownChange={tableSet.showTable}\n savedViews={session.menu({\n canSave: savedViewChanged,\n canSaveAs: canSaveView && viewChanged,\n canSetDefault: !!viewId && !isUserDefault,\n })}\n />\n {/* Last, as on a grid. Appointments the host gives the calendar are the host's to read again. */}\n {!appointments && (\n <ViewRefreshButton\n className=\"ppp-calendar-refresh\"\n disabled={loading}\n onClick={() => setRefreshes((count) => count + 1)}\n />\n )}\n </ViewToolbar>\n <SavedViewDialogs session={session} />\n <MultiTableFilterDialog\n open={tableSet.filterDialog !== null}\n tabs={tableSet.filterDialog?.tabs ?? []}\n viewTabs={tableSet.filterDialog?.viewTabs}\n onApply={applyFilter}\n onCancel={tableSet.closeFilter}\n />\n {/* A table that couldn't be read leaves the rest of the range as it is. */}\n <ViewLoadMessages\n failed={failed}\n errorText={t('error')}\n failedTables={failures.length > 0 ? t('failed-tables', [failures.map((x) => tableLabel(x.table ?? '')).join(', ')]) : null}\n retryText={t('retry')}\n onRetry={() => setRefreshes((count) => count + 1)}\n />\n {truncated && (\n <MessageBar intent=\"warning\">\n <MessageBarBody>{t('truncated')}</MessageBarBody>\n </MessageBar>\n )}\n {/* The appointments, under an overlay while a range loads, as a grid's rows are. Only they\n are covered: the toolbar stays free, so the user can move on, change the view or search\n while the range on screen is still loading. */}\n <div className={styles.body}>\n <div className={styles.surface}>\n {viewSettled && (\n <FullCalendar\n {...options}\n // Fluent's tokens are set on its provider's element, which the popover isn't inside: its\n // theme class sets them on the popover, as Fluent's own portals do.\n popoverClass={`${options.popoverClass} ${themeClassName}`}\n plugins={plugins}\n controller={controller}\n events={events}\n loading={setLoading}\n eventContent={renderAppointment}\n eventClick={(info) => {\n info.jsEvent.preventDefault();\n const table = info.event.extendedProps['table'] as string | null | undefined;\n if (onAppointmentClick) onAppointmentClick(info.event.id);\n else if (table === SERIES_TABLE && !appointments) {\n // A series shown once opens as the series.\n latestStart.current++;\n setOpenAppointment({ id: info.event.id, subject: info.event.title, recurring: false, isSeries: true });\n } else if (table && table !== APPOINTMENT_TABLE && !appointments) {\n // Another table's row opens in its form.\n latestStart.current++;\n void openRow(table, info.event.id);\n } else {\n const opened = appointmentToOpen(info.event, appointments !== undefined);\n if (opened) {\n // A new appointment still being started gives way to the one clicked.\n latestStart.current++;\n const seriesId = opened.recurring ? seriesOf.current.get(opened.id) : undefined;\n // One of a series: the user says whether they mean it or the series.\n if (seriesId) setRecurringChoice({ ...opened, seriesId });\n else setOpenAppointment(opened);\n }\n }\n }}\n select={(info) => {\n const range = { start: info.start, end: info.end, allDay: info.allDay };\n // The host's to handle when it says so; otherwise a calendar that loads its own\n // appointments opens a new one to create over the range.\n if (onRangeSelect) onRangeSelect(range);\n else if (!appointments) void startAppointment(range);\n info.view.calendar.unselect();\n }}\n eventDrop={handleChange}\n eventResize={handleChange}\n datesSet={(info) => {\n const layout = fromFullCalendarView(info.view.type);\n if (!layout) return;\n const date = periodDate(info.view.currentStart, info.view.currentEnd, new Date(), timeZone);\n shownState.current = { layout, ...(date ? { d: date } : {}) };\n persist();\n onRangeChange?.({ start: info.start, end: info.end, layout });\n }}\n />\n )}\n </div>\n {(loading || awaitsTimeZone || saved.loading || multiSaved.loading) && (\n <div className={styles.loadingOverlay}>\n <Spinner size=\"large\" />\n </div>\n )}\n </div>\n {/* What a screen reader announces while a range loads: always mounted, since a live region\n announces a change to what it holds, not its arrival. */}\n <span className={styles.visuallyHidden} role=\"status\" aria-live=\"polite\">\n {loading ? t('loading') : ''}\n </span>\n {/* In an editable calendar, a form: the appointment opened, or a new one over a range. Saving\n reads the range again. */}\n <AppointmentDetailsDialog\n appointment={openAppointment}\n newAppointment={creating}\n editable={editable}\n regardingTables={regardingTables}\n location={dialogLocation}\n showRecordLinks={showRecordLinks}\n onNavigate={onNavigate}\n onClose={() => {\n setOpenAppointment(null);\n setCreating(null);\n }}\n onSaved={() => setRefreshes((count) => count + 1)}\n >\n {appointmentDetails}\n </AppointmentDetailsDialog>\n {panelRow && infoOf(panelRow.table)?.definition && (\n <MultiTableRecordPanel\n key={`${panelRow.table}:${panelRow.id}`}\n title={tableLabel(panelRow.table)}\n existing={{ table: panelRow.table, id: panelRow.id }}\n loaded={panelRow.record}\n form={forms?.[panelRow.table]?.edit}\n location={dialogLocation}\n definition={infoOf(panelRow.table)!.definition!}\n onSaved={() => {\n setPanelRow(null);\n setRefreshes((count) => count + 1);\n }}\n onClose={() => setPanelRow(null)}\n />\n )}\n <RecurringChoiceDialog\n appointment={recurringChoice}\n onChoose={(series) => {\n const chosen = recurringChoice;\n setRecurringChoice(null);\n if (!chosen?.seriesId) return;\n setOpenAppointment(series ? { id: chosen.seriesId, subject: chosen.subject, recurring: false, isSeries: true } : chosen);\n }}\n onClose={() => setRecurringChoice(null)}\n />\n </div>\n );\n}\n\n/** The page's template for a table, its name matched as the Blazor Calendar matches it: ignoring case. */\nfunction templateFor(\n templates: Readonly<Record<string, (item: MultiTableItem) => ReactNode>> | undefined,\n table: string,\n): ((item: MultiTableItem) => ReactNode) | undefined {\n if (!templates) return undefined;\n const name = table.toLowerCase();\n return templates[table] ?? Object.entries(templates).find(([key]) => key.trim().toLowerCase() === name)?.[1];\n}\n\n/** A row drawn by the page's template, in place of all the calendar draws of it. */\nfunction templateContent(info: EventDisplayInfo, content: ReactNode) {\n return (\n <div className={isCompactView(info.view.type) ? 'ppp-calendar-event ppp-calendar-event-compact' : 'ppp-calendar-event'}>\n {content}\n </div>\n );\n}\n\nfunction appointmentContent(info: EventDisplayInfo) {\n const { event } = info;\n const location = event.extendedProps['location'] as string | null;\n const recurring = event.extendedProps['recurring'] as boolean;\n const title = (\n <span className=\"ppp-calendar-event-title\">\n {recurring && <ArrowRepeatAllRegular className=\"ppp-calendar-event-icon\" />}\n {event.title}\n </span>\n );\n if (isCompactView(info.view.type)) {\n // One line, as Outlook draws a month's cells: the time, then the subject.\n return (\n <div className=\"ppp-calendar-event ppp-calendar-event-compact\">\n {info.timeText && <span className=\"ppp-calendar-event-detail\">{info.timeText}</span>}\n {title}\n </div>\n );\n }\n // The subject, then the place, as Outlook draws them: the time is where the appointment sits in a\n // day's hours, and in the agenda's own column.\n return (\n <div className=\"ppp-calendar-event\">\n {title}\n {location && <span className=\"ppp-calendar-event-detail\">{location}</span>}\n </div>\n );\n}\n","import { ToolbarButton, Tooltip, mergeClasses, type ToolbarButtonProps } from '@fluentui/react-components';\nimport { AddRegular } from '@fluentui/react-icons';\nimport { useT } from '@powerportalspro/react';\nimport { useState, type ReactElement } from 'react';\nimport { useCalendarContext, type CalendarContextValue } from './calendar-context.js';\n\nexport interface CalendarButtonProps {\n /** Called when the button is clicked, with the calendar as it is then. */\n onClick?: (calendar: CalendarContextValue) => void | Promise<void>;\n /** The text on the button. */\n label?: string;\n /** An icon shown before the text, such as `<ArrowDownloadRegular />`. */\n icon?: ReactElement;\n /** Shown when the pointer rests on the button; also its name for a screen reader when it has no label. */\n tooltip?: string;\n /** How the button is drawn. `subtle` by default, as the calendar's own toolbar buttons are. */\n appearance?: ToolbarButtonProps['appearance'];\n /** Whether the button can't be clicked. */\n disabled?: boolean;\n /** A class added to the button. */\n className?: string;\n}\n\n/**\n * A button for a `<Calendar>`'s toolbar: place it among the calendar's children, and a click hands\n * it the calendar as it is then — the period shown, the record it is about, and what it can be\n * asked to do. The grid's `<GridButton>` is its counterpart, and the Blazor `CalendarButton` its\n * twin.\n *\n * ```tsx\n * <Calendar regarding={account} editable>\n * <NewAppointmentCalendarButton />\n * <CalendarButton label=\"Export\" icon={<ArrowDownloadRegular />} onClick={(calendar) => exportRange(calendar.start, calendar.end)} />\n * </Calendar>\n * ```\n */\nexport function CalendarButton({\n onClick,\n label,\n icon,\n tooltip,\n appearance = 'subtle',\n disabled = false,\n className,\n}: CalendarButtonProps) {\n const calendar = useCalendarContext();\n // Set while a click is handled, so a second click doesn't run it again.\n const [working, setWorking] = useState(false);\n const click = async () => {\n if (working || !onClick) return;\n setWorking(true);\n try {\n await onClick(calendar);\n } finally {\n setWorking(false);\n }\n };\n\n const button = (\n <ToolbarButton\n className={mergeClasses('ppp-calendar-button', className)}\n appearance={appearance}\n disabled={disabled || working}\n icon={icon ?? null}\n aria-label={label === undefined ? tooltip : undefined}\n onClick={() => void click()}\n >\n {label}\n </ToolbarButton>\n );\n return tooltip ? (\n <Tooltip content={tooltip} relationship={label === undefined ? 'label' : 'description'} withArrow>\n {button}\n </Tooltip>\n ) : (\n button\n );\n}\n\nexport interface NewAppointmentCalendarButtonProps {\n /** The text on the button. \"New\" by default. */\n label?: string;\n /** The icon shown before the text. A plus by default. */\n icon?: ReactElement;\n /** Shown when the pointer rests on the button. */\n tooltip?: string;\n /** How the button is drawn. `subtle` by default. */\n appearance?: ToolbarButtonProps['appearance'];\n}\n\n/**\n * A New button for a `<Calendar>`'s toolbar: it starts a new appointment as selecting a time does —\n * from the next half hour when the period shown takes in today, and otherwise from 8:00 on its\n * first day. Shown only where that starts something: in an `editable` calendar whose host handles\n * `onRangeSelect`, or that loads its own appointments for a user who may create them. The Blazor\n * `NewAppointmentCalendarButton` is its twin.\n */\nexport function NewAppointmentCalendarButton({\n label,\n icon,\n tooltip,\n appearance = 'subtle',\n}: NewAppointmentCalendarButtonProps) {\n const calendar = useCalendarContext();\n const t = useT();\n if (!calendar.canCreateAppointments) return null;\n return (\n <CalendarButton\n className=\"ppp-calendar-new\"\n label={label ?? t('app.buttons.new.label')}\n icon={icon ?? <AddRegular />}\n appearance={appearance}\n {...(tooltip !== undefined && { tooltip })}\n onClick={(context) => context.createAppointment()}\n />\n );\n}\n"]}