@dayflow/core 3.5.0 → 3.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +14 -2
- package/dist/index.esm.js +1 -1
- package/dist/styles.components.css +2 -6231
- package/dist/styles.css +2 -6812
- package/package.json +7 -7
- package/dist/index.js +0 -1
package/dist/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var e=require("tslib"),t=require("temporal-polyfill"),n=require("preact"),a=require("preact/compat"),r=require("preact/hooks"),o=require("@dayflow/blossom-color-picker");const i={code:"en-US",messages:{allDay:"All day",noEvents:"No events for this day",more:"more",eventTitle:"Event Title",dateRange:"Date Range",timeRange:"Time Range",note:"Note",addNotePlaceholder:"Add a note...",setAsAllDay:"Set as All-day",setAsTimed:"Set as Timed Event",delete:"Delete",confirm:"Confirm",cancel:"Cancel",today:"Today",day:"Day",week:"Week",month:"Month",year:"Year",newEvent:"New Event",newAllDayEvent:"New All-day Event",newCalendarEvent:"New {calendarName} Event",newAllDayCalendarEvent:"New {calendarName} All-day Event",save:"Save",deleteCalendar:"Delete {calendarName}?",deleteCalendarMessage:"Do you want to delete {calendarName} or merge its events into another existing calendar?",merge:"Merge",confirmDeleteTitle:"Are you sure you want to delete the calendar {calendarName}?",confirmDeleteMessage:"If you delete this calendar, all events associated with the calendar will also be deleted.",mergeConfirmTitle:"Merge {sourceName} with {targetName}?",mergeConfirmMessage:"Are you sure you want to merge {sourceName} with {targetName}?\nDoing so will move all the events from {sourceName} to {targetName} and {sourceName} will be deleted.\nThis cannot be undone.",expandSidebar:"Expand calendar sidebar",collapseSidebar:"Collapse calendar sidebar",calendars:"Calendars",createCalendar:"Create New Calendar",calendarNamePlaceholder:"e.g. Work",customColor:"Custom Color...",create:"Create",calendarOptions:"Calendar Options",untitled:"Untitled",search:"Search",noResults:"No results found",calendar:"Calendar",starts:"Starts",ends:"Ends",notes:"Notes",titlePlaceholder:"Title",notesPlaceholder:"Notes",editEvent:"Edit Event",viewEvent:"View Event",done:"Done",quickCreateEvent:"Quick Create Event",quickCreatePlaceholder:"Movie at 7pm on Friday",noSuggestions:"Type to create",newCalendar:"New Calendar",refreshAll:"Refresh All",tomorrow:"Tomorrow",importCalendar:"Import Calendar",exportCalendar:"Export Calendar",addSchedule:"Add Schedule",importCalendarMessage:"This calendar contains new events. Please select a target calendar.",ok:"OK",cut:"Cut",copy:"Copy",pasteHere:"Paste Here",eventSummary:"Summary",subscribeCalendar:"Subscribe to Calendar",subscribeCalendarTitle:"Enter the URL of the calendar you want to subscribe to.",calendarUrl:"Calendar URL",calendarUrlPlaceholder:"https://example.com/calendar.ics",subscribe:"Subscribe",fetchingCalendar:"Fetching calendar...",subscribeError:"Failed to fetch calendar. Please check the URL and try again."}},l={en:i};function s(e){const t=e.split("-")[0].toLowerCase();return t in l?t:"en"}function d(e){try{new Intl.DateTimeFormat(e);return!0}catch(e){return!1}}var c;exports.ViewType=void 0,(c=exports.ViewType||(exports.ViewType={})).DAY="day",c.WEEK="week",c.MONTH="month",c.YEAR="year",c.RESOURCE="resource";const u={OVERSCAN:6,BUFFER_SIZE:100,MIN_YEAR:1900,MAX_YEAR:2200,SCROLL_THROTTLE:8,SCROLL_DEBOUNCE:150,CACHE_CLEANUP_THRESHOLD:200,MOBILE_WEEK_HEIGHT:80,TABLET_WEEK_HEIGHT:90,WEEK_HEIGHT:119};class h{constructor(e=u.BUFFER_SIZE){this.cache=new Map,this.accessOrder=[],this.maxSize=e}static getKey(e){return`${e.getFullYear()}-${e.getMonth()}-${e.getDate()}`}get(e){const t=h.getKey(e),n=this.cache.get(t);if(n)return this.updateAccessOrder(t),n}set(e,t){const n=h.getKey(e);if(this.cache.size>=this.maxSize){const e=this.accessOrder.shift();void 0!==e&&this.cache.delete(e)}this.cache.set(n,t),this.updateAccessOrder(n)}updateAccessOrder(e){const t=this.accessOrder.indexOf(e);t>-1&&this.accessOrder.splice(t,1),this.accessOrder.push(e)}getSize(){return this.cache.size}clear(){this.cache.clear(),this.accessOrder=[]}}var m;function g(e){var n;if(!e||"object"!=typeof e)return!1;if(e instanceof Date)return!1;if(e instanceof t.Temporal.PlainDate)return!0;const a=e;return"PlainDate"===(null===(n=a.constructor)||void 0===n?void 0:n.name)||!("hour"in a)&&!("timeZone"in a)&&"year"in a&&"month"in a&&"day"in a}function f(e,n=t.Temporal.Now.timeZoneId()){return t.Temporal.Instant.fromEpochMilliseconds(e.getTime()).toZonedDateTimeISO(n)}function v(e){if("number"==typeof e.epochMilliseconds)return new Date(e.epochMilliseconds);const t=e;return new Date(t.year,t.month-1,t.day,t.hour,t.minute)}function p(e,n){if(e instanceof Date)return e;if(g(e))return function(e,n=t.Temporal.Now.timeZoneId()){if("function"==typeof e.toZonedDateTime)try{return v(e.toZonedDateTime({timeZone:n,plainTime:t.Temporal.PlainTime.from({hour:0,minute:0})}))}catch(e){}return new Date(e.year,e.month-1,e.day)}(e,n);if(e&&"object"==typeof e&&"hour"in e&&!("timeZone"in e)){const t=e;return new Date(t.year,t.month-1,t.day,t.hour,t.minute,t.second||0,t.millisecond||0)}if(e&&"object"==typeof e&&"year"in e){return v(e)}return new Date(e)}function y(e,n){const a=Math.floor(n),r=Math.round(60*(n-a));if(g(e))return t.Temporal.PlainDateTime.from({year:e.year,month:e.month,day:e.day,hour:a,minute:r});if("function"==typeof e.with)return e.with({hour:a,minute:r,second:0,millisecond:0});const o=e;return t.Temporal.PlainDateTime.from({year:o.year,month:o.month,day:o.day,hour:a,minute:r})}function D(e,n){if(e instanceof Date&&n instanceof Date)return e.toDateString()===n.toDateString();const a=e=>{if(e instanceof Date)return n=e,t.Temporal.PlainDate.from({year:n.getFullYear(),month:n.getMonth()+1,day:n.getDate()});var n;if(g(e))return e;if("function"==typeof e.toPlainDate)return e.toPlainDate();const a=e;return t.Temporal.PlainDate.from({year:a.year,month:a.month,day:a.day})},r=a(e),o=a(n);return 0===t.Temporal.PlainDate.compare(r,o)}function w(e,n=t.Temporal.Now.timeZoneId()){if("function"==typeof e.toZonedDateTime){return(g(e)?e:e.toPlainDate()).toZonedDateTime({timeZone:n,plainTime:t.Temporal.PlainTime.from({hour:0,minute:0})})}const a=e;return(g(e)?e:t.Temporal.PlainDate.from({year:a.year,month:a.month,day:a.day})).toZonedDateTime({timeZone:n,plainTime:t.Temporal.PlainTime.from({hour:0,minute:0})})}function b(e,n=t.Temporal.Now.timeZoneId()){if("function"==typeof e.toZonedDateTime){return(g(e)?e:e.toPlainDate()).toZonedDateTime({timeZone:n,plainTime:t.Temporal.PlainTime.from({hour:23,minute:59,second:59,millisecond:999})})}const a=e;return(g(e)?e:t.Temporal.PlainDate.from({year:a.year,month:a.month,day:a.day})).toZonedDateTime({timeZone:n,plainTime:t.Temporal.PlainTime.from({hour:23,minute:59,second:59,millisecond:999})})}function E(e,t){const n=new Date(e.getFullYear(),e.getMonth(),e.getDate()),a=new Date(t.getFullYear(),t.getMonth(),t.getDate());return Math.round((a.getTime()-n.getTime())/864e5)}exports.TimeZone=void 0,(m=exports.TimeZone||(exports.TimeZone={})).UTC="UTC",m.NEW_YORK="America/New_York",m.CHICAGO="America/Chicago",m.DENVER="America/Denver",m.LOS_ANGELES="America/Los_Angeles",m.TORONTO="America/Toronto",m.VANCOUVER="America/Vancouver",m.PHOENIX="America/Phoenix",m.ANCHORAGE="America/Anchorage",m.HONOLULU="Pacific/Honolulu",m.MEXICO_CITY="America/Mexico_City",m.WINNIPEG="America/Winnipeg",m.HALIFAX="America/Halifax",m.ST_JOHNS="America/St_Johns",m.DETROIT="America/Detroit",m.LONDON="Europe/London",m.PARIS="Europe/Paris",m.BERLIN="Europe/Berlin",m.MADRID="Europe/Madrid",m.ROME="Europe/Rome",m.AMSTERDAM="Europe/Amsterdam",m.ZURICH="Europe/Zurich",m.STOCKHOLM="Europe/Stockholm",m.OSLO="Europe/Oslo",m.COPENHAGEN="Europe/Copenhagen",m.MOSCOW="Europe/Moscow",m.ISTANBUL="Europe/Istanbul",m.DUBLIN="Europe/Dublin",m.LISBON="Europe/Lisbon",m.PRAGUE="Europe/Prague",m.VIENNA="Europe/Vienna",m.WARSAW="Europe/Warsaw",m.BRUSSELS="Europe/Brussels",m.ATHENS="Europe/Athens",m.BUCHAREST="Europe/Bucharest",m.HELSINKI="Europe/Helsinki",m.KYIV="Europe/Kyiv",m.BUDAPEST="Europe/Budapest",m.BELGRADE="Europe/Belgrade",m.LUXEMBOURG="Europe/Luxembourg",m.MONACO="Europe/Monaco",m.REYKJAVIK="Atlantic/Reykjavik",m.TOKYO="Asia/Tokyo",m.SHANGHAI="Asia/Shanghai",m.HONG_KONG="Asia/Hong_Kong",m.TAIPEI="Asia/Taipei",m.SEOUL="Asia/Seoul",m.SINGAPORE="Asia/Singapore",m.HANOI="Asia/Ho_Chi_Minh",m.BANGKOK="Asia/Bangkok",m.JAKARTA="Asia/Jakarta",m.KUALA_LUMPUR="Asia/Kuala_Lumpur",m.MANILA="Asia/Manila",m.DUBAI="Asia/Dubai",m.KOLKATA="Asia/Kolkata",m.RIYADH="Asia/Riyadh",m.TEHRAN="Asia/Tehran",m.JERUSALEM="Asia/Jerusalem",m.TEL_AVIV="Asia/Tel_Aviv",m.BAGHDAD="Asia/Baghdad",m.DHAKA="Asia/Dhaka",m.KARACHI="Asia/Karachi",m.KABUL="Asia/Kabul",m.KATHMANDU="Asia/Kathmandu",m.COLOMBO="Asia/Colombo",m.TASHKENT="Asia/Tashkent",m.ALMATY="Asia/Almaty",m.PHNOM_PENH="Asia/Phnom_Penh",m.VIENTIANE="Asia/Vientiane",m.MUSCAT="Asia/Muscat",m.SYDNEY="Australia/Sydney",m.MELBOURNE="Australia/Melbourne",m.BRISBANE="Australia/Brisbane",m.PERTH="Australia/Perth",m.ADELAIDE="Australia/Adelaide",m.DARWIN="Australia/Darwin",m.HOBART="Australia/Hobart",m.AUCKLAND="Pacific/Auckland",m.FIJI="Pacific/Fiji",m.GUAM="Pacific/Guam",m.NOUMEA="Pacific/Noumea",m.PAGO_PAGO="Pacific/Pago_Pago",m.PORT_MORESBY="Pacific/Port_Moresby",m.SAO_PAULO="America/Sao_Paulo",m.BUENOS_AIRES="America/Argentina/Buenos_Aires",m.SANTIAGO="America/Santiago",m.LIMA="America/Lima",m.BOGOTA="America/Bogota",m.CARACAS="America/Caracas",m.LA_PAZ="America/La_Paz",m.MONTEVIDEO="America/Montevideo",m.QUITO="America/Quito",m.ASUNCION="America/Asuncion",m.GEORGETOWN="America/Guyana",m.CAIRO="Africa/Cairo",m.JOHANNESBURG="Africa/Johannesburg",m.LAGOS="Africa/Lagos",m.NAIROBI="Africa/Nairobi",m.CASABLANCA="Africa/Casablanca",m.ALGIERS="Africa/Algiers",m.TUNIS="Africa/Tunis",m.ADDIS_ABABA="Africa/Addis_Ababa",m.ACCRA="Africa/Accra",m.DAKAR="Africa/Dakar",m.LUANDA="Africa/Luanda",m.ANTANANARIVO="Indian/Antananarivo",m.KINSHASA="Africa/Kinshasa",m.DAR_ES_SALAAM="Africa/Dar_es_Salaam",m.MCMURDO="Antarctica/McMurdo",m.CASEY="Antarctica/Casey";const C=e=>{if(e instanceof Date){return e.getHours()+e.getMinutes()/60}return function(e){var t;if(e instanceof Date)return e.getHours()+e.getMinutes()/60;if(g(e))return 0;if(null===e||"object"!=typeof e||!("hour"in e)||void 0===e.hour)return 0;const n=e;return n.hour+(null!==(t=n.minute)&&void 0!==t?t:0)/60}(e)},T=(e,t)=>{if(e instanceof Date){const n=new Date(e),a=Math.floor(t),r=Math.round(60*(t-a));return n.setHours(a,r,0,0),n}return y(e,t)},S=e=>{const t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate())),n=t.getUTCDay()||7;t.setUTCDate(t.getUTCDate()+4-n);const a=new Date(Date.UTC(t.getUTCFullYear(),0,1));return Math.ceil(((t.getTime()-a.getTime())/864e5+1)/7)},M=(e,n)=>{if(e instanceof Date&&n instanceof Date)return e.getFullYear()===n.getFullYear()&&e.getMonth()===n.getMonth()&&e.getDate()===n.getDate();return D(e instanceof Date?t.Temporal.PlainDate.from({year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}):g(e)?e:e.toPlainDate(),n instanceof Date?t.Temporal.PlainDate.from({year:n.getFullYear(),month:n.getMonth()+1,day:n.getDate()}):g(n)?n:n.toPlainDate())},x=e=>!e.readOnly&&!e.subscription,k=[{id:"blue",name:"Blue",isDefault:!0,colors:{eventColor:"#eff6ff",eventSelectedColor:"rgba(59, 130, 246)",lineColor:"#3b82f6",textColor:"#1e3a8a"},darkColors:{eventColor:"rgba(30, 64, 175, 0.8)",eventSelectedColor:"rgba(30, 58, 138, 1)",lineColor:"#3b82f6",textColor:"#dbeafe"}},{id:"green",name:"Green",isDefault:!0,colors:{eventColor:"#f0fdf4",eventSelectedColor:"rgba(16, 185, 129, 1)",lineColor:"#10b981",textColor:"#064e3b"},darkColors:{eventColor:"rgba(4, 120, 87, 0.8)",eventSelectedColor:"rgba(6, 78, 59, 1)",lineColor:"#10b981",textColor:"#d1fae5"}},{id:"purple",name:"Purple",isDefault:!0,colors:{eventColor:"#faf5ff",eventSelectedColor:"rgba(139, 92, 246, 1)",lineColor:"#8b5cf6",textColor:"#5b21b6"},darkColors:{eventColor:"rgba(109, 40, 217, 0.8)",eventSelectedColor:"rgba(91, 33, 182, 1)",lineColor:"#8b5cf6",textColor:"#ede9fe"}},{id:"yellow",name:"Yellow",isDefault:!0,colors:{eventColor:"#fefce8",eventSelectedColor:"rgba(245, 158, 11, 1)",lineColor:"#f59e0b",textColor:"#78350f"},darkColors:{eventColor:"rgba(180, 83, 9, 0.8)",eventSelectedColor:"rgba(120, 53, 15, 1)",lineColor:"#f59e0b",textColor:"#fef3c7"}},{id:"red",name:"Red",isDefault:!0,colors:{eventColor:"#fef2f2",eventSelectedColor:"rgba(239, 68, 68, 1)",lineColor:"#ef4444",textColor:"#7f1d1d"},darkColors:{eventColor:"rgba(185, 28, 28, 0.8)",eventSelectedColor:"rgba(127, 29, 29, 1)",lineColor:"#ef4444",textColor:"#fee2e2"}},{id:"orange",name:"Orange",isDefault:!0,colors:{eventColor:"#fff7edb3",eventSelectedColor:"rgba(249, 115, 22, 1)",lineColor:"#f97316",textColor:"#7c2d12"},darkColors:{eventColor:"rgba(194, 65, 12, 0.8)",eventSelectedColor:"rgba(124, 45, 18, 1)",lineColor:"#f97316",textColor:"#fed7aa"}},{id:"pink",name:"Pink",isDefault:!0,colors:{eventColor:"#fdf2f8",eventSelectedColor:"rgba(236, 72, 153, 1)",lineColor:"#ec4899",textColor:"#831843"},darkColors:{eventColor:"rgba(190, 24, 93, 0.8)",eventSelectedColor:"rgba(131, 24, 67, 1)",lineColor:"#ec4899",textColor:"#fce7f3"}},{id:"teal",name:"Teal",isDefault:!0,colors:{eventColor:"#f0fdfa",eventSelectedColor:"rgba(20, 184, 166, 1)",lineColor:"#14b8a6",textColor:"#134e4a"},darkColors:{eventColor:"rgba(15, 118, 110, 0.8)",eventSelectedColor:"rgba(19, 78, 74, 1)",lineColor:"#14b8a6",textColor:"#ccfbf1"}},{id:"indigo",name:"Indigo",isDefault:!0,colors:{eventColor:"#eef2ffb3",eventSelectedColor:"rgba(99, 102, 241, 1)",lineColor:"#6366f1",textColor:"#312e81"},darkColors:{eventColor:"rgba(67, 56, 202, 0.8)",eventSelectedColor:"rgba(49, 46, 129, 1)",lineColor:"#6366f1",textColor:"#e0e7ff"}},{id:"gray",name:"Gray",isDefault:!0,colors:{eventColor:"#f9fafbb3",eventSelectedColor:"rgba(107, 114, 128, 1)",lineColor:"#6b7280",textColor:"#1f2937"},darkColors:{eventColor:"rgba(75, 85, 99, 0.8)",eventSelectedColor:"rgba(31, 41, 55, 1)",lineColor:"#6b7280",textColor:"#f3f4f6"}}];class N{constructor(e,t,n="light"){this.calendars=new Map,this.defaultCalendarId=t||"blue",this.currentTheme=n;const a=e&&e.length>0;e?e.forEach(e=>{this.calendars.set(e.id,e)}):k.forEach(e=>{this.calendars.set(e.id,Object.assign(Object.assign({},e),{isVisible:!a&&e.isVisible}))})}register(e){this.calendars.set(e.id,e)}unregister(e){return this.calendars.delete(e)}get(e){return this.calendars.get(e)}getAll(){return Array.from(this.calendars.values())}getVisible(){return this.getAll().filter(e=>!1!==e.isVisible)}has(e){return this.calendars.has(e)}reorder(e,t){const n=Array.from(this.calendars.entries());if(e<0||e>=n.length||t<0||t>=n.length)return;const[a]=n.splice(e,1);n.splice(t,0,a),this.calendars.clear(),n.forEach(([e,t])=>{this.calendars.set(e,t)})}setVisibility(e,t){const n=this.calendars.get(e);n&&this.calendars.set(e,Object.assign(Object.assign({},n),{isVisible:t}))}setAllVisibility(e){this.calendars.forEach((t,n)=>{this.calendars.set(n,Object.assign(Object.assign({},t),{isVisible:e}))})}updateCalendar(e,t){const n=this.calendars.get(e);n&&this.calendars.set(e,Object.assign(Object.assign({},n),t))}setDefaultCalendar(e){if(!this.has(e))throw new Error(`Calendar type '${e}' does not exist`);this.defaultCalendarId=e}getDefaultCalendarId(){return this.defaultCalendarId}getDefaultCalendar(){const e=this.get(this.defaultCalendarId);return e||this.getAll()[0]}getDefaultWritableCalendar(){const e=this.getDefaultCalendar();return e&&x(e)?e:this.getAll().find(x)}setTheme(e){this.currentTheme=e}getTheme(){return this.currentTheme}resolveColors(e,t){const n=t||this.currentTheme,a=N.isDarkTheme(n);let r;return e&&(r=this.get(e)),r||(r=this.getDefaultCalendar()),a&&r.darkColors?r.darkColors:r.colors}getSelectedBgColor(e,t){return this.resolveColors(e,t).eventSelectedColor}getLineColor(e,t){return this.resolveColors(e,t).lineColor}getTextColor(e,t){return this.resolveColors(e,t).textColor}static isDarkTheme(e){return"dark"===e||"light"!==e&&(!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-color-scheme: dark)").matches)}static validate(e){const t=[];return e.id||t.push("Calendar type must have an id"),e.name||t.push("Calendar type must have a name"),e.colors?(e.colors.eventColor||t.push("Calendar colors must include eventColor"),e.colors.eventSelectedColor||t.push("Calendar colors must include eventSelectedColor"),e.colors.lineColor||t.push("Calendar colors must include lineColor"),e.colors.textColor||t.push("Calendar colors must include textColor")):t.push("Calendar type must have colors configuration"),t}}let I=new N;function R(){return I}function O(e){const t=k.find(t=>t.colors.lineColor.toLowerCase()===e.toLowerCase());return t?{colors:t.colors,darkColors:t.darkColors}:{colors:{eventColor:e+"1A",eventSelectedColor:e,lineColor:e,textColor:e},darkColors:{eventColor:e+"CC",eventSelectedColor:e,lineColor:e,textColor:"#ffffff"}}}const H=(e,t)=>(t||R()).resolveColors(e).eventColor,P=(e,t)=>(t||R()).resolveColors(e).textColor,A=(e,t)=>(t||R()).resolveColors(e).eventSelectedColor,L=(e,t)=>(t||R()).resolveColors(e).lineColor,$=e=>{var t,n;return(null!==(n=null===(t=e.calendarIds)||void 0===t?void 0:t[0])&&void 0!==n?n:e.calendarId)||"blue"},F=(e,t)=>{var n;const a=t||R();return(null!==(n=e.calendarIds)&&void 0!==n?n:e.calendarId?[e.calendarId]:["blue"]).map(e=>a.getLineColor(e))},Y=e=>{if(1===e.length)return e[0];const t=[];return e.forEach((n,a)=>{const r=a/e.length*100,o=(a+1)/e.length*100;t.push(`${n} ${r}%`,`${n} ${o}%`)}),`linear-gradient(to bottom, ${t.join(", ")})`},j=(e,t=6)=>{if(1===e.length)return e[0];const n=[];return e.forEach((e,a)=>{const r=a*t,o=(a+1)*t;n.push(`${e} ${r}px`,`${e} ${o}px`)}),`repeating-linear-gradient(-45deg, ${n.join(", ")})`},V=(e,t)=>{var n;const a=t||R();return(null!==(n=e.calendarIds)&&void 0!==n?n:e.calendarId?[e.calendarId]:["blue"]).map(e=>a.resolveColors(e).eventColor)},_=(e,t=6)=>{if(1===e.length)return e[0];const n=[];return e.forEach((e,a)=>{const r=a*t,o=(a+1)*t;n.push(`${e} ${r}px`,`${e} ${o}px`)}),`repeating-linear-gradient(-45deg, ${n.join(", ")})`};const Z=new class{constructor(){var e,t;this.isDevelopment="production"!==(null===(t=null===(e=globalThis.process)||void 0===e?void 0:e.env)||void 0===t?void 0:t.NODE_ENV)}formatMessage(e,t,...n){if(!this.isDevelopment)return;const a=(new Date).toISOString(),r=`[DayFlow ${e.toUpperCase()}] ${a}:`;switch(e){case"log":console.log(r,t,...n);break;case"warn":console.warn(r,t,...n);break;case"error":console.error(r,t,...n);break;case"debug":console.debug(r,t,...n)}}log(e,...t){this.formatMessage("log",e,...t)}warn(e,...t){this.formatMessage("warn",e,...t)}error(e,...t){this.formatMessage("error",e,...t)}debug(e,...t){this.formatMessage("debug",e,...t)}},z=new Map;function W(e){try{return new Intl.DateTimeFormat("en",{timeZone:e}).resolvedOptions().timeZone}catch(e){return}}function U(e){if(!e||"string"!=typeof e)return;const t=e.trim();if(!t)return;const n=z.get(t);if(n)return n;const a=W(t);if(a)return z.set(t,a),a;const r=Object.values(exports.TimeZone).find(e=>e.toLowerCase()===t.toLowerCase());if(r){const e=W(r);return e?(z.set(t,e),e):(z.set(t,r),r)}if("function"==typeof Intl.supportedValuesOf){const e=Intl.supportedValuesOf("timeZone").find(e=>e.toLowerCase()===t.toLowerCase());if(e)return z.set(t,e),e}const o=W(t.split("/").map(e=>e.split("_").map(e=>e?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():e).join("_")).join("/"));if(o)return z.set(t,o),o;const i=W(t.split("/").map((e,t)=>0===t?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():e).join("/"));return i?(z.set(t,i),i):t}function B(e){return null!==e&&"object"==typeof e&&!("hour"in e)&&"year"in e&&"month"in e&&"day"in e&&!(e instanceof Date)}function q(e){return null!==e&&"object"==typeof e&&"hour"in e&&!("timeZone"in e)&&!("timeZoneId"in e)&&"year"in e&&!(e instanceof Date)}function G(e){return null!==e&&"object"==typeof e&&("timeZone"in e||"timeZoneId"in e)&&"year"in e&&!(e instanceof Date)}function K(e){if(e instanceof Date)return e;if(B(e))return new Date(e.year,e.month-1,e.day);if(q(e))return new Date(e.year,e.month-1,e.day,e.hour,e.minute,e.second||0,e.millisecond||0);if(G(e))try{if("function"==typeof e.toInstant){const t=e.toInstant();return new Date(t.epochMilliseconds)}return"number"==typeof e.epochMilliseconds?new Date(e.epochMilliseconds):new Date(e.year,e.month-1,e.day,e.hour,e.minute)}catch(t){return new Date(e.year,e.month-1,e.day,e.hour,e.minute)}return new Date(e)}function X(e,n){if(e instanceof Date)return e;if(!n)return K(e);const a=U(n);if(!a)return K(e);try{if(G(e)){const n=("function"==typeof e.withTimeZone?e:t.Temporal.ZonedDateTime.from(e)).withTimeZone(a);return new Date(n.year,n.month-1,n.day,n.hour,n.minute,n.second||0,n.millisecond||0)}if(q(e)){const n="function"==typeof e.toZonedDateTime?e:t.Temporal.PlainDateTime.from(e),r=n.toZonedDateTime(t.Temporal.Now.timeZoneId()).withTimeZone(a);return new Date(r.year,r.month-1,r.day,r.hour,r.minute,r.second||0,r.millisecond||0)}}catch(e){Z.error("Failed to shift visual timezone:",e)}return K(e)}function J(e,n){if(!n)return e;const a=U(n);if(!a)return e;try{if(G(e)){return("function"==typeof e.withTimeZone?e:t.Temporal.ZonedDateTime.from(e)).withTimeZone(a)}if(q(e)){return("function"==typeof e.toZonedDateTime?e:t.Temporal.PlainDateTime.from(e)).toZonedDateTime(t.Temporal.Now.timeZoneId()).withTimeZone(a)}}catch(e){Z.error("Failed to shift visual temporal:",e)}return e}function Q(e){return t.Temporal.PlainDate.from({year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()})}function ee(e){return t.Temporal.PlainDateTime.from({year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate(),hour:e.getHours(),minute:e.getMinutes(),second:e.getSeconds(),millisecond:e.getMilliseconds()})}function te(e,n=t.Temporal.Now.timeZoneId()){return t.Temporal.ZonedDateTime.from({year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate(),hour:e.getHours(),minute:e.getMinutes(),second:e.getSeconds(),millisecond:e.getMilliseconds(),timeZone:n})}function ne(e){return e instanceof Date?Q(e):B(e)?e:(q(e),e.toPlainDate())}const ae=e=>new Date(e.year,e.month-1,e.day,e.hour,e.minute,e.second,Math.floor(e.millisecond)),re=(e,t=0,n="24h",a=!0)=>{const r=Math.floor(e),o=t||Math.round(60*(e-r));if("12h"===n){const e=r>=12?"PM":"AM",t=r%12||12;return 0===o?`${t}${a?` ${e}`:""}`:`${t}:${o.toString().padStart(2,"0")}${a?` ${e}`:""}`}return`${r.toString().padStart(2,"0")}:${o.toString().padStart(2,"0")}`},oe=e=>{if(!e.end)return 0;const t=C(e.end);if(e.allDay||!e.start)return t;const n=p(e.start),a=p(e.end);if(!(n.getFullYear()!==a.getFullYear()||n.getMonth()!==a.getMonth()||n.getDate()!==a.getDate()))return t;if(0===t&&0===a.getMinutes()&&0===a.getSeconds()&&0===a.getMilliseconds()){const e=a.getTime()-n.getTime();if(e>0&&e<864e5)return 24}return t},ie=(e,t="24h")=>{const n=C(e.start),a=oe(e);return`${re(n,0,t)} - ${re(a,0,t)}`},le=(e,n,a="24h",r=new Date,o)=>{const i=U(n);if(!i)return e.map(()=>"");const l=null!=o?o:t.Temporal.Now.timeZoneId(),s=r.getFullYear(),d=r.getMonth()+1,c=r.getDate();return e.map(e=>{try{const n=e.hour%24,r=t.Temporal.ZonedDateTime.from({year:s,month:d,day:c,hour:n,minute:0,second:0,timeZone:l}).withTimeZone(i);return re(r.hour,r.minute,a)}catch(e){return""}})},se=(e,t=new Date)=>{var n,a;const r=U(e);if(!r)return"";try{return null!==(a=null===(n=new Intl.DateTimeFormat("en",{timeZone:r,timeZoneName:"short"}).formatToParts(t).find(e=>"timeZoneName"===e.type))||void 0===n?void 0:n.value)&&void 0!==a?a:r}catch(e){return r}},de=e=>{var n;const a=null!==(n=e?U(e):void 0)&&void 0!==n?n:t.Temporal.Now.timeZoneId();return ae(t.Temporal.Now.zonedDateTimeISO(a))},ce=e=>{var n;const a=null!==(n=e?U(e):void 0)&&void 0!==n?n:t.Temporal.Now.timeZoneId(),r=t.Temporal.Now.plainDateISO(a);return new Date(r.year,r.month-1,r.day)},ue=e=>{var n;const a=null!==(n=e?U(e):void 0)&&void 0!==n?n:t.Temporal.Now.timeZoneId(),r=t.Temporal.Now.zonedDateTimeISO(a).add({hours:1}).with({minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});return{start:ae(r),end:ae(r.add({hours:1}))}},he=(e,n,a)=>{var r,o;const i=p(e);if(G(n)){const e=null!==(r=U(a))&&void 0!==r?r:t.Temporal.Now.timeZoneId(),o=(e=>{var n;const a=e;return a.timeZoneId||("string"==typeof a.timeZone?a.timeZone:null===(n=a.timeZone)||void 0===n?void 0:n.id)||t.Temporal.Now.timeZoneId()})(n);return te(i,e).toInstant().toZonedDateTimeISO(o)}return q(n)?ee(i):G(e)?e:te(i,null!==(o=U(a))&&void 0!==o?o:t.Temporal.Now.timeZoneId())},me=(e,t,n)=>t.allDay?Object.assign(Object.assign({},t),{allDay:!0,start:B(t.start)?t.start:Q(p(t.start)),end:B(t.end)?t.end:Q(p(t.end))}):Object.assign(Object.assign({},t),{allDay:!1,start:he(t.start,e.allDay?t.start:e.start,n),end:he(t.end,e.allDay?t.end:e.end,n)}),ge=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],fe=["January","February","March","April","May","June","July","August","September","October","November","December"],ve=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],pe=(e,t=1)=>{const n=(e.getDay()-t+7)%7,a=new Date(e);a.setDate(e.getDate()-n),a.setHours(0,0,0,0);const r=new Date(a);return r.setDate(a.getDate()+6),r.setHours(23,59,59,999),{monday:a,sunday:r}},ye=e=>{const t=new Date(e),n=t.getDate(),a=t.getMonth(),r=t.getFullYear(),o=new Date;return{date:t,day:n,month:a,year:r,monthName:fe[a],shortMonthName:ve[a],isToday:o.getDate()===n&&o.getMonth()===a&&o.getFullYear()===r}},De=e=>{const t={};e.forEach(e=>{const n=`${e.month}-${e.year}`;t[n]=(t[n]||0)+1});let n=0,a="";Object.entries(t).forEach(([e,t])=>{t>n&&(n=t,a=e)});const[r,o]=a.split("-").map(Number);return{month:fe[r],monthIndex:r,year:o}},we=e=>{const t=[],n=new Date(e);for(let e=0;e<7;e++){const e=new Date(n);t.push(ye(e)),n.setDate(n.getDate()+1)}return{days:t,startDate:new Date(e),monthYear:De(t)}};function be(e,t,n=1){const a=[],r=Math.floor(t/2),o=(e.getDay()-n+7)%7,i=new Date(e);i.setDate(e.getDate()-o),i.setHours(0,0,0,0);const l=new Date(i);l.setDate(l.getDate()-7*r);for(let e=0;e<t;e++){const t=new Date(l);t.setDate(t.getDate()+7*e),a.push(we(t))}return a}const Ee=(e,t)=>t.filter(t=>t.day===e&&!t.allDay),Ce=(e,t)=>{const n=new Date(e);return n.setDate(e.getDate()+t),n},Te=(e,n)=>n?t.Temporal.PlainDate.from({year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}):t.Temporal.ZonedDateTime.from({year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate(),hour:e.getHours(),minute:e.getMinutes(),second:e.getSeconds(),millisecond:e.getMilliseconds(),timeZone:t.Temporal.Now.timeZoneId()}),Se=(e,t)=>{const n=new Date(e);n.setHours(0,0,0,0);const a=new Date(t);a.setHours(0,0,0,0);const r=n.getTime()-a.getTime();return Math.floor(r/864e5)},Me=(e,t)=>e.map(e=>{const n=p(e.start),a=Se(n,t);return Object.assign(Object.assign({},e),{day:a})}),xe=(e,t)=>e===t||!(!e||!t)&&(e.title===t.title&&e.calendarId===t.calendarId&&(e.description||"")===(t.description||"")&&!!e.allDay==!!t.allDay&&e.start.toString()===t.start.toString()&&e.end.toString()===t.end.toString()),ke=(e,t)=>p(e.start).getTime()!==p(t.start).getTime()||p(e.end).getTime()!==p(t.end).getTime()||e.title!==t.title||e.day!==t.day||!!e.allDay!=!!t.allDay;function Ne(){return Date.now().toString(36)+Math.random().toString(36).slice(2,8)}function Ie(e,t){if(e===t)return!0;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;const n=Object.keys(e),a=Object.keys(t);if(n.length!==a.length)return!1;const r=e,o=t;for(const e of n)if(!a.includes(e)||!Ie(r[e],o[e]))return!1;return!0}function Re(e){return{allDaySortComparator:e.allDaySortComparator,calendars:e.calendars,customMobileEventRenderer:e.customMobileEventRenderer,locale:e.locale,readOnly:e.readOnly,switcherMode:e.switcherMode,theme:e.theme,timeZone:e.timeZone,useCalendarHeader:e.useCalendarHeader,useEventDetailDialog:e.useEventDetailDialog,views:e.views}}function Oe(e){return{callbacks:e.callbacks,syncableConfig:Re(e)}}function He(e,t){return e===t?null:{callbacks:t}}function Pe(e,t){const n={};return e.views!==t.views&&(n.views=t.views),Ie(e.calendars,t.calendars)||(n.calendars=t.calendars),Ie(e.theme,t.theme)||(n.theme=t.theme),e.useEventDetailDialog!==t.useEventDetailDialog&&(n.useEventDetailDialog=t.useEventDetailDialog),e.useCalendarHeader!==t.useCalendarHeader&&(n.useCalendarHeader=t.useCalendarHeader),e.customMobileEventRenderer!==t.customMobileEventRenderer&&(n.customMobileEventRenderer=t.customMobileEventRenderer),e.switcherMode!==t.switcherMode&&(n.switcherMode=t.switcherMode),Ie(e.locale,t.locale)||(n.locale=t.locale),Ie(e.readOnly,t.readOnly)||(n.readOnly=t.readOnly),e.allDaySortComparator!==t.allDaySortComparator&&(n.allDaySortComparator=t.allDaySortComparator),e.timeZone!==t.timeZone&&(n.timeZone=t.timeZone),n}const Ae={hasChanges:!1,requiresRender:!1},Le=(e,t)=>{if(e===t)return Ae;const n=typeof e,a=typeof t;if("function"===n||"function"===a)return"function"===n&&"function"===a?{hasChanges:!0,requiresRender:!1}:{hasChanges:!0,requiresRender:!0};if(e instanceof Date&&t instanceof Date){const n=e.getTime()!==t.getTime();return{hasChanges:n,requiresRender:n}}if(Array.isArray(e)||Array.isArray(t)){if(!Array.isArray(e)||!Array.isArray(t))return{hasChanges:!0,requiresRender:!0};if(e.length!==t.length)return{hasChanges:!0,requiresRender:!0};let n=!1,a=!1;return e.forEach((e,r)=>{const o=Le(e,t[r]);n=n||o.hasChanges,a=a||o.requiresRender}),{hasChanges:n,requiresRender:a}}if("object"!==n||null===e||"object"!==a||null===t)return{hasChanges:!0,requiresRender:!0};if(Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return{hasChanges:!0,requiresRender:!0};const r=e,o=t,i=Object.keys(r),l=Object.keys(o);if(i.length!==l.length)return{hasChanges:!0,requiresRender:!0};let s=!1,d=!1;for(const e of i){if(!l.includes(e))return{hasChanges:!0,requiresRender:!0};const t=Le(r[e],o[e]);s=s||t.hasChanges,d=d||t.requiresRender}return{hasChanges:s,requiresRender:d}},$e=(e,t)=>e?e.component!==t.component||e.label!==t.label?{hasChanges:!0,requiresRender:!0}:Le(e.config,t.config):{hasChanges:!0,requiresRender:!0};class Fe{constructor(e=[]){this.events=new Map,this.isInTransaction=!1,this.pendingChanges=[],e.forEach(e=>this.events.set(e.id,e))}beginTransaction(){this.isInTransaction?console.warn("Transaction already in progress. Nested transactions are not supported."):(this.isInTransaction=!0,this.pendingChanges=[])}endTransaction(){var e;if(!this.isInTransaction)return;const t=Fe.normalizeChanges(this.pendingChanges);return this.isInTransaction=!1,this.pendingChanges=[],t.length>0?null===(e=this.onEventBatchChange)||void 0===e?void 0:e.call(this,t):void 0}createEvent(e){if(this.events.has(e.id))throw new Error(`Event with ID ${e.id} already exists.`);return this.events.set(e.id,e),this.emitChange({type:"create",event:e})}updateEvent(e,t){const n=this.events.get(e);if(!n)throw new Error(`Event with id ${e} not found`);const a=Object.assign(Object.assign({},n),t);return this.events.set(e,a),this.emitChange({type:"update",before:n,after:a})}deleteEvent(e){const t=this.events.get(e);if(t)return this.events.delete(e),this.emitChange({type:"delete",event:t})}getEvent(e){return this.events.get(e)}getAllEvents(){return Array.from(this.events.values())}emitChange(e){var t;if(!this.isInTransaction)return null===(t=this.onEventChange)||void 0===t?void 0:t.call(this,e);this.pendingChanges.push(e)}static normalizeChanges(e){const t=new Map;for(const n of e){const e="delete"===n.type?n.event.id:"update"===n.type?n.after.id:n.event.id,a=t.get(e);a?"create"===a.type?"update"===n.type?t.set(e,{type:"create",event:n.after}):"delete"===n.type&&t.delete(e):"update"===a.type?"update"===n.type?t.set(e,{type:"update",before:a.before,after:n.after}):"delete"===n.type&&t.set(e,{type:"delete",event:a.before}):"delete"===a.type&&"create"===n.type&&t.set(e,{type:"update",before:a.event,after:n.event}):t.set(e,n)}return Array.from(t.values())}}class Ye{constructor(e,t,n,a,r,o){this.state=e,this.registry=t,this.getCallbacks=n,this.notify=a,this.triggerRender=r,this.undoStack=[],this.pendingSnapshot=null,this.pendingChangeSource=null,this.externalEvents=new Map,this.MAX_UNDO_STACK=50,this.store=new Fe(o),this.setupStoreListeners()}setupStoreListeners(){this.store.onEventChange=e=>{var t,n,a,r;this.syncExternalEventsToState();let o=null;return"create"===e.type?o=null===(n=(t=this.getCallbacks()).onEventCreate)||void 0===n?void 0:n.call(t,e.event):"update"===e.type&&(o=null===(r=(a=this.getCallbacks()).onEventUpdate)||void 0===r?void 0:r.call(a,e.after)),this.triggerRender(),this.notify(),null!=o?o:void 0},this.store.onEventBatchChange=e=>{var t,n;this.syncExternalEventsToState();let a=null;return"drag"!==this.pendingChangeSource&&"resize"!==this.pendingChangeSource&&(a=null===(n=(t=this.getCallbacks()).onEventBatchChange)||void 0===n?void 0:n.call(t,e)),this.pendingChangeSource=null,this.triggerRender(),this.notify(),null!=a?a:void 0}}getStore(){return this.store}pushToUndo(e){this.undoStack.push({type:"events_snapshot",data:e||[...this.state.events]}),this.undoStack.length>this.MAX_UNDO_STACK&&this.undoStack.shift()}undo(){if(0===this.undoStack.length)return;const e=this.undoStack.pop();"events_snapshot"===(null==e?void 0:e.type)&&(this.state.events=e.data,this.store=new Fe(this.state.events),this.setupStoreListeners(),this.triggerRender(),this.notify())}applyEventsChanges(e,t,n){if(t?this.pendingSnapshot||(this.pendingSnapshot=[...this.state.events]):this.pendingSnapshot?(this.pushToUndo(this.pendingSnapshot),this.pendingSnapshot=null):this.pushToUndo(),t){let t=[...this.state.events];if(e.delete){const n=new Set(e.delete);t=t.filter(e=>!n.has(e.id))}return e.update&&e.update.forEach(({id:e,updates:n})=>{const a=t.findIndex(t=>t.id===e);-1!==a&&(t[a]=Object.assign(Object.assign({},t[a]),n))}),e.add&&(t=[...t,...e.add]),this.state.events=t,void this.notify()}n&&(this.pendingChangeSource=n),this.store.beginTransaction(),e.delete&&e.delete.forEach(e=>this.store.deleteEvent(e)),e.update&&e.update.forEach(({id:e,updates:t})=>{try{this.store.updateEvent(e,t)}catch(t){Z.warn(`Failed to update event ${e}:`,t)}}),e.add&&e.add.forEach(e=>{try{this.store.createEvent(e)}catch(t){Z.warn(`Failed to create event ${e.id}:`,t)}}),this.store.endTransaction()}addEvent(e){this.pendingSnapshot=null,this.pushToUndo(),this.store.createEvent(e)}addExternalEvents(e,t){const n=t.map(t=>Object.assign(Object.assign({},t),{calendarId:e}));this.externalEvents.set(e,n),this.syncExternalEventsToState(),this.notify()}syncExternalEventsToState(){const e=this.store.getAllEvents(),t=new Map;if(e.forEach(e=>t.set(e.id,e)),this.externalEvents.size>0)for(const e of this.externalEvents.values())e.forEach(e=>t.set(e.id,e));this.state.events=Array.from(t.values())}updateEvent(t,n,a,r){return e.__awaiter(this,void 0,void 0,function*(){if(r&&(this.pendingChangeSource=r),a?this.pendingSnapshot||(this.pendingSnapshot=[...this.state.events]):this.pendingSnapshot?(this.pushToUndo(this.pendingSnapshot),this.pendingSnapshot=null):this.pushToUndo(),a){const e=this.state.events.findIndex(e=>e.id===t);if(-1===e)throw new Error(`Event with id ${t} not found`);const a=Object.assign(Object.assign({},this.state.events[e]),n);return this.state.events=[...this.state.events.slice(0,e),a,...this.state.events.slice(e+1)],void this.notify()}yield this.store.updateEvent(t,n)})}deleteEvent(t){return e.__awaiter(this,void 0,void 0,function*(){var e,n;yield null===(n=(e=this.getCallbacks()).onEventDelete)||void 0===n?void 0:n.call(e,t),this.pendingSnapshot=null,this.pushToUndo(),yield this.store.deleteEvent(t)})}getAllEvents(){return[...this.state.events]}getEvents(){const e=this.state.events||[],t=new Set(this.registry.getAll().filter(e=>!1!==e.isVisible).map(e=>e.id));return e.filter(e=>{var n;const a=null!==(n=e.calendarIds)&&void 0!==n?n:e.calendarId?[e.calendarId]:[];return 0!==a.length&&a.some(e=>t.has(e))})}onEventClick(e){var t,n;null===(n=(t=this.getCallbacks()).onEventClick)||void 0===n||n.call(t,e)}onEventDoubleClick(e,t){var n,a;return null===(a=(n=this.getCallbacks()).onEventDoubleClick)||void 0===a?void 0:a.call(n,e,t)}onMoreEventsClick(e){var t,n;null===(n=(t=this.getCallbacks()).onMoreEventsClick)||void 0===n||n.call(t,e)}onEventDetailToggle(e){var t,n;null===(n=(t=this.getCallbacks()).onEventDetailToggle)||void 0===n||n.call(t,e),this.notify()}highlightEvent(e){var t,n;this.state.highlightedEventId!==e&&(this.state.highlightedEventId=e,null===(n=(t=this.getCallbacks()).onRender)||void 0===n||n.call(t),this.notify())}selectEvent(e){var t,n;this.state.selectedEventId!==e&&(this.state.selectedEventId=e,null===(n=(t=this.getCallbacks()).onRender)||void 0===n||n.call(t),this.notify())}dismissUI(){var e,t;null===(t=(e=this.getCallbacks()).onDismissUI)||void 0===t||t.call(e),this.notify()}}class je{constructor(e,t,n,a){this.state=e,this.getCallbacks=t,this.notify=n,this.visibleMonth=new Date(a.getFullYear(),a.getMonth(),1)}changeView(e){var t,n;if(!this.state.views.has(e))throw new Error(`View ${e} is not registered`);this.state.currentView=e,this.state.highlightedEventId=null,null===(n=(t=this.getCallbacks()).onViewChange)||void 0===n||n.call(t,e),this.handleVisibleRangeChange("viewChange"),this.notify()}getCurrentView(){const e=this.state.views.get(this.state.currentView);if(!e)throw new Error(`Current view ${this.state.currentView} is not registered`);return e}emitVisibleRange(e,t,n="navigation"){var a,r;null===(r=(a=this.getCallbacks()).onVisibleRangeChange)||void 0===r||r.call(a,new Date(e),new Date(t),n)}handleVisibleRangeChange(e){var t,n,a,r;const o=this.state.views.get(this.state.currentView);switch(null==o?void 0:o.type){case exports.ViewType.DAY:{const t=new Date(this.state.currentDate);t.setHours(0,0,0,0);const n=new Date(t);n.setDate(n.getDate()+1),this.emitVisibleRange(t,n,e);break}case exports.ViewType.WEEK:{const a=null!==(n=null===(t=null==o?void 0:o.config)||void 0===t?void 0:t.startOfWeek)&&void 0!==n?n:1,{monday:r}=pe(this.state.currentDate,a),i=new Date(r),l=new Date(r);l.setDate(l.getDate()+7),this.emitVisibleRange(i,l,e);break}case exports.ViewType.MONTH:{if("navigation"===e)break;const t=new Date(this.state.currentDate.getFullYear(),this.state.currentDate.getMonth(),1),n=null!==(r=null===(a=null==o?void 0:o.config)||void 0===a?void 0:a.startOfWeek)&&void 0!==r?r:1,{monday:i}=pe(t,n),l=new Date(i),s=new Date(i);s.setDate(s.getDate()+42),this.emitVisibleRange(l,s,e);break}case exports.ViewType.YEAR:{const t=new Date(this.state.currentDate.getFullYear(),0,1);t.setHours(0,0,0,0);const n=new Date(this.state.currentDate.getFullYear(),11,31);n.setDate(n.getDate()+1),this.emitVisibleRange(t,n,e);break}}}setCurrentDate(e){var t,n;this.state.currentDate=new Date(e),null===(n=(t=this.getCallbacks()).onDateChange)||void 0===n||n.call(t,this.state.currentDate),this.setVisibleMonth(this.state.currentDate),this.handleVisibleRangeChange("navigation"),this.notify()}getCurrentDate(){return new Date(this.state.currentDate)}setVisibleMonth(e){const t=new Date(e.getFullYear(),e.getMonth(),1);this.visibleMonth.getFullYear()===t.getFullYear()&&this.visibleMonth.getMonth()===t.getMonth()||(this.visibleMonth=t,this.notify())}getVisibleMonth(){return new Date(this.visibleMonth)}goToToday(){const e=t.Temporal.Now.plainDateISO(this.state.timeZone),n=new Date(e.year,e.month-1,e.day);this.setCurrentDate(n)}goToPrevious(){const e=new Date(this.state.currentDate);switch(this.state.currentView){case exports.ViewType.DAY:e.setDate(e.getDate()-1);break;case exports.ViewType.WEEK:e.setDate(e.getDate()-7);break;case exports.ViewType.MONTH:e.setMonth(e.getMonth()-1);break;case exports.ViewType.YEAR:e.setFullYear(e.getFullYear()-1)}this.setCurrentDate(e)}goToNext(){const e=new Date(this.state.currentDate);switch(this.state.currentView){case exports.ViewType.DAY:e.setDate(e.getDate()+1);break;case exports.ViewType.WEEK:e.setDate(e.getDate()+7);break;case exports.ViewType.MONTH:e.setMonth(e.getMonth()+1);break;case exports.ViewType.YEAR:e.setFullYear(e.getFullYear()+1)}this.setCurrentDate(e)}selectDate(e){var t,n;this.setCurrentDate(e),null===(n=(t=this.getCallbacks()).onDateChange)||void 0===n||n.call(t,new Date(e))}}class Ve{constructor(e,t){this.state=e,this.notify=t}install(e,t){this.state.plugins.has(e.name)?Z.warn(`Plugin ${e.name} is already installed`):(this.state.plugins.set(e.name,e),e.install(t))}getPlugin(e){const t=this.state.plugins.get(e);return null==t?void 0:t.api}hasPlugin(e){return this.state.plugins.has(e)}getPluginConfig(e){const t=this.state.plugins.get(e);return(null==t?void 0:t.config)||{}}updatePluginConfig(e,t){const n=this.state.plugins.get(e);n&&(n.config=Object.assign(Object.assign({},n.config),t),this.notify())}}class _e{constructor(n){var a,r,o,i,l;this.subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e)),this.notify=()=>{this.listeners.forEach(e=>e(this))},this.triggerRender=()=>{var e,t;null===(t=(e=this.callbacks).onRender)||void 0===t||t.call(e),this.notify()},this.changeView=e=>this.navigation.changeView(e),this.getCurrentView=()=>this.navigation.getCurrentView(),this.emitVisibleRange=(e,t,n)=>this.navigation.emitVisibleRange(e,t,n),this.handleVisibleRangeChange=e=>this.navigation.handleVisibleRangeChange(e),this.setCurrentDate=e=>this.navigation.setCurrentDate(e),this.getCurrentDate=()=>this.navigation.getCurrentDate(),this.setVisibleMonth=e=>this.navigation.setVisibleMonth(e),this.getVisibleMonth=()=>this.navigation.getVisibleMonth(),this.goToToday=()=>this.navigation.goToToday(),this.goToPrevious=()=>this.navigation.goToPrevious(),this.goToNext=()=>this.navigation.goToNext(),this.selectDate=e=>this.navigation.selectDate(e),this.undo=()=>this.eventManager.undo(),this.applyEventsChanges=(e,t,n)=>this.eventManager.applyEventsChanges(e,t,n),this.addEvent=e=>this.eventManager.addEvent(e),this.addExternalEvents=(e,t)=>this.eventManager.addExternalEvents(e,t),this.updateEvent=(e,t,n,a)=>this.eventManager.updateEvent(e,t,n,a),this.deleteEvent=e=>this.eventManager.deleteEvent(e),this.getAllEvents=()=>this.eventManager.getAllEvents(),this.getEvents=()=>this.eventManager.getEvents(),this.onEventClick=e=>this.eventManager.onEventClick(e),this.onEventDoubleClick=(e,t)=>this.eventManager.onEventDoubleClick(e,t),this.onMoreEventsClick=e=>this.eventManager.onMoreEventsClick(e),this.onEventDetailToggle=e=>this.eventManager.onEventDetailToggle(e),this.highlightEvent=e=>this.eventManager.highlightEvent(e),this.selectEvent=e=>this.eventManager.selectEvent(e),this.dismissUI=()=>this.eventManager.dismissUI(),this.getReadOnlyConfig=e=>function(e,t,n,a){var r,o;let i=!0,l=!0;if(!0===e?(i=!1,l=!1):!1!==e&&(i=null===(r=e.draggable)||void 0===r||r,l=null===(o=e.viewable)||void 0===o||o),t&&(i||l)){let e=t;const r=a.find(e=>e.id===t);(null==r?void 0:r.calendarId)&&(e=r.calendarId);const o=n.get(e);o&&(!0===o.readOnly&&(i=!1),o.subscription&&void 0===o.readOnly&&(i=!1))}return{draggable:i,viewable:l}}(this.state.readOnly,e,this.calendarRegistry,this.state.events),this.canMutateFromUI=e=>function(e,t,n,a){if(!1!==e)return!1;if(t){let e=t;const r=a.find(e=>e.id===t);(null==r?void 0:r.calendarId)&&(e=r.calendarId);const o=n.get(e);if(o){if(void 0!==o.readOnly)return!o.readOnly;if(o.subscription)return!1}}return!0}(this.state.readOnly,e,this.calendarRegistry,this.state.events),this.getCalendars=()=>this.calendarRegistry.getAll(),this.reorderCalendars=(e,t)=>{this.calendarRegistry.reorder(e,t),this.triggerRender()},this.setCalendarVisibility=(e,t)=>{this.calendarRegistry.setVisibility(e,t),this.triggerRender()},this.setAllCalendarsVisibility=e=>{this.calendarRegistry.setAllVisibility(e),this.triggerRender()},this.updateCalendar=(e,t,n)=>{var a,r;if(this.calendarRegistry.updateCalendar(e,t),n)return void this.notify();const o=this.calendarRegistry.get(e);o&&(null===(r=(a=this.callbacks).onCalendarUpdate)||void 0===r||r.call(a,o)),this.triggerRender()},this.createCalendar=t=>e.__awaiter(this,void 0,void 0,function*(){var e,n;this.calendarRegistry.register(t),yield null===(n=(e=this.callbacks).onCalendarCreate)||void 0===n?void 0:n.call(e,t),this.triggerRender()}),this.deleteCalendar=t=>e.__awaiter(this,void 0,void 0,function*(){var e,n;this.calendarRegistry.unregister(t),yield null===(n=(e=this.callbacks).onCalendarDelete)||void 0===n?void 0:n.call(e,t),this.triggerRender()}),this.mergeCalendars=(t,n)=>e.__awaiter(this,void 0,void 0,function*(){var e,a;const r=this.eventManager.getStore(),o=r.getAllEvents().filter(e=>e.calendarId===t);this.eventManager.pushToUndo(),r.beginTransaction(),o.forEach(e=>r.updateEvent(e.id,{calendarId:n})),yield r.endTransaction(),yield this.deleteCalendar(t),yield null===(a=(e=this.callbacks).onCalendarMerge)||void 0===a?void 0:a.call(e,t,n)}),this.getPlugin=e=>this.pluginManager.getPlugin(e),this.hasPlugin=e=>this.pluginManager.hasPlugin(e),this.getPluginConfig=e=>this.pluginManager.getPluginConfig(e),this.updatePluginConfig=(e,t)=>this.pluginManager.updatePluginConfig(e,t),this.setTheme=e=>{this.calendarRegistry.setTheme(e),this.themeChangeListeners.forEach(t=>t(e)),this.triggerRender()},this.getTheme=()=>this.calendarRegistry.getTheme(),this.subscribeThemeChange=e=>(this.themeChangeListeners.add(e),()=>this.unsubscribeThemeChange(e)),this.unsubscribeThemeChange=e=>{this.themeChangeListeners.delete(e)},this.getViewConfig=e=>{const t=this.state.views.get(e);return(null==t?void 0:t.config)||{}},this.getCalendarRegistry=()=>this.calendarRegistry,this.getUseEventDetailDialog=()=>this.useEventDetailDialog,this.getCustomMobileEventRenderer=()=>this.customMobileEventRenderer,this.getCalendarHeaderConfig=()=>this.useCalendarHeader,this.setOverrides=e=>{this.state.overrides=e,this.triggerRender()},this.updateConfig=e=>{var t,n;let a=!1;if(void 0!==e.customMobileEventRenderer&&e.customMobileEventRenderer!==this.customMobileEventRenderer&&(this.customMobileEventRenderer=e.customMobileEventRenderer,a=!0),void 0!==e.useEventDetailDialog&&e.useEventDetailDialog!==this.useEventDetailDialog&&(this.useEventDetailDialog=e.useEventDetailDialog,a=!0),void 0!==e.useCalendarHeader&&e.useCalendarHeader!==this.useCalendarHeader&&(this.useCalendarHeader=e.useCalendarHeader,a=!0),void 0===e.readOnly||Ie(e.readOnly,this.state.readOnly)||(this.state.readOnly=e.readOnly,a=!0),void 0!==e.callbacks&&(this.callbacks=e.callbacks),void 0!==(null===(t=e.theme)||void 0===t?void 0:t.mode)&&e.theme.mode!==this.getTheme()&&this.setTheme(e.theme.mode),void 0!==e.switcherMode&&e.switcherMode!==this.state.switcherMode&&(this.state.switcherMode=e.switcherMode,a=!0),void 0!==e.locale){const t=_e.resolveLocale(e.locale);Ie(t,this.state.locale)||(this.state.locale=t,a=!0)}if(void 0!==e.allDaySortComparator&&e.allDaySortComparator!==this.state.allDaySortComparator&&(this.state.allDaySortComparator=e.allDaySortComparator,a=!0),void 0!==e.timeZone){const t=null!==(n=U(e.timeZone))&&void 0!==n?n:Intl.DateTimeFormat().resolvedOptions().timeZone;t!==this.state.timeZone&&(this.state.timeZone=t,a=!0)}if(void 0!==e.views){const t=new Map(this.state.views);let n=!1,r=!1;e.views.forEach(e=>{const a=t.get(e.type),o=$e(a,e);o.hasChanges&&(t.set(e.type,e),r=!0),n=n||o.requiresRender}),r&&(this.state.views=t),n&&(a=!0)}if(void 0!==e.calendars){let t=!1;for(const n of e.calendars){const e=this.calendarRegistry.get(n.id);e&&e.source!==n.source&&(this.calendarRegistry.updateCalendar(n.id,{source:n.source}),t=!0)}t&&(a=!0)}a&&this.triggerRender()};const s=null!==(a=U(n.timeZone))&&void 0!==a?a:Intl.DateTimeFormat().resolvedOptions().timeZone,d=(()=>{const e=t.Temporal.Now.plainDateISO(s);return new Date(e.year,e.month-1,e.day)})();var c;this.state={currentView:n.defaultView||exports.ViewType.WEEK,currentDate:n.initialDate||d,events:n.events||[],switcherMode:n.switcherMode||"buttons",plugins:new Map,views:new Map,locale:_e.resolveLocale(n.locale),highlightedEventId:null,selectedEventId:null,readOnly:n.readOnly||!1,overrides:[],allDaySortComparator:n.allDaySortComparator,timeZone:s},this.callbacks=n.callbacks||{},this.themeChangeListeners=new Set,this.listeners=new Set,this.calendarRegistry=new N(n.calendars,n.defaultCalendar,(null===(r=n.theme)||void 0===r?void 0:r.mode)||"light"),c=this.calendarRegistry,I=c,this.eventManager=new Ye(this.state,this.calendarRegistry,()=>this.callbacks,this.notify,this.triggerRender,n.events||[]),this.navigation=new je(this.state,()=>this.callbacks,this.notify,this.state.currentDate),this.pluginManager=new Ve(this.state,this.notify),this.useEventDetailDialog=null!==(o=n.useEventDetailDialog)&&void 0!==o&&o,this.useCalendarHeader=null===(i=n.useCalendarHeader)||void 0===i||i,this.customMobileEventRenderer=n.customMobileEventRenderer,n.views.forEach(e=>this.state.views.set(e.type,e)),null===(l=n.plugins)||void 0===l||l.forEach(e=>this.pluginManager.install(e,this)),this.handleVisibleRangeChange("initial")}static resolveLocale(e){return e?"string"==typeof e?d(e)?e:"en-US":e&&"object"==typeof e&&!d(e.code)?Object.assign(Object.assign({},e),{code:"en-US"}):e:"en-US"}get timeZone(){return this.state.timeZone}}var Ze=0;function ze(e,t,a,r,o,i){t||(t={});var l,s,d=t;if("ref"in d)for(s in d={},t)"ref"==s?l=t[s]:d[s]=t[s];var c={type:e,props:d,key:a,ref:l,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Ze,__i:-1,__u:0,__source:o,__self:i};if("function"==typeof e&&(l=e.defaultProps))for(s in l)void 0===d[s]&&(d[s]=l[s]);return n.options.vnode&&n.options.vnode(c),c}const We=e=>{if(!e)return"";let n,a,r;e instanceof Date?(r=e.getFullYear(),a=e.getMonth()+1,n=e.getDate()):g(e)?(r=e.year,a=e.month,n=e.day):(!function(e){if(!e||"object"!=typeof e)return!1;if(e instanceof Date)return!1;const n=e;t.Temporal.ZonedDateTime}(e),r=e.year,a=e.month,n=e.day);const o=String(a).padStart(2,"0");return`${String(n).padStart(2,"0")}/${o}/${r}`};let Ue=null;function Be(){if("undefined"==typeof document)return!1;if(null!==Ue)return Ue;const e=document.createElement("style");e.textContent=".df-calendar-container .__df_measure__::-webkit-scrollbar { display: block !important; }",document.head.append(e);const t=document.createElement("div");t.className="df-calendar-container",t.style.cssText="position:absolute;top:-9999px;width:100px;height:100px;overflow:hidden";const n=document.createElement("div");n.className="__df_measure__",n.style.cssText="width:100px;height:100px;overflow:scroll",t.append(n),document.body.append(t);const a=n.offsetWidth-n.clientWidth>0;return t.remove(),e.remove(),Ue=a,a}const qe=e=>{if("undefined"==typeof document)return e;const t=document.documentElement,n=[t.dataset.dfThemeOverride,t.dataset.dfTheme,t.dataset.theme];for(const e of n)if("light"===e||"dark"===e)return e;return t.classList.contains("dark")?"dark":t.classList.contains("light")?"light":e};function Ge(e,n=!1){if(e instanceof t.Temporal.PlainDate||e instanceof t.Temporal.PlainDateTime)return e;if(e instanceof Date)return n?Q(e):ee(e);throw new Error("Invalid time type: "+typeof e)}function Ke(e,n){if(e instanceof t.Temporal.ZonedDateTime)return e;if(e instanceof Date)return te(e,n);throw new Error("Invalid time type: "+typeof e)}function Xe(e){var t;const n=Ge(e.start,e.allDay),a=Ge(e.end,e.allDay);return{id:e.id,title:e.title,description:e.description,start:n,end:a,allDay:null!==(t=e.allDay)&&void 0!==t&&t,calendarId:e.calendarId,meta:e.meta}}function Je(e){const t=Ke(e.start,e.timeZone),n=Ke(e.end,e.timeZone);return{id:e.id,title:e.title,description:e.description,start:t,end:n,allDay:!1,calendarId:e.calendarId,meta:e.meta}}const Qe=e=>{try{return e instanceof Date?e:"string"==typeof e?new Date(e):p(e)}catch(e){return new Date}},et=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t},tt=(e,t,n,a)=>{const r=e.getTime()-t.getTime(),o=Math.round(r/864e5);let i="",l="default";if(0===o)i=a("today")||"Today",l="today";else if(1===o||2===o)try{const e=new Intl.RelativeTimeFormat(n,{numeric:"auto"}).format(o,"day");i=e.charAt(0).toUpperCase()+e.slice(1),l="upcoming"}catch(t){i=e.toLocaleDateString(n,{weekday:"long"})}else i=e.toLocaleDateString(n,{year:"numeric",month:"long",day:"numeric",weekday:"long"});return{title:i,tone:l}},nt=(e,t)=>{const n=new Map;e.forEach(e=>{var t;const a=Qe(e.start),r=et(a),o=r.getTime();n.has(o)||n.set(o,{date:r,events:[]}),null===(t=n.get(o))||void 0===t||t.events.push(e)});const a=t.getTime();n.has(a)||n.set(a,{date:t,events:[]});return Array.from(n.values()).toSorted((e,t)=>e.date.getTime()-t.date.getTime())};const at=new class{constructor(){this.lastCopiedEvent=null}setEvent(e){this.lastCopiedEvent=e}getEvent(){return this.lastCopiedEvent}hasEvent(){return null!==this.lastCopiedEvent}clear(){this.lastCopiedEvent=null}};function rt(e){return String(e).padStart(2,"0")}function ot(e,n,a){const r=e.trim(),o=/^(\d{4})(\d{2})(\d{2})$/,i=/^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})Z$/;if("DATE"===(null==n?void 0:n.value)||o.test(r)){const e=r.match(o);if(e)return t.Temporal.PlainDate.from({year:Number.parseInt(e[1],10),month:Number.parseInt(e[2],10),day:Number.parseInt(e[3],10)})}if(i.test(r)){const e=r.match(i);if(e){const n=t.Temporal.Instant.from(`${e[1]}-${e[2]}-${e[3]}T${e[4]}:${e[5]}:${e[6]}Z`),r=a||t.Temporal.Now.timeZoneId();return n.toZonedDateTimeISO(r)}}const l=r.match(/^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})$/);if(l){const e={year:Number.parseInt(l[1],10),month:Number.parseInt(l[2],10),day:Number.parseInt(l[3],10),hour:Number.parseInt(l[4],10),minute:Number.parseInt(l[5],10),second:Number.parseInt(l[6],10)};return(null==n?void 0:n.tzid)?t.Temporal.ZonedDateTime.from(Object.assign(Object.assign({},e),{timeZone:n.tzid})):t.Temporal.PlainDateTime.from(e)}throw new Error(`Invalid ICS date format: ${e}`)}function it(e,t=!1){if(t||B(e)){const t=B(e)?e:e.toPlainDate();return{value:`${t.year}${rt(t.month)}${rt(t.day)}`,params:{VALUE:"DATE"}}}if(G(e)){const t=e.toInstant().toZonedDateTimeISO("UTC");return{value:`${t.year}${rt(t.month)}${rt(t.day)}T${rt(t.hour)}${rt(t.minute)}${rt(t.second)}Z`}}if(q(e))return{value:`${e.year}${rt(e.month)}${rt(e.day)}T${rt(e.hour)}${rt(e.minute)}${rt(e.second)}`};throw new Error("Unsupported Temporal type")}function lt(e){return`${e.getUTCFullYear()}${rt(e.getUTCMonth()+1)}${rt(e.getUTCDate())}T${rt(e.getUTCHours())}${rt(e.getUTCMinutes())}${rt(e.getUTCSeconds())}Z`}function st(e){return e?e.replaceAll("\\","\\\\").replaceAll(";","\\;").replaceAll(",","\\,").replaceAll("\n","\\n"):""}function dt(e){return e?e.replaceAll("\\,",",").replaceAll("\\;",";").replaceAll(/\\[nN]/g,"\n").replaceAll("\\\\","\\"):""}function ct(e){if(e.length<=75)return e;const t=[];let n=e;for(t.push(n.slice(0,75)),n=n.slice(75);n.length>0;)t.push(" "+n.slice(0,74)),n=n.slice(74);return t.join("\r\n")}function ut(e,t,n){let a=e;return n&&Object.entries(n).forEach(([e,t])=>{a+=`;${e}=${t}`}),a+=`:${t}`,ct(a)}function ht(e){var t,n,a;const r=["BEGIN:VEVENT"],o=(null===(t=e.meta)||void 0===t?void 0:t.originalUid)||`${e.id}@dayflow`;r.push(`UID:${o}`),r.push(`DTSTAMP:${lt(new Date)}`);const i=it(e.start,e.allDay);let l;if(e.allDay){const t=(B(e.end)?e.end:e.end.toPlainDate()).add({days:1});l={value:`${t.year}${rt(t.month)}${rt(t.day)}`,params:{VALUE:"DATE"}}}else l=it(e.end,!1);if(r.push(ut("DTSTART",i.value,i.params)),r.push(ut("DTEND",l.value,l.params)),r.push(ut("SUMMARY",st(e.title))),e.description&&r.push(ut("DESCRIPTION",st(e.description))),(null===(n=e.meta)||void 0===n?void 0:n.location)&&r.push(ut("LOCATION",st(e.meta.location))),(null===(a=e.meta)||void 0===a?void 0:a.categories)&&Array.isArray(e.meta.categories)){const t=e.meta.categories.map(st).join(",");r.push(ut("CATEGORIES",t))}return r.push("END:VEVENT"),r}function mt(e){const t=[];let n=null,a=!1;for(const r of e){const e=r.trim().toUpperCase();e.startsWith("BEGIN:VEVENT")?(a=!0,n=[]):e.startsWith("END:VEVENT")?(a&&n&&t.push(n),a=!1,n=null):a&&n&&n.push(r)}return t}function gt(e){const t={};for(const n of e){const e=n.indexOf(":");if(-1===e)continue;const a=n.slice(0,e),r=n.slice(e+1),[o,...i]=a.split(";"),l=o.trim().toUpperCase(),s={};switch(i.forEach(e=>{const[t,n]=e.split("=");t&&n&&(s[t.trim().toUpperCase()]=n.trim())}),l){case"UID":t.uid=r.trim();break;case"SUMMARY":t.summary=dt(r);break;case"DESCRIPTION":t.description=dt(r);break;case"LOCATION":t.location=dt(r);break;case"DTSTART":t.dtstart=r.trim(),t.dtstartParams={value:s.VALUE,tzid:s.TZID};break;case"DTEND":t.dtend=r.trim(),t.dtendParams={value:s.VALUE,tzid:s.TZID};break;case"CATEGORIES":t.categories=r.split(",").map(e=>dt(e.trim()))}}if(!t.dtstart)throw new Error("Missing DTSTART in VEVENT");return t.uid||(t.uid=Ne()),t}function ft(e,n){var a;const{calendarId:r="default",generateNewIds:o=!0,idPrefix:i="ics-",defaultTimeZone:l}=n,s=o?`${i}${Ne()}`:e.uid,d=ot(e.dtstart,e.dtstartParams,l);let c;c=e.dtend?ot(e.dtend,e.dtendParams,l):B(d)?d.add({days:1}):d.add({hours:1});const u="DATE"===(null===(a=e.dtstartParams)||void 0===a?void 0:a.value)||B(d),h=l||t.Temporal.Now.timeZoneId();let m,g;if(B(d))m=d;else if(q(d))try{m=d.toZonedDateTime(h)}catch(e){m=t.Temporal.ZonedDateTime.from(Object.assign(Object.assign({},d),{timeZone:h}))}else m=d;if(B(c))g=c.subtract({days:1});else if(q(c))try{g=c.toZonedDateTime(h)}catch(e){g=t.Temporal.ZonedDateTime.from(Object.assign(Object.assign({},c),{timeZone:h}))}else g=c;return{id:s,calendarId:r,title:e.summary||"(No Title)",description:e.description,start:m,end:g,allDay:u,meta:{location:e.location,originalUid:e.uid,categories:e.categories}}}function vt(e,t={}){const n={success:!1,events:[],errors:[],totalParsed:0,totalImported:0};try{const a=e.replaceAll(/(\r\n|\n|\r)[ \t]/g,""),r=mt(a.split(/\r\n|\n|\r/));n.totalParsed=r.length,r.forEach((e,a)=>{try{const a=ft(gt(e),t);n.events.push(a)}catch(e){n.errors.push({line:0,message:e instanceof Error?e.message:"Unknown parsing error",eventUid:`index-${a}`})}}),n.success=0===n.errors.length,n.totalImported=n.events.length}catch(e){n.errors.push({message:`Fatal parsing error: ${e instanceof Error?e.message:"Unknown error"}`})}return n}function pt(e,t={}){const{calendarName:n="DayFlow Calendar",productId:a="-//DayFlow//DayFlow Calendar//EN"}=t,r=["BEGIN:VCALENDAR","VERSION:2.0",`PRODID:${a}`,"CALSCALE:GREGORIAN","METHOD:PUBLISH",`X-WR-CALNAME:${st(n)}`];return e.forEach(e=>{r.push(...ht(e))}),r.push("END:VCALENDAR"),r.join("\r\n")}const yt=e=>{const t=p(e.start);t.setHours(0,0,0,0);const n=p(e.end);return n.setHours(0,0,0,0),{startDay:t,endDay:n,isMultiDay:n.getTime()>t.getTime()}},Dt=(e,t,n)=>{const a=yt(e),r=yt(t);if(a.isMultiDay!==r.isMultiDay)return a.isMultiDay?-1:1;if(a.isMultiDay&&r.isMultiDay){const e=a.startDay.getTime()-r.startDay.getTime();if(0!==e)return e;const t=r.endDay.getTime()-a.endDay.getTime();if(0!==t)return t}if(n){const a=n(e,t);if(0!==a)return a}return a.startDay.getTime()-r.startDay.getTime()},wt=(e,t)=>{const n=new Map;return e.forEach(e=>{const{isMultiDay:t,startDay:a}=yt(e),r=n.get(e.calendarId);r?t&&(r.hasMultiDay=!0,r.earliestMultiDayStart=Math.min(r.earliestMultiDayStart,a.getTime())):n.set(e.calendarId,{hasMultiDay:t,earliestMultiDayStart:t?a.getTime():Number.POSITIVE_INFINITY})}),(e,a)=>{var r,o,i,l,s,d;const c=n.get(e.calendarId),u=n.get(a.calendarId);if((null!==(r=null==c?void 0:c.hasMultiDay)&&void 0!==r&&r)!==(null!==(o=null==u?void 0:u.hasMultiDay)&&void 0!==o&&o))return(null==c?void 0:c.hasMultiDay)?-1:1;if(null!==(i=null==c?void 0:c.hasMultiDay)&&void 0!==i&&i&&null!==(l=null==u?void 0:u.hasMultiDay)&&void 0!==l&&l&&e.calendarId!==a.calendarId){const e=(null!==(s=null==c?void 0:c.earliestMultiDayStart)&&void 0!==s?s:Number.POSITIVE_INFINITY)-(null!==(d=null==u?void 0:u.earliestMultiDayStart)&&void 0!==d?d:Number.POSITIVE_INFINITY);if(0!==e)return e}return e.calendarId,a.calendarId,Dt(e,a,t)}};let bt=null;const Et=()=>{const[e,t]=r.useState(()=>bt||{weekHeight:u.WEEK_HEIGHT,screenSize:"desktop",weeksPerView:6});return r.useEffect(()=>{const e=()=>{const e=window.innerWidth,n=window.innerHeight-150,a=Math.max(80,Math.floor(n/6)),r=e<768?{weekHeight:Math.max(u.MOBILE_WEEK_HEIGHT,a),screenSize:"mobile",weeksPerView:6}:e<1024?{weekHeight:Math.max(u.TABLET_WEEK_HEIGHT,a),screenSize:"tablet",weeksPerView:6}:{weekHeight:Math.max(u.WEEK_HEIGHT,a),screenSize:"desktop",weeksPerView:6};bt=r,t(e=>e.screenSize===r.screenSize&&e.weekHeight===r.weekHeight&&e.weeksPerView===r.weeksPerView?e:r)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e},Ct=n.createContext({locale:"en-US",t:e=>e,getWeekDaysLabels:()=>[],getMonthLabels:()=>[],isDefault:!0});function Tt(){return r.useContext(Ct)}const St="df-month-view",Mt="df-view-header-title",xt="df-date-number",kt="df-scroll-container",Nt="df-time-slot",It="df-time-label",Rt="df-time-grid-row",Ot="df-current-time-line",Ht="df-current-time-label",Pt="df-all-day-row",At="df-all-day-label",Lt="df-event-title",$t="df-event-month-color-bar",Ft="df-event-icon-svg",Yt="df-event-resize-handle df-event-resize-handle-left df-resize-handle",jt="df-event-resize-handle df-event-resize-handle-right df-resize-handle",Vt="df-nav-button df-calendar-nav-button",_t="df-event-detail-panel df-portal",Zt="df-portal df-calendar-picker-dropdown df-animate-in df-fade-in df-zoom-in-95",zt="df-time-grid-boundary",Wt="df-midnight-label",Ut="df-icon-btn",Bt=(...e)=>e.filter(Boolean).join(" "),qt=({className:e,width:t=24,height:n=24})=>ze("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:e,children:ze("path",{d:"m15 18-6-6 6-6"})}),Gt=({className:e,width:t=24,height:n=24})=>ze("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:e,children:ze("path",{d:"m9 18 6-6-6-6"})}),Kt=({className:e,width:t=24,height:n=24})=>ze("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:e,children:ze("path",{d:"m6 9 6 6 6-6"})}),Xt=({className:e,width:t=24,height:n=24})=>ze("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:e,children:[ze("path",{d:"M5 12h14"}),ze("path",{d:"M12 5v14"})]}),Jt=({className:e,width:t=24,height:n=24})=>ze("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:e,children:[ze("circle",{cx:"11",cy:"11",r:"8"}),ze("path",{d:"m21 21-4.3-4.3"})]}),Qt=({className:e,width:t=24,height:n=24})=>ze("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:e,children:ze("path",{d:"M20 6 9 17l-5-5"})}),en=({className:e,width:t=24,height:n=24})=>ze("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:e,children:[ze("path",{d:"m7 15 5 5 5-5"}),ze("path",{d:"m7 9 5-5 5 5"})]}),tn=({className:e,width:t=24,height:n=24})=>ze("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:e,children:[ze("path",{d:"M18 6 6 18"}),ze("path",{d:"m6 6 12 12"})]}),nn=({className:e,width:t=24,height:n=24})=>ze("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:e,children:[ze("path",{d:"M8 2v4"}),ze("path",{d:"M16 2v4"}),ze("rect",{width:"18",height:"18",x:"3",y:"4",rx:"2"}),ze("path",{d:"M3 10h18"}),ze("path",{d:"M8 14h.01"}),ze("path",{d:"M12 14h.01"}),ze("path",{d:"M16 14h.01"}),ze("path",{d:"M8 18h.01"}),ze("path",{d:"M12 18h.01"}),ze("path",{d:"M16 18h.01"})]}),an=({className:e,width:t=24,height:n=24})=>ze("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:e,children:ze("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),rn=({className:e,width:t=24,height:n=24})=>ze("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:e,children:[ze("rect",{width:"18",height:"14",x:"3",y:"8",rx:"2"}),ze("path",{d:"M12 5a3 3 0 1 0-3 3"}),ze("path",{d:"M12 5a3 3 0 1 1 3 3"}),ze("path",{d:"M3 12h18"}),ze("path",{d:"M12 22V8"})]}),on=({className:e,width:t=24,height:n=24})=>ze("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:e,children:ze("path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z"})}),ln=({className:e,width:t=24,height:n=24})=>ze("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:e,children:[ze("path",{d:"M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z"}),ze("circle",{cx:"12",cy:"10",r:"3"})]}),sn=({className:e,width:t=24,height:n=24})=>ze("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:e,children:ze("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})}),dn=({className:e,width:t=24,height:n=24})=>ze("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:e,children:[ze("path",{d:"m12 19-7-7 7-7"}),ze("path",{d:"M19 12H5"})]});function cn(e,t){var n,a,r,o,i;try{if("today"===e){return null!==(a=null===(n=new Intl.RelativeTimeFormat(t,{numeric:"auto"}).formatToParts(0,"day").find(e=>"literal"===e.type))||void 0===n?void 0:n.value)&&void 0!==a?a:null}if("week"===e){return null!==(o=null===(r=new Intl.RelativeTimeFormat(t,{numeric:"always"}).formatToParts(1,"week").find(e=>"unit"===e.type))||void 0===r?void 0:r.value)&&void 0!==o?o:null}return null!==(i=new Intl.DisplayNames(t,{type:"dateTimeField"}).of(e))&&void 0!==i?i:null}catch(e){return null}}function un(e){return e.charAt(0).toUpperCase()+e.slice(1)}const hn=(e,t="short",n=1)=>{const a=[],r=new Date(2024,0,7);for(let o=0;o<7;o++){const i=new Date(r);i.setDate(r.getDate()+n+o);try{a.push(i.toLocaleDateString(e,{weekday:t}))}catch(e){a.push(i.toLocaleDateString("en-US",{weekday:t}))}}return a},mn=(e,t="long")=>{const n=[];for(let a=0;a<12;a++){const r=new Date(2024,a,1);try{n.push(r.toLocaleDateString(e,{month:t}))}catch(e){n.push(r.toLocaleDateString("en-US",{month:t}))}}return n};function gn(e,t="en-US"){var n;if(["today","day","week","month","year"].includes(e)){const n=cn(e,t);if(n)return un(n)}const a=s(t),r=l[a],o=null===(n=null==r?void 0:r.messages)||void 0===n?void 0:n[e];if(o)return o;const i=l.en.messages;return(null==i?void 0:i[e])||e}const fn=({locale:e="en-US",messages:t,children:n})=>{const a=r.useMemo(()=>{if("string"==typeof e){return{code:d(e)?e:"en-US",messages:void 0}}return e&&"string"!=typeof e&&!d(e.code)?Object.assign(Object.assign({},e),{code:"en-US"}):e||{code:"en-US"}},[e]),o=r.useMemo(()=>{const e=a.code;return{locale:e,t:(n,r)=>{var o,i,l;let s=null!==(l=null!==(o=null==t?void 0:t[n])&&void 0!==o?o:null===(i=a.messages)||void 0===i?void 0:i[n])&&void 0!==l?l:gn(n,e);return r&&Object.entries(r).forEach(([e,t])=>{s=s.replaceAll(new RegExp(`{${e}}`,"g"),t)}),s},getWeekDaysLabels:hn,getMonthLabels:mn,isDefault:!1}},[a,t]);return ze(Ct.Provider,{value:o,children:n})},vn=(e,t,n)=>{var a;const r=null===(a=t.state.views.get(e))||void 0===a?void 0:a.label;if(r)return r;const o=n(e);return o!==e?o:e.split(/[-_]/g).map(e=>e?e.charAt(0).toUpperCase()+e.slice(1):e).join(" ")},pn=({calendar:e,mode:t="buttons"})=>{const[n,a]=r.useState(!1),o=r.useRef(null),{t:i}=Tt(),l=Array.from(e.state.views.keys()),s=e.state.currentView;return r.useEffect(()=>{const e=e=>{o.current&&!o.current.contains(e.target)&&a(!1)};if(n)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[n]),l.length<=1?null:ze("div","select"===t?{className:"df-view-switcher-select",ref:o,children:[ze("button",{type:"button",onClick:()=>a(!n),className:"df-view-switcher-select-trigger","aria-expanded":n,"aria-haspopup":"listbox",children:[ze("span",{children:vn(s,e,i)}),ze("span",{className:"df-view-switcher-select-chevron","data-open":n?"true":"false",children:ze(Kt,{width:16,height:16})})]}),n&&ze("div",{className:"df-view-switcher-select-dropdown df-animate-in df-fade-in df-zoom-in-95",children:ze("div",{className:"df-view-switcher-select-list",role:"listbox",children:l.map(t=>ze("button",{type:"button",onClick:()=>{e.changeView(t),a(!1),e.triggerRender()},className:"df-view-switcher-select-option","data-active":s===t?"true":"false",role:"option","aria-selected":s===t,children:vn(t,e,i)},t))})})]}:{className:"df-view-switcher",children:l.map(t=>ze("button",{type:"button",className:"df-view-switcher-btn","data-active":s===t?"true":"false",onClick:()=>{e.changeView(t),e.triggerRender()},children:vn(t,e,i)},t))})},yn=({calendar:e,switcherMode:t="buttons",onAddCalendar:n,onSearchChange:a,onSearchClick:o,searchValue:i="",isSearchOpen:l=!1,isEditable:s=!0,safeAreaLeft:d})=>{const c="buttons"===t,u=e.state.currentView===exports.ViewType.DAY,{screenSize:h}=Et(),m="mobile"===h,{t:g}=Tt(),f=r.useCallback(e=>{const t=e.currentTarget.value;t!==i&&(null==a||a(t))},[a,i]);return ze("div",{className:"df-header","data-bordered":u||l?"true":"false",style:{paddingLeft:d||8,transition:"padding-left 160ms ease-in-out"},onContextMenu:e=>e.preventDefault(),children:[ze("div",{className:"df-header-left",children:n&&s&&ze("button",{type:"button",id:"dayflow-add-event-btn",onClick:n,className:Ut,title:m?g("newEvent")||"New Event":g("createCalendar")||"Add Calendar",children:ze(Xt,{})})}),ze("div",{className:"df-header-mid",children:c&&ze(pn,{mode:t,calendar:e})}),ze("div",{className:"df-header-right",children:[!c&&ze(pn,{mode:t,calendar:e}),m?ze("button",{type:"button",onClick:o,className:Ut,title:g("search")||"Search",children:ze(Jt,{})}):ze("div",{className:"df-search-group",children:[ze("div",{className:"df-search-group-icon",children:ze(Jt,{width:16,height:16})}),ze("input",{id:"dayflow-search-input",type:"text",placeholder:g("search")||"Search",value:i,onChange:f,className:"df-search-group-input",style:{width:"12rem"}}),i&&ze("button",{type:"button",onClick:()=>{null==a||a("")},className:"df-search-group-clear",children:ze("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[ze("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ze("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})]})},Dn=n.createContext(void 0),wn=({children:e,initialTheme:t="light",onThemeChange:n})=>{const[a,o]=r.useState(t),[i,l]=r.useState(()=>"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),s="auto"===a?i:a;r.useEffect(()=>{o(t)},[t]);const d=r.useCallback(e=>{o(e)},[]);r.useEffect(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-color-scheme: dark)"),t=e=>{const t=e.matches?"dark":"light";l(t)};return e.addEventListener?e.addEventListener("change",t):e.addListener&&e.addListener(t),()=>{e.removeEventListener?e.removeEventListener("change",t):e.removeListener&&e.removeListener(t)}},[]),r.useLayoutEffect(()=>{if("undefined"==typeof document)return;const e=document.documentElement,t=qe(s),n="auto"===a?t:s;e.classList.remove("light","dark"),e.classList.add(n),"auto"===a?e.dataset.dfThemeOverride&&delete e.dataset.dfThemeOverride:e.dataset.dfThemeOverride!==n&&(e.dataset.dfThemeOverride=n),e.dataset.dfTheme!==n&&(e.dataset.dfTheme=n)},[s,a,i]),r.useEffect(()=>{n&&n(a,s)},[a,s,n]);const c=r.useMemo(()=>({theme:a,effectiveTheme:s,setTheme:d}),[a,s,d]);return ze(Dn.Provider,{value:c,children:e})},bn=()=>{const e=r.useContext(Dn);if(void 0===e)throw new Error("useTheme must be used within a ThemeProvider");return e},En=n.createContext(null);let Cn=0;function Tn({generatorName:e,generatorArgs:t,defaultContent:n,store:a}){const o=r.useRef(null),i=r.useContext(En),l=a||i,s=r.useRef(null),[d,c]=r.useState(()=>{var t;return!!e&&(null!==(t=null==l?void 0:l.isOverridden(e))&&void 0!==t&&t)});s.current||(s.current="df-slot-"+Cn++),r.useEffect(()=>{if(!o.current||!l||!e)return;const n=s.current;l.register({id:n,containerEl:o.current,generatorName:e,generatorArgs:t});const a=l.subscribeToOverrides(()=>{c(l.isOverridden(e))});return()=>{l.unregister(n),a()}},[l,e]),r.useEffect(()=>{if(!l||!s.current||!e)return;const n=s.current;l.register({id:n,containerEl:o.current,generatorName:e,generatorArgs:t})},[e,t]);const u=null==e?void 0:e.startsWith("eventContent");return ze("div",{ref:o,className:"df-content-slot "+(u||"sidebar"===e?"df-content-slot-stacked":""),children:!d&&n})}const Sn=t=>{const n=r.useRef(null),a=r.useRef(null);return r.useEffect(()=>{if(n.current){const r=e.__rest(t,[]);a.current=new o.BlossomColorPicker(n.current,r),r.initialExpanded&&a.current.expand()}return()=>{a.current&&(a.current.destroy(),a.current=null)}},[]),r.useEffect(()=>{if(a.current){const n=e.__rest(t,[]);a.current.setOptions(n)}},[t]),ze("div",{ref:n,className:t.className})},Mn=({color:e,onChange:t,onClose:n})=>{const a=r.useMemo(()=>{const{h:t,l:n}=o.hexToHsl(e);return{hue:t,saturation:o.lightnessToSliderValue(n),lightness:n,alpha:100,layer:"outer"}},[e]);return ze("div",{className:"df-default-color-picker",children:ze(Sn,{defaultValue:a,coreSize:36,petalSize:32,initialExpanded:!0,openOnHover:!1,onChange:e=>t({hex:e.hex},!0),onCollapse:n})})},xn=t=>{var{children:a,onClick:o,loading:i,loadingText:l,disabled:s,className:d,type:c="button"}=t,u=e.__rest(t,["children","onClick","loading","loadingText","disabled","className","type"]);const[h,m]=r.useState(!1),g=i||h,f=ze(n.Fragment,{children:[g&&ze("svg",{className:"df-loading-btn-spinner",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[ze("circle",{className:"df-loading-btn-track",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),ze("path",{className:"df-loading-btn-fill",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),ze("span",{className:"df-loading-btn-label",children:g&&l?l:a})]}),v=Object.assign(Object.assign({},u),{disabled:s||g,onClick:t=>e.__awaiter(void 0,void 0,void 0,function*(){if(!g&&o){const e=o(t);if(e&&"object"==typeof e&&"then"in e){m(!0);try{yield e}finally{m(!1)}}}}),className:"df-loading-btn"+(d?` ${d}`:""),"data-loading":g?"true":"false"});return ze("button","submit"===c?Object.assign({},v,{type:"submit",children:f}):"reset"===c?Object.assign({},v,{type:"reset",children:f}):Object.assign({},v,{type:"button",children:f}))},kn=["#ea426b","#f19a38","#f7cf46","#83d754","#51aaf2","#b672d0","#957e5e"],Nn=({onClose:t,onCreate:i,app:l})=>{const{t:s}=Tt(),{effectiveTheme:d}=bn(),[c,u]=r.useState(""),[h,m]=r.useState(!1),g=l.state.overrides.includes("createCalendarDialogColorPicker"),[f,v]=r.useState(kn[Math.floor(Math.random()*kn.length)]),[p,y]=r.useState(!1),[D,w]=r.useState(""),b=r.useMemo(()=>{const e=o.DEFAULT_COLORS[Math.floor(Math.random()*o.DEFAULT_COLORS.length)],t=e.layer||"outer",n=o.lightnessToSliderValue(e.l);return{hue:e.h,saturation:n,lightness:e.l,alpha:100,layer:t}},[]),[E,C]=r.useState(null),T=e=>{v(e.hex)},S=()=>{y(!1)},M=()=>{v(D),y(!1)},x="dark"===d,k={default:{picker:{background:x?"#1e293b":"#ffffff",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",borderRadius:"0.5rem",border:x?"1px solid #4b5563":"1px solid #e5e7eb"},head:{background:x?"#1e293b":"#ffffff",borderBottom:x?"1px solid #4b5563":"1px solid #e5e7eb",boxShadow:"none"},body:{background:x?"#1e293b":"#ffffff"},controls:{border:x?"1px solid #4b5563":"1px solid #e5e7eb"},input:{background:x?"#374151":"#ffffff",color:x?"#f3f4f6":"#1f2937",border:x?"1px solid #4b5563":"1px solid #e5e7eb",boxShadow:"none"},previews:{border:x?"1px solid #4b5563":"1px solid #e5e7eb"},actions:{borderTop:x?"1px solid #4b5563":"1px solid #e5e7eb"}}};return"undefined"==typeof window?null:a.createPortal(ze("div",{className:"df-portal df-create-calendar-dialog-backdrop",children:ze("div",{className:"df-animate-in df-fade-in df-zoom-in-95 df-create-calendar-dialog-panel",onClick:e=>e.stopPropagation(),children:[ze("h2",{className:"df-create-calendar-dialog-title "+(g?"df-create-calendar-dialog-title-compact":""),children:s("createCalendar")}),ze("form",{onSubmit:n=>e.__awaiter(void 0,void 0,void 0,function*(){var e;if(n.preventDefault(),c.trim()&&!h){m(!0);try{let n;n=g?f:null!==(e=null==E?void 0:E.hex)&&void 0!==e?e:o.hslToHex(b.hue,b.saturation,b.lightness);const{colors:a,darkColors:r}=O(n),l={id:Ne(),name:c.trim(),colors:a,darkColors:r,isVisible:!0,isDefault:!1};yield i(l),t()}finally{m(!1)}}}),children:[g?ze(n.Fragment,{children:[ze("div",{className:"df-create-calendar-dialog-color-row",children:[ze("div",{className:"df-create-calendar-dialog-color-preview",style:{backgroundColor:f}}),ze("input",{id:"custom-calendar-name",name:"calendar-name",type:"text",value:c,onChange:e=>u(e.target.value),className:"df-form-input",style:{flex:1},placeholder:s("calendarNamePlaceholder"),autoFocus:!0})]}),ze("div",{className:"df-create-calendar-dialog-color-section",children:[ze("div",{className:"df-create-calendar-dialog-color-grid",children:kn.map(e=>ze("button",{type:"button",className:"df-create-calendar-dialog-color-btn","data-selected":f===e?"true":"false",style:{backgroundColor:e},onClick:()=>v(e)},e))}),ze("div",{style:{position:"relative"},children:[ze("button",{type:"button",onClick:()=>{w(f),y(!0)},className:"df-create-calendar-dialog-custom-color-btn",children:s("customColor")}),p&&ze("div",{className:"df-create-calendar-dialog-picker-overlay",onClick:M,children:ze("div",{className:"df-animate-in df-fade-in df-zoom-in-95 df-create-calendar-dialog-picker-inner",onClick:e=>e.stopPropagation(),children:ze(Tn,{generatorName:"createCalendarDialogColorPicker",generatorArgs:{color:f,onChange:T,onAccept:S,onCancel:M,styles:k},defaultContent:ze("div",{className:"df-create-calendar-dialog-picker-card",children:[ze(Mn,{color:f,onChange:T}),ze("div",{className:"df-create-calendar-dialog-picker-actions",children:[ze("button",{type:"button",onClick:M,className:"df-btn-sm df-btn-sm-ghost",children:s("cancel")}),ze("button",{type:"button",onClick:S,className:"df-fill-primary df-btn-sm",children:"OK"})]})]})})})})]})]})]}):ze("div",{className:"df-create-calendar-dialog-blossom-row",children:[ze("div",{className:"df-create-calendar-dialog-blossom-input-area",children:ze("input",{id:"blossom-calendar-name",name:"calendar-name",type:"text",value:c,onChange:e=>u(e.target.value),className:"df-form-input",placeholder:s("calendarNamePlaceholder"),autoFocus:!0})}),ze("div",{className:"df-create-calendar-dialog-blossom-picker-wrap",children:ze("div",{className:"df-create-calendar-dialog-blossom-picker-inner",children:ze(Sn,{defaultValue:b,coreSize:36,petalSize:32,openOnHover:!1,onChange:e=>C(e),onCollapse:e=>C(e),className:"df-create-calendar-dialog-blossom-picker"})})})]}),ze("div",{className:"df-create-calendar-dialog-actions",children:[ze("button",{type:"button",onClick:t,disabled:h,className:"df-btn-sm df-btn-sm-ghost",children:s("cancel")}),ze(xn,{type:"submit",disabled:!c.trim(),loading:h,className:"df-fill-primary df-hover-primary-solid df-btn-sm",children:s("create")})]})]})]})}),document.body)};var In=0;function Rn(e,t,a,r,o,i){t||(t={});var l,s,d=t;if("ref"in d)for(s in d={},t)"ref"==s?l=t[s]:d[s]=t[s];var c={type:e,props:d,key:a,ref:l,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--In,__i:-1,__u:0,__source:o,__self:i};if("function"==typeof e&&(l=e.defaultProps))for(s in l)void 0===d[s]&&(d[s]=l[s]);return n.options.vnode&&n.options.vnode(c),c}const On=(e,n)=>t.Temporal.PlainDate.compare(e,n),Hn=({calendarDays:e,visibleMonth:t,startDate:a,endDate:r,weekDayLabels:o,disabled:i,onDaySelect:l})=>Rn(n.Fragment,{children:[Rn("div",{className:"df-range-picker-weekday-row",children:o.map(e=>Rn("span",{className:"df-range-picker-weekday-label",children:e},e))}),Rn("div",{className:"df-range-picker-day-grid",children:e.map(e=>{const n=e.month!==t.month,o=0===On(e,a),s=0===On(e,r),d=On(e,a)>=0&&On(e,r)<=0;return Rn("button",{type:"button",disabled:i,onClick:()=>l(e),className:"df-range-picker-day-cell","data-outside":n,"data-range-edge":o?"start":s?"end":void 0,"data-in-range":d&&!o&&!s,children:e.day},e.toString())})})]}),Pn=({className:e,width:t=24,height:n=24})=>Rn("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:e,children:Rn("path",{d:"m15 18-6-6 6-6"})}),An=({className:e,width:t=24,height:n=24})=>Rn("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:e,children:Rn("path",{d:"m9 18 6-6-6-6"})}),Ln=({className:e,width:t=24,height:n=24})=>Rn("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:e,children:[Rn("path",{d:"m11 17-5-5 5-5"}),Rn("path",{d:"m18 17-5-5 5-5"})]}),$n=({className:e,width:t=24,height:n=24})=>Rn("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:e,children:[Rn("path",{d:"m6 17 5-5-5-5"}),Rn("path",{d:"m13 17 5-5-5-5"})]}),Fn=({className:e,width:t=24,height:n=24})=>Rn("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:e,children:[Rn("path",{d:"M18 8L22 12L18 16"}),Rn("path",{d:"M2 12H22"})]}),Yn=({visibleMonth:e,monthLabels:t,disabled:n,onMonthChange:a,onYearChange:r})=>Rn("div",{className:"df-range-picker-calendar-header",children:[Rn("div",{className:"df-range-picker-calendar-nav-group",children:[Rn("button",{type:"button",disabled:n,onClick:()=>r(-1),className:"df-range-picker-calendar-nav-button",children:Rn(Ln,{width:14,height:12})}),Rn("button",{type:"button",disabled:n,onClick:()=>a(-1),className:"df-range-picker-calendar-nav-button",children:Rn(Pn,{width:14,height:12})})]}),Rn("div",{className:"df-range-picker-calendar-title",children:[t[e.month-1]," ",e.year]}),Rn("div",{className:"df-range-picker-calendar-nav-group",children:[Rn("button",{type:"button",disabled:n,onClick:()=>a(1),className:"df-range-picker-calendar-nav-button",children:Rn(An,{width:14,height:12})}),Rn("button",{type:"button",disabled:n,onClick:()=>r(1),className:"df-range-picker-calendar-nav-button",children:Rn($n,{width:14,height:12})})]})]}),jn=Array.from({length:24},(e,t)=>t),Vn=Array.from({length:60},(e,t)=>t);function _n(e){return null!==e&&"object"==typeof e&&!("hour"in e)&&"year"in e&&"month"in e&&"day"in e&&!(e instanceof Date)}const Zn=/(YYYY|YY|MM|DD|HH|mm)/g,zn=e=>e.toString().padStart(2,"0"),Wn=(e,t)=>{const n=(null!=t?t:"").trim(),a=/[Hhms]/.test(e)||!n?e:`${e} ${n}`.trim();return a.replaceAll(/(H{1,2}):MM/g,(e,t)=>`${t}:mm`)},Un=e=>e.replaceAll(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),Bn=(e,n,a,r)=>{const o=e.trim();if(!o)return null;const i=o.match(n),l=null==i?void 0:i.groups;if(!l)return null;const s=l.YYYY?Number(l.YYYY):l.YY?Number(l.YY)+2e3:a.year,d=l.MM?Number(l.MM):a.month,c=l.DD?Number(l.DD):a.day,u=l.HH?Number(l.HH):a.hour,h=l.mm?Number(l.mm):a.minute;try{return t.Temporal.ZonedDateTime.from({timeZone:r,year:s,month:d,day:c,hour:u,minute:h,second:a.second,millisecond:a.millisecond,microsecond:a.microsecond,nanosecond:a.nanosecond})}catch(e){return null}},qn=e=>{var n;const a=e;return"string"==typeof a.timeZoneId?a.timeZoneId:"string"==typeof a.timeZone?a.timeZone:"string"==typeof(null===(n=a.timeZone)||void 0===n?void 0:n.id)?a.timeZone.id:t.Temporal.Now.timeZoneId()},Gn=(e,n,a)=>{var r,o,i,l,s,d,c,u,h,m,g,f,v,p,y,D,w,b,E,C,T,S,M,x;if(!e){const e=null!=n?n:a?qn(a):t.Temporal.Now.timeZoneId();return null!=a?a:t.Temporal.Now.zonedDateTimeISO(e)}if(_n(e)){const a=null!=n?n:t.Temporal.Now.timeZoneId(),r=`${e.year}-${zn(e.month)}-${zn(e.day)}T00:00:00[${a}]`;return t.Temporal.ZonedDateTime.from(r)}const k=e;if("hour"in k&&!("timeZoneId"in k)){const e=null!=n?n:t.Temporal.Now.timeZoneId();if("function"==typeof k.toZonedDateTime)try{return k.toZonedDateTime(e)}catch(e){}return t.Temporal.ZonedDateTime.from({timeZone:e,year:k.year,month:k.month,day:k.day,hour:k.hour,minute:k.minute,second:null!==(r=k.second)&&void 0!==r?r:0,millisecond:null!==(o=k.millisecond)&&void 0!==o?o:0,microsecond:null!==(i=k.microsecond)&&void 0!==i?i:0,nanosecond:null!==(l=k.nanosecond)&&void 0!==l?l:0})}try{return t.Temporal.ZonedDateTime.from(e)}catch(e){const r=null!==(h=null!==(u=null!==(c=null!==(d="string"==typeof k.timeZone?k.timeZone:null===(s=k.timeZone)||void 0===s?void 0:s.id)&&void 0!==d?d:k.timeZoneId)&&void 0!==c?c:n)&&void 0!==u?u:a?qn(a):void 0)&&void 0!==h?h:t.Temporal.Now.timeZoneId();if("function"==typeof k.toZonedDateTime)try{return k.toZonedDateTime(r)}catch(e){}const o=null!=a?a:t.Temporal.Now.zonedDateTimeISO(r);return t.Temporal.ZonedDateTime.from({timeZone:r,year:null!==(m=k.year)&&void 0!==m?m:o.year,month:null!==(g=k.month)&&void 0!==g?g:o.month,day:null!==(f=k.day)&&void 0!==f?f:o.day,hour:null!==(p=null!==(v=k.hour)&&void 0!==v?v:null==a?void 0:a.hour)&&void 0!==p?p:0,minute:null!==(D=null!==(y=k.minute)&&void 0!==y?y:null==a?void 0:a.minute)&&void 0!==D?D:0,second:null!==(b=null!==(w=k.second)&&void 0!==w?w:null==a?void 0:a.second)&&void 0!==b?b:0,millisecond:null!==(C=null!==(E=k.millisecond)&&void 0!==E?E:null==a?void 0:a.millisecond)&&void 0!==C?C:0,microsecond:null!==(S=null!==(T=k.microsecond)&&void 0!==T?T:null==a?void 0:a.microsecond)&&void 0!==S?S:0,nanosecond:null!==(x=null!==(M=k.nanosecond)&&void 0!==M?M:null==a?void 0:a.nanosecond)&&void 0!==x?x:0})}},Kn=(e,t,n)=>{const a=Wn(t,n),r={YYYY:e.year.toString(),YY:zn(e.year%100),MM:zn(e.month),DD:zn(e.day),HH:zn(e.hour),mm:zn(e.minute)};return a.replace(Zn,e=>{var t;return null!==(t=r[e])&&void 0!==t?t:e})},Xn="df-scrollbar-hide",Jn=({focusedField:e,draftRange:t,disabled:n,onHourSelect:a,onMinuteSelect:r,timeListRefs:o})=>{const i=e,l=t["start"===i?0:1],s=l.minute,d=Vn.includes(s)?Vn:[...Vn,s].toSorted((e,t)=>e-t);return Rn("div",{className:"df-range-picker-time-selector",children:[Rn("div",{className:"df-range-picker-time-selector-header",children:Rn("div",{className:"df-range-picker-time-selector-value",children:[l.hour.toString().padStart(2,"0"),":",l.minute.toString().padStart(2,"0")]})}),Rn("div",{className:"df-range-picker-time-selector-body",children:[Rn("div",{className:"df-range-picker-time-selector-column",children:Rn("div",{className:`df-range-picker-time-list ${Xn}`,role:"listbox","aria-label":"Hour",ref:e=>{o.current&&o.current[i]&&(o.current[i].hour=e)},children:jn.map(e=>{const t=e===l.hour;return Rn("button",{type:"button",role:"option","aria-selected":t,disabled:n,onClick:()=>a(i,e),className:"df-range-picker-time-option","data-active":t?"true":void 0,children:zn(e)},e)})})}),Rn("div",{className:"df-range-picker-time-selector-column",children:Rn("div",{className:`df-range-picker-time-list ${Xn}`,role:"listbox","aria-label":"Minute",ref:e=>{o.current&&o.current[i]&&(o.current[i].minute=e)},children:d.map(e=>{const t=e===s;return Rn("button",{type:"button",role:"option","aria-selected":t,disabled:n,onClick:()=>r(i,e),className:"df-range-picker-time-option","data-active":t?"true":void 0,children:zn(e)},e)})})})]})]})},Qn=({visibleMonth:e,monthLabels:t,weekDayLabels:n,calendarDays:a,draftRange:r,focusedField:o,isTimeEnabled:i,disabled:l,matchTriggerWidth:s,popupRef:d,timeListRefs:c,onMonthChange:u,onYearChange:h,onDaySelect:m,onHourSelect:g,onMinuteSelect:f,onOk:v,getPopupStyle:p})=>{const y=r[0].toPlainDate(),D=r[1].toPlainDate();return Rn("div",{ref:d,className:"df-range-picker df-range-picker-popup",style:p(),"data-range-picker-popup":"true",children:Rn("div",{className:"df-range-picker-panel",style:{boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",width:s?"100%":void 0},children:[Rn("div",{className:"df-range-picker-panel-body",children:[Rn("div",{className:"df-range-picker-calendar-pane",children:[Rn(Yn,{visibleMonth:e,monthLabels:t,disabled:l,onMonthChange:u,onYearChange:h}),Rn(Hn,{calendarDays:a,visibleMonth:e,startDate:y,endDate:D,weekDayLabels:n,disabled:l,onDaySelect:m})]}),i&&Rn("div",{className:"df-range-picker-time-pane",children:Rn(Jn,{focusedField:o,draftRange:r,disabled:l,onHourSelect:g,onMinuteSelect:f,timeListRefs:c})})]}),Rn("div",{className:"df-range-picker-footer",children:Rn("button",{type:"button",onClick:v,disabled:l,className:"df-range-picker-confirm-button",children:"OK"})})]})})},ea=({value:e,format:n="YYYY-MM-DD HH:mm",showTimeFormat:o="HH:mm",showTime:i=!0,onChange:l,onOk:s,timeZone:d,disabled:c=!1,placement:u="bottomLeft",autoAdjustOverflow:h=!0,getPopupContainer:m,matchTriggerWidth:g=!1,locale:f="en-US"})=>{const v=r.useMemo(()=>"string"==typeof f?f:(null==f?void 0:f.code)||"en-US",[f]),p=r.useMemo(()=>void 0===i||("object"==typeof i||Boolean(i)),[i]),y=r.useMemo(()=>((e,t="long")=>{const n=[];for(let a=0;a<12;a++){const r=new Date(2024,a,1);try{n.push(r.toLocaleDateString(e,{month:t}))}catch(e){n.push(r.toLocaleDateString("en-US",{month:t}))}}return n})(v,"short"),[v]),D=r.useMemo(()=>((e,t="short",n=1)=>{const a=[],r=new Date(2024,0,7);for(let o=0;o<7;o++){const i=new Date(r);i.setDate(r.getDate()+n+o);try{a.push(i.toLocaleDateString(e,{weekday:t}))}catch(e){a.push(i.toLocaleDateString("en-US",{weekday:t}))}}return a})(v,"narrow"),[v]),w=r.useMemo(()=>p?"object"==typeof i&&(null==i?void 0:i.format)?i.format:o:"",[p,i,o]),b=r.useMemo(()=>Wn(n,w),[n,w]),E=r.useMemo(()=>(e=>{let t,n=0,a="^";for(;null!==(t=Zn.exec(e));){a+=Un(e.slice(n,t.index));const r=t[0];a+=`(?<${r}>\\d{${"YYYY"===r?4:2}})`,n=t.index+r.length}return a+=Un(e.slice(n))+"$",new RegExp(a)})(b),[b]),C=r.useMemo(()=>{const n=null!=d?d:_n(e[0])?_n(e[1])?t.Temporal.Now.timeZoneId():qn(e[1]):qn(e[0]),a=Gn(e[0],n).withTimeZone(n);return[a,Gn(e[1],n,a).withTimeZone(n)]},[e,d]),[T,S]=r.useState(C),M=r.useRef(C),[x,k]=r.useState("start"),[N,I]=r.useState([Kn(C[0],n,w),Kn(C[1],n,w)]),R=r.useRef([Kn(C[0],n,w),Kn(C[1],n,w)]),O=r.useRef(C),[H,P]=r.useState(C[0].toPlainDate().with({day:1})),[A,L]=r.useState(!1),$=r.useCallback(e=>{L(e)},[]),[F,Y]=r.useState(u),j=r.useRef(u),V=r.useRef(null),_=r.useRef(null),Z=r.useRef({start:{hour:null,minute:null},end:{hour:null,minute:null}}),z=r.useRef(!1),W=r.useRef(!1);r.useEffect(()=>{R.current=N},[N]),r.useEffect(()=>{O.current=T},[T]),r.useEffect(()=>{const e=M.current,n=0!==t.Temporal.ZonedDateTime.compare(e[0],C[0])||e[0].timeZoneId!==C[0].timeZoneId,a=0!==t.Temporal.ZonedDateTime.compare(e[1],C[1])||e[1].timeZoneId!==C[1].timeZoneId;(n||a)&&S(C),M.current=C},[C]),r.useEffect(()=>{P(C[0].toPlainDate().with({day:1}))},[C[0]]);const U=r.useCallback((e,t,n=0)=>{var a;if(!e||!t)return;const r=e.getBoundingClientRect(),o=t.getBoundingClientRect().top-r.top+e.scrollTop-n,i=(null===(a=window.matchMedia)||void 0===a?void 0:a.call(window,"(prefers-reduced-motion: reduce)").matches)?"auto":"smooth";Math.abs(e.scrollTop-o)>1&&e.scrollTo({top:o,behavior:i})},[]),B=r.useCallback(e=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{const t=Z.current[e];["hour","minute"].forEach(e=>{const n=t[e];if(!n)return;const a=n.querySelector('[data-active="true"]');a&&U(n,a,0)})})})},[U]);r.useEffect(()=>{A&&p&&B(x)},[x,A,B,p]);const q=T[0].epochMilliseconds,G=T[0].offsetNanoseconds,K=T[1].epochMilliseconds,X=T[1].offsetNanoseconds;r.useEffect(()=>{if(W.current)return;const[e,t]=O.current,a=Kn(e,n,w),r=Kn(t,n,w),[o,i]=R.current;o===a&&i===r||(R.current=[a,r],I([a,r]))},[q,G,K,X,n,w]),r.useEffect(()=>{if(!A)return;const e=e=>{var t,n;const a=e.target;(null===(t=V.current)||void 0===t?void 0:t.contains(a))||(null===(n=_.current)||void 0===n?void 0:n.contains(a))||a.closest("[data-range-picker-popup]")||$(!1)};return document.addEventListener("pointerdown",e,!0),()=>{document.removeEventListener("pointerdown",e,!0)}},[A]),r.useEffect(()=>{A||(k("start"),z.current||S(C),z.current=!1)},[A,C]);const J=r.useCallback(e=>{l&&l(e,[Kn(e[0],n,w),Kn(e[1],n,w)])},[w,n,l]),Q=r.useCallback(e=>{s&&s(e,[Kn(e[0],n,w),Kn(e[1],n,w)])},[w,n,s]),ee=r.useCallback((e,n)=>{S(a=>{const r=[...a];if("start"===e){const e=Gn(r[1],qn(n),n),a=t.Temporal.ZonedDateTime.compare(n,e)>0?n:e;return[n,a]}const o=Gn(r[0],qn(n),n);return[t.Temporal.ZonedDateTime.compare(o,n)>0?n:o,n]})},[]),te=e=>{if(c)return;const n=(e,n)=>{var a,r,o,i;const l=qn(e);return t.Temporal.ZonedDateTime.from({timeZone:l,year:n.year,month:n.month,day:n.day,hour:e.hour,minute:e.minute,second:null!==(a=e.second)&&void 0!==a?a:0,millisecond:null!==(r=e.millisecond)&&void 0!==r?r:0,microsecond:null!==(o=e.microsecond)&&void 0!==o?o:0,nanosecond:null!==(i=e.nanosecond)&&void 0!==i?i:0})};if("start"===x){const t=n(T[0],e),a=T[1].epochMilliseconds-T[0].epochMilliseconds,r=t.add({milliseconds:a});return void S([t,r])}const a=n(T[1],e),r=T[1].epochMilliseconds-T[0].epochMilliseconds;if(t.Temporal.ZonedDateTime.compare(a,T[0])<0){const t=n(T[0],e),a=t.add({milliseconds:r});return void S([t,a])}S([T[0],a]),P(a.toPlainDate().with({day:1}))},ne=r.useCallback((e,n)=>{if(c)return;const a="start"===e?0:1;S(r=>{const o=r[a],i=o.with({hour:n,minute:o.minute,second:0,millisecond:0,microsecond:0,nanosecond:0});if("start"===e){const e=Gn(r[1],qn(i),i);return[i,t.Temporal.ZonedDateTime.compare(i,e)>0?i:e]}const l=Gn(r[0],qn(i),i);return[t.Temporal.ZonedDateTime.compare(l,i)>0?i:l,i]}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const t=Z.current[e].hour;if(!t)return;const n=t.querySelector('[data-active="true"]');n&&U(t,n,0)})})},[c,U]),ae=r.useCallback((e,n)=>{if(c)return;const a="start"===e?0:1;S(r=>{const o=r[a].with({minute:n,second:0,millisecond:0,microsecond:0,nanosecond:0});if("start"===e){const e=Gn(r[1],qn(o),o);return[o,t.Temporal.ZonedDateTime.compare(o,e)>0?o:e]}const i=Gn(r[0],qn(o),o);return[t.Temporal.ZonedDateTime.compare(i,o)>0?o:i,o]}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const t=Z.current[e].minute;if(!t)return;const n=t.querySelector('[data-active="true"]');n&&U(t,n,0)})})},[c,U]),re=r.useCallback((e,t)=>{const n="start"===e?0:1;I(e=>{const a=[...e];return a[n]=t,a})},[]),oe=r.useCallback((e,t)=>{const a="start"===e?0:1,r=T[a],o=qn(r),i=Bn(t,E,r,o);if(i){ee(e,i);const t=i.toPlainDate().with({day:1});return P(t),"start"===e&&k("end"),!0}return I(e=>{const t=[...e];return t[a]=Kn(T[a],n,w),t}),!1},[T,w,n,E,ee]),ie=r.useCallback(e=>t=>{const n=t.currentTarget.value;W.current=!0,re(e,n);const a="start"===e?0:1,r=O.current[a],o=qn(r),i=Bn(n,E,r,o);if(i){ee(e,i);const t=i.toPlainDate().with({day:1});P(t),B(e)}},[re,E,ee,B]),le=r.useCallback(e=>t=>{var a;if(c)return;if(W.current=!1,A){const t="start"===e?0:1,a=Kn(O.current[t],n,w);return void I(e=>{const n=[...e];return n[t]=a,n})}const r=t.relatedTarget;r&&(null===(a=V.current)||void 0===a?void 0:a.contains(r))||oe(e,t.currentTarget.value)},[oe,c,A,n,w]),se=r.useCallback(e=>t=>{"Enter"===t.key&&(t.preventDefault(),W.current=!1,oe(e,t.currentTarget.value)),"Escape"===t.key&&t.currentTarget.blur()},[oe]),de=()=>{z.current=!0,J(T),Q(T),$(!1)},ce=e=>{P(t=>t.add({months:e}).with({day:1}))},ue=e=>{P(t=>t.add({years:e}).with({day:1}))},he=r.useMemo(()=>{const e=H,t=e.dayOfWeek%7,n=e.subtract({days:t});return Array.from({length:42},(e,t)=>n.add({days:t}))},[H]),me=r.useCallback((e=u)=>{if(!h||!V.current)return e;const t=V.current.getBoundingClientRect(),n=g?t.width:480,a=window.innerHeight-t.bottom,r=t.top,o=window.innerWidth-t.left,i=t.right;let l=e;return l.startsWith("bottom")&&a<500&&r>a?l=l.replace("bottom","top"):l.startsWith("top")&&r<500&&a>r&&(l=l.replace("top","bottom")),l.endsWith("Left")&&o<n&&i>o?l=l.replace("Left","Right"):l.endsWith("Right")&&i<n&&o>i&&(l=l.replace("Right","Left")),l},[h,g,u]),ge=r.useCallback(()=>{const e=me();j.current!==e&&(j.current=e,Y(e))},[me]),fe=e=>{if(c)return;k(e);const t=T["start"===e?0:1].toPlainDate().with({day:1});P(t);const n=me();j.current!==n&&(j.current=n,Y(n)),$(!0)};r.useEffect(()=>{if(!A)return;ge();const e=()=>ge();return window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}},[A,ge]);const ve=()=>{if(!V.current)return{};const e=V.current.getBoundingClientRect(),t={position:"fixed",zIndex:9999};return j.current.startsWith("bottom")?t.top=e.bottom+8:t.bottom=window.innerHeight-e.top+8,u.endsWith("Left")?t.left=e.left:t.right=window.innerWidth-e.right,g&&(t.width=`${e.width}px`),t};return Rn("div",{className:"df-range-picker df-range-picker-root",ref:V,children:[Rn("div",{className:"df-range-picker-trigger","data-disabled":c,"data-open":A,children:[Rn("div",{className:"df-range-picker-field-group",children:Rn("input",{type:"text",name:"range-start",value:N[0],onChange:ie("start"),onFocus:()=>fe("start"),onClick:()=>fe("start"),onBlur:le("start"),onKeyDown:se("start"),className:"df-range-picker-input","data-disabled":c,"data-focused":"start"===x&&A,placeholder:b,autoComplete:"off",disabled:c})}),Rn(Fn,{className:"df-range-picker-separator-icon"}),Rn("div",{className:"df-range-picker-field-group",children:Rn("input",{type:"text",name:"range-end",value:N[1],onChange:ie("end"),onFocus:()=>fe("end"),onClick:()=>fe("end"),onBlur:le("end"),onKeyDown:se("end"),className:"df-range-picker-input","data-disabled":c,"data-focused":"end"===x&&A,placeholder:b,autoComplete:"off",disabled:c})})]}),A&&(m?a.createPortal(Rn(Qn,{visibleMonth:H,monthLabels:y,weekDayLabels:D,calendarDays:he,draftRange:T,focusedField:x,isTimeEnabled:!!p,disabled:c,matchTriggerWidth:g,popupRef:_,timeListRefs:Z,onMonthChange:ce,onYearChange:ue,onDaySelect:te,onHourSelect:ne,onMinuteSelect:ae,onOk:de,getPopupStyle:ve}),m()):a.createPortal(Rn(Qn,{visibleMonth:H,monthLabels:y,weekDayLabels:D,calendarDays:he,draftRange:T,focusedField:x,isTimeEnabled:!!p,disabled:c,matchTriggerWidth:g,popupRef:_,timeListRefs:Z,onMonthChange:ce,onYearChange:ue,onDaySelect:te,onHourSelect:ne,onMinuteSelect:ae,onOk:de,getPopupStyle:ve}),document.body))]})},ta=({options:e,value:t,onChange:n,registry:o,variant:i="desktop",disabled:l=!1})=>{const[s,d]=r.useState(!1),[c,u]=r.useState({}),h=r.useRef(null),m=r.useRef(null),g=()=>{if(m.current){const e=m.current.getBoundingClientRect(),t="mobile"===i,n={position:"fixed",zIndex:10001,minWidth:t?"12rem":`${e.width}px`,top:`${e.bottom+4}px`};t?n.right=window.innerWidth-e.right+"px":n.left=`${e.left}px`,u(n)}};r.useEffect(()=>{const e=e=>{!h.current||h.current.contains(e.target)||e.target.closest("[data-calendar-picker-dropdown]")||d(!1)};return s&&(g(),window.addEventListener("mousedown",e),window.addEventListener("scroll",g,!0),window.addEventListener("resize",g)),()=>{window.removeEventListener("mousedown",e),window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",g)}},[s]);const f=e=>(o||R()).resolveColors(e).lineColor,v=(e,t)=>{e.stopPropagation(),n(t),d(!1)},p=e.find(e=>e.value===t),y=()=>s&&"undefined"!=typeof window?"mobile"===i?a.createPortal(ze("div",{"data-calendar-picker-dropdown":"true",style:c,className:Zt,children:e.map(e=>ze("div",{className:"df-calendar-picker-option df-calendar-picker-option-mobile","data-selected":e.value===t?"true":"false",onClick:t=>v(t,e.value),children:[ze("div",{className:"df-calendar-picker-option-inner",children:[ze("div",{className:"df-calendar-picker-check-area",children:e.value===t&&ze(Qt,{className:"df-text-primary"})}),ze("span",{className:"df-calendar-picker-option-label",children:e.label})]}),ze("span",{className:"df-calendar-picker-color-swatch df-calendar-picker-color-swatch-sm",style:{backgroundColor:f(e.value)}})]},e.value))}),document.body):a.createPortal(ze("ul",{"data-calendar-picker-dropdown":"true",style:c,className:Zt,children:e.map(e=>ze("li",{className:"df-calendar-picker-option","data-selected":t===e.value?"true":"false",onClick:t=>v(t,e.value),children:[ze("div",{className:"df-calendar-picker-check-area",children:e.value===t&&ze(Qt,{className:"df-text-primary"})}),ze("span",{className:"df-calendar-picker-color-swatch-sm",style:{backgroundColor:f(e.value)}}),ze("span",{className:"df-calendar-picker-option-label",children:e.label})]},e.value))}),document.body):null;return ze("div","mobile"===i?{className:"df-calendar-picker",ref:h,children:[ze("button",{type:"button",ref:m,disabled:l,onClick:e=>{e.stopPropagation(),l||d(!s)},className:"df-calendar-picker-trigger df-calendar-picker-trigger-mobile",children:[ze("span",{className:"df-calendar-picker-color-swatch df-calendar-picker-color-swatch-sm",style:{backgroundColor:f(t)}}),ze("span",{className:"df-calendar-picker-label",children:(null==p?void 0:p.label)||t}),ze(en,{className:"df-text-muted"})]}),y()]}:{className:"df-calendar-picker",ref:h,children:[ze("button",{ref:m,type:"button",onClick:e=>{e.stopPropagation(),d(!s)},className:"df-calendar-picker-trigger",children:[ze("span",{className:"df-calendar-picker-color-swatch",style:{backgroundColor:f(t)}}),ze(en,{className:"df-text-muted"})]}),y()]})},na=({event:n,isOpen:o,onEventUpdate:i,onEventDelete:l,onClose:s,app:d})=>{var c,u;const[h,m]=r.useState(n),[f,v]=r.useState(!1),[p,y]=r.useState(!1),D=r.useRef(n.id),{t:w}=Tt();r.useEffect(()=>{m(n),D.current!==n.id&&(v(!1),y(!1),D.current=n.id)},[n]);const b=r.useMemo(()=>(d?d.getCalendarRegistry():R()).getVisible().map(e=>({label:e.name,value:e.id})),[d,null==d?void 0:d.getCalendars()]),E=r.useMemo(()=>!xe(n,h),[n,h]),C=r.useMemo(()=>{var e;return null!==(e=null==d?void 0:d.timeZone)&&void 0!==e?e:t.Temporal.Now.timeZoneId()},[d]),T=e=>{const[t,n]=e;m(Object.assign(Object.assign({},h),{start:t.toPlainDate(),end:n.toPlainDate()}))},S=null!==(c=null==d?void 0:d.canMutateFromUI(n.id))&&void 0!==c&&c,M=null==d?void 0:d.getReadOnlyConfig(n.id),x=!1!==(null==M?void 0:M.viewable),k=f||p,N=!r.useMemo(()=>{if(!n.calendarId)return!1;const e=null==d?void 0:d.getCalendarRegistry().get(n.calendarId);return!!(null==e?void 0:e.subscription)},[d,n.calendarId])||""!==(h.description||"").trim();if(!o||!x)return null;if("undefined"==typeof window||"undefined"==typeof document)return null;const I=ze("div",{className:"df-portal df-event-dialog-overlay",style:{zIndex:9998},"data-event-detail-dialog":"true",children:[ze("div",{className:"df-event-dialog-backdrop",style:{position:"absolute",inset:0},onClick:e=>{const t=e.target;t.closest("[data-range-picker-popup]")||t===e.currentTarget&&s()}}),ze("div",{className:"df-dialog-container",children:[ze("button",{type:"button",onClick:s,disabled:k,className:"df-event-dialog-close","aria-label":"Close",children:ze("svg",{fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:ze("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),ze("div",{children:[ze("span",{className:"df-form-label",children:w("eventTitle")}),ze("div",{className:"df-form-row",children:[ze("div",{className:"df-form-field",children:ze("input",{id:`event-dialog-title-${h.id}`,name:"title",type:"text",value:h.title,readOnly:!S||k,disabled:!S||k,onChange:e=>{m(Object.assign(Object.assign({},h),{title:e.target.value}))},className:"df-form-input"})}),S&&ze(ta,{options:b,value:h.calendarId||"blue",disabled:k,onChange:e=>m(Object.assign(Object.assign({},h),{calendarId:e})),registry:null==d?void 0:d.getCalendarRegistry()})]}),h.allDay?ze("div",{className:"df-event-dialog-time-row",children:[ze("div",{className:"df-form-label",children:w("dateRange")}),ze(ea,{value:[h.start,h.end],format:"YYYY-MM-DD",showTime:!1,timeZone:C,matchTriggerWidth:!0,disabled:!S||k,onChange:T,onOk:T,locale:null==d?void 0:d.state.locale})]}):ze("div",{className:"df-event-dialog-time-row",children:[ze("div",{className:"df-form-label",children:w("timeRange")}),ze(ea,{value:[h.start,h.end],timeZone:C,disabled:!S||k,onChange:e=>{const[t,n]=e;m(Object.assign(Object.assign({},h),{start:t,end:n}))},onOk:e=>{const[t,n]=e;m(Object.assign(Object.assign({},h),{start:t,end:n}))},locale:null==d?void 0:d.state.locale})]}),N&&ze("div",{className:"df-event-dialog-notes-row",children:[ze("span",{className:"df-form-label",children:w("note")}),ze("textarea",{id:`event-dialog-note-${h.id}`,name:"note",value:null!==(u=h.description)&&void 0!==u?u:"",readOnly:!S||k,disabled:!S||k,onChange:e=>m(Object.assign(Object.assign({},h),{description:e.target.value})),rows:4,className:"df-form-textarea",placeholder:w("addNotePlaceholder")})]}),S&&ze("div",{className:"df-form-actions",children:[h.allDay?ze("button",{type:"button",disabled:k,className:"df-tint-primary df-hover-primary-md df-btn-sm",onClick:()=>{var e;const n=g(h.start)?h.start:h.start.toPlainDate(),a=null!==(e=null==d?void 0:d.timeZone)&&void 0!==e?e:t.Temporal.Now.timeZoneId(),r=t.Temporal.ZonedDateTime.from({year:n.year,month:n.month,day:n.day,hour:9,minute:0,timeZone:a}),o=t.Temporal.ZonedDateTime.from({year:n.year,month:n.month,day:n.day,hour:10,minute:0,timeZone:a});m(Object.assign(Object.assign({},h),{allDay:!1,start:r,end:o}))},children:w("setAsTimed")}):ze("button",{type:"button",disabled:k,className:"df-tint-primary df-hover-primary-md df-btn-sm",onClick:()=>{const e=g(h.start)?h.start:h.start.toPlainDate();m(Object.assign(Object.assign({},h),{allDay:!0,start:e,end:e}))},children:w("setAsAllDay")}),ze(xn,{type:"button",disabled:k,className:"df-fill-destructive df-hover-destructive df-btn-sm",onClick:()=>e.__awaiter(void 0,void 0,void 0,function*(){if(!f&&!p){y(!0);try{yield l(n.id),s()}finally{y(!1)}}}),loading:p,children:w("delete")}),ze(xn,{type:"button",className:"df-fill-primary df-btn-sm "+(E?"df-shadow-primary df-hover-primary-solid":""),style:{marginLeft:"auto"},onClick:()=>e.__awaiter(void 0,void 0,void 0,function*(){if(!f&&!p){v(!0);try{yield i(me(n,h,null==d?void 0:d.timeZone)),s()}finally{v(!1)}}}),disabled:!E||k,loading:f,children:w("save")})]})]})]})]}),O=document.body;return O?a.createPortal(I,O):null},aa=e=>e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),ra=({app:e,anchorRef:t,onClose:n,isOpen:o})=>{const{t:i}=Tt(),[l,s]=r.useState(""),[d,c]=r.useState(0),[u,h]=r.useState(!1),m=r.useRef(null),g=r.useRef(null);r.useEffect(()=>{o||h(!1)},[o]),r.useEffect(()=>{if(o){const e=window.setTimeout(()=>{var e;return null===(e=m.current)||void 0===e?void 0:e.focus()},50);return s(""),c(0),()=>window.clearTimeout(e)}},[o]),r.useEffect(()=>{const e=e=>{o&&g.current&&!g.current.contains(e.target)&&t.current&&!t.current.contains(e.target)&&n()};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[o,n,t]);const[f,v]=r.useState({top:0,left:0}),[p,y]=r.useState("top"),[D,w]=r.useState(0),b=r.useMemo(()=>ue(e.timeZone),[e.timeZone,o]),E=r.useMemo(()=>{var t,n;if(!l.trim())return[];const a=[],r=e.getCalendars(),o=e.getAllEvents(),i=l.toLowerCase(),s=o.find(e=>e.title.toLowerCase()===i);let d=null==s?void 0:s.calendarId;if(d||(d=null===(t=e.getCalendarRegistry().getDefaultWritableCalendar())||void 0===t?void 0:t.id),d){const t=e.getCalendarRegistry().get(d);((null==t?void 0:t.readOnly)||(null==t?void 0:t.subscription))&&(d=null===(n=e.getCalendarRegistry().getDefaultWritableCalendar())||void 0===n?void 0:n.id)}const c=r.find(e=>e.id===d),u=(null==c?void 0:c.colors.lineColor)||"#3b82f6";a.push({type:"new",title:l,calendarId:d||"",color:u,start:b.start,end:b.end});const h=new Set([l.toLowerCase()]),m=o.filter(t=>{var n;if(!t.title.toLowerCase().includes(i))return!1;if(h.has(t.title.toLowerCase()))return!1;const a=e.getCalendarRegistry().get(null!==(n=t.calendarId)&&void 0!==n?n:"");return!((null==a?void 0:a.readOnly)||(null==a?void 0:a.subscription))});return m.slice(0,5).forEach(e=>{h.add(e.title.toLowerCase());const t=r.find(t=>t.id===e.calendarId);a.push({type:"history",title:e.title,calendarId:e.calendarId||"",color:(null==t?void 0:t.colors.lineColor)||"#9ca3af",start:b.start,end:b.end})}),a},[l,e,b]);r.useLayoutEffect(()=>{if(o&&t.current&&g.current){const e=t.current.getBoundingClientRect(),n=g.current.offsetHeight,a=340;let r=e.left+e.width/2-a/2;const o=12,i=window.innerWidth;r<o?r=o:r+a>i-o&&(r=i-a-o);const l=e.left+e.width/2;w(l-r);let s=0,d="top";e.top<n+20?(d="bottom",s=e.bottom+12):(d="top",s=e.top-12-n),y(d),v({top:s,left:r}),h(!0)}},[o,t,E]);const C=t=>{if(!t.calendarId)return;const a=Ne(),r={id:a,title:t.title,start:te(t.start,e.timeZone),end:te(t.end,e.timeZone),calendarId:t.calendarId,allDay:!1};e.addEvent(r),e.setCurrentDate(t.start),e.highlightEvent(a),n()};return r.useEffect(()=>{if(!o)return;const e=e=>{0!==E.length&&("ArrowDown"===e.key?(e.preventDefault(),c(e=>(e+1)%E.length)):"ArrowUp"===e.key?(e.preventDefault(),c(e=>(e-1+E.length)%E.length)):"Enter"===e.key&&(e.preventDefault(),E[d]&&C(E[d])))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[o,E,d]),o?a.createPortal(ze("div",{ref:g,className:"df-portal df-quick-create","data-ready":u?"true":"false",style:{top:f.top,left:f.left,visibility:u?"visible":"hidden"},children:[ze("div",{className:"df-quick-create-header",children:[ze("div",{className:"df-quick-create-title",children:i("quickCreateEvent")||"Quick Create Event"}),ze("div",{className:"df-quick-create-input-wrap",children:ze("input",{ref:m,type:"text",className:"df-form-input",placeholder:i("quickCreatePlaceholder")||"Enter title (e.g. Code review)",value:l,onChange:e=>s(e.target.value)})})]}),ze("div",{className:"df-quick-create-list",children:[0===E.length&&l&&ze("div",{className:"df-quick-create-empty",children:i("noSuggestions")||"Type to create"}),E.map((e,t)=>{return ze("div",{className:"df-quick-create-item","data-selected":t===d?"true":"false",onClick:()=>C(e),onMouseEnter:()=>c(t),children:[ze("div",{className:"df-quick-create-color-bar",style:{backgroundColor:e.color}}),ze("div",{className:"df-quick-create-item-content",children:[ze("div",{className:"df-quick-create-item-title",children:e.title}),ze("div",{children:ze("span",{className:"df-quick-create-item-badge",children:"new"===e.type?i("today"):i("tomorrow")})}),ze("div",{className:"df-quick-create-item-time",children:(n=e.start,a=e.end,`${aa(n)} - ${aa(a)}`)})]})]},`${e.type}-${t}`);var n,a})]}),ze("div",{className:"df-quick-create-arrow","data-placement":"top"===p?"bottom":"top",style:{left:D}})]}),document.body):null},oa=({visibleMonth:e,currentDate:n,showHeader:a=!1,onMonthChange:o,onDateSelect:i,events:l=[],showEventDots:s=!1,calendarRegistry:d,timeZone:c})=>{const{locale:u}=Tt(),h=r.useMemo(()=>{const e=c?t.Temporal.Now.plainDateISO(c):t.Temporal.Now.plainDateISO();return new Date(e.year,e.month-1,e.day).toDateString()},[c]),m=n.toDateString(),g=r.useMemo(()=>hn(u,"narrow"),[u]),f=r.useMemo(()=>e.toLocaleDateString(u,{month:"long",year:"numeric"}),[e,u]),v=r.useMemo(()=>{if(!s||!(null==l?void 0:l.length))return null;const e=new Map;return l.forEach(t=>{var n;const a=X(t.start,c),r=t.end?X(t.end,c):a,o=new Date(a);o.setHours(0,0,0,0);const i=new Date(r);i.setHours(0,0,0,0);let l=new Date(i);if(!t.allDay){0!==r.getHours()||0!==r.getMinutes()||0!==r.getSeconds()||0!==r.getMilliseconds()||l.setDate(l.getDate()-1)}l<o&&(l=new Date(o));const s=L(t.calendarId||"default",d).toLowerCase();for(let t=new Date(o);t<=l;t=new Date(t.getTime()+864e5)){const a=t.toDateString(),r=null!==(n=e.get(a))&&void 0!==n?n:[];!r.includes(s)&&r.length<4&&e.set(a,[...r,s])}}),e},[s,l,c,d]),p=r.useMemo(()=>{const t=e.getFullYear(),n=e.getMonth(),a=(new Date(t,n,1).getDay()+6)%7,r=[];for(let e=0;e<42;e++){const o=new Date(t,n,e-a+1),i=o.toDateString();r.push({date:o.getDate(),fullDate:o,isCurrentMonth:o.getMonth()===n,isToday:i===h,isSelected:i===m})}return r},[e,m,h]);return ze("div",{className:"df-mini-calendar-body",children:[a?ze("div",{className:"df-mini-calendar-header-nav",children:[ze("button",{type:"button",className:"df-mini-calendar-nav-btn",onClick:()=>o(-1),"aria-label":"Previous month",children:ze(qt,{})}),ze("span",{className:"df-mini-calendar-month-label",children:f}),ze("button",{type:"button",className:"df-mini-calendar-nav-btn",onClick:()=>o(1),"aria-label":"Next month",children:ze(Gt,{})})]}):null,ze("div",{className:"df-mini-calendar-grid",children:[g.map((e,t)=>ze("div",{className:"df-mini-calendar-header",children:e},`weekday-${t}`)),p.map(e=>{var t;const n=null!==(t=null==v?void 0:v.get(e.fullDate.toDateString()))&&void 0!==t?t:[];return ze("button",{type:"button",className:"df-mini-calendar-day df-mini-calendar-day-cell","data-today":e.isToday?"true":void 0,"data-selected":!e.isToday&&e.isSelected?"true":void 0,"data-other-month":e.isCurrentMonth?void 0:"true",onClick:()=>i(e.fullDate),children:[ze("span",{className:"df-mini-calendar-day-number",children:e.date}),s&&n.length>0&&ze("div",{className:"df-mini-calendar-dots",children:n.slice(0,4).map((e,t)=>ze("div",{"data-mini-calendar-dot":"true",className:"df-mini-calendar-dot",style:{backgroundColor:e}},`${e}-${t}`))})]},e.fullDate.getTime())})]})]})},ia=({checked:e,onChange:t,disabled:n})=>ze("button",{type:"button",role:"switch","aria-checked":e,disabled:n,"data-checked":String(e),"data-disabled":String(!!n),className:"df-mobile-switch",onClick:()=>!n&&t(!e),children:ze("span",{className:"df-mobile-switch-thumb"})}),la=({date:e,onChange:t})=>{const n=Array.from({length:24},(e,t)=>t),a=Array.from({length:12},(e,t)=>5*t),o=[...n,...n,...n],i=[...a,...a,...a],l=32,s=e.getHours(),d=5*Math.round(e.getMinutes()/5),c=(24+s)*l,u=(12+d/5)*l,[h,m]=r.useState(c),[g,f]=r.useState(u),v=r.useRef(null),p=r.useRef(null),y=r.useRef(null);r.useEffect(()=>{v.current&&(v.current.scrollTop=c,m(c)),p.current&&(p.current.scrollTop=u,f(u))},[c,u]);const D=(n,a)=>{const r=n.currentTarget;let s=r.scrollTop;if("hour"===a){const e=768;s<320?(s+=e,r.scrollTop=s):s>1600&&(s-=e,r.scrollTop=s),m(s)}else{const e=384;s<160?(s+=e,r.scrollTop=s):s>800&&(s-=e,r.scrollTop=s),f(s)}y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{((n,a)=>{const r=Math.round(a/l);if("hour"===n){const n=o[r];if(void 0!==n&&n!==e.getHours()){const a=new Date(e);a.setHours(n),t(a)}}else{const n=i[r];if(void 0!==n&&5*Math.round(e.getMinutes()/5)!==n){const a=new Date(e);a.setMinutes(n),t(a)}}})(a,s)},150)},w=(e,t)=>{const n=96+e*l+16-(t+112),a=Math.min(Math.abs(n)/112,1);return{transform:`perspective(500px) rotateX(${-(n/112*80)}deg) scale(${1-.4*a})`,opacity:1-.7*a,transition:"transform 0.1s ease-out, opacity 0.1s ease-out"}};return ze("div",{className:"df-time-wheel",children:[ze("div",{ref:v,className:"df-time-wheel-column",onScroll:e=>D(e,"hour"),children:[ze("div",{className:"df-time-wheel-spacer",style:{height:96}}),o.map((n,a)=>ze("div",{className:"df-time-wheel-option df-time-wheel-option-hour",onClick:()=>{var r;const o=new Date(e);o.setHours(n),t(o),null===(r=v.current)||void 0===r||r.scrollTo({top:a*l,behavior:"smooth"})},children:ze("div",{className:"df-time-wheel-value","data-selected":String(n===s),style:w(a,h),children:n.toString().padStart(2,"0")})},`h-${a}-${n}`)),ze("div",{className:"df-time-wheel-spacer",style:{height:96}})]}),ze("div",{ref:p,className:"df-time-wheel-column",onScroll:e=>D(e,"minute"),children:[ze("div",{className:"df-time-wheel-spacer",style:{height:96}}),i.map((n,a)=>ze("div",{className:"df-time-wheel-option df-time-wheel-option-minute",onClick:()=>{var r;const o=new Date(e);o.setMinutes(n),t(o),null===(r=p.current)||void 0===r||r.scrollTo({top:a*l,behavior:"smooth"})},children:ze("div",{className:"df-time-wheel-value","data-selected":String(n===d),style:w(a,g),children:n.toString().padStart(2,"0")})},`m-${a}-${n}`)),ze("div",{className:"df-time-wheel-spacer",style:{height:96}})]}),ze("div",{className:"df-time-wheel-selection"})]})},sa=({isOpen:e,onClose:t,onSave:n,onEventDelete:o,draftEvent:i,app:l,timeFormat:s="24h"})=>{const{locale:d,t:c}=Tt(),u=l.getReadOnlyConfig(null==i?void 0:i.id),h=l.canMutateFromUI(null==i?void 0:i.id),m=!1!==u.viewable,[g,v]=r.useState(""),y=!r.useMemo(()=>{if(!(null==i?void 0:i.calendarId))return!1;const e=l.getCalendarRegistry().get(i.calendarId);return!!(null==e?void 0:e.subscription)},[l,null==i?void 0:i.calendarId])||""!==g.trim(),[D,w]=r.useState(""),[b,E]=r.useState(""),[C,T]=r.useState(!1),[S,M]=r.useState(new Date),[x,k]=r.useState(new Date),[N,I]=r.useState(new Date),[R,O]=r.useState(new Date),[H,P]=r.useState(null),[A,L]=r.useState(e),[$,F]=r.useState(!1),[Y,j]=r.useState(!1);r.useEffect(()=>{if(!e){F(!0);const e=setTimeout(()=>{L(!1),F(!1)},300);return()=>clearTimeout(e)}L(!0),F(!1)},[e]),r.useEffect(()=>{if(e&&i){const e=l.getEvents().some(e=>e.id===i.id);j(e)}},[e,i,l]);const V=l.getCalendars(),_=V.map(e=>({label:e.name,value:e.id}));r.useEffect(()=>{if(e&&V.length>0){V.some(e=>e.id===b)||"blue"!==b&&""!==b||E(V[0].id)}},[V,e,b]),r.useEffect(()=>(e?(document.body.style.overflow="hidden",document.documentElement.style.overflow="hidden",document.body.style.position="fixed",document.body.style.width="100%"):(document.body.style.overflow="",document.documentElement.style.overflow="",document.body.style.position="",document.body.style.width=""),()=>{document.body.style.overflow="",document.documentElement.style.overflow="",document.body.style.position="",document.body.style.width=""}),[e]),r.useEffect(()=>{var t,n;if(e&&i){if(w(i.title||""),E(i.calendarId||(null===(t=V[0])||void 0===t?void 0:t.id)||"blue"),T(i.allDay||!1),v(i.description||""),i.start)try{const e=p(i.start);M(e),I(e)}catch(e){console.error("Failed to parse start date",e);const t=new Date;M(t),I(t)}if(i.end)try{const e=p(i.end);k(e),O(e)}catch(e){console.error("Failed to parse end date",e);const t=new Date;k(t),O(t)}}else if(e&&!i){E((null===(n=V[0])||void 0===n?void 0:n.id)||"blue"),v("");const e=new Date;e.setMinutes(0,0,0),M(e),I(e),k(new Date(e.getTime()+36e5)),O(e)}},[e,i]);const Z=r.useMemo(()=>{if(!e||!i)return!1;const t=new Date(S),n=new Date(x),a=Object.assign(Object.assign({},i),{title:D,calendarId:b,allDay:C,description:g,start:C?Q(t):f(t,l.timeZone),end:C?Q(n):f(n,l.timeZone)});return!xe(i,me(i,a,l.timeZone))},[e,i,D,b,C,S,x,g]);if(!A||!m)return null;const z=e=>{P(t=>t===e?null:e)},W=e=>e.toLocaleDateString(d,{day:"numeric",month:"short",year:"numeric"}),U=(e,t)=>{if("start"===e){const e=new Date(t);e.setHours(S.getHours(),S.getMinutes());const n=e.getTime()-S.getTime();M(e);const a=new Date(x.getTime()+n);k(a)}else{const e=new Date(t);e.setHours(x.getHours(),x.getMinutes()),k(e)}},B=(e,t)=>{"start"===e?I(e=>{const n=new Date(e);return n.setMonth(e.getMonth()+t),n}):O(e=>{const n=new Date(e);return n.setMonth(e.getMonth()+t),n})};return a.createPortal(ze("div",{className:"df-portal df-mobile-event-drawer",children:[ze("div",{className:"df-mobile-event-drawer-backdrop","data-closing":String($),onClick:t}),ze("div",{className:"df-mobile-event-drawer-panel "+($?"df-animate-slide-down":"df-animate-slide-up"),onClick:e=>e.stopPropagation(),children:[ze("div",{className:"df-mobile-event-drawer-header",children:[ze("button",{type:"button",onClick:t,className:"df-mobile-event-drawer-header-action",children:c("cancel")}),ze("span",{className:"df-mobile-event-drawer-title",children:c(!h&&Y?"viewEvent":Y?"editEvent":"newEvent")}),h&&ze("button",{type:"button",onClick:()=>{if(!i)return;const e=new Date(S),t=new Date(x),a=Object.assign(Object.assign({},i),{title:D,calendarId:b,allDay:C,start:C?Q(e):f(e,l.timeZone),end:C?Q(t):f(t,l.timeZone)});n(me(i,a,l.timeZone))},disabled:!Z,className:"df-mobile-event-drawer-header-action df-mobile-event-drawer-header-action-primary "+(Z?"":"df-mobile-event-drawer-header-action-disabled"),children:c(Y?"done":"create")}),!h&&ze("span",{className:"df-mobile-event-drawer-header-spacer"})]}),ze("div",{className:"df-mobile-event-drawer-body",children:[ze("div",{className:"df-mobile-event-drawer-section df-mobile-event-drawer-section-framed",children:ze("input",{type:"text",placeholder:c("titlePlaceholder"),value:D,onChange:e=>h&&w(e.currentTarget.value),readOnly:!h,className:"df-mobile-event-drawer-title-input",autoFocus:h})}),V.length>0&&ze("div",{className:"df-mobile-event-drawer-section df-mobile-event-drawer-section-framed",children:ze("div",{className:"df-mobile-event-drawer-row",children:[ze("span",{className:"df-mobile-event-drawer-label",children:c("calendar")}),ze(ta,{options:_,value:b,onChange:h?E:()=>{},registry:l.getCalendarRegistry(),variant:"mobile",disabled:!h})]})}),ze("div",{className:"df-mobile-event-drawer-section df-mobile-event-drawer-section-framed",children:ze("div",{className:"df-mobile-event-drawer-row",children:[ze("span",{className:"df-mobile-event-drawer-label",children:c("allDay")}),ze(ia,{checked:C,onChange:h?T:()=>{},disabled:!h})]})}),ze("div",{className:"df-mobile-event-drawer-section",children:[ze("div",{className:"df-mobile-event-drawer-row df-mobile-event-drawer-row-padded",children:[ze("span",{className:"df-mobile-event-drawer-label",children:c("starts")}),ze("div",{className:"df-mobile-event-drawer-controls",children:[ze("button",{type:"button",className:"df-mobile-event-drawer-picker-trigger","data-active":String("start-date"===H),onClick:()=>h&&z("start-date"),disabled:!h,"aria-expanded":"start-date"===H,children:W(S)}),!C&&ze("button",{type:"button",className:"df-mobile-event-drawer-picker-trigger","data-active":String("start-time"===H),onClick:()=>h&&z("start-time"),disabled:!h,"aria-expanded":"start-time"===H,children:re(S.getHours()+S.getMinutes()/60,0,s)})]})]}),ze("div",{className:"df-mobile-event-drawer-expander","data-kind":"calendar","data-expanded":String("start-date"===H),children:ze("div",{className:"df-mobile-event-drawer-expander-content",children:ze(oa,{currentDate:S,visibleMonth:N,onDateSelect:e=>U("start",e),onMonthChange:e=>B("start",e),showHeader:!0,events:l.getEvents(),calendarRegistry:l.getCalendarRegistry(),timeZone:l.timeZone})})}),ze("div",{className:"df-mobile-event-drawer-expander","data-kind":"time","data-expanded":String("start-time"===H),children:ze("div",{className:"df-mobile-event-drawer-expander-content",children:ze(la,{date:S,onChange:e=>{const t=x.getTime()-S.getTime();M(e),k(new Date(e.getTime()+t))},timeFormat:s})})})]}),ze("div",{className:"df-mobile-event-drawer-section",children:[ze("div",{className:"df-mobile-event-drawer-row df-mobile-event-drawer-row-padded",children:[ze("span",{className:"df-mobile-event-drawer-label",children:c("ends")}),ze("div",{className:"df-mobile-event-drawer-controls",children:[ze("button",{type:"button",className:"df-mobile-event-drawer-picker-trigger","data-active":String("end-date"===H),onClick:()=>h&&z("end-date"),disabled:!h,"aria-expanded":"end-date"===H,children:W(x)}),!C&&ze("button",{type:"button",className:"df-mobile-event-drawer-picker-trigger","data-active":String("end-time"===H),onClick:()=>h&&z("end-time"),disabled:!h,"aria-expanded":"end-time"===H,children:re(x.getHours()+x.getMinutes()/60,0,s)})]})]}),ze("div",{className:"df-mobile-event-drawer-expander","data-kind":"calendar","data-expanded":String("end-date"===H),children:ze("div",{className:"df-mobile-event-drawer-expander-content",children:ze(oa,{currentDate:x,visibleMonth:R,onDateSelect:e=>U("end",e),onMonthChange:e=>B("end",e),showHeader:!0,events:l.getEvents(),calendarRegistry:l.getCalendarRegistry(),timeZone:l.timeZone})})}),ze("div",{className:"df-mobile-event-drawer-expander","data-kind":"time","data-expanded":String("end-time"===H),children:ze("div",{className:"df-mobile-event-drawer-expander-content",children:ze(la,{date:x,onChange:e=>{if(e<S){const t=x.getTime()-S.getTime();k(e),M(new Date(e.getTime()-t))}else k(e)},timeFormat:s})})})]}),y&&ze("div",{className:"df-mobile-event-drawer-section df-mobile-event-drawer-section-framed",children:ze("textarea",{placeholder:c("notesPlaceholder"),value:g,onChange:e=>h&&v(e.currentTarget.value),readOnly:!h,className:"df-mobile-event-drawer-notes"})}),h&&Y&&o&&i&&ze("div",{className:"df-mobile-event-drawer-section df-mobile-event-drawer-section-danger",children:ze("button",{type:"button",onClick:()=>o(i.id),className:"df-mobile-event-drawer-delete-button",children:c("delete")})})]})]})]}),document.body)},da=()=>ze("svg",{className:"df-search-results-state-icon",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:ze("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),ca=({loading:e,results:t,keyword:n,onResultClick:a,emptyText:o})=>{const{t:i,locale:l}=Tt(),s=r.useMemo(()=>et(new Date),[]),d=r.useMemo(()=>nt(t,s),[t,s]),c=e=>Qe(e);return e?ze("div",{className:"df-search-results-state",children:[ze(an,{className:"df-search-results-loader"}),ze("span",{children:"Loading..."})]}):0===t.length?n?ze("div",{className:"df-search-results-state",children:[ze(da,{}),ze("span",{style:{marginTop:"0.5rem",fontSize:"0.875rem"},children:"string"==typeof o?o:o&&"object"==typeof o?o[l]||o.en||"No results found":i("noResults")||"No results found"})]}):null:ze("div",{className:"df-search-results",children:d.map(e=>{const{title:t,tone:n}=tt(e.date,s,l,i);return ze("div",{className:"df-search-results-group",children:[ze("h3",{className:"df-search-results-date-header","data-tone":n,children:t}),ze("div",{className:"df-search-results-events",children:e.events.map(e=>{const t=c(e.start),n=c(e.end),r={hour:"2-digit",minute:"2-digit"},o=e.allDay?i("allDay")||"All Day":t.toLocaleTimeString(l,r),s=e.allDay?"":n.toLocaleTimeString(l,r);return ze("div",{children:[ze("div",{className:"df-search-results-event",onClick:()=>null==a?void 0:a(e),children:ze("div",{className:"df-search-results-event-inner",children:[ze("div",{className:"df-search-results-color-bar",style:{backgroundColor:e.color||"#3b82f6"}}),ze("div",{className:"df-search-results-event-content",children:[ze("div",{className:"df-search-results-event-title",children:e.title}),ze("div",{className:"df-search-results-event-time",children:[ze("div",{children:o}),s&&ze("div",{className:"df-search-results-end-time",children:s})]})]})]})}),ze("div",{className:"df-search-results-divider"})]},e.id)})})]},e.date.getTime())})})},ua=({isOpen:e,onClose:t,keyword:n,onSearchChange:o,results:i,loading:l,onResultClick:s,emptyText:d})=>{const c=r.useRef(null),{t:u}=Tt();return r.useEffect(()=>(e?(setTimeout(()=>{var e;null===(e=c.current)||void 0===e||e.focus()},100),document.body.style.overflow="hidden"):document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),e&&"undefined"!=typeof window?a.createPortal(ze("div",{className:"df-mobile-fullscreen",children:[ze("div",{className:"df-search-dialog-header",children:[ze("button",{type:"button",onClick:t,className:"df-search-dialog-back-btn",children:ze(dn,{className:"df-search-dialog-back-icon"})}),ze("div",{className:"df-search-dialog-input-wrap",children:[ze("input",{ref:c,type:"text",placeholder:u("search")||"Search",value:n,onChange:e=>{const t=e.target.value;t!==n&&o(t)},className:"df-search-dialog-input"}),n&&ze("button",{type:"button",onClick:()=>{""!==n&&o("")},className:"df-search-dialog-input-clear",children:ze(tn,{className:"df-search-dialog-clear-icon"})})]})]}),ze("div",{className:"df-search-dialog-results",children:ze(ca,{loading:l,results:i,keyword:n,onResultClick:e=>{null==s||s(e)},emptyText:d})})]}),document.body):null},ha=({isOpen:e,loading:t,results:n,keyword:a,onResultClick:r,emptyText:o})=>ze("div",{className:"df-search-drawer","data-open":e?"true":"false",children:ze("div",{className:"df-search-drawer-content",children:ze(ca,{loading:t,results:n,keyword:a,onResultClick:r,emptyText:o})})});let ma=null;const ga={enabled:!1,width:"0px",isCollapsed:!1,toggleCollapsed:()=>{},miniWidth:"0px",content:null,extraContent:null,safeAreaLeft:0};function fa(e){return ma&&e.hasPlugin("sidebar")?ma(e):ga}const va=({locale:e,messages:t,children:n})=>Tt().isDefault?ze(fn,{locale:e,messages:t,children:n}):n,pa=({app:t,customDetailPanelContent:o,customEventDetailDialog:i,meta:l,customMessages:s,search:d,titleBarSlot:c,collapsedSafeAreaLeft:u})=>{const h=r.useContext(En),{tick:m,selectedEventId:f}=function(e){var t;const[n,a]=r.useState(0),[o,i]=r.useState(null!==(t=e.state.selectedEventId)&&void 0!==t?t:null);return r.useEffect(()=>{var t;a(0),i(null!==(t=e.state.selectedEventId)&&void 0!==t?t:null)},[e]),r.useEffect(()=>e.subscribe(e=>{a(e=>e+1),i(t=>{var n;const a=null!==(n=e.state.selectedEventId)&&void 0!==n?n:null;return t===a?t:a})}),[e]),{tick:n,selectedEventId:o}}(t),{isMobile:v}=function(){const[e,t]=r.useState(!1);return r.useEffect(()=>{const e=()=>{t(window.matchMedia("(max-width: 768px)").matches)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),{isMobile:e}}(),y=function(t,n){const[a,o]=r.useState(""),[i,l]=r.useState(!1),[s,d]=r.useState(!1),[c,u]=r.useState(!1),[h,m]=r.useState([]),g=r.useRef(""),f=r.useRef(!1);r.useEffect(()=>{t.state.highlightedEventId&&t.selectEvent(t.state.highlightedEventId)},[t.state.highlightedEventId,t]),r.useEffect(()=>{f.current&&!i&&null!==t.state.highlightedEventId&&t.highlightEvent(null),f.current=i},[i,t]),r.useEffect(()=>{var r;if(!a.trim())return l(!1),m([]),g.current.trim()&&null!==t.state.highlightedEventId&&t.highlightEvent(null),void(g.current=a);const o=null!==(r=null==n?void 0:n.debounceDelay)&&void 0!==r?r:300,i=setTimeout(()=>e.__awaiter(this,void 0,void 0,function*(){var e;u(!0),l(!0);try{let r=[];if(null==n?void 0:n.customSearch){const e=t.getEvents().map(e=>{var n;return Object.assign(Object.assign({},e),{color:(null===(n=t.getCalendarRegistry().get(e.calendarId||""))||void 0===n?void 0:n.colors.lineColor)||t.getCalendarRegistry().resolveColors().lineColor})});r=n.customSearch({keyword:a,events:e})}else if(null==n?void 0:n.onSearch)r=yield n.onSearch(a);else{const e=a.toLowerCase();r=t.getEvents().filter(t=>t.title.toLowerCase().includes(e)||t.description&&t.description.toLowerCase().includes(e)).map(e=>{var n;return Object.assign(Object.assign({},e),{color:(null===(n=t.getCalendarRegistry().get(e.calendarId||""))||void 0===n?void 0:n.colors.lineColor)||t.getCalendarRegistry().resolveColors().lineColor})})}m(r),null===(e=null==n?void 0:n.onSearchStateChange)||void 0===e||e.call(n,{keyword:a,loading:!1,results:r})}catch(e){console.error("Search failed",e),m([])}finally{u(!1)}}),o);return g.current=a,()=>clearTimeout(i)},[a,n,t]);const v=r.useCallback((e,a="desktop")=>{const r=()=>{let n;n=e.start instanceof Date?e.start:"string"==typeof e.start?new Date(e.start):p(e.start),t.setCurrentDate(n),t.highlightEvent(e.id),s&&d(!1)},o=()=>{"mobile"===a?d(!1):l(!1)};(null==n?void 0:n.onResultClick)?n.onResultClick({event:e,app:t,source:a,defaultAction:r,closeSearch:o}):r()},[t,s,n]),y=r.useCallback(()=>{o(""),d(!0)},[]),D=r.useCallback(()=>{l(!1),o(""),t.highlightEvent(null)},[t]),w=r.useCallback(()=>{d(!1),o(""),t.highlightEvent(null)},[t]);return{searchKeyword:a,setSearchKeyword:o,isSearchOpen:i,setIsSearchOpen:l,isMobileSearchOpen:s,setIsMobileSearchOpen:d,searchLoading:c,searchResults:h,handleSearchResultClick:v,handleSearchClick:y,handleSearchClose:D,handleMobileSearchClose:w}}(t,d),D=i||(t.getUseEventDetailDialog()?na:void 0),w=function(t,n,a){const[o,i]=r.useState(null),l=r.useRef(null);r.useEffect(()=>{i(null),l.current=null},[t]);const s=r.useCallback(()=>{i(null),l.current=null,t.selectEvent(null)},[t]),d=r.useCallback(e=>t.updateEvent(e.id,e),[t]),c=r.useCallback(n=>e.__awaiter(this,void 0,void 0,function*(){yield t.deleteEvent(n),i(null),t.selectEvent(null)}),[t]),u=r.useMemo(()=>{var e;if(!n||!o)return null;const a=o.split("::")[0],r=t.getEvents().find(e=>e.id===a);r&&(l.current=r);const i=null!=r?r:(null===(e=l.current)||void 0===e?void 0:e.id)===a?l.current:null;return i?{event:i,isOpen:!0,isAllDay:g(i.start),onEventUpdate:d,onEventDelete:c,onClose:s,app:t}:null},[a,o,n,s,d,c,t]);return{detailPanelEventId:o,setDetailPanelEventId:i,dialogProps:u}}(t,D,m),b=fa(t),E=function(e,t,n){const[a,o]=r.useState(!1),i=r.useRef(null),[l,s]=r.useState(!1),[d,c]=r.useState(null),[u,h]=r.useState(!1),m=r.useCallback(()=>{h(!0)},[]),g=r.useCallback(r=>{if(!e.canMutateFromUI())return;const l=e.getCalendarRegistry().getDefaultWritableCalendar();if(l){if(t){const{start:t,end:n}=ue(e.timeZone),a={id:Ne(),title:"",start:te(t,e.timeZone),end:te(n,e.timeZone),calendarId:l.id};return c(a),void s(!0)}n?a?o(!1):(i.current=r.currentTarget,o(!0)):m()}},[t,a,e,n,m]);return{isQuickCreateOpen:a,setIsQuickCreateOpen:o,quickCreateAnchorRef:i,isMobileDrawerOpen:l,setIsMobileDrawerOpen:s,mobileDraftEvent:d,setMobileDraftEvent:c,handleAddButtonClick:g,isCreateCalendarOpen:u,setIsCreateCalendarOpen:h}}(t,v,b.enabled),[C,T]=r.useState(()=>t.getTheme());r.useEffect(()=>t.subscribeThemeChange(e=>T(e)),[t]);const S=r.useCallback(e=>t.setTheme(e),[t]);r.useEffect(()=>{const e=t.callbacks,n=e.onDismissUI,a=e.onEventDetailToggle;return e.onDismissUI=()=>{w.detailPanelEventId&&w.setDetailPanelEventId(null),E.isMobileDrawerOpen&&E.setIsMobileDrawerOpen(!1),null==n||n()},e.onEventDetailToggle=e=>{w.setDetailPanelEventId(e),null==a||a(e)},()=>{e.onDismissUI=n,e.onEventDetailToggle=a}},[t,w,E]),r.useEffect(()=>{if(!v||!w.detailPanelEventId)return;const e=w.detailPanelEventId.split("::")[0],n=t.getEvents().find(t=>t.id===e);n&&(E.setMobileDraftEvent(n),E.setIsMobileDrawerOpen(!0)),w.setDetailPanelEventId(null)},[w.detailPanelEventId,v]);const M=r.useCallback(e=>{t.setCurrentDate(e),t.selectEvent(null)},[t]),x=r.useCallback(e=>t.selectEvent(e),[t]),k=r.useRef(null),N={app:t,config:t.getCurrentView().config||{},customDetailPanelContent:o,customEventDetailDialog:D,switcherMode:t.state.switcherMode,calendarRef:k,meta:l,selectedEventId:f,onEventSelect:x,onDateChange:M,detailPanelEventId:w.detailPanelEventId,onDetailPanelToggle:w.setDetailPanelEventId},I=r.useMemo(()=>({isCollapsed:b.isCollapsed,toggleCollapsed:b.toggleCollapsed}),[b.isCollapsed,b.toggleCollapsed]),R=void 0!==u,O=R?"0px":b.miniWidth,H=R&&b.isCollapsed?u:b.safeAreaLeft,P=t.getCalendarHeaderConfig(),A=Object.assign({calendar:t,switcherMode:t.state.switcherMode,onAddCalendar:E.handleAddButtonClick,onSearchChange:y.setSearchKeyword,onSearchClick:y.handleSearchClick,searchValue:y.searchKeyword,isSearchOpen:y.isSearchOpen,isEditable:t.canMutateFromUI()},H>0?{safeAreaLeft:H}:{}),L=t.getCurrentView().component,$=t.getCustomMobileEventRenderer()||sa;return ze(wn,{initialTheme:C,onThemeChange:S,children:ze(va,{locale:t.state.locale,messages:s,children:ze("div",{className:"df-calendar-container",children:[ze(Tn,{store:h,generatorName:"titleBarSlot",generatorArgs:I,defaultContent:c&&("function"==typeof c?c(I):c)}),b.enabled&&ze("aside",{className:"df-calendar-sidebar-aside",style:{width:b.width},children:b.content}),ze("div",{className:"df-calendar-shell","data-sidebar-collapsed":b.isCollapsed,style:{marginLeft:b.enabled?`calc(${b.isCollapsed?O:b.width} - 1px)`:0},children:[!1===P?null:ze(Tn,{store:h,generatorName:"calendarHeader",generatorArgs:A,defaultContent:n.h(yn,A)}),ze("div",{className:"df-calendar-content-wrap",ref:k,children:[ze("div",{className:"df-calendar-renderer",children:[ze("div",{className:"df-calendar-view-container",children:ze(L,Object.assign({},N))}),ze(ha,{isOpen:y.isSearchOpen,onClose:y.handleSearchClose,loading:y.searchLoading,results:y.searchResults,keyword:y.searchKeyword,onResultClick:e=>y.handleSearchResultClick(e,"desktop"),emptyText:null==d?void 0:d.emptyText})]}),ze(ua,{isOpen:y.isMobileSearchOpen,onClose:y.handleMobileSearchClose,keyword:y.searchKeyword,onSearchChange:y.setSearchKeyword,results:y.searchResults,loading:y.searchLoading,onResultClick:e=>y.handleSearchResultClick(e,"mobile"),emptyText:null==d?void 0:d.emptyText})]})]}),ze(ra,{app:t,anchorRef:E.quickCreateAnchorRef,isOpen:E.isQuickCreateOpen,onClose:()=>E.setIsQuickCreateOpen(!1)}),ze($,{isOpen:E.isMobileDrawerOpen,onClose:()=>{E.setIsMobileDrawerOpen(!1),E.setMobileDraftEvent(null)},onSave:e=>{t.getEvents().some(t=>t.id===e.id)?t.updateEvent(e.id,e):t.addEvent(e),E.setIsMobileDrawerOpen(!1),E.setMobileDraftEvent(null)},onEventDelete:e=>{t.deleteEvent(e),E.setIsMobileDrawerOpen(!1),E.setMobileDraftEvent(null)},draftEvent:E.mobileDraftEvent,app:t}),b.extraContent,E.isCreateCalendarOpen&&ze(Nn,{app:t,onClose:()=>E.setIsCreateCalendarOpen(!1),onCreate:n=>e.__awaiter(void 0,void 0,void 0,function*(){yield t.createCalendar(n),E.setIsCreateCalendarOpen(!1)})}),(()=>{if(!w.dialogProps)return null;const e=D,t="undefined"==typeof document?null:document.body;if(!t)return null;const r=null==h?void 0:h.isOverridden("eventDetailDialog");return ze(Tn,{store:h,generatorName:"eventDetailDialog",generatorArgs:w.dialogProps,defaultContent:r?null:a.createPortal(n.h(e,w.dialogProps),t)})})()]})})})};class ya{constructor(e){this.renderings=new Map,this.overrides=new Set,this.listeners=new Set,this.overrideListeners=new Set,e&&e.length>0&&(this.overrides=new Set(e))}register(e){this.renderings.set(e.id,e),this.notify()}unregister(e){this.renderings.delete(e)&&this.notify()}setOverrides(e){this.overrides=new Set(e),this.notify(),this.notifyOverrides()}isOverridden(e){return this.overrides.has(e)}subscribe(e){return this.listeners.add(e),e(this.renderings),()=>{this.listeners.delete(e)}}subscribeToOverrides(e){return this.overrideListeners.add(e),e(),()=>{this.overrideListeners.delete(e)}}notify(){this.listeners.forEach(e=>e(this.renderings))}notifyOverrides(){this.overrideListeners.forEach(e=>e())}}var Da=0;function wa(e,t,a,r,o,i){t||(t={});var l,s,d=t;if("ref"in d)for(s in d={},t)"ref"==s?l=t[s]:d[s]=t[s];var c={type:e,props:d,key:a,ref:l,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Da,__i:-1,__u:0,__source:o,__self:i};if("function"==typeof e&&(l=e.defaultProps))for(s in l)void 0===d[s]&&(d[s]=l[s]);return n.options.vnode&&n.options.vnode(c),c}const ba=({className:e,width:t=24,height:n=24})=>wa("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:e,children:wa("path",{d:"m9 18 6-6-6-6"})}),Ea=a.forwardRef(({x:e,y:t,onClose:n,children:o,className:i},l)=>{const s=r.useRef(null);r.useEffect(()=>{const e=()=>n(),t=e=>{if(s.current&&!s.current.contains(e.target)){if(e.target.closest("[data-submenu-content]"))return;n()}};window.dispatchEvent(new CustomEvent("dayflow-close-all-menus")),window.addEventListener("dayflow-close-all-menus",e),document.body.addEventListener("mousedown",t,{capture:!0}),document.body.addEventListener("contextmenu",t,{capture:!0});const a=e=>{"Escape"===e.key&&n()};window.addEventListener("keydown",a);const r=()=>n();return window.addEventListener("scroll",r,!0),window.addEventListener("resize",r),()=>{window.removeEventListener("dayflow-close-all-menus",e),document.body.removeEventListener("mousedown",t,{capture:!0}),document.body.removeEventListener("contextmenu",t,{capture:!0}),window.removeEventListener("keydown",a),window.removeEventListener("scroll",r,!0),window.removeEventListener("resize",r)}},[n]);const d={top:t,left:e};return a.createPortal(wa("div",{ref:e=>{s.current=e,"function"==typeof l?l(e):l&&"current"in l&&(l.current=e)},className:"df-portal df-context-menu df-context-menu-content"+(i?` ${i}`:""),style:d,onContextMenu:e=>e.preventDefault(),"data-context-menu-root":"true",role:"menu",children:o}),document.body)});Ea.displayName="ContextMenu";const Ca=({onClick:e,children:t,icon:n,danger:a,disabled:r})=>wa("div",{className:"df-context-menu-item",onClick:t=>{t.stopPropagation(),r||e()},"data-disabled":r,"data-danger":a,role:"menuitem",tabIndex:r?-1:0,children:[n&&wa("span",{className:"df-context-menu-item-icon",children:n}),t]}),Ta=()=>wa("div",{className:"df-context-menu-separator",role:"separator"}),Sa=({children:e})=>{const[t,a]=r.useState(!1),o=r.useRef(null);return r.useEffect(()=>()=>{o.current&&clearTimeout(o.current)},[]),wa("div",{className:"df-context-menu-sub",onMouseEnter:()=>{o.current&&(clearTimeout(o.current),o.current=null),a(!0)},onMouseLeave:()=>{o.current=setTimeout(()=>a(!1),100)},children:(Array.isArray(e)?e:[e]).map(e=>n.isValidElement(e)?n.cloneElement(e,{isOpen:t}):e)})},Ma=({children:e,icon:t,isOpen:n})=>wa("div",{className:"df-context-menu-sub-trigger","data-open":n,role:"menuitem",tabIndex:0,children:[t&&wa("span",{className:"df-context-menu-sub-icon",children:t}),wa("span",{className:"df-context-menu-sub-label",children:e}),wa(ba,{className:"df-context-menu-sub-chevron"})]}),xa=({children:e,isOpen:t})=>{const n=r.useRef(null),[a,o]=r.useState("right");return r.useEffect(()=>{var e;if(t&&n.current){const t=n.current.getBoundingClientRect(),a=null===(e=n.current.parentElement)||void 0===e?void 0:e.getBoundingClientRect();a&&o(a.right+t.width>window.innerWidth?"left":"right")}},[t]),t?wa("div",{ref:n,className:"df-portal df-context-menu df-context-menu-sub-content","data-position":a,"data-submenu-content":"true",role:"menu",children:e}):null},ka=["#ea426b","#f19a38","#f7cf46","#83d754","#51aaf2","#b672d0","#957e5e"],Na=({x:t,y:a,date:r,onClose:o,app:i,onCreateEvent:l,viewType:s})=>{const{t:d}=Tt();if(!i.canMutateFromUI())return null;const c=at.hasEvent(),u=ze(n.Fragment,{children:[ze(Ca,{onClick:()=>{l(),o()},children:d("newEvent")||"New Event"}),ze(Ca,{onClick:()=>e.__awaiter(void 0,void 0,void 0,function*(){yield((t,n,a)=>e.__awaiter(void 0,void 0,void 0,function*(){if(at.hasEvent())try{let e=at.getEvent();if(!e){const t=yield navigator.clipboard.readText();t&&(e=JSON.parse(t))}if(e&&"object"==typeof e&&"title"in e){const r=e,o=K(r.start),i=K(r.end).getTime()-o.getTime(),l=e,s=new Date(n),d=a===exports.ViewType.MONTH||a===exports.ViewType.YEAR,c=0===s.getHours()&&0===s.getMinutes(),u=0!==o.getHours()||0!==o.getMinutes();!r.allDay&&(d||c&&u)&&s.setHours(o.getHours(),o.getMinutes(),o.getSeconds(),o.getMilliseconds());const h=new Date(s.getTime()+(i>0?i:36e5)),m=Object.assign(Object.assign({},l),{title:r.title,id:Ne(),start:r.allDay?Q(s):te(s,t.timeZone),end:r.allDay?Q(h):te(h,t.timeZone),calendarId:r.calendarId&&t.getCalendarRegistry().has(r.calendarId)?r.calendarId:t.getCalendarRegistry().getDefaultCalendarId()||"default"});t.addEvent(m)}}catch(e){console.error("Failed to paste event:",e)}}))(i,r,s),o()}),disabled:!c,children:d("pasteHere")||"Paste Here"})]});return ze(Ea,{x:t,y:a,onClose:o,className:"df-context-menu",children:ze(Tn,{generatorName:"gridContextMenu",generatorArgs:{date:r,viewType:s,onClose:o},defaultContent:u})})},Ia=({event:t,x:a,y:r,onClose:o,app:i})=>{const{t:l}=Tt();if(!i.canMutateFromUI(t.id))return null;const s=i.getCalendars(),d=ze(n.Fragment,{children:[ze(Sa,{children:[ze(Ma,{children:l("calendars")||"Calendars"}),ze(xa,{children:s.map(e=>{const n=e.id===t.calendarId;return ze(Ca,{onClick:()=>{return n=e.id,i.updateEvent(t.id,{calendarId:n}),void o();var n},children:ze("div",{className:"df-context-menu-calendar-item",children:[ze("div",{className:"df-context-menu-calendar-check-wrap",children:n&&ze(Qt,{className:"df-text-primary df-context-menu-calendar-check"})}),ze("div",{className:"df-context-menu-calendar-info",children:[ze("div",{className:"df-context-menu-calendar-dot",style:{backgroundColor:e.colors.lineColor}}),ze("span",{className:"df-context-menu-calendar-label","data-selected":n,children:e.name})]})]})},e.id)})})]}),ze(Ta,{}),ze(Ca,{onClick:()=>{i.deleteEvent(t.id),o()},danger:!0,children:l("delete")||"Delete"}),ze(Ca,{onClick:()=>e.__awaiter(void 0,void 0,void 0,function*(){try{const e=JSON.stringify(t,null,2);yield navigator.clipboard.writeText(e),at.setEvent(t),i.deleteEvent(t.id)}catch(e){console.error("Failed to cut event: ",e)}o()}),children:l("cut")||"Cut"}),ze(Ca,{onClick:()=>e.__awaiter(void 0,void 0,void 0,function*(){try{const e=JSON.stringify(t,null,2);yield navigator.clipboard.writeText(e),at.setEvent(t)}catch(e){console.error("Failed to copy event: ",e)}o()}),children:l("copy")||"Copy"})]});return ze(Ea,{x:a,y:r,onClose:o,children:ze(Tn,{generatorName:"eventContextMenu",generatorArgs:{event:t,onClose:o},defaultContent:d})})},Ra=(e,t)=>{if(!e.current)return t?48:80;const n=e.current.querySelector(".df-time-column");return n?n.getBoundingClientRect().width:t?48:80},Oa=e=>{var t;const n=e.current;if(!n)return null;const a=n.matches(".df-calendar-content")?n:null,r=n.querySelector(".df-calendar-content"),o=n.closest(".df-calendar-content");return null!==(t=null!=a?a:r)&&void 0!==t?t:o},Ha=(e,t,n)=>{const a=["df-event"];return e===exports.ViewType.DAY?a.push("df-day-event"):e===exports.ViewType.WEEK?a.push("df-week-event"):e===exports.ViewType.MONTH?(a.push("df-month-event"),n||a.push("df-month-event-stacked")):e===exports.ViewType.YEAR&&a.push("df-year-event"),a.push(t?"df-event-all-day":"df-event-timed"),a.join(" ")},Pa=e=>{if(!e)return"full";switch(e.segmentType){case"start":case"start-week-end":return"start";case"end":case"end-week-start":return"end";case"middle":return"middle";default:return"full"}},Aa=e=>{if(!1===e.icon)return null;if(void 0!==e.icon&&"boolean"!=typeof e.icon)return e.icon;const t=e.title.toLowerCase();return t.includes("holiday")||t.includes("vacation")||t.includes("假期")?ze(rn,{className:Ft}):t.includes("birthday")||t.includes("anniversary")||t.includes("生日")?ze(on,{className:Ft}):t.includes("conference")||t.includes("meeting")||t.includes("会议")||t.includes("研讨")?ze(sn,{className:Ft}):t.includes("trip")||t.includes("travel")||t.includes("旅行")?ze(ln,{className:Ft}):ze(nn,{className:Ft})},La=(e,t,n=7,a)=>{const r=[],o=new Date(t);return o.setDate(t.getDate()+(n-1)),o.setHours(23,59,59,999),e.forEach(e=>{const i=X(e.start,a),l=e.end?X(e.end,a):i,s=new Date(i);s.setHours(0,0,0,0);const d=new Date(l);d.setHours(0,0,0,0);let c=new Date(d);if(!e.allDay){if(!(0!==l.getHours()||0!==l.getMinutes()||0!==l.getSeconds())){const e=l.getTime()-i.getTime();e>0&&e<864e5&&(c=new Date(d),c.setDate(c.getDate()-1))}}const u=E(s,c)>0;if(!u&&e.allDay){if(s<t||s>o)return;const a=Math.floor((s.getTime()-t.getTime())/864e5);return void(a>=0&&a<=n-1&&r.push({id:`${e.id}-week-${t.getTime()}`,originalEventId:e.id,event:e,startDayIndex:a,endDayIndex:a,segmentType:"single",totalDays:1,segmentIndex:0,isFirstSegment:!0,isLastSegment:!0}))}if(!u)return;const h=s;let m;if(e.allDay)m=new Date(d),m.setHours(23,59,59,999);else{0!==l.getHours()||0!==l.getMinutes()||0!==l.getSeconds()?(m=new Date(d),m.setHours(23,59,59,999)):(m=new Date(d),m.setTime(m.getTime()-1))}if(m<t||h>o)return;const g=h<t?t:h,f=m>o?o:m,v=Math.max(0,Math.floor((g.getTime()-t.getTime())/864e5)),p=Math.min(n-1,Math.floor((f.getTime()-t.getTime())/864e5)),y=h>=t,D=m<=o,w=0===v||p===n-1;let b;b=y&&D?"single":y?w&&p===n-1?"start-week-end":"start":D?w&&0===v?"end-week-start":"end":"middle";const C=E(h,m)+1;r.push({id:`${e.id}-week-${t.getTime()}`,originalEventId:e.id,event:e,startDayIndex:v,endDayIndex:p,segmentType:b,totalDays:C,segmentIndex:0,isFirstSegment:y,isLastSegment:D})}),r},$a=(e,t,n=7,a)=>{if(e.allDay)return[];const r=X(e.start,a),o=e.end?X(e.end,a):r,i=new Date(r);i.setHours(0,0,0,0);const l=new Date(o);l.setHours(0,0,0,0);const s=E(i,l);if(0===s)return[];const d=0!==o.getHours()||0!==o.getMinutes()||0!==o.getSeconds()||0!==o.getMilliseconds(),c=o.getTime()-r.getTime();if(!e.allDay&&1===s&&!d&&c<864e5)return[];const u=d?s:Math.max(0,s-1),h=[];for(let e=0;e<=u;e++){const a=new Date(i);a.setDate(i.getDate()+e);const l=Math.floor((a.getTime()-t.getTime())/864e5);if(l<0||l>n-1)continue;const s=0===e,c=e===u,m=s?r.getHours()+r.getMinutes()/60:0,g=c&&d?o.getHours()+o.getMinutes()/60:24;h.push({dayIndex:l,startHour:m,endHour:g,isFirst:s,isLast:c})}return h},Fa={whiteSpace:"nowrap",textOverflow:"clip",WebkitMaskImage:"linear-gradient(to right, black 70%, transparent 100%)",maskImage:"linear-gradient(to right, black 70%, transparent 100%)",WebkitMaskRepeat:"no-repeat",maskRepeat:"no-repeat"},Ya=a.memo(({segment:e,segmentIndex:t,isDragging:a,isResizing:o=!1,isSelected:i=!1,onMoveStart:l,onResizeStart:s,onEventLongPress:d,isMobile:c=!1,isDraggable:u=!0,isEditable:h=!0,viewable:m=!0,isPopping:g,renderSlot:f,appTimeZone:v})=>{const[p,y]=r.useState(!1),D=r.useMemo(()=>{if(!v||e.event.allDay)return e.event;const t=J(e.event.start,v),n=e.event.end?J(e.event.end,v):void 0;return Object.assign(Object.assign({},e.event),{start:t,end:n})},[e.event,v]),w=17*t,b=`calc(${e.startDayIndex/7*100}% + 2px)`,E=`calc(${(e.endDayIndex-e.startDayIndex+1)/7*100}% - 4px)`,T=r.useRef(null),S=r.useRef(null),M=t=>{const n="left"===t;return(n?e.isFirstSegment:e.isLastSegment)&&s&&h?ze("div",{className:n?Yt:jt,onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),s(t,e.event,n?"left":"right")},onClick:e=>{e.preventDefault(),e.stopPropagation()}}):null},x=$(e.event),k=!!e.event.calendarIds&&e.event.calendarIds.length>1,N=k?V(e.event):null,I=i||a||p,R=()=>{const t=D.allDay,n=$(D),a=C(D.start),r=oe(D),o=re(a),i=re(r),l=F(e.event),s=I&&k;if(t){const t=()=>e.isFirstSegment?D.title:"middle"===e.segmentType||e.isLastSegment&&e.totalDays>1?"···":D.title;return ze("div",{className:"df-month-segment-event-all-day",children:[e.isFirstSegment&&Aa(D)&&ze("div",{className:"df-event-icon-slot",children:ze("div",{className:"df-event-year-icon-badge",style:{backgroundColor:L(n)},children:Aa(D)})}),ze("div",{className:"df-month-segment-event-all-day-main",children:ze("div",{className:"df-month-segment-event-all-day-title "+(c?"df-mobile-mask-fade":""),style:c?Fa:void 0,children:t()})}),e.isLastSegment&&"single"!==e.segmentType&&ze("div",{className:"df-month-segment-event-tail",children:ze("div",{className:"df-month-segment-event-tail-dot"})})]})}const d=e.isFirstSegment||e.isLastSegment?D.title:"···",u=e.endDayIndex-e.startDayIndex+1,h=u>1?{right:`calc(${u>1?(u-1)/u*100:0}% + 2px)`,top:"50%",transform:"translateY(-50%)"}:void 0;return ze("div",{className:"df-event-month-main",children:[!s&&ze("div",{className:$t,style:l.length>1?{background:Y(l)}:{backgroundColor:l[0]}}),ze("div",{className:"df-event-month-main",children:ze("span",{className:"df-event-month-title "+(c?"df-mobile-mask-fade":""),style:c?Fa:void 0,children:d})}),e.isFirstSegment&&!c&&ze("span",{className:"df-month-segment-event-time "+(1===u?"df-month-segment-event-time-spaced":"df-month-segment-event-time-overlay"),style:h,children:o}),e.isLastSegment&&!D.allDay&&24!==r&&!c&&ze("span",{className:"df-month-segment-event-tail-time",children:`ends ${i}`})]})},O=e.endDayIndex-e.startDayIndex+1;return ze("div",{className:"df-month-segment-event",style:Object.assign(Object.assign({left:b,width:E,top:`${w}px`,height:"16px",pointerEvents:"auto",zIndex:10,transform:g?"scale(1.02)":"scale(1)",transition:"transform 0.5s cubic-bezier(0.22, 1, 0.36, 1)",willChange:"transform"},I?{backgroundColor:A(x),color:"#fff"}:k?{background:_(N),color:P(x)}:{backgroundColor:H(x),color:P(x)}),{cursor:u||m?"pointer":"default"}),"data-all-day":String(!!D.allDay),"data-selected":String(i),"data-dragging":String(a),"data-resizing":String(o),"data-popping":String(!!g),"data-segment-shape":Pa(e),"data-segment-days":O,onMouseDown:t=>{if(!u&&!m)return;t.preventDefault(),t.stopPropagation(),y(!0);!t.target.closest(".df-resize-handle")&&u&&(null==l||l(t,e.event))},onMouseUp:()=>{y(!1)},onMouseLeave:()=>{y(!1)},onTouchStart:t=>{if(!l||!c||!u&&!m)return;t.stopPropagation(),y(!0);const n=t.touches[0],a=n.clientX,r=n.clientY,o=t.currentTarget;S.current={x:a,y:r},T.current=setTimeout(()=>{d&&d(e.event.id);u&&l({preventDefault:()=>{},stopPropagation:()=>{},currentTarget:o,touches:[{clientX:a,clientY:r}],cancelable:!1},e.event),T.current=null,navigator.vibrate&&navigator.vibrate(50)},500)},onTouchMove:e=>{if(T.current&&S.current){const t=Math.abs(e.touches[0].clientX-S.current.x),n=Math.abs(e.touches[0].clientY-S.current.y);(t>10||n>10)&&(clearTimeout(T.current),T.current=null,S.current=null,y(!1))}},onTouchEnd:()=>{y(!1),T.current&&(clearTimeout(T.current),T.current=null),S.current=null},title:`${D.title} (${We(D.start)} - ${We(D.end)})`,children:[c&&i&&h&&ze(n.Fragment,{children:[e.isFirstSegment&&ze("div",{className:"df-event-touch-resize-indicator","data-axis":"horizontal","data-position":"left",style:{borderColor:L(x)},onTouchStart:t=>{t.stopPropagation(),null==s||s(t,e.event,"left")}}),e.isLastSegment&&ze("div",{className:"df-event-touch-resize-indicator","data-axis":"horizontal","data-position":"right",style:{borderColor:L(x)},onTouchStart:t=>{t.stopPropagation(),null==s||s(t,e.event,"right")}})]}),M("left"),ze("div",{className:"df-month-segment-event-body",style:{cursor:o?"ew-resize":"pointer"},children:f?f(R()):R()}),M("right")]})});Ya.displayName="MultiDayEvent";const ja=({event:e,isEditable:t,onResizeStart:a,isMultiDay:r,segment:o,isSlidingView:i,renderSlot:l})=>{const s=!1!==e.icon,d="boolean"==typeof e.icon?null:e.icon,c=(()=>{if(!i||!r||!o)return{};if(o.startDayIndex<2&&o.endDayIndex>=2){return{paddingLeft:`calc(${(2-o.startDayIndex)/(o.endDayIndex-o.startDayIndex+1)*100}% + 0.75rem)`}}return{}})(),u=ze("div",{className:"df-event-content-row",children:[s&&(d?ze("div",{className:"df-event-icon-slot",children:d}):ze("span",{className:"df-event-icon-slot",children:ze(nn,{className:Ft})})),ze("div",{className:`${Lt} df-event-title-tight`,children:e.title})]});return ze("div",{className:"df-event-all-day-shell",style:c,children:[l?l(u):u,a&&t&&ze(n.Fragment,{children:[ze("div",{className:Yt,onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),a(t,e,"left")},onClick:e=>{e.preventDefault(),e.stopPropagation()}}),ze("div",{className:jt,onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),a(t,e,"right")},onClick:e=>{e.preventDefault(),e.stopPropagation()}})]})]})},Va={overflow:"hidden",whiteSpace:"nowrap",textOverflow:"clip",WebkitMaskImage:"linear-gradient(to right, black 70%, transparent 100%)",maskImage:"linear-gradient(to right, black 70%, transparent 100%)",WebkitMaskRepeat:"no-repeat",maskRepeat:"no-repeat"},_a=({event:e,isEventSelected:t,isMobile:n})=>{const a=!1!==e.icon,r="boolean"==typeof e.icon?null:e.icon;return ze("div",{className:"df-event-month-all-day",children:[a&&(r?ze("div",{className:"df-event-icon-slot",children:r}):e.title.toLowerCase().includes("easter")||e.title.toLowerCase().includes("holiday")?ze("span",{className:"df-event-holiday-icon",children:"⭐"}):ze("span",{className:"df-event-icon-slot",children:ze(nn,{className:Ft})})),ze("span",{className:"df-event-month-title "+(n?"df-mobile-mask-fade":""),style:n?Va:void 0,children:e.title})]})},Za={overflow:"hidden",whiteSpace:"nowrap",textOverflow:"clip",WebkitMaskImage:"linear-gradient(to right, black 70%, transparent 100%)",maskImage:"linear-gradient(to right, black 70%, transparent 100%)",WebkitMaskRepeat:"no-repeat",maskRepeat:"no-repeat"},za=({event:e,app:t,isEventSelected:n,hideTime:a,isMobile:r})=>{const o=`${Math.floor(C(e.start)).toString().padStart(2,"0")}:${Math.round(C(e.start)%1*60).toString().padStart(2,"0")}`,i=F(e,null==t?void 0:t.getCalendarRegistry()),l=Y(i),s=i.length>1?{background:l}:{backgroundColor:l},d=n&&i.length>1;return ze("div",{className:"df-event-month-regular","data-mobile":String(!!r),children:[ze("div",{className:"df-event-month-main",children:[!d&&ze("div",{style:s,className:$t}),ze("span",{className:"df-event-month-title "+(r?"df-mobile-mask-fade":""),style:r?Za:void 0,children:e.title})]}),!a&&!r&&ze("span",{className:"df-event-month-time",children:o})]})},Wa=({event:e,app:t,multiDaySegmentInfo:a,isEditable:r,isTouchEnabled:o,isEventSelected:i,onResizeStart:l,timeFormat:s="24h",resizeHandleOrientation:d="vertical",renderSlot:c})=>{const u=a?a.startHour:C(e.start),h=a?a.endHour:oe(e),m=h-u,g=!a||a.isFirst,f=!a||a.isLast,v=$(e),p=!a&&m<=.25?"compact":"default",y=F(e,null==t?void 0:t.getCalendarRegistry()),D=j(y),w=i&&y.length>1?null:y.length>1?ze("div",{className:"df-event-color-bar-overlay",style:{background:D,clipPath:"inset(0.25rem calc(100% - 0.25rem - 3px) 0.25rem 0.25rem round 9999px)"}}):ze("div",{className:"df-event-color-bar",style:{backgroundColor:D}}),b=ze(n.Fragment,{children:[w,ze("div",{className:"df-event-timed-content","data-density":p,children:[ze("div",{className:`${Lt} ${m<=.25?"df-event-title-tight":""}`,children:e.title}),m>.5&&ze("div",{className:"df-event-time",children:a?`${re(u,0,s)} - ${re(h,0,s)}`:ie(e,s)})]})]});return ze(n.Fragment,{children:[c?c(b):b,l&&r&&"vertical"===d&&ze(n.Fragment,{children:[g&&ze("div",{className:"df-event-resize-handle df-event-resize-handle-top",onMouseDown:t=>l(t,e,"top")}),f&&ze("div",{className:"df-event-resize-handle df-event-resize-handle-bottom",onMouseDown:t=>l(t,e,"bottom")}),!g&&f&&a&&ze("div",{className:jt,onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),l(t,e,"right")},onClick:e=>{e.preventDefault(),e.stopPropagation()}})]}),o&&i&&l&&r&&"vertical"===d&&ze(n.Fragment,{children:[ze("div",{className:"df-event-touch-resize-indicator","data-axis":"vertical","data-position":"top",style:{borderColor:L(v,null==t?void 0:t.getCalendarRegistry())},onTouchStart:t=>{t.stopPropagation(),l(t,e,"top")}}),ze("div",{className:"df-event-touch-resize-indicator","data-axis":"vertical","data-position":"bottom",style:{borderColor:L(v,null==t?void 0:t.getCalendarRegistry())},onTouchStart:t=>{t.stopPropagation(),l(t,e,"bottom")}})]}),l&&r&&"horizontal"===d&&ze(n.Fragment,{children:[ze("div",{className:Yt,onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),l(t,e,"left")},onClick:e=>{e.preventDefault(),e.stopPropagation()}}),ze("div",{className:jt,onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),l(t,e,"right")},onClick:e=>{e.preventDefault(),e.stopPropagation()}})]})]})},Ua=({event:e,segment:t,isEditable:a,onMoveStart:r,onResizeStart:o,renderSlot:i})=>{const l=!!e.allDay,s=$(e),d=F(e),c=Y(d),u=d.length>1?{background:c}:{backgroundColor:c},{isFirstSegment:h,isLastSegment:m}=t,g=t=>{const n="left"===t,r=n?h:m;return e.allDay&&r&&o&&a?ze("div",{className:n?Yt:jt,onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),o(t,e,n?"left":"right")},onTouchStart:t=>{t.stopPropagation(),o(t,e,n?"left":"right")},onClick:e=>{e.preventDefault(),e.stopPropagation()}}):null},f=()=>{if(l){const n=()=>t.isFirstSegment?e.title:"···";return ze("div",{className:"df-event-year-content",onMouseDown:t=>{r&&(t.stopPropagation(),r(t,e))},children:[t.isFirstSegment&&Aa(e)&&ze("div",{className:"df-event-icon-slot",children:ze("div",{className:"df-event-year-icon-badge",style:{backgroundColor:L(s)},children:Aa(e)})}),ze("div",{className:"df-event-year-main",children:ze("div",{className:"df-event-year-title df-event-year-title-fade",children:n()})}),t.isLastSegment&&!t.isFirstSegment&&ze("div",{className:"df-event-year-tail",children:ze("div",{className:"df-event-year-tail-dot"})})]})}const n=t.isFirstSegment?e.title:"";return ze("div",{className:"df-event-year-content df-event-year-content-timed",onMouseDown:t=>{r&&(t.stopPropagation(),r(t,e))},children:[!l&&ze("span",{style:u,className:"df-event-year-indicator"}),ze("span",{className:"df-event-year-title df-event-year-title-strong df-event-year-title-fade",children:n}),t.isLastSegment&&!t.isFirstSegment&&ze("div",{className:"df-event-year-tail",children:ze("div",{className:"df-event-year-tail-dot"})})]})};return ze(n.Fragment,{children:[g("left"),i?i(f()):f(),g("right")]})};const Ba=({event:e,viewType:t,isAllDay:n,isMultiDay:a,segment:r,yearSegment:o,segmentIndex:i,isBeingDragged:l,isBeingResized:s,isEventSelected:d,isPopping:c,isEditable:u,isDraggable:h,canOpenDetail:m,isTouchEnabled:g,hideTime:f,isMobile:v,isSlidingView:p,app:y,onMoveStart:D,onResizeStart:w,multiDaySegmentInfo:b,customRenderingStore:E,eventContentSlotArgs:C,timeFormat:T="24h",appTimeZone:S,renderVisualContent:M,resizeHandleOrientation:x})=>{const k=t===exports.ViewType.MONTH,N=t===exports.ViewType.YEAR,I=function(e,t,n){const a=t.charAt(0).toUpperCase()+t.slice(1),r=n?`eventContentAllDay${a}`:`eventContent${a}`;return(null==e?void 0:e.isOverridden(r))?r:null}(E,t,n),R=e=>M?M(e):e;if(k&&a&&r)return ze(Ya,{segment:r,segmentIndex:null!=i?i:0,isDragging:l||d,isResizing:s,isSelected:d,onMoveStart:D,onResizeStart:w,isMobile:v,isDraggable:h,isEditable:u,viewable:m,isPopping:c,appTimeZone:S,renderSlot:e=>ze(Tn,{store:E,generatorName:I,generatorArgs:C,defaultContent:R(e)})});if(N&&o)return ze(Ua,{event:e,segment:o,isEditable:u,onMoveStart:D,onResizeStart:w,renderSlot:e=>ze(Tn,{store:E,generatorName:I,generatorArgs:C,defaultContent:R(e)})});if(k){const t=n?ze(_a,{event:e,isEventSelected:d,isMobile:v}):ze(za,{event:e,app:y,isEventSelected:d,hideTime:f,isMobile:v});return ze(Tn,{store:E,generatorName:I,generatorArgs:C,defaultContent:R(t)})}const O=e=>ze(Tn,{store:E,generatorName:I,generatorArgs:C,defaultContent:R(e)});return n?ze(ja,{event:e,isEditable:u,onResizeStart:w,isMultiDay:a,segment:r,isSlidingView:p,renderSlot:O}):ze(Wa,{event:e,app:y,multiDaySegmentInfo:b,isEditable:u,isTouchEnabled:g,isEventSelected:d,onResizeStart:w,timeFormat:T,resizeHandleOrientation:x,renderSlot:O})},qa=({event:n,position:o,panelRef:i,isAllDay:l,eventVisibility:s,calendarRef:d,selectedEventElementRef:c,onEventUpdate:u,onEventDelete:h,onClose:m,app:f})=>{var v,p;const{effectiveTheme:y}=bn(),D=qe(y),{t:w}=Tt(),[b,E]=r.useState(n),[C,T]=r.useState(!1),S=r.useRef(n),M=r.useRef(n),x=r.useRef(!1),k=r.useCallback(()=>{if(x.current)return;const e=S.current,t=M.current;if(xe(e,t))return;const n=me(e,t,null==f?void 0:f.timeZone);S.current=n,M.current=n;const a=u(n);a&&Promise.resolve(a).catch(e=>{Z.error("Failed to commit deferred event detail panel update",e)})},[null==f?void 0:f.timeZone,u]),N=r.useCallback(e=>{if(!xe(M.current,e)&&(M.current=e,E(e),f)){const t=f.updateEvent(e.id,e,!0);t&&Promise.resolve(t).catch(e=>{Z.error("Failed to apply pending event detail panel update",e)})}},[f]);r.useEffect(()=>{if(!(S.current.id===n.id))return k(),x.current=!1,S.current=n,M.current=n,void E(n);xe(S.current,M.current)&&(S.current=n,M.current=n,E(n))},[n,k]),r.useEffect(()=>()=>{k()},[k]);const I=r.useMemo(()=>{var e;return null!==(e=null==f?void 0:f.timeZone)&&void 0!==e?e:t.Temporal.Now.timeZoneId()},[f]),O=r.useMemo(()=>(f?f.getCalendarRegistry():R()).getVisible().map(e=>({label:e.name,value:e.id})),[f,null==f?void 0:f.getCalendars()]),H="dark"===D||"undefined"!=typeof document&&document.documentElement.classList.contains("dark"),P=null!==(v=null==f?void 0:f.canMutateFromUI(n.id))&&void 0!==v&&v,A=null==f?void 0:f.getReadOnlyConfig(n.id),L=!1!==(null==A?void 0:A.viewable),$=!!b.allDay,F=!r.useMemo(()=>{if(!n.calendarId)return!1;const e=null==f?void 0:f.getCalendarRegistry().get(n.calendarId);return!!(null==e?void 0:e.subscription)},[f,n.calendarId])||""!==(b.description||"").trim();if(!L)return null;const Y=H?"#1f2937":"white",j=H?"rgb(55, 65, 81)":"rgb(229, 231, 235)",V=(()=>{let e={};if("sticky-top"===s){const t=Oa(d);if(t){const n=t.getBoundingClientRect().top+3-o.top;e=Object.assign({position:"absolute",width:"12px",height:"12px",backgroundColor:Y,transform:"rotate(45deg)",transformOrigin:"center",top:n-6+"px",borderRight:""+(o.isSunday?`1px solid ${j}`:"none"),borderTop:""+(o.isSunday?`1px solid ${j}`:"none"),borderLeft:""+(o.isSunday?"none":`1px solid ${j}`),borderBottom:""+(o.isSunday?"none":`1px solid ${j}`)},o.isSunday?{right:"-6px"}:{left:"-6px"})}}else if("sticky-bottom"===s){const t=i.current;let n=200;if(t){const e=t.getBoundingClientRect(),a=window.getComputedStyle(t),r=Number.parseInt(a.paddingBottom,10)||0,o=Number.parseInt(a.borderBottomWidth,10)||0;n=e.height-r-o-6+11}e={position:"absolute",width:"12px",height:"12px",backgroundColor:Y,transform:"rotate(45deg)",transformOrigin:"center",top:`${n}px`,left:o.isSunday?void 0:"-6px",right:o.isSunday?"-6px":void 0,borderRight:""+(o.isSunday?`1px solid ${j}`:"none"),borderTop:""+(o.isSunday?`1px solid ${j}`:"none"),borderLeft:""+(o.isSunday?"none":`1px solid ${j}`),borderBottom:""+(o.isSunday?"none":`1px solid ${j}`)}}else if(o&&c.current&&d.current){const t=c.current.getBoundingClientRect(),n=Oa(d);if(n){const a=n.getBoundingClientRect(),r=Math.max(t.top,a.top),l=Math.min(t.bottom,a.bottom),s=Math.max(0,l-r);let d;d=s===t.height?t.top+t.height/2:s>0?r+s/2:t.top+t.height/2;const c=d-o.top,u=i.current;let h=228;if(u){const e=u.getBoundingClientRect(),t=window.getComputedStyle(u),n=Number.parseInt(t.paddingBottom,10)||0,a=Number.parseInt(t.borderBottomWidth,10)||0;h=e.height-n-a+11}const m=12,g=Math.max(m,Math.min(h,c));e=Object.assign({position:"absolute",width:"12px",height:"12px",backgroundColor:Y,transform:"rotate(45deg)",transformOrigin:"center",top:g-6+"px",borderRight:""+(o.isSunday?`1px solid ${j}`:"none"),borderTop:""+(o.isSunday?`1px solid ${j}`:"none"),borderLeft:""+(o.isSunday?"none":`1px solid ${j}`),borderBottom:""+(o.isSunday?"none":`1px solid ${j}`)},o.isSunday?{right:"-6px"}:{left:"-6px"})}}return e})(),_=ze("div",{ref:i,className:`${_t} df-event-panel-content`,"data-event-detail-panel":"true","data-event-id":n.id,style:{top:`${o.top}px`,left:`${o.left}px`,zIndex:9999,pointerEvents:"auto"},children:[ze("div",{style:V}),ze("span",{className:"df-form-label",children:w("eventTitle")}),ze("div",{className:"df-form-row",style:{marginBottom:"0.75rem"},children:[ze("div",{className:"df-form-field",children:ze("input",{id:`event-title-${b.id}`,name:"title",type:"text",value:b.title,readOnly:!P||C,disabled:!P||C,onChange:e=>N(Object.assign(Object.assign({},b),{title:e.target.value})),onInput:e=>N(Object.assign(Object.assign({},b),{title:e.target.value})),className:"df-form-input"})}),P&&ze(ta,{options:O,value:b.calendarId||"blue",disabled:C,onChange:e=>{N(Object.assign(Object.assign({},b),{calendarId:e}))},registry:null==f?void 0:f.getCalendarRegistry()})]}),ze("div",$?{className:"df-event-dialog-time-row",style:{marginBottom:"0.75rem"},children:[ze("div",{className:"df-form-label",children:w("dateRange")}),ze(ea,{value:[b.start,b.end],format:"YYYY-MM-DD",showTime:!1,timeZone:I,matchTriggerWidth:!0,disabled:!P||C,onChange:e=>{if(C)return;const[t,n]=e;N(Object.assign(Object.assign({},b),{start:t.toPlainDate(),end:n.toPlainDate()}))},locale:null==f?void 0:f.state.locale})]}:{className:"df-event-dialog-time-row",style:{marginBottom:"0.75rem"},children:[ze("div",{className:"df-form-label",children:w("timeRange")}),ze(ea,{value:[b.start,b.end],timeZone:I,disabled:!P||C,onChange:e=>{if(C)return;const[t,n]=e;N(Object.assign(Object.assign({},b),{start:t,end:n}))},locale:null==f?void 0:f.state.locale})]}),F&&ze("div",{className:"df-event-dialog-notes-row",style:{marginBottom:"0.75rem"},children:[ze("span",{className:"df-form-label",children:w("note")}),ze("textarea",{id:`event-note-${b.id}`,name:"note",value:null!==(p=b.description)&&void 0!==p?p:"",readOnly:!P||C,disabled:!P||C,onChange:e=>N(Object.assign(Object.assign({},b),{description:e.target.value})),onInput:e=>N(Object.assign(Object.assign({},b),{description:e.target.value})),rows:3,className:"df-form-textarea",placeholder:w("addNotePlaceholder")})]}),P&&ze("div",{className:"df-form-actions",children:[ze(xn,$?{type:"button",className:"df-fill-primary df-hover-primary-solid df-btn-sm",onClick:()=>{var e;if(C)return;const n=g(b.start)?b.start:b.start.toPlainDate(),a=null!==(e=null==f?void 0:f.timeZone)&&void 0!==e?e:t.Temporal.Now.timeZoneId(),r=t.Temporal.ZonedDateTime.from({year:n.year,month:n.month,day:n.day,hour:9,minute:0,timeZone:a}),o=t.Temporal.ZonedDateTime.from({year:n.year,month:n.month,day:n.day,hour:10,minute:0,timeZone:a});N(Object.assign(Object.assign({},b),{allDay:!1,start:r,end:o}))},loading:C,children:w("setAsTimed")}:{type:"button",className:"df-fill-primary df-hover-primary-solid df-btn-sm",onClick:()=>{if(C)return;const e=g(b.start)?b.start:b.start.toPlainDate(),t=g(b.end)?b.end:b.end.toPlainDate();N(Object.assign(Object.assign({},b),{allDay:!0,start:e,end:t}))},loading:C,children:w("setAsAllDay")}),ze(xn,{type:"button",className:"df-fill-destructive df-hover-destructive df-btn-sm",onClick:()=>e.__awaiter(void 0,void 0,void 0,function*(){if(!C){x.current=!0,T(!0);try{yield h(b.id)}finally{T(!1)}}}),loading:C,children:w("delete")})]})]});if("undefined"==typeof window||"undefined"==typeof document)return null;const z=document.body;return z?a.createPortal(_,z):null},Ga=({event:e,position:t,panelRef:n,isAllDay:r,eventVisibility:o,calendarRef:i,selectedEventElementRef:l,onEventUpdate:s,onEventDelete:d,onClose:c,contentRenderer:u})=>{const{effectiveTheme:h}=bn(),m=qe(h),g="dark"===m?"#1f2937":"white",f="dark"===m?"rgb(55, 65, 81)":"rgb(229, 231, 235)",v=(()=>{let e={};if("sticky-top"===o){const n=Oa(i);if(n){const a=n.getBoundingClientRect().top+3-t.top;e=Object.assign({position:"absolute",width:"12px",height:"12px",backgroundColor:g,transform:"rotate(45deg)",transformOrigin:"center",top:a-6+"px",borderRight:""+(t.isSunday?`1px solid ${f}`:"none"),borderTop:""+(t.isSunday?`1px solid ${f}`:"none"),borderLeft:""+(t.isSunday?"none":`1px solid ${f}`),borderBottom:""+(t.isSunday?"none":`1px solid ${f}`)},t.isSunday?{right:"-6px"}:{left:"-6px"})}}else if("sticky-bottom"===o){const a=n.current;let r=200;if(a){const e=a.getBoundingClientRect(),t=window.getComputedStyle(a),n=Number.parseInt(t.paddingBottom,10)||0,o=Number.parseInt(t.borderBottomWidth,10)||0;r=e.height-n-o-6+11}e={position:"absolute",width:"12px",height:"12px",backgroundColor:g,transform:"rotate(45deg)",transformOrigin:"center",top:`${r}px`,left:t.isSunday?void 0:"-6px",right:t.isSunday?"-6px":void 0,borderRight:""+(t.isSunday?`1px solid ${f}`:"none"),borderTop:""+(t.isSunday?`1px solid ${f}`:"none"),borderLeft:""+(t.isSunday?"none":`1px solid ${f}`),borderBottom:""+(t.isSunday?"none":`1px solid ${f}`)}}else if(t&&l.current&&i.current){const a=l.current.getBoundingClientRect(),r=Oa(i);if(r){const o=r.getBoundingClientRect(),i=Math.max(a.top,o.top),l=Math.min(a.bottom,o.bottom),s=Math.max(0,l-i);let d;d=s===a.height?a.top+a.height/2:s>0?i+s/2:a.top+a.height/2;const c=d-t.top,u=n.current;let h=228;if(u){const e=u.getBoundingClientRect(),t=window.getComputedStyle(u),n=Number.parseInt(t.paddingBottom,10)||0,a=Number.parseInt(t.borderBottomWidth,10)||0;h=e.height-n-a+11}const m=12,v=Math.max(m,Math.min(h,c));e=Object.assign({position:"absolute",width:"12px",height:"12px",backgroundColor:g,transform:"rotate(45deg)",transformOrigin:"center",top:v-6+"px",borderRight:""+(t.isSunday?`1px solid ${f}`:"none"),borderTop:""+(t.isSunday?`1px solid ${f}`:"none"),borderLeft:""+(t.isSunday?"none":`1px solid ${f}`),borderBottom:""+(t.isSunday?"none":`1px solid ${f}`)},t.isSunday?{right:"-6px"}:{left:"-6px"})}}return e})(),p=ze("div",{ref:n,className:`${_t} df-event-panel-content`,"data-event-detail-panel":"true","data-event-id":e.id,style:{top:`${t.top}px`,left:`${t.left}px`,zIndex:9999,pointerEvents:"auto",backgroundColor:"dark"===m?"#1f2937":"#ffffff"},children:[ze("div",{style:v}),ze(u,{event:e,isAllDay:r,onEventUpdate:s,onEventDelete:d,onClose:c})]});return a.createPortal(p,document.body)},Ka=({showDetailPanel:e,customEventDetailDialog:t,detailPanelPosition:n,event:a,detailPanelRef:r,isAllDay:o,eventVisibility:i,calendarRef:l,selectedEventElementRef:s,onEventUpdate:d,onEventDelete:c,handlePanelClose:u,customRenderingStore:h,contentSlotRenderer:m,customDetailPanelContent:g,app:f})=>{if(!e)return null;if(t)return null;if(!n)return null;const v={event:a,position:n,panelRef:r,isAllDay:o,eventVisibility:i,calendarRef:l,selectedEventElementRef:s,onEventUpdate:d,onEventDelete:c,onClose:u};return(null==h?void 0:h.isOverridden("eventDetailContent"))?ze(Ga,Object.assign({},v,{contentRenderer:m})):g?ze(Ga,Object.assign({},v,{contentRenderer:g})):ze(qa,Object.assign({},v,{app:f}))},Xa="transform 0.5s cubic-bezier(0.22, 1, 0.36, 1)",Ja=({event:e,layout:t,isAllDay:a=!1,allDayHeight:o=28,calendarRef:i,isBeingDragged:l=!1,isBeingResized:s=!1,viewType:d,isMultiDay:c=!1,segment:u,yearSegment:h,columnsPerRow:m,segmentIndex:g=0,hourHeight:f,firstHour:v,selectedEventId:p,detailPanelEventId:y,onMoveStart:D,onResizeStart:w,onEventUpdate:b,onEventDelete:E,newlyCreatedEventId:T,onDetailPanelOpen:S,onEventSelect:M,onEventLongPress:x,onDetailPanelToggle:k,customDetailPanelContent:N,customEventDetailDialog:I,multiDaySegmentInfo:R,app:O,isMobile:L=!1,isSlidingView:F=!1,enableTouch:Y,hideTime:j,timeFormat:z="24h",styleOverride:W,className:U,disableDefaultStyle:B=!1,renderVisualContent:q,resizeHandleOrientation:G,appTimeZone:K})=>{var X;const Q=r.useContext(En),ee=null!=Y?Y:L,te=d===exports.ViewType.YEAR,ne=r.useMemo(()=>{if(!K||e.allDay)return e;const t=J(e.start,K),n=e.end?J(e.end,K):void 0;return Object.assign(Object.assign({},e),{start:t,end:n})},[e,K]),[ae,re]=r.useState(null),[ie,le]=r.useState(!1),se=r.useRef(null),de=r.useRef(null),ce=r.useRef(null),ue=r.useRef(null),he=c&&u?`${e.id}::${u.id}`:void 0===(null==R?void 0:R.dayIndex)?te&&h?h.id:e.id:`${e.id}::day-${R.dayIndex}`,me=y===he,ge=me&&!I,fe=null==O?void 0:O.getReadOnlyConfig(e.id),ve=null!==(X=null==O?void 0:O.canMutateFromUI(e.id))&&void 0!==X&&X,pe=!1!==(null==fe?void 0:fe.viewable),ye=!1!==(null==fe?void 0:fe.draggable),{isSelected:De,setIsSelected:we,isPressed:be,setIsPressed:Ee,handleTouchStart:Ce,handleTouchMove:Te,handleTouchEnd:Se,shouldSuppressClick:Me}=(({event:e,isTouchEnabled:t,onMoveStart:n,onEventLongPress:a,onEventSelect:o,onDetailPanelToggle:i,canOpenDetail:l,app:s,multiDaySegmentInfo:d,isMultiDay:c,segment:u})=>{const[h,m]=r.useState(!1),[g,f]=r.useState(!1),v=r.useRef(null),p=r.useRef(null),y=r.useRef(0);return{isSelected:h,setIsSelected:m,isPressed:g,setIsPressed:f,handleTouchStart:r=>{if(!n||!t)return;r.stopPropagation(),f(!0);const o=r.touches[0],i=o.clientX,l=o.clientY,s=r.currentTarget;p.current={x:i,y:l},v.current=setTimeout(()=>{var t;a?a(e.id):m(!0);const r={preventDefault:()=>{},stopPropagation:()=>{},currentTarget:s,touches:[{clientX:i,clientY:l}],cancelable:!1};if(d){const a=Object.assign(Object.assign({},e),{day:null!==(t=d.dayIndex)&&void 0!==t?t:e.day,_segmentInfo:d});n(r,a)}else if(c&&u){const t=Object.assign(Object.assign({},e),{day:u.startDayIndex,_segmentInfo:{dayIndex:u.startDayIndex,isFirst:u.isFirstSegment,isLast:u.isLastSegment}});n(r,t)}else n(r,e);v.current=null,p.current=null,navigator.vibrate&&navigator.vibrate(50),y.current=Date.now()+400},500)},handleTouchMove:e=>{if(t&&e.stopPropagation(),v.current&&p.current){const t=Math.abs(e.touches[0].clientX-p.current.x),n=Math.abs(e.touches[0].clientY-p.current.y);(t>10||n>10)&&(clearTimeout(v.current),v.current=null,p.current=null,f(!1))}},handleTouchEnd:n=>{f(!1),v.current&&(clearTimeout(v.current),v.current=null),t&&p.current&&(n.preventDefault(),n.stopPropagation(),y.current=Date.now()+400,s&&s.onEventClick(e),l?(o?o(e.id):m(!0),null==i||i(null)):(null==o||o(null),null==i||i(null))),p.current=null},shouldSuppressClick:()=>Date.now()<y.current}})({event:e,isTouchEnabled:ee,onMoveStart:ye?D:void 0,onEventLongPress:x,onEventSelect:M,onDetailPanelToggle:k,canOpenDetail:pe,app:O,multiDaySegmentInfo:R,isMultiDay:c,segment:u}),[xe,ke]=r.useState("standard"),Ne=e=>{ue.current=e},Ie=r.useCallback(()=>((e,t,n,a,r,o)=>{var i;if(null!==a)return a;if(t===n){const e=n.split("::").at(-1);if(e&&e.startsWith("day-")){const t=Number(e.replace("day-",""));if(!Number.isNaN(t))return t}}return void 0!==(null==r?void 0:r.dayIndex)?r.dayIndex:o?o.startDayIndex:null!==(i=e.day)&&void 0!==i?i:0})(e,y||void 0,he,ue.current,R,u),[e,y,he,R,u]),Re=r.useCallback(e=>((e,t,n,a)=>{if(!t.current)return null;const r=t.current.getBoundingClientRect();if(n===exports.ViewType.MONTH){const t=r.width/7,n=e-r.left,a=Math.floor(n/t);return Number.isFinite(a)?Math.max(0,Math.min(6,a)):null}const o=Ra(t,a),i=n===exports.ViewType.DAY?1:7,l=(r.width-o)/i,s=e-r.left-o,d=Math.floor(s/l);return Number.isFinite(d)?Math.max(0,Math.min(i-1,d)):null})(e,i,d,L),[i,d,L]),Oe=r.useCallback(e=>((e,t,n,a)=>{if(!t.current)return null;const r=t.current.getBoundingClientRect();if(n===exports.ViewType.MONTH){const t=r.width/7;return{left:r.left+e*t,width:t}}const o=Ra(t,a);if(n===exports.ViewType.DAY){const e=r.width-o;return{left:r.left+o,width:e}}const i=(r.width-o)/7;return{left:r.left+o+e*i,width:i}})(e,i,d,L),[i,d,L]),{detailPanelPosition:He,setDetailPanelPosition:Pe,updatePanelPosition:Ae}=(({event:e,viewType:t,isMultiDay:n,segment:a,yearSegment:o,multiDaySegmentInfo:i,calendarRef:l,eventRef:s,detailPanelRef:d,selectedEventElementRef:c,isMobile:u,eventVisibility:h,firstHour:m,hourHeight:g,columnsPerRow:f,showDetailPanel:v,detailPanelEventId:p,detailPanelKey:y,getActiveDayIdx:D,getDayMetricsWrapper:w})=>{const[b,E]=r.useState(null),C=t===exports.ViewType.DAY,T=t===exports.ViewType.MONTH,S=t===exports.ViewType.YEAR,M=t===exports.ViewType.RESOURCE,x=r.useCallback(()=>{if(!c.current&&!s.current||!l.current||!d.current)return;const e=l.current.getBoundingClientRect(),t=D(),r=w(t);let o,i;if(r)o=r.left,i=r.width;else if(T)i=e.width/7,o=e.left+t*i;else{const n=Ra(l,u);i=(e.width-n)/7,o=e.left+n+t*i}const m=Math.min(window.innerWidth,e.right),g=Math.min(window.innerHeight,e.bottom);requestAnimationFrame(()=>{var r,i,l;if(!d.current)return;const u=c.current||s.current;if(!u)return;const f=d.current.getBoundingClientRect(),v=f.width,p=f.height;let y,D,b;if("sticky-top"===h||"sticky-bottom"===h||"sticky-left"===h||"sticky-right"===h){const e=null===(r=s.current)||void 0===r?void 0:r.getBoundingClientRect();if(!e)return;b=e}else b=u.getBoundingClientRect();if(T&&n&&a){const n=w(t),a=null!==(i=null==n?void 0:n.width)&&void 0!==i?i:e.width/7,r=null!==(l=null==n?void 0:n.left)&&void 0!==l?l:e.left+t*a,o=r+a;b={top:b.top,bottom:b.bottom,left:r,right:o,width:o-r,height:b.height,x:r,y:b.top,toJSON:()=>({})}}const C=m-b.right,x=b.left-e.left;y=C>=v+20?b.right+10:x>=v+20?b.left-v-10:C>x?Math.max(e.left+10,m-v-10):e.left+10;const k=b.top-p/2+b.height/2,N=Math.max(10,e.top+10),I=g-10;D=k<N?N:k+p>I?I-p:k,E(e=>{if(!e)return null;let t=y<o;return(S||M)&&(t=y<b.left),Object.assign(Object.assign({},e),{top:D,left:y,isSunday:t})})})},[l,e.day,e.start,e.end,h,T,m,g,n,a,i,p,y,u,C,S,o,f,D,w,c,d,s]);return r.useEffect(()=>{!v||b||u||(E({top:-9999,left:-9999,eventHeight:0,eventMiddleY:0,isSunday:!1}),requestAnimationFrame(()=>x()))},[v,b,x,u]),{detailPanelPosition:b,setDetailPanelPosition:E,updatePanelPosition:x}})({event:e,viewType:d,isMultiDay:c,segment:u,yearSegment:h,multiDaySegmentInfo:R,calendarRef:i,eventRef:se,detailPanelRef:de,selectedEventElementRef:ce,isMobile:L,eventVisibility:xe,firstHour:v,hourHeight:f,columnsPerRow:m,showDetailPanel:me,detailPanelEventId:y,detailPanelKey:he,getActiveDayIdx:Ie,getDayMetricsWrapper:Oe}),{handleClick:Le,handleDoubleClick:$e,handleContextMenu:Fe,hasPendingSelection:Ye}=(({event:e,timingEvent:t,viewType:n,isAllDay:a,isMultiDay:o,segment:i,multiDaySegmentInfo:l,calendarRef:s,firstHour:d,hourHeight:c,isMobile:u,canOpenDetail:h,detailPanelKey:m,app:g,onEventSelect:f,onDetailPanelToggle:v,setIsSelected:p,setDetailPanelPosition:y,setContextMenuPosition:D,setActiveDayIndex:w,getClickedDayIdx:b,updatePanelPosition:E,selectedEventElementRef:T})=>{const S=n===exports.ViewType.MONTH,M=n===exports.ViewType.YEAR,x=n===exports.ViewType.RESOURCE,k=null!=t?t:e,N=r.useRef(null),[I,R]=r.useState(!1),O=r.useCallback(()=>{N.current&&(clearTimeout(N.current),N.current=null,R(!1))},[]);r.useEffect(()=>()=>O(),[O]);const H=r.useCallback((e,t,n)=>new Promise(a=>{let r=0,o=0,i=t,l=n;const s=()=>{const t=e.scrollLeft,n=e.scrollTop,d=Math.abs(t-i)>1||Math.abs(n-l)>1;r=d?0:r+40,o+=40,i=t,l=n,r>=120||o>=600?a():setTimeout(s,40)};setTimeout(s,40)}),[]),P=r.useCallback(()=>new Promise(e=>{if(!s.current||a||S||M||c<=0)return void e();const t=Oa(s);if(!t)return void e();if(x&&T.current){const n=T.current.getBoundingClientRect(),a=t.getBoundingClientRect();if(n.left>=a.left&&n.right<=a.right&&n.top>=a.top&&n.bottom<=a.bottom)return void e();const r=t.scrollLeft,o=t.scrollTop,i=r+(n.left-a.left)-(t.clientWidth-n.width)/2,l=o+(n.top-a.top)-(t.clientHeight-n.height)/2,s=Math.max(0,t.scrollWidth-t.clientWidth),d=Math.max(0,t.scrollHeight-t.clientHeight),c=Math.max(0,Math.min(s,i)),u=Math.max(0,Math.min(d,l));return Math.abs(c-r)>1||Math.abs(u-o)>1?(t.scrollTo({left:c,top:u,behavior:"smooth"}),void H(t,r,o).then(e)):void e()}const n=l?l.startHour:C(k.start),r=l?l.endHour:oe(k),o=(n-d)*c,i=o+Math.max((r-n)*c,c/4),u=t.scrollTop,h=t.clientHeight;if(o>=u&&i<=u+h)return void e();const m=((n+r)/2-d)*c-h/2,g=t.scrollHeight-h,f=Math.max(0,Math.min(g,m));Math.abs(f-u)<=1?e():(t.scrollTo({top:f,behavior:"smooth"}),H(t,t.scrollLeft,u).then(e))}),[s,a,S,M,x,l,k.start,k.end,d,c,T,H]),A=r.useCallback(t=>{O(),t.preventDefault(),t.stopPropagation(),g&&!g.canMutateFromUI(e.id)||(f&&f(e.id),D({x:t.clientX,y:t.clientY}))},[g,O,e.id,f,D]),L=r.useCallback(t=>{var n,a,r;if(o){const r=b(t);w(null===r?null!==(a=null!==(n=null==l?void 0:l.dayIndex)&&void 0!==n?n:e.day)&&void 0!==a?a:null:i?Math.min(Math.max(r,i.startDayIndex),i.endDayIndex):r)}else w(null!==(r=e.day)&&void 0!==r?r:null);f?f(e.id):h&&p(!0),null==v||v(null),y(null)},[o,b,w,null==l?void 0:l.dayIndex,e,i,f,h,p,v,y]),$=r.useCallback(()=>{null==g||g.onEventClick(e)},[g,e]),F=r.useCallback(e=>{L(e),$()},[L,$]),Y=r.useCallback(t=>{var n,a,r,l,s,d;if(O(),t.preventDefault(),t.stopPropagation(),!h)return;let c=t.currentTarget;if(o){const e=c.querySelector("div");e&&(c=e)}if(T.current=c,o){const o=b(t.clientX);w(null===o?null!==(a=null!==(n=null==i?void 0:i.startDayIndex)&&void 0!==n?n:e.day)&&void 0!==a?a:0:Math.min(Math.max(o,null!==(r=null==i?void 0:i.startDayIndex)&&void 0!==r?r:0),null!==(l=null==i?void 0:i.endDayIndex)&&void 0!==l?l:6))}else w(null!==(s=e.day)&&void 0!==s?s:null);p(!0),null==f||f(e.id);const D=()=>{P().then(()=>{u||(null==v||v(m),y({top:-9999,left:-9999,eventHeight:0,eventMiddleY:0,isSunday:!1}),requestAnimationFrame(()=>E()))})};g?Promise.resolve(null===(d=g.onEventDoubleClick)||void 0===d?void 0:d.call(g,e,t)).then(e=>{!1!==e&&D()}).catch(e=>{Z.error("Failed to handle event double click callback",e),D()}):D()},[O,h,o,T,b,w,null==i?void 0:i.startDayIndex,null==i?void 0:i.endDayIndex,e.day,g,e,P,p,M,u,f,v,m,y,E]);return{handleClick:r.useCallback(e=>{e.preventDefault(),e.stopPropagation();const t=e.clientX;if(!u&&h)return O(),M||x||L(t),R(!0),void(N.current=setTimeout(()=>{(M||x)&&L(t),$(),N.current=null,R(!1)},180));F(t)},[O,h,L,$,M,x,u,F]),handleDoubleClick:Y,handleContextMenu:A,hasPendingSelection:I,scrollEventToCenter:P}})({event:e,timingEvent:ne,viewType:d,isAllDay:a,isMultiDay:c,segment:u,multiDaySegmentInfo:R,calendarRef:i,firstHour:v,hourHeight:f,isMobile:L,canOpenDetail:pe,detailPanelKey:he,app:O,onEventSelect:M,onDetailPanelToggle:k,setIsSelected:we,setDetailPanelPosition:Pe,setContextMenuPosition:re,setActiveDayIndex:Ne,getClickedDayIdx:Re,updatePanelPosition:Ae,selectedEventElementRef:ce}),je=(void 0===p?De:p===e.id)||Ye||!ee&&be||l,Ve=ee&&je&&ve,{calculateEventStyle:_e}=(({event:e,timingEvent:t,layout:n,isBeingDragged:a,isAllDay:r,allDayHeight:o,viewType:i,isMultiDay:l,segment:s,yearSegment:d,columnsPerRow:c,segmentIndex:u,hourHeight:h,firstHour:m,isEventSelected:g,showDetailPanel:f,isPopping:v,isDraggable:p,canOpenDetail:y,eventVisibility:D,calendarRef:w,isMobile:b,eventRef:E,getActiveDayIdx:T,getDayMetricsWrapper:S,multiDaySegmentInfo:M})=>{const x=i===exports.ViewType.DAY,k=i===exports.ViewType.MONTH,N=i===exports.ViewType.YEAR,I=null!=t?t:e;return{calculateEventStyle:()=>{var e,t,i,R,O,H,P,A,L,$,F;if(N&&d&&c){const{startCellIndex:e,endCellIndex:t,visualRowIndex:n}=d,r=2;return{position:"absolute",left:`calc(${e/c*100}% + ${r}px)`,top:18*n+"px",width:`calc(${(t-e+1)/c*100}% - ${2*r}px)`,height:"16px",opacity:1,zIndex:g||f?1e3:1,transform:v?"scale(1.05)":"scale(1)",transition:a?["left 90ms cubic-bezier(0.22, 1, 0.36, 1)","top 90ms cubic-bezier(0.22, 1, 0.36, 1)","width 90ms cubic-bezier(0.22, 1, 0.36, 1)",Xa].join(", "):Xa,willChange:a?"left, top, width, transform":"transform",cursor:p||y?"pointer":"default"}}if(k)return l&&s?{opacity:1,zIndex:g||f?1e3:1,cursor:p||y?"pointer":"default"}:{opacity:1,zIndex:g||f?1e3:1,transform:v?"scale(1.05)":"scale(1)",transition:Xa,cursor:p||y?"pointer":"default"};if(r){const e={height:o-4+"px",opacity:1,zIndex:g||f?1e3:1,transform:v?"scale(1.05)":"scale(1)",transition:Xa,cursor:p||y?"pointer":"default"},t=u*o;if(Object.assign(e,{top:`${t}px`}),x)Object.assign(e,{width:"100%",left:"0px",right:"2px",position:"absolute"});else if(l&&s){const t=c||7,n=(s.endDayIndex-s.startDayIndex+1)/t*100,a=s.startDayIndex/t*100,r=2,o=s.isFirstSegment?r:0,i=o+(s.isLastSegment?r:0);Object.assign(e,{width:i>0?`calc(${n}% - ${i}px)`:`${n}%`,left:o>0?`calc(${a}% + ${o}px)`:`${a}%`,position:"absolute",pointerEvents:"auto"})}else Object.assign(e,{width:"100%",left:"0px",position:"relative"});return e}const Y=M?M.startHour:C(I.start),j=M?M.endHour:oe(I),V=(Y-m)*h,_=Math.max((j-Y)*h,h/4),Z={top:`${V+3}px`,height:_-4+"px",position:"absolute",opacity:1,zIndex:g||f?1e3:null!==(e=null==n?void 0:n.zIndex)&&void 0!==e?e:1,transform:v?"scale(1.05)":"scale(1)",transition:Xa,cursor:p||y?"pointer":"default"};if(g&&f&&("sticky-left"===D||"sticky-right"===D)){const e=Oa(w),n=null==e?void 0:e.getBoundingClientRect();if(n){const e=Ra(w,b),a=n.left+e,r=n.right,o=null===(i=null===(t=E.current)||void 0===t?void 0:t.parentElement)||void 0===i?void 0:i.getBoundingClientRect(),l=(null!==(R=null==o?void 0:o.top)&&void 0!==R?R:n.top)+(Y-m)*h+3,s=Math.max(l,n.top),d=Math.min(l+_-4,n.bottom);if(d<=s)return{display:"none"};const c={position:"fixed",top:`${s}px`,height:d-s+"px",width:"6px",zIndex:1e3,overflow:"hidden",borderRadius:"0.25rem"};return"sticky-left"===D?Object.assign(Object.assign({},c),{left:`${a}px`}):Object.assign(Object.assign({},c),{left:r-6+"px"})}}if(g&&f&&("sticky-top"===D||"sticky-bottom"===D)){const e=null===(O=w.current)||void 0===O?void 0:O.getBoundingClientRect();if(e){const t=T(),a=Ra(w,b),r=x?1:c||7;let o=(e.width-a)/r,i=e.left+a+(x?0:t*o);k&&(o=e.width/7,i=e.left+t*o);const l=S(t);l&&(i=l.left,o=l.width);let s=Oa(w);s||(s=null!==(P=null===(H=w.current)||void 0===H?void 0:H.querySelector(".df-calendar-renderer"))&&void 0!==P?P:null);const d=null==s?void 0:s.getBoundingClientRect(),u=null===(L=null===(A=E.current)||void 0===A?void 0:A.parentElement)||void 0===L?void 0:L.getBoundingClientRect();let h,m;if(u&&u.width>0)n?(h=u.left+n.left/100*u.width,m=x?n.width/100*u.width:(n.width-1)/100*u.width):(h=u.left,m=x?u.width:u.width-3);else{const e=S(t),a=null!==($=null==e?void 0:e.left)&&void 0!==$?$:i,r=null!==(F=null==e?void 0:e.width)&&void 0!==F?F:o;h=a,m=r-3,n&&(h=a+n.left/100*r,m=x?n.width/100*r:(n.width-1)/100*r)}const g=e.left+a;if(h<g&&(m=Math.max(0,m-(g-h)),h=g),h+m>e.right&&(m=Math.max(0,e.right-h)),"sticky-top"===D){let t=d?d.top:e.top;return t=Math.max(t,0),t=Math.max(t,e.top),t=Math.min(t,e.bottom-6),t=Math.min(t,window.innerHeight-6),{position:"fixed",top:`${t}px`,left:`${h}px`,width:`${m}px`,height:"6px",zIndex:1e3,overflow:"hidden",borderRadius:"0.25rem"}}let f=d?d.bottom:e.bottom;return f=Math.min(f,window.innerHeight),f=Math.min(f,e.bottom),f=Math.max(f,e.top+6),f=Math.max(f,6),{position:"fixed",top:f-6+"px",left:`${h}px`,width:`${m}px`,height:"6px",zIndex:1e3,overflow:"hidden",borderRadius:"0.25rem"}}}if(n&&!r){const e=x?`${n.width}%`:n.width-1+"%";return Object.assign(Object.assign({},Z),{left:`${n.left}%`,width:e,right:"auto"})}return Object.assign(Object.assign({},Z),{left:"0px",right:x?"0px":"3px"})}}})({event:e,timingEvent:ne,layout:t,isBeingDragged:l,isAllDay:a,allDayHeight:o,viewType:d,isMultiDay:c,segment:u,yearSegment:h,columnsPerRow:m,segmentIndex:g,hourHeight:f,firstHour:v,isEventSelected:je,showDetailPanel:me,isPopping:ie,isDraggable:ye,canOpenDetail:pe,eventVisibility:xe,calendarRef:i,isMobile:L,eventRef:se,getActiveDayIdx:Ie,getDayMetricsWrapper:Oe,multiDaySegmentInfo:R});(({event:e,timingEvent:t,isEventSelected:n,showDetailPanel:a,eventRef:o,calendarRef:i,isAllDay:l,viewType:s,isMobile:d=!1,multiDaySegmentInfo:c,firstHour:u,hourHeight:h,updatePanelPosition:m,eventVisibility:g,setEventVisibility:f})=>{const v=s===exports.ViewType.MONTH,p=s===exports.ViewType.YEAR,y=s===exports.ViewType.RESOURCE,D=null!=t?t:e,w=r.useCallback(()=>{var e,t;if(!n||!a||!o.current||!i.current||l||v||p)return;const r=Oa(i);if(!r)return;const s=c?c.startHour:C(D.start),w=c?c.endHour:oe(D),b=(s-u)*h,E=b+Math.max((w-s)*h,h/4),T=r.getBoundingClientRect(),S=r.scrollTop,M=S+T.height,x=T.bottom<0,k=T.top>window.innerHeight;let N=g;if(x)N="sticky-top";else if(k)N="sticky-bottom";else{const n="sticky-left"===g||"sticky-right"===g?"standard":g;let a;if(a="standard"===n?E<S?"sticky-top":b>M-20?"sticky-bottom":"standard":"sticky-top"===n?E>=S?"standard":"sticky-top":b<=M-20?"standard":"sticky-bottom","standard"!==a)N=a;else if(y){const n=null===(t=null===(e=o.current)||void 0===e?void 0:e.parentElement)||void 0===t?void 0:t.getBoundingClientRect();if(n){const e=Ra(i,d),t=T.left+e,a=T.right;N=n.right<=t?"sticky-left":n.left>=a?"sticky-right":"standard"}else N="standard"}else N="standard"}N===g?m():(f(N),setTimeout(m,0))},[n,a,i,l,v,y,d,D.start,D.end,u,h,m,c,g,f]);r.useEffect(()=>{var e;if(!n||!a||l)return;const t=Oa(i);if(!t)return;const r=()=>w(),o=()=>{w(),m()},s=[t];let d=null===(e=i.current)||void 0===e?void 0:e.parentElement;for(;d;){const e=window.getComputedStyle(d);"auto"!==e.overflowY&&"scroll"!==e.overflowY&&"auto"!==e.overflowX&&"scroll"!==e.overflowX||s.push(d),d=d.parentElement}s.forEach(e=>{e.addEventListener("scroll",r)}),window.addEventListener("scroll",r,!0),window.addEventListener("resize",o);let c=null;return i.current&&(c=new ResizeObserver(()=>{o()}),c.observe(i.current)),w(),()=>{s.forEach(e=>{e.removeEventListener("scroll",r)}),window.removeEventListener("scroll",r,!0),window.removeEventListener("resize",o),c&&c.disconnect()}},[n,a,l,w,m,i])})({event:e,timingEvent:ne,isEventSelected:je,showDetailPanel:me,eventRef:se,calendarRef:i,isAllDay:a,viewType:d,isMobile:L,multiDaySegmentInfo:R,firstHour:v,hourHeight:f,updatePanelPosition:Ae,eventVisibility:xe,setEventVisibility:ke});const Ze=me&&!!I;(({eventRef:e,detailPanelRef:t,eventId:n,isEventSelected:a,showDetailPanel:o,onEventSelect:i,onDetailPanelToggle:l,setIsSelected:s,setActiveDayIndex:d})=>{r.useEffect(()=>{if(!a&&!o)return;const r=r=>{var c,u;const h=r.target,m=null===(c=e.current)||void 0===c?void 0:c.contains(h),g=null!==h.closest(`[data-event-id="${n}"]`),f=null===(u=t.current)||void 0===u?void 0:u.contains(h),v=h.closest("[data-event-detail-dialog]"),p=h.closest("[data-range-picker-popup]"),y=h.closest("[data-calendar-picker-dropdown]");o?m||g||f||v||p||y||(null==i||i(null),d(null),s(!1),null==l||l(null)):!a||m||g||v||p||y||(null==i||i(null),d(null),s(!1),null==l||l(null))};return document.addEventListener("mousedown",r),()=>{document.removeEventListener("mousedown",r)}},[a,o,i,l,n])})({eventRef:se,detailPanelRef:de,eventId:e.id,isEventSelected:!Ze&&je,showDetailPanel:ge,onEventSelect:M,onDetailPanelToggle:k,setIsSelected:we,setActiveDayIndex:Ne});const We=r.useCallback(()=>{M&&M(null),ue.current=null,we(!1),null==k||k(null)},[M,k,we]),Ue=r.useMemo(()=>({event:e,viewType:d,isAllDay:a,isMobile:L,isSelected:je,isDragging:l,segment:u,layout:t}),[e,d,a,L,je,l,u,t]),Be=r.useCallback(e=>ze(Tn,{store:Q,generatorName:"eventDetailContent",generatorArgs:e}),[Q]);r.useEffect(()=>{if((null==O?void 0:O.state.highlightedEventId)===e.id){le(!0);const e=setTimeout(()=>{le(!1)},650);return()=>{clearTimeout(e),le(!1)}}},[null==O?void 0:O.state.highlightedEventId,e.id]),r.useEffect(()=>{ve||re(null)},[ve]),r.useEffect(()=>{const t=c&&(null==u?void 0:u.isFirstSegment)||te&&(null==h?void 0:h.isFirstSegment)||!c&&!te;T===e.id&&!me&&t&&setTimeout(()=>{null==k||k(he),null==S||S()},50)},[T,e.id,me,c,u,te,h,k,S,he]);const qe=$(e),Ge=null==O?void 0:O.getCalendarRegistry(),Ke=e.calendarIds&&e.calendarIds.length>1?V(e,Ge):null,Xe=((e,t,n,a)=>e===exports.ViewType.YEAR?(e=>e?e.isFirstSegment&&e.isLastSegment?"full":e.isFirstSegment?"start":e.isLastSegment?"end":"middle":"full")(a):t?Pa(n):"full")(d,a,u,h);return ze(n.Fragment,{children:[ze("div",{ref:se,"data-event-id":e.id,"data-view":d,"data-all-day":String(a),"data-selected":String(je),"data-dragging":String(l),"data-resizing":String(s),"data-popping":String(ie),"data-multi-day":String(c),"data-editable":String(ve),"data-draggable":String(ye),"data-viewable":String(pe),"data-segment-shape":Xe,"data-month-stack":String(d===exports.ViewType.MONTH&&!c),"data-touch-handles":String(Ve),className:`${Ha(d,a,c)} ${a&&T===e.id?"df-all-day-event-animate":""} ${null!=U?U:""}`,style:Object.assign(Object.assign(Object.assign({},B?{}:_e()),je?{background:A(qe,Ge),color:"#fff"}:e.calendarIds&&e.calendarIds.length>1?{background:_(Ke),color:P(qe,Ge)}:{backgroundColor:H(qe,Ge),color:P(qe,Ge)}),W),onClick:e=>{if(ee&&Me())return e.preventDefault(),void e.stopPropagation();Le(e)},onContextMenu:Fe,onDblClick:$e,onMouseDown:t=>{var n;if(ee||Ee(!0),D&&ye){const a=t;D(a,R?Object.assign(Object.assign({},e),{day:null!==(n=R.dayIndex)&&void 0!==n?n:e.day,_segmentInfo:R}):c&&u?Object.assign(Object.assign({},e),{day:u.startDayIndex,_segmentInfo:{dayIndex:u.startDayIndex,isFirst:u.isFirstSegment,isLast:u.isLastSegment}}):e)}},onMouseUp:()=>!ee&&Ee(!1),onMouseLeave:()=>!ee&&Ee(!1),onTouchStart:Ce,onTouchMove:Te,onTouchEnd:Se,children:ze(Ba,{event:ne,viewType:d,isAllDay:a,isMultiDay:c,segment:u,yearSegment:h,segmentIndex:g,isBeingDragged:l,isBeingResized:s,isEventSelected:je,isPopping:ie,isEditable:ve,isDraggable:ye,canOpenDetail:pe,isTouchEnabled:ee,hideTime:j,isMobile:L,isSlidingView:F,app:O,onMoveStart:D,onResizeStart:w,multiDaySegmentInfo:R,customRenderingStore:Q,eventContentSlotArgs:Ue,timeFormat:z,appTimeZone:K,renderVisualContent:q,resizeHandleOrientation:G})}),me&&!I&&ze("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:9998,pointerEvents:"none"}}),ze(Ka,{showDetailPanel:me,customEventDetailDialog:I,detailPanelPosition:He,event:e,detailPanelRef:de,isAllDay:a,eventVisibility:xe,calendarRef:i,selectedEventElementRef:ce,onEventUpdate:b,onEventDelete:E,handlePanelClose:We,customRenderingStore:Q,contentSlotRenderer:Be,customDetailPanelContent:N,app:O}),ae&&O&&ve&&ze(Ia,{event:e,x:ae.x,y:ae.y,onClose:()=>re(null),app:O,onDetailPanelToggle:k,detailPanelKey:he})]})},Qa=({handlePreviousMonth:e,handleToday:t,handleNextMonth:n})=>{const{t:a}=Tt();return ze("div",{className:"df-navigation",children:[ze("button",{type:"button",className:Vt,onClick:e,"aria-label":"Previous month",children:ze(qt,{})}),ze("button",{type:"button",className:"df-today-button df-calendar-today-button",onClick:t,children:a("today")}),ze("button",{type:"button",className:Vt,onClick:n,"aria-label":"Next month",children:ze(Gt,{})})]})},er=({viewType:e,currentDate:t,onPrevious:n,onNext:a,onToday:r,customTitle:o,customSubtitle:i,subtitleMeta:l,showTodayBox:s,stickyYear:d,stickyYearOffset:c=0,nextYear:u,nextYearOffset:h=0})=>{const{locale:m}=Tt(),g=void 0===s||s,f=o||(()=>{switch(e){case"day":return t.toLocaleDateString(m,{day:"numeric",month:"long",year:"numeric"});case"week":case"month":return t.toLocaleDateString(m,{month:"long",year:"numeric"});case"year":return t.getFullYear().toString();default:return""}})(),v="day"===e?i||("day"===e?t.toLocaleDateString(m,{weekday:"long"}):null):null;return ze("div",{className:"df-view-header-container",onContextMenu:e=>e.preventDefault(),children:[ze("div",{className:"df-view-header-title-area",children:ze("div","year"===e&&d?{className:"df-view-header-year-stack",children:[ze("h1",{className:`${Mt} df-view-header-year-title`,style:{transform:`translateY(-${c}px)`},children:d}),u&&ze("h1",{className:`${Mt} df-view-header-year-title`,style:{transform:`translateY(${h}px)`},children:u})]}:{children:[ze("div",{className:Mt,children:f}),v&&ze("div",{className:"df-view-header-subtitle",children:v}),l&&ze("div",{className:"df-view-header-subtitle-row",children:l&&ze("div",{className:"df-view-header-subtitle-meta",children:l})})]})}),g&&n&&a&&r&&ze("div",{className:"df-view-header-nav",children:ze(Qa,{handlePreviousMonth:n,handleNextMonth:a,handleToday:r})})]})};function tr(e,t,n,a,r){if(a||0!==e.button)return;let o=!0;const i={move(a){if(!o)return;Math.hypot(a.clientX-e.clientX,a.clientY-e.clientY)>=5&&(o=!1,document.removeEventListener("mousemove",i.move),document.removeEventListener("mouseup",i.up),null==r||r(e,t,n),document.dispatchEvent(new MouseEvent("mousemove",{clientX:a.clientX,clientY:a.clientY,bubbles:!0,cancelable:!1})))},up(){o=!1,document.removeEventListener("mousemove",i.move),document.removeEventListener("mouseup",i.up)}};document.addEventListener("mousemove",i.move),document.addEventListener("mouseup",i.up)}function nr(){document.dispatchEvent(new MouseEvent("mouseup",{bubbles:!0,cancelable:!1}))}const ar=({app:e,currentDate:t,currentWeekStart:a,events:o,currentDayEvents:i,organizedAllDayEvents:l,allDayAreaHeight:s,timeSlots:d,eventLayouts:c,isToday:u,currentTime:h,selectedEventId:m,setSelectedEventId:g,newlyCreatedEventId:f,setNewlyCreatedEventId:v,detailPanelEventId:p,setDetailPanelEventId:y,dragState:D,isDragging:w,handleMoveStart:b,handleResizeStart:E,handleCreateStart:C,handleCreateAllDayEvent:T,handleTouchStart:S,handleTouchEnd:M,handleTouchMove:x,handleDragOver:k,handleDrop:N,handleEventUpdate:I,handleEventDelete:R,onDateChange:O,customDetailPanelContent:H,customEventDetailDialog:P,calendarRef:A,allDayRowRef:L,timeGridRef:$,switcherMode:F,isMobile:Y,isTouch:j,setDraftEvent:V,setIsDrawerOpen:_,ALL_DAY_HEIGHT:Z,HOUR_HEIGHT:z,FIRST_HOUR:W,LAST_HOUR:U,showAllDay:B,showStartOfDayLabel:q,timeFormat:G="24h",secondaryTimeSlots:K,primaryTzLabel:X,secondaryTzLabel:J,appTimeZone:Q})=>{var ee;const te=!!K&&K.length>0&&!Y,{t:ne}=Tt(),ae=r.useRef(e.state.highlightedEventId),[oe,ie]=r.useState(null),le=r.useMemo(()=>Be(),[]),se=r.useMemo(()=>te&&J&&X?ze(n.Fragment,{children:[ze("span",{className:"df-time-column-tz-label",children:J}),ze("span",{className:"df-time-column-tz-label",children:X})]}):null,[te,J,X]),de=()=>{var e;const t=null===(e=A.current)||void 0===e?void 0:e.querySelector(".df-calendar-content");if(!t)return 0;const n=t.querySelector(".df-time-grid-row");return n?n.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop:0},ce=e=>{var t;const n=null===(t=A.current)||void 0===t?void 0:t.querySelector(".df-calendar-content");if(!n)return null;const a=n.getBoundingClientRect(),r=n.scrollTop||0;return W+(e-a.top+r-de())/z},ue=e.canMutateFromUI();r.useEffect(()=>{ue||ie(null)},[ue]);const he=(e,n)=>{var a,r,o,i;if(e.preventDefault(),Y||!ue)return;const l=new Date(t);if(n)l.setHours(0,0,0,0);else{const t=null===(r=null===(a=A.current)||void 0===a?void 0:a.querySelector(".df-calendar-content"))||void 0===r?void 0:r.getBoundingClientRect();if(t){const n=(null===(i=null===(o=A.current)||void 0===o?void 0:o.querySelector(".df-calendar-content"))||void 0===i?void 0:i.scrollTop)||0,a=de(),r=(e.clientY-t.top+n-a)/z+W,s=Math.floor(r),d=Math.floor(60*(r-s)),c=15*Math.round(d/15),u=60===c?s+1:s,h=60===c?0:c;l.setHours(u,h,0,0)}}ie({x:e.clientX,y:e.clientY,date:l})};return ze("div",{className:"df-day-content","data-switcher-mode":F,onContextMenu:e=>e.preventDefault(),children:[ze("div",{className:"df-day-content-layout",children:[ze("div",{className:"df-day-content-header-wrap",onContextMenu:e=>e.preventDefault(),style:{paddingRight:Y||!le?"0px":"15px"},children:ze(er,{calendar:e,viewType:exports.ViewType.DAY,currentDate:t,subtitleMeta:se})}),ze("div",B?{className:Bt(Pt,"df-day-content-all-day-row"),ref:L,"data-scrollbar-space":!Y&&le?"true":"false",style:{paddingRight:Y||!le?"0px":"0.6875rem"},onContextMenu:e=>he(e,!0),children:[ze("div",{className:Bt(At,"df-day-content-all-day-label"),onContextMenu:e=>e.preventDefault(),children:ne("allDay")}),ze("div",{className:"df-day-content-all-day-grid","data-scrollbar-space":!Y&&le?"true":"false",children:ze("div",{className:"df-day-content-all-day-lane",style:{minHeight:`${s}px`},onClick:()=>null==O?void 0:O(t),onMouseDown:e=>{const n=Math.floor((t.getTime()-a.getTime())/864e5);null==T||T(e,n)},onDblClick:e=>{const n=Math.floor((t.getTime()-a.getTime())/864e5);null==T||T(e,n)},onDragOver:k,onDrop:e=>{N(e,t,void 0,!0)},children:l.map(t=>ze(Ja,{event:t,isAllDay:!0,viewType:exports.ViewType.DAY,segmentIndex:t.row,allDayHeight:Z,calendarRef:A,isBeingDragged:w&&(null==D?void 0:D.eventId)===t.id&&"move"===(null==D?void 0:D.mode),hourHeight:z,firstHour:W,onMoveStart:b,onEventUpdate:I,onEventDelete:R,newlyCreatedEventId:f,onDetailPanelOpen:()=>v(null),detailPanelEventId:p,onDetailPanelToggle:e=>y(e),selectedEventId:m,onEventSelect:t=>{const n=e.getReadOnlyConfig().viewable,a=e.canMutateFromUI(),r=o.find(e=>e.id===t);(Y||j)&&r&&n&&a?(V(r),_(!0)):(g(t),e.state.highlightedEventId&&(e.highlightEvent(null),ae.current=null))},onEventLongPress:e=>{(Y||j)&&g(e)},customDetailPanelContent:H,customEventDetailDialog:P,app:e,isMobile:Y,enableTouch:j,appTimeZone:Q},t.id))})})]}:{className:"df-day-content-all-day-spacer","data-scrollbar-space":!Y&&le?"true":"false"}),ze("div",{className:Bt("df-calendar-content","df-day-content-grid"),style:{scrollbarGutter:"stable"},children:ze("div",{className:"df-day-content-grid-inner",children:[u&&h&&(()=>{const e=h,t=e.getHours()+e.getMinutes()/60;if(t<W||t>U)return null;return ze("div",{className:Ot,"data-secondary-tz":te?"true":"false",style:{top:`${(t-W)*z}px`,height:0,zIndex:20,marginTop:"0.75rem"},children:[ze("div",{className:"df-day-content-current-time-side",children:[ze("div",{className:"df-day-content-current-time-side-inner"}),ze("div",{className:Ht,children:re(t,0,G,!1)})]}),ze("div",{className:"df-day-content-current-time-rail",children:ze("div",{className:"df-current-time-bar"})})]})})(),ze("div",{className:"df-time-column","data-secondary-tz":te?"true":"false",onContextMenu:e=>e.preventDefault(),children:[ze("div",{className:"df-time-column-spacer df-time-day-column-spacer","data-secondary-tz":te?"true":"false"}),d.map((e,t)=>{var n;return ze("div",{className:Nt,children:ze("div",te?{className:"df-time-column-tz-row",children:[ze("span",{className:"df-time-column-tz-value",children:q&&0===t?"":null!==(n=null==K?void 0:K[t])&&void 0!==n?n:""}),ze("span",{className:"df-time-column-tz-value",children:q&&0===t?"":e.label})]}:{className:It,children:q&&0===t?"":e.label})},t)})]}),ze("div",{className:"df-day-content-grid-column",children:[ze("div",{className:Bt(zt,"df-time-grid-boundary-top","df-day-content-grid-boundary"),"data-scrollbar-space":!Y&&le?"true":"false",children:ze("div",{className:Bt(Wt,"df-midnight-label-offset"),style:{top:"auto",bottom:"-0.625rem"},children:q?re(W,0,G):""})}),ze("div",{className:"df-day-content-grid-rows",style:{WebkitTouchCallout:"none"},ref:$,"data-scrollbar-space":!Y&&le?"true":"false",children:[d.map((e,n)=>ze("div",{className:Rt,"data-scrollbar-space":!Y&&le?"true":"false",onClick:()=>null==O?void 0:O(t),onMouseDown:e=>{const n=ce(e.clientY);if(null===n)return;tr(e,Math.floor((t.getTime()-a.getTime())/864e5),n,j,C)},onDblClick:e=>{const n=ce(e.clientY);if(null===n)return;const r=Math.floor((t.getTime()-a.getTime())/864e5);null==C||C(e,r,n),nr()},onTouchStart:e=>{const n=Math.floor((t.getTime()-a.getTime())/864e5);S(e,n)},onTouchEnd:M,onTouchMove:x,onDragOver:k,onDrop:e=>{var n,a,r,o;const i=null===(a=null===(n=A.current)||void 0===n?void 0:n.querySelector(".df-calendar-content"))||void 0===a?void 0:a.getBoundingClientRect();if(!i)return;const l=(null===(o=null===(r=A.current)||void 0===r?void 0:r.querySelector(".df-calendar-content"))||void 0===o?void 0:o.scrollTop)||0,s=de(),d=e.clientY-i.top+l-s,c=Math.floor(W+d/z);N(e,t,c)},onContextMenu:e=>he(e,!1)},n)),ze("div",{className:Bt(zt,"df-day-content-grid-boundary-bottom"),"data-scrollbar-space":!Y&&le?"true":"false",children:ze("div",te?{className:"df-time-column-tz-row df-day-content-bottom-tz-row",style:{left:Y?"-5rem":"-5.5rem",width:Y?"5rem":"5.5rem"},children:[ze("span",{children:null!==(ee=null==K?void 0:K[0])&&void 0!==ee?ee:""}),ze("span",{children:re(0,0,G)})]}:{className:Bt(Wt,"df-midnight-label-offset"),children:re(0,0,G)})}),ze("div",{className:"df-day-content-event-layer",children:i.filter(e=>!e.allDay).map(t=>{const n=c.get(t.id);return ze(Ja,{event:t,layout:n,viewType:exports.ViewType.DAY,calendarRef:A,isBeingDragged:w&&(null==D?void 0:D.eventId)===t.id&&"move"===(null==D?void 0:D.mode),hourHeight:z,firstHour:W,onMoveStart:b,onResizeStart:E,onEventUpdate:I,onEventDelete:R,newlyCreatedEventId:f,onDetailPanelOpen:()=>v(null),detailPanelEventId:p,onDetailPanelToggle:e=>y(e),selectedEventId:m,onEventSelect:t=>{const n=e.getReadOnlyConfig().viewable,a=o.find(e=>e.id===t);(Y||j)&&a&&n?(V(a),_(!0)):(g(t),e.state.highlightedEventId&&(e.highlightEvent(null),ae.current=null))},onEventLongPress:e=>{(Y||j)&&g(e)},customDetailPanelContent:H,customEventDetailDialog:P,app:e,isMobile:Y,enableTouch:j,appTimeZone:Q},t.id)})})]})]})]})})]}),ue&&oe&&ze(Na,{x:oe.x,y:oe.y,date:oe.date,viewType:exports.ViewType.DAY,onClose:()=>ie(null),app:e,onCreateEvent:()=>{if(C){const e=Math.floor((t.getTime()-a.getTime())/864e5);if(0===oe.date.getHours()&&0===oe.date.getMinutes())null==T||T({clientX:oe.x,clientY:oe.y},e);else{const t=oe.date.getHours()+oe.date.getMinutes()/60,n={preventDefault:()=>{},stopPropagation:()=>{},clientX:oe.x,clientY:oe.y};C(n,e,t)}}}})]})},rr=({app:e,currentDate:t,visibleMonth:n,currentDayEvents:a,selectedEvent:r,setSelectedEvent:o,handleMonthChange:i,handleDateSelect:l,switcherMode:s,timeFormat:d="24h",showEventDots:c=!0,appTimeZone:u,calendarRef:h})=>{const{t:m,locale:g}=Tt(),f=[...a].toSorted((e,t)=>{if(e.allDay&&!t.allDay)return-1;if(!e.allDay&&t.allDay)return 1;if(!e.allDay&&!t.allDay){return X(e.start,u).getTime()-X(t.start,u).getTime()}return 0});return ze("div",{className:"df-right-panel","data-switcher-mode":s,onContextMenu:e=>e.preventDefault(),children:ze("div",{className:"df-right-panel-layout",children:[ze("div",{className:"df-mini-calendar",children:ze("div",{className:"df-right-panel-calendar-shell",children:[ze("div",{className:"df-right-panel-calendar-header",children:[ze("div",{className:"df-right-panel-header-spacer","aria-hidden":"true",children:" "}),ze(Qa,{handlePreviousMonth:()=>e.goToPrevious(),handleNextMonth:()=>e.goToNext(),handleToday:()=>e.goToToday()})]}),ze(oa,{visibleMonth:n,currentDate:t,showHeader:!0,onMonthChange:i,onDateSelect:l,events:e.getEvents(),showEventDots:c,calendarRegistry:e.getCalendarRegistry(),timeZone:e.timeZone})]})}),ze("div",{className:"df-right-panel-events",children:ze("div",{className:"df-right-panel-events-inner",children:[ze("h3",{className:"df-right-panel-date-heading",children:t.toLocaleDateString(g,{weekday:"long",month:"long",day:"numeric"})}),0===f.length?ze("p",{className:"df-right-panel-empty",children:m("noEvents")}):ze("div",{className:"df-right-panel-list",children:f.map(t=>ze("div",{className:"df-right-panel-event-item",children:ze(Ja,{event:t,isAllDay:t.allDay,viewType:exports.ViewType.DAY,calendarRef:h,onEventUpdate:t=>e.updateEvent(t.id,t),onEventDelete:t=>e.deleteEvent(t),onEventSelect:t=>{if(!t)return void o(null);const n=e.getEvents().find(e=>e.id===t);o(n||null)},selectedEventId:null==r?void 0:r.id,app:e,timeFormat:d,appTimeZone:u,hourHeight:0,firstHour:0,disableDefaultStyle:!0,className:"df-right-panel-event-card"})},t.id))})]})})]})})},or={PARALLEL_THRESHOLD:.25,NESTED_THRESHOLD:.5,INDENT_STEP_PERCENT:2.5,MIN_WIDTH:25,MARGIN_BETWEEN:1,EDGE_MARGIN_PERCENT:.9};function ir(e){return Object.assign(Object.assign({},e),{parentId:void 0,children:[],_startHour:e.allDay?0:C(e.start),_endHour:e.allDay?0:oe(e)})}function lr(e){var t;return null!==(t=e._startHour)&&void 0!==t?t:C(e.start)}function sr(e){var t;return null!==(t=e._endHour)&&void 0!==t?t:oe(e)}function dr(e,t){return e.day===t.day&&!e.allDay&&!t.allDay&&(lr(e)<sr(t)&&lr(t)<sr(e))}function cr(e,t){const n=sr(e)-lr(e);if(n<1.25)return!1;const a=lr(e)+.4*n,r=lr(t)>=a,o=dr(e,t);return r&&o}function ur(e,t,n=or){if(!dr(e,t))return!1;const a=Math.abs(lr(e)-lr(t));return a<=n.PARALLEL_THRESHOLD||(a>n.PARALLEL_THRESHOLD&&a<n.NESTED_THRESHOLD||function(e,t){return!(!dr(e,t)||!cr(e,t)&&!cr(t,e))}(e,t))}function hr(e,t){const n=lr(e)<=lr(t)&&sr(e)>=sr(t),a=lr(e)<=lr(t)&&lr(t)<sr(e)&&dr(e,t);return n||a}function mr(e){const t=[],n=new Set;for(const a of e){if(n.has(a.id))continue;const r=[a];n.add(a.id);for(const t of e){if(n.has(t.id))continue;Math.abs(lr(a)-lr(t))<=or.PARALLEL_THRESHOLD&&(r.push(t),n.add(t.id))}r.sort((e,t)=>lr(e)-lr(t));const o={events:r,startHour:Math.min(...r.map(e=>lr(e))),endHour:Math.max(...r.map(e=>sr(e)))};t.push(o)}return t.sort((e,t)=>e.startHour-t.startHour),t}function gr(e){return"day"===e?.5:2.5}function fr(e){const t=sr(e)-lr(e);return Math.max(.1,Math.min(1,t/4))}function vr(e){if(e.length<2)return!1;for(let t=0;t<e.length;t++)for(let n=t+1;n<e.length;n++)if(ur(e[t],e[n],or))return!0;return!1}function pr(e,t,n,a,r={}){const o=gr(r.viewType);let i=e.depth*o;if(e.isProcessed){const t=function(e,t){let n=e;for(;n.parent&&n.parent.depth>0;)n=n.parent;return 1===n.depth?n.depth*gr(t):null}(e,r.viewType);null!==t&&(i=t)}const l="day"===r.viewType;let s=0;1===e.depth?s=l?.5:1.5:2===e.depth?s=l?-.01:-1:e.depth>=3&&(s=l?.55:-3.5);const d=t+i+s;let c=n-(i+s);if(d+c>t+n&&(c=t+n-d),a.set(e.event.id,{id:e.event.id,left:d,width:c,zIndex:e.depth,level:e.depth,isPrimary:0===e.depth,indentOffset:i*(r.containerWidth||320)/100,importance:fr(e.event)}),0===e.children.length)return;const u=[...e.children].toSorted((e,t)=>sr(t.event)-lr(t.event)-(sr(e.event)-lr(e.event)));1===u.length?pr(u[0],d,c,a,r):vr(u.map(e=>e.event))?yr(u,d,c,a,r):u.forEach(e=>pr(e,d,c,a,r))}function yr(e,t,n,a,r={}){const o=e.length,i=e[0].depth,l=i*gr(r.viewType),s="day"===r.viewType;let d=1===i?s?.5:1.5:2===i?s?-.01:-1:s?.55:-3.5;const c=t+l+d,u=n-(l+d);if(u<=0)return void e.forEach(e=>pr(e,t,n,a,r));let h=or.MARGIN_BETWEEN*(1===i?s?.15:.3:s?.1:.2);const m=(u-h*(o-1))/o;e.forEach((e,t)=>{const n=c+t*(m+h);if(a.set(e.event.id,{id:e.event.id,left:n,width:m,zIndex:e.depth,level:e.depth,isPrimary:0===e.depth,indentOffset:l*(r.containerWidth||320)/100,importance:fr(e.event)}),e.children.length>0){const t=[...e.children].toSorted((e,t)=>sr(t.event)-lr(t.event)-(sr(e.event)-lr(e.event)));1===t.length?pr(t[0],n,m,a,r):vr(t.map(e=>e.event))?yr(t,n,m,a,r):t.forEach(e=>pr(e,n,m,a,r))}})}function Dr(e,t,n={}){const a=100-("day"===n.viewType?0:or.EDGE_MARGIN_PERCENT);if(1===e.length)pr(e[0],0,a,t,n);else if(e.length>1){const r=e.length,o=(a-or.MARGIN_BETWEEN*(r-1))/r;e.forEach((e,a)=>{pr(e,a*(o+or.MARGIN_BETWEEN),Math.max(o,or.MIN_WIDTH),t,n)})}}function wr(e){let t=0;for(const n of e.children)t+=1+wr(n);return t}function br(e,t){var n,a;const r=null===(a=null===(n=e[0])||void 0===n?void 0:n.parent)||void 0===a?void 0:a.depth;return void 0===r?[]:t.filter(e=>e.depth===r).map(e=>({node:e,load:wr(e)})).toSorted((e,t)=>t.load-e.load)}function Er(e){return!(e.length<2)&&e[0].load-e.at(-1).load>=2}function Cr(e,t){t.parentId=e.id,e.children.includes(t.id)||e.children.push(t.id)}function Tr(e,t){e.parent&&(e.parent.children=e.parent.children.filter(t=>t!==e));const n=t.children.find(t=>hr(t.event,e.event));n?(e.parent=n,e.depth=n.depth+1,n.children.push(e),Cr(n.event,e.event)):(e.parent=t,e.depth=t.depth+1,t.children.push(e),Cr(t.event,e.event))}function Sr(e,t){0===e.children.length?t.push(e):e.children.forEach(e=>Sr(e,t))}function Mr(e,t){const n=[];return Sr(e,n),n.find(e=>hr(t.event,e.event))||n[0]||null}function xr(e){let t=0;for(;t<5;){e.sort((e,t)=>t.load-e.load);const n=e[0],a=e.at(-1);if(n.load-a.load<2)break;const r=Mr(n.node,a.node);if(!r)break;Tr(r,a.node),n.load--,a.load++,t++}}function kr(e,t){const n=t.startHour-e.startHour;if(function(e,t){for(const n of e.events)for(const e of t.events)if(dr(n,e)&&Math.abs(lr(e)-lr(n))<or.NESTED_THRESHOLD)return!0;return!1}(e,t))return!1;if(n<or.NESTED_THRESHOLD)return!1;for(const n of e.events)for(const e of t.events)if(hr(n,e))return!0;return!1}function Nr(e,t,n){const a=t.events.filter(t=>hr(t,e));if(0===a.length)return null;if(1===a.length)return a[0];const r=a.map(t=>({parent:t,load:t.children.length,hasParallelSibling:t.children.some(t=>{const a=n.find(e=>e.id===t);return a&&ur(e,a,or)})}));return r.sort((t,n)=>t.load!==n.load?t.load-n.load:t.hasParallelSibling!==n.hasParallelSibling?t.hasParallelSibling?-1:1:Math.abs(lr(e)-lr(t.parent))-Math.abs(lr(e)-lr(n.parent))),r[0].parent}function Ir(e,t,n){if(0===t.length)return null;let a=1/0,r=[];for(const e of t){const t=e.children.length;t<a?(a=t,r=[e]):t===a&&r.push(e)}const o=sr(e)-lr(e),i=r.flatMap(e=>e.children);return o>Math.max(...i.map(e=>{const t=n.find(t=>t.id===e);return t?sr(t)-lr(t):0}),0)?r[0]:r.at(-1)||null}function Rr(e,t){t.parentId=e.id,e.children.includes(t.id)||e.children.push(t.id)}function Or(e){let t=0;for(const n of e.children)t+=1+Or(n);return t}function Hr(e){const t=new Map;for(const n of e){const e={event:n,children:[],parent:null,depth:0,isProcessed:!1};t.set(n.id,e)}for(const n of e)if(n.parentId){const e=t.get(n.id),a=t.get(n.parentId);e&&a&&(e.parent=a,e.depth=a.depth+1,a.children.push(e))}return t}function Pr(e,t){const n=t.get(e.id);if(!n)return null;let a=n;for(;a.parent&&a.depth>1;)a=a.parent;if(1!==a.depth)return null;const r=a.parent;if(!r)return null;const o=r.children.filter(e=>1===e.depth&&e.event.id!==a.event.id);let i=1/0,l=null;for(const e of o){const t=Or(e);t<i&&(i=t,l=e)}return l?l.event:null}function Ar(e,t,n){const a=[];if(1===e.length){const r=Nr(e[0],t,n);return r&&(a.push({child:e[0],parent:r}),Rr(r,e[0])),a}const r=t.events.filter(t=>e.every(e=>hr(t,e)));if(0===r.length){for(const r of e){const o=Nr(r,t,n);if(o)a.push({child:r,parent:o}),Rr(o,r);else{const t=e.find(e=>e.id!==r.id&&dr(e,r));if(t){const e=Pr(t,Hr(n));e&&(a.push({child:r,parent:e}),Rr(e,r))}}}return a}const o=[...e].toSorted((e,t)=>sr(t)-lr(t)-(sr(e)-lr(e)));if(o.length%r.length===0){const e=o.length/r.length;for(let t=0;t<r.length;t++){const n=r[t],i=o.slice(t*e,(t+1)*e);for(const e of i)a.push({child:e,parent:n}),Rr(n,e)}}else for(const e of o){const t=Ir(e,r,o);t&&(a.push({child:e,parent:t}),Rr(t,e))}return a}function Lr(e,t){const n=[],a=new Map,r=new Map;t.forEach(e=>r.set(e.id,e));for(const t of e)for(const e of t.events){const t={event:r.get(e.id),children:[],parent:null,depth:0,isProcessed:!1};n.push(t),a.set(e.id,t)}for(let n=0;n<e.length;n++){const o=e[n],i=o.events.map(e=>r.get(e.id));let l=!1;for(let s=n-1;s>=0&&!l;s--){const n=e[s],d={events:n.events.map(e=>r.get(e.id)),startHour:n.startHour,endHour:n.endHour};if(kr(d,{events:i,startHour:o.startHour,endHour:o.endHour})){const e=Ar(i,d,t);for(const t of e){const e=a.get(t.child.id),n=a.get(t.parent.id);e.parent=n,e.depth=n.depth+1,n.children.push(e)}l=!0}}}const o=n.filter(e=>null===e.parent);return o.forEach(e=>{e.depth=0}),function(e,t){for(let n=e.length-1;n>=1;n--){const a=br(e[n].events.map(e=>t.find(t=>t.event.id===e.id)),t);Er(a)&&xr(a)}}(e,n),o}const $r={calculateDayEventLayouts(e,t={}){const n=e.map(ir);for(const e of n)e.parentId=void 0,e.children=[];const a=new Map,r=n.filter(e=>!e.allDay);if(0===r.length)return a;const o=function(e){const t=[],n=new Set;for(const a of e){if(n.has(a.id))continue;const r=[a],o=[a];for(n.add(a.id);o.length>0;){const t=o.shift();for(const a of e)n.has(a.id)||dr(t,a)&&(r.push(a),o.push(a),n.add(a.id))}t.push(r)}return t}(r);for(const e of o)if(1===e.length){const n="day"===t.viewType?0:or.EDGE_MARGIN_PERCENT;a.set(e[0].id,{id:e[0].id,left:0,width:100-n,zIndex:0,level:0,isPrimary:!0,indentOffset:0,importance:Math.max(.1,Math.min(1,(e[0]._endHour-e[0]._startHour)/4))})}else{Dr(Lr(mr([...e].toSorted((e,t)=>e._startHour!==t._startHour?e._startHour-t._startHour:t._endHour-t._startHour-(e._endHour-e._startHour))),e),a,t)}return a}},Fr=(e,t,n=7,a)=>{const r=new Map;for(let o=0;o<n;o++){const i=[];e.forEach(e=>{var r;if(e.allDay)return;const l=$a(e,t,n,a);if(l.length>0){const n=l.find(e=>e.dayIndex===o);if(n){const a=n.endHour>=24?23.99:n.endHour,r=Object.assign(Object.assign({},e),{start:te(T(Ce(t,o),n.startHour)),end:te(T(Ce(t,o),a)),day:o});i.push(r)}}else if(e.day===o){const t=e=>a?X(e,a):K(e);i.push(Object.assign(Object.assign({},e),{start:te(t(e.start),a),end:te(t(null!==(r=e.end)&&void 0!==r?r:e.start),a),day:o}))}});const l=$r.calculateDayEventLayouts(i,{viewType:"week"});r.set(o,l)}return r},Yr=(e,t=1)=>{const n=(e.getDay()-t+7)%7,a=new Date(e);return a.setDate(e.getDate()-n),a.setHours(0,0,0,0),a},jr={HOUR_HEIGHT:72,FIRST_HOUR:0,LAST_HOUR:24,ALL_DAY_HEIGHT:28};function Vr(e){const{app:n,onEventCreated:a}=e,{t:o}=Tt(),i=r.useCallback(e=>{e.dataTransfer&&e.dataTransfer.types.includes("application/x-dayflow-calendar")&&(e.preventDefault(),e.dataTransfer.dropEffect="copy")},[]);return{handleDrop:r.useCallback((e,r,i,l)=>{if(e.preventDefault(),!e.dataTransfer)return null;const s=e.dataTransfer.getData("application/x-dayflow-calendar");if(!s)return null;try{const e=JSON.parse(s);let d,c,u=!1;if(l){const e=t.Temporal.PlainDate.from({year:r.getFullYear(),month:r.getMonth()+1,day:r.getDate()});d=e,c=e,u=!0}else if(void 0===i){const e=new Date(r);e.setHours(9,0,0,0);const t=new Date(e);t.setHours(10,0,0,0),d=te(e,n.timeZone),c=te(t,n.timeZone)}else{const e=new Date(r);e.setHours(i,0,0,0);const t=new Date(e);t.setHours(i+1,0,0,0),d=te(e,n.timeZone),c=te(t,n.timeZone)}const h=n.getCalendarRegistry().get(e.calendarId);if((null==h?void 0:h.readOnly)||(null==h?void 0:h.subscription))return null;const m={id:`event-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,title:o(u?"newAllDayCalendarEvent":"newCalendarEvent",{calendarName:e.calendarName}),description:"",start:d,end:c,calendarId:e.calendarId,allDay:u};return n.addEvent(m),null==a||a(m),m}catch(e){return console.error("Error creating event from calendar drop:",e),null}},[n,a]),handleDragOver:i}}let _r=null;const Zr={handleMoveStart:()=>{},handleCreateStart:()=>{},handleResizeStart:void 0,handleCreateAllDayEvent:()=>{},dragState:{active:!1,mode:null,eventId:null,targetDate:null,startDate:null,endDate:null},isDragging:!1};function zr(e,t){return _r?_r(e,t):Zr}const Wr=({app:e,config:t,customDetailPanelContent:n,customEventDetailDialog:a,calendarRef:o,switcherMode:i="buttons",selectedEventId:l,onEventSelect:s,onDateChange:d,detailPanelEventId:c,onDetailPanelToggle:u})=>{const h=e.getEvents(),{screenSize:m}=Et(),g="desktop"!==m,[f,v]=r.useState(!1),{hourHeight:p=jr.HOUR_HEIGHT,firstHour:y=jr.FIRST_HOUR,lastHour:D=jr.LAST_HOUR,allDayHeight:w=jr.ALL_DAY_HEIGHT,showAllDay:b=!0,timeFormat:E="24h",secondaryTimeZone:T,showEventDots:S=!0}=t,M=p,x=y,k=D,N=w,I=!b;r.useEffect(()=>{v("ontouchstart"in window||navigator.maxTouchPoints>0)},[]);const R=e.getCustomMobileEventRenderer()||sa,[O,H]=r.useState(null),[P,A]=r.useState(null),[L,$]=r.useState(null),F=void 0===l?P:l,Y=void 0===c?L:c,j=r.useMemo(()=>F&&h.find(e=>e.id===F)||null,[F,h]),V=e=>{s?s(e):A(e)},[_,Z]=r.useState(null),[z,W]=r.useState(!1),[U,B]=r.useState(null),q=r.useRef(null),G=e.getCurrentDate(),[J,Q]=r.useState(G),ee=r.useRef(G.getTime());G.getTime()!==ee.current&&(ee.current=G.getTime(),G.getFullYear()===J.getFullYear()&&G.getMonth()===J.getMonth()||Q(G));const ne=r.useCallback(t=>{Q(n=>{const a=new Date(n.getFullYear(),n.getMonth()+t,1);return e.setVisibleMonth(a),a})},[e]),ae=r.useRef(e.state.highlightedEventId);r.useEffect(()=>{var t;if(e.state.highlightedEventId!==ae.current)if(e.state.highlightedEventId){V(e.state.highlightedEventId);const n=e.getEvents().find(t=>t.id===e.state.highlightedEventId);if(n&&!n.allDay){const e=C(n.start),a=null===(t=o.current)||void 0===t?void 0:t.querySelector(".df-calendar-content");if(a){const t=(e-x)*M;requestAnimationFrame(()=>{a.scrollTo({top:Math.max(0,t-100),behavior:"smooth"})})}}}else ae.current&&F===ae.current&&V(null);ae.current=e.state.highlightedEventId},[e.state.highlightedEventId,x,M,o,e]);const oe=r.useRef(null),ie=r.useRef(null),ue=r.useMemo(()=>Yr(G),[G]),he=e.timeZone,me=r.useMemo(()=>((e,t,n,a)=>{const r=new Date(t);r.setHours(0,0,0,0);const o=new Date(t);o.setHours(23,59,59,999);const i=e=>a?X(e,a):K(e);return e.filter(e=>{var t;const n=i(e.start),a=i(null!==(t=e.end)&&void 0!==t?t:e.start);if(e.allDay){const e=new Date(n);e.setHours(0,0,0,0);const t=new Date(a);return t.setHours(0,0,0,0),e<=o&&t>=r}return n<o&&a>r}).map(e=>{const t=i(e.start),a=Math.floor((t.getTime()-n.getTime())/864e5),r=Math.max(0,Math.min(6,a));return Object.assign(Object.assign({},e),{day:r})})})(h,G,ue,he),[h,G,ue,he]),ge=r.useMemo(()=>((e,t,n)=>{const a=new Date(t);a.setHours(0,0,0,0);const r=new Date(a);r.setDate(r.getDate()+1);const o=e=>n?X(e,n):K(e);return e.filter(e=>!e.allDay).map(e=>{var t;const i=o(e.start),l=o(null!==(t=e.end)&&void 0!==t?t:e.start);let s=te(i,n),d=te(l,n);return i<a&&(s=te(a,n)),l>r&&(d=te(r,n)),Object.assign(Object.assign({},e),{start:s,end:d,day:0})})})(me,G,he),[me,G,he]),fe=r.useMemo(()=>$r.calculateDayEventLayouts(ge,{viewType:"day"}),[ge]),ve=r.useMemo(()=>((e,t)=>{const n=e.filter(e=>e.allDay);if(t)n.sort(t);else{const e=new Map;n.forEach(t=>{e.has(t.calendarId)||e.set(t.calendarId,e.size)}),n.sort(wt(n,(t,n)=>{var a,r;return(null!==(a=e.get(t.calendarId))&&void 0!==a?a:0)-(null!==(r=e.get(n.calendarId))&&void 0!==r?r:0)}))}const a=[],r=[];return n.forEach(e=>{let t=0,n=!1;for(;!n;)a[t]?a[t].some(t=>{const n=K(e.start),a=K(e.end),r=K(t.start);return n<=K(t.end)&&r<=a})?t++:(a[t].push(e),r.push(Object.assign(Object.assign({},e),{row:t})),n=!0):(a[t]=[e],r.push(Object.assign(Object.assign({},e),{row:t})),n=!0)}),r})(me,e.state.allDaySortComparator),[me,e.state.allDaySortComparator]),pe=r.useMemo(()=>{if(0===ve.length)return N;return(Math.max(...ve.map(e=>e.row))+1)*N},[ve,N]),{handleMoveStart:ye,handleCreateStart:De,handleResizeStart:we,handleCreateAllDayEvent:be,dragState:Ee,isDragging:Ce}=zr(e,{calendarRef:o,allDayRowRef:b?oe:void 0,timeGridRef:ie,viewType:exports.ViewType.DAY,onEventsUpdate:(t,n,a)=>{const r=t(me),o=new Set(r.map(e=>e.id)),i=me.filter(e=>!o.has(e.id)),l=new Set(me.map(e=>e.id)),s=r.filter(e=>!l.has(e.id)),d=r.filter(e=>{if(!l.has(e.id))return!1;const t=h.find(t=>t.id===e.id);return t&&ke(t,e)});e.applyEventsChanges({delete:i.map(e=>e.id),add:s,update:d.map(e=>({id:e.id,updates:e}))},void 0,a)},onEventCreate:t=>{g?(B(t),W(!0)):(e.addEvent(t),Z(t.id))},onEventEdit:()=>{},currentWeekStart:ue,events:me,calculateNewEventLayout:(e,t,n)=>((e,t,n,a,r,o)=>{const i=new Date(a),l=new Date(a);i.setHours(Math.floor(t),t%1*60,0,0),l.setHours(Math.floor(n),n%1*60,0,0);const s=[...r,{id:"-1",title:"Temp",day:0,start:te(i,o),end:te(l,o),calendarId:"blue",allDay:!1}];return $r.calculateDayEventLayouts(s,{viewType:"day"}).get("-1")||null})(0,t,n,G,ge,he),calculateDragLayout:(e,t,n,a)=>((e,t,n,a,r,o,i)=>{const l=o.filter(t=>t.id!==e.id),s=new Date(r),d=new Date(s);d.setHours(Math.floor(n),n%1*60,0,0);const c=new Date(s);c.setHours(Math.floor(a),a%1*60,0,0);const u=[...l,Object.assign(Object.assign({},e),{start:te(d,i),end:te(c,i),day:0})];return 0===u.length?null:$r.calculateDayEventLayouts(u,{viewType:"day"}).get(e.id)||null})(e,0,n,a,G,ge,he),TIME_COLUMN_WIDTH:T&&!g?88:g?48:80,isMobile:g}),{handleDrop:Te,handleDragOver:Se}=Vr({app:e,onEventCreated:e=>{Z(e.id)}}),Me=Array.from({length:24},(e,t)=>({hour:t+x,label:re(t+x,0,E)})),xe=r.useMemo(()=>T?le(Me,T,E,G,he):void 0,[T,E,x,G,he]),Ne=r.useMemo(()=>T?se(he,G):void 0,[T,he,G]),Ie=r.useMemo(()=>T?se(T,G):void 0,[T,G]),Re=r.useCallback(t=>{const n=new Date(t.getFullYear(),t.getMonth(),t.getDate());e.setCurrentDate(n),Q(new Date(n.getFullYear(),n.getMonth(),1))},[e]),Oe=r.useMemo(()=>{const e=ce(he);return G.toDateString()===e.toDateString()},[G,he]);return r.useLayoutEffect(()=>{var e;if(t.scrollToCurrentTime){const t=null===(e=o.current)||void 0===e?void 0:e.querySelector(".df-calendar-content");if(t){const e=de(he),n=e.getHours()+e.getMinutes()/60,a=t.clientHeight;t.scrollTop=Math.max(0,(n-x)*M-a/2)}}},[he,t.scrollToCurrentTime,x,M]),r.useEffect(()=>{H(de(he));const e=setInterval(()=>H(de(he)),6e4);return()=>clearInterval(e)},[he]),ze("div",{className:"df-day-view",children:[ze(ar,{app:e,currentDate:G,currentWeekStart:ue,events:h,currentDayEvents:me,organizedAllDayEvents:ve,allDayAreaHeight:pe,timeSlots:Me,eventLayouts:fe,isToday:Oe,currentTime:O,selectedEventId:F,setSelectedEventId:V,newlyCreatedEventId:_,setNewlyCreatedEventId:Z,detailPanelEventId:Y,setDetailPanelEventId:e=>{u?u(e):$(e)},dragState:Ee,isDragging:Ce,handleMoveStart:ye,handleResizeStart:we,handleCreateStart:De,handleCreateAllDayEvent:be,handleTouchStart:(e,t)=>{if(!g&&!f)return;const n=e.touches[0],a=n.clientX,r=n.clientY,i=e.currentTarget;q.current=setTimeout(()=>{var e,n,l;const s=null===(n=null===(e=o.current)||void 0===e?void 0:e.querySelector(".df-calendar-content"))||void 0===n?void 0:n.getBoundingClientRect();if(!s)return;const d=null===(l=o.current)||void 0===l?void 0:l.querySelector(".df-calendar-content"),c=d?d.scrollTop:0,u=r-s.top+c;null==De||De({preventDefault:()=>{},stopPropagation:()=>{},touches:[{clientX:a,clientY:r}],changedTouches:[{clientX:a,clientY:r}],target:i,currentTarget:i,cancelable:!0},t,x+u/M)},500)},handleTouchEnd:()=>{q.current&&(clearTimeout(q.current),q.current=null)},handleTouchMove:()=>{q.current&&(clearTimeout(q.current),q.current=null)},handleDragOver:Se,handleDrop:Te,handleEventUpdate:t=>e.updateEvent(t.id,t),handleEventDelete:t=>e.deleteEvent(t),onDateChange:d,customDetailPanelContent:n,customEventDetailDialog:a,calendarRef:o,allDayRowRef:oe,timeGridRef:ie,switcherMode:i,isMobile:g,isTouch:f,setDraftEvent:B,setIsDrawerOpen:W,ALL_DAY_HEIGHT:N,HOUR_HEIGHT:M,FIRST_HOUR:x,LAST_HOUR:k,showAllDay:b,showStartOfDayLabel:I,timeFormat:E,secondaryTimeSlots:xe,primaryTzLabel:Ne,secondaryTzLabel:Ie,appTimeZone:he}),ze(rr,{app:e,currentDate:G,visibleMonth:J,currentDayEvents:me,selectedEvent:j,setSelectedEvent:e=>V(e?e.id:null),handleMonthChange:ne,handleDateSelect:Re,switcherMode:i,timeFormat:E,showEventDots:S,appTimeZone:he,calendarRef:o}),ze(R,{isOpen:z,onClose:()=>{W(!1),B(null)},onSave:t=>{h.some(e=>e.id===t.id)?e.updateEvent(t.id,t):e.addEvent(t),W(!1),B(null)},draftEvent:U,app:e,timeFormat:E})]})},Ur=({originalComponent:e,app:t,viewType:n,config:a,customDetailPanelContent:o,customEventDetailDialog:i,calendarRef:l,switcherMode:s,meta:d,selectedEventId:c,detailPanelEventId:u,onEventSelect:h,onDateChange:m,onDetailPanelToggle:g})=>{const f=t.getPlugin("events"),v=t.getPlugin("drag"),p=t.getCurrentDate(),y=t.state.currentView,D=t.getEvents(),w=r.useCallback(e=>f?f.update(e.id,e):t.updateEvent(e.id,e),[f,t]),b=r.useCallback(e=>f?f.delete(e):t.deleteEvent(e),[f,t]),E=r.useCallback(e=>{f?f.add(e):t.addEvent(e)},[f,t]),C=r.useCallback(e=>{m?m(e):t.setCurrentDate(e)},[t,m]),T=r.useCallback(e=>{t.changeView(e)},[t]),S=r.useMemo(()=>{const e=t.getViewConfig(n);return Object.assign(Object.assign({},e),a)},[a,t.state.views,n]),M=r.useMemo(()=>({app:t,currentDate:p,currentView:y,events:D,onEventUpdate:w,onEventDelete:b,onEventCreate:E,onDateChange:C,onViewChange:T,config:S,customDetailPanelContent:o,customEventDetailDialog:i,calendarRef:l,switcherMode:s,meta:d,selectedEventId:c,detailPanelEventId:u,onEventSelect:h,onDetailPanelToggle:g}),[t,p,y,D,w,b,E,C,T,S,o,i,l,s,d,c,u,h,g]),x=r.useMemo(()=>{const e={currentDate:p,events:D,setEvents:e=>{D.forEach(e=>b(e.id)),e.forEach(e=>E(e))},updateEvent:w,deleteEvent:b,addEvent:E,goToPrevious:()=>{const e=new Date(p);switch(y){case exports.ViewType.DAY:e.setDate(e.getDate()-1);break;case exports.ViewType.WEEK:e.setDate(e.getDate()-7);break;case exports.ViewType.MONTH:e.setMonth(e.getMonth()-1)}C(e)},goToNext:()=>{const e=new Date(p);switch(y){case exports.ViewType.DAY:e.setDate(e.getDate()+1);break;case exports.ViewType.WEEK:e.setDate(e.getDate()+7);break;case exports.ViewType.MONTH:e.setMonth(e.getMonth()+1)}C(e)},goToToday:()=>{C(new Date)},changeView:T,selectDate:C};return Object.assign(Object.assign({calendar:e},M),{eventsService:f,dragService:v})},[p,D,y,w,b,E,C,T,M,f,v]);return ze(e,Object.assign({},x))},Br={},qr=e=>n.h(Ur,Object.assign(Object.assign({},e),{viewType:exports.ViewType.DAY,originalComponent:Wr,className:"df-day-view-factory"}));qr.displayName="DayViewAdapter";const Gr=(e={})=>{const t=Object.assign(Object.assign({},Br),e);return{type:exports.ViewType.DAY,component:qr,config:t}},Kr=e=>{const t=e.toLowerCase();return t.startsWith("tu")||t.startsWith("th")||t.startsWith("sa")||t.startsWith("su")?e.slice(0,2):e.slice(0,1)},Xr=({app:e,fullWeekDates:t=[],mobilePageStart:a,onDateChange:r})=>ze("div",{className:"df-compact-header",children:[ze("div",{className:"df-compact-header-labels",children:t.map((e,t)=>ze("div",{className:"df-compact-header-label-cell",children:ze("span",{className:"df-compact-header-label","data-today":e.isToday?"true":"false",children:Kr(e.dayName)})},`label-${t}`))}),ze("div",{className:"df-compact-header-dates",children:(()=>{if(!a)return null;const o=t.findIndex(e=>e.fullDate.getTime()===a.getTime()),i=-1===o?"0":`calc(${(o+.5)/7*100}% - 16px)`,l=`calc(${1/7*100}% + 32px)`;return ze(n.Fragment,{children:[ze("div",{className:"df-compact-header-capsule",style:{left:i,top:0,width:l,height:"32px"}}),t.map((t,n)=>{const a=t.isCurrent,i=n>=o&&n<o+2;return ze("div",{className:"df-compact-header-date-button",style:{height:"32px"},onClick:()=>{e.setCurrentDate(t.fullDate),null==r||r(t.fullDate)},children:ze("div",{className:"df-compact-header-date-pill","data-selected":a?"true":"false","data-today":t.isToday?"true":"false","data-inside-pill":i?"true":"false",children:[t.date,t.isToday&&!a&&ze("div",{className:"df-compact-header-today-dot"})]})},`date-${n}`)})]})})()})]}),Jr=({app:e,weekDaysLabels:t,mobileWeekDaysLabels:a,weekDates:o,fullWeekDates:i,isSlidingView:l,mobilePageStart:s,currentWeekStart:d,gridWidth:c,allDayAreaHeight:u,organizedAllDaySegments:h,allDayLabelText:m,isMobile:g,isTouch:f,showAllDay:v=!0,calendarRef:p,allDayRowRef:y,topFrozenContentRef:D,ALL_DAY_HEIGHT:w,HOUR_HEIGHT:b,FIRST_HOUR:E,dragState:C,isDragging:T,primaryTzLabel:S,secondaryTzLabel:M,secondaryTimeSlots:x,handleMoveStart:k,handleResizeStart:N,handleEventUpdate:I,handleEventDelete:R,setDraftEvent:O,setIsDrawerOpen:H,onDateChange:P,newlyCreatedEventId:A,setNewlyCreatedEventId:L,selectedEventId:$,setSelectedEventId:F,detailPanelEventId:Y,setDetailPanelEventId:j,handleCreateAllDayEvent:V,handleDragOver:_,handleDrop:Z,customDetailPanelContent:z,customEventDetailDialog:W})=>{const U={flexShrink:0},[B,q]=r.useState(null),G=r.useMemo(()=>Be(),[]),K=!!x&&x.length>0&&!g,X=e.canMutateFromUI();r.useEffect(()=>{X||q(null)},[X]);return ze("div",{className:"df-week-all-day",children:[l&&i&&s&&ze(Xr,{app:e,fullWeekDates:i,mobilePageStart:s,onDateChange:P}),ze("div",{className:"df-week-all-day-shell","data-show-all-day":v?"true":"false",onContextMenu:e=>e.preventDefault(),children:[v&&ze("div",{className:"df-week-all-day-side",onContextMenu:e=>e.preventDefault(),children:[ze("div",{className:"df-week-all-day-side-spacer","data-sliding-view":l?"true":"false",children:K&&ze("div",{className:"df-time-column-tz-header df-time-column-tz-header-compact",children:[ze("span",{className:"df-time-column-tz-label",children:M}),ze("span",{className:"df-time-column-tz-label",children:S})]})}),ze("div",{className:`${At} df-week-all-day-label`,style:{minHeight:`${u}px`},children:m})]}),ze("div",{className:"df-week-all-day-content-wrap",style:{scrollbarGutter:"stable",minHeight:v?`${u+(l?0:36)}px`:"auto"},children:ze("div",{ref:D,className:"df-week-all-day-content",style:{width:c,minWidth:"100%",transform:l?"translateX(calc(-100% / 3))":void 0},children:[!l&&ze("div",{className:"df-week-header","data-scrollbar-space":G?"true":"false",style:{marginRight:G?"-50px":"0px",paddingRight:G?"50px":"0px"},children:t.map((e,t)=>ze("div",{className:"df-week-day-cell df-week-all-day-weekday-cell","data-mobile":g?"true":"false",style:U,children:ze(n.Fragment,g?{children:[ze("div",{className:"df-week-all-day-weekday-label",children:a[t]}),ze("div",{className:`${xt} df-week-all-day-date-number df-week-all-day-date-number-mobile`,"data-today":o[t].isToday?"true":void 0,children:o[t].date})]}:{children:[ze("div",{className:"df-week-all-day-weekday-name",children:e}),ze("div",{className:`${xt} df-week-all-day-date-number`,"data-today":o[t].isToday?"true":void 0,children:o[t].date})]})},t))}),v&&ze("div",{className:`${Pt} df-week-all-day-row`,ref:y,style:{minHeight:`${u}px`},children:ze("div",{className:"df-all-day-content df-week-all-day-row-content","data-scrollbar-space":g||!G?"false":"true",style:{minHeight:`${u}px`},children:[t.map((e,n)=>{const a=new Date(d);return a.setDate(d.getDate()+n),ze("div",{className:"df-all-day-cell df-week-all-day-cell "+(n!==t.length-1||!g&&G?"":"df-week-all-day-cell-no-border"),style:Object.assign({minHeight:`${u}px`},U),onMouseDown:e=>null==V?void 0:V(e,n),onDblClick:e=>null==V?void 0:V(e,n),onDragOver:_,onDrop:e=>{Z(e,a,void 0,!0)},onContextMenu:e=>((e,t)=>{if(e.preventDefault(),g||!X)return;const n=new Date(d);n.setDate(d.getDate()+t),n.setHours(0,0,0,0),q({x:e.clientX,y:e.clientY,date:n})})(e,n)},`allday-${n}`)}),ze("div",{className:"df-week-all-day-event-layer",children:h.map(n=>ze(Ja,{event:n.event,segment:n,segmentIndex:n.row,isAllDay:!0,isMultiDay:!0,allDayHeight:w,calendarRef:p,viewType:exports.ViewType.WEEK,columnsPerRow:t.length,isBeingDragged:T&&(null==C?void 0:C.eventId)===n.event.id&&"move"===(null==C?void 0:C.mode),hourHeight:b,firstHour:E,onMoveStart:k,onResizeStart:N,onEventUpdate:I,onEventDelete:R,newlyCreatedEventId:A,onDetailPanelOpen:()=>L(null),selectedEventId:$,detailPanelEventId:Y,onEventSelect:t=>{var n;const a=!1!==e.getReadOnlyConfig(null!=t?t:void 0).viewable,r=null===(n=h.find(e=>e.event.id===t))||void 0===n?void 0:n.event;if((g||f)&&r&&a)return O(r),void H(!0);F(t)},onEventLongPress:e=>{(g||f)&&F(e)},onDetailPanelToggle:e=>j(e),customDetailPanelContent:z,customEventDetailDialog:W,app:e,isMobile:g,isSlidingView:l,enableTouch:f},n.event.id))})]})})]})}),X&&B&&ze(Na,{x:B.x,y:B.y,date:B.date,viewType:exports.ViewType.WEEK,onClose:()=>q(null),app:e,onCreateEvent:()=>{const e=Math.floor((B.date.getTime()-d.getTime())/864e5);null==V||V({clientX:B.x,clientY:B.y},e)}})]})]})},Qr=({app:e,timeSlots:t,weekDaysLabels:a,currentWeekStart:o,currentWeekEvents:i,eventLayouts:l,gridWidth:s,isMobile:d,isTouch:c,scrollerRef:u,timeGridRef:h,leftFrozenContentRef:m,swipeContentRef:g,calendarRef:f,handleScroll:v,handleCreateStart:p,handleTouchStart:y,handleTouchEnd:D,handleTouchMove:w,handleDragOver:b,handleDrop:E,dragState:C,isDragging:T,handleMoveStart:S,handleResizeStart:M,handleEventUpdate:x,handleEventDelete:k,setDraftEvent:N,setIsDrawerOpen:I,onDateChange:R,newlyCreatedEventId:O,setNewlyCreatedEventId:H,selectedEventId:P,setSelectedEventId:A,detailPanelEventId:L,setDetailPanelEventId:$,customDetailPanelContent:F,customEventDetailDialog:Y,isSlidingView:j,isCurrentWeek:V,currentTime:_,HOUR_HEIGHT:Z,FIRST_HOUR:z,LAST_HOUR:W,showStartOfDayLabel:U,timeFormat:B="24h",secondaryTimeSlots:q,appTimeZone:G})=>{var K,X;const J=!!q&&q.length>0&&!d,Q={flexShrink:0},ee=r.useRef(e.state.highlightedEventId),[te,ne]=r.useState(null),ae=r.useMemo(()=>Be(),[]),oe=e.canMutateFromUI();r.useEffect(()=>{oe||ne(null)},[oe]);const ie=e=>{if(!h.current)return z;const t=h.current.getBoundingClientRect();return z+(e-t.top)/Z};return ze("div",{className:"df-week-time-grid",children:[ze("div",{ref:u,className:"df-calendar-content df-week-time-grid-scroller df-week-time-grid-scroller-shell","data-sliding-view":"300%"===s?"true":"false",style:{gridTemplateColumns:"auto 1fr"},onScroll:v,children:[ze("div",{ref:m,className:"df-week-time-grid-time-column","data-secondary-tz":J?"true":"false",onContextMenu:e=>e.preventDefault(),children:[ze("div",{className:"df-time-column-spacer df-time-week-column-spacer","data-secondary-tz":J?"true":"false",children:J?ze(n.Fragment,{children:ze("div",{className:"df-time-column-tz-row df-time-column-tz-row-boundary",children:[ze("span",{className:"df-time-column-tz-value",children:U&&null!==(K=null==q?void 0:q[0])&&void 0!==K?K:""}),ze("span",{className:"df-time-column-tz-value",children:U?re(z,0,B):""})]})}):ze("div",{className:"df-time-column-boundary-label",children:U?re(z,0,B):""})}),t.map((e,t)=>{var n;return ze("div",{className:Nt,children:ze("div",J?{className:"df-time-column-tz-row",children:[ze("span",{className:"df-time-column-tz-value",children:U&&0===t?"":null!==(n=null==q?void 0:q[t])&&void 0!==n?n:""}),ze("span",{className:"df-time-column-tz-value",children:U&&0===t?"":e.label})]}:{className:It,children:U&&0===t?"":e.label})},t)}),ze("div",{className:"df-week-time-grid-boundary-tail",children:ze("div",J?{className:"df-time-column-tz-row",children:[ze("span",{className:"df-time-column-tz-value",children:null!==(X=null==q?void 0:q[0])&&void 0!==X?X:""}),ze("span",{className:"df-time-column-tz-value",children:re(0,0,B)})]}:{className:It,children:re(0,0,B)})}),V&&_&&(()=>{const e=_,t=e.getHours()+e.getMinutes()/60;if(t<z||t>W)return null;return ze("div",{className:"df-week-time-grid-current-time-label",style:{top:`${(t-z)*Z}px`,marginTop:"0.75rem"},children:ze("div",{className:Ht,children:re(t,0,B,!1)})})})()]}),ze("div",{ref:g,className:"df-week-time-grid-content",style:{width:s,minWidth:"100%",transform:j?"translateX(calc(-100% / 3))":void 0},children:ze("div",{className:"df-week-time-grid-grid",children:[ze("div",{className:`${zt} df-time-grid-boundary-top df-week-time-grid-boundary-row`,"data-scrollbar-space":d||!ae?"false":"true",children:a.map((e,t)=>ze("div",{className:"df-week-time-grid-boundary-cell",style:Q},`boundary_${t}`))}),ze("div",{ref:h,className:"df-week-time-grid-grid-inner",children:[V&&_&&(()=>{const e=_,t=e.getHours()+e.getMinutes()/60;if(t<z||t>W)return null;const n=new Date(e);n.setHours(0,0,0,0);const r=new Date(o);r.setHours(0,0,0,0);const i=n.getTime()-r.getTime(),l=Math.round(i/864e5);return ze("div",{className:Ot,style:{top:`${(t-z)*Z}px`,height:0,zIndex:20},children:[ze("div",{className:"df-week-time-grid-current-time-spacer"}),ze("div",{className:"df-week-time-grid-current-time-track",children:a.map((e,t)=>ze("div",{className:"df-week-time-grid-current-time-cell",children:ze("div",{className:"df-week-time-grid-current-line-rail","data-today":t===l?"true":"false",style:{zIndex:9999},children:t===l&&0!==l&&ze("div",{className:"df-week-time-grid-current-line-dot"})})},t))})]})})(),t.map((e,t)=>ze("div",{className:Rt,"data-scrollbar-space":d||!ae?"false":"true",children:a.map((n,a)=>{const r=new Date(o);return r.setDate(o.getDate()+a),ze("div",{className:"df-time-grid-cell df-week-time-grid-cell",style:Q,onClick:()=>{const e=new Date(o);e.setDate(o.getDate()+a),null==R||R(e)},onMouseDown:e=>{tr(e,a,ie(e.clientY),c,p)},onDblClick:e=>{null==p||p(e,a,ie(e.clientY)),nr()},onTouchStart:t=>y(t,a,e.hour),onTouchEnd:D,onTouchMove:w,onDragOver:b,onDrop:t=>{E(t,r,e.hour)},onContextMenu:t=>((e,t,n)=>{if(e.preventDefault(),d||!oe)return;const a=new Date(o);if(a.setDate(o.getDate()+t),h.current){const t=h.current.getBoundingClientRect(),n=(e.clientY-t.top)/Z+z,r=Math.floor(n),o=Math.floor(60*(n-r)),i=15*Math.round(o/15),l=60===i?r+1:r,s=60===i?0:i;a.setHours(l,s,0,0)}else a.setHours(n,0,0,0);ne({x:e.clientX,y:e.clientY,date:a})})(t,a,e.hour)},`${t}-${a}`)})},t)),ze("div",{className:`${zt} df-time-grid-boundary-bottom df-week-time-grid-boundary-row`,"data-scrollbar-space":d||!ae?"false":"true",children:a.map((e,t)=>ze("div",{className:"df-week-time-grid-boundary-cell",style:Q},`24-${t}`))}),a.map((t,n)=>{const r=a.length,s=Ee(n,i),u=[];return s.forEach(e=>{const t=$a(e,o,a.length,G);if(t.length>0){const a=t.find(e=>e.dayIndex===n);a&&u.push({event:e,segmentInfo:Object.assign(Object.assign({},a),{dayIndex:n})})}else u.push({event:e})}),i.forEach(e=>{if(e.allDay||e.day===n)return;const t=$a(e,o,a.length,G).find(e=>e.dayIndex===n);t&&u.push({event:e,segmentInfo:Object.assign(Object.assign({},t),{dayIndex:n})})}),ze("div",{className:"df-week-time-grid-event-layer",style:{left:`calc(${100/r*n}%)`,width:100/r+"%",height:"100%"},children:u.map(({event:t,segmentInfo:a})=>{const o=l.get(n),s=null==o?void 0:o.get(t.id);return ze(Ja,{event:t,layout:s,viewType:exports.ViewType.WEEK,calendarRef:f,columnsPerRow:r,isBeingDragged:T&&(null==C?void 0:C.eventId)===t.id&&"move"===(null==C?void 0:C.mode),hourHeight:Z,firstHour:z,onMoveStart:S,onResizeStart:M,onEventUpdate:x,onEventDelete:k,newlyCreatedEventId:O,onDetailPanelOpen:()=>H(null),selectedEventId:P,detailPanelEventId:L,onEventSelect:t=>{const n=!1!==e.getReadOnlyConfig(null!=t?t:void 0).viewable,a=i.find(e=>e.id===t);if((d||c)&&a&&n)return N(a),void I(!0);A(t),e.state.highlightedEventId&&(e.highlightEvent(null),ee.current=null)},onEventLongPress:e=>{(d||c)&&A(e)},onDetailPanelToggle:e=>$(e),customDetailPanelContent:F,customEventDetailDialog:Y,multiDaySegmentInfo:a,app:e,isMobile:d,isSlidingView:j,enableTouch:c,appTimeZone:G},a?`${t.id}-seg-${n}`:t.id)})},`events-day-${n}`)})]})]})})]}),oe&&te&&ze(Na,{x:te.x,y:te.y,date:te.date,viewType:exports.ViewType.WEEK,onClose:()=>ne(null),app:e,onCreateEvent:()=>{if(p){const e=new Date(o);e.setHours(0,0,0,0);const t=new Date(te.date);t.setHours(0,0,0,0);const n=t.getTime()-e.getTime(),a=Math.round(n/864e5),r=te.date.getHours()+te.date.getMinutes()/60,i={preventDefault:()=>{},stopPropagation:()=>{},clientX:te.x,clientY:te.y};p(i,a,r)}}})]})},eo=e=>{const n=t.Temporal.Now.plainDateISO(e);return new Date(n.year,n.month-1,n.day).toDateString()},to=({app:e,config:t,customDetailPanelContent:n,customEventDetailDialog:a,calendarRef:o,selectedEventId:i,onEventSelect:l,onDateChange:s,detailPanelEventId:d,onDetailPanelToggle:c})=>{var u;const{t:h,getWeekDaysLabels:m,locale:g}=Tt(),f=e.getCurrentDate(),v=r.useMemo(()=>f,[f.getTime()]),p=e.getEvents(),{screenSize:y}=Et(),D="desktop"!==y,w=r.useRef(null),[b,E]=r.useState(!1),{hourHeight:S=jr.HOUR_HEIGHT,firstHour:M=jr.FIRST_HOUR,lastHour:x=jr.LAST_HOUR,allDayHeight:k=jr.ALL_DAY_HEIGHT,showAllDay:N=!0,timeFormat:I="24h",secondaryTimeZone:R}=t,O=R&&"mobile"!==y?88:"mobile"===y?48:80,H=S,P=M,A=x,L=k,$=!N;r.useEffect(()=>{E("ontouchstart"in window||navigator.maxTouchPoints>0)},[]);const F=e.getCustomMobileEventRenderer()||sa,Y="desktop"!==y,j=Y?2:7,V=Y,_=null!==(u=t.startOfWeek)&&void 0!==u?u:1,Z=V?"300%":"100%",z=r.useMemo(()=>Yr(v,_),[v,_]),W=V?3*j:7,[U,B]=r.useState(null),[q,G]=r.useState(null),[J,Q]=r.useState(null),ee=void 0===i?q:i,ne=void 0===d?J:d,ae=e=>{l?l(e):G(e)},oe=e=>{c?c(e):Q(e)},[ie,ue]=r.useState(null),[he,me]=r.useState(!1),[ge,fe]=r.useState(null),ve=r.useRef(null),pe=r.useRef(null),ye=r.useRef(null),De=r.useRef(null),we=r.useRef(null),be=r.useRef(null),{handleScroll:Ee,goToNext:Te,goToPrevious:Se,mobilePageStart:Me}=(({app:e,columnsPerPage:t,currentDate:n,displayDays:a,isSlidingView:o,scrollerRef:i,swipeContentRef:l,topFrozenContentRef:s})=>{const[d,c]=r.useState(()=>{const e=new Date(n);return e.setHours(0,0,0,0),e}),[u,h]=r.useState(0),[m,g]=r.useState(!1),f=r.useRef({x:0,y:0}),v=r.useRef(!1),p=r.useRef(0);r.useEffect(()=>{o&&c(e=>{const a=new Date(n);a.setHours(0,0,0,0);const r=new Date(e),o=new Date(e);return o.setDate(o.getDate()+t-1),a>=r&&a<=o?e:a})},[t,n,o]);const y=r.useCallback(e=>{const{scrollLeft:t}=e.currentTarget;if(!s.current)return;const n=o?"calc(-100% / 3)":"0px",a=o?`${u}px`:`-${t}px`;s.current.style.transform=`translateX(calc(${n} + ${a}))`,s.current.style.transition=o&&m?"transform 0.3s ease-out":"none"},[o,m,u,s]);r.useEffect(()=>{if(!o)return;const t=i.current;if(!t)return;const n=e=>{f.current={x:e.touches[0].clientX,y:e.touches[0].clientY},v.current=!1,p.current=0,g(!1)},r=e=>{if(m)return;const n=e.touches[0].clientX-f.current.x,a=e.touches[0].clientY-f.current.y;if(!v.current&&Math.abs(n)>10&&Math.abs(n)>Math.abs(a)&&(v.current=!0),v.current){e.cancelable&&e.preventDefault();const a=t.clientWidth/2,r=Math.max(-a,Math.min(a,n)),o=`translateX(calc(-100% / 3 + ${r}px))`;s.current&&(s.current.style.transition="none",s.current.style.transform=o),l.current&&(l.current.style.transition="none",l.current.style.transform=o),p.current=r}},u=()=>{var n;if(!v.current)return void(p.current=0);const r=p.current,o=((null===(n=l.current)||void 0===n?void 0:n.clientWidth)||t.clientWidth)/a;r>100?(g(!0),h(o),setTimeout(()=>{const t=new Date(d);t.setDate(t.getDate()-1),c(t),e.setCurrentDate(t),h(0),p.current=0,g(!1)},300)):r<-100?(g(!0),h(-o),setTimeout(()=>{const t=new Date(d);t.setDate(t.getDate()+1),c(t),e.setCurrentDate(t),h(0),p.current=0,g(!1)},300)):(g(!0),h(0),p.current=0,setTimeout(()=>{g(!1)},300))};return t.addEventListener("touchstart",n,{passive:!0}),t.addEventListener("touchmove",r,{passive:!1}),t.addEventListener("touchend",u,{passive:!0}),()=>{t.removeEventListener("touchstart",n),t.removeEventListener("touchmove",r),t.removeEventListener("touchend",u)}},[e,a,o,m,d,i,l,s]),r.useEffect(()=>{if(!o)return s.current&&(s.current.style.transform="",s.current.style.transition=""),void(l.current&&(l.current.style.transform="",l.current.style.transition=""));const e=m?"transform 0.3s ease-out":"none",t=`translateX(calc(calc(-100% / 3) + ${u}px))`;s.current&&(s.current.style.transition=e,s.current.style.transform=t),l.current&&(l.current.style.transition=e,l.current.style.transform=t)},[o,m,l,u,s]);const D=r.useCallback(()=>{if(!o)return!1;const t=new Date(n);return t.setDate(t.getDate()-1),c(e=>{const t=new Date(e);return t.setDate(t.getDate()-1),t}),e.setCurrentDate(t),!0},[e,n,o]);return{handleScroll:y,goToNext:r.useCallback(()=>{if(!o)return!1;const t=new Date(n);return t.setDate(t.getDate()+1),c(e=>{const t=new Date(e);return t.setDate(t.getDate()+1),t}),e.setCurrentDate(t),!0},[e,n,o]),goToPrevious:D,mobilePageStart:d}})({app:e,columnsPerPage:j,currentDate:v,displayDays:W,isSlidingView:V,scrollerRef:ye,swipeContentRef:be,topFrozenContentRef:De}),xe=V?Me:z,Ne=r.useMemo(()=>{if(!V)return xe;const e=new Date(xe);return e.setDate(e.getDate()-j),e},[j,xe,V]),Ie=e.timeZone,Re=r.useMemo(()=>((e,t,n=7,a)=>{const r=new Date(t);r.setDate(t.getDate()+(n-1)),r.setHours(23,59,59,999);const o=e=>a?X(e,a):K(e);return e.filter(e=>{var n;const a=o(e.start);a.setHours(0,0,0,0);const i=o(null!==(n=e.end)&&void 0!==n?n:e.start);return i.setHours(23,59,59,999),i>=t&&a<=r}).map(e=>{const a=o(e.start),r=Math.floor((a.getTime()-t.getTime())/864e5),i=Math.max(0,Math.min(n-1,r));return Object.assign(Object.assign({},e),{day:i})})})(p,Ne,W,Ie),[p,Ne,W,Ie]),Oe=r.useRef(e.state.highlightedEventId);r.useEffect(()=>{if(e.state.highlightedEventId!==Oe.current)if(e.state.highlightedEventId){ae(e.state.highlightedEventId);const t=Re.find(t=>t.id===e.state.highlightedEventId);if(t&&!t.allDay){const e=C(t.start),n=ye.current;if(n){const t=(e-P)*H;requestAnimationFrame(()=>{n.scrollTo({top:Math.max(0,t-100),behavior:"smooth"})})}}}else Oe.current&&ee===Oe.current&&ae(null);Oe.current=e.state.highlightedEventId},[e.state.highlightedEventId,Re,P,H]);const He=r.useMemo(()=>((e,t,n=7,a)=>{const r=La(e,t,n).filter(e=>e.event.allDay);if(a)r.sort((e,t)=>a(e.event,t.event));else{const e=new Map;r.forEach(t=>{const n=t.event.calendarId;e.has(n)||e.set(n,e.size)});const t=wt(r.map(e=>e.event),(t,n)=>{var a,r;return(null!==(a=e.get(t.calendarId))&&void 0!==a?a:0)-(null!==(r=e.get(n.calendarId))&&void 0!==r?r:0)});r.sort((e,n)=>t(e.event,n.event))}const o=[];return r.forEach(e=>{let t=0,n=!1;for(;!n;){let a=!1;for(const n of o)if(n.row===t&&!(e.endDayIndex<n.startDayIndex||e.startDayIndex>n.endDayIndex)){a=!0;break}a?t++:n=!0}o.push(Object.assign(Object.assign({},e),{row:t}))}),o})(Re,Ne,W,e.state.allDaySortComparator),[Re,Ne,W,e.state.allDaySortComparator]),Pe=r.useMemo(()=>{const e=V?He.filter(e=>e.endDayIndex>=j&&e.startDayIndex<=2*j-1):He;if(0===e.length)return L;const t=Math.max(...e.map(e=>e.row));return L+t*L},[He,L,V,j]),Ae=r.useMemo(()=>Fr(Re,Ne,W,Ie),[Re,Ne,W,Ie]),Le=r.useCallback((t,n,a)=>{const r=t(Re),o=new Set(r.map(e=>e.id)),i=Re.filter(e=>!o.has(e.id)),l=new Set(Re.map(e=>e.id)),s=r.filter(e=>!l.has(e.id)),d=r.filter(e=>{if(!l.has(e.id))return!1;const t=Re.find(t=>t.id===e.id);return t&&ke(t,e)});e.applyEventsChanges({delete:i.map(e=>e.id),add:s,update:d.map(e=>({id:e.id,updates:e}))},n,a)},[Re,e]),$e=r.useCallback(t=>{D?(fe(t),me(!0)):(e.addEvent(t),ue(t.id))},[D,e]),Fe=r.useCallback(()=>{},[]),Ye=r.useCallback((e,t,n)=>((e,t,n,a,r,o=7,i)=>{var l;const s=Ce(r,e),d=Ce(r,e);s.setHours(Math.floor(t),t%1*60,0,0),d.setHours(Math.floor(n),n%1*60,0,0);const c={id:"-1",title:"Temp",day:e,start:te(s,i),end:te(d,i),calendarId:"blue",allDay:!1};return(null===(l=Fr([...a,c],r,o,i).get(e))||void 0===l?void 0:l.get("-1"))||null})(e,t,n,Re,Ne,W,Ie),[Re,Ne,W,Ie]),je=r.useCallback((e,t,n,a)=>((e,t,n,a,r,o,i=7,l)=>{var s;const d=r.map(r=>{if(r.id!==e.id)return r;const i=Ce(o,t),s=T(i,n),d=T(i,a),c=te(s,l),u=te(d,l);return Object.assign(Object.assign({},r),{day:t,start:c,end:u})});return(null===(s=Fr(d,o,i,l).get(t))||void 0===s?void 0:s.get(e.id))||null})(e,t,n,a,Re,Ne,W,Ie),[Re,Ne,W,Ie]),Ve=r.useMemo(()=>({calendarRef:o,allDayRowRef:N?pe:void 0,timeGridRef:w,viewType:exports.ViewType.WEEK,onEventsUpdate:Le,onEventCreate:$e,onEventEdit:Fe,currentWeekStart:Ne,events:Re,calculateNewEventLayout:Ye,calculateDragLayout:je,TIME_COLUMN_WIDTH:O,isMobile:D,gridWidth:Z,displayDays:W}),[o,N,Le,$e,Fe,Ne,Re,Ye,je,O,D,Z,W]),{handleMoveStart:_e,handleCreateStart:Ze,handleResizeStart:We,handleCreateAllDayEvent:Ue,dragState:Be,isDragging:qe}=zr(e,Ve),{handleDrop:Ge,handleDragOver:Ke}=Vr({app:e,onEventCreated:e=>{ue(e.id)}}),Xe=r.useMemo(()=>(({displayDays:e,displayStart:t,getWeekDaysLabels:n,isSlidingView:a,locale:r,startOfWeek:o})=>a?Array.from({length:e},(e,n)=>{const a=new Date(t);return a.setDate(a.getDate()+n),a.toLocaleDateString(r,{weekday:"short"})}):n(r,"short",o))({displayDays:W,displayStart:Ne,getWeekDaysLabels:m,isSlidingView:V,locale:g,startOfWeek:_}),[W,Ne,m,V,g,_]),Je=r.useMemo(()=>((e,t,n,a)=>{if(!e)return[];const r=t.split("-")[0].toLowerCase();return"zh"===r||"ja"===r?n(t,"narrow"):a.map(e=>{if("en"===r){if(e.startsWith("Tu"))return"Tu";if(e.startsWith("Th"))return"Th";if(e.startsWith("Sa"))return"Sa";if(e.startsWith("Su"))return"Su"}return e.charAt(0)})})(D,g,m,Xe),[m,D,g,Xe]),Qe=r.useMemo(()=>h("allDay"),[h]),et=Array.from({length:24},(e,t)=>({hour:t+P,label:re(t+P,0,I)})),tt=r.useMemo(()=>R?le(et,R,I,v,Ie):void 0,[R,I,P,v,Ie]),nt=r.useMemo(()=>R?se(Ie,v):void 0,[R,Ie,v]),at=r.useMemo(()=>R?se(R,v):void 0,[R,v]),rt=r.useMemo(()=>((e,t,n,a)=>{const r=eo(a);return t.map((t,a)=>{const o=new Date(e);return o.setDate(e.getDate()+a),{date:o.getDate(),month:o.toLocaleString(n,{month:"short"}),fullDate:new Date(o),isToday:o.toDateString()===r}})})(Ne,Xe,g,Ie),[Ie,Ne,g,Xe]),ot=r.useMemo(()=>((e,t,n,a)=>{const r=eo(a),o=new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime();return Array.from({length:7},(n,a)=>{const i=new Date(e);i.setDate(e.getDate()+a);const l=new Date(i.getFullYear(),i.getMonth(),i.getDate());return{date:i.getDate(),month:i.toLocaleString(t,{month:"short"}),fullDate:new Date(i),isToday:i.toDateString()===r,isCurrent:l.getTime()===o,dayName:i.toLocaleDateString(t,{weekday:"short"})}})})(z,g,v,Ie),[Ie,v,g,z]),it=t=>e.updateEvent(t.id,t),lt=t=>e.deleteEvent(t),st=r.useMemo(()=>{const e=ce(Ie);e.setHours(0,0,0,0);const t=new Date(Ne);t.setHours(0,0,0,0);const n=new Date(t);return n.setDate(t.getDate()+W),e>=t&&e<n},[Ne,W,Ie]);return r.useLayoutEffect(()=>{if(t.scrollToCurrentTime&&ye.current){const e=ye.current,t=de(Ie),n=t.getHours()+t.getMinutes()/60,a=e.clientHeight;e.scrollTop=Math.max(0,(n-P)*H-a/2)}},[Ie,t.scrollToCurrentTime,P,H]),r.useEffect(()=>{B(de(Ie));const e=setInterval(()=>B(de(Ie)),6e4);return()=>clearInterval(e)},[Ie]),ze("div",{className:"df-calendar df-week-view",children:[ze(er,{calendar:e,viewType:exports.ViewType.WEEK,currentDate:v,onPrevious:()=>{Se()||e.goToPrevious()},onNext:()=>{Te()||e.goToNext()},onToday:()=>e.goToToday()}),ze(Jr,{app:e,weekDaysLabels:Xe,mobileWeekDaysLabels:Je,weekDates:rt,fullWeekDates:ot,isSlidingView:V,mobilePageStart:Me,currentWeekStart:Ne,gridWidth:Z,allDayAreaHeight:Pe,organizedAllDaySegments:He,allDayLabelText:Qe,isMobile:D,isTouch:b,showAllDay:N,calendarRef:o,allDayRowRef:pe,topFrozenContentRef:De,ALL_DAY_HEIGHT:L,HOUR_HEIGHT:H,FIRST_HOUR:P,dragState:Be,isDragging:qe,secondaryTimeSlots:tt,primaryTzLabel:nt,secondaryTzLabel:at,handleMoveStart:_e,handleResizeStart:We,handleEventUpdate:it,handleEventDelete:lt,setDraftEvent:fe,setIsDrawerOpen:me,onDateChange:s,newlyCreatedEventId:ie,setNewlyCreatedEventId:ue,selectedEventId:ee,setSelectedEventId:ae,detailPanelEventId:ne,setDetailPanelEventId:oe,handleCreateAllDayEvent:Ue,handleDragOver:Ke,handleDrop:Ge,customDetailPanelContent:n,customEventDetailDialog:a}),ze(Qr,{app:e,timeSlots:et,weekDaysLabels:Xe,currentWeekStart:Ne,currentWeekEvents:Re,eventLayouts:Ae,gridWidth:Z,isMobile:D,isSlidingView:V,isTouch:b,scrollerRef:ye,timeGridRef:w,leftFrozenContentRef:we,swipeContentRef:be,calendarRef:o,handleScroll:Ee,handleCreateStart:Ze,handleTouchStart:(e,t,n)=>{if(!D&&!b)return;const a=e.touches[0],r=a.clientX,o=a.clientY,i=e.currentTarget;ve.current=setTimeout(()=>{null==Ze||Ze({preventDefault:()=>{},stopPropagation:()=>{},touches:[{clientX:r,clientY:o}],changedTouches:[{clientX:r,clientY:o}],target:i,currentTarget:i,cancelable:!0},t,n)},500)},handleTouchEnd:()=>{ve.current&&(clearTimeout(ve.current),ve.current=null)},handleTouchMove:()=>{ve.current&&(clearTimeout(ve.current),ve.current=null)},handleDragOver:Ke,handleDrop:Ge,dragState:Be,isDragging:qe,handleMoveStart:_e,handleResizeStart:We,handleEventUpdate:it,handleEventDelete:lt,setDraftEvent:fe,setIsDrawerOpen:me,onDateChange:s,newlyCreatedEventId:ie,setNewlyCreatedEventId:ue,selectedEventId:ee,setSelectedEventId:ae,detailPanelEventId:ne,setDetailPanelEventId:oe,customDetailPanelContent:n,customEventDetailDialog:a,isCurrentWeek:st,currentTime:U,HOUR_HEIGHT:H,FIRST_HOUR:P,LAST_HOUR:A,showStartOfDayLabel:$,timeFormat:I,secondaryTimeSlots:tt,appTimeZone:Ie}),ze(F,{isOpen:he,onClose:()=>{me(!1),fe(null)},onSave:t=>{p.some(e=>e.id===t.id)?e.updateEvent(t.id,t):e.addEvent(t),me(!1),fe(null)},draftEvent:ge,app:e,timeFormat:I})]})},no={startOfWeek:1},ao=e=>n.h(Ur,Object.assign(Object.assign({},e),{viewType:exports.ViewType.WEEK,originalComponent:to,className:"df-week-view-factory"}));ao.displayName="WeekViewAdapter";const ro=(e={})=>{const t=Object.assign(Object.assign({},no),e);return{type:exports.ViewType.WEEK,component:ao,config:t}},oo=({app:e,appTimeZone:t,calendarRef:n,currentMonth:a,currentYear:o,customDetailPanelContent:i,customEventDetailDialog:l,day:s,dayIndex:d,dayLayout:c,detailPanelEventId:u,dragState:h,enableTouch:m,hasScrollbarSpace:g,isDragging:f,locale:v,moreLabel:p,newlyCreatedEventId:y,onCalendarDragOver:D,onCalendarDrop:w,onChangeView:b,onContextMenu:E,onCreateStart:T,onDetailPanelOpen:M,onDetailPanelToggle:x,onEventDelete:k,onEventLongPress:N,onEventSelect:I,onEventUpdate:R,onMoreEventsClick:O,onMoveStart:H,onResizeStart:P,onSelectDate:A,organizedMultiDaySegments:L,overlayVisibleLayerCount:$,screenSize:F,selectedEventId:Y,showWeekNumbers:j,totalSlotsNeeded:V,weekHeightPx:_})=>{const Z=r.useRef(null),z=r.useRef(null),W=s.date.toLocaleDateString(v,{month:v.startsWith("zh")||v.startsWith("ja")?"short":"long"})===a&&s.year===o,{hasMore:U,limit:B,timedEventsOnly:q,gapLayers:G,occupiedLayers:K,maxOccupiedLayer:X,segmentIsHidden:J}=c;let Q=0;L.slice(B).forEach(e=>{e.forEach(e=>{e.startDayIndex<=d&&e.endDayIndex>=d&&Q++})}),L.slice(0,B).forEach(e=>{e.forEach(e=>{e.startDayIndex<=d&&e.endDayIndex>=d&&J.has(e.id)&&Q++})});const ee=G.filter(e=>e<B).length,te=L.slice(0,B).filter(e=>e.some(e=>e.startDayIndex<=d&&e.endDayIndex>=d&&J.has(e.id))).length,ne=Math.max(0,B-Math.max(X+1,0)),ae=Math.min(q.length,ee+ne+te),re=q.slice(0,ae),oe=Q+(q.length-ae),ie=U&&$>B,le=17*($-B),se=f&&h.eventId?h.eventId:null,de=se?re.find(e=>e.id===se):null,ce=se&&!de?q.find(e=>e.id===se):null,ue=de?[de,...re.filter(e=>e.id!==se)]:ce&&re.length>0?[ce,...re.slice(0,-1)]:ce?[ce]:re,he=[];let me=0;const ge=Math.min(B,V);for(let a=0;a<ge;a++)if(K.has(a)&&!L[a].some(e=>e.startDayIndex<=d&&e.endDayIndex>=d&&J.has(e.id)))he.push(ze("div",{className:"df-shrink-0",style:{height:"17px",minHeight:"17px"}},`placeholder-layer-${a}-${s.date.getTime()}`));else if(me<ue.length){const a=ue[me];he.push(ze(Ja,{event:a,isAllDay:!!a.allDay,viewType:exports.ViewType.MONTH,isBeingDragged:f&&h.eventId===a.id&&"move"===h.mode,calendarRef:n,hourHeight:72,firstHour:0,onEventUpdate:R,onEventDelete:k,onMoveStart:H,onResizeStart:P,onDetailPanelOpen:M,onEventSelect:I,onEventLongPress:N,newlyCreatedEventId:y,selectedEventId:Y,detailPanelEventId:u,onDetailPanelToggle:x,customDetailPanelContent:i,customEventDetailDialog:l,app:e,isMobile:"desktop"!==F,enableTouch:m,appTimeZone:t},`${a.id}-${a.day}-${C(a.start)}-${me}`)),me++}return ze("div",{className:Bt("df-month-day-cell","df-month-day-cell-surface"),style:{height:_},"data-other-month":W?"false":"true","data-trailing-border":6!==d||g?"true":"false","data-date":(fe=s.date,`${fe.getFullYear()}-${String(fe.getMonth()+1).padStart(2,"0")}-${String(fe.getDate()).padStart(2,"0")}`),onClick:()=>W&&(null==A?void 0:A(s.date)),onDblClick:e=>null==T?void 0:T(e,s.date),onTouchStart:e=>{if("mobile"!==F&&!m)return;const t=e.touches[0];z.current={x:t.clientX,y:t.clientY},Z.current=setTimeout(()=>{null==T||T(e,s.date),Z.current=null,navigator.vibrate&&navigator.vibrate(50)},500)},onTouchMove:e=>{if(Z.current&&z.current){const t=Math.abs(e.touches[0].clientX-z.current.x),n=Math.abs(e.touches[0].clientY-z.current.y);(t>10||n>10)&&(clearTimeout(Z.current),Z.current=null)}},onTouchEnd:()=>{Z.current&&(clearTimeout(Z.current),Z.current=null),z.current=null},onDragOver:D,onDrop:e=>null==w?void 0:w(e,s.date),onContextMenu:e=>E(e,s.date),children:[ze("div",{className:"df-month-date-number-container",children:[j&&0===d&&"mobile"!==F&&ze("span",{className:"df-month-week-number",children:S(s.date)}),ze("span",{className:"df-month-date-number","data-today":s.isToday?"true":void 0,"data-other-month":W?void 0:"true",children:1===s.day&&"desktop"===F?s.date.toLocaleDateString(v,{month:"short",day:"numeric"}):s.day})]}),ze("div",{className:"df-month-day-cell-content",children:[ie&&ze("div",{className:"df-month-day-cell-overlay-mask",style:{top:17*B+"px",height:`${le}px`}}),he,U&&ze("div",{className:Bt("df-month-more-events","df-month-day-cell-more-events"),"data-layout":"desktop"===F?"desktop":"mobile",onClick:e=>{e.stopPropagation(),O?O(s.date):(null==A||A(s.date),null==b||b(exports.ViewType.DAY))},children:["+",oe,"desktop"===F?` ${p}`:""]})]})]},`day-${s.date.getTime()}`);var fe},io=a.memo(({currentMonth:e,currentYear:n,newlyCreatedEventId:a,screenSize:o,isScrolling:i,isDragging:l,showWeekNumbers:s,showMonthIndicator:d=!0,item:c,weekHeight:u,events:h,dragState:m,calendarRef:g,onEventUpdate:f,onEventDelete:v,onMoveStart:p,onCreateStart:y,onResizeStart:D,onDetailPanelOpen:w,onMoreEventsClick:b,onChangeView:E,onSelectDate:T,selectedEventId:S,onEventSelect:M,onEventLongPress:x,detailPanelEventId:k,onDetailPanelToggle:N,customDetailPanelContent:I,customEventDetailDialog:R,onCalendarDrop:O,onCalendarDragOver:H,app:P,enableTouch:A,appTimeZone:L})=>{const{t:$,locale:F}=Tt(),[Y,j]=r.useState(!1),V=r.useRef(null),[_,z]=r.useState(null),W=P.canMutateFromUI();r.useEffect(()=>{W||z(null)},[W]);const U=(e,t)=>{e.preventDefault(),"mobile"!==o&&W&&z({x:e.clientX,y:e.clientY,date:t})},B=r.useMemo(()=>{const e=u-33;if(e<=0)return{maxSlots:0,maxSlotsWithMore:0};const t=Math.floor(e/17),n=e-20,a=Math.max(0,Math.floor(n/17));return{maxSlots:t,maxSlotsWithMore:t>0?Math.min(a,t-1):a}},[u]);r.useEffect(()=>i?(j(!0),V.current&&(clearTimeout(V.current),V.current=null),()=>{V.current&&(clearTimeout(V.current),V.current=null)}):Y?(V.current=setTimeout(()=>{j(!1),V.current=null},100),()=>{V.current&&(clearTimeout(V.current),V.current=null)}):void 0,[i,Y]);const{weekData:q}=c,G=q.days.find(e=>1===e.day),K=`${u}px`,J=r.useMemo(()=>Be(),[]),Q=r.useMemo(()=>La(h,q.startDate,7,L),[h,q.startDate,L]),ee=r.useMemo(()=>((e,n,a)=>{const r=[],o=new Date(n);return o.setDate(o.getDate()+6),o.setHours(23,59,59,999),e.forEach(e=>{if(!e.start||!e.end)return void Z.warn("Event missing start or end date:",e);const i=X(e.start,a),l=e.end?X(e.end,a):i,s=new Date(i);s.setHours(0,0,0,0);const d=new Date(l);d.setHours(0,0,0,0);let c=new Date(d);if(!e.allDay&&0===l.getHours()&&0===l.getMinutes()&&0===l.getSeconds()){const e=l.getTime()-i.getTime();e>0&&e<864e5&&(c=new Date(d),c.setDate(c.getDate()-1))}const u=s.toDateString()!==c.toDateString();if(!u||e.allDay)if(u&&e.allDay){let a=new Date(i);a<n&&(a=new Date(n),a.setHours(0,0,0,0));const s=l>o?o:l;for(let o=i.getTime();o<=s.getTime();o+=864e5){const i=new Date(o);if(i<n)continue;const l=t.Temporal.PlainDate.from({year:i.getFullYear(),month:i.getMonth()+1,day:i.getDate()});r.push(Object.assign(Object.assign({},e),{start:l,end:l,day:a.getDay()}))}}else r.push(Object.assign(Object.assign({},e),{start:e.start,end:e.end,day:i.getDay()}))}),r})(h,q.startDate,L),[h,q.startDate,L]),te=r.useMemo(()=>{const e=new Map;return q.days.forEach(t=>{const n=t.date.toDateString();e.set(n,ee.filter(e=>{if(!e.start||!e.end)return X(e.start,L).toDateString()===n;const t=X(e.start,L),a=X(e.end,L);if(!e.allDay){if(!(0!==a.getHours()||0!==a.getMinutes()||0!==a.getSeconds())){const e=a.getTime()-t.getTime();if(e>0&&e<864e5)return t.toDateString()===n}}return t.toDateString()===n||a.toDateString()===n}))}),e},[ee,q.days,L]),ne=r.useMemo(()=>((e,t)=>{const n=t||wt(e.map(e=>e.event),(()=>{const t=new Map;return e.forEach(e=>{const n=e.event.calendarId;t.has(n)||t.set(n,t.size)}),(e,n)=>{var a,r;return(null!==(a=t.get(e.calendarId))&&void 0!==a?a:0)-(null!==(r=t.get(n.calendarId))&&void 0!==r?r:0)}})()),a=[...e].toSorted((e,t)=>{if(n){const a=n(e.event,t.event);if(0!==a)return a}const a=e.endDayIndex-e.startDayIndex+1,r=t.endDayIndex-t.startDayIndex+1;return e.startDayIndex>t.startDayIndex?1:a!==r?r-a:e.startDayIndex-t.startDayIndex}),r=[];a.forEach(e=>{var t;let n=0,a=!1;for(;!a;){let o=!1;for(const a of r){const r=Math.abs((null!==(t=a.yPosition)&&void 0!==t?t:0)-n)<16,i=!(e.endDayIndex<a.startDayIndex||e.startDayIndex>a.endDayIndex);if(r&&i){o=!0;break}}o?n+=16:a=!0}r.push(Object.assign(Object.assign({},e),{yPosition:n}))});const o=[];return r.forEach(e=>{var t;const n=Math.floor((null!==(t=e.yPosition)&&void 0!==t?t:0)/16);o[n]||(o[n]=[]),o[n].push(e)}),o.forEach(e=>{e.sort((e,t)=>{if(n){const a=n(e.event,t.event);if(0!==a)return a}return e.startDayIndex-t.startDayIndex})}),o})(Q,P.state.allDaySortComparator),[Q,P.state.allDaySortComparator]),ae=r.useMemo(()=>ne.flat(),[ne]),re=r.useMemo(()=>{const e=Array.from({length:7}).fill(0);return ne.forEach((t,n)=>{t.forEach(t=>{for(let a=t.startDayIndex;a<=t.endDayIndex;a++)e[a]=Math.max(e[a],n+1)})}),e},[ne]),oe=r.useMemo(()=>{const e=Array.from({length:7},()=>new Set);return ne.forEach((t,n)=>{t.forEach(t=>{for(let a=t.startDayIndex;a<=t.endDayIndex;a++)a>=0&&a<7&&e[a].add(n)})}),e},[ne]),ie=r.useMemo(()=>{const{maxSlots:e,maxSlotsWithMore:t}=B,n=q.days.map((n,a)=>{var r,o;const i=(e=>[...e].toSorted((e,t)=>e.allDay!==t.allDay?e.allDay?-1:1:e.allDay&&t.allDay?0:C(e.start)-C(t.start)))(null!==(r=te.get(n.date.toDateString()))&&void 0!==r?r:[]),l=i.filter(e=>{if(!e.allDay)return!0;return!ae.some(t=>t.originalEventId===e.id)}),s=(null!==(o=re[a])&&void 0!==o?o:0)-1,d=oe[a],c=[];for(let e=0;e<=s;e++)d.has(e)||c.push(e);const u=l.length,h=Math.max(0,u-c.length),m=Math.max(s+1,0)+h,g=m>e;return{totalSlotsNeeded:m,hasMore:g,limit:g?t:e,timedEventsOnly:l,gapLayers:c,occupiedLayers:d,maxOccupiedLayer:s}}),a=new Set;return ne.forEach((e,t)=>{e.forEach(e=>{for(let r=e.startDayIndex;r<=e.endDayIndex;r++)if(r>=0&&r<7&&t>=n[r].limit){a.add(e.id);break}})}),n.map((n,r)=>{let o=!1;ae.forEach(e=>{e.startDayIndex<=r&&e.endDayIndex>=r&&a.has(e.id)&&(o=!0)});const i=n.hasMore||o,l=i?t:e;return Object.assign(Object.assign({},n),{hasMore:i,limit:l,segmentIsHidden:a})})},[B,q.days,te,ae,re,oe,ne]),le=r.useMemo(()=>Math.min(ne.length,B.maxSlots),[ne.length,B.maxSlots]),se=r.useMemo(()=>Math.max(0,17*le),[le]),de=r.useMemo(()=>G?G.date.toLocaleDateString(F,{month:"long",year:"numeric"}):"",[G,F]);return ze("div",{className:"df-month-week",style:{height:K},children:[d&&G&&ze("div",{className:"df-month-title","data-visible":Y?"true":"false",style:{transition:"opacity 0.5s ease",maxWidth:"fit-content"},onContextMenu:e=>e.preventDefault(),children:ze("span",{className:"df-month-title-label",children:de})}),ze("div",{className:"df-month-week-inner",children:ze("div",{className:"df-month-week-grid-shell",children:[ze("div",{className:"df-month-week-grid",children:q.days.map((t,r)=>ze(oo,{app:P,appTimeZone:L,calendarRef:g,currentMonth:e,currentYear:n,customDetailPanelContent:I,customEventDetailDialog:R,day:t,dayIndex:r,dayLayout:ie[r],detailPanelEventId:k,dragState:m,enableTouch:A,hasScrollbarSpace:J,isDragging:l,locale:F,moreLabel:$("more"),newlyCreatedEventId:a,onCalendarDragOver:H,onCalendarDrop:O,onChangeView:E,onContextMenu:U,onCreateStart:y,onDetailPanelOpen:w,onDetailPanelToggle:N,onEventDelete:v,onEventLongPress:x,onEventSelect:M,onEventUpdate:f,onMoreEventsClick:b,onMoveStart:p,onResizeStart:D,onSelectDate:T,organizedMultiDaySegments:ne,overlayVisibleLayerCount:le,screenSize:o,selectedEventId:S,showWeekNumbers:s,totalSlotsNeeded:ie[r].totalSlotsNeeded,weekHeightPx:K},`day-${t.date.getTime()}`))}),ne.length>0&&ze("div",{className:"df-month-week-event-layer",style:{top:"33px",height:`${se}px`},children:ne.slice(0,le).map((e,t)=>ze("div",{className:"df-month-week-event-layer-row",children:e.filter(e=>!ie[0].segmentIsHidden.has(e.id)).map(e=>ze(Ja,{event:e.event,isAllDay:!0,segment:e,segmentIndex:t,viewType:exports.ViewType.MONTH,isMultiDay:!0,calendarRef:g,hourHeight:72,firstHour:0,onEventUpdate:f,onEventDelete:v,onMoveStart:p,onResizeStart:D,isBeingDragged:l&&m.eventId===e.event.id&&"move"===m.mode,isBeingResized:l&&m.eventId===e.event.id&&"resize"===m.mode,newlyCreatedEventId:a,onDetailPanelOpen:w,selectedEventId:S,onEventSelect:M,onEventLongPress:x,detailPanelEventId:k,onDetailPanelToggle:N,customDetailPanelContent:I,customEventDetailDialog:R,app:P,isMobile:"desktop"!==o,enableTouch:A,appTimeZone:L},e.id))},`layer-${t}`))})]})}),W&&_&&ze(Na,{x:_.x,y:_.y,date:_.date,viewType:exports.ViewType.MONTH,onClose:()=>z(null),app:P,onCreateEvent:()=>{if(y){const e={preventDefault:()=>{},stopPropagation:()=>{},clientX:_.x,clientY:_.y};y(e,_.date)}}})]})},(e,t)=>e.currentMonth===t.currentMonth&&e.currentYear===t.currentYear&&e.newlyCreatedEventId===t.newlyCreatedEventId&&e.screenSize===t.screenSize&&e.isScrolling===t.isScrolling&&e.showWeekNumbers===t.showWeekNumbers&&e.showMonthIndicator===t.showMonthIndicator&&e.item.weekData===t.item.weekData&&e.weekHeight===t.weekHeight&&e.events===t.events&&e.calendarRef===t.calendarRef&&e.onEventUpdate===t.onEventUpdate&&e.onEventDelete===t.onEventDelete&&e.onMoveStart===t.onMoveStart&&e.onCreateStart===t.onCreateStart&&e.onResizeStart===t.onResizeStart&&e.onDetailPanelOpen===t.onDetailPanelOpen&&e.onMoreEventsClick===t.onMoreEventsClick&&e.onChangeView===t.onChangeView&&e.onSelectDate===t.onSelectDate&&e.selectedEventId===t.selectedEventId&&e.onEventSelect===t.onEventSelect&&e.onEventLongPress===t.onEventLongPress&&e.detailPanelEventId===t.detailPanelEventId&&e.onDetailPanelToggle===t.onDetailPanelToggle&&e.customDetailPanelContent===t.customDetailPanelContent&&e.customEventDetailDialog===t.customEventDetailDialog&&e.onCalendarDrop===t.onCalendarDrop&&e.onCalendarDragOver===t.onCalendarDragOver&&e.app===t.app&&e.enableTouch===t.enableTouch&&e.appTimeZone===t.appTimeZone);io.displayName="WeekComponent";const lo=(e,t)=>{const n=new Date(e);n.setHours(0,0,0,0);const a=(n.getDay()-t+7)%7;return n.setDate(n.getDate()-a),n.setHours(0,0,0,0),n},so=(e,t,n,a)=>{const{startDate:r,adjustedEnd:o}=((e,t)=>{const n=X(e.start,t),a=e.end?X(e.end,t):n,r=new Date(n);r.setHours(0,0,0,0);const o=new Date(a);o.setHours(0,0,0,0);let i=new Date(o);e.allDay||0!==a.getHours()||0!==a.getMinutes()||0!==a.getSeconds()||0!==a.getMilliseconds()||i.setDate(i.getDate()-1);return i<r&&(i=new Date(r)),{startDate:r,adjustedEnd:i}})(e,a),i=lo(r,n).getTime(),l=lo(o,n).getTime(),s=lo(t,n).getTime();return s>=i&&s<=l},co=[],uo=({app:e,config:t,customDetailPanelContent:n,customEventDetailDialog:a,calendarRef:o,selectedEventId:i,onEventSelect:l,detailPanelEventId:s,onDetailPanelToggle:d})=>{var c,m,g;const{getWeekDaysLabels:f,getMonthLabels:v,locale:p}=Tt(),y=e.getCurrentDate(),D=e.getEvents(),w=null!==(c=t.startOfWeek)&&void 0!==c?c:1,b=e.timeZone,E=!0===(null===(m=t.scroll)||void 0===m?void 0:m.disabled),C=E&&"fade"===(null===(g=t.scroll)||void 0===g?void 0:g.transition),[T,S]=r.useState(y),[M,x]=r.useState(!1),[k,N]=r.useState("forward"),I=r.useRef(y),R=r.useRef(null),O=y.getFullYear(),H=y.getMonth();r.useEffect(()=>{if(!C)return;if(O===I.current.getFullYear()&&H===I.current.getMonth())return;const e=y>I.current;return I.current=y,N(e?"forward":"backward"),R.current&&clearTimeout(R.current),x(!0),R.current=setTimeout(()=>{S(y),x(!1)},300),()=>{R.current&&clearTimeout(R.current)}},[O,H,C]);const P=r.useMemo(()=>C?((e,t)=>{const n=new Date(e.getFullYear(),e.getMonth(),1),a=(n.getDay()-t+7)%7,r=new Date(n);r.setDate(n.getDate()-a),r.setHours(0,0,0,0);const o=[];for(let e=0;e<6;e++){const t=new Date(r);t.setDate(r.getDate()+7*e),o.push(we(t))}return o})(T,w):[],[C,T,w]),A=r.useMemo(()=>({opacity:M?0:1,transform:M?`translateX(${"forward"===k?"-6%":"6%"})`:"translateX(0)",transition:"opacity 300ms ease, transform 300ms ease"}),[M,k]),L=e.getCalendars().map(e=>e.id+e.colors.lineColor).join("-"),$=r.useRef(null),F=r.useMemo(()=>{const e=$.current;return e&&e.length===D.length&&e.every((e,t)=>e===D[t])?e:($.current=D,D)},[D]),Y=r.useMemo(()=>{const e=new Map,t=e=>{const t=new Date(e);t.setHours(0,0,0,0);const n=(t.getDay()-w+7)%7;return t.setDate(t.getDate()-n),t.setHours(0,0,0,0),t},n=(t,n)=>{const a=e.get(t);a?a.push(n):e.set(t,[n])};return F.forEach(e=>{if(!e.start)return;const a=X(e.start,b),r=e.end?X(e.end,b):a,o=new Date(a);o.setHours(0,0,0,0);const i=new Date(r);i.setHours(0,0,0,0);let l=new Date(i);if(!e.allDay){0!==r.getHours()||0!==r.getMinutes()||0!==r.getSeconds()||0!==r.getMilliseconds()||l.setDate(l.getDate()-1)}l<o&&(l=new Date(o));const s=t(o),d=t(l);let c=s.getTime();const u=d.getTime();for(;c<=u;){n(c,e);const t=new Date(c);t.setDate(t.getDate()+7),t.setHours(0,0,0,0),c=t.getTime()}}),e},[F,w,b]),{screenSize:j}=Et(),[V,_]=r.useState(!1);r.useEffect(()=>{_("ontouchstart"in window||navigator.maxTouchPoints>0)},[]);const Z=e.getCustomMobileEventRenderer()||sa,[z,W]=r.useState(()=>{if("undefined"==typeof window)return 119;const e=window.innerHeight-150;return Math.max(80,Math.ceil(e/6))}),[U,B]=r.useState(()=>"undefined"!=typeof window),q=r.useRef(z),G=r.useRef([]),[K,J]=r.useState(null),[ee,ne]=r.useState(!1),[ae,re]=r.useState(null),[oe,ie]=r.useState(null),[le,se]=r.useState(null),de=void 0===i?oe:i,ce=void 0===s?le:s,ue=r.useCallback(e=>{l?l(e):ie(e)},[l]),he=r.useCallback(e=>{d?d(e):se(e)},[d]),me=r.useRef(e.state.highlightedEventId);r.useEffect(()=>{e.state.highlightedEventId?ue(e.state.highlightedEventId):me.current&&ue(null),me.current=e.state.highlightedEventId},[e.state.highlightedEventId]);const ge=r.useMemo(()=>{const e=(y.getDay()-w+7)%7,t=new Date(y);return t.setDate(y.getDate()-e),t.setHours(0,0,0,0),t},[y,w]),{handleMoveStart:fe,handleCreateStart:ve,handleResizeStart:pe,dragState:ye,isDragging:De}=zr(e,{calendarRef:o,viewType:exports.ViewType.MONTH,onEventsUpdate:(t,n,a)=>{const r=t(F),o=new Set(r.map(e=>e.id)),i=F.filter(e=>!o.has(e.id)),l=new Set(F.map(e=>e.id)),s=r.filter(e=>!l.has(e.id)),d=r.filter(e=>{if(!l.has(e.id))return!1;const t=F.find(t=>t.id===e.id);return t&&ke(t,e)});e.applyEventsChanges({delete:i.map(e=>e.id),add:s,update:d.map(e=>({id:e.id,updates:e}))},n,a)},onEventCreate:t=>{"desktop"===j?e.addEvent(t):(re(t),ne(!0))},onEventEdit:e=>{J(e.id)},currentWeekStart:ge,events:F,isMobile:"desktop"!==j}),Ee=ye,{handleDrop:Ce,handleDragOver:Te}=Vr({app:e,onEventCreated:e=>{J(e.id)}}),Se=r.useMemo(()=>f(p,"short",w),[p,f,w]),Me=r.useMemo(()=>{if(!De||!Ee.eventId||!Ee.startDate||!Ee.endDate||"move"!==Ee.mode&&"resize"!==Ee.mode)return null;const e=F.find(e=>e.id===Ee.eventId);return e?Object.assign(Object.assign({},e),{start:e.allDay?Q(Ee.startDate):te(Ee.startDate,b),end:e.allDay?Q(Ee.endDate):te(Ee.endDate,b)}):null},[De,Ee.eventId,Ee.startDate,Ee.endDate,Ee.mode,F,b]),xe=r.useCallback(e=>{var t;const n=null!==(t=Y.get(e.getTime()))&&void 0!==t?t:co;if(!Me)return n;const a=n.some(e=>e.id===Me.id),r=so(Me,e,w,b);if(!a&&!r)return n;const o=n.filter(e=>e.id!==Me.id);return r&&o.push(Me),o},[Y,Me,w,b]),{currentMonth:Ne,currentYear:Ie,isScrolling:Re,virtualData:Oe,weeksData:He,scrollElementRef:Pe,isNavigating:Ae,handleScroll:Le,handlePreviousMonth:$e,handleNextMonth:Fe,handleToday:Ye,setScrollTop:je}=(({currentDate:e,weekHeight:t,onCurrentMonthChange:n,initialWeeksToLoad:a=104,locale:o="en-US",startOfWeek:i=1,isEnabled:l=!0,snapToMonth:s=!1})=>{const d=r.useRef(null),c=r.useCallback((e,t)=>{const n=new Date(t,e,1),a=o.startsWith("zh")||o.startsWith("ja");return n.toLocaleDateString(o,{month:a?"short":"long"})},[o]),m=r.useMemo(()=>{const t=new Date(e);return t.setDate(1),t.setHours(0,0,0,0),be(t,a,i)},[e,a,i]),g=r.useMemo(()=>{const n=new Date(e);n.setDate(1),n.setHours(0,0,0,0);const a=m.findIndex(e=>e.days.some(e=>e.date.toDateString()===n.toDateString()));return a>0?a*t:0},[m,e,t]),[f,v]=r.useState(g),[p,y]=r.useState(600),[D,w]=r.useState(c(e.getMonth(),e.getFullYear())),[b,E]=r.useState(e.getFullYear()),[C,T]=r.useState(!1),[S,M]=r.useState(m),[x,k]=r.useState(!1),N=r.useRef(!1),[I,R]=r.useState(!1),O=r.useRef(e),H=r.useRef(null),P=r.useRef(null),A=r.useRef(new h),L=r.useRef(0),$=r.useRef(0),F=r.useRef(!1),Y=r.useCallback(e=>{e&&(H.current=e)},[]),j=r.useCallback(e=>{let t=A.current.get(e);return t||(t=we(e),A.current.set(e,t)),t},[]),V=r.useCallback((e,n=26)=>{F.current||(F.current=!0,setTimeout(()=>{try{if("future"===e){const e=S.at(-1),t=[];for(let a=1;a<=n;a++){const n=new Date(e.startDate);n.setDate(n.getDate()+7*a),t.push(j(n))}M(e=>[...e,...t])}else{const e=S[0],a=[];for(let t=n;t>=1;t--){const n=new Date(e.startDate);n.setDate(n.getDate()-7*t),a.push(j(n))}const r=a.length*t;M(e=>[...a,...e]),requestAnimationFrame(()=>{v(e=>e+r),H.current&&(H.current.scrollTop+=r)})}}finally{setTimeout(()=>{F.current=!1},200)}},0))},[S,j,t]),_=r.useMemo(()=>{const e=S.length*t,n=Math.floor(f/t);let a=Math.max(0,n);a=Math.min(a,Math.max(0,S.length-6));const r=Math.min(S.length-1,a+6-1),o=Math.max(0,a-15),i=Math.min(S.length-1,r+15),l=[];for(let e=o;e<=i;e++)l.push({index:e,weekData:S[e],top:e*t,height:t});return{totalHeight:e,visibleItems:l,displayStartIndex:a}},[f,p,t,S]),Z=r.useCallback(e=>{if(x||C||0===e.length||!I)return;const t=f+p/2,a=e.find(e=>e.top<=t&&e.top+e.height>t)||e[Math.floor(e.length/2)];if(!a)return;const r={};a.weekData.days.forEach(e=>{const t=`${c(e.month,e.year)}-${e.year}`;r[t]=(r[t]||0)+1});let o="",i=0,l=0;Object.entries(r).forEach(([e,t])=>{if(t>l){l=t;const[n,a]=e.split("-");o=n,i=Number.parseInt(a,10)}}),o&&i&&(d.current?o===d.current.month&&i===d.current.year&&(d.current=null,o===D&&i===b||(w(o),E(i),null==n||n(o,i))):o===D&&i===b||(w(o),E(i),null==n||n(o,i)))},[p,D,b,x,C,n,f,I]),z=r.useCallback(e=>{const n=performance.now();if(n-L.current<u.SCROLL_THROTTLE)return;L.current=n;const a=e.currentTarget,r=a.scrollTop;$.current=r,v(r),x||requestAnimationFrame(()=>{const{scrollHeight:e,clientHeight:n}=a;r+n>e-10*t&&!F.current&&V("future",26),r<10*t&&!F.current&&V("past",26)}),T(!0),P.current&&clearTimeout(P.current),P.current=setTimeout(()=>{T(!1)},u.SCROLL_DEBOUNCE)},[t,V,x]),W=r.useCallback((e,n=!0)=>{if(!H.current)return;k(!0),N.current=!0;const a=()=>{setTimeout(()=>{k(!1),N.current=!1},n?500:200)},r=S.findIndex(t=>t.days.some(t=>t.date.toDateString()===e.toDateString()));if(-1!==r){const e=r*t;return H.current.scrollTo({top:e,behavior:n?"smooth":"auto"}),void a()}const o=(e.getDay()-i+7)%7,l=new Date(e);l.setDate(e.getDate()-o),l.setHours(0,0,0,0);const s=S[0],d=S.at(-1);let c=0,u=!1,h=!1;l<s.startDate?(c=Math.ceil((s.startDate.getTime()-l.getTime())/6048e5),u=!0):l>d.startDate&&(c=Math.ceil((l.getTime()-d.startDate.getTime())/6048e5),h=!0);const m=Math.min(c+10,52);if(u){const r=[];for(let e=m;e>=1;e--){const t=new Date(s.startDate);t.setDate(t.getDate()-7*e),r.push(j(t))}const o=r.length*t;M(e=>[...r,...e]),requestAnimationFrame(()=>{const i=[...r,...S].findIndex(t=>t.days.some(t=>t.date.toDateString()===e.toDateString()));if(H.current&&-1!==i){const e=i*t;H.current.scrollTop+=o,v(e=>e+o),setTimeout(()=>{H.current&&H.current.scrollTo({top:e,behavior:n?"smooth":"auto"})},50)}a()})}else if(h){const r=[];for(let e=1;e<=m;e++){const t=new Date(d.startDate);t.setDate(t.getDate()+7*e),r.push(j(t))}M(e=>[...e,...r]),requestAnimationFrame(()=>{const o=[...S,...r].findIndex(t=>t.days.some(t=>t.date.toDateString()===e.toDateString()));if(H.current&&-1!==o){const e=o*t;H.current.scrollTo({top:e,behavior:n?"smooth":"auto"})}a()})}else a()},[S,t,j]),U=r.useCallback(()=>{var e;const t=_.displayStartIndex,n=Math.min(S.length-1,t+5),a={};for(let r=t;r<=n;r++)null===(e=S[r])||void 0===e||e.days.forEach(e=>{const t=`${e.month}-${e.year}`;a[t]=(a[t]||0)+1});let r=0,o=0,i=0;for(const[e,t]of Object.entries(a))t>i&&(i=t,[r,o]=e.split("-").map(Number));const l=new Date(o,r-1,1);W(l)},[_.displayStartIndex,S,W]),B=r.useCallback(()=>{var e;const t=_.displayStartIndex,n=Math.min(S.length-1,t+5),a={};for(let r=t;r<=n;r++)null===(e=S[r])||void 0===e||e.days.forEach(e=>{const t=`${e.month}-${e.year}`;a[t]=(a[t]||0)+1});let r=0,o=0,i=0;for(const[e,t]of Object.entries(a))t>i&&(i=t,[r,o]=e.split("-").map(Number));const l=new Date(o,r+1,1);W(l)},[_.displayStartIndex,S,W]),q=r.useCallback(()=>{const e=new Date,a=c(e.getMonth(),e.getFullYear()),r=e.getFullYear(),o=new Date(r,e.getMonth(),1);d.current={month:a,year:r},w(a),E(r),null==n||n(a,r);const i=S.findIndex(e=>e.days.some(e=>e.date.toDateString()===o.toDateString()));if(-1===i)k(!0),N.current=!0,requestAnimationFrame(()=>{W(o,!0),setTimeout(()=>{N.current=!1,k(!1)},200)});else{const e=i*t,n=H.current;n&&(k(!0),N.current=!0,requestAnimationFrame(()=>{v(e),requestAnimationFrame(()=>{n&&(n.scrollTop=e,setTimeout(()=>{N.current=!1,k(!1)},200))})}))}},[S,t,n,W]);return r.useEffect(()=>{Z(_.visibleItems)},[_.visibleItems,Z]),r.useEffect(()=>{const t=O.current,a=t.getMonth(),r=t.getFullYear(),o=e.getMonth(),i=e.getFullYear();if(a!==o||r!==i){const e=6,t=_.displayStartIndex,a=Math.min(S.length-1,t+e-1),r={};for(let e=t;e<=a;e++){const t=S[e];t&&t.days.forEach(e=>{const t=`${e.month}-${e.year}`;r[t]=(r[t]||0)+1})}let l="",s=0;for(const[e,t]of Object.entries(r))t>s&&(s=t,l=e);if(l!==`${o}-${i}`){const e=new Date(i,o,1),t=c(o,i);d.current={month:t,year:i},w(t),E(i),null==n||n(t,i),W(e,!0)}}O.current=e},[e,n,W,_,S,c]),r.useEffect(()=>{const e=H.current;if(!e)return;const t=new ResizeObserver(([e])=>{y(e.contentRect.height)});return t.observe(e),()=>t.disconnect()},[]),r.useLayoutEffect(()=>{const e=H.current;e&&!I&&l&&(g>0&&(e.scrollTop=g),R(!0))},[I,g,l]),r.useEffect(()=>{var e;if(!s||C||x||!I)return;const n=Math.floor(f/t),a=Math.min(S.length-1,n+5),r={};for(let t=n;t<=a;t++)null===(e=S[t])||void 0===e||e.days.forEach(e=>{const t=`${e.month}-${e.year}`;r[t]=(r[t]||0)+1});let o=0,i=0,l=0;for(const[e,t]of Object.entries(r))t>l&&(l=t,[o,i]=e.split("-").map(Number));const d=new Date(i,o,1),c=S.findIndex(e=>e.days.some(e=>e.date.toDateString()===d.toDateString()));if(-1===c)return;const u=c*t;if(Math.abs(u-f)>5){const e=setTimeout(()=>{W(d,!0)},200);return()=>clearTimeout(e)}},[C,s,x,I,f,t,S,W]),r.useEffect(()=>()=>{P.current&&clearTimeout(P.current)},[]),{scrollTop:f,containerHeight:p,currentMonth:D,currentYear:b,isScrolling:C,isNavigating:x,virtualData:_,scrollElementRef:H,handleScroll:z,scrollToDate:W,handlePreviousMonth:U,handleNextMonth:B,handleToday:q,setScrollTop:v,setContainerHeight:y,setCurrentMonth:w,setCurrentYear:E,setIsScrolling:T,cache:A.current,scrollElementRefCallback:Y,weeksData:S}})({currentDate:y,weekHeight:z,onCurrentMonthChange:(t,n)=>{const a=p.startsWith("zh")||p.startsWith("ja"),r=v(p,a?"short":"long").indexOf(t);r>=0&&e.setVisibleMonth(new Date(n,r,1))},initialWeeksToLoad:156,locale:p,startOfWeek:w,isEnabled:U,snapToMonth:t.snapToMonth}),Ve=r.useRef(0),[_e,Ze]=r.useState(0),We=r.useMemo(()=>_e-6*z,[_e,z]),{visibleWeeks:Ue,startIndex:Be}=r.useMemo(()=>{var e,t;const{visibleItems:n,displayStartIndex:a}=Oe,r=n.findIndex(e=>e.index===a);if(-1===r)return G.current.length>0?{visibleWeeks:G.current,startIndex:Ve.current}:{visibleWeeks:[],startIndex:a};const o=Math.max(0,r-2),i=n.slice(o,r+8),l=null!==(t=null===(e=n[o])||void 0===e?void 0:e.index)&&void 0!==t?t:a;return i.length>=6&&(G.current=i,Ve.current=l),{visibleWeeks:i,startIndex:l}},[Oe]),qe=r.useMemo(()=>Be*z,[Be,z]),Ge=r.useRef(!0),Ke=r.useRef(!1),Xe=((e,t)=>{const[n,a]=r.useState(e);return r.useEffect(()=>{const n=setTimeout(()=>{a(e)},t);return()=>{clearTimeout(n)}},[e,t]),n})(Oe.displayStartIndex,250);r.useEffect(()=>{Ae&&(Ke.current=!0)},[Ae]),r.useEffect(()=>{if(Ge.current)return void(Ge.current=!1);const t=He[Xe];if(!t)return;const n=new Date(t.startDate);n.setHours(0,0,0,0);const a=new Date(n);a.setDate(a.getDate()+42+7),e.emitVisibleRange(n,a,Ke.current?"navigation":"scroll"),Ke.current=!1},[e,He,Xe]);const Je=r.useMemo(()=>{const e=Oe.totalHeight,t=Be*z+Ue.length*z+We;return Math.max(0,e-t)},[Oe.totalHeight,Be,z,We,Ue.length]);r.useEffect(()=>{const e=Pe.current;if(!e)return;const t=new ResizeObserver(t=>{for(const n of t){const t=n.contentRect.height;if(Ze(t),t>0){const n=Math.max(80,Math.ceil(t/6));if(n!==q.current){const t=e.scrollTop;if(t>0){const a=Math.round(t/q.current)*n;e.scrollTop=a,je(a)}W(n),q.current=n}}}});return t.observe(e),()=>{t.disconnect()}},[Pe,je]),r.useLayoutEffect(()=>{const e=window.innerHeight-150,t=Math.max(80,Math.ceil(e/6));W(t),q.current=t,B(!0)},[]),r.useEffect(()=>{if(C||!E)return;const e=Pe.current;if(!e)return;const t=e=>e.preventDefault();return e.addEventListener("wheel",t,{passive:!1}),e.addEventListener("touchmove",t,{passive:!1}),()=>{e.removeEventListener("wheel",t),e.removeEventListener("touchmove",t)}},[C,E,Pe]);const Qe=r.useCallback(t=>e.updateEvent(t.id,t),[e]),et=r.useCallback(t=>e.deleteEvent(t),[e]),tt=t=>{e.changeView(t)},nt=r.useCallback(()=>J(null),[]),at=r.useCallback(t=>{const n=e.getReadOnlyConfig().viewable;if(("desktop"!==j||V)&&t&&n){const e=F.find(e=>e.id===t);if(e)return re(e),void ne(!0)}ue(t)},[j,V,F,ue,e]),rt=r.useCallback(e=>{("desktop"!==j||V)&&ue(e)},[j,V,ue]);return ze("div",{className:St,children:[ze(er,{calendar:e,viewType:exports.ViewType.MONTH,currentDate:y,customTitle:(()=>{const e=p.startsWith("zh")||p.startsWith("ja");if(C){const t=v(p,e?"short":"long")[T.getMonth()],n=T.getFullYear();return e?`${n}年${t}`:`${t} ${n}`}return e?`${Ie}年${Ne}`:`${Ne} ${Ie}`})(),onPrevious:()=>{e.goToPrevious(),C||$e()},onNext:()=>{e.goToNext(),C||Fe()},onToday:()=>{e.goToToday(),C||Ye()}}),ze("div",{className:"df-week-header-row",onContextMenu:e=>e.preventDefault(),children:ze("div",{className:"df-week-grid",children:Se.map((e,t)=>ze("div",{className:"df-day-label",children:e},`${e}-${t}`))})}),ze("div",C?{ref:Pe,className:`${kt} df-month-view-fade-scroller`,"data-layout-ready":U?"true":"false",children:ze("div",{className:"df-month-view-fade-body",style:A,children:P.map((r,i)=>{const l=xe(r.startDate),s={index:i,weekData:r,top:i*z,height:z},d=5===i?Object.assign(Object.assign({},s),{height:s.height+We}):s;return ze(io,{item:d,weekHeight:z,showWeekNumbers:t.showWeekNumbers,showMonthIndicator:!1,currentMonth:"",currentYear:0,screenSize:j,isScrolling:!1,calendarRef:o,events:l,onEventUpdate:Qe,onEventDelete:et,onMoveStart:fe,onCreateStart:ve,onResizeStart:pe,isDragging:De,dragState:Ee,newlyCreatedEventId:K,onDetailPanelOpen:nt,onMoreEventsClick:e.onMoreEventsClick,onChangeView:tt,onSelectDate:e.selectDate,selectedEventId:de,onEventSelect:at,onEventLongPress:rt,detailPanelEventId:ce,onDetailPanelToggle:he,customDetailPanelContent:n,customEventDetailDialog:a,onCalendarDrop:Ce,onCalendarDragOver:Te,calendarSignature:L,app:e,enableTouch:V,appTimeZone:b},`week-${r.startDate.getTime()}`)})})}:{ref:Pe,className:`${kt} df-month-view-virtual-scroller`,"data-layout-ready":U?"true":"false",onScroll:Le,children:[ze("div",{style:{height:qe}}),Ue.map((r,i)=>{const l=xe(r.weekData.startDate),s=5===i?Object.assign(Object.assign({},r),{height:r.height+We}):r,d=!(!1===t.showMonthIndicator||!r.weekData.days.some(e=>1===e.day))&ℜreturn ze(io,{item:s,weekHeight:z,showWeekNumbers:t.showWeekNumbers,showMonthIndicator:t.showMonthIndicator,currentMonth:Ne,currentYear:Ie,screenSize:j,isScrolling:d,calendarRef:o,events:l,onEventUpdate:Qe,onEventDelete:et,onMoveStart:fe,onCreateStart:ve,onResizeStart:pe,isDragging:De,dragState:Ee,newlyCreatedEventId:K,onDetailPanelOpen:nt,onMoreEventsClick:e.onMoreEventsClick,onChangeView:tt,onSelectDate:e.selectDate,selectedEventId:de,onEventSelect:at,onEventLongPress:rt,detailPanelEventId:ce,onDetailPanelToggle:he,customDetailPanelContent:n,customEventDetailDialog:a,onCalendarDrop:Ce,onCalendarDragOver:Te,calendarSignature:L,app:e,enableTouch:V,appTimeZone:b},`week-${r.weekData.startDate.getTime()}`)}),ze("div",{style:{height:Je}})]}),ze(Z,{isOpen:ee,onClose:()=>{ne(!1),re(null)},onSave:t=>{F.some(e=>e.id===t.id)?e.updateEvent(t.id,t):e.addEvent(t),ne(!1),re(null)},draftEvent:ae,app:e})]})},ho={showWeekNumbers:!1,showMonthIndicator:!0,startOfWeek:1},mo=e=>n.h(Ur,Object.assign(Object.assign({},e),{viewType:exports.ViewType.MONTH,originalComponent:uo,className:"df-month-view-factory"}));mo.displayName="MonthViewAdapter";const go=(e={})=>{const t=Object.assign(Object.assign({},ho),e);return{type:exports.ViewType.MONTH,component:mo,config:t}};function fo(e,t,n,a,r){if(0===t.length)return[];const o=t[0],i=t.at(-1);if(!o||!i)return[];const l=new Date(o.getFullYear(),o.getMonth(),o.getDate()).getTime(),s=new Date(i.getFullYear(),i.getMonth(),i.getDate(),23,59,59,999).getTime(),d=e.map(e=>{const t=X(e.start,r),n=e.end?X(e.end,r):t;return{event:e,startMs:new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime(),endMs:new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime()}}).filter(e=>e.startMs<=s&&e.endMs>=l);if(0===d.length)return[];const c=wt(d.map(e=>e.event),a);d.sort((e,t)=>{const n=!!e.event.allDay;return n!==!!t.event.allDay?n?-1:1:c(e.event,t.event)});const u=[],h=[];return d.forEach(({event:e,startMs:t,endMs:a})=>{let r=Math.round((t-l)/864e5),o=Math.round((a-l)/864e5);r=Math.max(0,Math.min(r,n-1)),o=Math.max(0,Math.min(o,n-1));const i=t>=l,d=a<=s;let c=0;for(;;){h[c]||(h[c]=[]);let e=!1;for(let t=r;t<=o;t++)if(h[c][t]){e=!0;break}if(!e){for(let e=r;e<=o;e++)h[c][e]=!0;break}c++}u.push({id:`${e.id}::year-${l}`,event:e,startCellIndex:r,endCellIndex:o,isFirstSegment:i,isLastSegment:d,visualRowIndex:c})}),u}const vo=(e,t,n,a)=>{if(!e)return!1;const r=new Date(t,n,1).getTime(),o=new Date(t,n+1,0,23,59,59,999).getTime(),i=X(e.start,a),l=e.end?X(e.end,a):i,s=new Date(i.getFullYear(),i.getMonth(),i.getDate()).getTime(),d=new Date(l.getFullYear(),l.getMonth(),l.getDate(),23,59,59,999).getTime();return s<=o&&d>=r};function po(e,t,n,a=1,r){const o=new Date(n,t,1),i=new Date(n,t+1,0).getDate(),l=(o.getDay()-a+7)%7,s=o.getTime(),d=new Date(n,t,i,23,59,59,999).getTime(),c=e.filter(e=>!!e.start).map(e=>{const t=X(e.start,r),n=e.end?X(e.end,r):t,a=new Date(t.getFullYear(),t.getMonth(),t.getDate()),o=new Date(n.getFullYear(),n.getMonth(),n.getDate());return{event:e,startMs:a.getTime(),endMs:o.getTime(),eventStartDay:a,eventEndDay:o}}).filter(e=>e.startMs<=d&&e.endMs>=s);if(0===c.length)return{segments:[],maxVisualRow:-1};const u=wt(c.map(e=>e.event));c.sort((e,t)=>{const n=!!e.event.allDay;return n!==!!t.event.allDay?n?-1:1:u(e.event,t.event)});const h=[],m=[];c.forEach(({event:e,startMs:a,endMs:r,eventStartDay:o,eventEndDay:i})=>{const c=Math.max(a,s),u=Math.min(r,d),g=new Date(c).getDate(),f=new Date(u).getDate(),v=l+(g-1),p=l+(f-1),y=o.getMonth()===t&&o.getFullYear()===n,D=i.getMonth()===t&&i.getFullYear()===n;let w=0;for(;;){m[w]||(m[w]=[]);let e=!1;for(let t=v;t<=p;t++)if(m[w][t]){e=!0;break}if(!e){for(let e=v;e<=p;e++)m[w][e]=!0;break}w++}h.push({id:`${e.id}::month-${t}`,event:e,startCellIndex:v,endCellIndex:p,isFirstSegment:y,isLastSegment:D,visualRowIndex:w,monthIndex:t})});const g=h.length>0?Math.max(...h.map(e=>e.visualRowIndex)):-1;return{segments:h,maxVisualRow:g}}const yo=a.memo(({date:e,isToday:t,locale:n,onSelectDate:a,onCreateStart:r,onMoreEventsClick:o,moreCount:i=0,onContextMenu:l})=>{const{t:s}=Tt(),d=e.getDate(),c=1===d,u=e.toLocaleDateString(n,{month:"short"}).toUpperCase();return ze("div",{className:"df-year-day-cell","data-first-day":c?"true":"false",style:{aspectRatio:"1/1"},onClick:()=>a(e),onDblClick:t=>null==r?void 0:r(t,e),onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),null==l||l(t,e)},"data-date":`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`,children:[ze("div",{className:"df-year-day-cell-header",children:[c&&ze("span",{className:"df-year-day-cell-month-pill",children:u}),ze("span",{className:"df-year-day-cell-date","data-today":t?"true":"false",children:d})]}),i>0&&ze("div",{className:"df-year-day-cell-more-wrap",children:ze("span",{className:"df-year-day-cell-more",onClick:t=>{t.stopPropagation(),null==o||o(e)},children:["+",i," ",s("more")]})})]})});yo.displayName="YearDayCell";const Do=(e,t,n)=>{if(!e||0===t.length)return!1;const a=t[0],r=t.at(-1);if(!a||!r)return!1;const o=new Date(a.getFullYear(),a.getMonth(),a.getDate()).getTime(),i=new Date(r.getFullYear(),r.getMonth(),r.getDate(),23,59,59,999).getTime(),l=X(e.start,n),s=e.end?X(e.end,n):l,d=new Date(l.getFullYear(),l.getMonth(),l.getDate()).getTime(),c=new Date(s.getFullYear(),s.getMonth(),s.getDate(),23,59,59,999).getTime();return d<=i&&c>=o},wo=a.memo(({rowDays:e,events:t,columnsPerRow:n,app:a,calendarRef:o,locale:i,isDragging:l,dragState:s,onMoveStart:d,onResizeStart:c,onCreateStart:u,selectedEventId:h,onEventSelect:m,onMoreEventsClick:g,newlyCreatedEventId:f,onDetailPanelOpen:v,detailPanelEventId:p,onDetailPanelToggle:y,customDetailPanelContent:D,customEventDetailDialog:w,onContextMenu:b,appTimeZone:E,dragPreviewEvent:C})=>{const T=r.useMemo(()=>{const e=ce(E);return e.setHours(0,0,0,0),e},[E]),S=r.useCallback((e,t)=>{e.preventDefault(),e.stopPropagation(),b({x:e.clientX,y:e.clientY,date:t})},[b]),M=r.useCallback(e=>{a.selectDate(e)},[a]),x=r.useMemo(()=>fo(t,e,n,a.state.allDaySortComparator,E),[t,e,n,a.state.allDaySortComparator,E]),k=l&&"move"===s.mode&&!!C&&C.id===s.eventId,N=r.useMemo(()=>{if(!C)return x;if(k)return x;const r=t.filter(e=>e.id!==C.id);return Do(C,e,E)&&r.push(C),fo(r,e,n,a.state.allDaySortComparator,E)},[C,k,x,t,e,n,a.state.allDaySortComparator,E]),I=r.useMemo(()=>k?((e,t,n,a)=>{if(!e||0===t.length)return null;const r=t[0],o=t.at(-1);if(!r||!o)return null;const i=new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime(),l=new Date(o.getFullYear(),o.getMonth(),o.getDate(),23,59,59,999).getTime(),s=X(e.start,a),d=e.end?X(e.end,a):s,c=new Date(s.getFullYear(),s.getMonth(),s.getDate()).getTime(),u=new Date(d.getFullYear(),d.getMonth(),d.getDate()).getTime();if(c>l||u<i)return null;let h=Math.round((Math.max(c,i)-i)/864e5),m=Math.round((Math.min(u,l)-i)/864e5);return h=Math.max(0,Math.min(h,n-1)),m=Math.max(0,Math.min(m,n-1)),{id:`${e.id}::preview-year-${i}`,event:e,startCellIndex:h,endCellIndex:m,isFirstSegment:c>=i,isLastSegment:u<=l,visualRowIndex:0}})(C,e,n,E):null,[k,C,e,n,E]),{visibleSegments:R,moreCounts:O}=r.useMemo(()=>{const t=Array.from({length:e.length}).fill(0);N.forEach(n=>{const a=Math.max(0,n.startCellIndex),r=Math.min(e.length-1,n.endCellIndex);for(let e=a;e<=r;e++)t[e]++});const n=[],a=Array.from({length:e.length}).fill(0);return N.forEach(r=>{let o=!0;const i=Math.max(0,r.startCellIndex),l=Math.min(e.length-1,r.endCellIndex);for(let e=i;e<=l;e++){const n=t[e]>3?1:2;if(r.visualRowIndex>n){o=!1;break}}if(o)n.push(r);else for(let e=i;e<=l;e++)a[e]++}),{visibleSegments:n,moreCounts:a}},[N,e.length]),H=r.useMemo(()=>{if(!k||!s.eventId)return N;const e=N.filter(e=>e.event.id!==s.eventId);return I?[...e,I]:e},[k,s.eventId,N,I]);return ze("div",{className:"df-year-row",style:{display:"grid",gridTemplateColumns:`repeat(${n}, 1fr)`},onContextMenu:e=>e.preventDefault(),children:[e.map((e,t)=>{const n=e.getTime()===T.getTime();return ze(yo,{date:e,isToday:n,locale:i,onSelectDate:M,onCreateStart:u,onMoreEventsClick:g,moreCount:O[t],onContextMenu:S},e.getTime())}),ze("div",{className:"df-year-row-event-layer",style:{top:26,bottom:0,left:0,right:0},onContextMenu:e=>e.preventDefault(),children:ze("div",{className:"df-year-row-event-layer-inner",children:(k&&s.eventId?H.filter(e=>R.some(t=>t.id===e.id)||e.id===(null==I?void 0:I.id)):R).map(e=>ze("div",{className:"df-year-row-event-hitbox",children:ze(Ja,{event:e.event,isAllDay:!!e.event.allDay,viewType:exports.ViewType.YEAR,yearSegment:e,columnsPerRow:n,isBeingDragged:l&&s.eventId===e.event.id,selectedEventId:h,onMoveStart:d,onResizeStart:c,onEventSelect:m,onDetailPanelToggle:y,newlyCreatedEventId:f,onDetailPanelOpen:v,calendarRef:o,app:a,detailPanelEventId:p,customDetailPanelContent:D,customEventDetailDialog:w,firstHour:0,hourHeight:0,onEventUpdate:e=>a.updateEvent(e.id,e),onEventDelete:e=>a.deleteEvent(e),appTimeZone:E})},e.id))})})]})},(e,t)=>{var n,a;const r=null===(n=e.dragPreviewEvent)||void 0===n?void 0:n.id,o=null===(a=t.dragPreviewEvent)||void 0===a?void 0:a.id,i=!!r&&e.events.some(e=>e.id===r)||!!o&&t.events.some(e=>e.id===o),l=Do(e.dragPreviewEvent,e.rowDays,e.appTimeZone),s=Do(t.dragPreviewEvent,t.rowDays,t.appTimeZone);return!(i||l||s)&&(e.rowDays===t.rowDays&&e.events===t.events&&e.columnsPerRow===t.columnsPerRow&&e.app===t.app&&e.calendarRef===t.calendarRef&&e.locale===t.locale&&e.onMoveStart===t.onMoveStart&&e.onResizeStart===t.onResizeStart&&e.onCreateStart===t.onCreateStart&&e.selectedEventId===t.selectedEventId&&e.onEventSelect===t.onEventSelect&&e.onMoreEventsClick===t.onMoreEventsClick&&e.newlyCreatedEventId===t.newlyCreatedEventId&&e.onDetailPanelOpen===t.onDetailPanelOpen&&e.detailPanelEventId===t.detailPanelEventId&&e.onDetailPanelToggle===t.onDetailPanelToggle&&e.customDetailPanelContent===t.customDetailPanelContent&&e.customEventDetailDialog===t.customEventDetailDialog&&e.onContextMenu===t.onContextMenu&&e.appTimeZone===t.appTimeZone)});wo.displayName="YearRowComponent";const bo=({app:e,calendarRef:n,customDetailPanelContent:a,customEventDetailDialog:o,config:i,selectedEventId:l,onEventSelect:s,detailPanelEventId:d,onDetailPanelToggle:c})=>{var u;const{t:h,locale:m}=Tt(),g=e.getCurrentDate(),f=g.getFullYear(),v=e.getEvents(),p=e.timeZone,y=r.useRef(null),[D,w]=r.useState(7),[b,E]=r.useState(!1),[C,T]=r.useState(()=>"undefined"!=typeof window&&window.innerWidth<768),[S,M]=r.useState(null),[x,k]=r.useState(null),N=void 0===l?S:l,I=void 0===d?x:d,[R,O]=r.useState(null),H=r.useCallback(e=>{s?s(e):M(e)},[s]),P=r.useCallback(e=>{c?c(e):k(e)},[c]),A=r.useCallback(()=>{O(null)},[]),[L,$]=r.useState(null),F=e.canMutateFromUI();r.useEffect(()=>{F||$(null)},[F]),r.useEffect(()=>{const e=e=>{if(2===e.button)return;const t=e.target,n=t.closest("[data-event-id]"),a=t.closest("[data-event-detail-panel]"),r=t.closest("[data-event-detail-dialog]"),o=t.closest("[data-range-picker-popup]"),i=t.closest("[data-calendar-picker-dropdown]"),l=t.closest(".df-context-menu");n||a||r||o||i||l||(H(null),P(null),$(null))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const Y=r.useRef(null);r.useLayoutEffect(()=>{const e=y.current;if(!e)return;const t=e=>{if(e<=0)return;const t=Math.max(1,Math.floor(e/80));w(t),T(e<768),E(!0)};t(e.clientWidth);const n=new ResizeObserver(e=>{Y.current&&clearTimeout(Y.current),Y.current=setTimeout(()=>{const n=e[0].contentRect.width;t(n)},60)});return n.observe(e),()=>{n.disconnect(),Y.current&&clearTimeout(Y.current)}},[]);const j=r.useRef(e.state.highlightedEventId);r.useEffect(()=>{e.state.highlightedEventId?(H(e.state.highlightedEventId),requestAnimationFrame(()=>{const t=y.current;if(!t)return;const n=t.querySelector(`[data-event-id="${e.state.highlightedEventId}"]`);if(!n)return;const a=t.getBoundingClientRect(),r=n.getBoundingClientRect(),o=r.top-a.top+t.scrollTop-t.clientHeight/2+r.height/2;t.scrollTo({top:Math.max(0,o),behavior:"smooth"})})):j.current&&H(null),j.current=e.state.highlightedEventId},[e.state.highlightedEventId]);const{handleMoveStart:V,handleResizeStart:_,handleCreateStart:Z,dragState:z,isDragging:W}=zr(e,{calendarRef:n,viewType:exports.ViewType.YEAR,onEventsUpdate:(t,n,a)=>{const r=t(v).filter(e=>{const t=v.find(t=>t.id===e.id);return t&&ke(t,e)});r.length>0&&e.applyEventsChanges({update:r.map(e=>({id:e.id,updates:e}))},n,a)},currentWeekStart:new Date,events:v,onEventCreate:t=>{e.addEvent(t)},onEventEdit:e=>{O(e.id)},isMobile:C}),U=z,B=null!==(u=null==i?void 0:i.showTimedEventsInYearView)&&void 0!==u&&u,q=r.useCallback((n,a)=>{if(B)null==Z||Z(n,a);else{const n=t.Temporal.PlainDate.from({year:a.getFullYear(),month:a.getMonth()+1,day:a.getDate()}),r={id:`event-${Date.now()}`,title:h("newEvent")||"New Event",start:n,end:n,allDay:!0,calendarId:e.getCalendarRegistry().getDefaultCalendarId()||"default"};e.addEvent(r),O(r.id)}},[B,Z,e,h]),G=r.useMemo(()=>{const e=[],t=new Date(f,0,1),n=new Date(f,11,31);for(let a=t.getTime();a<=n.getTime();a+=864e5)e.push(new Date(a));return e},[f]),K=r.useMemo(()=>function(e,t){const n=[];for(let a=0;a<e.length;a+=t)n.push(e.slice(a,a+t));return n}(G,D),[G,D]),J=r.useMemo(()=>{const e=new Date(f,0,1),t=new Date(f,11,31,23,59,59);return v.filter(n=>{if(!n.start)return!1;if(!B&&!n.allDay)return!1;const a=X(n.start,p),r=n.end?X(n.end,p):a;return a<=t&&r>=e})},[v,f,B,p]),ee=r.useMemo(()=>{const e=J.map(e=>{const t=X(e.start,p),n=e.end?X(e.end,p):t;return{event:e,startMs:new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime(),endMs:new Date(n.getFullYear(),n.getMonth(),n.getDate(),23,59,59,999).getTime()}});return K.map(t=>{if(0===t.length)return[];const n=t[0],a=t.at(-1);if(!n||!a)return[];const r=new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime(),o=new Date(a.getFullYear(),a.getMonth(),a.getDate(),23,59,59,999).getTime();return e.filter(e=>e.startMs<=o&&e.endMs>=r).map(e=>e.event)})},[K,J,p]),ne=r.useMemo(()=>{if(!W||!U.eventId||!U.startDate||!U.endDate||"move"!==U.mode&&"resize"!==U.mode)return null;const e=J.find(e=>e.id===U.eventId);return e?Object.assign(Object.assign({},e),{start:e.allDay?Q(U.startDate):te(U.startDate,p),end:e.allDay?Q(U.endDate):te(U.endDate,p)}):null},[W,U.eventId,U.startDate,U.endDate,U.mode,J,p]);return ze("div",{className:St,onContextMenu:e=>e.preventDefault(),children:[ze(er,{calendar:e,viewType:exports.ViewType.YEAR,currentDate:g,customTitle:m.startsWith("zh")||m.startsWith("ja")?`${f}年`:`${f}`,onPrevious:()=>{const t=new Date(g);t.setFullYear(t.getFullYear()-1),e.setCurrentDate(t)},onNext:()=>{const t=new Date(g);t.setFullYear(t.getFullYear()+1),e.setCurrentDate(t)},onToday:()=>{e.goToToday()}}),ze("div",{ref:y,className:`df-year-default-scroll ${kt} df-scrollbar-hide`,children:ze("div",{className:"df-year-default-rows",style:{opacity:b?1:0,transition:"opacity 0.2s ease"},children:K.map((t,r)=>ze(wo,{rowDays:t,events:ee[r],columnsPerRow:D,app:e,calendarRef:n,locale:m,isDragging:W,dragState:U,dragPreviewEvent:ne,onMoveStart:V,onResizeStart:_,onCreateStart:q,selectedEventId:N,onEventSelect:H,onMoreEventsClick:e.onMoreEventsClick,newlyCreatedEventId:R,onDetailPanelOpen:A,detailPanelEventId:I,onDetailPanelToggle:P,customDetailPanelContent:a,customEventDetailDialog:o,onContextMenu:e=>{F&&$(e)},appTimeZone:p},r))})}),F&&L&&ze(Na,{x:L.x,y:L.y,date:L.date,viewType:exports.ViewType.YEAR,onClose:()=>$(null),app:e,onCreateEvent:()=>{if(L&&L.date){const e={preventDefault:()=>{},stopPropagation:()=>{},clientX:L.x,clientY:L.y};q(e,L.date)}}})]})},Eo=({app:e,calendarRef:n,customDetailPanelContent:a,customEventDetailDialog:o,config:i,selectedEventId:l,onEventSelect:s,detailPanelEventId:d,onDetailPanelToggle:c})=>{var u,h;const{t:m,locale:g,getWeekDaysLabels:f}=Tt(),v=e.getCurrentDate(),p=v.getFullYear(),y=e.getEvents(),D=e.timeZone,w=ce(D);w.setHours(0,0,0,0);const b=null!==(u=null==i?void 0:i.startOfWeek)&&void 0!==u?u:1,E=r.useRef(null),C=r.useRef(null),T=r.useRef(null),[S,M]=r.useState(0),[x,k]=r.useState(0),[N,I]=r.useState(null),[R,O]=r.useState(null),H=r.useMemo(()=>Be(),[]),P=void 0===l?N:l,A=void 0===d?R:d,L=e=>{s?s(e):I(e)},$=e=>{c?c(e):O(e)},[F,Y]=r.useState(null),[j,V]=r.useState(null),_=e.canMutateFromUI();r.useEffect(()=>{_||V(null)},[_]),r.useEffect(()=>{const e=e=>{const t=e.target,n=t.closest("[data-event-id]"),a=t.closest("[data-event-detail-panel]"),r=t.closest("[data-event-detail-dialog]"),o=t.closest("[data-range-picker-popup]"),i=t.closest("[data-calendar-picker-dropdown]");n||a||r||o||i||(L(null),$(null))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const Z=r.useRef(e.state.highlightedEventId);r.useEffect(()=>{e.state.highlightedEventId?(L(e.state.highlightedEventId),requestAnimationFrame(()=>{const t=T.current;if(!t)return;const n=t.querySelector(`[data-event-id="${e.state.highlightedEventId}"]`);if(!n)return;const a=t.getBoundingClientRect(),r=n.getBoundingClientRect(),o=r.top-a.top+t.scrollTop-t.clientHeight/2+r.height/2,i=r.left-a.left+t.scrollLeft-t.clientWidth/2+r.width/2;t.scrollTo({top:Math.max(0,o),left:Math.max(0,i),behavior:"smooth"})})):Z.current&&L(null),Z.current=e.state.highlightedEventId},[e.state.highlightedEventId]);const z=r.useMemo(()=>((e,t)=>{let n=0;for(let a=0;a<12;a++){const r=new Date(e,a,1),o=new Date(e,a+1,0).getDate(),i=(r.getDay()-t+7)%7+o;i>n&&(n=i)}return n})(p,b),[p,b]),{handleMoveStart:W,handleResizeStart:U,handleCreateStart:B,dragState:q,isDragging:G}=zr(e,{calendarRef:n,viewType:exports.ViewType.YEAR,onEventsUpdate:(t,n,a)=>{const r=t(y).filter(e=>{const t=y.find(t=>t.id===e.id);return t&&ke(t,e)});r.length>0&&e.applyEventsChanges({update:r.map(e=>({id:e.id,updates:e}))},n,a)},currentWeekStart:new Date,events:y,onEventCreate:t=>{e.addEvent(t)},onEventEdit:e=>{Y(e.id)}}),K=q,J=null!==(h=null==i?void 0:i.showTimedEventsInYearView)&&void 0!==h&&h,ee=r.useCallback((n,a)=>{if(J)null==B||B(n,a);else{const n=t.Temporal.PlainDate.from({year:a.getFullYear(),month:a.getMonth()+1,day:a.getDate()}),r={id:`event-${Date.now()}`,title:m("newEvent")||"New Event",start:n,end:n,allDay:!0};e.addEvent(r),Y(r.id)}},[J,B,e,m]),ne=r.useMemo(()=>(({locale:e,totalColumns:t,startOfWeek:n,getWeekDaysLabels:a})=>{const r=a(e,"short",n).map(t=>{var n;if(e.startsWith("zh"))return null!==(n=t.at(-1))&&void 0!==n?n:t;const a=t.slice(0,2);return a.charAt(0).toUpperCase()+a.slice(1).toLowerCase()}),o=[];for(let e=0;e<t;e++)o.push(r[e%7]);return o})({locale:g,totalColumns:z,startOfWeek:b,getWeekDaysLabels:f}),[g,z,b,f]),ae=r.useMemo(()=>{const e=new Date(p,0,1),t=new Date(p,11,31,23,59,59);return y.filter(n=>{if(!n.start)return!1;if(!J&&!n.allDay)return!1;const a=X(n.start,D),r=n.end?X(n.end,D):a;return a<=t&&r>=e})},[y,p,J,D]),re=r.useMemo(()=>(({currentYear:e,locale:t,totalColumns:n,yearEvents:a,startOfWeek:r,appTimeZone:o})=>{const i=[];for(let l=0;l<12;l++){const s=new Date(e,l,1),d=new Date(e,l+1,0).getDate(),c=(s.getDay()-r+7)%7,u=[];for(let e=0;e<c;e++)u.push(null);for(let t=1;t<=d;t++)u.push(new Date(e,l,t));for(;u.length<n;)u.push(null);const h=s.toLocaleDateString(t,{month:"short"}),m=h.charAt(0).toUpperCase()+h.slice(1).toLowerCase(),{segments:g,maxVisualRow:f}=po(a,l,e,r,o),v=f+1,p=Math.max(60,20+18*v);i.push({monthIndex:l,monthName:m,days:u,monthEvents:a.filter(t=>vo(t,e,l,o)),eventSegments:g,minHeight:p})}return i})({currentYear:p,locale:g,totalColumns:z,yearEvents:ae,startOfWeek:b,appTimeZone:D}),[p,g,z,ae,b,D]),oe=r.useMemo(()=>(({isDragging:e,dragState:t,yearEvents:n,appTimeZone:a})=>{if(!e||!t.eventId||!t.startDate||!t.endDate||"move"!==t.mode&&"resize"!==t.mode)return null;const r=n.find(e=>e.id===t.eventId);return r?Object.assign(Object.assign({},r),{start:r.allDay?Q(t.startDate):te(t.startDate,a),end:r.allDay?Q(t.endDate):te(t.endDate,a)}):null})({isDragging:G,dragState:K,yearEvents:ae,appTimeZone:D}),[G,K,ae,D]),ie=G&&"move"===K.mode&&!!oe&&oe.id===K.eventId,le=r.useMemo(()=>(({monthsData:e,dragPreviewEvent:t,isMovePreviewActive:n,currentYear:a,startOfWeek:r,appTimeZone:o})=>e.map(e=>{if(n)return e;if(!t||!e.monthEvents.some(e=>e.id===t.id)&&!vo(t,a,e.monthIndex,o))return e;const i=e.monthEvents.filter(e=>e.id!==(null==t?void 0:t.id));t&&vo(t,a,e.monthIndex,o)&&i.push(t);const{segments:l,maxVisualRow:s}=po(i,e.monthIndex,a,r,o);return Object.assign(Object.assign({},e),{eventSegments:l,minHeight:Math.max(60,20+18*(s+1))})}))({monthsData:re,dragPreviewEvent:oe,isMovePreviewActive:ie,currentYear:p,startOfWeek:b,appTimeZone:D}),[re,oe,ie,p,b,D]),se=r.useCallback(e=>{const t=e.currentTarget;E.current&&(E.current.scrollLeft=t.scrollLeft),C.current&&(C.current.scrollTop=t.scrollTop)},[]);r.useEffect(()=>{const e=()=>{if(T.current){const e=T.current,t=e.offsetHeight-e.clientHeight,n=e.offsetWidth-e.clientWidth;k(e=>e===t?e:t),M(e=>e===n?e:n)}},t=T.current;if(!t)return;e();const n=new ResizeObserver(()=>{e()});return n.observe(t),()=>{n.disconnect()}},[le]);return ze("div",{className:"df-year-fixed",onContextMenu:e=>e.preventDefault(),children:[ze("div",{className:"df-year-fixed-header-span",children:ze(er,{calendar:e,viewType:exports.ViewType.YEAR,currentDate:v,customTitle:g.startsWith("zh")||g.startsWith("ja")?`${p}年`:`${p}`,onPrevious:()=>{const t=new Date(v);t.setFullYear(t.getFullYear()-1),e.setCurrentDate(t)},onNext:()=>{const t=new Date(v);t.setFullYear(t.getFullYear()+1),e.setCurrentDate(t)},onToday:()=>{e.goToToday()}})}),ze("div",{className:"df-year-fixed-corner"}),ze("div",{ref:E,className:"df-year-fixed-week-header",children:ze("div",{className:"df-year-fixed-week-header-inner",style:{minWidth:`calc(1352px + ${S}px)`},children:[ze("div",{className:"df-year-fixed-week-grid",style:{gridTemplateColumns:`repeat(${z}, minmax(0, 1fr))`,minWidth:"1352px"},children:ne.map((e,t)=>{const n=(t+b)%7;return ze("div",{className:"df-year-fixed-week-label","data-weekend":0===n||6===n?"true":"false",children:e},`label-${t}`)})}),S>0&&ze("div",{className:"df-year-fixed-week-spacer","data-scrollbar-space":H?"true":"false",style:{width:`${S}px`}})]})}),ze("div",{ref:C,className:"df-year-fixed-month-sidebar",children:ze("div",{className:"df-year-fixed-month-sidebar-inner",children:[le.map(e=>ze("div",{className:"df-year-fixed-month-label",style:{minHeight:`${e.minHeight}px`,transition:"min-height 180ms cubic-bezier(0.22, 1, 0.36, 1)"},children:e.monthName},e.monthIndex)),x>0&&ze("div",{className:"df-year-fixed-month-spacer","data-scrollbar-space":H?"true":"false",style:{height:`${x}px`}})]})}),ze("div",{ref:T,className:"df-year-fixed-content",onScroll:se,children:ze("div",{className:"df-year-fixed-content-inner",style:{minWidth:"1352px"},children:le.map(t=>{const r=ie&&oe?((e,t,n,a=1,r)=>{if(!e)return null;const o=new Date(n,t,1),i=new Date(n,t+1,0).getDate(),l=(o.getDay()-a+7)%7,s=o.getTime(),d=new Date(n,t,i,23,59,59,999).getTime(),c=X(e.start,r),u=e.end?X(e.end,r):c,h=new Date(c.getFullYear(),c.getMonth(),c.getDate()),m=new Date(u.getFullYear(),u.getMonth(),u.getDate()),g=h.getTime(),f=m.getTime();if(g>d||f<s)return null;const v=Math.max(g,s),p=Math.min(f,d);return{id:`${e.id}::preview-month-${t}`,event:e,startCellIndex:l+(new Date(v).getDate()-1),endCellIndex:l+(new Date(p).getDate()-1),isFirstSegment:h.getMonth()===t&&h.getFullYear()===n,isLastSegment:m.getMonth()===t&&m.getFullYear()===n,visualRowIndex:0,monthIndex:t}})(oe,t.monthIndex,p,b,D):null,i=ie&&K.eventId?[...t.eventSegments.filter(e=>e.event.id!==K.eventId),...r?[r]:[]]:t.eventSegments;return ze("div",{className:"df-year-fixed-month-row",style:{minHeight:`${t.minHeight}px`,transition:"min-height 180ms cubic-bezier(0.22, 1, 0.36, 1)"},children:[ze("div",{className:"df-year-fixed-background-grid",style:{gridTemplateColumns:`repeat(${z}, minmax(0, 1fr))`},children:t.days.map((n,a)=>{const r=(a+b)%7,o=0===r||6===r;if(!n)return ze("div",{className:"df-year-fixed-empty-cell","data-weekend":o?"true":"false"},`empty-${t.monthIndex}-${a}`);const i=(e=>e.getTime()===w.getTime())(n);return ze("div",{"data-date":`${n.getFullYear()}-${String(n.getMonth()+1).padStart(2,"0")}-${String(n.getDate()).padStart(2,"0")}`,className:"df-year-fixed-day-cell","data-dragging":G?"true":"false","data-weekend":o?"true":"false",onClick:()=>e.selectDate(n),onDblClick:e=>ee(e,n),onContextMenu:e=>((e,t)=>{e.preventDefault(),e.stopPropagation(),_&&V({x:e.clientX,y:e.clientY,date:t})})(e,n),children:ze("span",{className:"df-year-fixed-day-number","data-today":i?"true":"false",children:n.getDate()})},n.getTime())})}),i.length>0&&ze("div",{className:"df-year-fixed-event-layer",style:{top:20},children:ze("div",{className:"df-year-fixed-event-layer-inner",children:i.map(t=>ze("div",{className:"df-year-fixed-event-hitbox",children:ze(Ja,{event:t.event,isAllDay:!!t.event.allDay,viewType:exports.ViewType.YEAR,yearSegment:t,columnsPerRow:z,isBeingDragged:G&&K.eventId===t.event.id,selectedEventId:P,onMoveStart:W,onResizeStart:U,onEventSelect:L,onDetailPanelToggle:$,newlyCreatedEventId:F,onDetailPanelOpen:()=>Y(null),calendarRef:n,app:e,detailPanelEventId:A,customDetailPanelContent:a,customEventDetailDialog:o,firstHour:0,hourHeight:0,onEventUpdate:t=>e.updateEvent(t.id,t),onEventDelete:t=>e.deleteEvent(t),appTimeZone:D})},t.id))})})]},t.monthIndex)})})}),_&&j&&ze(Na,{x:j.x,y:j.y,date:j.date,viewType:exports.ViewType.YEAR,onClose:()=>V(null),app:e,onCreateEvent:()=>{const e={preventDefault:()=>{},stopPropagation:()=>{},clientX:j.x,clientY:j.y};ee(e,j.date)}})]})},Co=({date:e,events:t,anchorEl:o,position:i,onClose:l,locale:s,app:d,customContent:c,appTimeZone:u})=>{const{t:h}=Tt(),m=r.useRef(null);r.useEffect(()=>{const e=e=>{const t=e.target;!m.current||m.current.contains(t)||o.contains(t)||l()},t=e=>{"Escape"===e.key&&l()};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[o,l]);const g=d.getCalendars(),f=new Map(g.map(e=>[e.id,e])),v=e.toLocaleDateString(s,{weekday:"long",month:"long",day:"numeric"}),p=ze(n.Fragment,{children:[ze("div",{className:"df-year-popup-header",children:ze("div",{className:"df-year-popup-title",children:v})}),ze("div",{className:"df-year-popup-body",children:0===t.length?ze("div",{className:"df-year-popup-empty",children:"No events"}):t.map(e=>{var t,n;const a=e.calendarId?f.get(e.calendarId):void 0,r=null!==(n=null===(t=null==a?void 0:a.colors)||void 0===t?void 0:t.lineColor)&&void 0!==n?n:"#3b82f6";let o="";if(!e.allDay&&e.start){if(o=X(e.start,u).toLocaleTimeString(s,{hour:"2-digit",minute:"2-digit",hour12:!1}),e.end){o+=` – ${X(e.end,u).toLocaleTimeString(s,{hour:"2-digit",minute:"2-digit",hour12:!1})}`}}return ze("div",{className:"df-year-popup-event",children:[ze("div",{className:"df-year-popup-dot",style:{backgroundColor:r}}),ze("div",{className:"df-year-popup-event-main",children:[ze("div",{className:"df-year-popup-event-title",children:e.title}),e.allDay&&ze("div",{className:"df-year-popup-event-meta",children:h("allDay")}),o&&ze("div",{className:"df-year-popup-event-meta",children:o})]})]},e.id)})})]});return a.createPortal(ze("div",{ref:m,"data-grid-day-popup":!0,className:"df-year-popup df-animate-in df-fade-in df-zoom-in-95",style:{top:i.top,left:i.left},children:c?c(e,t):p}),document.body)};function To(e,t,n,a){const r=new Map,o=new Date(t,0,1);o.setHours(0,0,0,0);const i=new Date(t,11,31,23,59,59,999);for(const l of e){if(!l.start)continue;if(!n&&!l.allDay)continue;const e=X(l.start,a),s=l.end?X(l.end,a):new Date(e);if(e.setHours(0,0,0,0),s.setHours(0,0,0,0),e>i||s<o)continue;const d=e<o?new Date(o):new Date(e),c=s>i?new Date(t,11,31):new Date(s);d.setHours(0,0,0,0),c.setHours(0,0,0,0);const u=864e5,h=d.getTime(),m=Math.round((c.getTime()-h)/u);for(let e=0;e<=m;e++){const t=new Date(h+e*u),n=`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`,a=r.get(n);a?a.push(l):r.set(n,[l])}}return r}function So(e){const t=e.getBoundingClientRect(),n=window.innerWidth,a=window.innerHeight;let r=t.right+8;r+256>n-8&&(r=t.left-256-8),r=Math.max(8,Math.min(r,n-256-8));let o=t.top;return o+220>a-8&&(o=a-220-8),o=Math.max(8,o),{top:o,left:r}}const Mo=({app:e,config:t})=>{var n,a,o;const{locale:i,getWeekDaysLabels:l}=Tt(),s=e.getCurrentDate(),d=s.getFullYear(),c=e.getEvents(),u=null!==(n=null==t?void 0:t.startOfWeek)&&void 0!==n?n:1,h=null!==(a=null==t?void 0:t.showTimedEventsInYearView)&&void 0!==a&&a,m=null!==(o=null==t?void 0:t.gridHeatmapLevels)&&void 0!==o?o:5,g=e.timeZone,f=r.useMemo(()=>{const e=ce(g);return e.setHours(0,0,0,0),e},[g]),[v,p]=r.useState(null);r.useEffect(()=>{if(!v)return;const e=e=>{const t=e.target;t.closest("[data-grid-day-popup]")||t.closest("[data-grid-day-cell]")||p(null)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[v]);const y=r.useMemo(()=>To(c,d,h,g),[c,d,h,g]),D=r.useMemo(()=>To(c,d,!0,g),[c,d,g]),w=r.useMemo(()=>l(i,"narrow",u).map(e=>i.startsWith("zh")?e.at(-1):e.charAt(0).toUpperCase()),[i,l,u]),b=r.useMemo(()=>{const e=[];for(let t=0;t<12;t++){const n=new Date(d,t,1),a=new Date(d,t+1,0).getDate(),r=[];for(let e=(n.getDay()-u+7)%7-1;e>=0;e--)r.push({date:new Date(d,t,-e),isCurrentMonth:!1});for(let e=1;e<=a;e++)r.push({date:new Date(d,t,e),isCurrentMonth:!0});let o=1;for(;r.length<42;)r.push({date:new Date(d,t+1,o++),isCurrentMonth:!1});const l=n.toLocaleDateString(i,{month:"long"}),s=l.charAt(0).toUpperCase()+l.slice(1);e.push({monthIndex:t,monthName:s,cells:r})}return e},[d,i,u]),E=r.useCallback((n,a,r)=>{var o,i;const l=null!==(o=null==t?void 0:t.gridDateClick)&&void 0!==o?o:"popup";if("function"==typeof l){const e=`${a.getFullYear()}-${String(a.getMonth()+1).padStart(2,"0")}-${String(a.getDate()).padStart(2,"0")}`;return void l(a,null!==(i=D.get(e))&&void 0!==i?i:[])}if("popup"===l){const e=n.currentTarget;v&&v.date.getTime()===a.getTime()&&v.monthIndex===r?p(null):p({date:a,monthIndex:r,anchorEl:e,position:So(e)})}else"day-view"===l&&(e.setCurrentDate(a),e.changeView(exports.ViewType.DAY))},[t,e,v,D]),C=r.useCallback(n=>{var a,r;const o=null!==(a=null==t?void 0:t.gridDateDoubleClick)&&void 0!==a?a:"day-view";if("function"==typeof o){const e=`${n.getFullYear()}-${String(n.getMonth()+1).padStart(2,"0")}-${String(n.getDate()).padStart(2,"0")}`;return void o(n,null!==(r=D.get(e))&&void 0!==r?r:[])}"day-view"===o&&(p(null),e.setCurrentDate(n),e.changeView(exports.ViewType.DAY))},[t,e,D]),T=r.useMemo(()=>{var e;if(!v)return[];const t=`${v.date.getFullYear()}-${String(v.date.getMonth()+1).padStart(2,"0")}-${String(v.date.getDate()).padStart(2,"0")}`;return[...null!==(e=D.get(t))&&void 0!==e?e:[]].toSorted((e,t)=>{const n=!!e.allDay;return n!==!!t.allDay?n?-1:1:0})},[v,D]);return ze("div",{className:St,children:[ze(er,{calendar:e,viewType:exports.ViewType.YEAR,currentDate:s,customTitle:i.startsWith("zh")||i.startsWith("ja")?`${d}年`:`${d}`,onPrevious:()=>{const t=new Date(s);t.setFullYear(t.getFullYear()-1),e.setCurrentDate(t)},onNext:()=>{const t=new Date(s);t.setFullYear(t.getFullYear()+1),e.setCurrentDate(t)},onToday:()=>e.goToToday()}),ze("div",{className:"df-year-grid",style:{gridTemplateColumns:"repeat(4, 1fr)",gridTemplateRows:"repeat(3, 1fr)"},children:b.map(e=>ze("div",{className:"df-year-grid-month df-year-grid-month",children:[ze("div",{className:"df-year-grid-month-title",children:e.monthName}),ze("div",{className:"df-year-grid-month-body",children:ze("div",{className:"df-year-grid-calendar",style:{gridTemplateColumns:"repeat(7, 1fr)",gridTemplateRows:"repeat(7, 1fr)"},children:[w.map((e,t)=>ze("div",{className:"df-year-grid-weekday",children:e},t)),e.cells.map(({date:t,isCurrentMonth:n},a)=>{var r,o;const i=`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`,l=n&&null!==(o=null===(r=y.get(i))||void 0===r?void 0:r.length)&&void 0!==o?o:0,s=(c=m,0===(d=l)?0:Math.min(d,c));var d,c;const u=n?function(e,t){return 0===e?{}:{backgroundColor:`var(--heat-${Math.min(e,t)})`}}(l,m):{};return ze("div",{"data-grid-day-cell":!0,className:"df-year-grid-day","data-current-month":n?"true":"false",style:u,onClick:n=>E(n,t,e.monthIndex),onDblClick:()=>C(t),children:ze("div",{className:"df-year-grid-day-inner",children:ze("span",{className:"df-year-grid-day-number","data-today":t.getTime()===f.getTime()?"true":"false","data-current-month":n?"true":"false","data-has-events":l>0?"true":"false","data-heat-level":String(s),children:t.getDate()})})},`${e.monthIndex}-${a}`)})]})})]},e.monthIndex))}),v&&ze(Co,{date:v.date,events:T,anchorEl:v.anchorEl,position:v.position,onClose:()=>p(null),locale:i,app:e,customContent:null==t?void 0:t.gridPopupContent,appTimeZone:g})]})},xo=e=>{var t;const n=(null===(t=e.config)||void 0===t?void 0:t.mode)||"year-canvas";return"fixed-week"===n?ze(Eo,Object.assign({},e)):"grid"===n?ze(Mo,{app:e.app,config:e.config}):ze(bo,Object.assign({},e))},ko={},No=e=>n.h(Ur,Object.assign(Object.assign({},e),{viewType:exports.ViewType.YEAR,originalComponent:xo,className:"df-year-view-factory"}));No.displayName="YearViewAdapter";const Io={enableAutoRecalculate:!0,enableValidation:!0,defaultEvents:[],maxEventsPerDay:50};function Ro(e){const t=e.getDay(),n=e.getDate()-t+(0===t?-6:1),a=new Date(e);return a.setDate(n),a.setHours(0,0,0,0),a}Object.defineProperty(exports,"createPortal",{enumerable:!0,get:function(){return a.createPortal}}),exports.AlertCircle=({className:e,width:t=24,height:n=24})=>ze("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:e,children:[ze("circle",{cx:"12",cy:"12",r:"10"}),ze("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),ze("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]}),exports.AudioLines=({className:e,width:t=24,height:n=24})=>ze("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:e,children:[ze("path",{d:"M4 11a9 9 0 0 1 9 9"}),ze("path",{d:"M4 4a16 16 0 0 1 16 16"}),ze("circle",{cx:"5",cy:"19",r:"1"})]}),exports.BlossomColorPicker=Sn,exports.CalendarApp=_e,exports.CalendarEvent=Ja,exports.CalendarRegistry=N,exports.CalendarRenderer=class{constructor(e,t){this.app=e,this.container=null,this.unsubscribe=null,this.renderRequested=!1,this.extraProps={},this.customRenderingStore=new ya(t),t&&this.app.setOverrides(t),this.unsubscribe=e.subscribe(()=>this.requestRender())}setProps(e){Ie(this.extraProps,e)||(this.extraProps=e,this.requestRender())}requestRender(){this.renderRequested||(this.renderRequested=!0,requestAnimationFrame(()=>{this.render(),this.renderRequested=!1}))}mount(e){this.container=e,this.render()}unmount(){this.container&&(n.render(null,this.container),this.container=null),this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null)}getCustomRenderingStore(){return this.customRenderingStore}render(){this.container&&n.render(n.h(En.Provider,{value:this.customRenderingStore},n.h(pa,Object.assign({app:this.app},this.extraProps))),this.container)}},exports.Check=Qt,exports.ChevronDown=Kt,exports.ChevronRight=Gt,exports.ChevronsUpDown=en,exports.ContentSlot=Tn,exports.ContextMenu=Ea,exports.ContextMenuColorPicker=({selectedColor:e,onSelect:t,onCustomColor:n,customColorLabel:a="Custom Color"})=>wa("div",{className:"df-context-menu-color-picker",children:[wa("div",{className:"df-context-menu-color-grid",children:ka.map(n=>wa("button",{type:"button",className:"df-context-menu-color-swatch","data-selected":(null==e?void 0:e.toLowerCase())===n.toLowerCase()?"true":void 0,style:{backgroundColor:n},onClick:e=>{e.stopPropagation(),t(n)},title:n},n))}),n&&wa("button",{type:"button",className:"df-context-menu-custom-color",onClick:e=>{e.stopPropagation(),n()},children:a})]}),exports.ContextMenuItem=Ca,exports.ContextMenuLabel=({children:e})=>wa("div",{className:"df-context-menu-label",children:e}),exports.ContextMenuSeparator=Ta,exports.CreateCalendarDialog=Nn,exports.CustomRenderingStore=ya,exports.DayflowRangePicker=ea,exports.DefaultColorPicker=Mn,exports.DefaultEventDetailDialog=na,exports.DefaultEventDetailPanel=qa,exports.EventContextMenu=Ia,exports.EventLayoutCalculator=$r,exports.GridContextMenu=Na,exports.LAYOUT_CONFIG={INDENT_STEP:2,MIN_WIDTH:25,MARGIN_BETWEEN:2,CONTAINER_WIDTH:320,OVERLAP_THRESHOLD:.25,EDGE_MARGIN:3,MAX_LOAD_IMBALANCE:0,REBALANCE_THRESHOLD:2},exports.LOCALES=l,exports.Loader2=an,exports.LoadingButton=xn,exports.LocaleContext=Ct,exports.LocaleProvider=fn,exports.MiniCalendar=oa,exports.PanelRightClose=({className:e,width:t=24,height:n=24})=>ze("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:e,children:[ze("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),ze("path",{d:"M15 3v18"}),ze("path",{d:"m8 9 3 3-3 3"})]}),exports.PanelRightOpen=({className:e,width:t=24,height:n=24})=>ze("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:e,children:[ze("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),ze("path",{d:"M15 3v18"}),ze("path",{d:"m10 15-3-3 3-3"})]}),exports.Plus=Xt,exports.TIME_STEP=.25,exports.VIRTUAL_MONTH_SCROLL_CONFIG=u,exports.WeekDataCache=h,exports.addDays=function(e,t){const n=new Date(e);return n.setDate(n.getDate()+t),n},exports.buildColorBarGradient=Y,exports.buildDiagonalColorBarGradient=j,exports.buildDiagonalPatternBackground=_,exports.calculateDayIndex=Se,exports.calendarPickerDropdown=Zt,exports.cancelButton="df-btn-sm df-btn-sm-ghost",exports.capitalize=un,exports.clipboardStore=at,exports.compareAllDayDisplayPriority=Dt,exports.compareViews=$e,exports.convertToDayFlowEvent=ft,exports.createAllDayDisplayComparator=wt,exports.createAllDayEvent=function(e,t,n,a){return Xe(Object.assign({id:e,title:t,start:n,end:n,allDay:!0},a))},exports.createConfigSyncSnapshot=Oe,exports.createDateWithHour=T,exports.createDayView=Gr,exports.createEvent=Xe,exports.createEventWithDate=(e,t)=>{var n,a;const r=Ce(t,null!==(n=e.day)&&void 0!==n?n:0),o=null!==(a=e.allDay)&&void 0!==a&&a;return Object.assign(Object.assign({},e),{start:Te(r,o),end:Te(r,o)})},exports.createEventWithPlainDateTime=(e,n)=>{var a,r;const o=Ce(n,null!==(a=e.day)&&void 0!==a?a:0);if(null!==(r=e.allDay)&&void 0!==r&&r){const n=t.Temporal.PlainDate.from({year:o.getFullYear(),month:o.getMonth()+1,day:o.getDate()});return Object.assign(Object.assign({},e),{start:n,end:n})}const i=t.Temporal.PlainDateTime.from({year:o.getFullYear(),month:o.getMonth()+1,day:o.getDate(),hour:o.getHours(),minute:o.getMinutes(),second:o.getSeconds(),millisecond:o.getMilliseconds()});return Object.assign(Object.assign({},e),{start:i,end:i})},exports.createEventWithRealDate=(e,t)=>{var n,a;const r=new Date(t);r.setDate(t.getDate()+(null!==(n=e.day)&&void 0!==n?n:0));const o=null!==(a=e.allDay)&&void 0!==a&&a;return Object.assign(Object.assign({},e),{start:Te(r,o),end:Te(r,o)})},exports.createEventWithZonedDateTime=(e,n,a)=>{var r,o;const i=Ce(n,null!==(r=e.day)&&void 0!==r?r:0);if(null!==(o=e.allDay)&&void 0!==o&&o){const n=t.Temporal.PlainDate.from({year:i.getFullYear(),month:i.getMonth()+1,day:i.getDate()});return Object.assign(Object.assign({},e),{start:n,end:n})}const l=t.Temporal.ZonedDateTime.from({year:i.getFullYear(),month:i.getMonth()+1,day:i.getDate(),hour:i.getHours(),minute:i.getMinutes(),second:i.getSeconds(),millisecond:i.getMilliseconds(),timeZone:a});return Object.assign(Object.assign({},e),{start:l,end:l})},exports.createEvents=function(e){return e.map(e=>Xe(e))},exports.createEventsPlugin=function(t={}){const n=Object.assign(Object.assign({},Io),t);let a;const r={getAll:()=>a.getAllEvents(),getById:e=>a.getAllEvents().find(t=>t.id===e),add:e=>{if(n.enableValidation){const t=r.validateEvent(e);if(t.length>0)throw new Error(`Event validation failed: ${t.join(", ")}`)}if(n.maxEventsPerDay&&void 0!==e.day){if(r.getByDay(e.day,a.getCurrentDate()).length>=n.maxEventsPerDay)throw new Error(`Maximum events per day (${n.maxEventsPerDay}) exceeded`)}if(a.addEvent(e),n.enableAutoRecalculate){const e=Ro(a.getCurrentDate());a.state.events=Me(a.getAllEvents(),e)}},update:(t,o)=>e.__awaiter(this,void 0,void 0,function*(){const e=r.getById(t);if(!e)throw new Error(`Event with id ${t} not found`);const i=Object.assign(Object.assign({},e),o);if(n.enableValidation){const e=r.validateEvent(i);if(e.length>0)throw new Error(`Event validation failed: ${e.join(", ")}`)}if(yield a.updateEvent(t,o),n.enableAutoRecalculate){const e=Ro(a.getCurrentDate());a.state.events=Me(a.getAllEvents(),e)}}),delete:t=>e.__awaiter(this,void 0,void 0,function*(){yield a.deleteEvent(t)}),getByDate:e=>a.getAllEvents().filter(t=>{const n=p(t.start);n.setHours(0,0,0,0);const a=new Date(e);return a.setHours(0,0,0,0),n.getTime()===a.getTime()}),getByDateRange:(e,t)=>a.getAllEvents().filter(n=>{const a=p(n.start),r=p(n.end);return a>=e&&a<=t||r>=e&&r<=t||a<=e&&r>=t}),getByDay:(e,t)=>a.getAllEvents().filter(t=>t.day===e),getAllDayEvents:(e,t)=>t.filter(t=>t.day===e&&t.allDay),recalculateEventDays:(e,t)=>Me(e,t),validateEvent:e=>{const t=[];return e.title&&""!==e.title.trim()||t.push("Event title is required"),e.start||t.push("Event start time is required"),e.end||t.push("Event end time is required"),e.start&&e.end&&!e.allDay&&e.start>=e.end&&t.push("Start time must be before end time"),t},filterEvents:(e,t)=>e.filter(t)};return{name:"events",config:n,install:e=>{a=e},api:r}},exports.createMonthView=go,exports.createNormalizedCalendarAppConfigGetter=function(e){let t=e().allDaySortComparator;const n=(e,n)=>{var a;return null!==(a=null==t?void 0:t(e,n))&&void 0!==a?a:0};return()=>{const a=e();return t=a.allDaySortComparator,Object.assign(Object.assign({},a),{allDaySortComparator:a.allDaySortComparator?n:void 0})}},exports.createStandardViews=function(e){return[Gr(null==e?void 0:e.day),ro(null==e?void 0:e.week),go(null==e?void 0:e.month)]},exports.createTemporalWithHour=y,exports.createTimedEvent=function(e,t,n,a,r){return Xe(Object.assign({id:e,title:t,start:n,end:a},r))},exports.createTimezoneEvent=Je,exports.createTimezoneEvents=function(e){return e.map(e=>Je(e))},exports.createWeekView=ro,exports.createYearView=(e={})=>{const t=Object.assign(Object.assign({},ko),e);return{type:exports.ViewType.YEAR,component:No,config:t}},exports.dateToPlainDate=Q,exports.dateToPlainDateTime=ee,exports.dateToZonedDateTime=te,exports.daysBetween=function(e,n){const a=e=>{if(g(e))return e;if("function"==typeof e.toPlainDate)return e.toPlainDate();const n=e;return t.Temporal.PlainDate.from({year:n.year,month:n.month,day:n.day})},r=a(e),o=a(n);return r.until(o).days},exports.daysDifference=E,exports.downloadICS=function(e,t={}){const n=pt(e,t),a=`${t.filename||"calendar"}.ics`,r=new Blob([n],{type:"text/calendar;charset=utf-8"}),o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.setAttribute("download",a),document.body.append(i),i.click(),i.remove(),URL.revokeObjectURL(o)},exports.en=i,exports.escapeICSValue=st,exports.extractHourFromDate=C,exports.extractHourFromTemporal=function(e){if(e instanceof Date)return e.getHours()+e.getMinutes()/60;if(B(e))return 0;const t=e;return t.hour+t.minute/60},exports.extractVEvents=mt,exports.foldLine=ct,exports.formatDate=e=>{const t=e.year,n=e.month;return`${e.day} ${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][n-1]} ${t}`},exports.formatDateConsistent=We,exports.formatDateToICSTimestamp=lt,exports.formatEventTimeRange=ie,exports.formatICSDate=it,exports.formatMonthYear=e=>`${["January","February","March","April","May","June","July","August","September","October","November","December"][e.getMonth()]} ${e.getFullYear()}`,exports.formatProperty=ut,exports.formatTime=re,exports.generateDayData=ye,exports.generateICS=pt,exports.generateSecondaryTimeSlots=le,exports.generateUniKey=Ne,exports.generateVEvent=ht,exports.generateWeekData=we,exports.generateWeekRange=be,exports.generateWeeksData=(e,t=3)=>{const n=5*t,{monday:a}=pe(e),r=[],o=Math.floor(n/2),i=new Date(a);i.setDate(i.getDate()-7*o);for(let e=0;e<n;e++){const t=new Date(i);t.setDate(t.getDate()+7*e),r.push(we(t))}return r},exports.getAllDayEventsForDay=(e,t,n)=>t.filter(t=>{if(!t.allDay)return!1;if(!n)return t.day===e;const a=new Date(n);a.setDate(n.getDate()+e),a.setHours(0,0,0,0);const r=p(t.start);r.setHours(0,0,0,0);const o=p(t.end);return o.setHours(0,0,0,0),a>=r&&a<=o}),exports.getAllDayRangeMetrics=yt,exports.getCalendarColorsForHex=O,exports.getCalendarEventBgColors=V,exports.getCalendarLineColors=F,exports.getCallbackConfigUpdate=He,exports.getCurrentWeekDates=(e=1)=>{const t=new Date,n=new Date,a=(t.getDay()-e+7)%7;return ge.map((e,r)=>{const o=new Date(t);return o.setDate(t.getDate()-a+r),{date:o.getDate(),month:o.toLocaleString("default",{month:"short"}),isToday:o.getDate()===n.getDate()&&o.getMonth()===n.getMonth()&&o.getFullYear()===n.getFullYear()}})},exports.getDateByDayIndex=Ce,exports.getDateObj=Qe,exports.getDayIndexByDate=(e,t)=>{const n=new Date(e);n.setHours(0,0,0,0);const a=new Date(t);a.setHours(0,0,0,0);const r=a.getTime()-n.getTime();return Math.floor(r/864e5)},exports.getEndOfDay=e=>{if(e instanceof Date){const t=new Date(e);return t.setHours(23,59,59,999),t}return b(e)},exports.getEndOfTemporal=b,exports.getEventBgColor=H,exports.getEventEndHour=oe,exports.getEventTextColor=P,exports.getEventsForDay=Ee,exports.getEventsForWeek=(e,t)=>{const n=new Date(t);return n.setDate(t.getDate()+6),n.setHours(23,59,59,999),e.filter(e=>{const a=p(e.start);return a>=t&&a<=n}).map(e=>{const n=Se(p(e.start),t);return Object.assign(Object.assign({},e),{day:n})})},exports.getIntlLabel=cn,exports.getLineColor=L,exports.getMonthLabels=mn,exports.getMonthYearOfWeek=De,exports.getNextHourRangeInTimeZone=ue,exports.getNowInTimeZone=de,exports.getPlainDate=ne,exports.getPrimaryCalendarId=$,exports.getSearchHeaderInfo=tt,exports.getSelectedBgColor=A,exports.getStartOfDay=e=>{if(e instanceof Date){const t=new Date(e);return t.setHours(0,0,0,0),t}return w(e)},exports.getStartOfTemporal=w,exports.getSyncConfigUpdates=Pe,exports.getTestEvents=function(){const e=new Date,n=e.getDay(),a=new Date(e),r=0===n?-6:1-n;return a.setDate(e.getDate()+r),a.setHours(0,0,0,0),[{id:"15",title:"C-早开始",day:3,startHour:8.5,endHour:10,calendarId:"teal"},{id:"16",title:"D-晚开始",day:3,startHour:9,endHour:10.5,calendarId:"red"},{id:"21",title:"A",day:0,startHour:14,endHour:16,calendarId:"blue"},{id:"22",title:"B",day:0,startHour:14.5,endHour:16,calendarId:"green"},{id:"23",title:"C",day:0,startHour:14.5,endHour:16,calendarId:"purple"},{id:"24",title:"D",day:0,startHour:15,endHour:16,calendarId:"yellow"},{id:"25",title:"E",day:0,startHour:15,endHour:16,calendarId:"red"},{id:"26",title:"F",day:0,startHour:15.5,endHour:16,calendarId:"orange"},{id:"27",title:"G",day:0,startHour:15,endHour:16,calendarId:"pink"},{id:"28",title:"H",day:0,startHour:15.5,endHour:16,calendarId:"teal"},{id:"29",title:"L",day:0,startHour:15.5,endHour:16,calendarId:"teal"},{id:"30",title:"I",day:0,startHour:15.5,endHour:16,calendarId:"blue"},{id:"99",title:"X",day:0,startHour:15.5,endHour:16,calendarId:"blue"},{id:"6",title:"假日",day:0,startHour:0,endHour:0,calendarId:"blue",allDay:!0},{id:"7",title:"研讨会",day:2,startHour:0,endHour:0,calendarId:"green",allDay:!0},{id:"8",title:"团队建设",day:4,startHour:0,endHour:0,calendarId:"purple",allDay:!0},{id:"41",title:"A",day:3,startHour:16,endHour:18.25,calendarId:"blue"},{id:"42",title:"B",day:3,startHour:16.5,endHour:18,calendarId:"green"},{id:"43",title:"C",day:3,startHour:16.75,endHour:17.75,calendarId:"purple"},{id:"44",title:"D",day:3,startHour:17,endHour:19,calendarId:"yellow"},{id:"45",title:"E",day:3,startHour:17.75,endHour:18.75,calendarId:"red"},{id:"46",title:"X",day:2,startHour:15,endHour:15.75,calendarId:"orange"},{id:"47",title:"Y",day:2,startHour:15.5,endHour:19.5,calendarId:"pink"},{id:"48",title:"Z",day:2,startHour:15,endHour:15.75,calendarId:"teal"},{id:"59",title:"Q",day:2,startHour:17,endHour:18,calendarId:"teal"},{id:"60",title:"W",day:2,startHour:15.5,endHour:18,calendarId:"teal"},{id:"31",title:"A",day:6,startHour:14,endHour:16,calendarId:"blue"},{id:"32",title:"B",day:6,startHour:14.5,endHour:16,calendarId:"green"},{id:"33",title:"C",day:6,startHour:14.5,endHour:16,calendarId:"purple"},{id:"34",title:"D",day:6,startHour:15,endHour:16,calendarId:"yellow"},{id:"35",title:"E",day:6,startHour:15.5,endHour:16.5,calendarId:"red"},{id:"36",title:"F",day:6,startHour:16.25,endHour:16.75,calendarId:"orange"},{id:"37",title:"G",day:6,startHour:16,endHour:17.25,calendarId:"pink"},{id:"51",title:"下周会议1",day:1,startHour:9,endHour:10,calendarId:"blue"},{id:"52",title:"下周会议2",day:3,startHour:14,endHour:15,calendarId:"green"},{id:"81",title:"A",day:5,startHour:14,endHour:16,calendarId:"blue"},{id:"82",title:"B",day:5,startHour:14.5,endHour:16,calendarId:"green"},{id:"83",title:"C",day:5,startHour:14.5,endHour:16,calendarId:"purple"},{id:"84",title:"D",day:5,startHour:15,endHour:16,calendarId:"yellow"},{id:"85",title:"E",day:5,startHour:15,endHour:16,calendarId:"red"},{id:"86",title:"F",day:5,startHour:15.75,endHour:17,calendarId:"orange"},{id:"87",title:"G",day:5,startHour:14.75,endHour:17.5,calendarId:"pink"}].map(e=>{const n=new Date(a);if(n.setDate(a.getDate()+e.day),e.allDay)return{id:e.id,title:e.title,start:t.Temporal.PlainDate.from({year:n.getFullYear(),month:n.getMonth()+1,day:n.getDate()}),end:t.Temporal.PlainDate.from({year:n.getFullYear(),month:n.getMonth()+1,day:n.getDate()}),allDay:!0,calendarId:e.calendarId,day:e.day};const r=Math.floor(e.startHour),o=Math.round(60*(e.startHour-r)),i=Math.floor(e.endHour),l=Math.round(60*(e.endHour-i));return{id:e.id,title:e.title,start:t.Temporal.ZonedDateTime.from({year:n.getFullYear(),month:n.getMonth()+1,day:n.getDate(),hour:r,minute:o,timeZone:t.Temporal.Now.timeZoneId()}),end:t.Temporal.ZonedDateTime.from({year:n.getFullYear(),month:n.getMonth()+1,day:n.getDate(),hour:i,minute:l,timeZone:t.Temporal.Now.timeZoneId()}),allDay:!1,calendarId:e.calendarId,day:e.day}})},exports.getTimezoneDisplayLabel=se,exports.getTodayInTimeZone=ce,exports.getWeekDaysLabels=hn,exports.getWeekNumber=S,exports.getWeekRange=pe,exports.groupSearchResults=nt,exports.hasEventChanged=ke,exports.importICSFile=function(t,n){return e.__awaiter(this,void 0,void 0,function*(){try{const e=yield t.text();if(!e)throw new Error("File content is empty");return vt(e,n)}catch(e){return{success:!1,events:[],errors:[{message:e instanceof Error?e.message:"string"==typeof e?e:"Failed to read file"}],totalParsed:0,totalImported:0}}})},exports.isDate=function(e){return e instanceof Date},exports.isDeepEqual=Ie,exports.isEventDeepEqual=xe,exports.isEventInWeek=(e,t)=>{const n=Se(e,t);return n>=0&&n<=6},exports.isMultiDayEvent=(e,t)=>!M(e,t),exports.isMultiDayTemporalEvent=function(e,t){return!D(e,t)},exports.isPlainDate=B,exports.isPlainDateTime=q,exports.isSameDay=M,exports.isSamePlainDate=D,exports.isSameTemporal=function(e,t){if(e instanceof Date&&t instanceof Date)return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate();const n=ne(e),a=ne(t);return n.equals(a)},exports.isValidLocale=d,exports.isZonedDateTime=G,exports.monthNames=fe,exports.normalizeCssWidth=function(e,t="240px"){return"number"==typeof e?`${e}px`:"string"==typeof e&&e.trim().length>0?e:t},exports.normalizeDate=et,exports.normalizeLocale=s,exports.normalizeTimeZoneValue=U,exports.now=function(e=t.Temporal.Now.timeZoneId()){return t.Temporal.Now.zonedDateTimeISO(e)},exports.pad2=rt,exports.parseICS=vt,exports.parseICSDate=ot,exports.parseVEventLines=gt,exports.pickSyncableConfig=Re,exports.plainDateTimeToDate=function(e){return new Date(e.year,e.month-1,e.day,e.hour,e.minute,e.second||0,e.millisecond||0)},exports.plainDateToDate=function(e){return new Date(e.year,e.month-1,e.day)},exports.recalculateEventDays=Me,exports.registerDragImplementation=function(e){_r=e},exports.registerLocale=function(e){const t=e.code.split("-")[0].toLowerCase();l[t]=e},exports.registerSidebarImplementation=function(e){ma=e},exports.resolveAppliedTheme=qe,exports.restoreTimedDragFromAllDayTransition=({wasOriginallyAllDay:e,mouseHour:t,hourOffset:n,duration:a,originalStartHour:r,originalEndHour:o,firstHour:i,lastHour:l,minDuration:s,roundToTimeStep:d})=>{const c=e?1:Math.max(s,a||o-r||1);let u=d(e?t:t+(null!=n?n:0));return u=Math.max(i,Math.min(l-c,u)),{startHour:u,endHour:u+c,duration:c,hourOffset:e?0:null!=n?n:0}},exports.restoreVisualEventToCanonical=me,exports.restoreVisualTimedTemporalToCanonical=he,exports.roundToTimeStep=e=>.25*Math.round(e/.25),exports.scrollbarTakesSpace=Be,exports.setHourInTemporal=function(e,t){const n=Math.floor(t),a=Math.round(60*(t-n));return G(e),e.with({hour:n,minute:a,second:0,millisecond:0})},exports.shortMonthNames=ve,exports.sidebarContainer="df-sidebar",exports.sidebarHeader="df-sidebar-header",exports.sidebarHeaderTitle="df-sidebar-header-title",exports.sidebarHeaderToggle="df-sidebar-toggle",exports.sortAllDayByTitle=(e,t)=>e.title.localeCompare(t.title),exports.subscribeCalendar=function(t){return e.__awaiter(this,void 0,void 0,function*(){const e=yield fetch(t);if(!e.ok)throw new Error(`HTTP ${e.status}`);const n=yield e.text(),a=vt(n),r=n.match(/X-WR-CALNAME[^:]*:([^\r\n]+)/),o=r?r[1].trim():new URL(t).hostname,i=["#3b82f6","#10b981","#8b5cf6","#f59e0b","#ef4444","#f97316","#ec4899","#14b8a6","#6366f1","#6b7280"],l=i[Math.floor(Math.random()*i.length)],{colors:s,darkColors:d}=O(l);return{calendar:{id:Ne(),name:o,isVisible:!0,colors:s,darkColors:d,subscription:{url:t,status:"ready"}},events:a.events}})},exports.syncCalendarAppConfig=function(e,t,n){const a=Oe(n),r=He(t.callbacks,a.callbacks);r&&e.updateConfig(r);const o=Pe(t.syncableConfig,a.syncableConfig);return Object.keys(o).length>0&&e.updateConfig(o),a},exports.t=gn,exports.temporalToDate=K,exports.temporalToVisualDate=X,exports.temporalToVisualTemporal=J,exports.today=function(e=t.Temporal.Now.timeZoneId()){return t.Temporal.Now.plainDateISO(e)},exports.unescapeICSValue=dt,exports.updateEventDateAndDay=(e,n,a)=>{const r=Ce(a,n);return Object.assign(Object.assign({},e),{day:n,start:e.allDay?t.Temporal.PlainDate.from({year:r.getFullYear(),month:r.getMonth()+1,day:r.getDate()}):t.Temporal.ZonedDateTime.from({year:r.getFullYear(),month:r.getMonth()+1,day:r.getDate(),hour:r.getHours(),minute:r.getMinutes(),timeZone:t.Temporal.Now.timeZoneId()}),end:e.allDay?t.Temporal.PlainDate.from({year:r.getFullYear(),month:r.getMonth()+1,day:r.getDate()}):t.Temporal.ZonedDateTime.from({year:r.getFullYear(),month:r.getMonth()+1,day:r.getDate(),hour:r.getHours(),minute:r.getMinutes(),timeZone:t.Temporal.Now.timeZoneId()})})},exports.updateEventWithRealDate=(e,t,n)=>{var a;const r=new Date(n);r.setDate(n.getDate()+t);const o=null!==(a=e.allDay)&&void 0!==a&&a;return Object.assign(Object.assign({},e),{day:t,start:Te(r,o),end:Te(r,o)})},exports.useDragForView=zr,exports.useLocale=Tt,exports.useSidebarBridge=fa,exports.weekDays=ge,exports.weekDaysFullName=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],exports.zonedDateTimeToDate=v;
|