@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.esm.js CHANGED
@@ -1 +1 @@
1
- import{__awaiter as e,__rest as t}from"tslib";import{Temporal as n}from"temporal-polyfill";import{options as a,createContext as r,Fragment as o,h as i,render as l,isValidElement as s,cloneElement as d}from"preact";import{createPortal as c,forwardRef as u,memo as h}from"preact/compat";export{createPortal}from"preact/compat";import{useState as g,useEffect as m,useRef as v,useCallback as f,useMemo as p,useLayoutEffect as y,useContext as D}from"preact/hooks";import{BlossomColorPicker as w,hexToHsl as b,lightnessToSliderValue as E,DEFAULT_COLORS as C,hslToHex as T}from"@dayflow/blossom-color-picker";const S={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."}},M={en:S};function N(e){const t=e.code.split("-")[0].toLowerCase();M[t]=e}function I(e){const t=e.split("-")[0].toLowerCase();return t in M?t:"en"}function k(e){try{new Intl.DateTimeFormat(e);return!0}catch(e){return!1}}var x;!function(e){e.DAY="day",e.WEEK="week",e.MONTH="month",e.YEAR="year",e.RESOURCE="resource"}(x||(x={}));const O={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},R={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=R.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 A;function P(e){var t;if(!e||"object"!=typeof e)return!1;if(e instanceof Date)return!1;if(e instanceof n.PlainDate)return!0;const a=e;return"PlainDate"===(null===(t=a.constructor)||void 0===t?void 0:t.name)||!("hour"in a)&&!("timeZone"in a)&&"year"in a&&"month"in a&&"day"in a}function L(e){return e instanceof Date}function $(e,t=n.Now.timeZoneId()){return n.Instant.fromEpochMilliseconds(e.getTime()).toZonedDateTimeISO(t)}function j(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 Y(e,t){if(e instanceof Date)return e;if(P(e))return function(e,t=n.Now.timeZoneId()){if("function"==typeof e.toZonedDateTime)try{return j(e.toZonedDateTime({timeZone:t,plainTime:n.PlainTime.from({hour:0,minute:0})}))}catch(e){}return new Date(e.year,e.month-1,e.day)}(e,t);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 j(e)}return new Date(e)}function F(e,t){const a=Math.floor(t),r=Math.round(60*(t-a));if(P(e))return n.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 n.PlainDateTime.from({year:o.year,month:o.month,day:o.day,hour:a,minute:r})}function Z(e,t){if(e instanceof Date&&t instanceof Date)return e.toDateString()===t.toDateString();const a=e=>{if(e instanceof Date)return t=e,n.PlainDate.from({year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()});var t;if(P(e))return e;if("function"==typeof e.toPlainDate)return e.toPlainDate();const a=e;return n.PlainDate.from({year:a.year,month:a.month,day:a.day})},r=a(e),o=a(t);return 0===n.PlainDate.compare(r,o)}function z(e,t){return!Z(e,t)}function _(e,t=n.Now.timeZoneId()){if("function"==typeof e.toZonedDateTime){return(P(e)?e:e.toPlainDate()).toZonedDateTime({timeZone:t,plainTime:n.PlainTime.from({hour:0,minute:0})})}const a=e;return(P(e)?e:n.PlainDate.from({year:a.year,month:a.month,day:a.day})).toZonedDateTime({timeZone:t,plainTime:n.PlainTime.from({hour:0,minute:0})})}function U(e,t=n.Now.timeZoneId()){if("function"==typeof e.toZonedDateTime){return(P(e)?e:e.toPlainDate()).toZonedDateTime({timeZone:t,plainTime:n.PlainTime.from({hour:23,minute:59,second:59,millisecond:999})})}const a=e;return(P(e)?e:n.PlainDate.from({year:a.year,month:a.month,day:a.day})).toZonedDateTime({timeZone:t,plainTime:n.PlainTime.from({hour:23,minute:59,second:59,millisecond:999})})}function W(e,t){const a=e=>{if(P(e))return e;if("function"==typeof e.toPlainDate)return e.toPlainDate();const t=e;return n.PlainDate.from({year:t.year,month:t.month,day:t.day})},r=a(e),o=a(t);return r.until(o).days}function B(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)}function V(e,t){const n=new Date(e);return n.setDate(n.getDate()+t),n}function q(e=n.Now.timeZoneId()){return n.Now.zonedDateTimeISO(e)}function G(e=n.Now.timeZoneId()){return n.Now.plainDateISO(e)}!function(e){e.UTC="UTC",e.NEW_YORK="America/New_York",e.CHICAGO="America/Chicago",e.DENVER="America/Denver",e.LOS_ANGELES="America/Los_Angeles",e.TORONTO="America/Toronto",e.VANCOUVER="America/Vancouver",e.PHOENIX="America/Phoenix",e.ANCHORAGE="America/Anchorage",e.HONOLULU="Pacific/Honolulu",e.MEXICO_CITY="America/Mexico_City",e.WINNIPEG="America/Winnipeg",e.HALIFAX="America/Halifax",e.ST_JOHNS="America/St_Johns",e.DETROIT="America/Detroit",e.LONDON="Europe/London",e.PARIS="Europe/Paris",e.BERLIN="Europe/Berlin",e.MADRID="Europe/Madrid",e.ROME="Europe/Rome",e.AMSTERDAM="Europe/Amsterdam",e.ZURICH="Europe/Zurich",e.STOCKHOLM="Europe/Stockholm",e.OSLO="Europe/Oslo",e.COPENHAGEN="Europe/Copenhagen",e.MOSCOW="Europe/Moscow",e.ISTANBUL="Europe/Istanbul",e.DUBLIN="Europe/Dublin",e.LISBON="Europe/Lisbon",e.PRAGUE="Europe/Prague",e.VIENNA="Europe/Vienna",e.WARSAW="Europe/Warsaw",e.BRUSSELS="Europe/Brussels",e.ATHENS="Europe/Athens",e.BUCHAREST="Europe/Bucharest",e.HELSINKI="Europe/Helsinki",e.KYIV="Europe/Kyiv",e.BUDAPEST="Europe/Budapest",e.BELGRADE="Europe/Belgrade",e.LUXEMBOURG="Europe/Luxembourg",e.MONACO="Europe/Monaco",e.REYKJAVIK="Atlantic/Reykjavik",e.TOKYO="Asia/Tokyo",e.SHANGHAI="Asia/Shanghai",e.HONG_KONG="Asia/Hong_Kong",e.TAIPEI="Asia/Taipei",e.SEOUL="Asia/Seoul",e.SINGAPORE="Asia/Singapore",e.HANOI="Asia/Ho_Chi_Minh",e.BANGKOK="Asia/Bangkok",e.JAKARTA="Asia/Jakarta",e.KUALA_LUMPUR="Asia/Kuala_Lumpur",e.MANILA="Asia/Manila",e.DUBAI="Asia/Dubai",e.KOLKATA="Asia/Kolkata",e.RIYADH="Asia/Riyadh",e.TEHRAN="Asia/Tehran",e.JERUSALEM="Asia/Jerusalem",e.TEL_AVIV="Asia/Tel_Aviv",e.BAGHDAD="Asia/Baghdad",e.DHAKA="Asia/Dhaka",e.KARACHI="Asia/Karachi",e.KABUL="Asia/Kabul",e.KATHMANDU="Asia/Kathmandu",e.COLOMBO="Asia/Colombo",e.TASHKENT="Asia/Tashkent",e.ALMATY="Asia/Almaty",e.PHNOM_PENH="Asia/Phnom_Penh",e.VIENTIANE="Asia/Vientiane",e.MUSCAT="Asia/Muscat",e.SYDNEY="Australia/Sydney",e.MELBOURNE="Australia/Melbourne",e.BRISBANE="Australia/Brisbane",e.PERTH="Australia/Perth",e.ADELAIDE="Australia/Adelaide",e.DARWIN="Australia/Darwin",e.HOBART="Australia/Hobart",e.AUCKLAND="Pacific/Auckland",e.FIJI="Pacific/Fiji",e.GUAM="Pacific/Guam",e.NOUMEA="Pacific/Noumea",e.PAGO_PAGO="Pacific/Pago_Pago",e.PORT_MORESBY="Pacific/Port_Moresby",e.SAO_PAULO="America/Sao_Paulo",e.BUENOS_AIRES="America/Argentina/Buenos_Aires",e.SANTIAGO="America/Santiago",e.LIMA="America/Lima",e.BOGOTA="America/Bogota",e.CARACAS="America/Caracas",e.LA_PAZ="America/La_Paz",e.MONTEVIDEO="America/Montevideo",e.QUITO="America/Quito",e.ASUNCION="America/Asuncion",e.GEORGETOWN="America/Guyana",e.CAIRO="Africa/Cairo",e.JOHANNESBURG="Africa/Johannesburg",e.LAGOS="Africa/Lagos",e.NAIROBI="Africa/Nairobi",e.CASABLANCA="Africa/Casablanca",e.ALGIERS="Africa/Algiers",e.TUNIS="Africa/Tunis",e.ADDIS_ABABA="Africa/Addis_Ababa",e.ACCRA="Africa/Accra",e.DAKAR="Africa/Dakar",e.LUANDA="Africa/Luanda",e.ANTANANARIVO="Indian/Antananarivo",e.KINSHASA="Africa/Kinshasa",e.DAR_ES_SALAAM="Africa/Dar_es_Salaam",e.MCMURDO="Antarctica/McMurdo",e.CASEY="Antarctica/Casey"}(A||(A={}));const K=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(P(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)},X=(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 F(e,t)},J=e=>{if(e instanceof Date){const t=new Date(e);return t.setHours(0,0,0,0),t}return _(e)},Q=e=>{if(e instanceof Date){const t=new Date(e);return t.setHours(23,59,59,999),t}return U(e)},ee=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)},te=(e,t)=>{if(e instanceof Date&&t instanceof Date)return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate();return Z(e instanceof Date?n.PlainDate.from({year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}):P(e)?e:e.toPlainDate(),t instanceof Date?n.PlainDate.from({year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()}):P(t)?t:t.toPlainDate())},ne=(e,t)=>!te(e,t),ae=e=>!e.readOnly&&!e.subscription,re=[{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 oe{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)}):re.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&&ae(e)?e:this.getAll().find(ae)}setTheme(e){this.currentTheme=e}getTheme(){return this.currentTheme}resolveColors(e,t){const n=t||this.currentTheme,a=oe.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 ie=new oe;function le(){return ie}function se(e){const t=re.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 de=(e,t)=>(t||le()).resolveColors(e).eventColor,ce=(e,t)=>(t||le()).resolveColors(e).textColor,ue=(e,t)=>(t||le()).resolveColors(e).eventSelectedColor,he=(e,t)=>(t||le()).resolveColors(e).lineColor,ge=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"},me=(e,t)=>{var n;const a=t||le();return(null!==(n=e.calendarIds)&&void 0!==n?n:e.calendarId?[e.calendarId]:["blue"]).map(e=>a.getLineColor(e))},ve=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(", ")})`},fe=(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(", ")})`},pe=(e,t)=>{var n;const a=t||le();return(null!==(n=e.calendarIds)&&void 0!==n?n:e.calendarId?[e.calendarId]:["blue"]).map(e=>a.resolveColors(e).eventColor)},ye=(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 De=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)}},we=new Map;function be(e){try{return new Intl.DateTimeFormat("en",{timeZone:e}).resolvedOptions().timeZone}catch(e){return}}function Ee(e){if(!e||"string"!=typeof e)return;const t=e.trim();if(!t)return;const n=we.get(t);if(n)return n;const a=be(t);if(a)return we.set(t,a),a;const r=Object.values(A).find(e=>e.toLowerCase()===t.toLowerCase());if(r){const e=be(r);return e?(we.set(t,e),e):(we.set(t,r),r)}if("function"==typeof Intl.supportedValuesOf){const e=Intl.supportedValuesOf("timeZone").find(e=>e.toLowerCase()===t.toLowerCase());if(e)return we.set(t,e),e}const o=be(t.split("/").map(e=>e.split("_").map(e=>e?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():e).join("_")).join("/"));if(o)return we.set(t,o),o;const i=be(t.split("/").map((e,t)=>0===t?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():e).join("/"));return i?(we.set(t,i),i):t}function Ce(e){return null!==e&&"object"==typeof e&&!("hour"in e)&&"year"in e&&"month"in e&&"day"in e&&!(e instanceof Date)}function Te(e){return null!==e&&"object"==typeof e&&"hour"in e&&!("timeZone"in e)&&!("timeZoneId"in e)&&"year"in e&&!(e instanceof Date)}function Se(e){return null!==e&&"object"==typeof e&&("timeZone"in e||"timeZoneId"in e)&&"year"in e&&!(e instanceof Date)}function Me(e){if(e instanceof Date)return e;if(Ce(e))return new Date(e.year,e.month-1,e.day);if(Te(e))return new Date(e.year,e.month-1,e.day,e.hour,e.minute,e.second||0,e.millisecond||0);if(Se(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 Ne(e,t){if(e instanceof Date)return e;if(!t)return Me(e);const a=Ee(t);if(!a)return Me(e);try{if(Se(e)){const t=("function"==typeof e.withTimeZone?e:n.ZonedDateTime.from(e)).withTimeZone(a);return new Date(t.year,t.month-1,t.day,t.hour,t.minute,t.second||0,t.millisecond||0)}if(Te(e)){const t="function"==typeof e.toZonedDateTime?e:n.PlainDateTime.from(e),r=t.toZonedDateTime(n.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){De.error("Failed to shift visual timezone:",e)}return Me(e)}function Ie(e,t){if(!t)return e;const a=Ee(t);if(!a)return e;try{if(Se(e)){return("function"==typeof e.withTimeZone?e:n.ZonedDateTime.from(e)).withTimeZone(a)}if(Te(e)){return("function"==typeof e.toZonedDateTime?e:n.PlainDateTime.from(e)).toZonedDateTime(n.Now.timeZoneId()).withTimeZone(a)}}catch(e){De.error("Failed to shift visual temporal:",e)}return e}function ke(e){return n.PlainDate.from({year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()})}function xe(e){return n.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 Oe(e,t=n.Now.timeZoneId()){return n.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})}function Re(e){return new Date(e.year,e.month-1,e.day,e.hour,e.minute,e.second||0,e.millisecond||0)}function He(e){return new Date(e.year,e.month-1,e.day)}function Ae(e){if(e instanceof Date)return e.getHours()+e.getMinutes()/60;if(Ce(e))return 0;const t=e;return t.hour+t.minute/60}function Pe(e,t){const n=Math.floor(t),a=Math.round(60*(t-n));return Se(e),e.with({hour:n,minute:a,second:0,millisecond:0})}function Le(e){return e instanceof Date?ke(e):Ce(e)?e:(Te(e),e.toPlainDate())}function $e(e,t){if(e instanceof Date&&t instanceof Date)return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate();const n=Le(e),a=Le(t);return n.equals(a)}const je=e=>new Date(e.year,e.month-1,e.day,e.hour,e.minute,e.second,Math.floor(e.millisecond)),Ye=.25,Fe=(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")}`},Ze=e=>{if(!e.end)return 0;const t=K(e.end);if(e.allDay||!e.start)return t;const n=Y(e.start),a=Y(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},ze=(e,t="24h")=>{const n=K(e.start),a=Ze(e);return`${Fe(n,0,t)} - ${Fe(a,0,t)}`},_e=e=>.25*Math.round(e/.25),Ue=(e,t,a="24h",r=new Date,o)=>{const i=Ee(t);if(!i)return e.map(()=>"");const l=null!=o?o:n.Now.timeZoneId(),s=r.getFullYear(),d=r.getMonth()+1,c=r.getDate();return e.map(e=>{try{const t=e.hour%24,r=n.ZonedDateTime.from({year:s,month:d,day:c,hour:t,minute:0,second:0,timeZone:l}).withTimeZone(i);return Fe(r.hour,r.minute,a)}catch(e){return""}})},We=(e,t=new Date)=>{var n,a;const r=Ee(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}},Be=e=>{var t;const a=null!==(t=e?Ee(e):void 0)&&void 0!==t?t:n.Now.timeZoneId();return je(n.Now.zonedDateTimeISO(a))},Ve=e=>{var t;const a=null!==(t=e?Ee(e):void 0)&&void 0!==t?t:n.Now.timeZoneId(),r=n.Now.plainDateISO(a);return new Date(r.year,r.month-1,r.day)},qe=e=>{var t;const a=null!==(t=e?Ee(e):void 0)&&void 0!==t?t:n.Now.timeZoneId(),r=n.Now.zonedDateTimeISO(a).add({hours:1}).with({minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});return{start:je(r),end:je(r.add({hours:1}))}},Ge=(e,t,a)=>{var r,o;const i=Y(e);if(Se(t)){const e=null!==(r=Ee(a))&&void 0!==r?r:n.Now.timeZoneId(),o=(e=>{var t;const a=e;return a.timeZoneId||("string"==typeof a.timeZone?a.timeZone:null===(t=a.timeZone)||void 0===t?void 0:t.id)||n.Now.timeZoneId()})(t);return Oe(i,e).toInstant().toZonedDateTimeISO(o)}return Te(t)?xe(i):Se(e)?e:Oe(i,null!==(o=Ee(a))&&void 0!==o?o:n.Now.timeZoneId())},Ke=(e,t,n)=>t.allDay?Object.assign(Object.assign({},t),{allDay:!0,start:Ce(t.start)?t.start:ke(Y(t.start)),end:Ce(t.end)?t.end:ke(Y(t.end))}):Object.assign(Object.assign({},t),{allDay:!1,start:Ge(t.start,e.allDay?t.start:e.start,n),end:Ge(t.end,e.allDay?t.end:e.end,n)}),Xe=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Je=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Qe=["January","February","March","April","May","June","July","August","September","October","November","December"],et=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tt=(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}},nt=(e=1)=>{const t=new Date,n=new Date,a=(t.getDay()-e+7)%7;return Xe.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()}})},at=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:Qe[a],shortMonthName:et[a],isToday:o.getDate()===n&&o.getMonth()===a&&o.getFullYear()===r}},rt=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:Qe[r],monthIndex:r,year:o}},ot=e=>{const t=[],n=new Date(e);for(let e=0;e<7;e++){const e=new Date(n);t.push(at(e)),n.setDate(n.getDate()+1)}return{days:t,startDate:new Date(e),monthYear:rt(t)}},it=(e,t=3)=>{const n=5*t,{monday:a}=tt(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(ot(t))}return r};function lt(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(ot(t))}return a}const st=(e,t)=>t.filter(t=>t.day===e&&!t.allDay),dt=(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=Y(t.start);r.setHours(0,0,0,0);const o=Y(t.end);return o.setHours(0,0,0,0),a>=r&&a<=o}),ct=(e,t)=>{const n=new Date(e);return n.setDate(e.getDate()+t),n},ut=(e,t,a)=>{const r=ct(a,t);return Object.assign(Object.assign({},e),{day:t,start:e.allDay?n.PlainDate.from({year:r.getFullYear(),month:r.getMonth()+1,day:r.getDate()}):n.ZonedDateTime.from({year:r.getFullYear(),month:r.getMonth()+1,day:r.getDate(),hour:r.getHours(),minute:r.getMinutes(),timeZone:n.Now.timeZoneId()}),end:e.allDay?n.PlainDate.from({year:r.getFullYear(),month:r.getMonth()+1,day:r.getDate()}):n.ZonedDateTime.from({year:r.getFullYear(),month:r.getMonth()+1,day:r.getDate(),hour:r.getHours(),minute:r.getMinutes(),timeZone:n.Now.timeZoneId()})})},ht=(e,t)=>t?n.PlainDate.from({year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}):n.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.Now.timeZoneId()}),gt=(e,t)=>{var n,a;const r=ct(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:ht(r,o),end:ht(r,o)})},mt=(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)},vt=(e,t)=>{const n=mt(e,t);return n>=0&&n<=6},ft=(e,t)=>e.map(e=>{const n=Y(e.start),a=mt(n,t);return Object.assign(Object.assign({},e),{day:a})}),pt=(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)},yt=(e,t)=>{const n=new Date(t);return n.setDate(t.getDate()+6),n.setHours(23,59,59,999),e.filter(e=>{const a=Y(e.start);return a>=t&&a<=n}).map(e=>{const n=mt(Y(e.start),t);return Object.assign(Object.assign({},e),{day:n})})},Dt=(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:ht(r,o),end:ht(r,o)})},wt=(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:ht(r,o),end:ht(r,o)})},bt=(e,t)=>{var a,r;const o=ct(t,null!==(a=e.day)&&void 0!==a?a:0);if(null!==(r=e.allDay)&&void 0!==r&&r){const t=n.PlainDate.from({year:o.getFullYear(),month:o.getMonth()+1,day:o.getDate()});return Object.assign(Object.assign({},e),{start:t,end:t})}const i=n.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})},Et=(e,t,a)=>{var r,o;const i=ct(t,null!==(r=e.day)&&void 0!==r?r:0);if(null!==(o=e.allDay)&&void 0!==o&&o){const t=n.PlainDate.from({year:i.getFullYear(),month:i.getMonth()+1,day:i.getDate()});return Object.assign(Object.assign({},e),{start:t,end:t})}const l=n.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})},Ct=(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()),Tt=(e,t)=>Y(e.start).getTime()!==Y(t.start).getTime()||Y(e.end).getTime()!==Y(t.end).getTime()||e.title!==t.title||e.day!==t.day||!!e.allDay!=!!t.allDay;function St(){const e=new Date,t=e.getDay(),a=new Date(e),r=0===t?-6:1-t;a.setDate(e.getDate()+r),a.setHours(0,0,0,0);return[{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 t=new Date(a);if(t.setDate(a.getDate()+e.day),e.allDay)return{id:e.id,title:e.title,start:n.PlainDate.from({year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()}),end:n.PlainDate.from({year:t.getFullYear(),month:t.getMonth()+1,day:t.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:n.ZonedDateTime.from({year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate(),hour:r,minute:o,timeZone:n.Now.timeZoneId()}),end:n.ZonedDateTime.from({year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate(),hour:i,minute:l,timeZone:n.Now.timeZoneId()}),allDay:!1,calendarId:e.calendarId,day:e.day}})}function Mt(){return Date.now().toString(36)+Math.random().toString(36).slice(2,8)}function Nt(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)||!Nt(r[e],o[e]))return!1;return!0}function It(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 kt(e){return{callbacks:e.callbacks,syncableConfig:It(e)}}function xt(e,t){return e===t?null:{callbacks:t}}function Ot(e,t){const n={};return e.views!==t.views&&(n.views=t.views),Nt(e.calendars,t.calendars)||(n.calendars=t.calendars),Nt(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),Nt(e.locale,t.locale)||(n.locale=t.locale),Nt(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}function Rt(e,t,n){const a=kt(n),r=xt(t.callbacks,a.callbacks);r&&e.updateConfig(r);const o=Ot(t.syncableConfig,a.syncableConfig);return Object.keys(o).length>0&&e.updateConfig(o),a}function Ht(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})}}const At={hasChanges:!1,requiresRender:!1},Pt=(e,t)=>{if(e===t)return At;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=Pt(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=Pt(r[e],o[e]);s=s||t.hasChanges,d=d||t.requiresRender}return{hasChanges:s,requiresRender:d}},Lt=(e,t)=>e?e.component!==t.component||e.label!==t.label?{hasChanges:!0,requiresRender:!0}:Pt(e.config,t.config):{hasChanges:!0,requiresRender:!0};class $t{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=$t.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 jt{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 $t(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 $t(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){De.warn(`Failed to update event ${e}:`,t)}}),e.add&&e.add.forEach(e=>{try{this.store.createEvent(e)}catch(t){De.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(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(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 Yt{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 x.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 x.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}=tt(this.state.currentDate,a),i=new Date(r),l=new Date(r);l.setDate(l.getDate()+7),this.emitVisibleRange(i,l,e);break}case x.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}=tt(t,n),l=new Date(i),s=new Date(i);s.setDate(s.getDate()+42),this.emitVisibleRange(l,s,e);break}case x.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=n.Now.plainDateISO(this.state.timeZone),t=new Date(e.year,e.month-1,e.day);this.setCurrentDate(t)}goToPrevious(){const e=new Date(this.state.currentDate);switch(this.state.currentView){case x.DAY:e.setDate(e.getDate()-1);break;case x.WEEK:e.setDate(e.getDate()-7);break;case x.MONTH:e.setMonth(e.getMonth()-1);break;case x.YEAR:e.setFullYear(e.getFullYear()-1)}this.setCurrentDate(e)}goToNext(){const e=new Date(this.state.currentDate);switch(this.state.currentView){case x.DAY:e.setDate(e.getDate()+1);break;case x.WEEK:e.setDate(e.getDate()+7);break;case x.MONTH:e.setMonth(e.getMonth()+1);break;case x.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 Ft{constructor(e,t){this.state=e,this.notify=t}install(e,t){this.state.plugins.has(e.name)?De.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 Zt{constructor(t){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(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(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(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||Nt(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=Zt.resolveLocale(e.locale);Nt(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=Ee(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=Lt(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=Ee(t.timeZone))&&void 0!==a?a:Intl.DateTimeFormat().resolvedOptions().timeZone,d=(()=>{const e=n.Now.plainDateISO(s);return new Date(e.year,e.month-1,e.day)})();var c;this.state={currentView:t.defaultView||x.WEEK,currentDate:t.initialDate||d,events:t.events||[],switcherMode:t.switcherMode||"buttons",plugins:new Map,views:new Map,locale:Zt.resolveLocale(t.locale),highlightedEventId:null,selectedEventId:null,readOnly:t.readOnly||!1,overrides:[],allDaySortComparator:t.allDaySortComparator,timeZone:s},this.callbacks=t.callbacks||{},this.themeChangeListeners=new Set,this.listeners=new Set,this.calendarRegistry=new oe(t.calendars,t.defaultCalendar,(null===(r=t.theme)||void 0===r?void 0:r.mode)||"light"),c=this.calendarRegistry,ie=c,this.eventManager=new jt(this.state,this.calendarRegistry,()=>this.callbacks,this.notify,this.triggerRender,t.events||[]),this.navigation=new Yt(this.state,()=>this.callbacks,this.notify,this.state.currentDate),this.pluginManager=new Ft(this.state,this.notify),this.useEventDetailDialog=null!==(o=t.useEventDetailDialog)&&void 0!==o&&o,this.useCalendarHeader=null===(i=t.useCalendarHeader)||void 0===i||i,this.customMobileEventRenderer=t.customMobileEventRenderer,t.views.forEach(e=>this.state.views.set(e.type,e)),null===(l=t.plugins)||void 0===l||l.forEach(e=>this.pluginManager.install(e,this)),this.handleVisibleRangeChange("initial")}static resolveLocale(e){return e?"string"==typeof e?k(e)?e:"en-US":e&&"object"==typeof e&&!k(e.code)?Object.assign(Object.assign({},e),{code:"en-US"}):e:"en-US"}get timeZone(){return this.state.timeZone}}var zt=0;function _t(e,t,n,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:n,ref:l,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--zt,__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 a.vnode&&a.vnode(c),c}const Ut=e=>{if(!e)return"";let t,a,r;e instanceof Date?(r=e.getFullYear(),a=e.getMonth()+1,t=e.getDate()):P(e)?(r=e.year,a=e.month,t=e.day):(!function(e){if(!e||"object"!=typeof e)return!1;if(e instanceof Date)return!1;const t=e;n.ZonedDateTime}(e),r=e.year,a=e.month,t=e.day);const o=String(a).padStart(2,"0");return`${String(t).padStart(2,"0")}/${o}/${r}`},Wt=e=>`${["January","February","March","April","May","June","July","August","September","October","November","December"][e.getMonth()]} ${e.getFullYear()}`,Bt=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}`};function Vt(e,t="240px"){return"number"==typeof e?`${e}px`:"string"==typeof e&&e.trim().length>0?e:t}let qt=null;function Gt(){if("undefined"==typeof document)return!1;if(null!==qt)return qt;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(),qt=a,a}const Kt=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 Xt(e,t=!1){if(e instanceof n.PlainDate||e instanceof n.PlainDateTime)return e;if(e instanceof Date)return t?ke(e):xe(e);throw new Error("Invalid time type: "+typeof e)}function Jt(e,t){if(e instanceof n.ZonedDateTime)return e;if(e instanceof Date)return Oe(e,t);throw new Error("Invalid time type: "+typeof e)}function Qt(e){var t;const n=Xt(e.start,e.allDay),a=Xt(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 en(e){const t=Jt(e.start,e.timeZone),n=Jt(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}}function tn(e){return e.map(e=>Qt(e))}function nn(e){return e.map(e=>en(e))}function an(e,t,n,a){return Qt(Object.assign({id:e,title:t,start:n,end:n,allDay:!0},a))}function rn(e,t,n,a,r){return Qt(Object.assign({id:e,title:t,start:n,end:a},r))}const on=e=>{try{return e instanceof Date?e:"string"==typeof e?new Date(e):Y(e)}catch(e){return new Date}},ln=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t},sn=(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}},dn=(e,t)=>{const n=new Map;e.forEach(e=>{var t;const a=on(e.start),r=ln(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 cn=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 un(e){return String(e).padStart(2,"0")}function hn(e,t,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==t?void 0:t.value)||o.test(r)){const e=r.match(o);if(e)return n.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 t=n.Instant.from(`${e[1]}-${e[2]}-${e[3]}T${e[4]}:${e[5]}:${e[6]}Z`),r=a||n.Now.timeZoneId();return t.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==t?void 0:t.tzid)?n.ZonedDateTime.from(Object.assign(Object.assign({},e),{timeZone:t.tzid})):n.PlainDateTime.from(e)}throw new Error(`Invalid ICS date format: ${e}`)}function gn(e,t=!1){if(t||Ce(e)){const t=Ce(e)?e:e.toPlainDate();return{value:`${t.year}${un(t.month)}${un(t.day)}`,params:{VALUE:"DATE"}}}if(Se(e)){const t=e.toInstant().toZonedDateTimeISO("UTC");return{value:`${t.year}${un(t.month)}${un(t.day)}T${un(t.hour)}${un(t.minute)}${un(t.second)}Z`}}if(Te(e))return{value:`${e.year}${un(e.month)}${un(e.day)}T${un(e.hour)}${un(e.minute)}${un(e.second)}`};throw new Error("Unsupported Temporal type")}function mn(e){return`${e.getUTCFullYear()}${un(e.getUTCMonth()+1)}${un(e.getUTCDate())}T${un(e.getUTCHours())}${un(e.getUTCMinutes())}${un(e.getUTCSeconds())}Z`}function vn(e){return e?e.replaceAll("\\","\\\\").replaceAll(";","\\;").replaceAll(",","\\,").replaceAll("\n","\\n"):""}function fn(e){return e?e.replaceAll("\\,",",").replaceAll("\\;",";").replaceAll(/\\[nN]/g,"\n").replaceAll("\\\\","\\"):""}function pn(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 yn(e,t,n){let a=e;return n&&Object.entries(n).forEach(([e,t])=>{a+=`;${e}=${t}`}),a+=`:${t}`,pn(a)}function Dn(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:${mn(new Date)}`);const i=gn(e.start,e.allDay);let l;if(e.allDay){const t=(Ce(e.end)?e.end:e.end.toPlainDate()).add({days:1});l={value:`${t.year}${un(t.month)}${un(t.day)}`,params:{VALUE:"DATE"}}}else l=gn(e.end,!1);if(r.push(yn("DTSTART",i.value,i.params)),r.push(yn("DTEND",l.value,l.params)),r.push(yn("SUMMARY",vn(e.title))),e.description&&r.push(yn("DESCRIPTION",vn(e.description))),(null===(n=e.meta)||void 0===n?void 0:n.location)&&r.push(yn("LOCATION",vn(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(vn).join(",");r.push(yn("CATEGORIES",t))}return r.push("END:VEVENT"),r}function wn(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 bn(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=fn(r);break;case"DESCRIPTION":t.description=fn(r);break;case"LOCATION":t.location=fn(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=>fn(e.trim()))}}if(!t.dtstart)throw new Error("Missing DTSTART in VEVENT");return t.uid||(t.uid=Mt()),t}function En(e,t){var a;const{calendarId:r="default",generateNewIds:o=!0,idPrefix:i="ics-",defaultTimeZone:l}=t,s=o?`${i}${Mt()}`:e.uid,d=hn(e.dtstart,e.dtstartParams,l);let c;c=e.dtend?hn(e.dtend,e.dtendParams,l):Ce(d)?d.add({days:1}):d.add({hours:1});const u="DATE"===(null===(a=e.dtstartParams)||void 0===a?void 0:a.value)||Ce(d),h=l||n.Now.timeZoneId();let g,m;if(Ce(d))g=d;else if(Te(d))try{g=d.toZonedDateTime(h)}catch(e){g=n.ZonedDateTime.from(Object.assign(Object.assign({},d),{timeZone:h}))}else g=d;if(Ce(c))m=c.subtract({days:1});else if(Te(c))try{m=c.toZonedDateTime(h)}catch(e){m=n.ZonedDateTime.from(Object.assign(Object.assign({},c),{timeZone:h}))}else m=c;return{id:s,calendarId:r,title:e.summary||"(No Title)",description:e.description,start:g,end:m,allDay:u,meta:{location:e.location,originalUid:e.uid,categories:e.categories}}}function Cn(e,t={}){const n={success:!1,events:[],errors:[],totalParsed:0,totalImported:0};try{const a=e.replaceAll(/(\r\n|\n|\r)[ \t]/g,""),r=wn(a.split(/\r\n|\n|\r/));n.totalParsed=r.length,r.forEach((e,a)=>{try{const a=En(bn(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 Tn(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:${vn(n)}`];return e.forEach(e=>{r.push(...Dn(e))}),r.push("END:VCALENDAR"),r.join("\r\n")}function Sn(e,t={}){const n=Tn(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)}function Mn(t,n){return e(this,void 0,void 0,function*(){try{const e=yield t.text();if(!e)throw new Error("File content is empty");return Cn(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}}})}const Nn=e=>{const t=Y(e.start);t.setHours(0,0,0,0);const n=Y(e.end);return n.setHours(0,0,0,0),{startDay:t,endDay:n,isMultiDay:n.getTime()>t.getTime()}},In=(e,t)=>e.title.localeCompare(t.title),kn=(e,t,n)=>{const a=Nn(e),r=Nn(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()},xn=(e,t)=>{const n=new Map;return e.forEach(e=>{const{isMultiDay:t,startDay:a}=Nn(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,kn(e,a,t)}},On=({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}};let Rn=null;const Hn=()=>{const[e,t]=g(()=>Rn||{weekHeight:R.WEEK_HEIGHT,screenSize:"desktop",weeksPerView:6});return m(()=>{const e=()=>{const e=window.innerWidth,n=window.innerHeight-150,a=Math.max(80,Math.floor(n/6)),r=e<768?{weekHeight:Math.max(R.MOBILE_WEEK_HEIGHT,a),screenSize:"mobile",weeksPerView:6}:e<1024?{weekHeight:Math.max(R.TABLET_WEEK_HEIGHT,a),screenSize:"tablet",weeksPerView:6}:{weekHeight:Math.max(R.WEEK_HEIGHT,a),screenSize:"desktop",weeksPerView:6};Rn=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},An=r({locale:"en-US",t:e=>e,getWeekDaysLabels:()=>[],getMonthLabels:()=>[],isDefault:!0});function Pn(){return D(An)}const Ln="df-month-view",$n="df-view-header-title",jn="df-btn-sm df-btn-sm-ghost",Yn="df-date-number",Fn="df-scroll-container",Zn="df-time-slot",zn="df-time-label",_n="df-time-grid-row",Un="df-current-time-line",Wn="df-current-time-label",Bn="df-all-day-row",Vn="df-all-day-label",qn="df-event-title",Gn="df-event-month-color-bar",Kn="df-event-icon-svg",Xn="df-event-resize-handle df-event-resize-handle-left df-resize-handle",Jn="df-event-resize-handle df-event-resize-handle-right df-resize-handle",Qn="df-nav-button df-calendar-nav-button",ea="df-event-detail-panel df-portal",ta="df-portal df-calendar-picker-dropdown df-animate-in df-fade-in df-zoom-in-95",na="df-time-grid-boundary",aa="df-midnight-label",ra="df-sidebar",oa="df-sidebar-header",ia="df-sidebar-toggle",la="df-sidebar-header-title",sa="df-icon-btn",da=(...e)=>e.filter(Boolean).join(" "),ca=({className:e,width:t=24,height:n=24})=>_t("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:_t("path",{d:"m15 18-6-6 6-6"})}),ua=({className:e,width:t=24,height:n=24})=>_t("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:_t("path",{d:"m9 18 6-6-6-6"})}),ha=({className:e,width:t=24,height:n=24})=>_t("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:_t("path",{d:"m6 9 6 6 6-6"})}),ga=({className:e,width:t=24,height:n=24})=>_t("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:[_t("path",{d:"M5 12h14"}),_t("path",{d:"M12 5v14"})]}),ma=({className:e,width:t=24,height:n=24})=>_t("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:[_t("circle",{cx:"11",cy:"11",r:"8"}),_t("path",{d:"m21 21-4.3-4.3"})]}),va=({className:e,width:t=24,height:n=24})=>_t("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:_t("path",{d:"M20 6 9 17l-5-5"})}),fa=({className:e,width:t=24,height:n=24})=>_t("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:[_t("path",{d:"m7 15 5 5 5-5"}),_t("path",{d:"m7 9 5-5 5 5"})]}),pa=({className:e,width:t=24,height:n=24})=>_t("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:[_t("path",{d:"M18 6 6 18"}),_t("path",{d:"m6 6 12 12"})]}),ya=({className:e,width:t=24,height:n=24})=>_t("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:[_t("path",{d:"M8 2v4"}),_t("path",{d:"M16 2v4"}),_t("rect",{width:"18",height:"18",x:"3",y:"4",rx:"2"}),_t("path",{d:"M3 10h18"}),_t("path",{d:"M8 14h.01"}),_t("path",{d:"M12 14h.01"}),_t("path",{d:"M16 14h.01"}),_t("path",{d:"M8 18h.01"}),_t("path",{d:"M12 18h.01"}),_t("path",{d:"M16 18h.01"})]}),Da=({className:e,width:t=24,height:n=24})=>_t("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:_t("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),wa=({className:e,width:t=24,height:n=24})=>_t("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:[_t("rect",{width:"18",height:"14",x:"3",y:"8",rx:"2"}),_t("path",{d:"M12 5a3 3 0 1 0-3 3"}),_t("path",{d:"M12 5a3 3 0 1 1 3 3"}),_t("path",{d:"M3 12h18"}),_t("path",{d:"M12 22V8"})]}),ba=({className:e,width:t=24,height:n=24})=>_t("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:_t("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"})}),Ea=({className:e,width:t=24,height:n=24})=>_t("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:[_t("path",{d:"M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z"}),_t("circle",{cx:"12",cy:"10",r:"3"})]}),Ca=({className:e,width:t=24,height:n=24})=>_t("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:_t("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"})}),Ta=({className:e,width:t=24,height:n=24})=>_t("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:[_t("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),_t("path",{d:"M15 3v18"}),_t("path",{d:"m8 9 3 3-3 3"})]}),Sa=({className:e,width:t=24,height:n=24})=>_t("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:[_t("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),_t("path",{d:"M15 3v18"}),_t("path",{d:"m10 15-3-3 3-3"})]}),Ma=({className:e,width:t=24,height:n=24})=>_t("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:[_t("path",{d:"m12 19-7-7 7-7"}),_t("path",{d:"M19 12H5"})]}),Na=({className:e,width:t=24,height:n=24})=>_t("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:[_t("path",{d:"M4 11a9 9 0 0 1 9 9"}),_t("path",{d:"M4 4a16 16 0 0 1 16 16"}),_t("circle",{cx:"5",cy:"19",r:"1"})]}),Ia=({className:e,width:t=24,height:n=24})=>_t("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:[_t("circle",{cx:"12",cy:"12",r:"10"}),_t("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),_t("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]});function ka(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 xa(e){return e.charAt(0).toUpperCase()+e.slice(1)}const Oa=(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},Ra=(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 Ha(e,t="en-US"){var n;if(["today","day","week","month","year"].includes(e)){const n=ka(e,t);if(n)return xa(n)}const a=I(t),r=M[a],o=null===(n=null==r?void 0:r.messages)||void 0===n?void 0:n[e];if(o)return o;const i=M.en.messages;return(null==i?void 0:i[e])||e}const Aa=({locale:e="en-US",messages:t,children:n})=>{const a=p(()=>{if("string"==typeof e){return{code:k(e)?e:"en-US",messages:void 0}}return e&&"string"!=typeof e&&!k(e.code)?Object.assign(Object.assign({},e),{code:"en-US"}):e||{code:"en-US"}},[e]),r=p(()=>{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:Ha(n,e);return r&&Object.entries(r).forEach(([e,t])=>{s=s.replaceAll(new RegExp(`{${e}}`,"g"),t)}),s},getWeekDaysLabels:Oa,getMonthLabels:Ra,isDefault:!1}},[a,t]);return _t(An.Provider,{value:r,children:n})},Pa=(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(" ")},La=({calendar:e,mode:t="buttons"})=>{const[n,a]=g(!1),r=v(null),{t:o}=Pn(),i=Array.from(e.state.views.keys()),l=e.state.currentView;return m(()=>{const e=e=>{r.current&&!r.current.contains(e.target)&&a(!1)};if(n)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[n]),i.length<=1?null:_t("div","select"===t?{className:"df-view-switcher-select",ref:r,children:[_t("button",{type:"button",onClick:()=>a(!n),className:"df-view-switcher-select-trigger","aria-expanded":n,"aria-haspopup":"listbox",children:[_t("span",{children:Pa(l,e,o)}),_t("span",{className:"df-view-switcher-select-chevron","data-open":n?"true":"false",children:_t(ha,{width:16,height:16})})]}),n&&_t("div",{className:"df-view-switcher-select-dropdown df-animate-in df-fade-in df-zoom-in-95",children:_t("div",{className:"df-view-switcher-select-list",role:"listbox",children:i.map(t=>_t("button",{type:"button",onClick:()=>{e.changeView(t),a(!1),e.triggerRender()},className:"df-view-switcher-select-option","data-active":l===t?"true":"false",role:"option","aria-selected":l===t,children:Pa(t,e,o)},t))})})]}:{className:"df-view-switcher",children:i.map(t=>_t("button",{type:"button",className:"df-view-switcher-btn","data-active":l===t?"true":"false",onClick:()=>{e.changeView(t),e.triggerRender()},children:Pa(t,e,o)},t))})},$a=({calendar:e,switcherMode:t="buttons",onAddCalendar:n,onSearchChange:a,onSearchClick:r,searchValue:o="",isSearchOpen:i=!1,isEditable:l=!0,safeAreaLeft:s})=>{const d="buttons"===t,c=e.state.currentView===x.DAY,{screenSize:u}=Hn(),h="mobile"===u,{t:g}=Pn(),m=f(e=>{const t=e.currentTarget.value;t!==o&&(null==a||a(t))},[a,o]);return _t("div",{className:"df-header","data-bordered":c||i?"true":"false",style:{paddingLeft:s||8,transition:"padding-left 160ms ease-in-out"},onContextMenu:e=>e.preventDefault(),children:[_t("div",{className:"df-header-left",children:n&&l&&_t("button",{type:"button",id:"dayflow-add-event-btn",onClick:n,className:sa,title:h?g("newEvent")||"New Event":g("createCalendar")||"Add Calendar",children:_t(ga,{})})}),_t("div",{className:"df-header-mid",children:d&&_t(La,{mode:t,calendar:e})}),_t("div",{className:"df-header-right",children:[!d&&_t(La,{mode:t,calendar:e}),h?_t("button",{type:"button",onClick:r,className:sa,title:g("search")||"Search",children:_t(ma,{})}):_t("div",{className:"df-search-group",children:[_t("div",{className:"df-search-group-icon",children:_t(ma,{width:16,height:16})}),_t("input",{id:"dayflow-search-input",type:"text",placeholder:g("search")||"Search",value:o,onChange:m,className:"df-search-group-input",style:{width:"12rem"}}),o&&_t("button",{type:"button",onClick:()=>{null==a||a("")},className:"df-search-group-clear",children:_t("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[_t("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),_t("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})]})},ja=r(void 0),Ya=({children:e,initialTheme:t="light",onThemeChange:n})=>{const[a,r]=g(t),[o,i]=g(()=>"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),l="auto"===a?o:a;m(()=>{r(t)},[t]);const s=f(e=>{r(e)},[]);m(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-color-scheme: dark)"),t=e=>{const t=e.matches?"dark":"light";i(t)};return e.addEventListener?e.addEventListener("change",t):e.addListener&&e.addListener(t),()=>{e.removeEventListener?e.removeEventListener("change",t):e.removeListener&&e.removeListener(t)}},[]),y(()=>{if("undefined"==typeof document)return;const e=document.documentElement,t=Kt(l),n="auto"===a?t:l;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)},[l,a,o]),m(()=>{n&&n(a,l)},[a,l,n]);const d=p(()=>({theme:a,effectiveTheme:l,setTheme:s}),[a,l,s]);return _t(ja.Provider,{value:d,children:e})},Fa=()=>{const e=D(ja);if(void 0===e)throw new Error("useTheme must be used within a ThemeProvider");return e},Za=r(null);let za=0;function _a({generatorName:e,generatorArgs:t,defaultContent:n,store:a}){const r=v(null),o=D(Za),i=a||o,l=v(null),[s,d]=g(()=>{var t;return!!e&&(null!==(t=null==i?void 0:i.isOverridden(e))&&void 0!==t&&t)});l.current||(l.current="df-slot-"+za++),m(()=>{if(!r.current||!i||!e)return;const n=l.current;i.register({id:n,containerEl:r.current,generatorName:e,generatorArgs:t});const a=i.subscribeToOverrides(()=>{d(i.isOverridden(e))});return()=>{i.unregister(n),a()}},[i,e]),m(()=>{if(!i||!l.current||!e)return;const n=l.current;i.register({id:n,containerEl:r.current,generatorName:e,generatorArgs:t})},[e,t]);const c=null==e?void 0:e.startsWith("eventContent");return _t("div",{ref:r,className:"df-content-slot "+(c||"sidebar"===e?"df-content-slot-stacked":""),children:!s&&n})}const Ua=e=>{const n=v(null),a=v(null);return m(()=>{if(n.current){const r=t(e,[]);a.current=new w(n.current,r),r.initialExpanded&&a.current.expand()}return()=>{a.current&&(a.current.destroy(),a.current=null)}},[]),m(()=>{if(a.current){const n=t(e,[]);a.current.setOptions(n)}},[e]),_t("div",{ref:n,className:e.className})},Wa=({color:e,onChange:t,onClose:n})=>{const a=p(()=>{const{h:t,l:n}=b(e);return{hue:t,saturation:E(n),lightness:n,alpha:100,layer:"outer"}},[e]);return _t("div",{className:"df-default-color-picker",children:_t(Ua,{defaultValue:a,coreSize:36,petalSize:32,initialExpanded:!0,openOnHover:!1,onChange:e=>t({hex:e.hex},!0),onCollapse:n})})},Ba=n=>{var{children:a,onClick:r,loading:i,loadingText:l,disabled:s,className:d,type:c="button"}=n,u=t(n,["children","onClick","loading","loadingText","disabled","className","type"]);const[h,m]=g(!1),v=i||h,f=_t(o,{children:[v&&_t("svg",{className:"df-loading-btn-spinner",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[_t("circle",{className:"df-loading-btn-track",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),_t("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"})]}),_t("span",{className:"df-loading-btn-label",children:v&&l?l:a})]}),p=Object.assign(Object.assign({},u),{disabled:s||v,onClick:t=>e(void 0,void 0,void 0,function*(){if(!v&&r){const e=r(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":v?"true":"false"});return _t("button","submit"===c?Object.assign({},p,{type:"submit",children:f}):"reset"===c?Object.assign({},p,{type:"reset",children:f}):Object.assign({},p,{type:"button",children:f}))},Va=["#ea426b","#f19a38","#f7cf46","#83d754","#51aaf2","#b672d0","#957e5e"],qa=({onClose:t,onCreate:n,app:a})=>{const{t:r}=Pn(),{effectiveTheme:i}=Fa(),[l,s]=g(""),[d,u]=g(!1),h=a.state.overrides.includes("createCalendarDialogColorPicker"),[m,v]=g(Va[Math.floor(Math.random()*Va.length)]),[f,y]=g(!1),[D,w]=g(""),b=p(()=>{const e=C[Math.floor(Math.random()*C.length)],t=e.layer||"outer",n=E(e.l);return{hue:e.h,saturation:n,lightness:e.l,alpha:100,layer:t}},[]),[S,M]=g(null),N=e=>{v(e.hex)},I=()=>{y(!1)},k=()=>{v(D),y(!1)},x="dark"===i,O={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:c(_t("div",{className:"df-portal df-create-calendar-dialog-backdrop",children:_t("div",{className:"df-animate-in df-fade-in df-zoom-in-95 df-create-calendar-dialog-panel",onClick:e=>e.stopPropagation(),children:[_t("h2",{className:"df-create-calendar-dialog-title "+(h?"df-create-calendar-dialog-title-compact":""),children:r("createCalendar")}),_t("form",{onSubmit:a=>e(void 0,void 0,void 0,function*(){var e;if(a.preventDefault(),l.trim()&&!d){u(!0);try{let a;a=h?m:null!==(e=null==S?void 0:S.hex)&&void 0!==e?e:T(b.hue,b.saturation,b.lightness);const{colors:r,darkColors:o}=se(a),i={id:Mt(),name:l.trim(),colors:r,darkColors:o,isVisible:!0,isDefault:!1};yield n(i),t()}finally{u(!1)}}}),children:[h?_t(o,{children:[_t("div",{className:"df-create-calendar-dialog-color-row",children:[_t("div",{className:"df-create-calendar-dialog-color-preview",style:{backgroundColor:m}}),_t("input",{id:"custom-calendar-name",name:"calendar-name",type:"text",value:l,onChange:e=>s(e.target.value),className:"df-form-input",style:{flex:1},placeholder:r("calendarNamePlaceholder"),autoFocus:!0})]}),_t("div",{className:"df-create-calendar-dialog-color-section",children:[_t("div",{className:"df-create-calendar-dialog-color-grid",children:Va.map(e=>_t("button",{type:"button",className:"df-create-calendar-dialog-color-btn","data-selected":m===e?"true":"false",style:{backgroundColor:e},onClick:()=>v(e)},e))}),_t("div",{style:{position:"relative"},children:[_t("button",{type:"button",onClick:()=>{w(m),y(!0)},className:"df-create-calendar-dialog-custom-color-btn",children:r("customColor")}),f&&_t("div",{className:"df-create-calendar-dialog-picker-overlay",onClick:k,children:_t("div",{className:"df-animate-in df-fade-in df-zoom-in-95 df-create-calendar-dialog-picker-inner",onClick:e=>e.stopPropagation(),children:_t(_a,{generatorName:"createCalendarDialogColorPicker",generatorArgs:{color:m,onChange:N,onAccept:I,onCancel:k,styles:O},defaultContent:_t("div",{className:"df-create-calendar-dialog-picker-card",children:[_t(Wa,{color:m,onChange:N}),_t("div",{className:"df-create-calendar-dialog-picker-actions",children:[_t("button",{type:"button",onClick:k,className:"df-btn-sm df-btn-sm-ghost",children:r("cancel")}),_t("button",{type:"button",onClick:I,className:"df-fill-primary df-btn-sm",children:"OK"})]})]})})})})]})]})]}):_t("div",{className:"df-create-calendar-dialog-blossom-row",children:[_t("div",{className:"df-create-calendar-dialog-blossom-input-area",children:_t("input",{id:"blossom-calendar-name",name:"calendar-name",type:"text",value:l,onChange:e=>s(e.target.value),className:"df-form-input",placeholder:r("calendarNamePlaceholder"),autoFocus:!0})}),_t("div",{className:"df-create-calendar-dialog-blossom-picker-wrap",children:_t("div",{className:"df-create-calendar-dialog-blossom-picker-inner",children:_t(Ua,{defaultValue:b,coreSize:36,petalSize:32,openOnHover:!1,onChange:e=>M(e),onCollapse:e=>M(e),className:"df-create-calendar-dialog-blossom-picker"})})})]}),_t("div",{className:"df-create-calendar-dialog-actions",children:[_t("button",{type:"button",onClick:t,disabled:d,className:"df-btn-sm df-btn-sm-ghost",children:r("cancel")}),_t(Ba,{type:"submit",disabled:!l.trim(),loading:d,className:"df-fill-primary df-hover-primary-solid df-btn-sm",children:r("create")})]})]})]})}),document.body)};var Ga=0;function Ka(e,t,n,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:n,ref:l,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Ga,__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 a.vnode&&a.vnode(c),c}const Xa=(e,t)=>n.PlainDate.compare(e,t),Ja=({calendarDays:e,visibleMonth:t,startDate:n,endDate:a,weekDayLabels:r,disabled:i,onDaySelect:l})=>Ka(o,{children:[Ka("div",{className:"df-range-picker-weekday-row",children:r.map(e=>Ka("span",{className:"df-range-picker-weekday-label",children:e},e))}),Ka("div",{className:"df-range-picker-day-grid",children:e.map(e=>{const r=e.month!==t.month,o=0===Xa(e,n),s=0===Xa(e,a),d=Xa(e,n)>=0&&Xa(e,a)<=0;return Ka("button",{type:"button",disabled:i,onClick:()=>l(e),className:"df-range-picker-day-cell","data-outside":r,"data-range-edge":o?"start":s?"end":void 0,"data-in-range":d&&!o&&!s,children:e.day},e.toString())})})]}),Qa=({className:e,width:t=24,height:n=24})=>Ka("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:Ka("path",{d:"m15 18-6-6 6-6"})}),er=({className:e,width:t=24,height:n=24})=>Ka("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:Ka("path",{d:"m9 18 6-6-6-6"})}),tr=({className:e,width:t=24,height:n=24})=>Ka("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:[Ka("path",{d:"m11 17-5-5 5-5"}),Ka("path",{d:"m18 17-5-5 5-5"})]}),nr=({className:e,width:t=24,height:n=24})=>Ka("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:[Ka("path",{d:"m6 17 5-5-5-5"}),Ka("path",{d:"m13 17 5-5-5-5"})]}),ar=({className:e,width:t=24,height:n=24})=>Ka("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:[Ka("path",{d:"M18 8L22 12L18 16"}),Ka("path",{d:"M2 12H22"})]}),rr=({visibleMonth:e,monthLabels:t,disabled:n,onMonthChange:a,onYearChange:r})=>Ka("div",{className:"df-range-picker-calendar-header",children:[Ka("div",{className:"df-range-picker-calendar-nav-group",children:[Ka("button",{type:"button",disabled:n,onClick:()=>r(-1),className:"df-range-picker-calendar-nav-button",children:Ka(tr,{width:14,height:12})}),Ka("button",{type:"button",disabled:n,onClick:()=>a(-1),className:"df-range-picker-calendar-nav-button",children:Ka(Qa,{width:14,height:12})})]}),Ka("div",{className:"df-range-picker-calendar-title",children:[t[e.month-1]," ",e.year]}),Ka("div",{className:"df-range-picker-calendar-nav-group",children:[Ka("button",{type:"button",disabled:n,onClick:()=>a(1),className:"df-range-picker-calendar-nav-button",children:Ka(er,{width:14,height:12})}),Ka("button",{type:"button",disabled:n,onClick:()=>r(1),className:"df-range-picker-calendar-nav-button",children:Ka(nr,{width:14,height:12})})]})]}),or=Array.from({length:24},(e,t)=>t),ir=Array.from({length:60},(e,t)=>t);function lr(e){return null!==e&&"object"==typeof e&&!("hour"in e)&&"year"in e&&"month"in e&&"day"in e&&!(e instanceof Date)}const sr=/(YYYY|YY|MM|DD|HH|mm)/g,dr=e=>e.toString().padStart(2,"0"),cr=(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`)},ur=e=>e.replaceAll(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),hr=(e,t,a,r)=>{const o=e.trim();if(!o)return null;const i=o.match(t),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 n.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}},gr=e=>{var t;const a=e;return"string"==typeof a.timeZoneId?a.timeZoneId:"string"==typeof a.timeZone?a.timeZone:"string"==typeof(null===(t=a.timeZone)||void 0===t?void 0:t.id)?a.timeZone.id:n.Now.timeZoneId()},mr=(e,t,a)=>{var r,o,i,l,s,d,c,u,h,g,m,v,f,p,y,D,w,b,E,C,T,S,M,N;if(!e){const e=null!=t?t:a?gr(a):n.Now.timeZoneId();return null!=a?a:n.Now.zonedDateTimeISO(e)}if(lr(e)){const a=null!=t?t:n.Now.timeZoneId(),r=`${e.year}-${dr(e.month)}-${dr(e.day)}T00:00:00[${a}]`;return n.ZonedDateTime.from(r)}const I=e;if("hour"in I&&!("timeZoneId"in I)){const e=null!=t?t:n.Now.timeZoneId();if("function"==typeof I.toZonedDateTime)try{return I.toZonedDateTime(e)}catch(e){}return n.ZonedDateTime.from({timeZone:e,year:I.year,month:I.month,day:I.day,hour:I.hour,minute:I.minute,second:null!==(r=I.second)&&void 0!==r?r:0,millisecond:null!==(o=I.millisecond)&&void 0!==o?o:0,microsecond:null!==(i=I.microsecond)&&void 0!==i?i:0,nanosecond:null!==(l=I.nanosecond)&&void 0!==l?l:0})}try{return n.ZonedDateTime.from(e)}catch(e){const r=null!==(h=null!==(u=null!==(c=null!==(d="string"==typeof I.timeZone?I.timeZone:null===(s=I.timeZone)||void 0===s?void 0:s.id)&&void 0!==d?d:I.timeZoneId)&&void 0!==c?c:t)&&void 0!==u?u:a?gr(a):void 0)&&void 0!==h?h:n.Now.timeZoneId();if("function"==typeof I.toZonedDateTime)try{return I.toZonedDateTime(r)}catch(e){}const o=null!=a?a:n.Now.zonedDateTimeISO(r);return n.ZonedDateTime.from({timeZone:r,year:null!==(g=I.year)&&void 0!==g?g:o.year,month:null!==(m=I.month)&&void 0!==m?m:o.month,day:null!==(v=I.day)&&void 0!==v?v:o.day,hour:null!==(p=null!==(f=I.hour)&&void 0!==f?f:null==a?void 0:a.hour)&&void 0!==p?p:0,minute:null!==(D=null!==(y=I.minute)&&void 0!==y?y:null==a?void 0:a.minute)&&void 0!==D?D:0,second:null!==(b=null!==(w=I.second)&&void 0!==w?w:null==a?void 0:a.second)&&void 0!==b?b:0,millisecond:null!==(C=null!==(E=I.millisecond)&&void 0!==E?E:null==a?void 0:a.millisecond)&&void 0!==C?C:0,microsecond:null!==(S=null!==(T=I.microsecond)&&void 0!==T?T:null==a?void 0:a.microsecond)&&void 0!==S?S:0,nanosecond:null!==(N=null!==(M=I.nanosecond)&&void 0!==M?M:null==a?void 0:a.nanosecond)&&void 0!==N?N:0})}},vr=(e,t,n)=>{const a=cr(t,n),r={YYYY:e.year.toString(),YY:dr(e.year%100),MM:dr(e.month),DD:dr(e.day),HH:dr(e.hour),mm:dr(e.minute)};return a.replace(sr,e=>{var t;return null!==(t=r[e])&&void 0!==t?t:e})},fr="df-scrollbar-hide",pr=({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=ir.includes(s)?ir:[...ir,s].toSorted((e,t)=>e-t);return Ka("div",{className:"df-range-picker-time-selector",children:[Ka("div",{className:"df-range-picker-time-selector-header",children:Ka("div",{className:"df-range-picker-time-selector-value",children:[l.hour.toString().padStart(2,"0"),":",l.minute.toString().padStart(2,"0")]})}),Ka("div",{className:"df-range-picker-time-selector-body",children:[Ka("div",{className:"df-range-picker-time-selector-column",children:Ka("div",{className:`df-range-picker-time-list ${fr}`,role:"listbox","aria-label":"Hour",ref:e=>{o.current&&o.current[i]&&(o.current[i].hour=e)},children:or.map(e=>{const t=e===l.hour;return Ka("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:dr(e)},e)})})}),Ka("div",{className:"df-range-picker-time-selector-column",children:Ka("div",{className:`df-range-picker-time-list ${fr}`,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 Ka("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:dr(e)},e)})})})]})]})},yr=({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:g,onHourSelect:m,onMinuteSelect:v,onOk:f,getPopupStyle:p})=>{const y=r[0].toPlainDate(),D=r[1].toPlainDate();return Ka("div",{ref:d,className:"df-range-picker df-range-picker-popup",style:p(),"data-range-picker-popup":"true",children:Ka("div",{className:"df-range-picker-panel",style:{boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",width:s?"100%":void 0},children:[Ka("div",{className:"df-range-picker-panel-body",children:[Ka("div",{className:"df-range-picker-calendar-pane",children:[Ka(rr,{visibleMonth:e,monthLabels:t,disabled:l,onMonthChange:u,onYearChange:h}),Ka(Ja,{calendarDays:a,visibleMonth:e,startDate:y,endDate:D,weekDayLabels:n,disabled:l,onDaySelect:g})]}),i&&Ka("div",{className:"df-range-picker-time-pane",children:Ka(pr,{focusedField:o,draftRange:r,disabled:l,onHourSelect:m,onMinuteSelect:v,timeListRefs:c})})]}),Ka("div",{className:"df-range-picker-footer",children:Ka("button",{type:"button",onClick:f,disabled:l,className:"df-range-picker-confirm-button",children:"OK"})})]})})},Dr=({value:e,format:t="YYYY-MM-DD HH:mm",showTimeFormat:a="HH:mm",showTime:r=!0,onChange:o,onOk:i,timeZone:l,disabled:s=!1,placement:d="bottomLeft",autoAdjustOverflow:u=!0,getPopupContainer:h,matchTriggerWidth:y=!1,locale:D="en-US"})=>{const w=p(()=>"string"==typeof D?D:(null==D?void 0:D.code)||"en-US",[D]),b=p(()=>void 0===r||("object"==typeof r||Boolean(r)),[r]),E=p(()=>((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})(w,"short"),[w]),C=p(()=>((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})(w,"narrow"),[w]),T=p(()=>b?"object"==typeof r&&(null==r?void 0:r.format)?r.format:a:"",[b,r,a]),S=p(()=>cr(t,T),[t,T]),M=p(()=>(e=>{let t,n=0,a="^";for(;null!==(t=sr.exec(e));){a+=ur(e.slice(n,t.index));const r=t[0];a+=`(?<${r}>\\d{${"YYYY"===r?4:2}})`,n=t.index+r.length}return a+=ur(e.slice(n))+"$",new RegExp(a)})(S),[S]),N=p(()=>{const t=null!=l?l:lr(e[0])?lr(e[1])?n.Now.timeZoneId():gr(e[1]):gr(e[0]),a=mr(e[0],t).withTimeZone(t);return[a,mr(e[1],t,a).withTimeZone(t)]},[e,l]),[I,k]=g(N),x=v(N),[O,R]=g("start"),[H,A]=g([vr(N[0],t,T),vr(N[1],t,T)]),P=v([vr(N[0],t,T),vr(N[1],t,T)]),L=v(N),[$,j]=g(N[0].toPlainDate().with({day:1})),[Y,F]=g(!1),Z=f(e=>{F(e)},[]),[z,_]=g(d),U=v(d),W=v(null),B=v(null),V=v({start:{hour:null,minute:null},end:{hour:null,minute:null}}),q=v(!1),G=v(!1);m(()=>{P.current=H},[H]),m(()=>{L.current=I},[I]),m(()=>{const e=x.current,t=0!==n.ZonedDateTime.compare(e[0],N[0])||e[0].timeZoneId!==N[0].timeZoneId,a=0!==n.ZonedDateTime.compare(e[1],N[1])||e[1].timeZoneId!==N[1].timeZoneId;(t||a)&&k(N),x.current=N},[N]),m(()=>{j(N[0].toPlainDate().with({day:1}))},[N[0]]);const K=f((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})},[]),X=f(e=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{const t=V.current[e];["hour","minute"].forEach(e=>{const n=t[e];if(!n)return;const a=n.querySelector('[data-active="true"]');a&&K(n,a,0)})})})},[K]);m(()=>{Y&&b&&X(O)},[O,Y,X,b]);const J=I[0].epochMilliseconds,Q=I[0].offsetNanoseconds,ee=I[1].epochMilliseconds,te=I[1].offsetNanoseconds;m(()=>{if(G.current)return;const[e,n]=L.current,a=vr(e,t,T),r=vr(n,t,T),[o,i]=P.current;o===a&&i===r||(P.current=[a,r],A([a,r]))},[J,Q,ee,te,t,T]),m(()=>{if(!Y)return;const e=e=>{var t,n;const a=e.target;(null===(t=W.current)||void 0===t?void 0:t.contains(a))||(null===(n=B.current)||void 0===n?void 0:n.contains(a))||a.closest("[data-range-picker-popup]")||Z(!1)};return document.addEventListener("pointerdown",e,!0),()=>{document.removeEventListener("pointerdown",e,!0)}},[Y]),m(()=>{Y||(R("start"),q.current||k(N),q.current=!1)},[Y,N]);const ne=f(e=>{o&&o(e,[vr(e[0],t,T),vr(e[1],t,T)])},[T,t,o]),ae=f(e=>{i&&i(e,[vr(e[0],t,T),vr(e[1],t,T)])},[T,t,i]),re=f((e,t)=>{k(a=>{const r=[...a];if("start"===e){const e=mr(r[1],gr(t),t),a=n.ZonedDateTime.compare(t,e)>0?t:e;return[t,a]}const o=mr(r[0],gr(t),t);return[n.ZonedDateTime.compare(o,t)>0?t:o,t]})},[]),oe=e=>{if(s)return;const t=(e,t)=>{var a,r,o,i;const l=gr(e);return n.ZonedDateTime.from({timeZone:l,year:t.year,month:t.month,day:t.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"===O){const n=t(I[0],e),a=I[1].epochMilliseconds-I[0].epochMilliseconds,r=n.add({milliseconds:a});return void k([n,r])}const a=t(I[1],e),r=I[1].epochMilliseconds-I[0].epochMilliseconds;if(n.ZonedDateTime.compare(a,I[0])<0){const n=t(I[0],e),a=n.add({milliseconds:r});return void k([n,a])}k([I[0],a]),j(a.toPlainDate().with({day:1}))},ie=f((e,t)=>{if(s)return;const a="start"===e?0:1;k(r=>{const o=r[a],i=o.with({hour:t,minute:o.minute,second:0,millisecond:0,microsecond:0,nanosecond:0});if("start"===e){const e=mr(r[1],gr(i),i);return[i,n.ZonedDateTime.compare(i,e)>0?i:e]}const l=mr(r[0],gr(i),i);return[n.ZonedDateTime.compare(l,i)>0?i:l,i]}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const t=V.current[e].hour;if(!t)return;const n=t.querySelector('[data-active="true"]');n&&K(t,n,0)})})},[s,K]),le=f((e,t)=>{if(s)return;const a="start"===e?0:1;k(r=>{const o=r[a].with({minute:t,second:0,millisecond:0,microsecond:0,nanosecond:0});if("start"===e){const e=mr(r[1],gr(o),o);return[o,n.ZonedDateTime.compare(o,e)>0?o:e]}const i=mr(r[0],gr(o),o);return[n.ZonedDateTime.compare(i,o)>0?o:i,o]}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const t=V.current[e].minute;if(!t)return;const n=t.querySelector('[data-active="true"]');n&&K(t,n,0)})})},[s,K]),se=f((e,t)=>{const n="start"===e?0:1;A(e=>{const a=[...e];return a[n]=t,a})},[]),de=f((e,n)=>{const a="start"===e?0:1,r=I[a],o=gr(r),i=hr(n,M,r,o);if(i){re(e,i);const t=i.toPlainDate().with({day:1});return j(t),"start"===e&&R("end"),!0}return A(e=>{const n=[...e];return n[a]=vr(I[a],t,T),n}),!1},[I,T,t,M,re]),ce=f(e=>t=>{const n=t.currentTarget.value;G.current=!0,se(e,n);const a="start"===e?0:1,r=L.current[a],o=gr(r),i=hr(n,M,r,o);if(i){re(e,i);const t=i.toPlainDate().with({day:1});j(t),X(e)}},[se,M,re,X]),ue=f(e=>n=>{var a;if(s)return;if(G.current=!1,Y){const n="start"===e?0:1,a=vr(L.current[n],t,T);return void A(e=>{const t=[...e];return t[n]=a,t})}const r=n.relatedTarget;r&&(null===(a=W.current)||void 0===a?void 0:a.contains(r))||de(e,n.currentTarget.value)},[de,s,Y,t,T]),he=f(e=>t=>{"Enter"===t.key&&(t.preventDefault(),G.current=!1,de(e,t.currentTarget.value)),"Escape"===t.key&&t.currentTarget.blur()},[de]),ge=()=>{q.current=!0,ne(I),ae(I),Z(!1)},me=e=>{j(t=>t.add({months:e}).with({day:1}))},ve=e=>{j(t=>t.add({years:e}).with({day:1}))},fe=p(()=>{const e=$,t=e.dayOfWeek%7,n=e.subtract({days:t});return Array.from({length:42},(e,t)=>n.add({days:t}))},[$]),pe=f((e=d)=>{if(!u||!W.current)return e;const t=W.current.getBoundingClientRect(),n=y?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},[u,y,d]),ye=f(()=>{const e=pe();U.current!==e&&(U.current=e,_(e))},[pe]),De=e=>{if(s)return;R(e);const t=I["start"===e?0:1].toPlainDate().with({day:1});j(t);const n=pe();U.current!==n&&(U.current=n,_(n)),Z(!0)};m(()=>{if(!Y)return;ye();const e=()=>ye();return window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}},[Y,ye]);const we=()=>{if(!W.current)return{};const e=W.current.getBoundingClientRect(),t={position:"fixed",zIndex:9999};return U.current.startsWith("bottom")?t.top=e.bottom+8:t.bottom=window.innerHeight-e.top+8,d.endsWith("Left")?t.left=e.left:t.right=window.innerWidth-e.right,y&&(t.width=`${e.width}px`),t};return Ka("div",{className:"df-range-picker df-range-picker-root",ref:W,children:[Ka("div",{className:"df-range-picker-trigger","data-disabled":s,"data-open":Y,children:[Ka("div",{className:"df-range-picker-field-group",children:Ka("input",{type:"text",name:"range-start",value:H[0],onChange:ce("start"),onFocus:()=>De("start"),onClick:()=>De("start"),onBlur:ue("start"),onKeyDown:he("start"),className:"df-range-picker-input","data-disabled":s,"data-focused":"start"===O&&Y,placeholder:S,autoComplete:"off",disabled:s})}),Ka(ar,{className:"df-range-picker-separator-icon"}),Ka("div",{className:"df-range-picker-field-group",children:Ka("input",{type:"text",name:"range-end",value:H[1],onChange:ce("end"),onFocus:()=>De("end"),onClick:()=>De("end"),onBlur:ue("end"),onKeyDown:he("end"),className:"df-range-picker-input","data-disabled":s,"data-focused":"end"===O&&Y,placeholder:S,autoComplete:"off",disabled:s})})]}),Y&&c(Ka(yr,{visibleMonth:$,monthLabels:E,weekDayLabels:C,calendarDays:fe,draftRange:I,focusedField:O,isTimeEnabled:!!b,disabled:s,matchTriggerWidth:y,popupRef:B,timeListRefs:V,onMonthChange:me,onYearChange:ve,onDaySelect:oe,onHourSelect:ie,onMinuteSelect:le,onOk:ge,getPopupStyle:we}),h?h():document.body)]})},wr=({options:e,value:t,onChange:n,registry:a,variant:r="desktop",disabled:o=!1})=>{const[i,l]=g(!1),[s,d]=g({}),u=v(null),h=v(null),f=()=>{if(h.current){const e=h.current.getBoundingClientRect(),t="mobile"===r,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`,d(n)}};m(()=>{const e=e=>{!u.current||u.current.contains(e.target)||e.target.closest("[data-calendar-picker-dropdown]")||l(!1)};return i&&(f(),window.addEventListener("mousedown",e),window.addEventListener("scroll",f,!0),window.addEventListener("resize",f)),()=>{window.removeEventListener("mousedown",e),window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",f)}},[i]);const p=e=>(a||le()).resolveColors(e).lineColor,y=(e,t)=>{e.stopPropagation(),n(t),l(!1)},D=e.find(e=>e.value===t),w=()=>i&&"undefined"!=typeof window?c("mobile"===r?_t("div",{"data-calendar-picker-dropdown":"true",style:s,className:ta,children:e.map(e=>_t("div",{className:"df-calendar-picker-option df-calendar-picker-option-mobile","data-selected":e.value===t?"true":"false",onClick:t=>y(t,e.value),children:[_t("div",{className:"df-calendar-picker-option-inner",children:[_t("div",{className:"df-calendar-picker-check-area",children:e.value===t&&_t(va,{className:"df-text-primary"})}),_t("span",{className:"df-calendar-picker-option-label",children:e.label})]}),_t("span",{className:"df-calendar-picker-color-swatch df-calendar-picker-color-swatch-sm",style:{backgroundColor:p(e.value)}})]},e.value))}):_t("ul",{"data-calendar-picker-dropdown":"true",style:s,className:ta,children:e.map(e=>_t("li",{className:"df-calendar-picker-option","data-selected":t===e.value?"true":"false",onClick:t=>y(t,e.value),children:[_t("div",{className:"df-calendar-picker-check-area",children:e.value===t&&_t(va,{className:"df-text-primary"})}),_t("span",{className:"df-calendar-picker-color-swatch-sm",style:{backgroundColor:p(e.value)}}),_t("span",{className:"df-calendar-picker-option-label",children:e.label})]},e.value))}),document.body):null;return _t("div","mobile"===r?{className:"df-calendar-picker",ref:u,children:[_t("button",{type:"button",ref:h,disabled:o,onClick:e=>{e.stopPropagation(),o||l(!i)},className:"df-calendar-picker-trigger df-calendar-picker-trigger-mobile",children:[_t("span",{className:"df-calendar-picker-color-swatch df-calendar-picker-color-swatch-sm",style:{backgroundColor:p(t)}}),_t("span",{className:"df-calendar-picker-label",children:(null==D?void 0:D.label)||t}),_t(fa,{className:"df-text-muted"})]}),w()]}:{className:"df-calendar-picker",ref:u,children:[_t("button",{ref:h,type:"button",onClick:e=>{e.stopPropagation(),l(!i)},className:"df-calendar-picker-trigger",children:[_t("span",{className:"df-calendar-picker-color-swatch",style:{backgroundColor:p(t)}}),_t(fa,{className:"df-text-muted"})]}),w()]})},br=({event:t,isOpen:a,onEventUpdate:r,onEventDelete:o,onClose:i,app:l})=>{var s,d;const[u,h]=g(t),[f,y]=g(!1),[D,w]=g(!1),b=v(t.id),{t:E}=Pn();m(()=>{h(t),b.current!==t.id&&(y(!1),w(!1),b.current=t.id)},[t]);const C=p(()=>(l?l.getCalendarRegistry():le()).getVisible().map(e=>({label:e.name,value:e.id})),[l,null==l?void 0:l.getCalendars()]),T=p(()=>!Ct(t,u),[t,u]),S=p(()=>{var e;return null!==(e=null==l?void 0:l.timeZone)&&void 0!==e?e:n.Now.timeZoneId()},[l]),M=e=>{const[t,n]=e;h(Object.assign(Object.assign({},u),{start:t.toPlainDate(),end:n.toPlainDate()}))},N=null!==(s=null==l?void 0:l.canMutateFromUI(t.id))&&void 0!==s&&s,I=null==l?void 0:l.getReadOnlyConfig(t.id),k=!1!==(null==I?void 0:I.viewable),x=f||D,O=!p(()=>{if(!t.calendarId)return!1;const e=null==l?void 0:l.getCalendarRegistry().get(t.calendarId);return!!(null==e?void 0:e.subscription)},[l,t.calendarId])||""!==(u.description||"").trim();if(!a||!k)return null;if("undefined"==typeof window||"undefined"==typeof document)return null;const R=_t("div",{className:"df-portal df-event-dialog-overlay",style:{zIndex:9998},"data-event-detail-dialog":"true",children:[_t("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&&i()}}),_t("div",{className:"df-dialog-container",children:[_t("button",{type:"button",onClick:i,disabled:x,className:"df-event-dialog-close","aria-label":"Close",children:_t("svg",{fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:_t("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),_t("div",{children:[_t("span",{className:"df-form-label",children:E("eventTitle")}),_t("div",{className:"df-form-row",children:[_t("div",{className:"df-form-field",children:_t("input",{id:`event-dialog-title-${u.id}`,name:"title",type:"text",value:u.title,readOnly:!N||x,disabled:!N||x,onChange:e=>{h(Object.assign(Object.assign({},u),{title:e.target.value}))},className:"df-form-input"})}),N&&_t(wr,{options:C,value:u.calendarId||"blue",disabled:x,onChange:e=>h(Object.assign(Object.assign({},u),{calendarId:e})),registry:null==l?void 0:l.getCalendarRegistry()})]}),u.allDay?_t("div",{className:"df-event-dialog-time-row",children:[_t("div",{className:"df-form-label",children:E("dateRange")}),_t(Dr,{value:[u.start,u.end],format:"YYYY-MM-DD",showTime:!1,timeZone:S,matchTriggerWidth:!0,disabled:!N||x,onChange:M,onOk:M,locale:null==l?void 0:l.state.locale})]}):_t("div",{className:"df-event-dialog-time-row",children:[_t("div",{className:"df-form-label",children:E("timeRange")}),_t(Dr,{value:[u.start,u.end],timeZone:S,disabled:!N||x,onChange:e=>{const[t,n]=e;h(Object.assign(Object.assign({},u),{start:t,end:n}))},onOk:e=>{const[t,n]=e;h(Object.assign(Object.assign({},u),{start:t,end:n}))},locale:null==l?void 0:l.state.locale})]}),O&&_t("div",{className:"df-event-dialog-notes-row",children:[_t("span",{className:"df-form-label",children:E("note")}),_t("textarea",{id:`event-dialog-note-${u.id}`,name:"note",value:null!==(d=u.description)&&void 0!==d?d:"",readOnly:!N||x,disabled:!N||x,onChange:e=>h(Object.assign(Object.assign({},u),{description:e.target.value})),rows:4,className:"df-form-textarea",placeholder:E("addNotePlaceholder")})]}),N&&_t("div",{className:"df-form-actions",children:[u.allDay?_t("button",{type:"button",disabled:x,className:"df-tint-primary df-hover-primary-md df-btn-sm",onClick:()=>{var e;const t=P(u.start)?u.start:u.start.toPlainDate(),a=null!==(e=null==l?void 0:l.timeZone)&&void 0!==e?e:n.Now.timeZoneId(),r=n.ZonedDateTime.from({year:t.year,month:t.month,day:t.day,hour:9,minute:0,timeZone:a}),o=n.ZonedDateTime.from({year:t.year,month:t.month,day:t.day,hour:10,minute:0,timeZone:a});h(Object.assign(Object.assign({},u),{allDay:!1,start:r,end:o}))},children:E("setAsTimed")}):_t("button",{type:"button",disabled:x,className:"df-tint-primary df-hover-primary-md df-btn-sm",onClick:()=>{const e=P(u.start)?u.start:u.start.toPlainDate();h(Object.assign(Object.assign({},u),{allDay:!0,start:e,end:e}))},children:E("setAsAllDay")}),_t(Ba,{type:"button",disabled:x,className:"df-fill-destructive df-hover-destructive df-btn-sm",onClick:()=>e(void 0,void 0,void 0,function*(){if(!f&&!D){w(!0);try{yield o(t.id),i()}finally{w(!1)}}}),loading:D,children:E("delete")}),_t(Ba,{type:"button",className:"df-fill-primary df-btn-sm "+(T?"df-shadow-primary df-hover-primary-solid":""),style:{marginLeft:"auto"},onClick:()=>e(void 0,void 0,void 0,function*(){if(!f&&!D){y(!0);try{yield r(Ke(t,u,null==l?void 0:l.timeZone)),i()}finally{y(!1)}}}),disabled:!T||x,loading:f,children:E("save")})]})]})]})]}),H=document.body;return H?c(R,H):null},Er=e=>e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),Cr=({app:e,anchorRef:t,onClose:n,isOpen:a})=>{const{t:r}=Pn(),[o,i]=g(""),[l,s]=g(0),[d,u]=g(!1),h=v(null),f=v(null);m(()=>{a||u(!1)},[a]),m(()=>{if(a){const e=window.setTimeout(()=>{var e;return null===(e=h.current)||void 0===e?void 0:e.focus()},50);return i(""),s(0),()=>window.clearTimeout(e)}},[a]),m(()=>{const e=e=>{a&&f.current&&!f.current.contains(e.target)&&t.current&&!t.current.contains(e.target)&&n()};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[a,n,t]);const[D,w]=g({top:0,left:0}),[b,E]=g("top"),[C,T]=g(0),S=p(()=>qe(e.timeZone),[e.timeZone,a]),M=p(()=>{var t,n;if(!o.trim())return[];const a=[],r=e.getCalendars(),i=e.getAllEvents(),l=o.toLowerCase(),s=i.find(e=>e.title.toLowerCase()===l);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:o,calendarId:d||"",color:u,start:S.start,end:S.end});const h=new Set([o.toLowerCase()]),g=i.filter(t=>{var n;if(!t.title.toLowerCase().includes(l))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 g.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:S.start,end:S.end})}),a},[o,e,S]);y(()=>{if(a&&t.current&&f.current){const e=t.current.getBoundingClientRect(),n=f.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;T(l-r);let s=0,d="top";e.top<n+20?(d="bottom",s=e.bottom+12):(d="top",s=e.top-12-n),E(d),w({top:s,left:r}),u(!0)}},[a,t,M]);const N=t=>{if(!t.calendarId)return;const a=Mt(),r={id:a,title:t.title,start:Oe(t.start,e.timeZone),end:Oe(t.end,e.timeZone),calendarId:t.calendarId,allDay:!1};e.addEvent(r),e.setCurrentDate(t.start),e.highlightEvent(a),n()};return m(()=>{if(!a)return;const e=e=>{0!==M.length&&("ArrowDown"===e.key?(e.preventDefault(),s(e=>(e+1)%M.length)):"ArrowUp"===e.key?(e.preventDefault(),s(e=>(e-1+M.length)%M.length)):"Enter"===e.key&&(e.preventDefault(),M[l]&&N(M[l])))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[a,M,l]),a?c(_t("div",{ref:f,className:"df-portal df-quick-create","data-ready":d?"true":"false",style:{top:D.top,left:D.left,visibility:d?"visible":"hidden"},children:[_t("div",{className:"df-quick-create-header",children:[_t("div",{className:"df-quick-create-title",children:r("quickCreateEvent")||"Quick Create Event"}),_t("div",{className:"df-quick-create-input-wrap",children:_t("input",{ref:h,type:"text",className:"df-form-input",placeholder:r("quickCreatePlaceholder")||"Enter title (e.g. Code review)",value:o,onChange:e=>i(e.target.value)})})]}),_t("div",{className:"df-quick-create-list",children:[0===M.length&&o&&_t("div",{className:"df-quick-create-empty",children:r("noSuggestions")||"Type to create"}),M.map((e,t)=>{return _t("div",{className:"df-quick-create-item","data-selected":t===l?"true":"false",onClick:()=>N(e),onMouseEnter:()=>s(t),children:[_t("div",{className:"df-quick-create-color-bar",style:{backgroundColor:e.color}}),_t("div",{className:"df-quick-create-item-content",children:[_t("div",{className:"df-quick-create-item-title",children:e.title}),_t("div",{children:_t("span",{className:"df-quick-create-item-badge",children:"new"===e.type?r("today"):r("tomorrow")})}),_t("div",{className:"df-quick-create-item-time",children:(n=e.start,a=e.end,`${Er(n)} - ${Er(a)}`)})]})]},`${e.type}-${t}`);var n,a})]}),_t("div",{className:"df-quick-create-arrow","data-placement":"top"===b?"bottom":"top",style:{left:C}})]}),document.body):null},Tr=({visibleMonth:e,currentDate:t,showHeader:a=!1,onMonthChange:r,onDateSelect:o,events:i=[],showEventDots:l=!1,calendarRegistry:s,timeZone:d})=>{const{locale:c}=Pn(),u=p(()=>{const e=d?n.Now.plainDateISO(d):n.Now.plainDateISO();return new Date(e.year,e.month-1,e.day).toDateString()},[d]),h=t.toDateString(),g=p(()=>Oa(c,"narrow"),[c]),m=p(()=>e.toLocaleDateString(c,{month:"long",year:"numeric"}),[e,c]),v=p(()=>{if(!l||!(null==i?void 0:i.length))return null;const e=new Map;return i.forEach(t=>{var n;const a=Ne(t.start,d),r=t.end?Ne(t.end,d):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 c=he(t.calendarId||"default",s).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(c)&&r.length<4&&e.set(a,[...r,c])}}),e},[l,i,d,s]),f=p(()=>{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===u,isSelected:i===h})}return r},[e,h,u]);return _t("div",{className:"df-mini-calendar-body",children:[a?_t("div",{className:"df-mini-calendar-header-nav",children:[_t("button",{type:"button",className:"df-mini-calendar-nav-btn",onClick:()=>r(-1),"aria-label":"Previous month",children:_t(ca,{})}),_t("span",{className:"df-mini-calendar-month-label",children:m}),_t("button",{type:"button",className:"df-mini-calendar-nav-btn",onClick:()=>r(1),"aria-label":"Next month",children:_t(ua,{})})]}):null,_t("div",{className:"df-mini-calendar-grid",children:[g.map((e,t)=>_t("div",{className:"df-mini-calendar-header",children:e},`weekday-${t}`)),f.map(e=>{var t;const n=null!==(t=null==v?void 0:v.get(e.fullDate.toDateString()))&&void 0!==t?t:[];return _t("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:()=>o(e.fullDate),children:[_t("span",{className:"df-mini-calendar-day-number",children:e.date}),l&&n.length>0&&_t("div",{className:"df-mini-calendar-dots",children:n.slice(0,4).map((e,t)=>_t("div",{"data-mini-calendar-dot":"true",className:"df-mini-calendar-dot",style:{backgroundColor:e}},`${e}-${t}`))})]},e.fullDate.getTime())})]})]})},Sr=({checked:e,onChange:t,disabled:n})=>_t("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:_t("span",{className:"df-mobile-switch-thumb"})}),Mr=({date:e,onChange:t})=>{const n=Array.from({length:24},(e,t)=>t),a=Array.from({length:12},(e,t)=>5*t),r=[...n,...n,...n],o=[...a,...a,...a],i=32,l=e.getHours(),s=5*Math.round(e.getMinutes()/5),d=(24+l)*i,c=(12+s/5)*i,[u,h]=g(d),[f,p]=g(c),y=v(null),D=v(null),w=v(null);m(()=>{y.current&&(y.current.scrollTop=d,h(d)),D.current&&(D.current.scrollTop=c,p(c))},[d,c]);const b=(n,a)=>{const l=n.currentTarget;let s=l.scrollTop;if("hour"===a){const e=768;s<320?(s+=e,l.scrollTop=s):s>1600&&(s-=e,l.scrollTop=s),h(s)}else{const e=384;s<160?(s+=e,l.scrollTop=s):s>800&&(s-=e,l.scrollTop=s),p(s)}w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{((n,a)=>{const l=Math.round(a/i);if("hour"===n){const n=r[l];if(void 0!==n&&n!==e.getHours()){const a=new Date(e);a.setHours(n),t(a)}}else{const n=o[l];if(void 0!==n&&5*Math.round(e.getMinutes()/5)!==n){const a=new Date(e);a.setMinutes(n),t(a)}}})(a,s)},150)},E=(e,t)=>{const n=96+e*i+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 _t("div",{className:"df-time-wheel",children:[_t("div",{ref:y,className:"df-time-wheel-column",onScroll:e=>b(e,"hour"),children:[_t("div",{className:"df-time-wheel-spacer",style:{height:96}}),r.map((n,a)=>_t("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=y.current)||void 0===r||r.scrollTo({top:a*i,behavior:"smooth"})},children:_t("div",{className:"df-time-wheel-value","data-selected":String(n===l),style:E(a,u),children:n.toString().padStart(2,"0")})},`h-${a}-${n}`)),_t("div",{className:"df-time-wheel-spacer",style:{height:96}})]}),_t("div",{ref:D,className:"df-time-wheel-column",onScroll:e=>b(e,"minute"),children:[_t("div",{className:"df-time-wheel-spacer",style:{height:96}}),o.map((n,a)=>_t("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=D.current)||void 0===r||r.scrollTo({top:a*i,behavior:"smooth"})},children:_t("div",{className:"df-time-wheel-value","data-selected":String(n===s),style:E(a,f),children:n.toString().padStart(2,"0")})},`m-${a}-${n}`)),_t("div",{className:"df-time-wheel-spacer",style:{height:96}})]}),_t("div",{className:"df-time-wheel-selection"})]})},Nr=({isOpen:e,onClose:t,onSave:n,onEventDelete:a,draftEvent:r,app:o,timeFormat:i="24h"})=>{const{locale:l,t:s}=Pn(),d=o.getReadOnlyConfig(null==r?void 0:r.id),u=o.canMutateFromUI(null==r?void 0:r.id),h=!1!==d.viewable,[v,f]=g(""),y=!p(()=>{if(!(null==r?void 0:r.calendarId))return!1;const e=o.getCalendarRegistry().get(r.calendarId);return!!(null==e?void 0:e.subscription)},[o,null==r?void 0:r.calendarId])||""!==v.trim(),[D,w]=g(""),[b,E]=g(""),[C,T]=g(!1),[S,M]=g(new Date),[N,I]=g(new Date),[k,x]=g(new Date),[O,R]=g(new Date),[H,A]=g(null),[P,L]=g(e),[j,F]=g(!1),[Z,z]=g(!1);m(()=>{if(!e){F(!0);const e=setTimeout(()=>{L(!1),F(!1)},300);return()=>clearTimeout(e)}L(!0),F(!1)},[e]),m(()=>{if(e&&r){const e=o.getEvents().some(e=>e.id===r.id);z(e)}},[e,r,o]);const _=o.getCalendars(),U=_.map(e=>({label:e.name,value:e.id}));m(()=>{if(e&&_.length>0){_.some(e=>e.id===b)||"blue"!==b&&""!==b||E(_[0].id)}},[_,e,b]),m(()=>(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]),m(()=>{var t,n;if(e&&r){if(w(r.title||""),E(r.calendarId||(null===(t=_[0])||void 0===t?void 0:t.id)||"blue"),T(r.allDay||!1),f(r.description||""),r.start)try{const e=Y(r.start);M(e),x(e)}catch(e){console.error("Failed to parse start date",e);const t=new Date;M(t),x(t)}if(r.end)try{const e=Y(r.end);I(e),R(e)}catch(e){console.error("Failed to parse end date",e);const t=new Date;I(t),R(t)}}else if(e&&!r){E((null===(n=_[0])||void 0===n?void 0:n.id)||"blue"),f("");const e=new Date;e.setMinutes(0,0,0),M(e),x(e),I(new Date(e.getTime()+36e5)),R(e)}},[e,r]);const W=p(()=>{if(!e||!r)return!1;const t=new Date(S),n=new Date(N),a=Object.assign(Object.assign({},r),{title:D,calendarId:b,allDay:C,description:v,start:C?ke(t):$(t,o.timeZone),end:C?ke(n):$(n,o.timeZone)});return!Ct(r,Ke(r,a,o.timeZone))},[e,r,D,b,C,S,N,v]);if(!P||!h)return null;const B=e=>{A(t=>t===e?null:e)},V=e=>e.toLocaleDateString(l,{day:"numeric",month:"short",year:"numeric"}),q=(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(N.getTime()+n);I(a)}else{const e=new Date(t);e.setHours(N.getHours(),N.getMinutes()),I(e)}},G=(e,t)=>{"start"===e?x(e=>{const n=new Date(e);return n.setMonth(e.getMonth()+t),n}):R(e=>{const n=new Date(e);return n.setMonth(e.getMonth()+t),n})};return c(_t("div",{className:"df-portal df-mobile-event-drawer",children:[_t("div",{className:"df-mobile-event-drawer-backdrop","data-closing":String(j),onClick:t}),_t("div",{className:"df-mobile-event-drawer-panel "+(j?"df-animate-slide-down":"df-animate-slide-up"),onClick:e=>e.stopPropagation(),children:[_t("div",{className:"df-mobile-event-drawer-header",children:[_t("button",{type:"button",onClick:t,className:"df-mobile-event-drawer-header-action",children:s("cancel")}),_t("span",{className:"df-mobile-event-drawer-title",children:s(!u&&Z?"viewEvent":Z?"editEvent":"newEvent")}),u&&_t("button",{type:"button",onClick:()=>{if(!r)return;const e=new Date(S),t=new Date(N),a=Object.assign(Object.assign({},r),{title:D,calendarId:b,allDay:C,start:C?ke(e):$(e,o.timeZone),end:C?ke(t):$(t,o.timeZone)});n(Ke(r,a,o.timeZone))},disabled:!W,className:"df-mobile-event-drawer-header-action df-mobile-event-drawer-header-action-primary "+(W?"":"df-mobile-event-drawer-header-action-disabled"),children:s(Z?"done":"create")}),!u&&_t("span",{className:"df-mobile-event-drawer-header-spacer"})]}),_t("div",{className:"df-mobile-event-drawer-body",children:[_t("div",{className:"df-mobile-event-drawer-section df-mobile-event-drawer-section-framed",children:_t("input",{type:"text",placeholder:s("titlePlaceholder"),value:D,onChange:e=>u&&w(e.currentTarget.value),readOnly:!u,className:"df-mobile-event-drawer-title-input",autoFocus:u})}),_.length>0&&_t("div",{className:"df-mobile-event-drawer-section df-mobile-event-drawer-section-framed",children:_t("div",{className:"df-mobile-event-drawer-row",children:[_t("span",{className:"df-mobile-event-drawer-label",children:s("calendar")}),_t(wr,{options:U,value:b,onChange:u?E:()=>{},registry:o.getCalendarRegistry(),variant:"mobile",disabled:!u})]})}),_t("div",{className:"df-mobile-event-drawer-section df-mobile-event-drawer-section-framed",children:_t("div",{className:"df-mobile-event-drawer-row",children:[_t("span",{className:"df-mobile-event-drawer-label",children:s("allDay")}),_t(Sr,{checked:C,onChange:u?T:()=>{},disabled:!u})]})}),_t("div",{className:"df-mobile-event-drawer-section",children:[_t("div",{className:"df-mobile-event-drawer-row df-mobile-event-drawer-row-padded",children:[_t("span",{className:"df-mobile-event-drawer-label",children:s("starts")}),_t("div",{className:"df-mobile-event-drawer-controls",children:[_t("button",{type:"button",className:"df-mobile-event-drawer-picker-trigger","data-active":String("start-date"===H),onClick:()=>u&&B("start-date"),disabled:!u,"aria-expanded":"start-date"===H,children:V(S)}),!C&&_t("button",{type:"button",className:"df-mobile-event-drawer-picker-trigger","data-active":String("start-time"===H),onClick:()=>u&&B("start-time"),disabled:!u,"aria-expanded":"start-time"===H,children:Fe(S.getHours()+S.getMinutes()/60,0,i)})]})]}),_t("div",{className:"df-mobile-event-drawer-expander","data-kind":"calendar","data-expanded":String("start-date"===H),children:_t("div",{className:"df-mobile-event-drawer-expander-content",children:_t(Tr,{currentDate:S,visibleMonth:k,onDateSelect:e=>q("start",e),onMonthChange:e=>G("start",e),showHeader:!0,events:o.getEvents(),calendarRegistry:o.getCalendarRegistry(),timeZone:o.timeZone})})}),_t("div",{className:"df-mobile-event-drawer-expander","data-kind":"time","data-expanded":String("start-time"===H),children:_t("div",{className:"df-mobile-event-drawer-expander-content",children:_t(Mr,{date:S,onChange:e=>{const t=N.getTime()-S.getTime();M(e),I(new Date(e.getTime()+t))},timeFormat:i})})})]}),_t("div",{className:"df-mobile-event-drawer-section",children:[_t("div",{className:"df-mobile-event-drawer-row df-mobile-event-drawer-row-padded",children:[_t("span",{className:"df-mobile-event-drawer-label",children:s("ends")}),_t("div",{className:"df-mobile-event-drawer-controls",children:[_t("button",{type:"button",className:"df-mobile-event-drawer-picker-trigger","data-active":String("end-date"===H),onClick:()=>u&&B("end-date"),disabled:!u,"aria-expanded":"end-date"===H,children:V(N)}),!C&&_t("button",{type:"button",className:"df-mobile-event-drawer-picker-trigger","data-active":String("end-time"===H),onClick:()=>u&&B("end-time"),disabled:!u,"aria-expanded":"end-time"===H,children:Fe(N.getHours()+N.getMinutes()/60,0,i)})]})]}),_t("div",{className:"df-mobile-event-drawer-expander","data-kind":"calendar","data-expanded":String("end-date"===H),children:_t("div",{className:"df-mobile-event-drawer-expander-content",children:_t(Tr,{currentDate:N,visibleMonth:O,onDateSelect:e=>q("end",e),onMonthChange:e=>G("end",e),showHeader:!0,events:o.getEvents(),calendarRegistry:o.getCalendarRegistry(),timeZone:o.timeZone})})}),_t("div",{className:"df-mobile-event-drawer-expander","data-kind":"time","data-expanded":String("end-time"===H),children:_t("div",{className:"df-mobile-event-drawer-expander-content",children:_t(Mr,{date:N,onChange:e=>{if(e<S){const t=N.getTime()-S.getTime();I(e),M(new Date(e.getTime()-t))}else I(e)},timeFormat:i})})})]}),y&&_t("div",{className:"df-mobile-event-drawer-section df-mobile-event-drawer-section-framed",children:_t("textarea",{placeholder:s("notesPlaceholder"),value:v,onChange:e=>u&&f(e.currentTarget.value),readOnly:!u,className:"df-mobile-event-drawer-notes"})}),u&&Z&&a&&r&&_t("div",{className:"df-mobile-event-drawer-section df-mobile-event-drawer-section-danger",children:_t("button",{type:"button",onClick:()=>a(r.id),className:"df-mobile-event-drawer-delete-button",children:s("delete")})})]})]})]}),document.body)},Ir=()=>_t("svg",{className:"df-search-results-state-icon",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:_t("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),kr=({loading:e,results:t,keyword:n,onResultClick:a,emptyText:r})=>{const{t:o,locale:i}=Pn(),l=p(()=>ln(new Date),[]),s=p(()=>dn(t,l),[t,l]),d=e=>on(e);return e?_t("div",{className:"df-search-results-state",children:[_t(Da,{className:"df-search-results-loader"}),_t("span",{children:"Loading..."})]}):0===t.length?n?_t("div",{className:"df-search-results-state",children:[_t(Ir,{}),_t("span",{style:{marginTop:"0.5rem",fontSize:"0.875rem"},children:"string"==typeof r?r:r&&"object"==typeof r?r[i]||r.en||"No results found":o("noResults")||"No results found"})]}):null:_t("div",{className:"df-search-results",children:s.map(e=>{const{title:t,tone:n}=sn(e.date,l,i,o);return _t("div",{className:"df-search-results-group",children:[_t("h3",{className:"df-search-results-date-header","data-tone":n,children:t}),_t("div",{className:"df-search-results-events",children:e.events.map(e=>{const t=d(e.start),n=d(e.end),r={hour:"2-digit",minute:"2-digit"},l=e.allDay?o("allDay")||"All Day":t.toLocaleTimeString(i,r),s=e.allDay?"":n.toLocaleTimeString(i,r);return _t("div",{children:[_t("div",{className:"df-search-results-event",onClick:()=>null==a?void 0:a(e),children:_t("div",{className:"df-search-results-event-inner",children:[_t("div",{className:"df-search-results-color-bar",style:{backgroundColor:e.color||"#3b82f6"}}),_t("div",{className:"df-search-results-event-content",children:[_t("div",{className:"df-search-results-event-title",children:e.title}),_t("div",{className:"df-search-results-event-time",children:[_t("div",{children:l}),s&&_t("div",{className:"df-search-results-end-time",children:s})]})]})]})}),_t("div",{className:"df-search-results-divider"})]},e.id)})})]},e.date.getTime())})})},xr=({isOpen:e,onClose:t,keyword:n,onSearchChange:a,results:r,loading:o,onResultClick:i,emptyText:l})=>{const s=v(null),{t:d}=Pn();return m(()=>(e?(setTimeout(()=>{var e;null===(e=s.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?c(_t("div",{className:"df-mobile-fullscreen",children:[_t("div",{className:"df-search-dialog-header",children:[_t("button",{type:"button",onClick:t,className:"df-search-dialog-back-btn",children:_t(Ma,{className:"df-search-dialog-back-icon"})}),_t("div",{className:"df-search-dialog-input-wrap",children:[_t("input",{ref:s,type:"text",placeholder:d("search")||"Search",value:n,onChange:e=>{const t=e.target.value;t!==n&&a(t)},className:"df-search-dialog-input"}),n&&_t("button",{type:"button",onClick:()=>{""!==n&&a("")},className:"df-search-dialog-input-clear",children:_t(pa,{className:"df-search-dialog-clear-icon"})})]})]}),_t("div",{className:"df-search-dialog-results",children:_t(kr,{loading:o,results:r,keyword:n,onResultClick:e=>{null==i||i(e)},emptyText:l})})]}),document.body):null},Or=({isOpen:e,loading:t,results:n,keyword:a,onResultClick:r,emptyText:o})=>_t("div",{className:"df-search-drawer","data-open":e?"true":"false",children:_t("div",{className:"df-search-drawer-content",children:_t(kr,{loading:t,results:n,keyword:a,onResultClick:r,emptyText:o})})});let Rr=null;function Hr(e){Rr=e}const Ar={enabled:!1,width:"0px",isCollapsed:!1,toggleCollapsed:()=>{},miniWidth:"0px",content:null,extraContent:null,safeAreaLeft:0};function Pr(e){return Rr&&e.hasPlugin("sidebar")?Rr(e):Ar}const Lr=({locale:e,messages:t,children:n})=>Pn().isDefault?_t(Aa,{locale:e,messages:t,children:n}):n,$r=({app:t,customDetailPanelContent:n,customEventDetailDialog:a,meta:r,customMessages:o,search:l,titleBarSlot:s,collapsedSafeAreaLeft:d})=>{const u=D(Za),{tick:h,selectedEventId:y}=function(e){var t;const[n,a]=g(0),[r,o]=g(null!==(t=e.state.selectedEventId)&&void 0!==t?t:null);return m(()=>{var t;a(0),o(null!==(t=e.state.selectedEventId)&&void 0!==t?t:null)},[e]),m(()=>e.subscribe(e=>{a(e=>e+1),o(t=>{var n;const a=null!==(n=e.state.selectedEventId)&&void 0!==n?n:null;return t===a?t:a})}),[e]),{tick:n,selectedEventId:r}}(t),{isMobile:w}=function(){const[e,t]=g(!1);return m(()=>{const e=()=>{t(window.matchMedia("(max-width: 768px)").matches)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),{isMobile:e}}(),b=function(t,n){const[a,r]=g(""),[o,i]=g(!1),[l,s]=g(!1),[d,c]=g(!1),[u,h]=g([]),p=v(""),y=v(!1);m(()=>{t.state.highlightedEventId&&t.selectEvent(t.state.highlightedEventId)},[t.state.highlightedEventId,t]),m(()=>{y.current&&!o&&null!==t.state.highlightedEventId&&t.highlightEvent(null),y.current=o},[o,t]),m(()=>{var r;if(!a.trim())return i(!1),h([]),p.current.trim()&&null!==t.state.highlightedEventId&&t.highlightEvent(null),void(p.current=a);const o=null!==(r=null==n?void 0:n.debounceDelay)&&void 0!==r?r:300,l=setTimeout(()=>e(this,void 0,void 0,function*(){var e;c(!0),i(!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})})}h(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),h([])}finally{c(!1)}}),o);return p.current=a,()=>clearTimeout(l)},[a,n,t]);const D=f((e,a="desktop")=>{const r=()=>{let n;n=e.start instanceof Date?e.start:"string"==typeof e.start?new Date(e.start):Y(e.start),t.setCurrentDate(n),t.highlightEvent(e.id),l&&s(!1)},o=()=>{"mobile"===a?s(!1):i(!1)};(null==n?void 0:n.onResultClick)?n.onResultClick({event:e,app:t,source:a,defaultAction:r,closeSearch:o}):r()},[t,l,n]),w=f(()=>{r(""),s(!0)},[]),b=f(()=>{i(!1),r(""),t.highlightEvent(null)},[t]),E=f(()=>{s(!1),r(""),t.highlightEvent(null)},[t]);return{searchKeyword:a,setSearchKeyword:r,isSearchOpen:o,setIsSearchOpen:i,isMobileSearchOpen:l,setIsMobileSearchOpen:s,searchLoading:d,searchResults:u,handleSearchResultClick:D,handleSearchClick:w,handleSearchClose:b,handleMobileSearchClose:E}}(t,l),E=a||(t.getUseEventDetailDialog()?br:void 0),C=function(t,n,a){const[r,o]=g(null),i=v(null);m(()=>{o(null),i.current=null},[t]);const l=f(()=>{o(null),i.current=null,t.selectEvent(null)},[t]),s=f(e=>t.updateEvent(e.id,e),[t]),d=f(n=>e(this,void 0,void 0,function*(){yield t.deleteEvent(n),o(null),t.selectEvent(null)}),[t]),c=p(()=>{var e;if(!n||!r)return null;const a=r.split("::")[0],o=t.getEvents().find(e=>e.id===a);o&&(i.current=o);const c=null!=o?o:(null===(e=i.current)||void 0===e?void 0:e.id)===a?i.current:null;return c?{event:c,isOpen:!0,isAllDay:P(c.start),onEventUpdate:s,onEventDelete:d,onClose:l,app:t}:null},[a,r,n,l,s,d,t]);return{detailPanelEventId:r,setDetailPanelEventId:o,dialogProps:c}}(t,E,h),T=Pr(t),S=function(e,t,n){const[a,r]=g(!1),o=v(null),[i,l]=g(!1),[s,d]=g(null),[c,u]=g(!1),h=f(()=>{u(!0)},[]),m=f(i=>{if(!e.canMutateFromUI())return;const s=e.getCalendarRegistry().getDefaultWritableCalendar();if(s){if(t){const{start:t,end:n}=qe(e.timeZone),a={id:Mt(),title:"",start:Oe(t,e.timeZone),end:Oe(n,e.timeZone),calendarId:s.id};return d(a),void l(!0)}n?a?r(!1):(o.current=i.currentTarget,r(!0)):h()}},[t,a,e,n,h]);return{isQuickCreateOpen:a,setIsQuickCreateOpen:r,quickCreateAnchorRef:o,isMobileDrawerOpen:i,setIsMobileDrawerOpen:l,mobileDraftEvent:s,setMobileDraftEvent:d,handleAddButtonClick:m,isCreateCalendarOpen:c,setIsCreateCalendarOpen:u}}(t,w,T.enabled),[M,N]=g(()=>t.getTheme());m(()=>t.subscribeThemeChange(e=>N(e)),[t]);const I=f(e=>t.setTheme(e),[t]);m(()=>{const e=t.callbacks,n=e.onDismissUI,a=e.onEventDetailToggle;return e.onDismissUI=()=>{C.detailPanelEventId&&C.setDetailPanelEventId(null),S.isMobileDrawerOpen&&S.setIsMobileDrawerOpen(!1),null==n||n()},e.onEventDetailToggle=e=>{C.setDetailPanelEventId(e),null==a||a(e)},()=>{e.onDismissUI=n,e.onEventDetailToggle=a}},[t,C,S]),m(()=>{if(!w||!C.detailPanelEventId)return;const e=C.detailPanelEventId.split("::")[0],n=t.getEvents().find(t=>t.id===e);n&&(S.setMobileDraftEvent(n),S.setIsMobileDrawerOpen(!0)),C.setDetailPanelEventId(null)},[C.detailPanelEventId,w]);const k=f(e=>{t.setCurrentDate(e),t.selectEvent(null)},[t]),x=f(e=>t.selectEvent(e),[t]),O=v(null),R={app:t,config:t.getCurrentView().config||{},customDetailPanelContent:n,customEventDetailDialog:E,switcherMode:t.state.switcherMode,calendarRef:O,meta:r,selectedEventId:y,onEventSelect:x,onDateChange:k,detailPanelEventId:C.detailPanelEventId,onDetailPanelToggle:C.setDetailPanelEventId},H=p(()=>({isCollapsed:T.isCollapsed,toggleCollapsed:T.toggleCollapsed}),[T.isCollapsed,T.toggleCollapsed]),A=void 0!==d,L=A?"0px":T.miniWidth,$=A&&T.isCollapsed?d:T.safeAreaLeft,j=t.getCalendarHeaderConfig(),F=Object.assign({calendar:t,switcherMode:t.state.switcherMode,onAddCalendar:S.handleAddButtonClick,onSearchChange:b.setSearchKeyword,onSearchClick:b.handleSearchClick,searchValue:b.searchKeyword,isSearchOpen:b.isSearchOpen,isEditable:t.canMutateFromUI()},$>0?{safeAreaLeft:$}:{}),Z=t.getCurrentView().component,z=t.getCustomMobileEventRenderer()||Nr;return _t(Ya,{initialTheme:M,onThemeChange:I,children:_t(Lr,{locale:t.state.locale,messages:o,children:_t("div",{className:"df-calendar-container",children:[_t(_a,{store:u,generatorName:"titleBarSlot",generatorArgs:H,defaultContent:s&&("function"==typeof s?s(H):s)}),T.enabled&&_t("aside",{className:"df-calendar-sidebar-aside",style:{width:T.width},children:T.content}),_t("div",{className:"df-calendar-shell","data-sidebar-collapsed":T.isCollapsed,style:{marginLeft:T.enabled?`calc(${T.isCollapsed?L:T.width} - 1px)`:0},children:[!1===j?null:_t(_a,{store:u,generatorName:"calendarHeader",generatorArgs:F,defaultContent:i($a,F)}),_t("div",{className:"df-calendar-content-wrap",ref:O,children:[_t("div",{className:"df-calendar-renderer",children:[_t("div",{className:"df-calendar-view-container",children:_t(Z,Object.assign({},R))}),_t(Or,{isOpen:b.isSearchOpen,onClose:b.handleSearchClose,loading:b.searchLoading,results:b.searchResults,keyword:b.searchKeyword,onResultClick:e=>b.handleSearchResultClick(e,"desktop"),emptyText:null==l?void 0:l.emptyText})]}),_t(xr,{isOpen:b.isMobileSearchOpen,onClose:b.handleMobileSearchClose,keyword:b.searchKeyword,onSearchChange:b.setSearchKeyword,results:b.searchResults,loading:b.searchLoading,onResultClick:e=>b.handleSearchResultClick(e,"mobile"),emptyText:null==l?void 0:l.emptyText})]})]}),_t(Cr,{app:t,anchorRef:S.quickCreateAnchorRef,isOpen:S.isQuickCreateOpen,onClose:()=>S.setIsQuickCreateOpen(!1)}),_t(z,{isOpen:S.isMobileDrawerOpen,onClose:()=>{S.setIsMobileDrawerOpen(!1),S.setMobileDraftEvent(null)},onSave:e=>{t.getEvents().some(t=>t.id===e.id)?t.updateEvent(e.id,e):t.addEvent(e),S.setIsMobileDrawerOpen(!1),S.setMobileDraftEvent(null)},onEventDelete:e=>{t.deleteEvent(e),S.setIsMobileDrawerOpen(!1),S.setMobileDraftEvent(null)},draftEvent:S.mobileDraftEvent,app:t}),T.extraContent,S.isCreateCalendarOpen&&_t(qa,{app:t,onClose:()=>S.setIsCreateCalendarOpen(!1),onCreate:n=>e(void 0,void 0,void 0,function*(){yield t.createCalendar(n),S.setIsCreateCalendarOpen(!1)})}),(()=>{if(!C.dialogProps)return null;const e=E,t="undefined"==typeof document?null:document.body;if(!t)return null;const n=null==u?void 0:u.isOverridden("eventDetailDialog");return _t(_a,{store:u,generatorName:"eventDetailDialog",generatorArgs:C.dialogProps,defaultContent:n?null:c(i(e,C.dialogProps),t)})})()]})})})};class jr{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())}}class Yr{constructor(e,t){this.app=e,this.container=null,this.unsubscribe=null,this.renderRequested=!1,this.extraProps={},this.customRenderingStore=new jr(t),t&&this.app.setOverrides(t),this.unsubscribe=e.subscribe(()=>this.requestRender())}setProps(e){Nt(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&&(l(null,this.container),this.container=null),this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null)}getCustomRenderingStore(){return this.customRenderingStore}render(){this.container&&l(i(Za.Provider,{value:this.customRenderingStore},i($r,Object.assign({app:this.app},this.extraProps))),this.container)}}function Fr(t){return e(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=Cn(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}=se(l);return{calendar:{id:Mt(),name:o,isVisible:!0,colors:s,darkColors:d,subscription:{url:t,status:"ready"}},events:a.events}})}var Zr=0;function zr(e,t,n,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:n,ref:l,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Zr,__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 a.vnode&&a.vnode(c),c}const _r=({className:e,width:t=24,height:n=24})=>zr("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:zr("path",{d:"m9 18 6-6-6-6"})}),Ur=u(({x:e,y:t,onClose:n,children:a,className:r},o)=>{const i=v(null);m(()=>{const e=()=>n(),t=e=>{if(i.current&&!i.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]);return c(zr("div",{ref:e=>{i.current=e,"function"==typeof o?o(e):o&&"current"in o&&(o.current=e)},className:"df-portal df-context-menu df-context-menu-content"+(r?` ${r}`:""),style:{top:t,left:e},onContextMenu:e=>e.preventDefault(),"data-context-menu-root":"true",role:"menu",children:a}),document.body)});Ur.displayName="ContextMenu";const Wr=({onClick:e,children:t,icon:n,danger:a,disabled:r})=>zr("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&&zr("span",{className:"df-context-menu-item-icon",children:n}),t]}),Br=()=>zr("div",{className:"df-context-menu-separator",role:"separator"}),Vr=({children:e})=>zr("div",{className:"df-context-menu-label",children:e}),qr=({children:e})=>{const[t,n]=g(!1),a=v(null);return m(()=>()=>{a.current&&clearTimeout(a.current)},[]),zr("div",{className:"df-context-menu-sub",onMouseEnter:()=>{a.current&&(clearTimeout(a.current),a.current=null),n(!0)},onMouseLeave:()=>{a.current=setTimeout(()=>n(!1),100)},children:(Array.isArray(e)?e:[e]).map(e=>s(e)?d(e,{isOpen:t}):e)})},Gr=({children:e,icon:t,isOpen:n})=>zr("div",{className:"df-context-menu-sub-trigger","data-open":n,role:"menuitem",tabIndex:0,children:[t&&zr("span",{className:"df-context-menu-sub-icon",children:t}),zr("span",{className:"df-context-menu-sub-label",children:e}),zr(_r,{className:"df-context-menu-sub-chevron"})]}),Kr=({children:e,isOpen:t})=>{const n=v(null),[a,r]=g("right");return m(()=>{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&&r(a.right+t.width>window.innerWidth?"left":"right")}},[t]),t?zr("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},Xr=["#ea426b","#f19a38","#f7cf46","#83d754","#51aaf2","#b672d0","#957e5e"],Jr=({selectedColor:e,onSelect:t,onCustomColor:n,customColorLabel:a="Custom Color"})=>zr("div",{className:"df-context-menu-color-picker",children:[zr("div",{className:"df-context-menu-color-grid",children:Xr.map(n=>zr("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&&zr("button",{type:"button",className:"df-context-menu-custom-color",onClick:e=>{e.stopPropagation(),n()},children:a})]}),Qr=({x:t,y:n,date:a,onClose:r,app:i,onCreateEvent:l,viewType:s})=>{const{t:d}=Pn();if(!i.canMutateFromUI())return null;const c=cn.hasEvent(),u=_t(o,{children:[_t(Wr,{onClick:()=>{l(),r()},children:d("newEvent")||"New Event"}),_t(Wr,{onClick:()=>e(void 0,void 0,void 0,function*(){yield((t,n,a)=>e(void 0,void 0,void 0,function*(){if(cn.hasEvent())try{let e=cn.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=Me(r.start),i=Me(r.end).getTime()-o.getTime(),l=e,s=new Date(n),d=a===x.MONTH||a===x.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)),g=Object.assign(Object.assign({},l),{title:r.title,id:Mt(),start:r.allDay?ke(s):Oe(s,t.timeZone),end:r.allDay?ke(h):Oe(h,t.timeZone),calendarId:r.calendarId&&t.getCalendarRegistry().has(r.calendarId)?r.calendarId:t.getCalendarRegistry().getDefaultCalendarId()||"default"});t.addEvent(g)}}catch(e){console.error("Failed to paste event:",e)}}))(i,a,s),r()}),disabled:!c,children:d("pasteHere")||"Paste Here"})]});return _t(Ur,{x:t,y:n,onClose:r,className:"df-context-menu",children:_t(_a,{generatorName:"gridContextMenu",generatorArgs:{date:a,viewType:s,onClose:r},defaultContent:u})})},eo=({event:t,x:n,y:a,onClose:r,app:i})=>{const{t:l}=Pn();if(!i.canMutateFromUI(t.id))return null;const s=i.getCalendars(),d=_t(o,{children:[_t(qr,{children:[_t(Gr,{children:l("calendars")||"Calendars"}),_t(Kr,{children:s.map(e=>{const n=e.id===t.calendarId;return _t(Wr,{onClick:()=>{return n=e.id,i.updateEvent(t.id,{calendarId:n}),void r();var n},children:_t("div",{className:"df-context-menu-calendar-item",children:[_t("div",{className:"df-context-menu-calendar-check-wrap",children:n&&_t(va,{className:"df-text-primary df-context-menu-calendar-check"})}),_t("div",{className:"df-context-menu-calendar-info",children:[_t("div",{className:"df-context-menu-calendar-dot",style:{backgroundColor:e.colors.lineColor}}),_t("span",{className:"df-context-menu-calendar-label","data-selected":n,children:e.name})]})]})},e.id)})})]}),_t(Br,{}),_t(Wr,{onClick:()=>{i.deleteEvent(t.id),r()},danger:!0,children:l("delete")||"Delete"}),_t(Wr,{onClick:()=>e(void 0,void 0,void 0,function*(){try{const e=JSON.stringify(t,null,2);yield navigator.clipboard.writeText(e),cn.setEvent(t),i.deleteEvent(t.id)}catch(e){console.error("Failed to cut event: ",e)}r()}),children:l("cut")||"Cut"}),_t(Wr,{onClick:()=>e(void 0,void 0,void 0,function*(){try{const e=JSON.stringify(t,null,2);yield navigator.clipboard.writeText(e),cn.setEvent(t)}catch(e){console.error("Failed to copy event: ",e)}r()}),children:l("copy")||"Copy"})]});return _t(Ur,{x:n,y:a,onClose:r,children:_t(_a,{generatorName:"eventContextMenu",generatorArgs:{event:t,onClose:r},defaultContent:d})})},to=(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},no=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},ao=(e,t,n)=>{const a=["df-event"];return e===x.DAY?a.push("df-day-event"):e===x.WEEK?a.push("df-week-event"):e===x.MONTH?(a.push("df-month-event"),n||a.push("df-month-event-stacked")):e===x.YEAR&&a.push("df-year-event"),a.push(t?"df-event-all-day":"df-event-timed"),a.join(" ")},ro=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"}},oo=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("假期")?_t(wa,{className:Kn}):t.includes("birthday")||t.includes("anniversary")||t.includes("生日")?_t(ba,{className:Kn}):t.includes("conference")||t.includes("meeting")||t.includes("会议")||t.includes("研讨")?_t(Ca,{className:Kn}):t.includes("trip")||t.includes("travel")||t.includes("旅行")?_t(Ea,{className:Kn}):_t(ya,{className:Kn})},io=(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=Ne(e.start,a),l=e.end?Ne(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=B(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 g;if(e.allDay)g=new Date(d),g.setHours(23,59,59,999);else{0!==l.getHours()||0!==l.getMinutes()||0!==l.getSeconds()?(g=new Date(d),g.setHours(23,59,59,999)):(g=new Date(d),g.setTime(g.getTime()-1))}if(g<t||h>o)return;const m=h<t?t:h,v=g>o?o:g,f=Math.max(0,Math.floor((m.getTime()-t.getTime())/864e5)),p=Math.min(n-1,Math.floor((v.getTime()-t.getTime())/864e5)),y=h>=t,D=g<=o,w=0===f||p===n-1;let b;b=y&&D?"single":y?w&&p===n-1?"start-week-end":"start":D?w&&0===f?"end-week-start":"end":"middle";const E=B(h,g)+1;r.push({id:`${e.id}-week-${t.getTime()}`,originalEventId:e.id,event:e,startDayIndex:f,endDayIndex:p,segmentType:b,totalDays:E,segmentIndex:0,isFirstSegment:y,isLastSegment:D})}),r},lo=(e,t,n=7,a)=>{if(e.allDay)return[];const r=Ne(e.start,a),o=e.end?Ne(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=B(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,g=s?r.getHours()+r.getMinutes()/60:0,m=c&&d?o.getHours()+o.getMinutes()/60:24;h.push({dayIndex:l,startHour:g,endHour:m,isFirst:s,isLast:c})}return h},so={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"},co=h(({segment:e,segmentIndex:t,isDragging:n,isResizing:a=!1,isSelected:r=!1,onMoveStart:i,onResizeStart:l,onEventLongPress:s,isMobile:d=!1,isDraggable:c=!0,isEditable:u=!0,viewable:h=!0,isPopping:m,renderSlot:f,appTimeZone:y})=>{const[D,w]=g(!1),b=p(()=>{if(!y||e.event.allDay)return e.event;const t=Ie(e.event.start,y),n=e.event.end?Ie(e.event.end,y):void 0;return Object.assign(Object.assign({},e.event),{start:t,end:n})},[e.event,y]),E=17*t,C=`calc(${e.startDayIndex/7*100}% + 2px)`,T=`calc(${(e.endDayIndex-e.startDayIndex+1)/7*100}% - 4px)`,S=v(null),M=v(null),N=t=>{const n="left"===t;return(n?e.isFirstSegment:e.isLastSegment)&&l&&u?_t("div",{className:n?Xn:Jn,onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),l(t,e.event,n?"left":"right")},onClick:e=>{e.preventDefault(),e.stopPropagation()}}):null},I=ge(e.event),k=!!e.event.calendarIds&&e.event.calendarIds.length>1,x=k?pe(e.event):null,O=r||n||D,R=()=>{const t=b.allDay,n=ge(b),a=K(b.start),r=Ze(b),o=Fe(a),i=Fe(r),l=me(e.event),s=O&&k;if(t){const t=()=>e.isFirstSegment?b.title:"middle"===e.segmentType||e.isLastSegment&&e.totalDays>1?"···":b.title;return _t("div",{className:"df-month-segment-event-all-day",children:[e.isFirstSegment&&oo(b)&&_t("div",{className:"df-event-icon-slot",children:_t("div",{className:"df-event-year-icon-badge",style:{backgroundColor:he(n)},children:oo(b)})}),_t("div",{className:"df-month-segment-event-all-day-main",children:_t("div",{className:"df-month-segment-event-all-day-title "+(d?"df-mobile-mask-fade":""),style:d?so:void 0,children:t()})}),e.isLastSegment&&"single"!==e.segmentType&&_t("div",{className:"df-month-segment-event-tail",children:_t("div",{className:"df-month-segment-event-tail-dot"})})]})}const c=e.isFirstSegment||e.isLastSegment?b.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 _t("div",{className:"df-event-month-main",children:[!s&&_t("div",{className:Gn,style:l.length>1?{background:ve(l)}:{backgroundColor:l[0]}}),_t("div",{className:"df-event-month-main",children:_t("span",{className:"df-event-month-title "+(d?"df-mobile-mask-fade":""),style:d?so:void 0,children:c})}),e.isFirstSegment&&!d&&_t("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&&!b.allDay&&24!==r&&!d&&_t("span",{className:"df-month-segment-event-tail-time",children:`ends ${i}`})]})},H=e.endDayIndex-e.startDayIndex+1;return _t("div",{className:"df-month-segment-event",style:Object.assign(Object.assign({left:C,width:T,top:`${E}px`,height:"16px",pointerEvents:"auto",zIndex:10,transform:m?"scale(1.02)":"scale(1)",transition:"transform 0.5s cubic-bezier(0.22, 1, 0.36, 1)",willChange:"transform"},O?{backgroundColor:ue(I),color:"#fff"}:k?{background:ye(x),color:ce(I)}:{backgroundColor:de(I),color:ce(I)}),{cursor:c||h?"pointer":"default"}),"data-all-day":String(!!b.allDay),"data-selected":String(r),"data-dragging":String(n),"data-resizing":String(a),"data-popping":String(!!m),"data-segment-shape":ro(e),"data-segment-days":H,onMouseDown:t=>{if(!c&&!h)return;t.preventDefault(),t.stopPropagation(),w(!0);!t.target.closest(".df-resize-handle")&&c&&(null==i||i(t,e.event))},onMouseUp:()=>{w(!1)},onMouseLeave:()=>{w(!1)},onTouchStart:t=>{if(!i||!d||!c&&!h)return;t.stopPropagation(),w(!0);const n=t.touches[0],a=n.clientX,r=n.clientY,o=t.currentTarget;M.current={x:a,y:r},S.current=setTimeout(()=>{s&&s(e.event.id);c&&i({preventDefault:()=>{},stopPropagation:()=>{},currentTarget:o,touches:[{clientX:a,clientY:r}],cancelable:!1},e.event),S.current=null,navigator.vibrate&&navigator.vibrate(50)},500)},onTouchMove:e=>{if(S.current&&M.current){const t=Math.abs(e.touches[0].clientX-M.current.x),n=Math.abs(e.touches[0].clientY-M.current.y);(t>10||n>10)&&(clearTimeout(S.current),S.current=null,M.current=null,w(!1))}},onTouchEnd:()=>{w(!1),S.current&&(clearTimeout(S.current),S.current=null),M.current=null},title:`${b.title} (${Ut(b.start)} - ${Ut(b.end)})`,children:[d&&r&&u&&_t(o,{children:[e.isFirstSegment&&_t("div",{className:"df-event-touch-resize-indicator","data-axis":"horizontal","data-position":"left",style:{borderColor:he(I)},onTouchStart:t=>{t.stopPropagation(),null==l||l(t,e.event,"left")}}),e.isLastSegment&&_t("div",{className:"df-event-touch-resize-indicator","data-axis":"horizontal","data-position":"right",style:{borderColor:he(I)},onTouchStart:t=>{t.stopPropagation(),null==l||l(t,e.event,"right")}})]}),N("left"),_t("div",{className:"df-month-segment-event-body",style:{cursor:a?"ew-resize":"pointer"},children:f?f(R()):R()}),N("right")]})});co.displayName="MultiDayEvent";const uo=({event:e,isEditable:t,onResizeStart:n,isMultiDay:a,segment:r,isSlidingView:i,renderSlot:l})=>{const s=!1!==e.icon,d="boolean"==typeof e.icon?null:e.icon,c=(()=>{if(!i||!a||!r)return{};if(r.startDayIndex<2&&r.endDayIndex>=2){return{paddingLeft:`calc(${(2-r.startDayIndex)/(r.endDayIndex-r.startDayIndex+1)*100}% + 0.75rem)`}}return{}})(),u=_t("div",{className:"df-event-content-row",children:[s&&(d?_t("div",{className:"df-event-icon-slot",children:d}):_t("span",{className:"df-event-icon-slot",children:_t(ya,{className:Kn})})),_t("div",{className:`${qn} df-event-title-tight`,children:e.title})]});return _t("div",{className:"df-event-all-day-shell",style:c,children:[l?l(u):u,n&&t&&_t(o,{children:[_t("div",{className:Xn,onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),n(t,e,"left")},onClick:e=>{e.preventDefault(),e.stopPropagation()}}),_t("div",{className:Jn,onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),n(t,e,"right")},onClick:e=>{e.preventDefault(),e.stopPropagation()}})]})]})},ho={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"},go=({event:e,isEventSelected:t,isMobile:n})=>{const a=!1!==e.icon,r="boolean"==typeof e.icon?null:e.icon;return _t("div",{className:"df-event-month-all-day",children:[a&&(r?_t("div",{className:"df-event-icon-slot",children:r}):e.title.toLowerCase().includes("easter")||e.title.toLowerCase().includes("holiday")?_t("span",{className:"df-event-holiday-icon",children:"⭐"}):_t("span",{className:"df-event-icon-slot",children:_t(ya,{className:Kn})})),_t("span",{className:"df-event-month-title "+(n?"df-mobile-mask-fade":""),style:n?ho:void 0,children:e.title})]})},mo={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"},vo=({event:e,app:t,isEventSelected:n,hideTime:a,isMobile:r})=>{const o=`${Math.floor(K(e.start)).toString().padStart(2,"0")}:${Math.round(K(e.start)%1*60).toString().padStart(2,"0")}`,i=me(e,null==t?void 0:t.getCalendarRegistry()),l=ve(i),s=i.length>1?{background:l}:{backgroundColor:l},d=n&&i.length>1;return _t("div",{className:"df-event-month-regular","data-mobile":String(!!r),children:[_t("div",{className:"df-event-month-main",children:[!d&&_t("div",{style:s,className:Gn}),_t("span",{className:"df-event-month-title "+(r?"df-mobile-mask-fade":""),style:r?mo:void 0,children:e.title})]}),!a&&!r&&_t("span",{className:"df-event-month-time",children:o})]})},fo=({event:e,app:t,multiDaySegmentInfo:n,isEditable:a,isTouchEnabled:r,isEventSelected:i,onResizeStart:l,timeFormat:s="24h",resizeHandleOrientation:d="vertical",renderSlot:c})=>{const u=n?n.startHour:K(e.start),h=n?n.endHour:Ze(e),g=h-u,m=!n||n.isFirst,v=!n||n.isLast,f=ge(e),p=!n&&g<=.25?"compact":"default",y=me(e,null==t?void 0:t.getCalendarRegistry()),D=fe(y),w=i&&y.length>1?null:y.length>1?_t("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)"}}):_t("div",{className:"df-event-color-bar",style:{backgroundColor:D}}),b=_t(o,{children:[w,_t("div",{className:"df-event-timed-content","data-density":p,children:[_t("div",{className:`${qn} ${g<=.25?"df-event-title-tight":""}`,children:e.title}),g>.5&&_t("div",{className:"df-event-time",children:n?`${Fe(u,0,s)} - ${Fe(h,0,s)}`:ze(e,s)})]})]});return _t(o,{children:[c?c(b):b,l&&a&&"vertical"===d&&_t(o,{children:[m&&_t("div",{className:"df-event-resize-handle df-event-resize-handle-top",onMouseDown:t=>l(t,e,"top")}),v&&_t("div",{className:"df-event-resize-handle df-event-resize-handle-bottom",onMouseDown:t=>l(t,e,"bottom")}),!m&&v&&n&&_t("div",{className:Jn,onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),l(t,e,"right")},onClick:e=>{e.preventDefault(),e.stopPropagation()}})]}),r&&i&&l&&a&&"vertical"===d&&_t(o,{children:[_t("div",{className:"df-event-touch-resize-indicator","data-axis":"vertical","data-position":"top",style:{borderColor:he(f,null==t?void 0:t.getCalendarRegistry())},onTouchStart:t=>{t.stopPropagation(),l(t,e,"top")}}),_t("div",{className:"df-event-touch-resize-indicator","data-axis":"vertical","data-position":"bottom",style:{borderColor:he(f,null==t?void 0:t.getCalendarRegistry())},onTouchStart:t=>{t.stopPropagation(),l(t,e,"bottom")}})]}),l&&a&&"horizontal"===d&&_t(o,{children:[_t("div",{className:Xn,onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),l(t,e,"left")},onClick:e=>{e.preventDefault(),e.stopPropagation()}}),_t("div",{className:Jn,onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),l(t,e,"right")},onClick:e=>{e.preventDefault(),e.stopPropagation()}})]})]})},po=({event:e,segment:t,isEditable:n,onMoveStart:a,onResizeStart:r,renderSlot:i})=>{const l=!!e.allDay,s=ge(e),d=me(e),c=ve(d),u=d.length>1?{background:c}:{backgroundColor:c},{isFirstSegment:h,isLastSegment:g}=t,m=t=>{const a="left"===t,o=a?h:g;return e.allDay&&o&&r&&n?_t("div",{className:a?Xn:Jn,onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),r(t,e,a?"left":"right")},onTouchStart:t=>{t.stopPropagation(),r(t,e,a?"left":"right")},onClick:e=>{e.preventDefault(),e.stopPropagation()}}):null},v=()=>{if(l){const n=()=>t.isFirstSegment?e.title:"···";return _t("div",{className:"df-event-year-content",onMouseDown:t=>{a&&(t.stopPropagation(),a(t,e))},children:[t.isFirstSegment&&oo(e)&&_t("div",{className:"df-event-icon-slot",children:_t("div",{className:"df-event-year-icon-badge",style:{backgroundColor:he(s)},children:oo(e)})}),_t("div",{className:"df-event-year-main",children:_t("div",{className:"df-event-year-title df-event-year-title-fade",children:n()})}),t.isLastSegment&&!t.isFirstSegment&&_t("div",{className:"df-event-year-tail",children:_t("div",{className:"df-event-year-tail-dot"})})]})}const n=t.isFirstSegment?e.title:"";return _t("div",{className:"df-event-year-content df-event-year-content-timed",onMouseDown:t=>{a&&(t.stopPropagation(),a(t,e))},children:[!l&&_t("span",{style:u,className:"df-event-year-indicator"}),_t("span",{className:"df-event-year-title df-event-year-title-strong df-event-year-title-fade",children:n}),t.isLastSegment&&!t.isFirstSegment&&_t("div",{className:"df-event-year-tail",children:_t("div",{className:"df-event-year-tail-dot"})})]})};return _t(o,{children:[m("left"),i?i(v()):v(),m("right")]})};const yo=({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:g,isTouchEnabled:m,hideTime:v,isMobile:f,isSlidingView:p,app:y,onMoveStart:D,onResizeStart:w,multiDaySegmentInfo:b,customRenderingStore:E,eventContentSlotArgs:C,timeFormat:T="24h",appTimeZone:S,renderVisualContent:M,resizeHandleOrientation:N})=>{const I=t===x.MONTH,k=t===x.YEAR,O=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(I&&a&&r)return _t(co,{segment:r,segmentIndex:null!=i?i:0,isDragging:l||d,isResizing:s,isSelected:d,onMoveStart:D,onResizeStart:w,isMobile:f,isDraggable:h,isEditable:u,viewable:g,isPopping:c,appTimeZone:S,renderSlot:e=>_t(_a,{store:E,generatorName:O,generatorArgs:C,defaultContent:R(e)})});if(k&&o)return _t(po,{event:e,segment:o,isEditable:u,onMoveStart:D,onResizeStart:w,renderSlot:e=>_t(_a,{store:E,generatorName:O,generatorArgs:C,defaultContent:R(e)})});if(I){const t=n?_t(go,{event:e,isEventSelected:d,isMobile:f}):_t(vo,{event:e,app:y,isEventSelected:d,hideTime:v,isMobile:f});return _t(_a,{store:E,generatorName:O,generatorArgs:C,defaultContent:R(t)})}const H=e=>_t(_a,{store:E,generatorName:O,generatorArgs:C,defaultContent:R(e)});return n?_t(uo,{event:e,isEditable:u,onResizeStart:w,isMultiDay:a,segment:r,isSlidingView:p,renderSlot:H}):_t(fo,{event:e,app:y,multiDaySegmentInfo:b,isEditable:u,isTouchEnabled:m,isEventSelected:d,onResizeStart:w,timeFormat:T,resizeHandleOrientation:N,renderSlot:H})},Do=({event:t,position:a,panelRef:r,isAllDay:o,eventVisibility:i,calendarRef:l,selectedEventElementRef:s,onEventUpdate:d,onEventDelete:u,onClose:h,app:y})=>{var D,w;const{effectiveTheme:b}=Fa(),E=Kt(b),{t:C}=Pn(),[T,S]=g(t),[M,N]=g(!1),I=v(t),k=v(t),x=v(!1),O=f(()=>{if(x.current)return;const e=I.current,t=k.current;if(Ct(e,t))return;const n=Ke(e,t,null==y?void 0:y.timeZone);I.current=n,k.current=n;const a=d(n);a&&Promise.resolve(a).catch(e=>{De.error("Failed to commit deferred event detail panel update",e)})},[null==y?void 0:y.timeZone,d]),R=f(e=>{if(!Ct(k.current,e)&&(k.current=e,S(e),y)){const t=y.updateEvent(e.id,e,!0);t&&Promise.resolve(t).catch(e=>{De.error("Failed to apply pending event detail panel update",e)})}},[y]);m(()=>{if(!(I.current.id===t.id))return O(),x.current=!1,I.current=t,k.current=t,void S(t);Ct(I.current,k.current)&&(I.current=t,k.current=t,S(t))},[t,O]),m(()=>()=>{O()},[O]);const H=p(()=>{var e;return null!==(e=null==y?void 0:y.timeZone)&&void 0!==e?e:n.Now.timeZoneId()},[y]),A=p(()=>(y?y.getCalendarRegistry():le()).getVisible().map(e=>({label:e.name,value:e.id})),[y,null==y?void 0:y.getCalendars()]),L="dark"===E||"undefined"!=typeof document&&document.documentElement.classList.contains("dark"),$=null!==(D=null==y?void 0:y.canMutateFromUI(t.id))&&void 0!==D&&D,j=null==y?void 0:y.getReadOnlyConfig(t.id),Y=!1!==(null==j?void 0:j.viewable),F=!!T.allDay,Z=!p(()=>{if(!t.calendarId)return!1;const e=null==y?void 0:y.getCalendarRegistry().get(t.calendarId);return!!(null==e?void 0:e.subscription)},[y,t.calendarId])||""!==(T.description||"").trim();if(!Y)return null;const z=L?"#1f2937":"white",_=L?"rgb(55, 65, 81)":"rgb(229, 231, 235)",U=(()=>{let e={};if("sticky-top"===i){const t=no(l);if(t){const n=t.getBoundingClientRect().top+3-a.top;e=Object.assign({position:"absolute",width:"12px",height:"12px",backgroundColor:z,transform:"rotate(45deg)",transformOrigin:"center",top:n-6+"px",borderRight:""+(a.isSunday?`1px solid ${_}`:"none"),borderTop:""+(a.isSunday?`1px solid ${_}`:"none"),borderLeft:""+(a.isSunday?"none":`1px solid ${_}`),borderBottom:""+(a.isSunday?"none":`1px solid ${_}`)},a.isSunday?{right:"-6px"}:{left:"-6px"})}}else if("sticky-bottom"===i){const t=r.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:z,transform:"rotate(45deg)",transformOrigin:"center",top:`${n}px`,left:a.isSunday?void 0:"-6px",right:a.isSunday?"-6px":void 0,borderRight:""+(a.isSunday?`1px solid ${_}`:"none"),borderTop:""+(a.isSunday?`1px solid ${_}`:"none"),borderLeft:""+(a.isSunday?"none":`1px solid ${_}`),borderBottom:""+(a.isSunday?"none":`1px solid ${_}`)}}else if(a&&s.current&&l.current){const t=s.current.getBoundingClientRect(),n=no(l);if(n){const o=n.getBoundingClientRect(),i=Math.max(t.top,o.top),l=Math.min(t.bottom,o.bottom),s=Math.max(0,l-i);let d;d=s===t.height?t.top+t.height/2:s>0?i+s/2:t.top+t.height/2;const c=d-a.top,u=r.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 g=12,m=Math.max(g,Math.min(h,c));e=Object.assign({position:"absolute",width:"12px",height:"12px",backgroundColor:z,transform:"rotate(45deg)",transformOrigin:"center",top:m-6+"px",borderRight:""+(a.isSunday?`1px solid ${_}`:"none"),borderTop:""+(a.isSunday?`1px solid ${_}`:"none"),borderLeft:""+(a.isSunday?"none":`1px solid ${_}`),borderBottom:""+(a.isSunday?"none":`1px solid ${_}`)},a.isSunday?{right:"-6px"}:{left:"-6px"})}}return e})(),W=_t("div",{ref:r,className:`${ea} df-event-panel-content`,"data-event-detail-panel":"true","data-event-id":t.id,style:{top:`${a.top}px`,left:`${a.left}px`,zIndex:9999,pointerEvents:"auto"},children:[_t("div",{style:U}),_t("span",{className:"df-form-label",children:C("eventTitle")}),_t("div",{className:"df-form-row",style:{marginBottom:"0.75rem"},children:[_t("div",{className:"df-form-field",children:_t("input",{id:`event-title-${T.id}`,name:"title",type:"text",value:T.title,readOnly:!$||M,disabled:!$||M,onChange:e=>R(Object.assign(Object.assign({},T),{title:e.target.value})),onInput:e=>R(Object.assign(Object.assign({},T),{title:e.target.value})),className:"df-form-input"})}),$&&_t(wr,{options:A,value:T.calendarId||"blue",disabled:M,onChange:e=>{R(Object.assign(Object.assign({},T),{calendarId:e}))},registry:null==y?void 0:y.getCalendarRegistry()})]}),_t("div",F?{className:"df-event-dialog-time-row",style:{marginBottom:"0.75rem"},children:[_t("div",{className:"df-form-label",children:C("dateRange")}),_t(Dr,{value:[T.start,T.end],format:"YYYY-MM-DD",showTime:!1,timeZone:H,matchTriggerWidth:!0,disabled:!$||M,onChange:e=>{if(M)return;const[t,n]=e;R(Object.assign(Object.assign({},T),{start:t.toPlainDate(),end:n.toPlainDate()}))},locale:null==y?void 0:y.state.locale})]}:{className:"df-event-dialog-time-row",style:{marginBottom:"0.75rem"},children:[_t("div",{className:"df-form-label",children:C("timeRange")}),_t(Dr,{value:[T.start,T.end],timeZone:H,disabled:!$||M,onChange:e=>{if(M)return;const[t,n]=e;R(Object.assign(Object.assign({},T),{start:t,end:n}))},locale:null==y?void 0:y.state.locale})]}),Z&&_t("div",{className:"df-event-dialog-notes-row",style:{marginBottom:"0.75rem"},children:[_t("span",{className:"df-form-label",children:C("note")}),_t("textarea",{id:`event-note-${T.id}`,name:"note",value:null!==(w=T.description)&&void 0!==w?w:"",readOnly:!$||M,disabled:!$||M,onChange:e=>R(Object.assign(Object.assign({},T),{description:e.target.value})),onInput:e=>R(Object.assign(Object.assign({},T),{description:e.target.value})),rows:3,className:"df-form-textarea",placeholder:C("addNotePlaceholder")})]}),$&&_t("div",{className:"df-form-actions",children:[_t(Ba,F?{type:"button",className:"df-fill-primary df-hover-primary-solid df-btn-sm",onClick:()=>{var e;if(M)return;const t=P(T.start)?T.start:T.start.toPlainDate(),a=null!==(e=null==y?void 0:y.timeZone)&&void 0!==e?e:n.Now.timeZoneId(),r=n.ZonedDateTime.from({year:t.year,month:t.month,day:t.day,hour:9,minute:0,timeZone:a}),o=n.ZonedDateTime.from({year:t.year,month:t.month,day:t.day,hour:10,minute:0,timeZone:a});R(Object.assign(Object.assign({},T),{allDay:!1,start:r,end:o}))},loading:M,children:C("setAsTimed")}:{type:"button",className:"df-fill-primary df-hover-primary-solid df-btn-sm",onClick:()=>{if(M)return;const e=P(T.start)?T.start:T.start.toPlainDate(),t=P(T.end)?T.end:T.end.toPlainDate();R(Object.assign(Object.assign({},T),{allDay:!0,start:e,end:t}))},loading:M,children:C("setAsAllDay")}),_t(Ba,{type:"button",className:"df-fill-destructive df-hover-destructive df-btn-sm",onClick:()=>e(void 0,void 0,void 0,function*(){if(!M){x.current=!0,N(!0);try{yield u(T.id)}finally{N(!1)}}}),loading:M,children:C("delete")})]})]});if("undefined"==typeof window||"undefined"==typeof document)return null;const B=document.body;return B?c(W,B):null},wo=({event:e,position:t,panelRef:n,isAllDay:a,eventVisibility:r,calendarRef:o,selectedEventElementRef:i,onEventUpdate:l,onEventDelete:s,onClose:d,contentRenderer:u})=>{const{effectiveTheme:h}=Fa(),g=Kt(h),m="dark"===g?"#1f2937":"white",v="dark"===g?"rgb(55, 65, 81)":"rgb(229, 231, 235)",f=(()=>{let e={};if("sticky-top"===r){const n=no(o);if(n){const a=n.getBoundingClientRect().top+3-t.top;e=Object.assign({position:"absolute",width:"12px",height:"12px",backgroundColor:m,transform:"rotate(45deg)",transformOrigin:"center",top:a-6+"px",borderRight:""+(t.isSunday?`1px solid ${v}`:"none"),borderTop:""+(t.isSunday?`1px solid ${v}`:"none"),borderLeft:""+(t.isSunday?"none":`1px solid ${v}`),borderBottom:""+(t.isSunday?"none":`1px solid ${v}`)},t.isSunday?{right:"-6px"}:{left:"-6px"})}}else if("sticky-bottom"===r){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:m,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 ${v}`:"none"),borderTop:""+(t.isSunday?`1px solid ${v}`:"none"),borderLeft:""+(t.isSunday?"none":`1px solid ${v}`),borderBottom:""+(t.isSunday?"none":`1px solid ${v}`)}}else if(t&&i.current&&o.current){const a=i.current.getBoundingClientRect(),r=no(o);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 g=12,f=Math.max(g,Math.min(h,c));e=Object.assign({position:"absolute",width:"12px",height:"12px",backgroundColor:m,transform:"rotate(45deg)",transformOrigin:"center",top:f-6+"px",borderRight:""+(t.isSunday?`1px solid ${v}`:"none"),borderTop:""+(t.isSunday?`1px solid ${v}`:"none"),borderLeft:""+(t.isSunday?"none":`1px solid ${v}`),borderBottom:""+(t.isSunday?"none":`1px solid ${v}`)},t.isSunday?{right:"-6px"}:{left:"-6px"})}}return e})(),p=_t("div",{ref:n,className:`${ea} 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"===g?"#1f2937":"#ffffff"},children:[_t("div",{style:f}),_t(u,{event:e,isAllDay:a,onEventUpdate:l,onEventDelete:s,onClose:d})]});return c(p,document.body)},bo=({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:g,customDetailPanelContent:m,app:v})=>{if(!e)return null;if(t)return null;if(!n)return null;const f={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"))?_t(wo,Object.assign({},f,{contentRenderer:g})):m?_t(wo,Object.assign({},f,{contentRenderer:m})):_t(Do,Object.assign({},f,{app:v}))},Eo="transform 0.5s cubic-bezier(0.22, 1, 0.36, 1)",Co=({event:e,layout:t,isAllDay:n=!1,allDayHeight:a=28,calendarRef:r,isBeingDragged:i=!1,isBeingResized:l=!1,viewType:s,isMultiDay:d=!1,segment:c,yearSegment:u,columnsPerRow:h,segmentIndex:y=0,hourHeight:w,firstHour:b,selectedEventId:E,detailPanelEventId:C,onMoveStart:T,onResizeStart:S,onEventUpdate:M,onEventDelete:N,newlyCreatedEventId:I,onDetailPanelOpen:k,onEventSelect:O,onEventLongPress:R,onDetailPanelToggle:H,customDetailPanelContent:A,customEventDetailDialog:P,multiDaySegmentInfo:L,app:$,isMobile:j=!1,isSlidingView:Y=!1,enableTouch:F,hideTime:Z,timeFormat:z="24h",styleOverride:_,className:U,disableDefaultStyle:W=!1,renderVisualContent:B,resizeHandleOrientation:V,appTimeZone:q})=>{var G;const X=D(Za),J=null!=F?F:j,Q=s===x.YEAR,ee=p(()=>{if(!q||e.allDay)return e;const t=Ie(e.start,q),n=e.end?Ie(e.end,q):void 0;return Object.assign(Object.assign({},e),{start:t,end:n})},[e,q]),[te,ne]=g(null),[ae,re]=g(!1),oe=v(null),ie=v(null),le=v(null),se=v(null),he=d&&c?`${e.id}::${c.id}`:void 0===(null==L?void 0:L.dayIndex)?Q&&u?u.id:e.id:`${e.id}::day-${L.dayIndex}`,me=C===he,ve=me&&!P,fe=null==$?void 0:$.getReadOnlyConfig(e.id),we=null!==(G=null==$?void 0:$.canMutateFromUI(e.id))&&void 0!==G&&G,be=!1!==(null==fe?void 0:fe.viewable),Ee=!1!==(null==fe?void 0:fe.draggable),{isSelected:Ce,setIsSelected:Te,isPressed:Se,setIsPressed:Me,handleTouchStart:Ne,handleTouchMove:ke,handleTouchEnd:xe,shouldSuppressClick:Oe}=(({event:e,isTouchEnabled:t,onMoveStart:n,onEventLongPress:a,onEventSelect:r,onDetailPanelToggle:o,canOpenDetail:i,app:l,multiDaySegmentInfo:s,isMultiDay:d,segment:c})=>{const[u,h]=g(!1),[m,f]=g(!1),p=v(null),y=v(null),D=v(0);return{isSelected:u,setIsSelected:h,isPressed:m,setIsPressed:f,handleTouchStart:r=>{if(!n||!t)return;r.stopPropagation(),f(!0);const o=r.touches[0],i=o.clientX,l=o.clientY,u=r.currentTarget;y.current={x:i,y:l},p.current=setTimeout(()=>{var t;a?a(e.id):h(!0);const r={preventDefault:()=>{},stopPropagation:()=>{},currentTarget:u,touches:[{clientX:i,clientY:l}],cancelable:!1};if(s){const a=Object.assign(Object.assign({},e),{day:null!==(t=s.dayIndex)&&void 0!==t?t:e.day,_segmentInfo:s});n(r,a)}else if(d&&c){const t=Object.assign(Object.assign({},e),{day:c.startDayIndex,_segmentInfo:{dayIndex:c.startDayIndex,isFirst:c.isFirstSegment,isLast:c.isLastSegment}});n(r,t)}else n(r,e);p.current=null,y.current=null,navigator.vibrate&&navigator.vibrate(50),D.current=Date.now()+400},500)},handleTouchMove:e=>{if(t&&e.stopPropagation(),p.current&&y.current){const t=Math.abs(e.touches[0].clientX-y.current.x),n=Math.abs(e.touches[0].clientY-y.current.y);(t>10||n>10)&&(clearTimeout(p.current),p.current=null,y.current=null,f(!1))}},handleTouchEnd:n=>{f(!1),p.current&&(clearTimeout(p.current),p.current=null),t&&y.current&&(n.preventDefault(),n.stopPropagation(),D.current=Date.now()+400,l&&l.onEventClick(e),i?(r?r(e.id):h(!0),null==o||o(null)):(null==r||r(null),null==o||o(null))),y.current=null},shouldSuppressClick:()=>Date.now()<D.current}})({event:e,isTouchEnabled:J,onMoveStart:Ee?T:void 0,onEventLongPress:R,onEventSelect:O,onDetailPanelToggle:H,canOpenDetail:be,app:$,multiDaySegmentInfo:L,isMultiDay:d,segment:c}),[Re,He]=g("standard"),Ae=e=>{se.current=e},Pe=f(()=>((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,C||void 0,he,se.current,L,c),[e,C,he,L,c]),Le=f(e=>((e,t,n,a)=>{if(!t.current)return null;const r=t.current.getBoundingClientRect();if(n===x.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=to(t,a),i=n===x.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,r,s,j),[r,s,j]),$e=f(e=>((e,t,n,a)=>{if(!t.current)return null;const r=t.current.getBoundingClientRect();if(n===x.MONTH){const t=r.width/7;return{left:r.left+e*t,width:t}}const o=to(t,a);if(n===x.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,r,s,j),[r,s,j]),{detailPanelPosition:je,setDetailPanelPosition:Ye,updatePanelPosition:Fe}=(({event:e,viewType:t,isMultiDay:n,segment:a,yearSegment:r,multiDaySegmentInfo:o,calendarRef:i,eventRef:l,detailPanelRef:s,selectedEventElementRef:d,isMobile:c,eventVisibility:u,firstHour:h,hourHeight:v,columnsPerRow:p,showDetailPanel:y,detailPanelEventId:D,detailPanelKey:w,getActiveDayIdx:b,getDayMetricsWrapper:E})=>{const[C,T]=g(null),S=t===x.DAY,M=t===x.MONTH,N=t===x.YEAR,I=t===x.RESOURCE,k=f(()=>{if(!d.current&&!l.current||!i.current||!s.current)return;const e=i.current.getBoundingClientRect(),t=b(),r=E(t);let o,h;if(r)o=r.left,h=r.width;else if(M)h=e.width/7,o=e.left+t*h;else{const n=to(i,c);h=(e.width-n)/7,o=e.left+n+t*h}const g=Math.min(window.innerWidth,e.right),m=Math.min(window.innerHeight,e.bottom);requestAnimationFrame(()=>{var r,i,c;if(!s.current)return;const h=d.current||l.current;if(!h)return;const v=s.current.getBoundingClientRect(),f=v.width,p=v.height;let y,D,w;if("sticky-top"===u||"sticky-bottom"===u||"sticky-left"===u||"sticky-right"===u){const e=null===(r=l.current)||void 0===r?void 0:r.getBoundingClientRect();if(!e)return;w=e}else w=h.getBoundingClientRect();if(M&&n&&a){const n=E(t),a=null!==(i=null==n?void 0:n.width)&&void 0!==i?i:e.width/7,r=null!==(c=null==n?void 0:n.left)&&void 0!==c?c:e.left+t*a,o=r+a;w={top:w.top,bottom:w.bottom,left:r,right:o,width:o-r,height:w.height,x:r,y:w.top,toJSON:()=>({})}}const b=g-w.right,C=w.left-e.left;y=b>=f+20?w.right+10:C>=f+20?w.left-f-10:b>C?Math.max(e.left+10,g-f-10):e.left+10;const S=w.top-p/2+w.height/2,k=Math.max(10,e.top+10),x=m-10;D=S<k?k:S+p>x?x-p:S,T(e=>{if(!e)return null;let t=y<o;return(N||I)&&(t=y<w.left),Object.assign(Object.assign({},e),{top:D,left:y,isSunday:t})})})},[i,e.day,e.start,e.end,u,M,h,v,n,a,o,D,w,c,S,N,r,p,b,E,d,s,l]);return m(()=>{!y||C||c||(T({top:-9999,left:-9999,eventHeight:0,eventMiddleY:0,isSunday:!1}),requestAnimationFrame(()=>k()))},[y,C,k,c]),{detailPanelPosition:C,setDetailPanelPosition:T,updatePanelPosition:k}})({event:e,viewType:s,isMultiDay:d,segment:c,yearSegment:u,multiDaySegmentInfo:L,calendarRef:r,eventRef:oe,detailPanelRef:ie,selectedEventElementRef:le,isMobile:j,eventVisibility:Re,firstHour:b,hourHeight:w,columnsPerRow:h,showDetailPanel:me,detailPanelEventId:C,detailPanelKey:he,getActiveDayIdx:Pe,getDayMetricsWrapper:$e}),{handleClick:ze,handleDoubleClick:_e,handleContextMenu:Ue,hasPendingSelection:We}=(({event:e,timingEvent:t,viewType:n,isAllDay:a,isMultiDay:r,segment:o,multiDaySegmentInfo:i,calendarRef:l,firstHour:s,hourHeight:d,isMobile:c,canOpenDetail:u,detailPanelKey:h,app:p,onEventSelect:y,onDetailPanelToggle:D,setIsSelected:w,setDetailPanelPosition:b,setContextMenuPosition:E,setActiveDayIndex:C,getClickedDayIdx:T,updatePanelPosition:S,selectedEventElementRef:M})=>{const N=n===x.MONTH,I=n===x.YEAR,k=n===x.RESOURCE,O=null!=t?t:e,R=v(null),[H,A]=g(!1),P=f(()=>{R.current&&(clearTimeout(R.current),R.current=null,A(!1))},[]);m(()=>()=>P(),[P]);const L=f((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)}),[]),$=f(()=>new Promise(e=>{if(!l.current||a||N||I||d<=0)return void e();const t=no(l);if(!t)return void e();if(k&&M.current){const n=M.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 L(t,r,o).then(e)):void e()}const n=i?i.startHour:K(O.start),r=i?i.endHour:Ze(O),o=(n-s)*d,c=o+Math.max((r-n)*d,d/4),u=t.scrollTop,h=t.clientHeight;if(o>=u&&c<=u+h)return void e();const g=((n+r)/2-s)*d-h/2,m=t.scrollHeight-h,v=Math.max(0,Math.min(m,g));Math.abs(v-u)<=1?e():(t.scrollTo({top:v,behavior:"smooth"}),L(t,t.scrollLeft,u).then(e))}),[l,a,N,I,k,i,O.start,O.end,s,d,M,L]),j=f(t=>{P(),t.preventDefault(),t.stopPropagation(),p&&!p.canMutateFromUI(e.id)||(y&&y(e.id),E({x:t.clientX,y:t.clientY}))},[p,P,e.id,y,E]),Y=f(t=>{var n,a,l;if(r){const r=T(t);C(null===r?null!==(a=null!==(n=null==i?void 0:i.dayIndex)&&void 0!==n?n:e.day)&&void 0!==a?a:null:o?Math.min(Math.max(r,o.startDayIndex),o.endDayIndex):r)}else C(null!==(l=e.day)&&void 0!==l?l:null);y?y(e.id):u&&w(!0),null==D||D(null),b(null)},[r,T,C,null==i?void 0:i.dayIndex,e,o,y,u,w,D,b]),F=f(()=>{null==p||p.onEventClick(e)},[p,e]),Z=f(e=>{Y(e),F()},[Y,F]),z=f(t=>{var n,a,i,l,s,d;if(P(),t.preventDefault(),t.stopPropagation(),!u)return;let g=t.currentTarget;if(r){const e=g.querySelector("div");e&&(g=e)}if(M.current=g,r){const r=T(t.clientX);C(null===r?null!==(a=null!==(n=null==o?void 0:o.startDayIndex)&&void 0!==n?n:e.day)&&void 0!==a?a:0:Math.min(Math.max(r,null!==(i=null==o?void 0:o.startDayIndex)&&void 0!==i?i:0),null!==(l=null==o?void 0:o.endDayIndex)&&void 0!==l?l:6))}else C(null!==(s=e.day)&&void 0!==s?s:null);w(!0),null==y||y(e.id);const m=()=>{$().then(()=>{c||(null==D||D(h),b({top:-9999,left:-9999,eventHeight:0,eventMiddleY:0,isSunday:!1}),requestAnimationFrame(()=>S()))})};p?Promise.resolve(null===(d=p.onEventDoubleClick)||void 0===d?void 0:d.call(p,e,t)).then(e=>{!1!==e&&m()}).catch(e=>{De.error("Failed to handle event double click callback",e),m()}):m()},[P,u,r,M,T,C,null==o?void 0:o.startDayIndex,null==o?void 0:o.endDayIndex,e.day,p,e,$,w,I,c,y,D,h,b,S]);return{handleClick:f(e=>{e.preventDefault(),e.stopPropagation();const t=e.clientX;if(!c&&u)return P(),I||k||Y(t),A(!0),void(R.current=setTimeout(()=>{(I||k)&&Y(t),F(),R.current=null,A(!1)},180));Z(t)},[P,u,Y,F,I,k,c,Z]),handleDoubleClick:z,handleContextMenu:j,hasPendingSelection:H,scrollEventToCenter:$}})({event:e,timingEvent:ee,viewType:s,isAllDay:n,isMultiDay:d,segment:c,multiDaySegmentInfo:L,calendarRef:r,firstHour:b,hourHeight:w,isMobile:j,canOpenDetail:be,detailPanelKey:he,app:$,onEventSelect:O,onDetailPanelToggle:H,setIsSelected:Te,setDetailPanelPosition:Ye,setContextMenuPosition:ne,setActiveDayIndex:Ae,getClickedDayIdx:Le,updatePanelPosition:Fe,selectedEventElementRef:le}),Be=(void 0===E?Ce:E===e.id)||We||!J&&Se||i,Ve=J&&Be&&we,{calculateEventStyle:qe}=(({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:g,isEventSelected:m,showDetailPanel:v,isPopping:f,isDraggable:p,canOpenDetail:y,eventVisibility:D,calendarRef:w,isMobile:b,eventRef:E,getActiveDayIdx:C,getDayMetricsWrapper:T,multiDaySegmentInfo:S})=>{const M=i===x.DAY,N=i===x.MONTH,I=i===x.YEAR,k=null!=t?t:e;return{calculateEventStyle:()=>{var e,t,i,x,O,R,H,A,P,L,$;if(I&&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:m||v?1e3:1,transform:f?"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)",Eo].join(", "):Eo,willChange:a?"left, top, width, transform":"transform",cursor:p||y?"pointer":"default"}}if(N)return l&&s?{opacity:1,zIndex:m||v?1e3:1,cursor:p||y?"pointer":"default"}:{opacity:1,zIndex:m||v?1e3:1,transform:f?"scale(1.05)":"scale(1)",transition:Eo,cursor:p||y?"pointer":"default"};if(r){const e={height:o-4+"px",opacity:1,zIndex:m||v?1e3:1,transform:f?"scale(1.05)":"scale(1)",transition:Eo,cursor:p||y?"pointer":"default"},t=u*o;if(Object.assign(e,{top:`${t}px`}),M)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 j=S?S.startHour:K(k.start),Y=S?S.endHour:Ze(k),F=(j-g)*h,Z=Math.max((Y-j)*h,h/4),z={top:`${F+3}px`,height:Z-4+"px",position:"absolute",opacity:1,zIndex:m||v?1e3:null!==(e=null==n?void 0:n.zIndex)&&void 0!==e?e:1,transform:f?"scale(1.05)":"scale(1)",transition:Eo,cursor:p||y?"pointer":"default"};if(m&&v&&("sticky-left"===D||"sticky-right"===D)){const e=no(w),n=null==e?void 0:e.getBoundingClientRect();if(n){const e=to(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!==(x=null==o?void 0:o.top)&&void 0!==x?x:n.top)+(j-g)*h+3,s=Math.max(l,n.top),d=Math.min(l+Z-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(m&&v&&("sticky-top"===D||"sticky-bottom"===D)){const e=null===(O=w.current)||void 0===O?void 0:O.getBoundingClientRect();if(e){const t=C(),a=to(w,b),r=M?1:c||7;let o=(e.width-a)/r,i=e.left+a+(M?0:t*o);N&&(o=e.width/7,i=e.left+t*o);const l=T(t);l&&(i=l.left,o=l.width);let s=no(w);s||(s=null!==(H=null===(R=w.current)||void 0===R?void 0:R.querySelector(".df-calendar-renderer"))&&void 0!==H?H:null);const d=null==s?void 0:s.getBoundingClientRect(),u=null===(P=null===(A=E.current)||void 0===A?void 0:A.parentElement)||void 0===P?void 0:P.getBoundingClientRect();let h,g;if(u&&u.width>0)n?(h=u.left+n.left/100*u.width,g=M?n.width/100*u.width:(n.width-1)/100*u.width):(h=u.left,g=M?u.width:u.width-3);else{const e=T(t),a=null!==(L=null==e?void 0:e.left)&&void 0!==L?L:i,r=null!==($=null==e?void 0:e.width)&&void 0!==$?$:o;h=a,g=r-3,n&&(h=a+n.left/100*r,g=M?n.width/100*r:(n.width-1)/100*r)}const m=e.left+a;if(h<m&&(g=Math.max(0,g-(m-h)),h=m),h+g>e.right&&(g=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:`${g}px`,height:"6px",zIndex:1e3,overflow:"hidden",borderRadius:"0.25rem"}}let v=d?d.bottom:e.bottom;return v=Math.min(v,window.innerHeight),v=Math.min(v,e.bottom),v=Math.max(v,e.top+6),v=Math.max(v,6),{position:"fixed",top:v-6+"px",left:`${h}px`,width:`${g}px`,height:"6px",zIndex:1e3,overflow:"hidden",borderRadius:"0.25rem"}}}if(n&&!r){const e=M?`${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:M?"0px":"3px"})}}})({event:e,timingEvent:ee,layout:t,isBeingDragged:i,isAllDay:n,allDayHeight:a,viewType:s,isMultiDay:d,segment:c,yearSegment:u,columnsPerRow:h,segmentIndex:y,hourHeight:w,firstHour:b,isEventSelected:Be,showDetailPanel:me,isPopping:ae,isDraggable:Ee,canOpenDetail:be,eventVisibility:Re,calendarRef:r,isMobile:j,eventRef:oe,getActiveDayIdx:Pe,getDayMetricsWrapper:$e,multiDaySegmentInfo:L});(({event:e,timingEvent:t,isEventSelected:n,showDetailPanel:a,eventRef:r,calendarRef:o,isAllDay:i,viewType:l,isMobile:s=!1,multiDaySegmentInfo:d,firstHour:c,hourHeight:u,updatePanelPosition:h,eventVisibility:g,setEventVisibility:v})=>{const p=l===x.MONTH,y=l===x.YEAR,D=l===x.RESOURCE,w=null!=t?t:e,b=f(()=>{var e,t;if(!n||!a||!r.current||!o.current||i||p||y)return;const l=no(o);if(!l)return;const m=d?d.startHour:K(w.start),f=d?d.endHour:Ze(w),b=(m-c)*u,E=b+Math.max((f-m)*u,u/4),C=l.getBoundingClientRect(),T=l.scrollTop,S=T+C.height,M=C.bottom<0,N=C.top>window.innerHeight;let I=g;if(M)I="sticky-top";else if(N)I="sticky-bottom";else{const n="sticky-left"===g||"sticky-right"===g?"standard":g;let a;if(a="standard"===n?E<T?"sticky-top":b>S-20?"sticky-bottom":"standard":"sticky-top"===n?E>=T?"standard":"sticky-top":b<=S-20?"standard":"sticky-bottom","standard"!==a)I=a;else if(D){const n=null===(t=null===(e=r.current)||void 0===e?void 0:e.parentElement)||void 0===t?void 0:t.getBoundingClientRect();if(n){const e=to(o,s),t=C.left+e,a=C.right;I=n.right<=t?"sticky-left":n.left>=a?"sticky-right":"standard"}else I="standard"}else I="standard"}I===g?h():(v(I),setTimeout(h,0))},[n,a,o,i,p,D,s,w.start,w.end,c,u,h,d,g,v]);m(()=>{var e;if(!n||!a||i)return;const t=no(o);if(!t)return;const r=()=>b(),l=()=>{b(),h()},s=[t];let d=null===(e=o.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",l);let c=null;return o.current&&(c=new ResizeObserver(()=>{l()}),c.observe(o.current)),b(),()=>{s.forEach(e=>{e.removeEventListener("scroll",r)}),window.removeEventListener("scroll",r,!0),window.removeEventListener("resize",l),c&&c.disconnect()}},[n,a,i,b,h,o])})({event:e,timingEvent:ee,isEventSelected:Be,showDetailPanel:me,eventRef:oe,calendarRef:r,isAllDay:n,viewType:s,isMobile:j,multiDaySegmentInfo:L,firstHour:b,hourHeight:w,updatePanelPosition:Fe,eventVisibility:Re,setEventVisibility:He});const Ge=me&&!!P;(({eventRef:e,detailPanelRef:t,eventId:n,isEventSelected:a,showDetailPanel:r,onEventSelect:o,onDetailPanelToggle:i,setIsSelected:l,setActiveDayIndex:s})=>{m(()=>{if(!a&&!r)return;const d=d=>{var c,u;const h=d.target,g=null===(c=e.current)||void 0===c?void 0:c.contains(h),m=null!==h.closest(`[data-event-id="${n}"]`),v=null===(u=t.current)||void 0===u?void 0:u.contains(h),f=h.closest("[data-event-detail-dialog]"),p=h.closest("[data-range-picker-popup]"),y=h.closest("[data-calendar-picker-dropdown]");r?g||m||v||f||p||y||(null==o||o(null),s(null),l(!1),null==i||i(null)):!a||g||m||f||p||y||(null==o||o(null),s(null),l(!1),null==i||i(null))};return document.addEventListener("mousedown",d),()=>{document.removeEventListener("mousedown",d)}},[a,r,o,i,n])})({eventRef:oe,detailPanelRef:ie,eventId:e.id,isEventSelected:!Ge&&Be,showDetailPanel:ve,onEventSelect:O,onDetailPanelToggle:H,setIsSelected:Te,setActiveDayIndex:Ae});const Ke=f(()=>{O&&O(null),se.current=null,Te(!1),null==H||H(null)},[O,H,Te]),Xe=p(()=>({event:e,viewType:s,isAllDay:n,isMobile:j,isSelected:Be,isDragging:i,segment:c,layout:t}),[e,s,n,j,Be,i,c,t]),Je=f(e=>_t(_a,{store:X,generatorName:"eventDetailContent",generatorArgs:e}),[X]);m(()=>{if((null==$?void 0:$.state.highlightedEventId)===e.id){re(!0);const e=setTimeout(()=>{re(!1)},650);return()=>{clearTimeout(e),re(!1)}}},[null==$?void 0:$.state.highlightedEventId,e.id]),m(()=>{we||ne(null)},[we]),m(()=>{const t=d&&(null==c?void 0:c.isFirstSegment)||Q&&(null==u?void 0:u.isFirstSegment)||!d&&!Q;I===e.id&&!me&&t&&setTimeout(()=>{null==H||H(he),null==k||k()},50)},[I,e.id,me,d,c,Q,u,H,k,he]);const Qe=ge(e),et=null==$?void 0:$.getCalendarRegistry(),tt=e.calendarIds&&e.calendarIds.length>1?pe(e,et):null,nt=((e,t,n,a)=>e===x.YEAR?(e=>e?e.isFirstSegment&&e.isLastSegment?"full":e.isFirstSegment?"start":e.isLastSegment?"end":"middle":"full")(a):t?ro(n):"full")(s,n,c,u);return _t(o,{children:[_t("div",{ref:oe,"data-event-id":e.id,"data-view":s,"data-all-day":String(n),"data-selected":String(Be),"data-dragging":String(i),"data-resizing":String(l),"data-popping":String(ae),"data-multi-day":String(d),"data-editable":String(we),"data-draggable":String(Ee),"data-viewable":String(be),"data-segment-shape":nt,"data-month-stack":String(s===x.MONTH&&!d),"data-touch-handles":String(Ve),className:`${ao(s,n,d)} ${n&&I===e.id?"df-all-day-event-animate":""} ${null!=U?U:""}`,style:Object.assign(Object.assign(Object.assign({},W?{}:qe()),Be?{background:ue(Qe,et),color:"#fff"}:e.calendarIds&&e.calendarIds.length>1?{background:ye(tt),color:ce(Qe,et)}:{backgroundColor:de(Qe,et),color:ce(Qe,et)}),_),onClick:e=>{if(J&&Oe())return e.preventDefault(),void e.stopPropagation();ze(e)},onContextMenu:Ue,onDblClick:_e,onMouseDown:t=>{var n;if(J||Me(!0),T&&Ee){const a=t;T(a,L?Object.assign(Object.assign({},e),{day:null!==(n=L.dayIndex)&&void 0!==n?n:e.day,_segmentInfo:L}):d&&c?Object.assign(Object.assign({},e),{day:c.startDayIndex,_segmentInfo:{dayIndex:c.startDayIndex,isFirst:c.isFirstSegment,isLast:c.isLastSegment}}):e)}},onMouseUp:()=>!J&&Me(!1),onMouseLeave:()=>!J&&Me(!1),onTouchStart:Ne,onTouchMove:ke,onTouchEnd:xe,children:_t(yo,{event:ee,viewType:s,isAllDay:n,isMultiDay:d,segment:c,yearSegment:u,segmentIndex:y,isBeingDragged:i,isBeingResized:l,isEventSelected:Be,isPopping:ae,isEditable:we,isDraggable:Ee,canOpenDetail:be,isTouchEnabled:J,hideTime:Z,isMobile:j,isSlidingView:Y,app:$,onMoveStart:T,onResizeStart:S,multiDaySegmentInfo:L,customRenderingStore:X,eventContentSlotArgs:Xe,timeFormat:z,appTimeZone:q,renderVisualContent:B,resizeHandleOrientation:V})}),me&&!P&&_t("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:9998,pointerEvents:"none"}}),_t(bo,{showDetailPanel:me,customEventDetailDialog:P,detailPanelPosition:je,event:e,detailPanelRef:ie,isAllDay:n,eventVisibility:Re,calendarRef:r,selectedEventElementRef:le,onEventUpdate:M,onEventDelete:N,handlePanelClose:Ke,customRenderingStore:X,contentSlotRenderer:Je,customDetailPanelContent:A,app:$}),te&&$&&we&&_t(eo,{event:e,x:te.x,y:te.y,onClose:()=>ne(null),app:$,onDetailPanelToggle:H,detailPanelKey:he})]})},To=({handlePreviousMonth:e,handleToday:t,handleNextMonth:n})=>{const{t:a}=Pn();return _t("div",{className:"df-navigation",children:[_t("button",{type:"button",className:Qn,onClick:e,"aria-label":"Previous month",children:_t(ca,{})}),_t("button",{type:"button",className:"df-today-button df-calendar-today-button",onClick:t,children:a("today")}),_t("button",{type:"button",className:Qn,onClick:n,"aria-label":"Next month",children:_t(ua,{})})]})},So=({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:g}=Pn(),m=void 0===s||s,v=o||(()=>{switch(e){case"day":return t.toLocaleDateString(g,{day:"numeric",month:"long",year:"numeric"});case"week":case"month":return t.toLocaleDateString(g,{month:"long",year:"numeric"});case"year":return t.getFullYear().toString();default:return""}})(),f="day"===e?i||("day"===e?t.toLocaleDateString(g,{weekday:"long"}):null):null;return _t("div",{className:"df-view-header-container",onContextMenu:e=>e.preventDefault(),children:[_t("div",{className:"df-view-header-title-area",children:_t("div","year"===e&&d?{className:"df-view-header-year-stack",children:[_t("h1",{className:`${$n} df-view-header-year-title`,style:{transform:`translateY(-${c}px)`},children:d}),u&&_t("h1",{className:`${$n} df-view-header-year-title`,style:{transform:`translateY(${h}px)`},children:u})]}:{children:[_t("div",{className:$n,children:v}),f&&_t("div",{className:"df-view-header-subtitle",children:f}),l&&_t("div",{className:"df-view-header-subtitle-row",children:l&&_t("div",{className:"df-view-header-subtitle-meta",children:l})})]})}),m&&n&&a&&r&&_t("div",{className:"df-view-header-nav",children:_t(To,{handlePreviousMonth:n,handleNextMonth:a,handleToday:r})})]})};function Mo(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 No(){document.dispatchEvent(new MouseEvent("mouseup",{bubbles:!0,cancelable:!1}))}const Io=({app:e,currentDate:t,currentWeekStart:n,events:a,currentDayEvents:r,organizedAllDayEvents:i,allDayAreaHeight:l,timeSlots:s,eventLayouts:d,isToday:c,currentTime:u,selectedEventId:h,setSelectedEventId:f,newlyCreatedEventId:y,setNewlyCreatedEventId:D,detailPanelEventId:w,setDetailPanelEventId:b,dragState:E,isDragging:C,handleMoveStart:T,handleResizeStart:S,handleCreateStart:M,handleCreateAllDayEvent:N,handleTouchStart:I,handleTouchEnd:k,handleTouchMove:O,handleDragOver:R,handleDrop:H,handleEventUpdate:A,handleEventDelete:P,onDateChange:L,customDetailPanelContent:$,customEventDetailDialog:j,calendarRef:Y,allDayRowRef:F,timeGridRef:Z,switcherMode:z,isMobile:_,isTouch:U,setDraftEvent:W,setIsDrawerOpen:B,ALL_DAY_HEIGHT:V,HOUR_HEIGHT:q,FIRST_HOUR:G,LAST_HOUR:K,showAllDay:X,showStartOfDayLabel:J,timeFormat:Q="24h",secondaryTimeSlots:ee,primaryTzLabel:te,secondaryTzLabel:ne,appTimeZone:ae})=>{var re;const oe=!!ee&&ee.length>0&&!_,{t:ie}=Pn(),le=v(e.state.highlightedEventId),[se,de]=g(null),ce=p(()=>Gt(),[]),ue=p(()=>oe&&ne&&te?_t(o,{children:[_t("span",{className:"df-time-column-tz-label",children:ne}),_t("span",{className:"df-time-column-tz-label",children:te})]}):null,[oe,ne,te]),he=()=>{var e;const t=null===(e=Y.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},ge=e=>{var t;const n=null===(t=Y.current)||void 0===t?void 0:t.querySelector(".df-calendar-content");if(!n)return null;const a=n.getBoundingClientRect(),r=n.scrollTop||0;return G+(e-a.top+r-he())/q},me=e.canMutateFromUI();m(()=>{me||de(null)},[me]);const ve=(e,n)=>{var a,r,o,i;if(e.preventDefault(),_||!me)return;const l=new Date(t);if(n)l.setHours(0,0,0,0);else{const t=null===(r=null===(a=Y.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=Y.current)||void 0===o?void 0:o.querySelector(".df-calendar-content"))||void 0===i?void 0:i.scrollTop)||0,a=he(),r=(e.clientY-t.top+n-a)/q+G,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)}}de({x:e.clientX,y:e.clientY,date:l})};return _t("div",{className:"df-day-content","data-switcher-mode":z,onContextMenu:e=>e.preventDefault(),children:[_t("div",{className:"df-day-content-layout",children:[_t("div",{className:"df-day-content-header-wrap",onContextMenu:e=>e.preventDefault(),style:{paddingRight:_||!ce?"0px":"15px"},children:_t(So,{calendar:e,viewType:x.DAY,currentDate:t,subtitleMeta:ue})}),_t("div",X?{className:da(Bn,"df-day-content-all-day-row"),ref:F,"data-scrollbar-space":!_&&ce?"true":"false",style:{paddingRight:_||!ce?"0px":"0.6875rem"},onContextMenu:e=>ve(e,!0),children:[_t("div",{className:da(Vn,"df-day-content-all-day-label"),onContextMenu:e=>e.preventDefault(),children:ie("allDay")}),_t("div",{className:"df-day-content-all-day-grid","data-scrollbar-space":!_&&ce?"true":"false",children:_t("div",{className:"df-day-content-all-day-lane",style:{minHeight:`${l}px`},onClick:()=>null==L?void 0:L(t),onMouseDown:e=>{const a=Math.floor((t.getTime()-n.getTime())/864e5);null==N||N(e,a)},onDblClick:e=>{const a=Math.floor((t.getTime()-n.getTime())/864e5);null==N||N(e,a)},onDragOver:R,onDrop:e=>{H(e,t,void 0,!0)},children:i.map(t=>_t(Co,{event:t,isAllDay:!0,viewType:x.DAY,segmentIndex:t.row,allDayHeight:V,calendarRef:Y,isBeingDragged:C&&(null==E?void 0:E.eventId)===t.id&&"move"===(null==E?void 0:E.mode),hourHeight:q,firstHour:G,onMoveStart:T,onEventUpdate:A,onEventDelete:P,newlyCreatedEventId:y,onDetailPanelOpen:()=>D(null),detailPanelEventId:w,onDetailPanelToggle:e=>b(e),selectedEventId:h,onEventSelect:t=>{const n=e.getReadOnlyConfig().viewable,r=e.canMutateFromUI(),o=a.find(e=>e.id===t);(_||U)&&o&&n&&r?(W(o),B(!0)):(f(t),e.state.highlightedEventId&&(e.highlightEvent(null),le.current=null))},onEventLongPress:e=>{(_||U)&&f(e)},customDetailPanelContent:$,customEventDetailDialog:j,app:e,isMobile:_,enableTouch:U,appTimeZone:ae},t.id))})})]}:{className:"df-day-content-all-day-spacer","data-scrollbar-space":!_&&ce?"true":"false"}),_t("div",{className:da("df-calendar-content","df-day-content-grid"),style:{scrollbarGutter:"stable"},children:_t("div",{className:"df-day-content-grid-inner",children:[c&&u&&(()=>{const e=u,t=e.getHours()+e.getMinutes()/60;if(t<G||t>K)return null;return _t("div",{className:Un,"data-secondary-tz":oe?"true":"false",style:{top:`${(t-G)*q}px`,height:0,zIndex:20,marginTop:"0.75rem"},children:[_t("div",{className:"df-day-content-current-time-side",children:[_t("div",{className:"df-day-content-current-time-side-inner"}),_t("div",{className:Wn,children:Fe(t,0,Q,!1)})]}),_t("div",{className:"df-day-content-current-time-rail",children:_t("div",{className:"df-current-time-bar"})})]})})(),_t("div",{className:"df-time-column","data-secondary-tz":oe?"true":"false",onContextMenu:e=>e.preventDefault(),children:[_t("div",{className:"df-time-column-spacer df-time-day-column-spacer","data-secondary-tz":oe?"true":"false"}),s.map((e,t)=>{var n;return _t("div",{className:Zn,children:_t("div",oe?{className:"df-time-column-tz-row",children:[_t("span",{className:"df-time-column-tz-value",children:J&&0===t?"":null!==(n=null==ee?void 0:ee[t])&&void 0!==n?n:""}),_t("span",{className:"df-time-column-tz-value",children:J&&0===t?"":e.label})]}:{className:zn,children:J&&0===t?"":e.label})},t)})]}),_t("div",{className:"df-day-content-grid-column",children:[_t("div",{className:da(na,"df-time-grid-boundary-top","df-day-content-grid-boundary"),"data-scrollbar-space":!_&&ce?"true":"false",children:_t("div",{className:da(aa,"df-midnight-label-offset"),style:{top:"auto",bottom:"-0.625rem"},children:J?Fe(G,0,Q):""})}),_t("div",{className:"df-day-content-grid-rows",style:{WebkitTouchCallout:"none"},ref:Z,"data-scrollbar-space":!_&&ce?"true":"false",children:[s.map((e,a)=>_t("div",{className:_n,"data-scrollbar-space":!_&&ce?"true":"false",onClick:()=>null==L?void 0:L(t),onMouseDown:e=>{const a=ge(e.clientY);if(null===a)return;Mo(e,Math.floor((t.getTime()-n.getTime())/864e5),a,U,M)},onDblClick:e=>{const a=ge(e.clientY);if(null===a)return;const r=Math.floor((t.getTime()-n.getTime())/864e5);null==M||M(e,r,a),No()},onTouchStart:e=>{const a=Math.floor((t.getTime()-n.getTime())/864e5);I(e,a)},onTouchEnd:k,onTouchMove:O,onDragOver:R,onDrop:e=>{var n,a,r,o;const i=null===(a=null===(n=Y.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=Y.current)||void 0===r?void 0:r.querySelector(".df-calendar-content"))||void 0===o?void 0:o.scrollTop)||0,s=he(),d=e.clientY-i.top+l-s,c=Math.floor(G+d/q);H(e,t,c)},onContextMenu:e=>ve(e,!1)},a)),_t("div",{className:da(na,"df-day-content-grid-boundary-bottom"),"data-scrollbar-space":!_&&ce?"true":"false",children:_t("div",oe?{className:"df-time-column-tz-row df-day-content-bottom-tz-row",style:{left:_?"-5rem":"-5.5rem",width:_?"5rem":"5.5rem"},children:[_t("span",{children:null!==(re=null==ee?void 0:ee[0])&&void 0!==re?re:""}),_t("span",{children:Fe(0,0,Q)})]}:{className:da(aa,"df-midnight-label-offset"),children:Fe(0,0,Q)})}),_t("div",{className:"df-day-content-event-layer",children:r.filter(e=>!e.allDay).map(t=>{const n=d.get(t.id);return _t(Co,{event:t,layout:n,viewType:x.DAY,calendarRef:Y,isBeingDragged:C&&(null==E?void 0:E.eventId)===t.id&&"move"===(null==E?void 0:E.mode),hourHeight:q,firstHour:G,onMoveStart:T,onResizeStart:S,onEventUpdate:A,onEventDelete:P,newlyCreatedEventId:y,onDetailPanelOpen:()=>D(null),detailPanelEventId:w,onDetailPanelToggle:e=>b(e),selectedEventId:h,onEventSelect:t=>{const n=e.getReadOnlyConfig().viewable,r=a.find(e=>e.id===t);(_||U)&&r&&n?(W(r),B(!0)):(f(t),e.state.highlightedEventId&&(e.highlightEvent(null),le.current=null))},onEventLongPress:e=>{(_||U)&&f(e)},customDetailPanelContent:$,customEventDetailDialog:j,app:e,isMobile:_,enableTouch:U,appTimeZone:ae},t.id)})})]})]})]})})]}),me&&se&&_t(Qr,{x:se.x,y:se.y,date:se.date,viewType:x.DAY,onClose:()=>de(null),app:e,onCreateEvent:()=>{if(M){const e=Math.floor((t.getTime()-n.getTime())/864e5);if(0===se.date.getHours()&&0===se.date.getMinutes())null==N||N({clientX:se.x,clientY:se.y},e);else{const t=se.date.getHours()+se.date.getMinutes()/60,n={preventDefault:()=>{},stopPropagation:()=>{},clientX:se.x,clientY:se.y};M(n,e,t)}}}})]})},ko=({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:g,locale:m}=Pn(),v=[...a].toSorted((e,t)=>{if(e.allDay&&!t.allDay)return-1;if(!e.allDay&&t.allDay)return 1;if(!e.allDay&&!t.allDay){return Ne(e.start,u).getTime()-Ne(t.start,u).getTime()}return 0});return _t("div",{className:"df-right-panel","data-switcher-mode":s,onContextMenu:e=>e.preventDefault(),children:_t("div",{className:"df-right-panel-layout",children:[_t("div",{className:"df-mini-calendar",children:_t("div",{className:"df-right-panel-calendar-shell",children:[_t("div",{className:"df-right-panel-calendar-header",children:[_t("div",{className:"df-right-panel-header-spacer","aria-hidden":"true",children:" "}),_t(To,{handlePreviousMonth:()=>e.goToPrevious(),handleNextMonth:()=>e.goToNext(),handleToday:()=>e.goToToday()})]}),_t(Tr,{visibleMonth:n,currentDate:t,showHeader:!0,onMonthChange:i,onDateSelect:l,events:e.getEvents(),showEventDots:c,calendarRegistry:e.getCalendarRegistry(),timeZone:e.timeZone})]})}),_t("div",{className:"df-right-panel-events",children:_t("div",{className:"df-right-panel-events-inner",children:[_t("h3",{className:"df-right-panel-date-heading",children:t.toLocaleDateString(m,{weekday:"long",month:"long",day:"numeric"})}),0===v.length?_t("p",{className:"df-right-panel-empty",children:g("noEvents")}):_t("div",{className:"df-right-panel-list",children:v.map(t=>_t("div",{className:"df-right-panel-event-item",children:_t(Co,{event:t,isAllDay:t.allDay,viewType:x.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))})]})})]})})},xo={PARALLEL_THRESHOLD:.25,NESTED_THRESHOLD:.5,INDENT_STEP_PERCENT:2.5,MIN_WIDTH:25,MARGIN_BETWEEN:1,EDGE_MARGIN_PERCENT:.9};function Oo(e){return Object.assign(Object.assign({},e),{parentId:void 0,children:[],_startHour:e.allDay?0:K(e.start),_endHour:e.allDay?0:Ze(e)})}function Ro(e){var t;return null!==(t=e._startHour)&&void 0!==t?t:K(e.start)}function Ho(e){var t;return null!==(t=e._endHour)&&void 0!==t?t:Ze(e)}function Ao(e,t){return e.day===t.day&&!e.allDay&&!t.allDay&&(Ro(e)<Ho(t)&&Ro(t)<Ho(e))}function Po(e,t){const n=Ho(e)-Ro(e);if(n<1.25)return!1;const a=Ro(e)+.4*n,r=Ro(t)>=a,o=Ao(e,t);return r&&o}function Lo(e,t,n=xo){if(!Ao(e,t))return!1;const a=Math.abs(Ro(e)-Ro(t));return a<=n.PARALLEL_THRESHOLD||(a>n.PARALLEL_THRESHOLD&&a<n.NESTED_THRESHOLD||function(e,t){return!(!Ao(e,t)||!Po(e,t)&&!Po(t,e))}(e,t))}function $o(e,t){const n=Ro(e)<=Ro(t)&&Ho(e)>=Ho(t),a=Ro(e)<=Ro(t)&&Ro(t)<Ho(e)&&Ao(e,t);return n||a}function jo(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(Ro(a)-Ro(t))<=xo.PARALLEL_THRESHOLD&&(r.push(t),n.add(t.id))}r.sort((e,t)=>Ro(e)-Ro(t));const o={events:r,startHour:Math.min(...r.map(e=>Ro(e))),endHour:Math.max(...r.map(e=>Ho(e)))};t.push(o)}return t.sort((e,t)=>e.startHour-t.startHour),t}function Yo(e){return"day"===e?.5:2.5}function Fo(e){const t=Ho(e)-Ro(e);return Math.max(.1,Math.min(1,t/4))}function Zo(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(Lo(e[t],e[n],xo))return!0;return!1}function zo(e,t,n,a,r={}){const o=Yo(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*Yo(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:Fo(e.event)}),0===e.children.length)return;const u=[...e.children].toSorted((e,t)=>Ho(t.event)-Ro(t.event)-(Ho(e.event)-Ro(e.event)));1===u.length?zo(u[0],d,c,a,r):Zo(u.map(e=>e.event))?_o(u,d,c,a,r):u.forEach(e=>zo(e,d,c,a,r))}function _o(e,t,n,a,r={}){const o=e.length,i=e[0].depth,l=i*Yo(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=>zo(e,t,n,a,r));let h=xo.MARGIN_BETWEEN*(1===i?s?.15:.3:s?.1:.2);const g=(u-h*(o-1))/o;e.forEach((e,t)=>{const n=c+t*(g+h);if(a.set(e.event.id,{id:e.event.id,left:n,width:g,zIndex:e.depth,level:e.depth,isPrimary:0===e.depth,indentOffset:l*(r.containerWidth||320)/100,importance:Fo(e.event)}),e.children.length>0){const t=[...e.children].toSorted((e,t)=>Ho(t.event)-Ro(t.event)-(Ho(e.event)-Ro(e.event)));1===t.length?zo(t[0],n,g,a,r):Zo(t.map(e=>e.event))?_o(t,n,g,a,r):t.forEach(e=>zo(e,n,g,a,r))}})}function Uo(e,t,n={}){const a=100-("day"===n.viewType?0:xo.EDGE_MARGIN_PERCENT);if(1===e.length)zo(e[0],0,a,t,n);else if(e.length>1){const r=e.length,o=(a-xo.MARGIN_BETWEEN*(r-1))/r;e.forEach((e,a)=>{zo(e,a*(o+xo.MARGIN_BETWEEN),Math.max(o,xo.MIN_WIDTH),t,n)})}}function Wo(e){let t=0;for(const n of e.children)t+=1+Wo(n);return t}function Bo(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:Wo(e)})).toSorted((e,t)=>t.load-e.load)}function Vo(e){return!(e.length<2)&&e[0].load-e.at(-1).load>=2}function qo(e,t){t.parentId=e.id,e.children.includes(t.id)||e.children.push(t.id)}function Go(e,t){e.parent&&(e.parent.children=e.parent.children.filter(t=>t!==e));const n=t.children.find(t=>$o(t.event,e.event));n?(e.parent=n,e.depth=n.depth+1,n.children.push(e),qo(n.event,e.event)):(e.parent=t,e.depth=t.depth+1,t.children.push(e),qo(t.event,e.event))}function Ko(e,t){0===e.children.length?t.push(e):e.children.forEach(e=>Ko(e,t))}function Xo(e,t){const n=[];return Ko(e,n),n.find(e=>$o(t.event,e.event))||n[0]||null}function Jo(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=Xo(n.node,a.node);if(!r)break;Go(r,a.node),n.load--,a.load++,t++}}function Qo(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(Ao(n,e)&&Math.abs(Ro(e)-Ro(n))<xo.NESTED_THRESHOLD)return!0;return!1}(e,t))return!1;if(n<xo.NESTED_THRESHOLD)return!1;for(const n of e.events)for(const e of t.events)if($o(n,e))return!0;return!1}function ei(e,t,n){const a=t.events.filter(t=>$o(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&&Lo(e,a,xo)})}));return r.sort((t,n)=>t.load!==n.load?t.load-n.load:t.hasParallelSibling!==n.hasParallelSibling?t.hasParallelSibling?-1:1:Math.abs(Ro(e)-Ro(t.parent))-Math.abs(Ro(e)-Ro(n.parent))),r[0].parent}function ti(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=Ho(e)-Ro(e),i=r.flatMap(e=>e.children);return o>Math.max(...i.map(e=>{const t=n.find(t=>t.id===e);return t?Ho(t)-Ro(t):0}),0)?r[0]:r.at(-1)||null}function ni(e,t){t.parentId=e.id,e.children.includes(t.id)||e.children.push(t.id)}function ai(e){let t=0;for(const n of e.children)t+=1+ai(n);return t}function ri(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 oi(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=ai(e);t<i&&(i=t,l=e)}return l?l.event:null}function ii(e,t,n){const a=[];if(1===e.length){const r=ei(e[0],t,n);return r&&(a.push({child:e[0],parent:r}),ni(r,e[0])),a}const r=t.events.filter(t=>e.every(e=>$o(t,e)));if(0===r.length){for(const r of e){const o=ei(r,t,n);if(o)a.push({child:r,parent:o}),ni(o,r);else{const t=e.find(e=>e.id!==r.id&&Ao(e,r));if(t){const e=oi(t,ri(n));e&&(a.push({child:r,parent:e}),ni(e,r))}}}return a}const o=[...e].toSorted((e,t)=>Ho(t)-Ro(t)-(Ho(e)-Ro(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}),ni(n,e)}}else for(const e of o){const t=ti(e,r,o);t&&(a.push({child:e,parent:t}),ni(t,e))}return a}function li(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(Qo(d,{events:i,startHour:o.startHour,endHour:o.endHour})){const e=ii(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=Bo(e[n].events.map(e=>t.find(t=>t.event.id===e.id)),t);Vo(a)&&Jo(a)}}(e,n),o}const si={calculateDayEventLayouts(e,t={}){const n=e.map(Oo);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)||Ao(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:xo.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{Uo(li(jo([...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}},di=(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=lo(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:Oe(X(ct(t,o),n.startHour)),end:Oe(X(ct(t,o),a)),day:o});i.push(r)}}else if(e.day===o){const t=e=>a?Ne(e,a):Me(e);i.push(Object.assign(Object.assign({},e),{start:Oe(t(e.start),a),end:Oe(t(null!==(r=e.end)&&void 0!==r?r:e.start),a),day:o}))}});const l=si.calculateDayEventLayouts(i,{viewType:"week"});r.set(o,l)}return r},ci=(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},ui={HOUR_HEIGHT:72,FIRST_HOUR:0,LAST_HOUR:24,ALL_DAY_HEIGHT:28};function hi(e){const{app:t,onEventCreated:a}=e,{t:r}=Pn(),o=f(e=>{e.dataTransfer&&e.dataTransfer.types.includes("application/x-dayflow-calendar")&&(e.preventDefault(),e.dataTransfer.dropEffect="copy")},[]);return{handleDrop:f((e,o,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=n.PlainDate.from({year:o.getFullYear(),month:o.getMonth()+1,day:o.getDate()});d=e,c=e,u=!0}else if(void 0===i){const e=new Date(o);e.setHours(9,0,0,0);const n=new Date(e);n.setHours(10,0,0,0),d=Oe(e,t.timeZone),c=Oe(n,t.timeZone)}else{const e=new Date(o);e.setHours(i,0,0,0);const n=new Date(e);n.setHours(i+1,0,0,0),d=Oe(e,t.timeZone),c=Oe(n,t.timeZone)}const h=t.getCalendarRegistry().get(e.calendarId);if((null==h?void 0:h.readOnly)||(null==h?void 0:h.subscription))return null;const g={id:`event-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,title:r(u?"newAllDayCalendarEvent":"newCalendarEvent",{calendarName:e.calendarName}),description:"",start:d,end:c,calendarId:e.calendarId,allDay:u};return t.addEvent(g),null==a||a(g),g}catch(e){return console.error("Error creating event from calendar drop:",e),null}},[t,a]),handleDragOver:o}}let gi=null;function mi(e){gi=e}const vi={handleMoveStart:()=>{},handleCreateStart:()=>{},handleResizeStart:void 0,handleCreateAllDayEvent:()=>{},dragState:{active:!1,mode:null,eventId:null,targetDate:null,startDate:null,endDate:null},isDragging:!1};function fi(e,t){return gi?gi(e,t):vi}const pi=({app:e,config:t,customDetailPanelContent:n,customEventDetailDialog:a,calendarRef:r,switcherMode:o="buttons",selectedEventId:i,onEventSelect:l,onDateChange:s,detailPanelEventId:d,onDetailPanelToggle:c})=>{const u=e.getEvents(),{screenSize:h}=Hn(),D="desktop"!==h,[w,b]=g(!1),{hourHeight:E=ui.HOUR_HEIGHT,firstHour:C=ui.FIRST_HOUR,lastHour:T=ui.LAST_HOUR,allDayHeight:S=ui.ALL_DAY_HEIGHT,showAllDay:M=!0,timeFormat:N="24h",secondaryTimeZone:I,showEventDots:k=!0}=t,O=E,R=C,H=T,A=S,P=!M;m(()=>{b("ontouchstart"in window||navigator.maxTouchPoints>0)},[]);const L=e.getCustomMobileEventRenderer()||Nr,[$,j]=g(null),[Y,F]=g(null),[Z,z]=g(null),_=void 0===i?Y:i,U=void 0===d?Z:d,W=p(()=>_&&u.find(e=>e.id===_)||null,[_,u]),B=e=>{l?l(e):F(e)},[V,q]=g(null),[G,X]=g(!1),[J,Q]=g(null),ee=v(null),te=e.getCurrentDate(),[ne,ae]=g(te),re=v(te.getTime());te.getTime()!==re.current&&(re.current=te.getTime(),te.getFullYear()===ne.getFullYear()&&te.getMonth()===ne.getMonth()||ae(te));const oe=f(t=>{ae(n=>{const a=new Date(n.getFullYear(),n.getMonth()+t,1);return e.setVisibleMonth(a),a})},[e]),ie=v(e.state.highlightedEventId);m(()=>{var t;if(e.state.highlightedEventId!==ie.current)if(e.state.highlightedEventId){B(e.state.highlightedEventId);const n=e.getEvents().find(t=>t.id===e.state.highlightedEventId);if(n&&!n.allDay){const e=K(n.start),a=null===(t=r.current)||void 0===t?void 0:t.querySelector(".df-calendar-content");if(a){const t=(e-R)*O;requestAnimationFrame(()=>{a.scrollTo({top:Math.max(0,t-100),behavior:"smooth"})})}}}else ie.current&&_===ie.current&&B(null);ie.current=e.state.highlightedEventId},[e.state.highlightedEventId,R,O,r,e]);const le=v(null),se=v(null),de=p(()=>ci(te),[te]),ce=e.timeZone,ue=p(()=>((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?Ne(e,a):Me(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})})})(u,te,de,ce),[u,te,de,ce]),he=p(()=>((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?Ne(e,n):Me(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=Oe(i,n),d=Oe(l,n);return i<a&&(s=Oe(a,n)),l>r&&(d=Oe(r,n)),Object.assign(Object.assign({},e),{start:s,end:d,day:0})})})(ue,te,ce),[ue,te,ce]),ge=p(()=>si.calculateDayEventLayouts(he,{viewType:"day"}),[he]),me=p(()=>((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(xn(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=Me(e.start),a=Me(e.end),r=Me(t.start);return n<=Me(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})(ue,e.state.allDaySortComparator),[ue,e.state.allDaySortComparator]),ve=p(()=>{if(0===me.length)return A;return(Math.max(...me.map(e=>e.row))+1)*A},[me,A]),{handleMoveStart:fe,handleCreateStart:pe,handleResizeStart:ye,handleCreateAllDayEvent:De,dragState:we,isDragging:be}=fi(e,{calendarRef:r,allDayRowRef:M?le:void 0,timeGridRef:se,viewType:x.DAY,onEventsUpdate:(t,n,a)=>{const r=t(ue),o=new Set(r.map(e=>e.id)),i=ue.filter(e=>!o.has(e.id)),l=new Set(ue.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=u.find(t=>t.id===e.id);return t&&Tt(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=>{D?(Q(t),X(!0)):(e.addEvent(t),q(t.id))},onEventEdit:()=>{},currentWeekStart:de,events:ue,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:Oe(i,o),end:Oe(l,o),calendarId:"blue",allDay:!1}];return si.calculateDayEventLayouts(s,{viewType:"day"}).get("-1")||null})(0,t,n,te,he,ce),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:Oe(d,i),end:Oe(c,i),day:0})];return 0===u.length?null:si.calculateDayEventLayouts(u,{viewType:"day"}).get(e.id)||null})(e,0,n,a,te,he,ce),TIME_COLUMN_WIDTH:I&&!D?88:D?48:80,isMobile:D}),{handleDrop:Ee,handleDragOver:Ce}=hi({app:e,onEventCreated:e=>{q(e.id)}}),Te=Array.from({length:24},(e,t)=>({hour:t+R,label:Fe(t+R,0,N)})),Se=p(()=>I?Ue(Te,I,N,te,ce):void 0,[I,N,R,te,ce]),Ie=p(()=>I?We(ce,te):void 0,[I,ce,te]),ke=p(()=>I?We(I,te):void 0,[I,te]),xe=f(t=>{const n=new Date(t.getFullYear(),t.getMonth(),t.getDate());e.setCurrentDate(n),ae(new Date(n.getFullYear(),n.getMonth(),1))},[e]),Re=p(()=>{const e=Ve(ce);return te.toDateString()===e.toDateString()},[te,ce]);return y(()=>{var e;if(t.scrollToCurrentTime){const t=null===(e=r.current)||void 0===e?void 0:e.querySelector(".df-calendar-content");if(t){const e=Be(ce),n=e.getHours()+e.getMinutes()/60,a=t.clientHeight;t.scrollTop=Math.max(0,(n-R)*O-a/2)}}},[ce,t.scrollToCurrentTime,R,O]),m(()=>{j(Be(ce));const e=setInterval(()=>j(Be(ce)),6e4);return()=>clearInterval(e)},[ce]),_t("div",{className:"df-day-view",children:[_t(Io,{app:e,currentDate:te,currentWeekStart:de,events:u,currentDayEvents:ue,organizedAllDayEvents:me,allDayAreaHeight:ve,timeSlots:Te,eventLayouts:ge,isToday:Re,currentTime:$,selectedEventId:_,setSelectedEventId:B,newlyCreatedEventId:V,setNewlyCreatedEventId:q,detailPanelEventId:U,setDetailPanelEventId:e=>{c?c(e):z(e)},dragState:we,isDragging:be,handleMoveStart:fe,handleResizeStart:ye,handleCreateStart:pe,handleCreateAllDayEvent:De,handleTouchStart:(e,t)=>{if(!D&&!w)return;const n=e.touches[0],a=n.clientX,o=n.clientY,i=e.currentTarget;ee.current=setTimeout(()=>{var e,n,l;const s=null===(n=null===(e=r.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=r.current)||void 0===l?void 0:l.querySelector(".df-calendar-content"),c=d?d.scrollTop:0,u=o-s.top+c;null==pe||pe({preventDefault:()=>{},stopPropagation:()=>{},touches:[{clientX:a,clientY:o}],changedTouches:[{clientX:a,clientY:o}],target:i,currentTarget:i,cancelable:!0},t,R+u/O)},500)},handleTouchEnd:()=>{ee.current&&(clearTimeout(ee.current),ee.current=null)},handleTouchMove:()=>{ee.current&&(clearTimeout(ee.current),ee.current=null)},handleDragOver:Ce,handleDrop:Ee,handleEventUpdate:t=>e.updateEvent(t.id,t),handleEventDelete:t=>e.deleteEvent(t),onDateChange:s,customDetailPanelContent:n,customEventDetailDialog:a,calendarRef:r,allDayRowRef:le,timeGridRef:se,switcherMode:o,isMobile:D,isTouch:w,setDraftEvent:Q,setIsDrawerOpen:X,ALL_DAY_HEIGHT:A,HOUR_HEIGHT:O,FIRST_HOUR:R,LAST_HOUR:H,showAllDay:M,showStartOfDayLabel:P,timeFormat:N,secondaryTimeSlots:Se,primaryTzLabel:Ie,secondaryTzLabel:ke,appTimeZone:ce}),_t(ko,{app:e,currentDate:te,visibleMonth:ne,currentDayEvents:ue,selectedEvent:W,setSelectedEvent:e=>B(e?e.id:null),handleMonthChange:oe,handleDateSelect:xe,switcherMode:o,timeFormat:N,showEventDots:k,appTimeZone:ce,calendarRef:r}),_t(L,{isOpen:G,onClose:()=>{X(!1),Q(null)},onSave:t=>{u.some(e=>e.id===t.id)?e.updateEvent(t.id,t):e.addEvent(t),X(!1),Q(null)},draftEvent:J,app:e,timeFormat:N})]})},yi=({originalComponent:e,app:t,viewType:n,config:a,customDetailPanelContent:r,customEventDetailDialog:o,calendarRef:i,switcherMode:l,meta:s,selectedEventId:d,detailPanelEventId:c,onEventSelect:u,onDateChange:h,onDetailPanelToggle:g})=>{const m=t.getPlugin("events"),v=t.getPlugin("drag"),y=t.getCurrentDate(),D=t.state.currentView,w=t.getEvents(),b=f(e=>m?m.update(e.id,e):t.updateEvent(e.id,e),[m,t]),E=f(e=>m?m.delete(e):t.deleteEvent(e),[m,t]),C=f(e=>{m?m.add(e):t.addEvent(e)},[m,t]),T=f(e=>{h?h(e):t.setCurrentDate(e)},[t,h]),S=f(e=>{t.changeView(e)},[t]),M=p(()=>{const e=t.getViewConfig(n);return Object.assign(Object.assign({},e),a)},[a,t.state.views,n]),N=p(()=>({app:t,currentDate:y,currentView:D,events:w,onEventUpdate:b,onEventDelete:E,onEventCreate:C,onDateChange:T,onViewChange:S,config:M,customDetailPanelContent:r,customEventDetailDialog:o,calendarRef:i,switcherMode:l,meta:s,selectedEventId:d,detailPanelEventId:c,onEventSelect:u,onDetailPanelToggle:g}),[t,y,D,w,b,E,C,T,S,M,r,o,i,l,s,d,c,u,g]),I=p(()=>{const e={currentDate:y,events:w,setEvents:e=>{w.forEach(e=>E(e.id)),e.forEach(e=>C(e))},updateEvent:b,deleteEvent:E,addEvent:C,goToPrevious:()=>{const e=new Date(y);switch(D){case x.DAY:e.setDate(e.getDate()-1);break;case x.WEEK:e.setDate(e.getDate()-7);break;case x.MONTH:e.setMonth(e.getMonth()-1)}T(e)},goToNext:()=>{const e=new Date(y);switch(D){case x.DAY:e.setDate(e.getDate()+1);break;case x.WEEK:e.setDate(e.getDate()+7);break;case x.MONTH:e.setMonth(e.getMonth()+1)}T(e)},goToToday:()=>{T(new Date)},changeView:S,selectDate:T};return Object.assign(Object.assign({calendar:e},N),{eventsService:m,dragService:v})},[y,w,D,b,E,C,T,S,N,m,v]);return _t(e,Object.assign({},I))},Di={},wi=e=>i(yi,Object.assign(Object.assign({},e),{viewType:x.DAY,originalComponent:pi,className:"df-day-view-factory"}));wi.displayName="DayViewAdapter";const bi=(e={})=>{const t=Object.assign(Object.assign({},Di),e);return{type:x.DAY,component:wi,config:t}},Ei=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)},Ci=({app:e,fullWeekDates:t=[],mobilePageStart:n,onDateChange:a})=>_t("div",{className:"df-compact-header",children:[_t("div",{className:"df-compact-header-labels",children:t.map((e,t)=>_t("div",{className:"df-compact-header-label-cell",children:_t("span",{className:"df-compact-header-label","data-today":e.isToday?"true":"false",children:Ei(e.dayName)})},`label-${t}`))}),_t("div",{className:"df-compact-header-dates",children:(()=>{if(!n)return null;const r=t.findIndex(e=>e.fullDate.getTime()===n.getTime());return _t(o,{children:[_t("div",{className:"df-compact-header-capsule",style:{left:-1===r?"0":`calc(${(r+.5)/7*100}% - 16px)`,top:0,width:`calc(${1/7*100}% + 32px)`,height:"32px"}}),t.map((t,n)=>{const o=t.isCurrent,i=n>=r&&n<r+2;return _t("div",{className:"df-compact-header-date-button",style:{height:"32px"},onClick:()=>{e.setCurrentDate(t.fullDate),null==a||a(t.fullDate)},children:_t("div",{className:"df-compact-header-date-pill","data-selected":o?"true":"false","data-today":t.isToday?"true":"false","data-inside-pill":i?"true":"false",children:[t.date,t.isToday&&!o&&_t("div",{className:"df-compact-header-today-dot"})]})},`date-${n}`)})]})})()})]}),Ti=({app:e,weekDaysLabels:t,mobileWeekDaysLabels:n,weekDates:a,fullWeekDates:r,isSlidingView:i,mobilePageStart:l,currentWeekStart:s,gridWidth:d,allDayAreaHeight:c,organizedAllDaySegments:u,allDayLabelText:h,isMobile:v,isTouch:f,showAllDay:y=!0,calendarRef:D,allDayRowRef:w,topFrozenContentRef:b,ALL_DAY_HEIGHT:E,HOUR_HEIGHT:C,FIRST_HOUR:T,dragState:S,isDragging:M,primaryTzLabel:N,secondaryTzLabel:I,secondaryTimeSlots:k,handleMoveStart:O,handleResizeStart:R,handleEventUpdate:H,handleEventDelete:A,setDraftEvent:P,setIsDrawerOpen:L,onDateChange:$,newlyCreatedEventId:j,setNewlyCreatedEventId:Y,selectedEventId:F,setSelectedEventId:Z,detailPanelEventId:z,setDetailPanelEventId:_,handleCreateAllDayEvent:U,handleDragOver:W,handleDrop:B,customDetailPanelContent:V,customEventDetailDialog:q})=>{const G={flexShrink:0},[K,X]=g(null),J=p(()=>Gt(),[]),Q=!!k&&k.length>0&&!v,ee=e.canMutateFromUI();m(()=>{ee||X(null)},[ee]);return _t("div",{className:"df-week-all-day",children:[i&&r&&l&&_t(Ci,{app:e,fullWeekDates:r,mobilePageStart:l,onDateChange:$}),_t("div",{className:"df-week-all-day-shell","data-show-all-day":y?"true":"false",onContextMenu:e=>e.preventDefault(),children:[y&&_t("div",{className:"df-week-all-day-side",onContextMenu:e=>e.preventDefault(),children:[_t("div",{className:"df-week-all-day-side-spacer","data-sliding-view":i?"true":"false",children:Q&&_t("div",{className:"df-time-column-tz-header df-time-column-tz-header-compact",children:[_t("span",{className:"df-time-column-tz-label",children:I}),_t("span",{className:"df-time-column-tz-label",children:N})]})}),_t("div",{className:`${Vn} df-week-all-day-label`,style:{minHeight:`${c}px`},children:h})]}),_t("div",{className:"df-week-all-day-content-wrap",style:{scrollbarGutter:"stable",minHeight:y?`${c+(i?0:36)}px`:"auto"},children:_t("div",{ref:b,className:"df-week-all-day-content",style:{width:d,minWidth:"100%",transform:i?"translateX(calc(-100% / 3))":void 0},children:[!i&&_t("div",{className:"df-week-header","data-scrollbar-space":J?"true":"false",style:{marginRight:J?"-50px":"0px",paddingRight:J?"50px":"0px"},children:t.map((e,t)=>_t("div",{className:"df-week-day-cell df-week-all-day-weekday-cell","data-mobile":v?"true":"false",style:G,children:_t(o,v?{children:[_t("div",{className:"df-week-all-day-weekday-label",children:n[t]}),_t("div",{className:`${Yn} df-week-all-day-date-number df-week-all-day-date-number-mobile`,"data-today":a[t].isToday?"true":void 0,children:a[t].date})]}:{children:[_t("div",{className:"df-week-all-day-weekday-name",children:e}),_t("div",{className:`${Yn} df-week-all-day-date-number`,"data-today":a[t].isToday?"true":void 0,children:a[t].date})]})},t))}),y&&_t("div",{className:`${Bn} df-week-all-day-row`,ref:w,style:{minHeight:`${c}px`},children:_t("div",{className:"df-all-day-content df-week-all-day-row-content","data-scrollbar-space":v||!J?"false":"true",style:{minHeight:`${c}px`},children:[t.map((e,n)=>{const a=new Date(s);return a.setDate(s.getDate()+n),_t("div",{className:"df-all-day-cell df-week-all-day-cell "+(n!==t.length-1||!v&&J?"":"df-week-all-day-cell-no-border"),style:Object.assign({minHeight:`${c}px`},G),onMouseDown:e=>null==U?void 0:U(e,n),onDblClick:e=>null==U?void 0:U(e,n),onDragOver:W,onDrop:e=>{B(e,a,void 0,!0)},onContextMenu:e=>((e,t)=>{if(e.preventDefault(),v||!ee)return;const n=new Date(s);n.setDate(s.getDate()+t),n.setHours(0,0,0,0),X({x:e.clientX,y:e.clientY,date:n})})(e,n)},`allday-${n}`)}),_t("div",{className:"df-week-all-day-event-layer",children:u.map(n=>_t(Co,{event:n.event,segment:n,segmentIndex:n.row,isAllDay:!0,isMultiDay:!0,allDayHeight:E,calendarRef:D,viewType:x.WEEK,columnsPerRow:t.length,isBeingDragged:M&&(null==S?void 0:S.eventId)===n.event.id&&"move"===(null==S?void 0:S.mode),hourHeight:C,firstHour:T,onMoveStart:O,onResizeStart:R,onEventUpdate:H,onEventDelete:A,newlyCreatedEventId:j,onDetailPanelOpen:()=>Y(null),selectedEventId:F,detailPanelEventId:z,onEventSelect:t=>{var n;const a=!1!==e.getReadOnlyConfig(null!=t?t:void 0).viewable,r=null===(n=u.find(e=>e.event.id===t))||void 0===n?void 0:n.event;if((v||f)&&r&&a)return P(r),void L(!0);Z(t)},onEventLongPress:e=>{(v||f)&&Z(e)},onDetailPanelToggle:e=>_(e),customDetailPanelContent:V,customEventDetailDialog:q,app:e,isMobile:v,isSlidingView:i,enableTouch:f},n.event.id))})]})})]})}),ee&&K&&_t(Qr,{x:K.x,y:K.y,date:K.date,viewType:x.WEEK,onClose:()=>X(null),app:e,onCreateEvent:()=>{const e=Math.floor((K.date.getTime()-s.getTime())/864e5);null==U||U({clientX:K.x,clientY:K.y},e)}})]})]})},Si=({app:e,timeSlots:t,weekDaysLabels:n,currentWeekStart:a,currentWeekEvents:r,eventLayouts:i,gridWidth:l,isMobile:s,isTouch:d,scrollerRef:c,timeGridRef:u,leftFrozenContentRef:h,swipeContentRef:f,calendarRef:y,handleScroll:D,handleCreateStart:w,handleTouchStart:b,handleTouchEnd:E,handleTouchMove:C,handleDragOver:T,handleDrop:S,dragState:M,isDragging:N,handleMoveStart:I,handleResizeStart:k,handleEventUpdate:O,handleEventDelete:R,setDraftEvent:H,setIsDrawerOpen:A,onDateChange:P,newlyCreatedEventId:L,setNewlyCreatedEventId:$,selectedEventId:j,setSelectedEventId:Y,detailPanelEventId:F,setDetailPanelEventId:Z,customDetailPanelContent:z,customEventDetailDialog:_,isSlidingView:U,isCurrentWeek:W,currentTime:B,HOUR_HEIGHT:V,FIRST_HOUR:q,LAST_HOUR:G,showStartOfDayLabel:K,timeFormat:X="24h",secondaryTimeSlots:J,appTimeZone:Q})=>{var ee,te;const ne=!!J&&J.length>0&&!s,ae={flexShrink:0},re=v(e.state.highlightedEventId),[oe,ie]=g(null),le=p(()=>Gt(),[]),se=e.canMutateFromUI();m(()=>{se||ie(null)},[se]);const de=e=>{if(!u.current)return q;const t=u.current.getBoundingClientRect();return q+(e-t.top)/V};return _t("div",{className:"df-week-time-grid",children:[_t("div",{ref:c,className:"df-calendar-content df-week-time-grid-scroller df-week-time-grid-scroller-shell","data-sliding-view":"300%"===l?"true":"false",style:{gridTemplateColumns:"auto 1fr"},onScroll:D,children:[_t("div",{ref:h,className:"df-week-time-grid-time-column","data-secondary-tz":ne?"true":"false",onContextMenu:e=>e.preventDefault(),children:[_t("div",{className:"df-time-column-spacer df-time-week-column-spacer","data-secondary-tz":ne?"true":"false",children:ne?_t(o,{children:_t("div",{className:"df-time-column-tz-row df-time-column-tz-row-boundary",children:[_t("span",{className:"df-time-column-tz-value",children:K&&null!==(ee=null==J?void 0:J[0])&&void 0!==ee?ee:""}),_t("span",{className:"df-time-column-tz-value",children:K?Fe(q,0,X):""})]})}):_t("div",{className:"df-time-column-boundary-label",children:K?Fe(q,0,X):""})}),t.map((e,t)=>{var n;return _t("div",{className:Zn,children:_t("div",ne?{className:"df-time-column-tz-row",children:[_t("span",{className:"df-time-column-tz-value",children:K&&0===t?"":null!==(n=null==J?void 0:J[t])&&void 0!==n?n:""}),_t("span",{className:"df-time-column-tz-value",children:K&&0===t?"":e.label})]}:{className:zn,children:K&&0===t?"":e.label})},t)}),_t("div",{className:"df-week-time-grid-boundary-tail",children:_t("div",ne?{className:"df-time-column-tz-row",children:[_t("span",{className:"df-time-column-tz-value",children:null!==(te=null==J?void 0:J[0])&&void 0!==te?te:""}),_t("span",{className:"df-time-column-tz-value",children:Fe(0,0,X)})]}:{className:zn,children:Fe(0,0,X)})}),W&&B&&(()=>{const e=B,t=e.getHours()+e.getMinutes()/60;if(t<q||t>G)return null;return _t("div",{className:"df-week-time-grid-current-time-label",style:{top:`${(t-q)*V}px`,marginTop:"0.75rem"},children:_t("div",{className:Wn,children:Fe(t,0,X,!1)})})})()]}),_t("div",{ref:f,className:"df-week-time-grid-content",style:{width:l,minWidth:"100%",transform:U?"translateX(calc(-100% / 3))":void 0},children:_t("div",{className:"df-week-time-grid-grid",children:[_t("div",{className:`${na} df-time-grid-boundary-top df-week-time-grid-boundary-row`,"data-scrollbar-space":s||!le?"false":"true",children:n.map((e,t)=>_t("div",{className:"df-week-time-grid-boundary-cell",style:ae},`boundary_${t}`))}),_t("div",{ref:u,className:"df-week-time-grid-grid-inner",children:[W&&B&&(()=>{const e=B,t=e.getHours()+e.getMinutes()/60;if(t<q||t>G)return null;const r=new Date(e);r.setHours(0,0,0,0);const o=new Date(a);o.setHours(0,0,0,0);const i=r.getTime()-o.getTime(),l=Math.round(i/864e5);return _t("div",{className:Un,style:{top:`${(t-q)*V}px`,height:0,zIndex:20},children:[_t("div",{className:"df-week-time-grid-current-time-spacer"}),_t("div",{className:"df-week-time-grid-current-time-track",children:n.map((e,t)=>_t("div",{className:"df-week-time-grid-current-time-cell",children:_t("div",{className:"df-week-time-grid-current-line-rail","data-today":t===l?"true":"false",style:{zIndex:9999},children:t===l&&0!==l&&_t("div",{className:"df-week-time-grid-current-line-dot"})})},t))})]})})(),t.map((e,t)=>_t("div",{className:_n,"data-scrollbar-space":s||!le?"false":"true",children:n.map((n,r)=>{const o=new Date(a);return o.setDate(a.getDate()+r),_t("div",{className:"df-time-grid-cell df-week-time-grid-cell",style:ae,onClick:()=>{const e=new Date(a);e.setDate(a.getDate()+r),null==P||P(e)},onMouseDown:e=>{Mo(e,r,de(e.clientY),d,w)},onDblClick:e=>{null==w||w(e,r,de(e.clientY)),No()},onTouchStart:t=>b(t,r,e.hour),onTouchEnd:E,onTouchMove:C,onDragOver:T,onDrop:t=>{S(t,o,e.hour)},onContextMenu:t=>((e,t,n)=>{if(e.preventDefault(),s||!se)return;const r=new Date(a);if(r.setDate(a.getDate()+t),u.current){const t=u.current.getBoundingClientRect(),n=(e.clientY-t.top)/V+q,a=Math.floor(n),o=Math.floor(60*(n-a)),i=15*Math.round(o/15),l=60===i?a+1:a,s=60===i?0:i;r.setHours(l,s,0,0)}else r.setHours(n,0,0,0);ie({x:e.clientX,y:e.clientY,date:r})})(t,r,e.hour)},`${t}-${r}`)})},t)),_t("div",{className:`${na} df-time-grid-boundary-bottom df-week-time-grid-boundary-row`,"data-scrollbar-space":s||!le?"false":"true",children:n.map((e,t)=>_t("div",{className:"df-week-time-grid-boundary-cell",style:ae},`24-${t}`))}),n.map((t,o)=>{const l=n.length,c=st(o,r),u=[];return c.forEach(e=>{const t=lo(e,a,n.length,Q);if(t.length>0){const n=t.find(e=>e.dayIndex===o);n&&u.push({event:e,segmentInfo:Object.assign(Object.assign({},n),{dayIndex:o})})}else u.push({event:e})}),r.forEach(e=>{if(e.allDay||e.day===o)return;const t=lo(e,a,n.length,Q).find(e=>e.dayIndex===o);t&&u.push({event:e,segmentInfo:Object.assign(Object.assign({},t),{dayIndex:o})})}),_t("div",{className:"df-week-time-grid-event-layer",style:{left:`calc(${100/l*o}%)`,width:100/l+"%",height:"100%"},children:u.map(({event:t,segmentInfo:n})=>{const a=i.get(o),c=null==a?void 0:a.get(t.id);return _t(Co,{event:t,layout:c,viewType:x.WEEK,calendarRef:y,columnsPerRow:l,isBeingDragged:N&&(null==M?void 0:M.eventId)===t.id&&"move"===(null==M?void 0:M.mode),hourHeight:V,firstHour:q,onMoveStart:I,onResizeStart:k,onEventUpdate:O,onEventDelete:R,newlyCreatedEventId:L,onDetailPanelOpen:()=>$(null),selectedEventId:j,detailPanelEventId:F,onEventSelect:t=>{const n=!1!==e.getReadOnlyConfig(null!=t?t:void 0).viewable,a=r.find(e=>e.id===t);if((s||d)&&a&&n)return H(a),void A(!0);Y(t),e.state.highlightedEventId&&(e.highlightEvent(null),re.current=null)},onEventLongPress:e=>{(s||d)&&Y(e)},onDetailPanelToggle:e=>Z(e),customDetailPanelContent:z,customEventDetailDialog:_,multiDaySegmentInfo:n,app:e,isMobile:s,isSlidingView:U,enableTouch:d,appTimeZone:Q},n?`${t.id}-seg-${o}`:t.id)})},`events-day-${o}`)})]})]})})]}),se&&oe&&_t(Qr,{x:oe.x,y:oe.y,date:oe.date,viewType:x.WEEK,onClose:()=>ie(null),app:e,onCreateEvent:()=>{if(w){const e=new Date(a);e.setHours(0,0,0,0);const t=new Date(oe.date);t.setHours(0,0,0,0);const n=t.getTime()-e.getTime(),r=Math.round(n/864e5),o=oe.date.getHours()+oe.date.getMinutes()/60,i={preventDefault:()=>{},stopPropagation:()=>{},clientX:oe.x,clientY:oe.y};w(i,r,o)}}})]})},Mi=e=>{const t=n.Now.plainDateISO(e);return new Date(t.year,t.month-1,t.day).toDateString()},Ni=({app:e,config:t,customDetailPanelContent:n,customEventDetailDialog:a,calendarRef:r,selectedEventId:o,onEventSelect:i,onDateChange:l,detailPanelEventId:s,onDetailPanelToggle:d})=>{var c;const{t:u,getWeekDaysLabels:h,locale:D}=Pn(),w=e.getCurrentDate(),b=p(()=>w,[w.getTime()]),E=e.getEvents(),{screenSize:C}=Hn(),T="desktop"!==C,S=v(null),[M,N]=g(!1),{hourHeight:I=ui.HOUR_HEIGHT,firstHour:k=ui.FIRST_HOUR,lastHour:O=ui.LAST_HOUR,allDayHeight:R=ui.ALL_DAY_HEIGHT,showAllDay:H=!0,timeFormat:A="24h",secondaryTimeZone:P}=t,L=P&&"mobile"!==C?88:"mobile"===C?48:80,$=I,j=k,Y=O,F=R,Z=!H;m(()=>{N("ontouchstart"in window||navigator.maxTouchPoints>0)},[]);const z=e.getCustomMobileEventRenderer()||Nr,_="desktop"!==C,U=_?2:7,W=_,B=null!==(c=t.startOfWeek)&&void 0!==c?c:1,V=W?"300%":"100%",q=p(()=>ci(b,B),[b,B]),G=W?3*U:7,[J,Q]=g(null),[ee,te]=g(null),[ne,ae]=g(null),re=void 0===o?ee:o,oe=void 0===s?ne:s,ie=e=>{i?i(e):te(e)},le=e=>{d?d(e):ae(e)},[se,de]=g(null),[ce,ue]=g(!1),[he,ge]=g(null),me=v(null),ve=v(null),fe=v(null),pe=v(null),ye=v(null),De=v(null),{handleScroll:we,goToNext:be,goToPrevious:Ee,mobilePageStart:Ce}=(({app:e,columnsPerPage:t,currentDate:n,displayDays:a,isSlidingView:r,scrollerRef:o,swipeContentRef:i,topFrozenContentRef:l})=>{const[s,d]=g(()=>{const e=new Date(n);return e.setHours(0,0,0,0),e}),[c,u]=g(0),[h,p]=g(!1),y=v({x:0,y:0}),D=v(!1),w=v(0);m(()=>{r&&d(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,r]);const b=f(e=>{const{scrollLeft:t}=e.currentTarget;if(!l.current)return;const n=r?"calc(-100% / 3)":"0px",a=r?`${c}px`:`-${t}px`;l.current.style.transform=`translateX(calc(${n} + ${a}))`,l.current.style.transition=r&&h?"transform 0.3s ease-out":"none"},[r,h,c,l]);m(()=>{if(!r)return;const t=o.current;if(!t)return;const n=e=>{y.current={x:e.touches[0].clientX,y:e.touches[0].clientY},D.current=!1,w.current=0,p(!1)},c=e=>{if(h)return;const n=e.touches[0].clientX-y.current.x,a=e.touches[0].clientY-y.current.y;if(!D.current&&Math.abs(n)>10&&Math.abs(n)>Math.abs(a)&&(D.current=!0),D.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))`;l.current&&(l.current.style.transition="none",l.current.style.transform=o),i.current&&(i.current.style.transition="none",i.current.style.transform=o),w.current=r}},g=()=>{var n;if(!D.current)return void(w.current=0);const r=w.current,o=((null===(n=i.current)||void 0===n?void 0:n.clientWidth)||t.clientWidth)/a;r>100?(p(!0),u(o),setTimeout(()=>{const t=new Date(s);t.setDate(t.getDate()-1),d(t),e.setCurrentDate(t),u(0),w.current=0,p(!1)},300)):r<-100?(p(!0),u(-o),setTimeout(()=>{const t=new Date(s);t.setDate(t.getDate()+1),d(t),e.setCurrentDate(t),u(0),w.current=0,p(!1)},300)):(p(!0),u(0),w.current=0,setTimeout(()=>{p(!1)},300))};return t.addEventListener("touchstart",n,{passive:!0}),t.addEventListener("touchmove",c,{passive:!1}),t.addEventListener("touchend",g,{passive:!0}),()=>{t.removeEventListener("touchstart",n),t.removeEventListener("touchmove",c),t.removeEventListener("touchend",g)}},[e,a,r,h,s,o,i,l]),m(()=>{if(!r)return l.current&&(l.current.style.transform="",l.current.style.transition=""),void(i.current&&(i.current.style.transform="",i.current.style.transition=""));const e=h?"transform 0.3s ease-out":"none",t=`translateX(calc(calc(-100% / 3) + ${c}px))`;l.current&&(l.current.style.transition=e,l.current.style.transform=t),i.current&&(i.current.style.transition=e,i.current.style.transform=t)},[r,h,i,c,l]);const E=f(()=>{if(!r)return!1;const t=new Date(n);return t.setDate(t.getDate()-1),d(e=>{const t=new Date(e);return t.setDate(t.getDate()-1),t}),e.setCurrentDate(t),!0},[e,n,r]);return{handleScroll:b,goToNext:f(()=>{if(!r)return!1;const t=new Date(n);return t.setDate(t.getDate()+1),d(e=>{const t=new Date(e);return t.setDate(t.getDate()+1),t}),e.setCurrentDate(t),!0},[e,n,r]),goToPrevious:E,mobilePageStart:s}})({app:e,columnsPerPage:U,currentDate:b,displayDays:G,isSlidingView:W,scrollerRef:fe,swipeContentRef:De,topFrozenContentRef:pe}),Te=W?Ce:q,Se=p(()=>{if(!W)return Te;const e=new Date(Te);return e.setDate(e.getDate()-U),e},[U,Te,W]),Ie=e.timeZone,ke=p(()=>((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?Ne(e,a):Me(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})})})(E,Se,G,Ie),[E,Se,G,Ie]),xe=v(e.state.highlightedEventId);m(()=>{if(e.state.highlightedEventId!==xe.current)if(e.state.highlightedEventId){ie(e.state.highlightedEventId);const t=ke.find(t=>t.id===e.state.highlightedEventId);if(t&&!t.allDay){const e=K(t.start),n=fe.current;if(n){const t=(e-j)*$;requestAnimationFrame(()=>{n.scrollTo({top:Math.max(0,t-100),behavior:"smooth"})})}}}else xe.current&&re===xe.current&&ie(null);xe.current=e.state.highlightedEventId},[e.state.highlightedEventId,ke,j,$]);const Re=p(()=>((e,t,n=7,a)=>{const r=io(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=xn(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})(ke,Se,G,e.state.allDaySortComparator),[ke,Se,G,e.state.allDaySortComparator]),He=p(()=>{const e=W?Re.filter(e=>e.endDayIndex>=U&&e.startDayIndex<=2*U-1):Re;if(0===e.length)return F;const t=Math.max(...e.map(e=>e.row));return F+t*F},[Re,F,W,U]),Ae=p(()=>di(ke,Se,G,Ie),[ke,Se,G,Ie]),Pe=f((t,n,a)=>{const r=t(ke),o=new Set(r.map(e=>e.id)),i=ke.filter(e=>!o.has(e.id)),l=new Set(ke.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=ke.find(t=>t.id===e.id);return t&&Tt(t,e)});e.applyEventsChanges({delete:i.map(e=>e.id),add:s,update:d.map(e=>({id:e.id,updates:e}))},n,a)},[ke,e]),Le=f(t=>{T?(ge(t),ue(!0)):(e.addEvent(t),de(t.id))},[T,e]),$e=f(()=>{},[]),je=f((e,t,n)=>((e,t,n,a,r,o=7,i)=>{var l;const s=ct(r,e),d=ct(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:Oe(s,i),end:Oe(d,i),calendarId:"blue",allDay:!1};return(null===(l=di([...a,c],r,o,i).get(e))||void 0===l?void 0:l.get("-1"))||null})(e,t,n,ke,Se,G,Ie),[ke,Se,G,Ie]),Ye=f((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=ct(o,t),s=X(i,n),d=X(i,a),c=Oe(s,l),u=Oe(d,l);return Object.assign(Object.assign({},r),{day:t,start:c,end:u})});return(null===(s=di(d,o,i,l).get(t))||void 0===s?void 0:s.get(e.id))||null})(e,t,n,a,ke,Se,G,Ie),[ke,Se,G,Ie]),Ze=p(()=>({calendarRef:r,allDayRowRef:H?ve:void 0,timeGridRef:S,viewType:x.WEEK,onEventsUpdate:Pe,onEventCreate:Le,onEventEdit:$e,currentWeekStart:Se,events:ke,calculateNewEventLayout:je,calculateDragLayout:Ye,TIME_COLUMN_WIDTH:L,isMobile:T,gridWidth:V,displayDays:G}),[r,H,Pe,Le,$e,Se,ke,je,Ye,L,T,V,G]),{handleMoveStart:ze,handleCreateStart:_e,handleResizeStart:qe,handleCreateAllDayEvent:Ge,dragState:Ke,isDragging:Xe}=fi(e,Ze),{handleDrop:Je,handleDragOver:Qe}=hi({app:e,onEventCreated:e=>{de(e.id)}}),et=p(()=>(({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:G,displayStart:Se,getWeekDaysLabels:h,isSlidingView:W,locale:D,startOfWeek:B}),[G,Se,h,W,D,B]),tt=p(()=>((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)})})(T,D,h,et),[h,T,D,et]),nt=p(()=>u("allDay"),[u]),at=Array.from({length:24},(e,t)=>({hour:t+j,label:Fe(t+j,0,A)})),rt=p(()=>P?Ue(at,P,A,b,Ie):void 0,[P,A,j,b,Ie]),ot=p(()=>P?We(Ie,b):void 0,[P,Ie,b]),it=p(()=>P?We(P,b):void 0,[P,b]),lt=p(()=>((e,t,n,a)=>{const r=Mi(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}})})(Se,et,D,Ie),[Ie,Se,D,et]),st=p(()=>((e,t,n,a)=>{const r=Mi(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"})}})})(q,D,b,Ie),[Ie,b,D,q]),dt=t=>e.updateEvent(t.id,t),ut=t=>e.deleteEvent(t),ht=p(()=>{const e=Ve(Ie);e.setHours(0,0,0,0);const t=new Date(Se);t.setHours(0,0,0,0);const n=new Date(t);return n.setDate(t.getDate()+G),e>=t&&e<n},[Se,G,Ie]);return y(()=>{if(t.scrollToCurrentTime&&fe.current){const e=fe.current,t=Be(Ie),n=t.getHours()+t.getMinutes()/60,a=e.clientHeight;e.scrollTop=Math.max(0,(n-j)*$-a/2)}},[Ie,t.scrollToCurrentTime,j,$]),m(()=>{Q(Be(Ie));const e=setInterval(()=>Q(Be(Ie)),6e4);return()=>clearInterval(e)},[Ie]),_t("div",{className:"df-calendar df-week-view",children:[_t(So,{calendar:e,viewType:x.WEEK,currentDate:b,onPrevious:()=>{Ee()||e.goToPrevious()},onNext:()=>{be()||e.goToNext()},onToday:()=>e.goToToday()}),_t(Ti,{app:e,weekDaysLabels:et,mobileWeekDaysLabels:tt,weekDates:lt,fullWeekDates:st,isSlidingView:W,mobilePageStart:Ce,currentWeekStart:Se,gridWidth:V,allDayAreaHeight:He,organizedAllDaySegments:Re,allDayLabelText:nt,isMobile:T,isTouch:M,showAllDay:H,calendarRef:r,allDayRowRef:ve,topFrozenContentRef:pe,ALL_DAY_HEIGHT:F,HOUR_HEIGHT:$,FIRST_HOUR:j,dragState:Ke,isDragging:Xe,secondaryTimeSlots:rt,primaryTzLabel:ot,secondaryTzLabel:it,handleMoveStart:ze,handleResizeStart:qe,handleEventUpdate:dt,handleEventDelete:ut,setDraftEvent:ge,setIsDrawerOpen:ue,onDateChange:l,newlyCreatedEventId:se,setNewlyCreatedEventId:de,selectedEventId:re,setSelectedEventId:ie,detailPanelEventId:oe,setDetailPanelEventId:le,handleCreateAllDayEvent:Ge,handleDragOver:Qe,handleDrop:Je,customDetailPanelContent:n,customEventDetailDialog:a}),_t(Si,{app:e,timeSlots:at,weekDaysLabels:et,currentWeekStart:Se,currentWeekEvents:ke,eventLayouts:Ae,gridWidth:V,isMobile:T,isSlidingView:W,isTouch:M,scrollerRef:fe,timeGridRef:S,leftFrozenContentRef:ye,swipeContentRef:De,calendarRef:r,handleScroll:we,handleCreateStart:_e,handleTouchStart:(e,t,n)=>{if(!T&&!M)return;const a=e.touches[0],r=a.clientX,o=a.clientY,i=e.currentTarget;me.current=setTimeout(()=>{null==_e||_e({preventDefault:()=>{},stopPropagation:()=>{},touches:[{clientX:r,clientY:o}],changedTouches:[{clientX:r,clientY:o}],target:i,currentTarget:i,cancelable:!0},t,n)},500)},handleTouchEnd:()=>{me.current&&(clearTimeout(me.current),me.current=null)},handleTouchMove:()=>{me.current&&(clearTimeout(me.current),me.current=null)},handleDragOver:Qe,handleDrop:Je,dragState:Ke,isDragging:Xe,handleMoveStart:ze,handleResizeStart:qe,handleEventUpdate:dt,handleEventDelete:ut,setDraftEvent:ge,setIsDrawerOpen:ue,onDateChange:l,newlyCreatedEventId:se,setNewlyCreatedEventId:de,selectedEventId:re,setSelectedEventId:ie,detailPanelEventId:oe,setDetailPanelEventId:le,customDetailPanelContent:n,customEventDetailDialog:a,isCurrentWeek:ht,currentTime:J,HOUR_HEIGHT:$,FIRST_HOUR:j,LAST_HOUR:Y,showStartOfDayLabel:Z,timeFormat:A,secondaryTimeSlots:rt,appTimeZone:Ie}),_t(z,{isOpen:ce,onClose:()=>{ue(!1),ge(null)},onSave:t=>{E.some(e=>e.id===t.id)?e.updateEvent(t.id,t):e.addEvent(t),ue(!1),ge(null)},draftEvent:he,app:e,timeFormat:A})]})},Ii={startOfWeek:1},ki=e=>i(yi,Object.assign(Object.assign({},e),{viewType:x.WEEK,originalComponent:Ni,className:"df-week-view-factory"}));ki.displayName="WeekViewAdapter";const xi=(e={})=>{const t=Object.assign(Object.assign({},Ii),e);return{type:x.WEEK,component:ki,config:t}},Oi=({app:e,appTimeZone:t,calendarRef:n,currentMonth:a,currentYear:r,customDetailPanelContent:o,customEventDetailDialog:i,day:l,dayIndex:s,dayLayout:d,detailPanelEventId:c,dragState:u,enableTouch:h,hasScrollbarSpace:g,isDragging:m,locale:f,moreLabel:p,newlyCreatedEventId:y,onCalendarDragOver:D,onCalendarDrop:w,onChangeView:b,onContextMenu:E,onCreateStart:C,onDetailPanelOpen:T,onDetailPanelToggle:S,onEventDelete:M,onEventLongPress:N,onEventSelect:I,onEventUpdate:k,onMoreEventsClick:O,onMoveStart:R,onResizeStart:H,onSelectDate:A,organizedMultiDaySegments:P,overlayVisibleLayerCount:L,screenSize:$,selectedEventId:j,showWeekNumbers:Y,totalSlotsNeeded:F,weekHeightPx:Z})=>{const z=v(null),_=v(null),U=l.date.toLocaleDateString(f,{month:f.startsWith("zh")||f.startsWith("ja")?"short":"long"})===a&&l.year===r,{hasMore:W,limit:B,timedEventsOnly:V,gapLayers:q,occupiedLayers:G,maxOccupiedLayer:X,segmentIsHidden:J}=d;let Q=0;P.slice(B).forEach(e=>{e.forEach(e=>{e.startDayIndex<=s&&e.endDayIndex>=s&&Q++})}),P.slice(0,B).forEach(e=>{e.forEach(e=>{e.startDayIndex<=s&&e.endDayIndex>=s&&J.has(e.id)&&Q++})});const te=q.filter(e=>e<B).length,ne=P.slice(0,B).filter(e=>e.some(e=>e.startDayIndex<=s&&e.endDayIndex>=s&&J.has(e.id))).length,ae=Math.max(0,B-Math.max(X+1,0)),re=Math.min(V.length,te+ae+ne),oe=V.slice(0,re),ie=Q+(V.length-re),le=W&&L>B,se=17*(L-B),de=m&&u.eventId?u.eventId:null,ce=de?oe.find(e=>e.id===de):null,ue=de&&!ce?V.find(e=>e.id===de):null,he=ce?[ce,...oe.filter(e=>e.id!==de)]:ue&&oe.length>0?[ue,...oe.slice(0,-1)]:ue?[ue]:oe,ge=[];let me=0;const ve=Math.min(B,F);for(let a=0;a<ve;a++)if(G.has(a)&&!P[a].some(e=>e.startDayIndex<=s&&e.endDayIndex>=s&&J.has(e.id)))ge.push(_t("div",{className:"df-shrink-0",style:{height:"17px",minHeight:"17px"}},`placeholder-layer-${a}-${l.date.getTime()}`));else if(me<he.length){const a=he[me];ge.push(_t(Co,{event:a,isAllDay:!!a.allDay,viewType:x.MONTH,isBeingDragged:m&&u.eventId===a.id&&"move"===u.mode,calendarRef:n,hourHeight:72,firstHour:0,onEventUpdate:k,onEventDelete:M,onMoveStart:R,onResizeStart:H,onDetailPanelOpen:T,onEventSelect:I,onEventLongPress:N,newlyCreatedEventId:y,selectedEventId:j,detailPanelEventId:c,onDetailPanelToggle:S,customDetailPanelContent:o,customEventDetailDialog:i,app:e,isMobile:"desktop"!==$,enableTouch:h,appTimeZone:t},`${a.id}-${a.day}-${K(a.start)}-${me}`)),me++}return _t("div",{className:da("df-month-day-cell","df-month-day-cell-surface"),style:{height:Z},"data-other-month":U?"false":"true","data-trailing-border":6!==s||g?"true":"false","data-date":(fe=l.date,`${fe.getFullYear()}-${String(fe.getMonth()+1).padStart(2,"0")}-${String(fe.getDate()).padStart(2,"0")}`),onClick:()=>U&&(null==A?void 0:A(l.date)),onDblClick:e=>null==C?void 0:C(e,l.date),onTouchStart:e=>{if("mobile"!==$&&!h)return;const t=e.touches[0];_.current={x:t.clientX,y:t.clientY},z.current=setTimeout(()=>{null==C||C(e,l.date),z.current=null,navigator.vibrate&&navigator.vibrate(50)},500)},onTouchMove:e=>{if(z.current&&_.current){const t=Math.abs(e.touches[0].clientX-_.current.x),n=Math.abs(e.touches[0].clientY-_.current.y);(t>10||n>10)&&(clearTimeout(z.current),z.current=null)}},onTouchEnd:()=>{z.current&&(clearTimeout(z.current),z.current=null),_.current=null},onDragOver:D,onDrop:e=>null==w?void 0:w(e,l.date),onContextMenu:e=>E(e,l.date),children:[_t("div",{className:"df-month-date-number-container",children:[Y&&0===s&&"mobile"!==$&&_t("span",{className:"df-month-week-number",children:ee(l.date)}),_t("span",{className:"df-month-date-number","data-today":l.isToday?"true":void 0,"data-other-month":U?void 0:"true",children:1===l.day&&"desktop"===$?l.date.toLocaleDateString(f,{month:"short",day:"numeric"}):l.day})]}),_t("div",{className:"df-month-day-cell-content",children:[le&&_t("div",{className:"df-month-day-cell-overlay-mask",style:{top:17*B+"px",height:`${se}px`}}),ge,W&&_t("div",{className:da("df-month-more-events","df-month-day-cell-more-events"),"data-layout":"desktop"===$?"desktop":"mobile",onClick:e=>{e.stopPropagation(),O?O(l.date):(null==A||A(l.date),null==b||b(x.DAY))},children:["+",ie,"desktop"===$?` ${p}`:""]})]})]},`day-${l.date.getTime()}`);var fe},Ri=h(({currentMonth:e,currentYear:t,newlyCreatedEventId:a,screenSize:r,isScrolling:o,isDragging:i,showWeekNumbers:l,showMonthIndicator:s=!0,item:d,weekHeight:c,events:u,dragState:h,calendarRef:f,onEventUpdate:y,onEventDelete:D,onMoveStart:w,onCreateStart:b,onResizeStart:E,onDetailPanelOpen:C,onMoreEventsClick:T,onChangeView:S,onSelectDate:M,selectedEventId:N,onEventSelect:I,onEventLongPress:k,detailPanelEventId:O,onDetailPanelToggle:R,customDetailPanelContent:H,customEventDetailDialog:A,onCalendarDrop:P,onCalendarDragOver:L,app:$,enableTouch:j,appTimeZone:Y})=>{const{t:F,locale:Z}=Pn(),[z,_]=g(!1),U=v(null),[W,B]=g(null),V=$.canMutateFromUI();m(()=>{V||B(null)},[V]);const q=(e,t)=>{e.preventDefault(),"mobile"!==r&&V&&B({x:e.clientX,y:e.clientY,date:t})},G=p(()=>{const e=c-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}},[c]);m(()=>o?(_(!0),U.current&&(clearTimeout(U.current),U.current=null),()=>{U.current&&(clearTimeout(U.current),U.current=null)}):z?(U.current=setTimeout(()=>{_(!1),U.current=null},100),()=>{U.current&&(clearTimeout(U.current),U.current=null)}):void 0,[o,z]);const{weekData:X}=d,J=X.days.find(e=>1===e.day),Q=`${c}px`,ee=p(()=>Gt(),[]),te=p(()=>io(u,X.startDate,7,Y),[u,X.startDate,Y]),ne=p(()=>((e,t,a)=>{const r=[],o=new Date(t);return o.setDate(o.getDate()+6),o.setHours(23,59,59,999),e.forEach(e=>{if(!e.start||!e.end)return void De.warn("Event missing start or end date:",e);const i=Ne(e.start,a),l=e.end?Ne(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<t&&(a=new Date(t),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<t)continue;const l=n.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})(u,X.startDate,Y),[u,X.startDate,Y]),ae=p(()=>{const e=new Map;return X.days.forEach(t=>{const n=t.date.toDateString();e.set(n,ne.filter(e=>{if(!e.start||!e.end)return Ne(e.start,Y).toDateString()===n;const t=Ne(e.start,Y),a=Ne(e.end,Y);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},[ne,X.days,Y]),re=p(()=>((e,t)=>{const n=t||xn(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})(te,$.state.allDaySortComparator),[te,$.state.allDaySortComparator]),oe=p(()=>re.flat(),[re]),ie=p(()=>{const e=Array.from({length:7}).fill(0);return re.forEach((t,n)=>{t.forEach(t=>{for(let a=t.startDayIndex;a<=t.endDayIndex;a++)e[a]=Math.max(e[a],n+1)})}),e},[re]),le=p(()=>{const e=Array.from({length:7},()=>new Set);return re.forEach((t,n)=>{t.forEach(t=>{for(let a=t.startDayIndex;a<=t.endDayIndex;a++)a>=0&&a<7&&e[a].add(n)})}),e},[re]),se=p(()=>{const{maxSlots:e,maxSlotsWithMore:t}=G,n=X.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:K(e.start)-K(t.start)))(null!==(r=ae.get(n.date.toDateString()))&&void 0!==r?r:[]),l=i.filter(e=>{if(!e.allDay)return!0;return!oe.some(t=>t.originalEventId===e.id)}),s=(null!==(o=ie[a])&&void 0!==o?o:0)-1,d=le[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),g=Math.max(s+1,0)+h,m=g>e;return{totalSlotsNeeded:g,hasMore:m,limit:m?t:e,timedEventsOnly:l,gapLayers:c,occupiedLayers:d,maxOccupiedLayer:s}}),a=new Set;return re.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;oe.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})})},[G,X.days,ae,oe,ie,le,re]),de=p(()=>Math.min(re.length,G.maxSlots),[re.length,G.maxSlots]),ce=p(()=>Math.max(0,17*de),[de]),ue=p(()=>J?J.date.toLocaleDateString(Z,{month:"long",year:"numeric"}):"",[J,Z]);return _t("div",{className:"df-month-week",style:{height:Q},children:[s&&J&&_t("div",{className:"df-month-title","data-visible":z?"true":"false",style:{transition:"opacity 0.5s ease",maxWidth:"fit-content"},onContextMenu:e=>e.preventDefault(),children:_t("span",{className:"df-month-title-label",children:ue})}),_t("div",{className:"df-month-week-inner",children:_t("div",{className:"df-month-week-grid-shell",children:[_t("div",{className:"df-month-week-grid",children:X.days.map((n,o)=>_t(Oi,{app:$,appTimeZone:Y,calendarRef:f,currentMonth:e,currentYear:t,customDetailPanelContent:H,customEventDetailDialog:A,day:n,dayIndex:o,dayLayout:se[o],detailPanelEventId:O,dragState:h,enableTouch:j,hasScrollbarSpace:ee,isDragging:i,locale:Z,moreLabel:F("more"),newlyCreatedEventId:a,onCalendarDragOver:L,onCalendarDrop:P,onChangeView:S,onContextMenu:q,onCreateStart:b,onDetailPanelOpen:C,onDetailPanelToggle:R,onEventDelete:D,onEventLongPress:k,onEventSelect:I,onEventUpdate:y,onMoreEventsClick:T,onMoveStart:w,onResizeStart:E,onSelectDate:M,organizedMultiDaySegments:re,overlayVisibleLayerCount:de,screenSize:r,selectedEventId:N,showWeekNumbers:l,totalSlotsNeeded:se[o].totalSlotsNeeded,weekHeightPx:Q},`day-${n.date.getTime()}`))}),re.length>0&&_t("div",{className:"df-month-week-event-layer",style:{top:"33px",height:`${ce}px`},children:re.slice(0,de).map((e,t)=>_t("div",{className:"df-month-week-event-layer-row",children:e.filter(e=>!se[0].segmentIsHidden.has(e.id)).map(e=>_t(Co,{event:e.event,isAllDay:!0,segment:e,segmentIndex:t,viewType:x.MONTH,isMultiDay:!0,calendarRef:f,hourHeight:72,firstHour:0,onEventUpdate:y,onEventDelete:D,onMoveStart:w,onResizeStart:E,isBeingDragged:i&&h.eventId===e.event.id&&"move"===h.mode,isBeingResized:i&&h.eventId===e.event.id&&"resize"===h.mode,newlyCreatedEventId:a,onDetailPanelOpen:C,selectedEventId:N,onEventSelect:I,onEventLongPress:k,detailPanelEventId:O,onDetailPanelToggle:R,customDetailPanelContent:H,customEventDetailDialog:A,app:$,isMobile:"desktop"!==r,enableTouch:j,appTimeZone:Y},e.id))},`layer-${t}`))})]})}),V&&W&&_t(Qr,{x:W.x,y:W.y,date:W.date,viewType:x.MONTH,onClose:()=>B(null),app:$,onCreateEvent:()=>{if(b){const e={preventDefault:()=>{},stopPropagation:()=>{},clientX:W.x,clientY:W.y};b(e,W.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);Ri.displayName="WeekComponent";const Hi=(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},Ai=(e,t,n,a)=>{const{startDate:r,adjustedEnd:o}=((e,t)=>{const n=Ne(e.start,t),a=e.end?Ne(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=Hi(r,n).getTime(),l=Hi(o,n).getTime(),s=Hi(t,n).getTime();return s>=i&&s<=l},Pi=[],Li=({app:e,config:t,customDetailPanelContent:n,customEventDetailDialog:a,calendarRef:r,selectedEventId:o,onEventSelect:i,detailPanelEventId:l,onDetailPanelToggle:s})=>{var d,c,u;const{getWeekDaysLabels:h,getMonthLabels:D,locale:w}=Pn(),b=e.getCurrentDate(),E=e.getEvents(),C=null!==(d=t.startOfWeek)&&void 0!==d?d:1,T=e.timeZone,S=!0===(null===(c=t.scroll)||void 0===c?void 0:c.disabled),M=S&&"fade"===(null===(u=t.scroll)||void 0===u?void 0:u.transition),[N,I]=g(b),[k,O]=g(!1),[A,P]=g("forward"),L=v(b),$=v(null),j=b.getFullYear(),Y=b.getMonth();m(()=>{if(!M)return;if(j===L.current.getFullYear()&&Y===L.current.getMonth())return;const e=b>L.current;return L.current=b,P(e?"forward":"backward"),$.current&&clearTimeout($.current),O(!0),$.current=setTimeout(()=>{I(b),O(!1)},300),()=>{$.current&&clearTimeout($.current)}},[j,Y,M]);const F=p(()=>M?((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(ot(t))}return o})(N,C):[],[M,N,C]),Z=p(()=>({opacity:k?0:1,transform:k?`translateX(${"forward"===A?"-6%":"6%"})`:"translateX(0)",transition:"opacity 300ms ease, transform 300ms ease"}),[k,A]),z=e.getCalendars().map(e=>e.id+e.colors.lineColor).join("-"),_=v(null),U=p(()=>{const e=_.current;return e&&e.length===E.length&&e.every((e,t)=>e===E[t])?e:(_.current=E,E)},[E]),W=p(()=>{const e=new Map,t=e=>{const t=new Date(e);t.setHours(0,0,0,0);const n=(t.getDay()-C+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 U.forEach(e=>{if(!e.start)return;const a=Ne(e.start,T),r=e.end?Ne(e.end,T):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},[U,C,T]),{screenSize:B}=Hn(),[V,q]=g(!1);m(()=>{q("ontouchstart"in window||navigator.maxTouchPoints>0)},[]);const G=e.getCustomMobileEventRenderer()||Nr,[K,X]=g(()=>{if("undefined"==typeof window)return 119;const e=window.innerHeight-150;return Math.max(80,Math.ceil(e/6))}),[J,Q]=g(()=>"undefined"!=typeof window),ee=v(K),te=v([]),[ne,ae]=g(null),[re,oe]=g(!1),[ie,le]=g(null),[se,de]=g(null),[ce,ue]=g(null),he=void 0===o?se:o,ge=void 0===l?ce:l,me=f(e=>{i?i(e):de(e)},[i]),ve=f(e=>{s?s(e):ue(e)},[s]),fe=v(e.state.highlightedEventId);m(()=>{e.state.highlightedEventId?me(e.state.highlightedEventId):fe.current&&me(null),fe.current=e.state.highlightedEventId},[e.state.highlightedEventId]);const pe=p(()=>{const e=(b.getDay()-C+7)%7,t=new Date(b);return t.setDate(b.getDate()-e),t.setHours(0,0,0,0),t},[b,C]),{handleMoveStart:ye,handleCreateStart:De,handleResizeStart:we,dragState:be,isDragging:Ee}=fi(e,{calendarRef:r,viewType:x.MONTH,onEventsUpdate:(t,n,a)=>{const r=t(U),o=new Set(r.map(e=>e.id)),i=U.filter(e=>!o.has(e.id)),l=new Set(U.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=U.find(t=>t.id===e.id);return t&&Tt(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"===B?e.addEvent(t):(le(t),oe(!0))},onEventEdit:e=>{ae(e.id)},currentWeekStart:pe,events:U,isMobile:"desktop"!==B}),Ce=be,{handleDrop:Te,handleDragOver:Se}=hi({app:e,onEventCreated:e=>{ae(e.id)}}),Me=p(()=>h(w,"short",C),[w,h,C]),Ie=p(()=>{if(!Ee||!Ce.eventId||!Ce.startDate||!Ce.endDate||"move"!==Ce.mode&&"resize"!==Ce.mode)return null;const e=U.find(e=>e.id===Ce.eventId);return e?Object.assign(Object.assign({},e),{start:e.allDay?ke(Ce.startDate):Oe(Ce.startDate,T),end:e.allDay?ke(Ce.endDate):Oe(Ce.endDate,T)}):null},[Ee,Ce.eventId,Ce.startDate,Ce.endDate,Ce.mode,U,T]),xe=f(e=>{var t;const n=null!==(t=W.get(e.getTime()))&&void 0!==t?t:Pi;if(!Ie)return n;const a=n.some(e=>e.id===Ie.id),r=Ai(Ie,e,C,T);if(!a&&!r)return n;const o=n.filter(e=>e.id!==Ie.id);return r&&o.push(Ie),o},[W,Ie,C,T]),{currentMonth:Re,currentYear:He,isScrolling:Ae,virtualData:Pe,weeksData:Le,scrollElementRef:$e,isNavigating:je,handleScroll:Ye,handlePreviousMonth:Fe,handleNextMonth:Ze,handleToday:ze,setScrollTop:_e}=(({currentDate:e,weekHeight:t,onCurrentMonthChange:n,initialWeeksToLoad:a=104,locale:r="en-US",startOfWeek:o=1,isEnabled:i=!0,snapToMonth:l=!1})=>{const s=v(null),d=f((e,t)=>{const n=new Date(t,e,1),a=r.startsWith("zh")||r.startsWith("ja");return n.toLocaleDateString(r,{month:a?"short":"long"})},[r]),c=p(()=>{const t=new Date(e);return t.setDate(1),t.setHours(0,0,0,0),lt(t,a,o)},[e,a,o]),u=p(()=>{const n=new Date(e);n.setDate(1),n.setHours(0,0,0,0);const a=c.findIndex(e=>e.days.some(e=>e.date.toDateString()===n.toDateString()));return a>0?a*t:0},[c,e,t]),[h,D]=g(u),[w,b]=g(600),[E,C]=g(d(e.getMonth(),e.getFullYear())),[T,S]=g(e.getFullYear()),[M,N]=g(!1),[I,k]=g(c),[x,O]=g(!1),A=v(!1),[P,L]=g(!1),$=v(e),j=v(null),Y=v(null),F=v(new H),Z=v(0),z=v(0),_=v(!1),U=f(e=>{e&&(j.current=e)},[]),W=f(e=>{let t=F.current.get(e);return t||(t=ot(e),F.current.set(e,t)),t},[]),B=f((e,n=26)=>{_.current||(_.current=!0,setTimeout(()=>{try{if("future"===e){const e=I.at(-1),t=[];for(let a=1;a<=n;a++){const n=new Date(e.startDate);n.setDate(n.getDate()+7*a),t.push(W(n))}k(e=>[...e,...t])}else{const e=I[0],a=[];for(let t=n;t>=1;t--){const n=new Date(e.startDate);n.setDate(n.getDate()-7*t),a.push(W(n))}const r=a.length*t;k(e=>[...a,...e]),requestAnimationFrame(()=>{D(e=>e+r),j.current&&(j.current.scrollTop+=r)})}}finally{setTimeout(()=>{_.current=!1},200)}},0))},[I,W,t]),V=p(()=>{const e=I.length*t,n=Math.floor(h/t);let a=Math.max(0,n);a=Math.min(a,Math.max(0,I.length-6));const r=Math.min(I.length-1,a+6-1),o=Math.max(0,a-15),i=Math.min(I.length-1,r+15),l=[];for(let e=o;e<=i;e++)l.push({index:e,weekData:I[e],top:e*t,height:t});return{totalHeight:e,visibleItems:l,displayStartIndex:a}},[h,w,t,I]),q=f(e=>{if(x||M||0===e.length||!P)return;const t=h+w/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=`${d(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&&(s.current?o===s.current.month&&i===s.current.year&&(s.current=null,o===E&&i===T||(C(o),S(i),null==n||n(o,i))):o===E&&i===T||(C(o),S(i),null==n||n(o,i)))},[w,E,T,x,M,n,h,P]),G=f(e=>{const n=performance.now();if(n-Z.current<R.SCROLL_THROTTLE)return;Z.current=n;const a=e.currentTarget,r=a.scrollTop;z.current=r,D(r),x||requestAnimationFrame(()=>{const{scrollHeight:e,clientHeight:n}=a;r+n>e-10*t&&!_.current&&B("future",26),r<10*t&&!_.current&&B("past",26)}),N(!0),Y.current&&clearTimeout(Y.current),Y.current=setTimeout(()=>{N(!1)},R.SCROLL_DEBOUNCE)},[t,B,x]),K=f((e,n=!0)=>{if(!j.current)return;O(!0),A.current=!0;const a=()=>{setTimeout(()=>{O(!1),A.current=!1},n?500:200)},r=I.findIndex(t=>t.days.some(t=>t.date.toDateString()===e.toDateString()));if(-1!==r){const e=r*t;return j.current.scrollTo({top:e,behavior:n?"smooth":"auto"}),void a()}const i=(e.getDay()-o+7)%7,l=new Date(e);l.setDate(e.getDate()-i),l.setHours(0,0,0,0);const s=I[0],d=I.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 g=Math.min(c+10,52);if(u){const r=[];for(let e=g;e>=1;e--){const t=new Date(s.startDate);t.setDate(t.getDate()-7*e),r.push(W(t))}const o=r.length*t;k(e=>[...r,...e]),requestAnimationFrame(()=>{const i=[...r,...I].findIndex(t=>t.days.some(t=>t.date.toDateString()===e.toDateString()));if(j.current&&-1!==i){const e=i*t;j.current.scrollTop+=o,D(e=>e+o),setTimeout(()=>{j.current&&j.current.scrollTo({top:e,behavior:n?"smooth":"auto"})},50)}a()})}else if(h){const r=[];for(let e=1;e<=g;e++){const t=new Date(d.startDate);t.setDate(t.getDate()+7*e),r.push(W(t))}k(e=>[...e,...r]),requestAnimationFrame(()=>{const o=[...I,...r].findIndex(t=>t.days.some(t=>t.date.toDateString()===e.toDateString()));if(j.current&&-1!==o){const e=o*t;j.current.scrollTo({top:e,behavior:n?"smooth":"auto"})}a()})}else a()},[I,t,W]),X=f(()=>{var e;const t=V.displayStartIndex,n=Math.min(I.length-1,t+5),a={};for(let r=t;r<=n;r++)null===(e=I[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);K(l)},[V.displayStartIndex,I,K]),J=f(()=>{var e;const t=V.displayStartIndex,n=Math.min(I.length-1,t+5),a={};for(let r=t;r<=n;r++)null===(e=I[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);K(l)},[V.displayStartIndex,I,K]),Q=f(()=>{const e=new Date,a=d(e.getMonth(),e.getFullYear()),r=e.getFullYear(),o=new Date(r,e.getMonth(),1);s.current={month:a,year:r},C(a),S(r),null==n||n(a,r);const i=I.findIndex(e=>e.days.some(e=>e.date.toDateString()===o.toDateString()));if(-1===i)O(!0),A.current=!0,requestAnimationFrame(()=>{K(o,!0),setTimeout(()=>{A.current=!1,O(!1)},200)});else{const e=i*t,n=j.current;n&&(O(!0),A.current=!0,requestAnimationFrame(()=>{D(e),requestAnimationFrame(()=>{n&&(n.scrollTop=e,setTimeout(()=>{A.current=!1,O(!1)},200))})}))}},[I,t,n,K]);return m(()=>{q(V.visibleItems)},[V.visibleItems,q]),m(()=>{const t=$.current,a=t.getMonth(),r=t.getFullYear(),o=e.getMonth(),i=e.getFullYear();if(a!==o||r!==i){const e=6,t=V.displayStartIndex,a=Math.min(I.length-1,t+e-1),r={};for(let e=t;e<=a;e++){const t=I[e];t&&t.days.forEach(e=>{const t=`${e.month}-${e.year}`;r[t]=(r[t]||0)+1})}let l="",c=0;for(const[e,t]of Object.entries(r))t>c&&(c=t,l=e);if(l!==`${o}-${i}`){const e=new Date(i,o,1),t=d(o,i);s.current={month:t,year:i},C(t),S(i),null==n||n(t,i),K(e,!0)}}$.current=e},[e,n,K,V,I,d]),m(()=>{const e=j.current;if(!e)return;const t=new ResizeObserver(([e])=>{b(e.contentRect.height)});return t.observe(e),()=>t.disconnect()},[]),y(()=>{const e=j.current;e&&!P&&i&&(u>0&&(e.scrollTop=u),L(!0))},[P,u,i]),m(()=>{var e;if(!l||M||x||!P)return;const n=Math.floor(h/t),a=Math.min(I.length-1,n+5),r={};for(let t=n;t<=a;t++)null===(e=I[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,s=0;for(const[e,t]of Object.entries(r))t>s&&(s=t,[o,i]=e.split("-").map(Number));const d=new Date(i,o,1),c=I.findIndex(e=>e.days.some(e=>e.date.toDateString()===d.toDateString()));if(-1===c)return;const u=c*t;if(Math.abs(u-h)>5){const e=setTimeout(()=>{K(d,!0)},200);return()=>clearTimeout(e)}},[M,l,x,P,h,t,I,K]),m(()=>()=>{Y.current&&clearTimeout(Y.current)},[]),{scrollTop:h,containerHeight:w,currentMonth:E,currentYear:T,isScrolling:M,isNavigating:x,virtualData:V,scrollElementRef:j,handleScroll:G,scrollToDate:K,handlePreviousMonth:X,handleNextMonth:J,handleToday:Q,setScrollTop:D,setContainerHeight:b,setCurrentMonth:C,setCurrentYear:S,setIsScrolling:N,cache:F.current,scrollElementRefCallback:U,weeksData:I}})({currentDate:b,weekHeight:K,onCurrentMonthChange:(t,n)=>{const a=w.startsWith("zh")||w.startsWith("ja"),r=D(w,a?"short":"long").indexOf(t);r>=0&&e.setVisibleMonth(new Date(n,r,1))},initialWeeksToLoad:156,locale:w,startOfWeek:C,isEnabled:J,snapToMonth:t.snapToMonth}),Ue=v(0),[We,Be]=g(0),Ve=p(()=>We-6*K,[We,K]),{visibleWeeks:qe,startIndex:Ge}=p(()=>{var e,t;const{visibleItems:n,displayStartIndex:a}=Pe,r=n.findIndex(e=>e.index===a);if(-1===r)return te.current.length>0?{visibleWeeks:te.current,startIndex:Ue.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&&(te.current=i,Ue.current=l),{visibleWeeks:i,startIndex:l}},[Pe]),Ke=p(()=>Ge*K,[Ge,K]),Xe=v(!0),Je=v(!1),Qe=((e,t)=>{const[n,a]=g(e);return m(()=>{const n=setTimeout(()=>{a(e)},t);return()=>{clearTimeout(n)}},[e,t]),n})(Pe.displayStartIndex,250);m(()=>{je&&(Je.current=!0)},[je]),m(()=>{if(Xe.current)return void(Xe.current=!1);const t=Le[Qe];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,Je.current?"navigation":"scroll"),Je.current=!1},[e,Le,Qe]);const et=p(()=>{const e=Pe.totalHeight,t=Ge*K+qe.length*K+Ve;return Math.max(0,e-t)},[Pe.totalHeight,Ge,K,Ve,qe.length]);m(()=>{const e=$e.current;if(!e)return;const t=new ResizeObserver(t=>{for(const n of t){const t=n.contentRect.height;if(Be(t),t>0){const n=Math.max(80,Math.ceil(t/6));if(n!==ee.current){const t=e.scrollTop;if(t>0){const a=Math.round(t/ee.current)*n;e.scrollTop=a,_e(a)}X(n),ee.current=n}}}});return t.observe(e),()=>{t.disconnect()}},[$e,_e]),y(()=>{const e=window.innerHeight-150,t=Math.max(80,Math.ceil(e/6));X(t),ee.current=t,Q(!0)},[]),m(()=>{if(M||!S)return;const e=$e.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)}},[M,S,$e]);const tt=f(t=>e.updateEvent(t.id,t),[e]),nt=f(t=>e.deleteEvent(t),[e]),at=t=>{e.changeView(t)},rt=f(()=>ae(null),[]),it=f(t=>{const n=e.getReadOnlyConfig().viewable;if(("desktop"!==B||V)&&t&&n){const e=U.find(e=>e.id===t);if(e)return le(e),void oe(!0)}me(t)},[B,V,U,me,e]),st=f(e=>{("desktop"!==B||V)&&me(e)},[B,V,me]);return _t("div",{className:Ln,children:[_t(So,{calendar:e,viewType:x.MONTH,currentDate:b,customTitle:(()=>{const e=w.startsWith("zh")||w.startsWith("ja");if(M){const t=D(w,e?"short":"long")[N.getMonth()],n=N.getFullYear();return e?`${n}年${t}`:`${t} ${n}`}return e?`${He}年${Re}`:`${Re} ${He}`})(),onPrevious:()=>{e.goToPrevious(),M||Fe()},onNext:()=>{e.goToNext(),M||Ze()},onToday:()=>{e.goToToday(),M||ze()}}),_t("div",{className:"df-week-header-row",onContextMenu:e=>e.preventDefault(),children:_t("div",{className:"df-week-grid",children:Me.map((e,t)=>_t("div",{className:"df-day-label",children:e},`${e}-${t}`))})}),_t("div",M?{ref:$e,className:`${Fn} df-month-view-fade-scroller`,"data-layout-ready":J?"true":"false",children:_t("div",{className:"df-month-view-fade-body",style:Z,children:F.map((o,i)=>{const l=xe(o.startDate),s={index:i,weekData:o,top:i*K,height:K},d=5===i?Object.assign(Object.assign({},s),{height:s.height+Ve}):s;return _t(Ri,{item:d,weekHeight:K,showWeekNumbers:t.showWeekNumbers,showMonthIndicator:!1,currentMonth:"",currentYear:0,screenSize:B,isScrolling:!1,calendarRef:r,events:l,onEventUpdate:tt,onEventDelete:nt,onMoveStart:ye,onCreateStart:De,onResizeStart:we,isDragging:Ee,dragState:Ce,newlyCreatedEventId:ne,onDetailPanelOpen:rt,onMoreEventsClick:e.onMoreEventsClick,onChangeView:at,onSelectDate:e.selectDate,selectedEventId:he,onEventSelect:it,onEventLongPress:st,detailPanelEventId:ge,onDetailPanelToggle:ve,customDetailPanelContent:n,customEventDetailDialog:a,onCalendarDrop:Te,onCalendarDragOver:Se,calendarSignature:z,app:e,enableTouch:V,appTimeZone:T},`week-${o.startDate.getTime()}`)})})}:{ref:$e,className:`${Fn} df-month-view-virtual-scroller`,"data-layout-ready":J?"true":"false",onScroll:Ye,children:[_t("div",{style:{height:Ke}}),qe.map((o,i)=>{const l=xe(o.weekData.startDate),s=5===i?Object.assign(Object.assign({},o),{height:o.height+Ve}):o,d=!(!1===t.showMonthIndicator||!o.weekData.days.some(e=>1===e.day))&&Ae;return _t(Ri,{item:s,weekHeight:K,showWeekNumbers:t.showWeekNumbers,showMonthIndicator:t.showMonthIndicator,currentMonth:Re,currentYear:He,screenSize:B,isScrolling:d,calendarRef:r,events:l,onEventUpdate:tt,onEventDelete:nt,onMoveStart:ye,onCreateStart:De,onResizeStart:we,isDragging:Ee,dragState:Ce,newlyCreatedEventId:ne,onDetailPanelOpen:rt,onMoreEventsClick:e.onMoreEventsClick,onChangeView:at,onSelectDate:e.selectDate,selectedEventId:he,onEventSelect:it,onEventLongPress:st,detailPanelEventId:ge,onDetailPanelToggle:ve,customDetailPanelContent:n,customEventDetailDialog:a,onCalendarDrop:Te,onCalendarDragOver:Se,calendarSignature:z,app:e,enableTouch:V,appTimeZone:T},`week-${o.weekData.startDate.getTime()}`)}),_t("div",{style:{height:et}})]}),_t(G,{isOpen:re,onClose:()=>{oe(!1),le(null)},onSave:t=>{U.some(e=>e.id===t.id)?e.updateEvent(t.id,t):e.addEvent(t),oe(!1),le(null)},draftEvent:ie,app:e})]})},$i={showWeekNumbers:!1,showMonthIndicator:!0,startOfWeek:1},ji=e=>i(yi,Object.assign(Object.assign({},e),{viewType:x.MONTH,originalComponent:Li,className:"df-month-view-factory"}));ji.displayName="MonthViewAdapter";const Yi=(e={})=>{const t=Object.assign(Object.assign({},$i),e);return{type:x.MONTH,component:ji,config:t}};function Fi(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=Ne(e.start,r),n=e.end?Ne(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=xn(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 Zi=(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=Ne(e.start,a),l=e.end?Ne(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 zi(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=Ne(e.start,r),n=e.end?Ne(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=xn(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=[],g=[];c.forEach(({event:e,startMs:a,endMs:r,eventStartDay:o,eventEndDay:i})=>{const c=Math.max(a,s),u=Math.min(r,d),m=new Date(c).getDate(),v=new Date(u).getDate(),f=l+(m-1),p=l+(v-1),y=o.getMonth()===t&&o.getFullYear()===n,D=i.getMonth()===t&&i.getFullYear()===n;let w=0;for(;;){g[w]||(g[w]=[]);let e=!1;for(let t=f;t<=p;t++)if(g[w][t]){e=!0;break}if(!e){for(let e=f;e<=p;e++)g[w][e]=!0;break}w++}h.push({id:`${e.id}::month-${t}`,event:e,startCellIndex:f,endCellIndex:p,isFirstSegment:y,isLastSegment:D,visualRowIndex:w,monthIndex:t})});const m=h.length>0?Math.max(...h.map(e=>e.visualRowIndex)):-1;return{segments:h,maxVisualRow:m}}const _i=h(({date:e,isToday:t,locale:n,onSelectDate:a,onCreateStart:r,onMoreEventsClick:o,moreCount:i=0,onContextMenu:l})=>{const{t:s}=Pn(),d=e.getDate(),c=1===d,u=e.toLocaleDateString(n,{month:"short"}).toUpperCase();return _t("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:[_t("div",{className:"df-year-day-cell-header",children:[c&&_t("span",{className:"df-year-day-cell-month-pill",children:u}),_t("span",{className:"df-year-day-cell-date","data-today":t?"true":"false",children:d})]}),i>0&&_t("div",{className:"df-year-day-cell-more-wrap",children:_t("span",{className:"df-year-day-cell-more",onClick:t=>{t.stopPropagation(),null==o||o(e)},children:["+",i," ",s("more")]})})]})});_i.displayName="YearDayCell";const Ui=(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=Ne(e.start,n),s=e.end?Ne(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},Wi=h(({rowDays:e,events:t,columnsPerRow:n,app:a,calendarRef:r,locale:o,isDragging:i,dragState:l,onMoveStart:s,onResizeStart:d,onCreateStart:c,selectedEventId:u,onEventSelect:h,onMoreEventsClick:g,newlyCreatedEventId:m,onDetailPanelOpen:v,detailPanelEventId:y,onDetailPanelToggle:D,customDetailPanelContent:w,customEventDetailDialog:b,onContextMenu:E,appTimeZone:C,dragPreviewEvent:T})=>{const S=p(()=>{const e=Ve(C);return e.setHours(0,0,0,0),e},[C]),M=f((e,t)=>{e.preventDefault(),e.stopPropagation(),E({x:e.clientX,y:e.clientY,date:t})},[E]),N=f(e=>{a.selectDate(e)},[a]),I=p(()=>Fi(t,e,n,a.state.allDaySortComparator,C),[t,e,n,a.state.allDaySortComparator,C]),k=i&&"move"===l.mode&&!!T&&T.id===l.eventId,O=p(()=>{if(!T)return I;if(k)return I;const r=t.filter(e=>e.id!==T.id);return Ui(T,e,C)&&r.push(T),Fi(r,e,n,a.state.allDaySortComparator,C)},[T,k,I,t,e,n,a.state.allDaySortComparator,C]),R=p(()=>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=Ne(e.start,a),d=e.end?Ne(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),g=Math.round((Math.min(u,l)-i)/864e5);return h=Math.max(0,Math.min(h,n-1)),g=Math.max(0,Math.min(g,n-1)),{id:`${e.id}::preview-year-${i}`,event:e,startCellIndex:h,endCellIndex:g,isFirstSegment:c>=i,isLastSegment:u<=l,visualRowIndex:0}})(T,e,n,C):null,[k,T,e,n,C]),{visibleSegments:H,moreCounts:A}=p(()=>{const t=Array.from({length:e.length}).fill(0);O.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 O.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}},[O,e.length]),P=p(()=>{if(!k||!l.eventId)return O;const e=O.filter(e=>e.event.id!==l.eventId);return R?[...e,R]:e},[k,l.eventId,O,R]);return _t("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()===S.getTime();return _t(_i,{date:e,isToday:n,locale:o,onSelectDate:N,onCreateStart:c,onMoreEventsClick:g,moreCount:A[t],onContextMenu:M},e.getTime())}),_t("div",{className:"df-year-row-event-layer",style:{top:26,bottom:0,left:0,right:0},onContextMenu:e=>e.preventDefault(),children:_t("div",{className:"df-year-row-event-layer-inner",children:(k&&l.eventId?P.filter(e=>H.some(t=>t.id===e.id)||e.id===(null==R?void 0:R.id)):H).map(e=>_t("div",{className:"df-year-row-event-hitbox",children:_t(Co,{event:e.event,isAllDay:!!e.event.allDay,viewType:x.YEAR,yearSegment:e,columnsPerRow:n,isBeingDragged:i&&l.eventId===e.event.id,selectedEventId:u,onMoveStart:s,onResizeStart:d,onEventSelect:h,onDetailPanelToggle:D,newlyCreatedEventId:m,onDetailPanelOpen:v,calendarRef:r,app:a,detailPanelEventId:y,customDetailPanelContent:w,customEventDetailDialog:b,firstHour:0,hourHeight:0,onEventUpdate:e=>a.updateEvent(e.id,e),onEventDelete:e=>a.deleteEvent(e),appTimeZone:C})},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=Ui(e.dragPreviewEvent,e.rowDays,e.appTimeZone),s=Ui(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)});Wi.displayName="YearRowComponent";const Bi=({app:e,calendarRef:t,customDetailPanelContent:a,customEventDetailDialog:r,config:o,selectedEventId:i,onEventSelect:l,detailPanelEventId:s,onDetailPanelToggle:d})=>{var c;const{t:u,locale:h}=Pn(),D=e.getCurrentDate(),w=D.getFullYear(),b=e.getEvents(),E=e.timeZone,C=v(null),[T,S]=g(7),[M,N]=g(!1),[I,k]=g(()=>"undefined"!=typeof window&&window.innerWidth<768),[O,R]=g(null),[H,A]=g(null),P=void 0===i?O:i,L=void 0===s?H:s,[$,j]=g(null),Y=f(e=>{l?l(e):R(e)},[l]),F=f(e=>{d?d(e):A(e)},[d]),Z=f(()=>{j(null)},[]),[z,_]=g(null),U=e.canMutateFromUI();m(()=>{U||_(null)},[U]),m(()=>{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||(Y(null),F(null),_(null))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const W=v(null);y(()=>{const e=C.current;if(!e)return;const t=e=>{if(e<=0)return;const t=Math.max(1,Math.floor(e/80));S(t),k(e<768),N(!0)};t(e.clientWidth);const n=new ResizeObserver(e=>{W.current&&clearTimeout(W.current),W.current=setTimeout(()=>{const n=e[0].contentRect.width;t(n)},60)});return n.observe(e),()=>{n.disconnect(),W.current&&clearTimeout(W.current)}},[]);const B=v(e.state.highlightedEventId);m(()=>{e.state.highlightedEventId?(Y(e.state.highlightedEventId),requestAnimationFrame(()=>{const t=C.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"})})):B.current&&Y(null),B.current=e.state.highlightedEventId},[e.state.highlightedEventId]);const{handleMoveStart:V,handleResizeStart:q,handleCreateStart:G,dragState:K,isDragging:X}=fi(e,{calendarRef:t,viewType:x.YEAR,onEventsUpdate:(t,n,a)=>{const r=t(b).filter(e=>{const t=b.find(t=>t.id===e.id);return t&&Tt(t,e)});r.length>0&&e.applyEventsChanges({update:r.map(e=>({id:e.id,updates:e}))},n,a)},currentWeekStart:new Date,events:b,onEventCreate:t=>{e.addEvent(t)},onEventEdit:e=>{j(e.id)},isMobile:I}),J=K,Q=null!==(c=null==o?void 0:o.showTimedEventsInYearView)&&void 0!==c&&c,ee=f((t,a)=>{if(Q)null==G||G(t,a);else{const t=n.PlainDate.from({year:a.getFullYear(),month:a.getMonth()+1,day:a.getDate()}),r={id:`event-${Date.now()}`,title:u("newEvent")||"New Event",start:t,end:t,allDay:!0,calendarId:e.getCalendarRegistry().getDefaultCalendarId()||"default"};e.addEvent(r),j(r.id)}},[Q,G,e,u]),te=p(()=>{const e=[],t=new Date(w,0,1),n=new Date(w,11,31);for(let a=t.getTime();a<=n.getTime();a+=864e5)e.push(new Date(a));return e},[w]),ne=p(()=>function(e,t){const n=[];for(let a=0;a<e.length;a+=t)n.push(e.slice(a,a+t));return n}(te,T),[te,T]),ae=p(()=>{const e=new Date(w,0,1),t=new Date(w,11,31,23,59,59);return b.filter(n=>{if(!n.start)return!1;if(!Q&&!n.allDay)return!1;const a=Ne(n.start,E),r=n.end?Ne(n.end,E):a;return a<=t&&r>=e})},[b,w,Q,E]),re=p(()=>{const e=ae.map(e=>{const t=Ne(e.start,E),n=e.end?Ne(e.end,E):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 ne.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)})},[ne,ae,E]),oe=p(()=>{if(!X||!J.eventId||!J.startDate||!J.endDate||"move"!==J.mode&&"resize"!==J.mode)return null;const e=ae.find(e=>e.id===J.eventId);return e?Object.assign(Object.assign({},e),{start:e.allDay?ke(J.startDate):Oe(J.startDate,E),end:e.allDay?ke(J.endDate):Oe(J.endDate,E)}):null},[X,J.eventId,J.startDate,J.endDate,J.mode,ae,E]);return _t("div",{className:Ln,onContextMenu:e=>e.preventDefault(),children:[_t(So,{calendar:e,viewType:x.YEAR,currentDate:D,customTitle:h.startsWith("zh")||h.startsWith("ja")?`${w}年`:`${w}`,onPrevious:()=>{const t=new Date(D);t.setFullYear(t.getFullYear()-1),e.setCurrentDate(t)},onNext:()=>{const t=new Date(D);t.setFullYear(t.getFullYear()+1),e.setCurrentDate(t)},onToday:()=>{e.goToToday()}}),_t("div",{ref:C,className:`df-year-default-scroll ${Fn} df-scrollbar-hide`,children:_t("div",{className:"df-year-default-rows",style:{opacity:M?1:0,transition:"opacity 0.2s ease"},children:ne.map((n,o)=>_t(Wi,{rowDays:n,events:re[o],columnsPerRow:T,app:e,calendarRef:t,locale:h,isDragging:X,dragState:J,dragPreviewEvent:oe,onMoveStart:V,onResizeStart:q,onCreateStart:ee,selectedEventId:P,onEventSelect:Y,onMoreEventsClick:e.onMoreEventsClick,newlyCreatedEventId:$,onDetailPanelOpen:Z,detailPanelEventId:L,onDetailPanelToggle:F,customDetailPanelContent:a,customEventDetailDialog:r,onContextMenu:e=>{U&&_(e)},appTimeZone:E},o))})}),U&&z&&_t(Qr,{x:z.x,y:z.y,date:z.date,viewType:x.YEAR,onClose:()=>_(null),app:e,onCreateEvent:()=>{if(z&&z.date){const e={preventDefault:()=>{},stopPropagation:()=>{},clientX:z.x,clientY:z.y};ee(e,z.date)}}})]})},Vi=({app:e,calendarRef:t,customDetailPanelContent:a,customEventDetailDialog:r,config:o,selectedEventId:i,onEventSelect:l,detailPanelEventId:s,onDetailPanelToggle:d})=>{var c,u;const{t:h,locale:y,getWeekDaysLabels:D}=Pn(),w=e.getCurrentDate(),b=w.getFullYear(),E=e.getEvents(),C=e.timeZone,T=Ve(C);T.setHours(0,0,0,0);const S=null!==(c=null==o?void 0:o.startOfWeek)&&void 0!==c?c:1,M=v(null),N=v(null),I=v(null),[k,O]=g(0),[R,H]=g(0),[A,P]=g(null),[L,$]=g(null),j=p(()=>Gt(),[]),Y=void 0===i?A:i,F=void 0===s?L:s,Z=e=>{l?l(e):P(e)},z=e=>{d?d(e):$(e)},[_,U]=g(null),[W,B]=g(null),V=e.canMutateFromUI();m(()=>{V||B(null)},[V]),m(()=>{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||(Z(null),z(null))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const q=v(e.state.highlightedEventId);m(()=>{e.state.highlightedEventId?(Z(e.state.highlightedEventId),requestAnimationFrame(()=>{const t=I.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"})})):q.current&&Z(null),q.current=e.state.highlightedEventId},[e.state.highlightedEventId]);const G=p(()=>((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})(b,S),[b,S]),{handleMoveStart:K,handleResizeStart:X,handleCreateStart:J,dragState:Q,isDragging:ee}=fi(e,{calendarRef:t,viewType:x.YEAR,onEventsUpdate:(t,n,a)=>{const r=t(E).filter(e=>{const t=E.find(t=>t.id===e.id);return t&&Tt(t,e)});r.length>0&&e.applyEventsChanges({update:r.map(e=>({id:e.id,updates:e}))},n,a)},currentWeekStart:new Date,events:E,onEventCreate:t=>{e.addEvent(t)},onEventEdit:e=>{U(e.id)}}),te=Q,ne=null!==(u=null==o?void 0:o.showTimedEventsInYearView)&&void 0!==u&&u,ae=f((t,a)=>{if(ne)null==J||J(t,a);else{const t=n.PlainDate.from({year:a.getFullYear(),month:a.getMonth()+1,day:a.getDate()}),r={id:`event-${Date.now()}`,title:h("newEvent")||"New Event",start:t,end:t,allDay:!0};e.addEvent(r),U(r.id)}},[ne,J,e,h]),re=p(()=>(({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:y,totalColumns:G,startOfWeek:S,getWeekDaysLabels:D}),[y,G,S,D]),oe=p(()=>{const e=new Date(b,0,1),t=new Date(b,11,31,23,59,59);return E.filter(n=>{if(!n.start)return!1;if(!ne&&!n.allDay)return!1;const a=Ne(n.start,C),r=n.end?Ne(n.end,C):a;return a<=t&&r>=e})},[E,b,ne,C]),ie=p(()=>(({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"}),g=h.charAt(0).toUpperCase()+h.slice(1).toLowerCase(),{segments:m,maxVisualRow:v}=zi(a,l,e,r,o),f=v+1,p=Math.max(60,20+18*f);i.push({monthIndex:l,monthName:g,days:u,monthEvents:a.filter(t=>Zi(t,e,l,o)),eventSegments:m,minHeight:p})}return i})({currentYear:b,locale:y,totalColumns:G,yearEvents:oe,startOfWeek:S,appTimeZone:C}),[b,y,G,oe,S,C]),le=p(()=>(({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?ke(t.startDate):Oe(t.startDate,a),end:r.allDay?ke(t.endDate):Oe(t.endDate,a)}):null})({isDragging:ee,dragState:te,yearEvents:oe,appTimeZone:C}),[ee,te,oe,C]),se=ee&&"move"===te.mode&&!!le&&le.id===te.eventId,de=p(()=>(({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)&&!Zi(t,a,e.monthIndex,o))return e;const i=e.monthEvents.filter(e=>e.id!==(null==t?void 0:t.id));t&&Zi(t,a,e.monthIndex,o)&&i.push(t);const{segments:l,maxVisualRow:s}=zi(i,e.monthIndex,a,r,o);return Object.assign(Object.assign({},e),{eventSegments:l,minHeight:Math.max(60,20+18*(s+1))})}))({monthsData:ie,dragPreviewEvent:le,isMovePreviewActive:se,currentYear:b,startOfWeek:S,appTimeZone:C}),[ie,le,se,b,S,C]),ce=f(e=>{const t=e.currentTarget;M.current&&(M.current.scrollLeft=t.scrollLeft),N.current&&(N.current.scrollTop=t.scrollTop)},[]);m(()=>{const e=()=>{if(I.current){const e=I.current,t=e.offsetHeight-e.clientHeight,n=e.offsetWidth-e.clientWidth;H(e=>e===t?e:t),O(e=>e===n?e:n)}},t=I.current;if(!t)return;e();const n=new ResizeObserver(()=>{e()});return n.observe(t),()=>{n.disconnect()}},[de]);return _t("div",{className:"df-year-fixed",onContextMenu:e=>e.preventDefault(),children:[_t("div",{className:"df-year-fixed-header-span",children:_t(So,{calendar:e,viewType:x.YEAR,currentDate:w,customTitle:y.startsWith("zh")||y.startsWith("ja")?`${b}年`:`${b}`,onPrevious:()=>{const t=new Date(w);t.setFullYear(t.getFullYear()-1),e.setCurrentDate(t)},onNext:()=>{const t=new Date(w);t.setFullYear(t.getFullYear()+1),e.setCurrentDate(t)},onToday:()=>{e.goToToday()}})}),_t("div",{className:"df-year-fixed-corner"}),_t("div",{ref:M,className:"df-year-fixed-week-header",children:_t("div",{className:"df-year-fixed-week-header-inner",style:{minWidth:`calc(1352px + ${k}px)`},children:[_t("div",{className:"df-year-fixed-week-grid",style:{gridTemplateColumns:`repeat(${G}, minmax(0, 1fr))`,minWidth:"1352px"},children:re.map((e,t)=>{const n=(t+S)%7;return _t("div",{className:"df-year-fixed-week-label","data-weekend":0===n||6===n?"true":"false",children:e},`label-${t}`)})}),k>0&&_t("div",{className:"df-year-fixed-week-spacer","data-scrollbar-space":j?"true":"false",style:{width:`${k}px`}})]})}),_t("div",{ref:N,className:"df-year-fixed-month-sidebar",children:_t("div",{className:"df-year-fixed-month-sidebar-inner",children:[de.map(e=>_t("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)),R>0&&_t("div",{className:"df-year-fixed-month-spacer","data-scrollbar-space":j?"true":"false",style:{height:`${R}px`}})]})}),_t("div",{ref:I,className:"df-year-fixed-content",onScroll:ce,children:_t("div",{className:"df-year-fixed-content-inner",style:{minWidth:"1352px"},children:de.map(n=>{const o=se&&le?((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=Ne(e.start,r),u=e.end?Ne(e.end,r):c,h=new Date(c.getFullYear(),c.getMonth(),c.getDate()),g=new Date(u.getFullYear(),u.getMonth(),u.getDate()),m=h.getTime(),v=g.getTime();if(m>d||v<s)return null;const f=Math.max(m,s),p=Math.min(v,d);return{id:`${e.id}::preview-month-${t}`,event:e,startCellIndex:l+(new Date(f).getDate()-1),endCellIndex:l+(new Date(p).getDate()-1),isFirstSegment:h.getMonth()===t&&h.getFullYear()===n,isLastSegment:g.getMonth()===t&&g.getFullYear()===n,visualRowIndex:0,monthIndex:t}})(le,n.monthIndex,b,S,C):null,i=se&&te.eventId?[...n.eventSegments.filter(e=>e.event.id!==te.eventId),...o?[o]:[]]:n.eventSegments;return _t("div",{className:"df-year-fixed-month-row",style:{minHeight:`${n.minHeight}px`,transition:"min-height 180ms cubic-bezier(0.22, 1, 0.36, 1)"},children:[_t("div",{className:"df-year-fixed-background-grid",style:{gridTemplateColumns:`repeat(${G}, minmax(0, 1fr))`},children:n.days.map((t,a)=>{const r=(a+S)%7,o=0===r||6===r;if(!t)return _t("div",{className:"df-year-fixed-empty-cell","data-weekend":o?"true":"false"},`empty-${n.monthIndex}-${a}`);const i=(e=>e.getTime()===T.getTime())(t);return _t("div",{"data-date":`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`,className:"df-year-fixed-day-cell","data-dragging":ee?"true":"false","data-weekend":o?"true":"false",onClick:()=>e.selectDate(t),onDblClick:e=>ae(e,t),onContextMenu:e=>((e,t)=>{e.preventDefault(),e.stopPropagation(),V&&B({x:e.clientX,y:e.clientY,date:t})})(e,t),children:_t("span",{className:"df-year-fixed-day-number","data-today":i?"true":"false",children:t.getDate()})},t.getTime())})}),i.length>0&&_t("div",{className:"df-year-fixed-event-layer",style:{top:20},children:_t("div",{className:"df-year-fixed-event-layer-inner",children:i.map(n=>_t("div",{className:"df-year-fixed-event-hitbox",children:_t(Co,{event:n.event,isAllDay:!!n.event.allDay,viewType:x.YEAR,yearSegment:n,columnsPerRow:G,isBeingDragged:ee&&te.eventId===n.event.id,selectedEventId:Y,onMoveStart:K,onResizeStart:X,onEventSelect:Z,onDetailPanelToggle:z,newlyCreatedEventId:_,onDetailPanelOpen:()=>U(null),calendarRef:t,app:e,detailPanelEventId:F,customDetailPanelContent:a,customEventDetailDialog:r,firstHour:0,hourHeight:0,onEventUpdate:t=>e.updateEvent(t.id,t),onEventDelete:t=>e.deleteEvent(t),appTimeZone:C})},n.id))})})]},n.monthIndex)})})}),V&&W&&_t(Qr,{x:W.x,y:W.y,date:W.date,viewType:x.YEAR,onClose:()=>B(null),app:e,onCreateEvent:()=>{const e={preventDefault:()=>{},stopPropagation:()=>{},clientX:W.x,clientY:W.y};ae(e,W.date)}})]})},qi=({date:e,events:t,anchorEl:n,position:a,onClose:r,locale:i,app:l,customContent:s,appTimeZone:d})=>{const{t:u}=Pn(),h=v(null);m(()=>{const e=e=>{const t=e.target;!h.current||h.current.contains(t)||n.contains(t)||r()},t=e=>{"Escape"===e.key&&r()};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[n,r]);const g=l.getCalendars(),f=new Map(g.map(e=>[e.id,e])),p=e.toLocaleDateString(i,{weekday:"long",month:"long",day:"numeric"}),y=_t(o,{children:[_t("div",{className:"df-year-popup-header",children:_t("div",{className:"df-year-popup-title",children:p})}),_t("div",{className:"df-year-popup-body",children:0===t.length?_t("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=Ne(e.start,d).toLocaleTimeString(i,{hour:"2-digit",minute:"2-digit",hour12:!1}),e.end){o+=` – ${Ne(e.end,d).toLocaleTimeString(i,{hour:"2-digit",minute:"2-digit",hour12:!1})}`}}return _t("div",{className:"df-year-popup-event",children:[_t("div",{className:"df-year-popup-dot",style:{backgroundColor:r}}),_t("div",{className:"df-year-popup-event-main",children:[_t("div",{className:"df-year-popup-event-title",children:e.title}),e.allDay&&_t("div",{className:"df-year-popup-event-meta",children:u("allDay")}),o&&_t("div",{className:"df-year-popup-event-meta",children:o})]})]},e.id)})})]});return c(_t("div",{ref:h,"data-grid-day-popup":!0,className:"df-year-popup df-animate-in df-fade-in df-zoom-in-95",style:{top:a.top,left:a.left},children:s?s(e,t):y}),document.body)};function Gi(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=Ne(l.start,a),s=l.end?Ne(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(),g=Math.round((c.getTime()-h)/u);for(let e=0;e<=g;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 Ki(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 Xi=({app:e,config:t})=>{var n,a,r;const{locale:o,getWeekDaysLabels:i}=Pn(),l=e.getCurrentDate(),s=l.getFullYear(),d=e.getEvents(),c=null!==(n=null==t?void 0:t.startOfWeek)&&void 0!==n?n:1,u=null!==(a=null==t?void 0:t.showTimedEventsInYearView)&&void 0!==a&&a,h=null!==(r=null==t?void 0:t.gridHeatmapLevels)&&void 0!==r?r:5,v=e.timeZone,y=p(()=>{const e=Ve(v);return e.setHours(0,0,0,0),e},[v]),[D,w]=g(null);m(()=>{if(!D)return;const e=e=>{const t=e.target;t.closest("[data-grid-day-popup]")||t.closest("[data-grid-day-cell]")||w(null)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[D]);const b=p(()=>Gi(d,s,u,v),[d,s,u,v]),E=p(()=>Gi(d,s,!0,v),[d,s,v]),C=p(()=>i(o,"narrow",c).map(e=>o.startsWith("zh")?e.at(-1):e.charAt(0).toUpperCase()),[o,i,c]),T=p(()=>{const e=[];for(let t=0;t<12;t++){const n=new Date(s,t,1),a=new Date(s,t+1,0).getDate(),r=[];for(let e=(n.getDay()-c+7)%7-1;e>=0;e--)r.push({date:new Date(s,t,-e),isCurrentMonth:!1});for(let e=1;e<=a;e++)r.push({date:new Date(s,t,e),isCurrentMonth:!0});let i=1;for(;r.length<42;)r.push({date:new Date(s,t+1,i++),isCurrentMonth:!1});const l=n.toLocaleDateString(o,{month:"long"}),d=l.charAt(0).toUpperCase()+l.slice(1);e.push({monthIndex:t,monthName:d,cells:r})}return e},[s,o,c]),S=f((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=E.get(e))&&void 0!==i?i:[])}if("popup"===l){const e=n.currentTarget;D&&D.date.getTime()===a.getTime()&&D.monthIndex===r?w(null):w({date:a,monthIndex:r,anchorEl:e,position:Ki(e)})}else"day-view"===l&&(e.setCurrentDate(a),e.changeView(x.DAY))},[t,e,D,E]),M=f(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=E.get(e))&&void 0!==r?r:[])}"day-view"===o&&(w(null),e.setCurrentDate(n),e.changeView(x.DAY))},[t,e,E]),N=p(()=>{var e;if(!D)return[];const t=`${D.date.getFullYear()}-${String(D.date.getMonth()+1).padStart(2,"0")}-${String(D.date.getDate()).padStart(2,"0")}`;return[...null!==(e=E.get(t))&&void 0!==e?e:[]].toSorted((e,t)=>{const n=!!e.allDay;return n!==!!t.allDay?n?-1:1:0})},[D,E]);return _t("div",{className:Ln,children:[_t(So,{calendar:e,viewType:x.YEAR,currentDate:l,customTitle:o.startsWith("zh")||o.startsWith("ja")?`${s}年`:`${s}`,onPrevious:()=>{const t=new Date(l);t.setFullYear(t.getFullYear()-1),e.setCurrentDate(t)},onNext:()=>{const t=new Date(l);t.setFullYear(t.getFullYear()+1),e.setCurrentDate(t)},onToday:()=>e.goToToday()}),_t("div",{className:"df-year-grid",style:{gridTemplateColumns:"repeat(4, 1fr)",gridTemplateRows:"repeat(3, 1fr)"},children:T.map(e=>_t("div",{className:"df-year-grid-month df-year-grid-month",children:[_t("div",{className:"df-year-grid-month-title",children:e.monthName}),_t("div",{className:"df-year-grid-month-body",children:_t("div",{className:"df-year-grid-calendar",style:{gridTemplateColumns:"repeat(7, 1fr)",gridTemplateRows:"repeat(7, 1fr)"},children:[C.map((e,t)=>_t("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=b.get(i))||void 0===r?void 0:r.length)&&void 0!==o?o:0,s=(c=h,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,h):{};return _t("div",{"data-grid-day-cell":!0,className:"df-year-grid-day","data-current-month":n?"true":"false",style:u,onClick:n=>S(n,t,e.monthIndex),onDblClick:()=>M(t),children:_t("div",{className:"df-year-grid-day-inner",children:_t("span",{className:"df-year-grid-day-number","data-today":t.getTime()===y.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))}),D&&_t(qi,{date:D.date,events:N,anchorEl:D.anchorEl,position:D.position,onClose:()=>w(null),locale:o,app:e,customContent:null==t?void 0:t.gridPopupContent,appTimeZone:v})]})},Ji=e=>{var t;const n=(null===(t=e.config)||void 0===t?void 0:t.mode)||"year-canvas";return"fixed-week"===n?_t(Vi,Object.assign({},e)):"grid"===n?_t(Xi,{app:e.app,config:e.config}):_t(Bi,Object.assign({},e))},Qi={},el=e=>i(yi,Object.assign(Object.assign({},e),{viewType:x.YEAR,originalComponent:Ji,className:"df-year-view-factory"}));el.displayName="YearViewAdapter";const tl=(e={})=>{const t=Object.assign(Object.assign({},Qi),e);return{type:x.YEAR,component:el,config:t}};function nl(e){return[bi(null==e?void 0:e.day),xi(null==e?void 0:e.week),Yi(null==e?void 0:e.month)]}const al={enableAutoRecalculate:!0,enableValidation:!0,defaultEvents:[],maxEventsPerDay:50};function rl(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}function ol(t={}){const n=Object.assign(Object.assign({},al),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=rl(a.getCurrentDate());a.state.events=ft(a.getAllEvents(),e)}},update:(t,o)=>e(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=rl(a.getCurrentDate());a.state.events=ft(a.getAllEvents(),e)}}),delete:t=>e(this,void 0,void 0,function*(){yield a.deleteEvent(t)}),getByDate:e=>a.getAllEvents().filter(t=>{const n=Y(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=Y(n.start),r=Y(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)=>ft(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}}export{Ia as AlertCircle,Na as AudioLines,Ua as BlossomColorPicker,Zt as CalendarApp,Co as CalendarEvent,oe as CalendarRegistry,Yr as CalendarRenderer,va as Check,ha as ChevronDown,ua as ChevronRight,fa as ChevronsUpDown,_a as ContentSlot,Ur as ContextMenu,Jr as ContextMenuColorPicker,Wr as ContextMenuItem,Vr as ContextMenuLabel,Br as ContextMenuSeparator,qa as CreateCalendarDialog,jr as CustomRenderingStore,Dr as DayflowRangePicker,Wa as DefaultColorPicker,br as DefaultEventDetailDialog,Do as DefaultEventDetailPanel,eo as EventContextMenu,si as EventLayoutCalculator,Qr as GridContextMenu,O as LAYOUT_CONFIG,M as LOCALES,Da as Loader2,Ba as LoadingButton,An as LocaleContext,Aa as LocaleProvider,Tr as MiniCalendar,Ta as PanelRightClose,Sa as PanelRightOpen,ga as Plus,Ye as TIME_STEP,A as TimeZone,R as VIRTUAL_MONTH_SCROLL_CONFIG,x as ViewType,H as WeekDataCache,V as addDays,ve as buildColorBarGradient,fe as buildDiagonalColorBarGradient,ye as buildDiagonalPatternBackground,mt as calculateDayIndex,ta as calendarPickerDropdown,jn as cancelButton,xa as capitalize,cn as clipboardStore,kn as compareAllDayDisplayPriority,Lt as compareViews,En as convertToDayFlowEvent,xn as createAllDayDisplayComparator,an as createAllDayEvent,kt as createConfigSyncSnapshot,X as createDateWithHour,bi as createDayView,Qt as createEvent,gt as createEventWithDate,bt as createEventWithPlainDateTime,Dt as createEventWithRealDate,Et as createEventWithZonedDateTime,tn as createEvents,ol as createEventsPlugin,Yi as createMonthView,Ht as createNormalizedCalendarAppConfigGetter,nl as createStandardViews,F as createTemporalWithHour,rn as createTimedEvent,en as createTimezoneEvent,nn as createTimezoneEvents,xi as createWeekView,tl as createYearView,ke as dateToPlainDate,xe as dateToPlainDateTime,Oe as dateToZonedDateTime,W as daysBetween,B as daysDifference,Sn as downloadICS,S as en,vn as escapeICSValue,K as extractHourFromDate,Ae as extractHourFromTemporal,wn as extractVEvents,pn as foldLine,Bt as formatDate,Ut as formatDateConsistent,mn as formatDateToICSTimestamp,ze as formatEventTimeRange,gn as formatICSDate,Wt as formatMonthYear,yn as formatProperty,Fe as formatTime,at as generateDayData,Tn as generateICS,Ue as generateSecondaryTimeSlots,Mt as generateUniKey,Dn as generateVEvent,ot as generateWeekData,lt as generateWeekRange,it as generateWeeksData,dt as getAllDayEventsForDay,Nn as getAllDayRangeMetrics,se as getCalendarColorsForHex,pe as getCalendarEventBgColors,me as getCalendarLineColors,xt as getCallbackConfigUpdate,nt as getCurrentWeekDates,ct as getDateByDayIndex,on as getDateObj,pt as getDayIndexByDate,Q as getEndOfDay,U as getEndOfTemporal,de as getEventBgColor,Ze as getEventEndHour,ce as getEventTextColor,st as getEventsForDay,yt as getEventsForWeek,ka as getIntlLabel,he as getLineColor,Ra as getMonthLabels,rt as getMonthYearOfWeek,qe as getNextHourRangeInTimeZone,Be as getNowInTimeZone,Le as getPlainDate,ge as getPrimaryCalendarId,sn as getSearchHeaderInfo,ue as getSelectedBgColor,J as getStartOfDay,_ as getStartOfTemporal,Ot as getSyncConfigUpdates,St as getTestEvents,We as getTimezoneDisplayLabel,Ve as getTodayInTimeZone,Oa as getWeekDaysLabels,ee as getWeekNumber,tt as getWeekRange,dn as groupSearchResults,Tt as hasEventChanged,Mn as importICSFile,L as isDate,Nt as isDeepEqual,Ct as isEventDeepEqual,vt as isEventInWeek,ne as isMultiDayEvent,z as isMultiDayTemporalEvent,Ce as isPlainDate,Te as isPlainDateTime,te as isSameDay,Z as isSamePlainDate,$e as isSameTemporal,k as isValidLocale,Se as isZonedDateTime,Qe as monthNames,Vt as normalizeCssWidth,ln as normalizeDate,I as normalizeLocale,Ee as normalizeTimeZoneValue,q as now,un as pad2,Cn as parseICS,hn as parseICSDate,bn as parseVEventLines,It as pickSyncableConfig,Re as plainDateTimeToDate,He as plainDateToDate,ft as recalculateEventDays,mi as registerDragImplementation,N as registerLocale,Hr as registerSidebarImplementation,Kt as resolveAppliedTheme,On as restoreTimedDragFromAllDayTransition,Ke as restoreVisualEventToCanonical,Ge as restoreVisualTimedTemporalToCanonical,_e as roundToTimeStep,Gt as scrollbarTakesSpace,Pe as setHourInTemporal,et as shortMonthNames,ra as sidebarContainer,oa as sidebarHeader,la as sidebarHeaderTitle,ia as sidebarHeaderToggle,In as sortAllDayByTitle,Fr as subscribeCalendar,Rt as syncCalendarAppConfig,Ha as t,Me as temporalToDate,Ne as temporalToVisualDate,Ie as temporalToVisualTemporal,G as today,fn as unescapeICSValue,ut as updateEventDateAndDay,wt as updateEventWithRealDate,fi as useDragForView,Pn as useLocale,Pr as useSidebarBridge,Xe as weekDays,Je as weekDaysFullName,j as zonedDateTimeToDate};
1
+ import{__awaiter as e,__rest as t}from"tslib";import{Temporal as n}from"temporal-polyfill";import{options as a,createContext as r,Fragment as i,h as o,render as l,isValidElement as s,cloneElement as d}from"preact";import{createPortal as c,forwardRef as u,memo as h}from"preact/compat";export{createPortal}from"preact/compat";import{useState as g,useEffect as m,useRef as v,useCallback as f,useMemo as p,useLayoutEffect as y,useContext as D}from"preact/hooks";import{BlossomColorPicker as w,hexToHsl as b,lightnessToSliderValue as E,DEFAULT_COLORS as C,hslToHex as T}from"@dayflow/blossom-color-picker";const S={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."}},M={en:S};function N(e){const t=e.code.split("-")[0].toLowerCase();M[t]=e}function I(e){const t=e.split("-")[0].toLowerCase();return t in M?t:"en"}function k(e){try{return new Intl.DateTimeFormat(e),!0}catch(e){return!1}}var x;!function(e){e.DAY="day",e.WEEK="week",e.MONTH="month",e.YEAR="year",e.RESOURCE="resource"}(x||(x={}));const O={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},R={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=R.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 P;function A(e){var t;if(!e||"object"!=typeof e)return!1;if(e instanceof Date)return!1;if(e instanceof n.PlainDate)return!0;const a=e;return"PlainDate"===(null===(t=a.constructor)||void 0===t?void 0:t.name)||!("hour"in a)&&!("timeZone"in a)&&"year"in a&&"month"in a&&"day"in a}function L(e){return e instanceof Date}function $(e,t=n.Now.timeZoneId()){return n.Instant.fromEpochMilliseconds(e.getTime()).toZonedDateTimeISO(t)}function j(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 Y(e,t){if(e instanceof Date)return e;if(A(e))return function(e,t=n.Now.timeZoneId()){if("function"==typeof e.toZonedDateTime)try{return j(e.toZonedDateTime({timeZone:t,plainTime:n.PlainTime.from({hour:0,minute:0})}))}catch(e){}return new Date(e.year,e.month-1,e.day)}(e,t);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)}return e&&"object"==typeof e&&"year"in e?j(e):new Date(e)}function F(e,t){const a=Math.floor(t),r=Math.round(60*(t-a));if(A(e))return n.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 i=e;return n.PlainDateTime.from({year:i.year,month:i.month,day:i.day,hour:a,minute:r})}function Z(e,t){if(e instanceof Date&&t instanceof Date)return e.toDateString()===t.toDateString();const a=e=>{if(e instanceof Date)return t=e,n.PlainDate.from({year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()});var t;if(A(e))return e;if("function"==typeof e.toPlainDate)return e.toPlainDate();const a=e;return n.PlainDate.from({year:a.year,month:a.month,day:a.day})},r=a(e),i=a(t);return 0===n.PlainDate.compare(r,i)}function _(e,t){return!Z(e,t)}function z(e,t=n.Now.timeZoneId()){if("function"==typeof e.toZonedDateTime)return(A(e)?e:e.toPlainDate()).toZonedDateTime({timeZone:t,plainTime:n.PlainTime.from({hour:0,minute:0})});const a=e;return(A(e)?e:n.PlainDate.from({year:a.year,month:a.month,day:a.day})).toZonedDateTime({timeZone:t,plainTime:n.PlainTime.from({hour:0,minute:0})})}function U(e,t=n.Now.timeZoneId()){if("function"==typeof e.toZonedDateTime)return(A(e)?e:e.toPlainDate()).toZonedDateTime({timeZone:t,plainTime:n.PlainTime.from({hour:23,minute:59,second:59,millisecond:999})});const a=e;return(A(e)?e:n.PlainDate.from({year:a.year,month:a.month,day:a.day})).toZonedDateTime({timeZone:t,plainTime:n.PlainTime.from({hour:23,minute:59,second:59,millisecond:999})})}function W(e,t){const a=e=>{if(A(e))return e;if("function"==typeof e.toPlainDate)return e.toPlainDate();const t=e;return n.PlainDate.from({year:t.year,month:t.month,day:t.day})},r=a(e),i=a(t);return r.until(i).days}function B(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)}function V(e,t){const n=new Date(e);return n.setDate(n.getDate()+t),n}function q(e=n.Now.timeZoneId()){return n.Now.zonedDateTimeISO(e)}function G(e=n.Now.timeZoneId()){return n.Now.plainDateISO(e)}!function(e){e.UTC="UTC",e.NEW_YORK="America/New_York",e.CHICAGO="America/Chicago",e.DENVER="America/Denver",e.LOS_ANGELES="America/Los_Angeles",e.TORONTO="America/Toronto",e.VANCOUVER="America/Vancouver",e.PHOENIX="America/Phoenix",e.ANCHORAGE="America/Anchorage",e.HONOLULU="Pacific/Honolulu",e.MEXICO_CITY="America/Mexico_City",e.WINNIPEG="America/Winnipeg",e.HALIFAX="America/Halifax",e.ST_JOHNS="America/St_Johns",e.DETROIT="America/Detroit",e.LONDON="Europe/London",e.PARIS="Europe/Paris",e.BERLIN="Europe/Berlin",e.MADRID="Europe/Madrid",e.ROME="Europe/Rome",e.AMSTERDAM="Europe/Amsterdam",e.ZURICH="Europe/Zurich",e.STOCKHOLM="Europe/Stockholm",e.OSLO="Europe/Oslo",e.COPENHAGEN="Europe/Copenhagen",e.MOSCOW="Europe/Moscow",e.ISTANBUL="Europe/Istanbul",e.DUBLIN="Europe/Dublin",e.LISBON="Europe/Lisbon",e.PRAGUE="Europe/Prague",e.VIENNA="Europe/Vienna",e.WARSAW="Europe/Warsaw",e.BRUSSELS="Europe/Brussels",e.ATHENS="Europe/Athens",e.BUCHAREST="Europe/Bucharest",e.HELSINKI="Europe/Helsinki",e.KYIV="Europe/Kyiv",e.BUDAPEST="Europe/Budapest",e.BELGRADE="Europe/Belgrade",e.LUXEMBOURG="Europe/Luxembourg",e.MONACO="Europe/Monaco",e.REYKJAVIK="Atlantic/Reykjavik",e.TOKYO="Asia/Tokyo",e.SHANGHAI="Asia/Shanghai",e.HONG_KONG="Asia/Hong_Kong",e.TAIPEI="Asia/Taipei",e.SEOUL="Asia/Seoul",e.SINGAPORE="Asia/Singapore",e.HANOI="Asia/Ho_Chi_Minh",e.BANGKOK="Asia/Bangkok",e.JAKARTA="Asia/Jakarta",e.KUALA_LUMPUR="Asia/Kuala_Lumpur",e.MANILA="Asia/Manila",e.DUBAI="Asia/Dubai",e.KOLKATA="Asia/Kolkata",e.RIYADH="Asia/Riyadh",e.TEHRAN="Asia/Tehran",e.JERUSALEM="Asia/Jerusalem",e.TEL_AVIV="Asia/Tel_Aviv",e.BAGHDAD="Asia/Baghdad",e.DHAKA="Asia/Dhaka",e.KARACHI="Asia/Karachi",e.KABUL="Asia/Kabul",e.KATHMANDU="Asia/Kathmandu",e.COLOMBO="Asia/Colombo",e.TASHKENT="Asia/Tashkent",e.ALMATY="Asia/Almaty",e.PHNOM_PENH="Asia/Phnom_Penh",e.VIENTIANE="Asia/Vientiane",e.MUSCAT="Asia/Muscat",e.SYDNEY="Australia/Sydney",e.MELBOURNE="Australia/Melbourne",e.BRISBANE="Australia/Brisbane",e.PERTH="Australia/Perth",e.ADELAIDE="Australia/Adelaide",e.DARWIN="Australia/Darwin",e.HOBART="Australia/Hobart",e.AUCKLAND="Pacific/Auckland",e.FIJI="Pacific/Fiji",e.GUAM="Pacific/Guam",e.NOUMEA="Pacific/Noumea",e.PAGO_PAGO="Pacific/Pago_Pago",e.PORT_MORESBY="Pacific/Port_Moresby",e.SAO_PAULO="America/Sao_Paulo",e.BUENOS_AIRES="America/Argentina/Buenos_Aires",e.SANTIAGO="America/Santiago",e.LIMA="America/Lima",e.BOGOTA="America/Bogota",e.CARACAS="America/Caracas",e.LA_PAZ="America/La_Paz",e.MONTEVIDEO="America/Montevideo",e.QUITO="America/Quito",e.ASUNCION="America/Asuncion",e.GEORGETOWN="America/Guyana",e.CAIRO="Africa/Cairo",e.JOHANNESBURG="Africa/Johannesburg",e.LAGOS="Africa/Lagos",e.NAIROBI="Africa/Nairobi",e.CASABLANCA="Africa/Casablanca",e.ALGIERS="Africa/Algiers",e.TUNIS="Africa/Tunis",e.ADDIS_ABABA="Africa/Addis_Ababa",e.ACCRA="Africa/Accra",e.DAKAR="Africa/Dakar",e.LUANDA="Africa/Luanda",e.ANTANANARIVO="Indian/Antananarivo",e.KINSHASA="Africa/Kinshasa",e.DAR_ES_SALAAM="Africa/Dar_es_Salaam",e.MCMURDO="Antarctica/McMurdo",e.CASEY="Antarctica/Casey"}(P||(P={}));const K=e=>e instanceof Date?e.getHours()+e.getMinutes()/60:function(e){var t;if(e instanceof Date)return e.getHours()+e.getMinutes()/60;if(A(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),X=(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 F(e,t)},J=e=>{if(e instanceof Date){const t=new Date(e);return t.setHours(0,0,0,0),t}return z(e)},Q=e=>{if(e instanceof Date){const t=new Date(e);return t.setHours(23,59,59,999),t}return U(e)},ee=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)},te=(e,t)=>e instanceof Date&&t instanceof Date?e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate():Z(e instanceof Date?n.PlainDate.from({year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}):A(e)?e:e.toPlainDate(),t instanceof Date?n.PlainDate.from({year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()}):A(t)?t:t.toPlainDate()),ne=(e,t)=>!te(e,t),ae=e=>!e.readOnly&&!e.subscription,re=[{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 ie{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)}):re.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(){return this.get(this.defaultCalendarId)||this.getAll()[0]}getDefaultWritableCalendar(){const e=this.getDefaultCalendar();return e&&ae(e)?e:this.getAll().find(ae)}setTheme(e){this.currentTheme=e}getTheme(){return this.currentTheme}resolveColors(e,t){const n=t||this.currentTheme,a=ie.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 oe=new ie;function le(){return oe}function se(e){const t=re.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 de=(e,t)=>(t||le()).resolveColors(e).eventColor,ce=(e,t)=>(t||le()).resolveColors(e).textColor,ue=(e,t)=>(t||le()).resolveColors(e).eventSelectedColor,he=(e,t)=>(t||le()).resolveColors(e).lineColor,ge=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"},me=(e,t)=>{var n;const a=t||le();return(null!==(n=e.calendarIds)&&void 0!==n?n:e.calendarId?[e.calendarId]:["blue"]).map(e=>a.getLineColor(e))},ve=e=>{if(1===e.length)return e[0];const t=[];return e.forEach((n,a)=>{const r=a/e.length*100,i=(a+1)/e.length*100;t.push(`${n} ${r}%`,`${n} ${i}%`)}),`linear-gradient(to bottom, ${t.join(", ")})`},fe=(e,t=6)=>{if(1===e.length)return e[0];const n=[];return e.forEach((e,a)=>{const r=a*t,i=(a+1)*t;n.push(`${e} ${r}px`,`${e} ${i}px`)}),`repeating-linear-gradient(-45deg, ${n.join(", ")})`},pe=(e,t)=>{var n;const a=t||le();return(null!==(n=e.calendarIds)&&void 0!==n?n:e.calendarId?[e.calendarId]:["blue"]).map(e=>a.resolveColors(e).eventColor)},ye=(e,t=6)=>{if(1===e.length)return e[0];const n=[];return e.forEach((e,a)=>{const r=a*t,i=(a+1)*t;n.push(`${e} ${r}px`,`${e} ${i}px`)}),`repeating-linear-gradient(-45deg, ${n.join(", ")})`},De=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;(new Date).toISOString();e.toUpperCase()}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)}},we=new Map;function be(e){try{return new Intl.DateTimeFormat("en",{timeZone:e}).resolvedOptions().timeZone}catch(e){return}}function Ee(e){if(!e||"string"!=typeof e)return;const t=e.trim();if(!t)return;const n=we.get(t);if(n)return n;const a=be(t);if(a)return we.set(t,a),a;const r=Object.values(P).find(e=>e.toLowerCase()===t.toLowerCase());if(r){const e=be(r);return e?(we.set(t,e),e):(we.set(t,r),r)}if("function"==typeof Intl.supportedValuesOf){const e=Intl.supportedValuesOf("timeZone").find(e=>e.toLowerCase()===t.toLowerCase());if(e)return we.set(t,e),e}const i=be(t.split("/").map(e=>e.split("_").map(e=>e?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():e).join("_")).join("/"));if(i)return we.set(t,i),i;const o=be(t.split("/").map((e,t)=>0===t?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():e).join("/"));return o?(we.set(t,o),o):t}function Ce(e){return null!==e&&"object"==typeof e&&!("hour"in e)&&"year"in e&&"month"in e&&"day"in e&&!(e instanceof Date)}function Te(e){return null!==e&&"object"==typeof e&&"hour"in e&&!("timeZone"in e)&&!("timeZoneId"in e)&&"year"in e&&!(e instanceof Date)}function Se(e){return null!==e&&"object"==typeof e&&("timeZone"in e||"timeZoneId"in e)&&"year"in e&&!(e instanceof Date)}function Me(e){if(e instanceof Date)return e;if(Ce(e))return new Date(e.year,e.month-1,e.day);if(Te(e))return new Date(e.year,e.month-1,e.day,e.hour,e.minute,e.second||0,e.millisecond||0);if(Se(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 Ne(e,t){if(e instanceof Date)return e;if(!t)return Me(e);const a=Ee(t);if(!a)return Me(e);try{if(Se(e)){const t=("function"==typeof e.withTimeZone?e:n.ZonedDateTime.from(e)).withTimeZone(a);return new Date(t.year,t.month-1,t.day,t.hour,t.minute,t.second||0,t.millisecond||0)}if(Te(e)){const t=("function"==typeof e.toZonedDateTime?e:n.PlainDateTime.from(e)).toZonedDateTime(n.Now.timeZoneId()).withTimeZone(a);return new Date(t.year,t.month-1,t.day,t.hour,t.minute,t.second||0,t.millisecond||0)}}catch(e){De.error("Failed to shift visual timezone:",e)}return Me(e)}function Ie(e,t){if(!t)return e;const a=Ee(t);if(!a)return e;try{if(Se(e))return("function"==typeof e.withTimeZone?e:n.ZonedDateTime.from(e)).withTimeZone(a);if(Te(e))return("function"==typeof e.toZonedDateTime?e:n.PlainDateTime.from(e)).toZonedDateTime(n.Now.timeZoneId()).withTimeZone(a)}catch(e){De.error("Failed to shift visual temporal:",e)}return e}function ke(e){return n.PlainDate.from({year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()})}function xe(e){return n.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 Oe(e,t=n.Now.timeZoneId()){return n.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})}function Re(e){return new Date(e.year,e.month-1,e.day,e.hour,e.minute,e.second||0,e.millisecond||0)}function He(e){return new Date(e.year,e.month-1,e.day)}function Pe(e){if(e instanceof Date)return e.getHours()+e.getMinutes()/60;if(Ce(e))return 0;const t=e;return t.hour+t.minute/60}function Ae(e,t){const n=Math.floor(t),a=Math.round(60*(t-n));return Se(e),e.with({hour:n,minute:a,second:0,millisecond:0})}function Le(e){return e instanceof Date?ke(e):Ce(e)?e:(Te(e),e.toPlainDate())}function $e(e,t){if(e instanceof Date&&t instanceof Date)return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate();const n=Le(e),a=Le(t);return n.equals(a)}const je=e=>new Date(e.year,e.month-1,e.day,e.hour,e.minute,e.second,Math.floor(e.millisecond)),Ye=.25,Fe=(e,t=0,n="24h",a=!0)=>{const r=Math.floor(e),i=t||Math.round(60*(e-r));if("12h"===n){const e=r>=12?"PM":"AM",t=r%12||12;return 0===i?`${t}${a?` ${e}`:""}`:`${t}:${i.toString().padStart(2,"0")}${a?` ${e}`:""}`}return`${r.toString().padStart(2,"0")}:${i.toString().padStart(2,"0")}`},Ze=e=>{if(!e.end)return 0;const t=K(e.end);if(e.allDay||!e.start)return t;const n=Y(e.start),a=Y(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},_e=(e,t="24h")=>{const n=K(e.start),a=Ze(e);return`${Fe(n,0,t)} - ${Fe(a,0,t)}`},ze=e=>.25*Math.round(e/.25),Ue=(e,t,a="24h",r=new Date,i)=>{const o=Ee(t);if(!o)return e.map(()=>"");const l=null!=i?i:n.Now.timeZoneId(),s=r.getFullYear(),d=r.getMonth()+1,c=r.getDate();return e.map(e=>{try{const t=e.hour%24,r=n.ZonedDateTime.from({year:s,month:d,day:c,hour:t,minute:0,second:0,timeZone:l}).withTimeZone(o);return Fe(r.hour,r.minute,a)}catch(e){return""}})},We=(e,t=new Date)=>{var n,a;const r=Ee(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}},Be=e=>{var t;const a=null!==(t=e?Ee(e):void 0)&&void 0!==t?t:n.Now.timeZoneId();return je(n.Now.zonedDateTimeISO(a))},Ve=e=>{var t;const a=null!==(t=e?Ee(e):void 0)&&void 0!==t?t:n.Now.timeZoneId(),r=n.Now.plainDateISO(a);return new Date(r.year,r.month-1,r.day)},qe=e=>{var t;const a=null!==(t=e?Ee(e):void 0)&&void 0!==t?t:n.Now.timeZoneId(),r=n.Now.zonedDateTimeISO(a).add({hours:1}).with({minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});return{start:je(r),end:je(r.add({hours:1}))}},Ge=(e,t,a)=>{var r,i;const o=Y(e);if(Se(t)){const e=null!==(r=Ee(a))&&void 0!==r?r:n.Now.timeZoneId(),i=(e=>{var t;const a=e;return a.timeZoneId||("string"==typeof a.timeZone?a.timeZone:null===(t=a.timeZone)||void 0===t?void 0:t.id)||n.Now.timeZoneId()})(t);return Oe(o,e).toInstant().toZonedDateTimeISO(i)}return Te(t)?xe(o):Se(e)?e:Oe(o,null!==(i=Ee(a))&&void 0!==i?i:n.Now.timeZoneId())},Ke=(e,t,n)=>t.allDay?Object.assign(Object.assign({},t),{allDay:!0,start:Ce(t.start)?t.start:ke(Y(t.start)),end:Ce(t.end)?t.end:ke(Y(t.end))}):Object.assign(Object.assign({},t),{allDay:!1,start:Ge(t.start,e.allDay?t.start:e.start,n),end:Ge(t.end,e.allDay?t.end:e.end,n)}),Xe=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Je=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Qe=["January","February","March","April","May","June","July","August","September","October","November","December"],et=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tt=(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}},nt=(e=1)=>{const t=new Date,n=new Date,a=(t.getDay()-e+7)%7;return Xe.map((e,r)=>{const i=new Date(t);return i.setDate(t.getDate()-a+r),{date:i.getDate(),month:i.toLocaleString("default",{month:"short"}),isToday:i.getDate()===n.getDate()&&i.getMonth()===n.getMonth()&&i.getFullYear()===n.getFullYear()}})},at=e=>{const t=new Date(e),n=t.getDate(),a=t.getMonth(),r=t.getFullYear(),i=new Date;return{date:t,day:n,month:a,year:r,monthName:Qe[a],shortMonthName:et[a],isToday:i.getDate()===n&&i.getMonth()===a&&i.getFullYear()===r}},rt=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,i]=a.split("-").map(Number);return{month:Qe[r],monthIndex:r,year:i}},it=e=>{const t=[],n=new Date(e);for(let e=0;e<7;e++){const e=new Date(n);t.push(at(e)),n.setDate(n.getDate()+1)}return{days:t,startDate:new Date(e),monthYear:rt(t)}},ot=(e,t=3)=>{const n=5*t,{monday:a}=tt(e),r=[],i=Math.floor(n/2),o=new Date(a);o.setDate(o.getDate()-7*i);for(let e=0;e<n;e++){const t=new Date(o);t.setDate(t.getDate()+7*e),r.push(it(t))}return r};function lt(e,t,n=1){const a=[],r=Math.floor(t/2),i=(e.getDay()-n+7)%7,o=new Date(e);o.setDate(e.getDate()-i),o.setHours(0,0,0,0);const l=new Date(o);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(it(t))}return a}const st=(e,t)=>t.filter(t=>t.day===e&&!t.allDay),dt=(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=Y(t.start);r.setHours(0,0,0,0);const i=Y(t.end);return i.setHours(0,0,0,0),a>=r&&a<=i}),ct=(e,t)=>{const n=new Date(e);return n.setDate(e.getDate()+t),n},ut=(e,t,a)=>{const r=ct(a,t);return Object.assign(Object.assign({},e),{day:t,start:e.allDay?n.PlainDate.from({year:r.getFullYear(),month:r.getMonth()+1,day:r.getDate()}):n.ZonedDateTime.from({year:r.getFullYear(),month:r.getMonth()+1,day:r.getDate(),hour:r.getHours(),minute:r.getMinutes(),timeZone:n.Now.timeZoneId()}),end:e.allDay?n.PlainDate.from({year:r.getFullYear(),month:r.getMonth()+1,day:r.getDate()}):n.ZonedDateTime.from({year:r.getFullYear(),month:r.getMonth()+1,day:r.getDate(),hour:r.getHours(),minute:r.getMinutes(),timeZone:n.Now.timeZoneId()})})},ht=(e,t)=>t?n.PlainDate.from({year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}):n.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.Now.timeZoneId()}),gt=(e,t)=>{var n,a;const r=ct(t,null!==(n=e.day)&&void 0!==n?n:0),i=null!==(a=e.allDay)&&void 0!==a&&a;return Object.assign(Object.assign({},e),{start:ht(r,i),end:ht(r,i)})},mt=(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)},vt=(e,t)=>{const n=mt(e,t);return n>=0&&n<=6},ft=(e,t)=>e.map(e=>{const n=Y(e.start),a=mt(n,t);return Object.assign(Object.assign({},e),{day:a})}),pt=(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)},yt=(e,t)=>{const n=new Date(t);return n.setDate(t.getDate()+6),n.setHours(23,59,59,999),e.filter(e=>{const a=Y(e.start);return a>=t&&a<=n}).map(e=>{const n=mt(Y(e.start),t);return Object.assign(Object.assign({},e),{day:n})})},Dt=(e,t)=>{var n,a;const r=new Date(t);r.setDate(t.getDate()+(null!==(n=e.day)&&void 0!==n?n:0));const i=null!==(a=e.allDay)&&void 0!==a&&a;return Object.assign(Object.assign({},e),{start:ht(r,i),end:ht(r,i)})},wt=(e,t,n)=>{var a;const r=new Date(n);r.setDate(n.getDate()+t);const i=null!==(a=e.allDay)&&void 0!==a&&a;return Object.assign(Object.assign({},e),{day:t,start:ht(r,i),end:ht(r,i)})},bt=(e,t)=>{var a,r;const i=ct(t,null!==(a=e.day)&&void 0!==a?a:0);if(null!==(r=e.allDay)&&void 0!==r&&r){const t=n.PlainDate.from({year:i.getFullYear(),month:i.getMonth()+1,day:i.getDate()});return Object.assign(Object.assign({},e),{start:t,end:t})}const o=n.PlainDateTime.from({year:i.getFullYear(),month:i.getMonth()+1,day:i.getDate(),hour:i.getHours(),minute:i.getMinutes(),second:i.getSeconds(),millisecond:i.getMilliseconds()});return Object.assign(Object.assign({},e),{start:o,end:o})},Et=(e,t,a)=>{var r,i;const o=ct(t,null!==(r=e.day)&&void 0!==r?r:0);if(null!==(i=e.allDay)&&void 0!==i&&i){const t=n.PlainDate.from({year:o.getFullYear(),month:o.getMonth()+1,day:o.getDate()});return Object.assign(Object.assign({},e),{start:t,end:t})}const l=n.ZonedDateTime.from({year:o.getFullYear(),month:o.getMonth()+1,day:o.getDate(),hour:o.getHours(),minute:o.getMinutes(),second:o.getSeconds(),millisecond:o.getMilliseconds(),timeZone:a});return Object.assign(Object.assign({},e),{start:l,end:l})},Ct=(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(),Tt=(e,t)=>Y(e.start).getTime()!==Y(t.start).getTime()||Y(e.end).getTime()!==Y(t.end).getTime()||e.title!==t.title||e.day!==t.day||!!e.allDay!=!!t.allDay;function St(){const e=new Date,t=e.getDay(),a=new Date(e),r=0===t?-6:1-t;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 t=new Date(a);if(t.setDate(a.getDate()+e.day),e.allDay)return{id:e.id,title:e.title,start:n.PlainDate.from({year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()}),end:n.PlainDate.from({year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()}),allDay:!0,calendarId:e.calendarId,day:e.day};const r=Math.floor(e.startHour),i=Math.round(60*(e.startHour-r)),o=Math.floor(e.endHour),l=Math.round(60*(e.endHour-o));return{id:e.id,title:e.title,start:n.ZonedDateTime.from({year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate(),hour:r,minute:i,timeZone:n.Now.timeZoneId()}),end:n.ZonedDateTime.from({year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate(),hour:o,minute:l,timeZone:n.Now.timeZoneId()}),allDay:!1,calendarId:e.calendarId,day:e.day}})}function Mt(){return Date.now().toString(36)+Math.random().toString(36).slice(2,8)}function Nt(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,i=t;for(const e of n)if(!a.includes(e)||!Nt(r[e],i[e]))return!1;return!0}function It(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,useEventDetailPanel:e.useEventDetailPanel,views:e.views}}function kt(e){return{callbacks:e.callbacks,syncableConfig:It(e)}}function xt(e,t){return e===t?null:{callbacks:t}}function Ot(e,t){const n={};return e.views!==t.views&&(n.views=t.views),Nt(e.calendars,t.calendars)||(n.calendars=t.calendars),Nt(e.theme,t.theme)||(n.theme=t.theme),e.useEventDetailDialog!==t.useEventDetailDialog&&(n.useEventDetailDialog=t.useEventDetailDialog),e.useEventDetailPanel!==t.useEventDetailPanel&&(n.useEventDetailPanel=t.useEventDetailPanel),e.useCalendarHeader!==t.useCalendarHeader&&(n.useCalendarHeader=t.useCalendarHeader),e.customMobileEventRenderer!==t.customMobileEventRenderer&&(n.customMobileEventRenderer=t.customMobileEventRenderer),e.switcherMode!==t.switcherMode&&(n.switcherMode=t.switcherMode),Nt(e.locale,t.locale)||(n.locale=t.locale),Nt(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}function Rt(e,t,n){const a=kt(n),r=xt(t.callbacks,a.callbacks);r&&e.updateConfig(r);const i=Ot(t.syncableConfig,a.syncableConfig);return Object.keys(i).length>0&&e.updateConfig(i),a}function Ht(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})}}const Pt={hasChanges:!1,requiresRender:!1},At=(e,t)=>{if(e===t)return Pt;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 i=At(e,t[r]);n=n||i.hasChanges,a=a||i.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,i=t,o=Object.keys(r),l=Object.keys(i);if(o.length!==l.length)return{hasChanges:!0,requiresRender:!0};let s=!1,d=!1;for(const e of o){if(!l.includes(e))return{hasChanges:!0,requiresRender:!0};const t=At(r[e],i[e]);s=s||t.hasChanges,d=d||t.requiresRender}return{hasChanges:s,requiresRender:d}},Lt=(e,t)=>e?e.component!==t.component||e.label!==t.label?{hasChanges:!0,requiresRender:!0}:At(e.config,t.config):{hasChanges:!0,requiresRender:!0};class $t{constructor(e=[]){this.events=new Map,this.isInTransaction=!1,this.pendingChanges=[],e.forEach(e=>this.events.set(e.id,e))}beginTransaction(){this.isInTransaction||(this.isInTransaction=!0,this.pendingChanges=[])}endTransaction(){var e;if(!this.isInTransaction)return;const t=$t.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 jt{constructor(e,t,n,a,r,i){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 $t(i),this.setupStoreListeners()}setupStoreListeners(){this.store.onEventChange=e=>{var t,n,a,r;this.syncExternalEventsToState();let i=null;return"create"===e.type?i=null===(n=(t=this.getCallbacks()).onEventCreate)||void 0===n?void 0:n.call(t,e.event):"update"===e.type&&(i=null===(r=(a=this.getCallbacks()).onEventUpdate)||void 0===r?void 0:r.call(a,e.after)),this.triggerRender(),this.notify(),null!=i?i: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 $t(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){De.warn(`Failed to update event ${e}:`,t)}}),e.add&&e.add.forEach(e=>{try{this.store.createEvent(e)}catch(t){De.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(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(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 Yt{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 i=this.state.views.get(this.state.currentView);switch(null==i?void 0:i.type){case x.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 x.WEEK:{const a=null!==(n=null===(t=null==i?void 0:i.config)||void 0===t?void 0:t.startOfWeek)&&void 0!==n?n:1,{monday:r}=tt(this.state.currentDate,a),o=new Date(r),l=new Date(r);l.setDate(l.getDate()+7),this.emitVisibleRange(o,l,e);break}case x.MONTH:{if("navigation"===e)break;const t=new Date(this.state.currentDate.getFullYear(),this.state.currentDate.getMonth(),1),n=null!==(r=null===(a=null==i?void 0:i.config)||void 0===a?void 0:a.startOfWeek)&&void 0!==r?r:1,{monday:o}=tt(t,n),l=new Date(o),s=new Date(o);s.setDate(s.getDate()+42),this.emitVisibleRange(l,s,e);break}case x.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=n.Now.plainDateISO(this.state.timeZone),t=new Date(e.year,e.month-1,e.day);this.setCurrentDate(t)}goToPrevious(){const e=new Date(this.state.currentDate);switch(this.state.currentView){case x.DAY:e.setDate(e.getDate()-1);break;case x.WEEK:e.setDate(e.getDate()-7);break;case x.MONTH:e.setMonth(e.getMonth()-1);break;case x.YEAR:e.setFullYear(e.getFullYear()-1)}this.setCurrentDate(e)}goToNext(){const e=new Date(this.state.currentDate);switch(this.state.currentView){case x.DAY:e.setDate(e.getDate()+1);break;case x.WEEK:e.setDate(e.getDate()+7);break;case x.MONTH:e.setMonth(e.getMonth()+1);break;case x.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 Ft{constructor(e,t){this.state=e,this.notify=t}install(e,t){this.state.plugins.has(e.name)?De.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 Zt{constructor(t){var a,r,i,o,l,s;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,i;let o=!0,l=!0;if(!0===e?(o=!1,l=!1):!1!==e&&(o=null===(r=e.draggable)||void 0===r||r,l=null===(i=e.viewable)||void 0===i||i),t&&(o||l)){let e=t;const r=a.find(e=>e.id===t);(null==r?void 0:r.calendarId)&&(e=r.calendarId);const i=n.get(e);i&&(!0===i.readOnly&&(o=!1),i.subscription&&void 0===i.readOnly&&(o=!1))}return{draggable:o,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 i=n.get(e);if(i){if(void 0!==i.readOnly)return!i.readOnly;if(i.subscription)return!1}}return!0}(this.state.readOnly,e,this.calendarRegistry,this.state.events),this.getCalendars=()=>this.calendarRegistry.getAll(),this.reorderCalendars=(e,t)=>{var n,a;this.calendarRegistry.reorder(e,t),null===(a=(n=this.callbacks).onCalendarReorder)||void 0===a||a.call(n,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 i=this.calendarRegistry.get(e);i&&(null===(r=(a=this.callbacks).onCalendarUpdate)||void 0===r||r.call(a,i)),this.triggerRender()},this.createCalendar=t=>e(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(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(this,void 0,void 0,function*(){var e,a;const r=this.eventManager.getStore(),i=r.getAllEvents().filter(e=>e.calendarId===t);this.eventManager.pushToUndo(),r.beginTransaction(),i.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.getUseEventDetailPanel=()=>this.useEventDetailPanel,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.useEventDetailPanel&&e.useEventDetailPanel!==this.useEventDetailPanel&&(this.useEventDetailPanel=e.useEventDetailPanel,a=!0),void 0!==e.useCalendarHeader&&e.useCalendarHeader!==this.useCalendarHeader&&(this.useCalendarHeader=e.useCalendarHeader,a=!0),void 0===e.readOnly||Nt(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=Zt.resolveLocale(e.locale);Nt(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=Ee(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),i=Lt(a,e);i.hasChanges&&(t.set(e.type,e),r=!0),n=n||i.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 d=null!==(a=Ee(t.timeZone))&&void 0!==a?a:Intl.DateTimeFormat().resolvedOptions().timeZone,c=(()=>{const e=n.Now.plainDateISO(d);return new Date(e.year,e.month-1,e.day)})();var u;this.state={currentView:t.defaultView||x.WEEK,currentDate:t.initialDate||c,events:t.events||[],switcherMode:t.switcherMode||"buttons",plugins:new Map,views:new Map,locale:Zt.resolveLocale(t.locale),highlightedEventId:null,selectedEventId:null,readOnly:t.readOnly||!1,overrides:[],allDaySortComparator:t.allDaySortComparator,timeZone:d},this.callbacks=t.callbacks||{},this.themeChangeListeners=new Set,this.listeners=new Set,this.calendarRegistry=new ie(t.calendars,t.defaultCalendar,(null===(r=t.theme)||void 0===r?void 0:r.mode)||"light"),u=this.calendarRegistry,oe=u,this.eventManager=new jt(this.state,this.calendarRegistry,()=>this.callbacks,this.notify,this.triggerRender,t.events||[]),this.navigation=new Yt(this.state,()=>this.callbacks,this.notify,this.state.currentDate),this.pluginManager=new Ft(this.state,this.notify),this.useEventDetailDialog=null!==(i=t.useEventDetailDialog)&&void 0!==i&&i,this.useEventDetailPanel=null===(o=t.useEventDetailPanel)||void 0===o||o,this.useCalendarHeader=null===(l=t.useCalendarHeader)||void 0===l||l,this.customMobileEventRenderer=t.customMobileEventRenderer,t.views.forEach(e=>this.state.views.set(e.type,e)),null===(s=t.plugins)||void 0===s||s.forEach(e=>this.pluginManager.install(e,this)),this.handleVisibleRangeChange("initial")}static resolveLocale(e){return e?"string"==typeof e?k(e)?e:"en-US":e&&"object"==typeof e&&!k(e.code)?Object.assign(Object.assign({},e),{code:"en-US"}):e:"en-US"}get timeZone(){return this.state.timeZone}}var _t=0;function zt(e,t,n,r,i,o){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:n,ref:l,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--_t,__i:-1,__u:0,__source:i,__self:o};if("function"==typeof e&&(l=e.defaultProps))for(s in l)void 0===d[s]&&(d[s]=l[s]);return a.vnode&&a.vnode(c),c}const Ut=e=>{if(!e)return"";let t,a,r;e instanceof Date?(r=e.getFullYear(),a=e.getMonth()+1,t=e.getDate()):A(e)?(r=e.year,a=e.month,t=e.day):(function(e){if(!e||"object"!=typeof e)return!1;if(e instanceof Date)return!1;n.ZonedDateTime}(e),r=e.year,a=e.month,t=e.day);const i=String(a).padStart(2,"0");return`${String(t).padStart(2,"0")}/${i}/${r}`},Wt=e=>`${["January","February","March","April","May","June","July","August","September","October","November","December"][e.getMonth()]} ${e.getFullYear()}`,Bt=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}`};function Vt(e,t="240px"){return"number"==typeof e?`${e}px`:"string"==typeof e&&e.trim().length>0?e:t}let qt=null;function Gt(){if("undefined"==typeof document)return!1;if(null!==qt)return qt;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(),qt=a,a}const Kt=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 Xt(e,t=!1){if(e instanceof n.PlainDate||e instanceof n.PlainDateTime)return e;if(e instanceof Date)return t?ke(e):xe(e);throw new Error("Invalid time type: "+typeof e)}function Jt(e,t){if(e instanceof n.ZonedDateTime)return e;if(e instanceof Date)return Oe(e,t);throw new Error("Invalid time type: "+typeof e)}function Qt(e){var t;const n=Xt(e.start,e.allDay),a=Xt(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 en(e){const t=Jt(e.start,e.timeZone),n=Jt(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}}function tn(e){return e.map(e=>Qt(e))}function nn(e){return e.map(e=>en(e))}function an(e,t,n,a){return Qt(Object.assign({id:e,title:t,start:n,end:n,allDay:!0},a))}function rn(e,t,n,a,r){return Qt(Object.assign({id:e,title:t,start:n,end:a},r))}const on=e=>{try{return e instanceof Date?e:"string"==typeof e?new Date(e):Y(e)}catch(e){return new Date}},ln=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t},sn=(e,t,n,a)=>{const r=e.getTime()-t.getTime(),i=Math.round(r/864e5);let o="",l="default";if(0===i)o=a("today")||"Today",l="today";else if(1===i||2===i)try{const e=new Intl.RelativeTimeFormat(n,{numeric:"auto"}).format(i,"day");o=e.charAt(0).toUpperCase()+e.slice(1),l="upcoming"}catch(t){o=e.toLocaleDateString(n,{weekday:"long"})}else o=e.toLocaleDateString(n,{year:"numeric",month:"long",day:"numeric",weekday:"long"});return{title:o,tone:l}},dn=(e,t)=>{const n=new Map;e.forEach(e=>{var t;const a=on(e.start),r=ln(a),i=r.getTime();n.has(i)||n.set(i,{date:r,events:[]}),null===(t=n.get(i))||void 0===t||t.events.push(e)});const a=t.getTime();return n.has(a)||n.set(a,{date:t,events:[]}),Array.from(n.values()).toSorted((e,t)=>e.date.getTime()-t.date.getTime())},cn=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 un(e){return String(e).padStart(2,"0")}function hn(e,t,a){const r=e.trim(),i=/^(\d{4})(\d{2})(\d{2})$/,o=/^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})Z$/;if("DATE"===(null==t?void 0:t.value)||i.test(r)){const e=r.match(i);if(e)return n.PlainDate.from({year:Number.parseInt(e[1],10),month:Number.parseInt(e[2],10),day:Number.parseInt(e[3],10)})}if(o.test(r)){const e=r.match(o);if(e){const t=n.Instant.from(`${e[1]}-${e[2]}-${e[3]}T${e[4]}:${e[5]}:${e[6]}Z`),r=a||n.Now.timeZoneId();return t.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==t?void 0:t.tzid)?n.ZonedDateTime.from(Object.assign(Object.assign({},e),{timeZone:t.tzid})):n.PlainDateTime.from(e)}throw new Error(`Invalid ICS date format: ${e}`)}function gn(e,t=!1){if(t||Ce(e)){const t=Ce(e)?e:e.toPlainDate();return{value:`${t.year}${un(t.month)}${un(t.day)}`,params:{VALUE:"DATE"}}}if(Se(e)){const t=e.toInstant().toZonedDateTimeISO("UTC");return{value:`${t.year}${un(t.month)}${un(t.day)}T${un(t.hour)}${un(t.minute)}${un(t.second)}Z`}}if(Te(e))return{value:`${e.year}${un(e.month)}${un(e.day)}T${un(e.hour)}${un(e.minute)}${un(e.second)}`};throw new Error("Unsupported Temporal type")}function mn(e){return`${e.getUTCFullYear()}${un(e.getUTCMonth()+1)}${un(e.getUTCDate())}T${un(e.getUTCHours())}${un(e.getUTCMinutes())}${un(e.getUTCSeconds())}Z`}function vn(e){return e?e.replaceAll("\\","\\\\").replaceAll(";","\\;").replaceAll(",","\\,").replaceAll("\n","\\n"):""}function fn(e){return e?e.replaceAll("\\,",",").replaceAll("\\;",";").replaceAll(/\\[nN]/g,"\n").replaceAll("\\\\","\\"):""}function pn(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 yn(e,t,n){let a=e;return n&&Object.entries(n).forEach(([e,t])=>{a+=`;${e}=${t}`}),a+=`:${t}`,pn(a)}function Dn(e){var t,n,a;const r=["BEGIN:VEVENT"],i=(null===(t=e.meta)||void 0===t?void 0:t.originalUid)||`${e.id}@dayflow`;r.push(`UID:${i}`),r.push(`DTSTAMP:${mn(new Date)}`);const o=gn(e.start,e.allDay);let l;if(e.allDay){const t=(Ce(e.end)?e.end:e.end.toPlainDate()).add({days:1});l={value:`${t.year}${un(t.month)}${un(t.day)}`,params:{VALUE:"DATE"}}}else l=gn(e.end,!1);if(r.push(yn("DTSTART",o.value,o.params)),r.push(yn("DTEND",l.value,l.params)),r.push(yn("SUMMARY",vn(e.title))),e.description&&r.push(yn("DESCRIPTION",vn(e.description))),(null===(n=e.meta)||void 0===n?void 0:n.location)&&r.push(yn("LOCATION",vn(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(vn).join(",");r.push(yn("CATEGORIES",t))}return r.push("END:VEVENT"),r}function wn(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 bn(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),[i,...o]=a.split(";"),l=i.trim().toUpperCase(),s={};switch(o.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=fn(r);break;case"DESCRIPTION":t.description=fn(r);break;case"LOCATION":t.location=fn(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=>fn(e.trim()))}}if(!t.dtstart)throw new Error("Missing DTSTART in VEVENT");return t.uid||(t.uid=Mt()),t}function En(e,t){var a;const{calendarId:r="default",generateNewIds:i=!0,idPrefix:o="ics-",defaultTimeZone:l}=t,s=i?`${o}${Mt()}`:e.uid,d=hn(e.dtstart,e.dtstartParams,l);let c;c=e.dtend?hn(e.dtend,e.dtendParams,l):Ce(d)?d.add({days:1}):d.add({hours:1});const u="DATE"===(null===(a=e.dtstartParams)||void 0===a?void 0:a.value)||Ce(d),h=l||n.Now.timeZoneId();let g,m;if(Ce(d))g=d;else if(Te(d))try{g=d.toZonedDateTime(h)}catch(e){g=n.ZonedDateTime.from(Object.assign(Object.assign({},d),{timeZone:h}))}else g=d;if(Ce(c))m=c.subtract({days:1});else if(Te(c))try{m=c.toZonedDateTime(h)}catch(e){m=n.ZonedDateTime.from(Object.assign(Object.assign({},c),{timeZone:h}))}else m=c;return{id:s,calendarId:r,title:e.summary||"(No Title)",description:e.description,start:g,end:m,allDay:u,meta:{location:e.location,originalUid:e.uid,categories:e.categories}}}function Cn(e,t={}){const n={success:!1,events:[],errors:[],totalParsed:0,totalImported:0};try{const a=wn(e.replaceAll(/(\r\n|\n|\r)[ \t]/g,"").split(/\r\n|\n|\r/));n.totalParsed=a.length,a.forEach((e,a)=>{try{const a=En(bn(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 Tn(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:${vn(n)}`];return e.forEach(e=>{r.push(...Dn(e))}),r.push("END:VCALENDAR"),r.join("\r\n")}function Sn(e,t={}){const n=Tn(e,t),a=`${t.filename||"calendar"}.ics`,r=new Blob([n],{type:"text/calendar;charset=utf-8"}),i=URL.createObjectURL(r),o=document.createElement("a");o.href=i,o.setAttribute("download",a),document.body.append(o),o.click(),o.remove(),URL.revokeObjectURL(i)}function Mn(t,n){return e(this,void 0,void 0,function*(){try{const e=yield t.text();if(!e)throw new Error("File content is empty");return Cn(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}}})}const Nn=e=>{const t=Y(e.start);t.setHours(0,0,0,0);const n=Y(e.end);return n.setHours(0,0,0,0),{startDay:t,endDay:n,isMultiDay:n.getTime()>t.getTime()}},In=(e,t)=>e.title.localeCompare(t.title),kn=(e,t,n)=>{const a=Nn(e),r=Nn(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()},xn=(e,t)=>{const n=new Map;return e.forEach(e=>{const{isMultiDay:t,startDay:a}=Nn(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,i,o,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!==(i=null==u?void 0:u.hasMultiDay)&&void 0!==i&&i))return(null==c?void 0:c.hasMultiDay)?-1:1;if(null!==(o=null==c?void 0:c.hasMultiDay)&&void 0!==o&&o&&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,kn(e,a,t)}},On=({wasOriginallyAllDay:e,mouseHour:t,hourOffset:n,duration:a,originalStartHour:r,originalEndHour:i,firstHour:o,lastHour:l,minDuration:s,roundToTimeStep:d})=>{const c=e?1:Math.max(s,a||i-r||1);let u=d(e?t:t+(null!=n?n:0));return u=Math.max(o,Math.min(l-c,u)),{startHour:u,endHour:u+c,duration:c,hourOffset:e?0:null!=n?n:0}};let Rn=null;const Hn=()=>{const[e,t]=g(()=>Rn||{weekHeight:R.WEEK_HEIGHT,screenSize:"desktop",weeksPerView:6});return m(()=>{const e=()=>{const e=window.innerWidth,n=window.innerHeight-150,a=Math.max(80,Math.floor(n/6)),r=e<768?{weekHeight:Math.max(R.MOBILE_WEEK_HEIGHT,a),screenSize:"mobile",weeksPerView:6}:e<1024?{weekHeight:Math.max(R.TABLET_WEEK_HEIGHT,a),screenSize:"tablet",weeksPerView:6}:{weekHeight:Math.max(R.WEEK_HEIGHT,a),screenSize:"desktop",weeksPerView:6};Rn=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},Pn=r({locale:"en-US",t:e=>e,getWeekDaysLabels:()=>[],getMonthLabels:()=>[],isDefault:!0});function An(){return D(Pn)}const Ln="df-month-view",$n="df-view-header-title",jn="df-btn-sm df-btn-sm-ghost",Yn="df-date-number",Fn="df-scroll-container",Zn="df-time-slot",_n="df-time-label",zn="df-time-grid-row",Un="df-current-time-line",Wn="df-current-time-label",Bn="df-all-day-row",Vn="df-all-day-label",qn="df-event-title",Gn="df-event-month-color-bar",Kn="df-event-icon-svg",Xn="df-event-resize-handle df-event-resize-handle-left df-resize-handle",Jn="df-event-resize-handle df-event-resize-handle-right df-resize-handle",Qn="df-nav-button df-calendar-nav-button",ea="df-event-detail-panel df-portal",ta="df-portal df-calendar-picker-dropdown df-animate-in df-fade-in df-zoom-in-95",na="df-time-grid-boundary",aa="df-midnight-label",ra="df-sidebar",ia="df-sidebar-header",oa="df-sidebar-toggle",la="df-sidebar-header-title",sa="df-icon-btn",da=(...e)=>e.filter(Boolean).join(" "),ca=({className:e,width:t=24,height:n=24})=>zt("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:zt("path",{d:"m15 18-6-6 6-6"})}),ua=({className:e,width:t=24,height:n=24})=>zt("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:zt("path",{d:"m9 18 6-6-6-6"})}),ha=({className:e,width:t=24,height:n=24})=>zt("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:zt("path",{d:"m6 9 6 6 6-6"})}),ga=({className:e,width:t=24,height:n=24})=>zt("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:[zt("path",{d:"M5 12h14"}),zt("path",{d:"M12 5v14"})]}),ma=({className:e,width:t=24,height:n=24})=>zt("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:[zt("circle",{cx:"11",cy:"11",r:"8"}),zt("path",{d:"m21 21-4.3-4.3"})]}),va=({className:e,width:t=24,height:n=24})=>zt("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:zt("path",{d:"M20 6 9 17l-5-5"})}),fa=({className:e,width:t=24,height:n=24})=>zt("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:[zt("path",{d:"m7 15 5 5 5-5"}),zt("path",{d:"m7 9 5-5 5 5"})]}),pa=({className:e,width:t=24,height:n=24})=>zt("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:[zt("path",{d:"M18 6 6 18"}),zt("path",{d:"m6 6 12 12"})]}),ya=({className:e,width:t=24,height:n=24})=>zt("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:[zt("path",{d:"M8 2v4"}),zt("path",{d:"M16 2v4"}),zt("rect",{width:"18",height:"18",x:"3",y:"4",rx:"2"}),zt("path",{d:"M3 10h18"}),zt("path",{d:"M8 14h.01"}),zt("path",{d:"M12 14h.01"}),zt("path",{d:"M16 14h.01"}),zt("path",{d:"M8 18h.01"}),zt("path",{d:"M12 18h.01"}),zt("path",{d:"M16 18h.01"})]}),Da=({className:e,width:t=24,height:n=24})=>zt("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:zt("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),wa=({className:e,width:t=24,height:n=24})=>zt("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:[zt("rect",{width:"18",height:"14",x:"3",y:"8",rx:"2"}),zt("path",{d:"M12 5a3 3 0 1 0-3 3"}),zt("path",{d:"M12 5a3 3 0 1 1 3 3"}),zt("path",{d:"M3 12h18"}),zt("path",{d:"M12 22V8"})]}),ba=({className:e,width:t=24,height:n=24})=>zt("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:zt("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"})}),Ea=({className:e,width:t=24,height:n=24})=>zt("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:[zt("path",{d:"M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z"}),zt("circle",{cx:"12",cy:"10",r:"3"})]}),Ca=({className:e,width:t=24,height:n=24})=>zt("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:zt("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"})}),Ta=({className:e,width:t=24,height:n=24})=>zt("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:[zt("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),zt("path",{d:"M15 3v18"}),zt("path",{d:"m8 9 3 3-3 3"})]}),Sa=({className:e,width:t=24,height:n=24})=>zt("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:[zt("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),zt("path",{d:"M15 3v18"}),zt("path",{d:"m10 15-3-3 3-3"})]}),Ma=({className:e,width:t=24,height:n=24})=>zt("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:[zt("path",{d:"m12 19-7-7 7-7"}),zt("path",{d:"M19 12H5"})]}),Na=({className:e,width:t=24,height:n=24})=>zt("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:[zt("path",{d:"M4 11a9 9 0 0 1 9 9"}),zt("path",{d:"M4 4a16 16 0 0 1 16 16"}),zt("circle",{cx:"5",cy:"19",r:"1"})]}),Ia=({className:e,width:t=24,height:n=24})=>zt("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:[zt("circle",{cx:"12",cy:"12",r:"10"}),zt("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),zt("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]});function ka(e,t){var n,a,r,i,o;try{return"today"===e?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:"week"===e?null!==(i=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!==i?i:null:null!==(o=new Intl.DisplayNames(t,{type:"dateTimeField"}).of(e))&&void 0!==o?o:null}catch(e){return null}}function xa(e){return e.charAt(0).toUpperCase()+e.slice(1)}const Oa=(e,t="short",n=1)=>{const a=[],r=new Date(2024,0,7);for(let i=0;i<7;i++){const o=new Date(r);o.setDate(r.getDate()+n+i);try{a.push(o.toLocaleDateString(e,{weekday:t}))}catch(e){a.push(o.toLocaleDateString("en-US",{weekday:t}))}}return a},Ra=(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 Ha(e,t="en-US"){var n;if(["today","day","week","month","year"].includes(e)){const n=ka(e,t);if(n)return xa(n)}const a=I(t),r=M[a],i=null===(n=null==r?void 0:r.messages)||void 0===n?void 0:n[e];if(i)return i;const o=M.en.messages;return(null==o?void 0:o[e])||e}const Pa=({locale:e="en-US",messages:t,children:n})=>{const a=p(()=>"string"==typeof e?{code:k(e)?e:"en-US",messages:void 0}:e&&"string"!=typeof e&&!k(e.code)?Object.assign(Object.assign({},e),{code:"en-US"}):e||{code:"en-US"},[e]),r=p(()=>{const e=a.code;return{locale:e,t:(n,r)=>{var i,o,l;let s=null!==(l=null!==(i=null==t?void 0:t[n])&&void 0!==i?i:null===(o=a.messages)||void 0===o?void 0:o[n])&&void 0!==l?l:Ha(n,e);return r&&Object.entries(r).forEach(([e,t])=>{s=s.replaceAll(new RegExp(`{${e}}`,"g"),t)}),s},getWeekDaysLabels:Oa,getMonthLabels:Ra,isDefault:!1}},[a,t]);return zt(Pn.Provider,{value:r,children:n})},Aa=(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 i=n(e);return i!==e?i:e.split(/[-_]/g).map(e=>e?e.charAt(0).toUpperCase()+e.slice(1):e).join(" ")},La=({calendar:e,mode:t="buttons"})=>{const[n,a]=g(!1),r=v(null),{t:i}=An(),o=Array.from(e.state.views.keys()),l=e.state.currentView;return m(()=>{const e=e=>{r.current&&!r.current.contains(e.target)&&a(!1)};if(n)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[n]),o.length<=1?null:zt("div","select"===t?{className:"df-view-switcher-select",ref:r,children:[zt("button",{type:"button",onClick:()=>a(!n),className:"df-view-switcher-select-trigger","aria-expanded":n,"aria-haspopup":"listbox",children:[zt("span",{children:Aa(l,e,i)}),zt("span",{className:"df-view-switcher-select-chevron","data-open":n?"true":"false",children:zt(ha,{width:16,height:16})})]}),n&&zt("div",{className:"df-view-switcher-select-dropdown df-animate-in df-fade-in df-zoom-in-95",children:zt("div",{className:"df-view-switcher-select-list",role:"listbox",children:o.map(t=>zt("button",{type:"button",onClick:()=>{e.changeView(t),a(!1),e.triggerRender()},className:"df-view-switcher-select-option","data-active":l===t?"true":"false",role:"option","aria-selected":l===t,children:Aa(t,e,i)},t))})})]}:{className:"df-view-switcher",children:o.map(t=>zt("button",{type:"button",className:"df-view-switcher-btn","data-active":l===t?"true":"false",onClick:()=>{e.changeView(t),e.triggerRender()},children:Aa(t,e,i)},t))})},$a=({calendar:e,switcherMode:t="buttons",onAddCalendar:n,onSearchChange:a,onSearchClick:r,searchValue:i="",isSearchOpen:o=!1,isEditable:l=!0,safeAreaLeft:s})=>{const d="buttons"===t,c=e.state.currentView===x.DAY,{screenSize:u}=Hn(),h="mobile"===u,{t:g}=An(),m=f(e=>{const t=e.currentTarget.value;t!==i&&(null==a||a(t))},[a,i]);return zt("div",{className:"df-header","data-bordered":c||o?"true":"false",style:{paddingLeft:s||8,transition:"padding-left 160ms ease-in-out"},onContextMenu:e=>e.preventDefault(),children:[zt("div",{className:"df-header-left",children:n&&l&&zt("button",{type:"button",id:"dayflow-add-event-btn",onClick:n,className:sa,title:h?g("newEvent")||"New Event":g("createCalendar")||"Add Calendar",children:zt(ga,{})})}),zt("div",{className:"df-header-mid",children:d&&zt(La,{mode:t,calendar:e})}),zt("div",{className:"df-header-right",children:[!d&&zt(La,{mode:t,calendar:e}),h?zt("button",{type:"button",onClick:r,className:sa,title:g("search")||"Search",children:zt(ma,{})}):zt("div",{className:"df-search-group",children:[zt("div",{className:"df-search-group-icon",children:zt(ma,{width:16,height:16})}),zt("input",{id:"dayflow-search-input",type:"text",placeholder:g("search")||"Search",value:i,onChange:m,className:"df-search-group-input",style:{width:"12rem"}}),i&&zt("button",{type:"button",onClick:()=>{null==a||a("")},className:"df-search-group-clear",children:zt("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[zt("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),zt("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})]})},ja=r(void 0),Ya=({children:e,initialTheme:t="light",onThemeChange:n})=>{const[a,r]=g(t),[i,o]=g(()=>"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),l="auto"===a?i:a;m(()=>{r(t)},[t]);const s=f(e=>{r(e)},[]);m(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-color-scheme: dark)"),t=e=>{const t=e.matches?"dark":"light";o(t)};return e.addEventListener?e.addEventListener("change",t):e.addListener&&e.addListener(t),()=>{e.removeEventListener?e.removeEventListener("change",t):e.removeListener&&e.removeListener(t)}},[]),y(()=>{if("undefined"==typeof document)return;const e=document.documentElement,t=Kt(l),n="auto"===a?t:l;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)},[l,a,i]),m(()=>{n&&n(a,l)},[a,l,n]);const d=p(()=>({theme:a,effectiveTheme:l,setTheme:s}),[a,l,s]);return zt(ja.Provider,{value:d,children:e})},Fa=()=>{const e=D(ja);if(void 0===e)throw new Error("useTheme must be used within a ThemeProvider");return e},Za=r(null);let _a=0;function za({generatorName:e,generatorArgs:t,defaultContent:n,store:a}){const r=v(null),i=D(Za),o=a||i,l=v(null),[s,d]=g(()=>{var t;return!!e&&null!==(t=null==o?void 0:o.isOverridden(e))&&void 0!==t&&t});l.current||(l.current="df-slot-"+_a++),m(()=>{if(!r.current||!o||!e)return;const n=l.current;o.register({id:n,containerEl:r.current,generatorName:e,generatorArgs:t});const a=o.subscribeToOverrides(()=>{d(o.isOverridden(e))});return()=>{o.unregister(n),a()}},[o,e]),m(()=>{if(!o||!l.current||!e)return;const n=l.current;o.register({id:n,containerEl:r.current,generatorName:e,generatorArgs:t})},[e,t]);const c=null==e?void 0:e.startsWith("eventContent");return zt("div",{ref:r,className:"df-content-slot "+(c||"sidebar"===e?"df-content-slot-stacked":""),children:!s&&n})}const Ua=e=>{const n=v(null),a=v(null);return m(()=>{if(n.current){const r=t(e,[]);a.current=new w(n.current,r),r.initialExpanded&&a.current.expand()}return()=>{a.current&&(a.current.destroy(),a.current=null)}},[]),m(()=>{if(a.current){const n=t(e,[]);a.current.setOptions(n)}},[e]),zt("div",{ref:n,className:e.className})},Wa=({color:e,onChange:t,onClose:n})=>{const a=p(()=>{const{h:t,l:n}=b(e);return{hue:t,saturation:E(n),lightness:n,alpha:100,layer:"outer"}},[e]);return zt("div",{className:"df-default-color-picker",children:zt(Ua,{defaultValue:a,coreSize:36,petalSize:32,initialExpanded:!0,openOnHover:!1,onChange:e=>t({hex:e.hex},!0),onCollapse:n})})},Ba=n=>{var{children:a,onClick:r,loading:o,loadingText:l,disabled:s,className:d,type:c="button"}=n,u=t(n,["children","onClick","loading","loadingText","disabled","className","type"]);const[h,m]=g(!1),v=o||h,f=zt(i,{children:[v&&zt("svg",{className:"df-loading-btn-spinner",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[zt("circle",{className:"df-loading-btn-track",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),zt("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"})]}),zt("span",{className:"df-loading-btn-label",children:v&&l?l:a})]}),p=Object.assign(Object.assign({},u),{disabled:s||v,onClick:t=>e(void 0,void 0,void 0,function*(){if(!v&&r){const e=r(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":v?"true":"false"});return zt("button","submit"===c?Object.assign({},p,{type:"submit",children:f}):"reset"===c?Object.assign({},p,{type:"reset",children:f}):Object.assign({},p,{type:"button",children:f}))},Va=["#ea426b","#f19a38","#f7cf46","#83d754","#51aaf2","#b672d0","#957e5e"],qa=({onClose:t,onCreate:n,app:a})=>{const{t:r}=An(),{effectiveTheme:o}=Fa(),[l,s]=g(""),[d,u]=g(!1),h=a.state.overrides.includes("createCalendarDialogColorPicker"),[m,v]=g(Va[Math.floor(Math.random()*Va.length)]),[f,y]=g(!1),[D,w]=g(""),b=p(()=>{const e=C[Math.floor(Math.random()*C.length)],t=e.layer||"outer",n=E(e.l);return{hue:e.h,saturation:n,lightness:e.l,alpha:100,layer:t}},[]),[S,M]=g(null),N=e=>{v(e.hex)},I=()=>{y(!1)},k=()=>{v(D),y(!1)},x="dark"===o,O={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:c(zt("div",{className:"df-portal df-create-calendar-dialog-backdrop",children:zt("div",{className:"df-animate-in df-fade-in df-zoom-in-95 df-create-calendar-dialog-panel",onClick:e=>e.stopPropagation(),children:[zt("h2",{className:"df-create-calendar-dialog-title "+(h?"df-create-calendar-dialog-title-compact":""),children:r("createCalendar")}),zt("form",{onSubmit:a=>e(void 0,void 0,void 0,function*(){var e;if(a.preventDefault(),l.trim()&&!d){u(!0);try{let a;a=h?m:null!==(e=null==S?void 0:S.hex)&&void 0!==e?e:T(b.hue,b.saturation,b.lightness);const{colors:r,darkColors:i}=se(a),o={id:Mt(),name:l.trim(),colors:r,darkColors:i,isVisible:!0,isDefault:!1};yield n(o),t()}finally{u(!1)}}}),children:[h?zt(i,{children:[zt("div",{className:"df-create-calendar-dialog-color-row",children:[zt("div",{className:"df-create-calendar-dialog-color-preview",style:{backgroundColor:m}}),zt("input",{id:"custom-calendar-name",name:"calendar-name",type:"text",value:l,onChange:e=>s(e.target.value),className:"df-form-input",style:{flex:1},placeholder:r("calendarNamePlaceholder"),autoFocus:!0})]}),zt("div",{className:"df-create-calendar-dialog-color-section",children:[zt("div",{className:"df-create-calendar-dialog-color-grid",children:Va.map(e=>zt("button",{type:"button",className:"df-create-calendar-dialog-color-btn","data-selected":m===e?"true":"false",style:{backgroundColor:e},onClick:()=>v(e)},e))}),zt("div",{style:{position:"relative"},children:[zt("button",{type:"button",onClick:()=>{w(m),y(!0)},className:"df-create-calendar-dialog-custom-color-btn",children:r("customColor")}),f&&zt("div",{className:"df-create-calendar-dialog-picker-overlay",onClick:k,children:zt("div",{className:"df-animate-in df-fade-in df-zoom-in-95 df-create-calendar-dialog-picker-inner",onClick:e=>e.stopPropagation(),children:zt(za,{generatorName:"createCalendarDialogColorPicker",generatorArgs:{color:m,onChange:N,onAccept:I,onCancel:k,styles:O},defaultContent:zt("div",{className:"df-create-calendar-dialog-picker-card",children:[zt(Wa,{color:m,onChange:N}),zt("div",{className:"df-create-calendar-dialog-picker-actions",children:[zt("button",{type:"button",onClick:k,className:"df-btn-sm df-btn-sm-ghost",children:r("cancel")}),zt("button",{type:"button",onClick:I,className:"df-fill-primary df-btn-sm",children:"OK"})]})]})})})})]})]})]}):zt("div",{className:"df-create-calendar-dialog-blossom-row",children:[zt("div",{className:"df-create-calendar-dialog-blossom-input-area",children:zt("input",{id:"blossom-calendar-name",name:"calendar-name",type:"text",value:l,onChange:e=>s(e.target.value),className:"df-form-input",placeholder:r("calendarNamePlaceholder"),autoFocus:!0})}),zt("div",{className:"df-create-calendar-dialog-blossom-picker-wrap",children:zt("div",{className:"df-create-calendar-dialog-blossom-picker-inner",children:zt(Ua,{defaultValue:b,coreSize:36,petalSize:32,openOnHover:!1,onChange:e=>M(e),onCollapse:e=>M(e),className:"df-create-calendar-dialog-blossom-picker"})})})]}),zt("div",{className:"df-create-calendar-dialog-actions",children:[zt("button",{type:"button",onClick:t,disabled:d,className:"df-btn-sm df-btn-sm-ghost",children:r("cancel")}),zt(Ba,{type:"submit",disabled:!l.trim(),loading:d,className:"df-fill-primary df-hover-primary-solid df-btn-sm",children:r("create")})]})]})]})}),document.body)};var Ga=0;function Ka(e,t,n,r,i,o){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:n,ref:l,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Ga,__i:-1,__u:0,__source:i,__self:o};if("function"==typeof e&&(l=e.defaultProps))for(s in l)void 0===d[s]&&(d[s]=l[s]);return a.vnode&&a.vnode(c),c}const Xa=(e,t)=>n.PlainDate.compare(e,t),Ja=({calendarDays:e,visibleMonth:t,startDate:n,endDate:a,weekDayLabels:r,disabled:o,onDaySelect:l})=>Ka(i,{children:[Ka("div",{className:"df-range-picker-weekday-row",children:r.map(e=>Ka("span",{className:"df-range-picker-weekday-label",children:e},e))}),Ka("div",{className:"df-range-picker-day-grid",children:e.map(e=>{const r=e.month!==t.month,i=0===Xa(e,n),s=0===Xa(e,a),d=Xa(e,n)>=0&&Xa(e,a)<=0;return Ka("button",{type:"button",disabled:o,onClick:()=>l(e),className:"df-range-picker-day-cell","data-outside":r,"data-range-edge":i?"start":s?"end":void 0,"data-in-range":d&&!i&&!s,children:e.day},e.toString())})})]}),Qa=({className:e,width:t=24,height:n=24})=>Ka("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:Ka("path",{d:"m15 18-6-6 6-6"})}),er=({className:e,width:t=24,height:n=24})=>Ka("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:Ka("path",{d:"m9 18 6-6-6-6"})}),tr=({className:e,width:t=24,height:n=24})=>Ka("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:[Ka("path",{d:"m11 17-5-5 5-5"}),Ka("path",{d:"m18 17-5-5 5-5"})]}),nr=({className:e,width:t=24,height:n=24})=>Ka("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:[Ka("path",{d:"m6 17 5-5-5-5"}),Ka("path",{d:"m13 17 5-5-5-5"})]}),ar=({className:e,width:t=24,height:n=24})=>Ka("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:[Ka("path",{d:"M18 8L22 12L18 16"}),Ka("path",{d:"M2 12H22"})]}),rr=({visibleMonth:e,monthLabels:t,disabled:n,onMonthChange:a,onYearChange:r})=>Ka("div",{className:"df-range-picker-calendar-header",children:[Ka("div",{className:"df-range-picker-calendar-nav-group",children:[Ka("button",{type:"button",disabled:n,onClick:()=>r(-1),className:"df-range-picker-calendar-nav-button",children:Ka(tr,{width:14,height:12})}),Ka("button",{type:"button",disabled:n,onClick:()=>a(-1),className:"df-range-picker-calendar-nav-button",children:Ka(Qa,{width:14,height:12})})]}),Ka("div",{className:"df-range-picker-calendar-title",children:[t[e.month-1]," ",e.year]}),Ka("div",{className:"df-range-picker-calendar-nav-group",children:[Ka("button",{type:"button",disabled:n,onClick:()=>a(1),className:"df-range-picker-calendar-nav-button",children:Ka(er,{width:14,height:12})}),Ka("button",{type:"button",disabled:n,onClick:()=>r(1),className:"df-range-picker-calendar-nav-button",children:Ka(nr,{width:14,height:12})})]})]}),ir=Array.from({length:24},(e,t)=>t),or=Array.from({length:60},(e,t)=>t);function lr(e){return null!==e&&"object"==typeof e&&!("hour"in e)&&"year"in e&&"month"in e&&"day"in e&&!(e instanceof Date)}const sr=/(YYYY|YY|MM|DD|HH|mm)/g,dr=e=>e.toString().padStart(2,"0"),cr=(e,t)=>{const n=(null!=t?t:"").trim();return(/[Hhms]/.test(e)||!n?e:`${e} ${n}`.trim()).replaceAll(/(H{1,2}):MM/g,(e,t)=>`${t}:mm`)},ur=e=>e.replaceAll(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),hr=(e,t,a,r)=>{const i=e.trim();if(!i)return null;const o=i.match(t),l=null==o?void 0:o.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 n.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}},gr=e=>{var t;const a=e;return"string"==typeof a.timeZoneId?a.timeZoneId:"string"==typeof a.timeZone?a.timeZone:"string"==typeof(null===(t=a.timeZone)||void 0===t?void 0:t.id)?a.timeZone.id:n.Now.timeZoneId()},mr=(e,t,a)=>{var r,i,o,l,s,d,c,u,h,g,m,v,f,p,y,D,w,b,E,C,T,S,M,N;if(!e){const e=null!=t?t:a?gr(a):n.Now.timeZoneId();return null!=a?a:n.Now.zonedDateTimeISO(e)}if(lr(e)){const a=null!=t?t:n.Now.timeZoneId(),r=`${e.year}-${dr(e.month)}-${dr(e.day)}T00:00:00[${a}]`;return n.ZonedDateTime.from(r)}const I=e;if("hour"in I&&!("timeZoneId"in I)){const e=null!=t?t:n.Now.timeZoneId();if("function"==typeof I.toZonedDateTime)try{return I.toZonedDateTime(e)}catch(e){}return n.ZonedDateTime.from({timeZone:e,year:I.year,month:I.month,day:I.day,hour:I.hour,minute:I.minute,second:null!==(r=I.second)&&void 0!==r?r:0,millisecond:null!==(i=I.millisecond)&&void 0!==i?i:0,microsecond:null!==(o=I.microsecond)&&void 0!==o?o:0,nanosecond:null!==(l=I.nanosecond)&&void 0!==l?l:0})}try{return n.ZonedDateTime.from(e)}catch(e){const r=null!==(h=null!==(u=null!==(c=null!==(d="string"==typeof I.timeZone?I.timeZone:null===(s=I.timeZone)||void 0===s?void 0:s.id)&&void 0!==d?d:I.timeZoneId)&&void 0!==c?c:t)&&void 0!==u?u:a?gr(a):void 0)&&void 0!==h?h:n.Now.timeZoneId();if("function"==typeof I.toZonedDateTime)try{return I.toZonedDateTime(r)}catch(e){}const i=null!=a?a:n.Now.zonedDateTimeISO(r);return n.ZonedDateTime.from({timeZone:r,year:null!==(g=I.year)&&void 0!==g?g:i.year,month:null!==(m=I.month)&&void 0!==m?m:i.month,day:null!==(v=I.day)&&void 0!==v?v:i.day,hour:null!==(p=null!==(f=I.hour)&&void 0!==f?f:null==a?void 0:a.hour)&&void 0!==p?p:0,minute:null!==(D=null!==(y=I.minute)&&void 0!==y?y:null==a?void 0:a.minute)&&void 0!==D?D:0,second:null!==(b=null!==(w=I.second)&&void 0!==w?w:null==a?void 0:a.second)&&void 0!==b?b:0,millisecond:null!==(C=null!==(E=I.millisecond)&&void 0!==E?E:null==a?void 0:a.millisecond)&&void 0!==C?C:0,microsecond:null!==(S=null!==(T=I.microsecond)&&void 0!==T?T:null==a?void 0:a.microsecond)&&void 0!==S?S:0,nanosecond:null!==(N=null!==(M=I.nanosecond)&&void 0!==M?M:null==a?void 0:a.nanosecond)&&void 0!==N?N:0})}},vr=(e,t,n)=>{const a=cr(t,n),r={YYYY:e.year.toString(),YY:dr(e.year%100),MM:dr(e.month),DD:dr(e.day),HH:dr(e.hour),mm:dr(e.minute)};return a.replace(sr,e=>{var t;return null!==(t=r[e])&&void 0!==t?t:e})},fr="df-scrollbar-hide",pr=({focusedField:e,draftRange:t,disabled:n,onHourSelect:a,onMinuteSelect:r,timeListRefs:i})=>{const o=e,l=t["start"===o?0:1],s=l.minute,d=or.includes(s)?or:[...or,s].toSorted((e,t)=>e-t);return Ka("div",{className:"df-range-picker-time-selector",children:[Ka("div",{className:"df-range-picker-time-selector-header",children:Ka("div",{className:"df-range-picker-time-selector-value",children:[l.hour.toString().padStart(2,"0"),":",l.minute.toString().padStart(2,"0")]})}),Ka("div",{className:"df-range-picker-time-selector-body",children:[Ka("div",{className:"df-range-picker-time-selector-column",children:Ka("div",{className:`df-range-picker-time-list ${fr}`,role:"listbox","aria-label":"Hour",ref:e=>{i.current&&i.current[o]&&(i.current[o].hour=e)},children:ir.map(e=>{const t=e===l.hour;return Ka("button",{type:"button",role:"option","aria-selected":t,disabled:n,onClick:()=>a(o,e),className:"df-range-picker-time-option","data-active":t?"true":void 0,children:dr(e)},e)})})}),Ka("div",{className:"df-range-picker-time-selector-column",children:Ka("div",{className:`df-range-picker-time-list ${fr}`,role:"listbox","aria-label":"Minute",ref:e=>{i.current&&i.current[o]&&(i.current[o].minute=e)},children:d.map(e=>{const t=e===s;return Ka("button",{type:"button",role:"option","aria-selected":t,disabled:n,onClick:()=>r(o,e),className:"df-range-picker-time-option","data-active":t?"true":void 0,children:dr(e)},e)})})})]})]})},yr=({visibleMonth:e,monthLabels:t,weekDayLabels:n,calendarDays:a,draftRange:r,focusedField:i,isTimeEnabled:o,disabled:l,matchTriggerWidth:s,popupRef:d,timeListRefs:c,onMonthChange:u,onYearChange:h,onDaySelect:g,onHourSelect:m,onMinuteSelect:v,onOk:f,getPopupStyle:p})=>{const y=r[0].toPlainDate(),D=r[1].toPlainDate();return Ka("div",{ref:d,className:"df-range-picker df-range-picker-popup",style:p(),"data-range-picker-popup":"true",children:Ka("div",{className:"df-range-picker-panel",style:{boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",width:s?"100%":void 0},children:[Ka("div",{className:"df-range-picker-panel-body",children:[Ka("div",{className:"df-range-picker-calendar-pane",children:[Ka(rr,{visibleMonth:e,monthLabels:t,disabled:l,onMonthChange:u,onYearChange:h}),Ka(Ja,{calendarDays:a,visibleMonth:e,startDate:y,endDate:D,weekDayLabels:n,disabled:l,onDaySelect:g})]}),o&&Ka("div",{className:"df-range-picker-time-pane",children:Ka(pr,{focusedField:i,draftRange:r,disabled:l,onHourSelect:m,onMinuteSelect:v,timeListRefs:c})})]}),Ka("div",{className:"df-range-picker-footer",children:Ka("button",{type:"button",onClick:f,disabled:l,className:"df-range-picker-confirm-button",children:"OK"})})]})})},Dr=({value:e,format:t="YYYY-MM-DD HH:mm",showTimeFormat:a="HH:mm",showTime:r=!0,onChange:i,onOk:o,timeZone:l,disabled:s=!1,placement:d="bottomLeft",autoAdjustOverflow:u=!0,getPopupContainer:h,matchTriggerWidth:y=!1,locale:D="en-US"})=>{const w=p(()=>"string"==typeof D?D:(null==D?void 0:D.code)||"en-US",[D]),b=p(()=>void 0===r||"object"==typeof r||Boolean(r),[r]),E=p(()=>((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})(w,"short"),[w]),C=p(()=>((e,t="short",n=1)=>{const a=[],r=new Date(2024,0,7);for(let i=0;i<7;i++){const o=new Date(r);o.setDate(r.getDate()+n+i);try{a.push(o.toLocaleDateString(e,{weekday:t}))}catch(e){a.push(o.toLocaleDateString("en-US",{weekday:t}))}}return a})(w,"narrow"),[w]),T=p(()=>b?"object"==typeof r&&(null==r?void 0:r.format)?r.format:a:"",[b,r,a]),S=p(()=>cr(t,T),[t,T]),M=p(()=>(e=>{let t,n=0,a="^";for(;null!==(t=sr.exec(e));){a+=ur(e.slice(n,t.index));const r=t[0];a+=`(?<${r}>\\d{${"YYYY"===r?4:2}})`,n=t.index+r.length}return a+=ur(e.slice(n))+"$",new RegExp(a)})(S),[S]),N=p(()=>{const t=null!=l?l:lr(e[0])?lr(e[1])?n.Now.timeZoneId():gr(e[1]):gr(e[0]),a=mr(e[0],t).withTimeZone(t);return[a,mr(e[1],t,a).withTimeZone(t)]},[e,l]),[I,k]=g(N),x=v(N),[O,R]=g("start"),[H,P]=g([vr(N[0],t,T),vr(N[1],t,T)]),A=v([vr(N[0],t,T),vr(N[1],t,T)]),L=v(N),[$,j]=g(N[0].toPlainDate().with({day:1})),[Y,F]=g(!1),Z=f(e=>{F(e)},[]),[_,z]=g(d),U=v(d),W=v(null),B=v(null),V=v({start:{hour:null,minute:null},end:{hour:null,minute:null}}),q=v(!1),G=v(!1);m(()=>{A.current=H},[H]),m(()=>{L.current=I},[I]),m(()=>{const e=x.current,t=0!==n.ZonedDateTime.compare(e[0],N[0])||e[0].timeZoneId!==N[0].timeZoneId,a=0!==n.ZonedDateTime.compare(e[1],N[1])||e[1].timeZoneId!==N[1].timeZoneId;(t||a)&&k(N),x.current=N},[N]),m(()=>{j(N[0].toPlainDate().with({day:1}))},[N[0]]);const K=f((e,t,n=0)=>{var a;if(!e||!t)return;const r=e.getBoundingClientRect(),i=t.getBoundingClientRect().top-r.top+e.scrollTop-n,o=(null===(a=window.matchMedia)||void 0===a?void 0:a.call(window,"(prefers-reduced-motion: reduce)").matches)?"auto":"smooth";Math.abs(e.scrollTop-i)>1&&e.scrollTo({top:i,behavior:o})},[]),X=f(e=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{const t=V.current[e];["hour","minute"].forEach(e=>{const n=t[e];if(!n)return;const a=n.querySelector('[data-active="true"]');a&&K(n,a,0)})})})},[K]);m(()=>{Y&&b&&X(O)},[O,Y,X,b]);const J=I[0].epochMilliseconds,Q=I[0].offsetNanoseconds,ee=I[1].epochMilliseconds,te=I[1].offsetNanoseconds;m(()=>{if(G.current)return;const[e,n]=L.current,a=vr(e,t,T),r=vr(n,t,T),[i,o]=A.current;i===a&&o===r||(A.current=[a,r],P([a,r]))},[J,Q,ee,te,t,T]),m(()=>{if(!Y)return;const e=e=>{var t,n;const a=e.target;(null===(t=W.current)||void 0===t?void 0:t.contains(a))||(null===(n=B.current)||void 0===n?void 0:n.contains(a))||a.closest("[data-range-picker-popup]")||Z(!1)};return document.addEventListener("pointerdown",e,!0),()=>{document.removeEventListener("pointerdown",e,!0)}},[Y]),m(()=>{Y||(R("start"),q.current||k(N),q.current=!1)},[Y,N]);const ne=f(e=>{i&&i(e,[vr(e[0],t,T),vr(e[1],t,T)])},[T,t,i]),ae=f(e=>{o&&o(e,[vr(e[0],t,T),vr(e[1],t,T)])},[T,t,o]),re=f((e,t)=>{k(a=>{const r=[...a];if("start"===e){const e=mr(r[1],gr(t),t),a=n.ZonedDateTime.compare(t,e)>0?t:e;return[t,a]}const i=mr(r[0],gr(t),t);return[n.ZonedDateTime.compare(i,t)>0?t:i,t]})},[]),ie=f((e,t)=>{if(s)return;const a="start"===e?0:1;k(r=>{const i=r[a],o=i.with({hour:t,minute:i.minute,second:0,millisecond:0,microsecond:0,nanosecond:0});if("start"===e){const e=mr(r[1],gr(o),o);return[o,n.ZonedDateTime.compare(o,e)>0?o:e]}const l=mr(r[0],gr(o),o);return[n.ZonedDateTime.compare(l,o)>0?o:l,o]}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const t=V.current[e].hour;if(!t)return;const n=t.querySelector('[data-active="true"]');n&&K(t,n,0)})})},[s,K]),oe=f((e,t)=>{if(s)return;const a="start"===e?0:1;k(r=>{const i=r[a].with({minute:t,second:0,millisecond:0,microsecond:0,nanosecond:0});if("start"===e){const e=mr(r[1],gr(i),i);return[i,n.ZonedDateTime.compare(i,e)>0?i:e]}const o=mr(r[0],gr(i),i);return[n.ZonedDateTime.compare(o,i)>0?i:o,i]}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const t=V.current[e].minute;if(!t)return;const n=t.querySelector('[data-active="true"]');n&&K(t,n,0)})})},[s,K]),le=f((e,t)=>{const n="start"===e?0:1;P(e=>{const a=[...e];return a[n]=t,a})},[]),se=f((e,n)=>{const a="start"===e?0:1,r=I[a],i=gr(r),o=hr(n,M,r,i);if(o){re(e,o);const t=o.toPlainDate().with({day:1});return j(t),"start"===e&&R("end"),!0}return P(e=>{const n=[...e];return n[a]=vr(I[a],t,T),n}),!1},[I,T,t,M,re]),de=f(e=>t=>{const n=t.currentTarget.value;G.current=!0,le(e,n);const a="start"===e?0:1,r=L.current[a],i=gr(r),o=hr(n,M,r,i);if(o){re(e,o);const t=o.toPlainDate().with({day:1});j(t),X(e)}},[le,M,re,X]),ce=f(e=>n=>{var a;if(s)return;if(G.current=!1,Y){const n="start"===e?0:1,a=vr(L.current[n],t,T);return void P(e=>{const t=[...e];return t[n]=a,t})}const r=n.relatedTarget;r&&(null===(a=W.current)||void 0===a?void 0:a.contains(r))||se(e,n.currentTarget.value)},[se,s,Y,t,T]),ue=f(e=>t=>{"Enter"===t.key&&(t.preventDefault(),G.current=!1,se(e,t.currentTarget.value)),"Escape"===t.key&&t.currentTarget.blur()},[se]),he=p(()=>{const e=$,t=e.dayOfWeek%7,n=e.subtract({days:t});return Array.from({length:42},(e,t)=>n.add({days:t}))},[$]),ge=f((e=d)=>{if(!u||!W.current)return e;const t=W.current.getBoundingClientRect(),n=y?t.width:480,a=window.innerHeight-t.bottom,r=t.top,i=window.innerWidth-t.left,o=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")&&i<n&&o>i?l=l.replace("Left","Right"):l.endsWith("Right")&&o<n&&i>o&&(l=l.replace("Right","Left")),l},[u,y,d]),me=f(()=>{const e=ge();U.current!==e&&(U.current=e,z(e))},[ge]),ve=e=>{if(s)return;R(e);const t=I["start"===e?0:1].toPlainDate().with({day:1});j(t);const n=ge();U.current!==n&&(U.current=n,z(n)),Z(!0)};m(()=>{if(!Y)return;me();const e=()=>me();return window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}},[Y,me]);return Ka("div",{className:"df-range-picker df-range-picker-root",ref:W,children:[Ka("div",{className:"df-range-picker-trigger","data-disabled":s,"data-open":Y,children:[Ka("div",{className:"df-range-picker-field-group",children:Ka("input",{type:"text",name:"range-start",value:H[0],onChange:de("start"),onFocus:()=>ve("start"),onClick:()=>ve("start"),onBlur:ce("start"),onKeyDown:ue("start"),className:"df-range-picker-input","data-disabled":s,"data-focused":"start"===O&&Y,placeholder:S,autoComplete:"off",disabled:s})}),Ka(ar,{className:"df-range-picker-separator-icon"}),Ka("div",{className:"df-range-picker-field-group",children:Ka("input",{type:"text",name:"range-end",value:H[1],onChange:de("end"),onFocus:()=>ve("end"),onClick:()=>ve("end"),onBlur:ce("end"),onKeyDown:ue("end"),className:"df-range-picker-input","data-disabled":s,"data-focused":"end"===O&&Y,placeholder:S,autoComplete:"off",disabled:s})})]}),Y&&c(Ka(yr,{visibleMonth:$,monthLabels:E,weekDayLabels:C,calendarDays:he,draftRange:I,focusedField:O,isTimeEnabled:!!b,disabled:s,matchTriggerWidth:y,popupRef:B,timeListRefs:V,onMonthChange:e=>{j(t=>t.add({months:e}).with({day:1}))},onYearChange:e=>{j(t=>t.add({years:e}).with({day:1}))},onDaySelect:e=>{if(s)return;const t=(e,t)=>{var a,r,i,o;const l=gr(e);return n.ZonedDateTime.from({timeZone:l,year:t.year,month:t.month,day:t.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!==(i=e.microsecond)&&void 0!==i?i:0,nanosecond:null!==(o=e.nanosecond)&&void 0!==o?o:0})};if("start"===O){const n=t(I[0],e),a=I[1].epochMilliseconds-I[0].epochMilliseconds,r=n.add({milliseconds:a});return void k([n,r])}const a=t(I[1],e),r=I[1].epochMilliseconds-I[0].epochMilliseconds;if(n.ZonedDateTime.compare(a,I[0])<0){const n=t(I[0],e),a=n.add({milliseconds:r});return void k([n,a])}k([I[0],a]),j(a.toPlainDate().with({day:1}))},onHourSelect:ie,onMinuteSelect:oe,onOk:()=>{q.current=!0,ne(I),ae(I),Z(!1)},getPopupStyle:()=>{if(!W.current)return{};const e=W.current.getBoundingClientRect(),t={position:"fixed",zIndex:9999};return U.current.startsWith("bottom")?t.top=e.bottom+8:t.bottom=window.innerHeight-e.top+8,d.endsWith("Left")?t.left=e.left:t.right=window.innerWidth-e.right,y&&(t.width=`${e.width}px`),t}}),h?h():document.body)]})},wr=({options:e,value:t,onChange:n,registry:a,variant:r="desktop",disabled:i=!1})=>{const[o,l]=g(!1),[s,d]=g({}),u=v(null),h=v(null),f=()=>{if(h.current){const e=h.current.getBoundingClientRect(),t="mobile"===r,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`,d(n)}};m(()=>{const e=e=>{!u.current||u.current.contains(e.target)||e.target.closest("[data-calendar-picker-dropdown]")||l(!1)};return o&&(f(),window.addEventListener("mousedown",e),window.addEventListener("scroll",f,!0),window.addEventListener("resize",f)),()=>{window.removeEventListener("mousedown",e),window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",f)}},[o]);const p=e=>(a||le()).resolveColors(e).lineColor,y=(e,t)=>{e.stopPropagation(),n(t),l(!1)},D=e.find(e=>e.value===t),w=()=>o&&"undefined"!=typeof window?c("mobile"===r?zt("div",{"data-calendar-picker-dropdown":"true",style:s,className:ta,children:e.map(e=>zt("div",{className:"df-calendar-picker-option df-calendar-picker-option-mobile","data-selected":e.value===t?"true":"false",onClick:t=>y(t,e.value),children:[zt("div",{className:"df-calendar-picker-option-inner",children:[zt("div",{className:"df-calendar-picker-check-area",children:e.value===t&&zt(va,{className:"df-text-primary"})}),zt("span",{className:"df-calendar-picker-option-label",children:e.label})]}),zt("span",{className:"df-calendar-picker-color-swatch df-calendar-picker-color-swatch-sm",style:{backgroundColor:p(e.value)}})]},e.value))}):zt("ul",{"data-calendar-picker-dropdown":"true",style:s,className:ta,children:e.map(e=>zt("li",{className:"df-calendar-picker-option","data-selected":t===e.value?"true":"false",onClick:t=>y(t,e.value),children:[zt("div",{className:"df-calendar-picker-check-area",children:e.value===t&&zt(va,{className:"df-text-primary"})}),zt("span",{className:"df-calendar-picker-color-swatch-sm",style:{backgroundColor:p(e.value)}}),zt("span",{className:"df-calendar-picker-option-label",children:e.label})]},e.value))}),document.body):null;return zt("div","mobile"===r?{className:"df-calendar-picker",ref:u,children:[zt("button",{type:"button",ref:h,disabled:i,onClick:e=>{e.stopPropagation(),i||l(!o)},className:"df-calendar-picker-trigger df-calendar-picker-trigger-mobile",children:[zt("span",{className:"df-calendar-picker-color-swatch df-calendar-picker-color-swatch-sm",style:{backgroundColor:p(t)}}),zt("span",{className:"df-calendar-picker-label",children:(null==D?void 0:D.label)||t}),zt(fa,{className:"df-text-muted"})]}),w()]}:{className:"df-calendar-picker",ref:u,children:[zt("button",{ref:h,type:"button",onClick:e=>{e.stopPropagation(),l(!o)},className:"df-calendar-picker-trigger",children:[zt("span",{className:"df-calendar-picker-color-swatch",style:{backgroundColor:p(t)}}),zt(fa,{className:"df-text-muted"})]}),w()]})},br=({event:t,isOpen:a,onEventUpdate:r,onEventDelete:i,onClose:o,app:l})=>{var s,d;const[u,h]=g(t),[f,y]=g(!1),[D,w]=g(!1),b=v(t.id),{t:E}=An();m(()=>{h(t),b.current!==t.id&&(y(!1),w(!1),b.current=t.id)},[t]);const C=p(()=>(l?l.getCalendarRegistry():le()).getVisible().map(e=>({label:e.name,value:e.id})),[l,null==l?void 0:l.getCalendars()]),T=p(()=>!Ct(t,u),[t,u]),S=p(()=>{var e;return null!==(e=null==l?void 0:l.timeZone)&&void 0!==e?e:n.Now.timeZoneId()},[l]),M=e=>{const[t,n]=e;h(Object.assign(Object.assign({},u),{start:t.toPlainDate(),end:n.toPlainDate()}))},N=null!==(s=null==l?void 0:l.canMutateFromUI(t.id))&&void 0!==s&&s,I=null==l?void 0:l.getReadOnlyConfig(t.id),k=!1!==(null==I?void 0:I.viewable),x=f||D,O=!p(()=>{if(!t.calendarId)return!1;const e=null==l?void 0:l.getCalendarRegistry().get(t.calendarId);return!!(null==e?void 0:e.subscription)},[l,t.calendarId])||""!==(u.description||"").trim();if(!a||!k)return null;if("undefined"==typeof window||"undefined"==typeof document)return null;const R=zt("div",{className:"df-portal df-event-dialog-overlay",style:{zIndex:9998},"data-event-detail-dialog":"true",children:[zt("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&&o()}}),zt("div",{className:"df-dialog-container",children:[zt("button",{type:"button",onClick:o,disabled:x,className:"df-event-dialog-close","aria-label":"Close",children:zt("svg",{fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:zt("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),zt("div",{children:[zt("span",{className:"df-form-label",children:E("eventTitle")}),zt("div",{className:"df-form-row",children:[zt("div",{className:"df-form-field",children:zt("input",{id:`event-dialog-title-${u.id}`,name:"title",type:"text",value:u.title,readOnly:!N||x,disabled:!N||x,onChange:e=>{h(Object.assign(Object.assign({},u),{title:e.target.value}))},className:"df-form-input"})}),N&&zt(wr,{options:C,value:u.calendarId||"blue",disabled:x,onChange:e=>h(Object.assign(Object.assign({},u),{calendarId:e})),registry:null==l?void 0:l.getCalendarRegistry()})]}),u.allDay?zt("div",{className:"df-event-dialog-time-row",children:[zt("div",{className:"df-form-label",children:E("dateRange")}),zt(Dr,{value:[u.start,u.end],format:"YYYY-MM-DD",showTime:!1,timeZone:S,matchTriggerWidth:!0,disabled:!N||x,onChange:M,onOk:M,locale:null==l?void 0:l.state.locale})]}):zt("div",{className:"df-event-dialog-time-row",children:[zt("div",{className:"df-form-label",children:E("timeRange")}),zt(Dr,{value:[u.start,u.end],timeZone:S,disabled:!N||x,onChange:e=>{const[t,n]=e;h(Object.assign(Object.assign({},u),{start:t,end:n}))},onOk:e=>{const[t,n]=e;h(Object.assign(Object.assign({},u),{start:t,end:n}))},locale:null==l?void 0:l.state.locale})]}),O&&zt("div",{className:"df-event-dialog-notes-row",children:[zt("span",{className:"df-form-label",children:E("note")}),zt("textarea",{id:`event-dialog-note-${u.id}`,name:"note",value:null!==(d=u.description)&&void 0!==d?d:"",readOnly:!N||x,disabled:!N||x,onChange:e=>h(Object.assign(Object.assign({},u),{description:e.target.value})),rows:4,className:"df-form-textarea",placeholder:E("addNotePlaceholder")})]}),N&&zt("div",{className:"df-form-actions",children:[u.allDay?zt("button",{type:"button",disabled:x,className:"df-tint-primary df-hover-primary-md df-btn-sm",onClick:()=>{var e;const t=A(u.start)?u.start:u.start.toPlainDate(),a=null!==(e=null==l?void 0:l.timeZone)&&void 0!==e?e:n.Now.timeZoneId(),r=n.ZonedDateTime.from({year:t.year,month:t.month,day:t.day,hour:9,minute:0,timeZone:a}),i=n.ZonedDateTime.from({year:t.year,month:t.month,day:t.day,hour:10,minute:0,timeZone:a});h(Object.assign(Object.assign({},u),{allDay:!1,start:r,end:i}))},children:E("setAsTimed")}):zt("button",{type:"button",disabled:x,className:"df-tint-primary df-hover-primary-md df-btn-sm",onClick:()=>{const e=A(u.start)?u.start:u.start.toPlainDate();h(Object.assign(Object.assign({},u),{allDay:!0,start:e,end:e}))},children:E("setAsAllDay")}),zt(Ba,{type:"button",disabled:x,className:"df-fill-destructive df-hover-destructive df-btn-sm",onClick:()=>e(void 0,void 0,void 0,function*(){if(!f&&!D){w(!0);try{yield i(t.id),o()}finally{w(!1)}}}),loading:D,children:E("delete")}),zt(Ba,{type:"button",className:"df-fill-primary df-btn-sm "+(T?"df-shadow-primary df-hover-primary-solid":""),style:{marginLeft:"auto"},onClick:()=>e(void 0,void 0,void 0,function*(){if(!f&&!D){y(!0);try{yield r(Ke(t,u,null==l?void 0:l.timeZone)),o()}finally{y(!1)}}}),disabled:!T||x,loading:f,children:E("save")})]})]})]})]}),H=document.body;return H?c(R,H):null},Er=e=>e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),Cr=({app:e,anchorRef:t,onClose:n,isOpen:a})=>{const{t:r}=An(),[i,o]=g(""),[l,s]=g(0),[d,u]=g(!1),h=v(null),f=v(null);m(()=>{a||u(!1)},[a]),m(()=>{if(a){const e=window.setTimeout(()=>{var e;return null===(e=h.current)||void 0===e?void 0:e.focus()},50);return o(""),s(0),()=>window.clearTimeout(e)}},[a]),m(()=>{const e=e=>{a&&f.current&&!f.current.contains(e.target)&&t.current&&!t.current.contains(e.target)&&n()};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[a,n,t]);const[D,w]=g({top:0,left:0}),[b,E]=g("top"),[C,T]=g(0),S=p(()=>qe(e.timeZone),[e.timeZone,a]),M=p(()=>{var t,n;if(!i.trim())return[];const a=[],r=e.getCalendars(),o=e.getAllEvents(),l=i.toLowerCase(),s=o.find(e=>e.title.toLowerCase()===l);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:i,calendarId:d||"",color:u,start:S.start,end:S.end});const h=new Set([i.toLowerCase()]),g=o.filter(t=>{var n;if(!t.title.toLowerCase().includes(l))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 g.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:S.start,end:S.end})}),a},[i,e,S]);y(()=>{if(a&&t.current&&f.current){const e=t.current.getBoundingClientRect(),n=f.current.offsetHeight,a=340;let r=e.left+e.width/2-a/2;const i=12,o=window.innerWidth;r<i?r=i:r+a>o-i&&(r=o-a-i);const l=e.left+e.width/2;T(l-r);let s=0,d="top";e.top<n+20?(d="bottom",s=e.bottom+12):(d="top",s=e.top-12-n),E(d),w({top:s,left:r}),u(!0)}},[a,t,M]);const N=t=>{if(!t.calendarId)return;const a=Mt(),r={id:a,title:t.title,start:Oe(t.start,e.timeZone),end:Oe(t.end,e.timeZone),calendarId:t.calendarId,allDay:!1};e.addEvent(r),e.setCurrentDate(t.start),e.highlightEvent(a),n()};return m(()=>{if(!a)return;const e=e=>{0!==M.length&&("ArrowDown"===e.key?(e.preventDefault(),s(e=>(e+1)%M.length)):"ArrowUp"===e.key?(e.preventDefault(),s(e=>(e-1+M.length)%M.length)):"Enter"===e.key&&(e.preventDefault(),M[l]&&N(M[l])))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[a,M,l]),a?c(zt("div",{ref:f,className:"df-portal df-quick-create","data-ready":d?"true":"false",style:{top:D.top,left:D.left,visibility:d?"visible":"hidden"},children:[zt("div",{className:"df-quick-create-header",children:[zt("div",{className:"df-quick-create-title",children:r("quickCreateEvent")||"Quick Create Event"}),zt("div",{className:"df-quick-create-input-wrap",children:zt("input",{ref:h,type:"text",className:"df-form-input",placeholder:r("quickCreatePlaceholder")||"Enter title (e.g. Code review)",value:i,onChange:e=>o(e.target.value)})})]}),zt("div",{className:"df-quick-create-list",children:[0===M.length&&i&&zt("div",{className:"df-quick-create-empty",children:r("noSuggestions")||"Type to create"}),M.map((e,t)=>{return zt("div",{className:"df-quick-create-item","data-selected":t===l?"true":"false",onClick:()=>N(e),onMouseEnter:()=>s(t),children:[zt("div",{className:"df-quick-create-color-bar",style:{backgroundColor:e.color}}),zt("div",{className:"df-quick-create-item-content",children:[zt("div",{className:"df-quick-create-item-title",children:e.title}),zt("div",{children:zt("span",{className:"df-quick-create-item-badge",children:"new"===e.type?r("today"):r("tomorrow")})}),zt("div",{className:"df-quick-create-item-time",children:(n=e.start,a=e.end,`${Er(n)} - ${Er(a)}`)})]})]},`${e.type}-${t}`);var n,a})]}),zt("div",{className:"df-quick-create-arrow","data-placement":"top"===b?"bottom":"top",style:{left:C}})]}),document.body):null},Tr=({visibleMonth:e,currentDate:t,showHeader:a=!1,onMonthChange:r,onDateSelect:i,events:o=[],showEventDots:l=!1,calendarRegistry:s,timeZone:d})=>{const{locale:c}=An(),u=p(()=>{const e=d?n.Now.plainDateISO(d):n.Now.plainDateISO();return new Date(e.year,e.month-1,e.day).toDateString()},[d]),h=t.toDateString(),g=p(()=>Oa(c,"narrow"),[c]),m=p(()=>e.toLocaleDateString(c,{month:"long",year:"numeric"}),[e,c]),v=p(()=>{if(!l||!(null==o?void 0:o.length))return null;const e=new Map;return o.forEach(t=>{var n;const a=Ne(t.start,d),r=t.end?Ne(t.end,d):a,i=new Date(a);i.setHours(0,0,0,0);const o=new Date(r);o.setHours(0,0,0,0);let l=new Date(o);t.allDay||0!==r.getHours()||0!==r.getMinutes()||0!==r.getSeconds()||0!==r.getMilliseconds()||l.setDate(l.getDate()-1),l<i&&(l=new Date(i));const c=he(t.calendarId||"default",s).toLowerCase();for(let t=new Date(i);t<=l;t=new Date(t.getTime()+864e5)){const a=t.toDateString(),r=null!==(n=e.get(a))&&void 0!==n?n:[];!r.includes(c)&&r.length<4&&e.set(a,[...r,c])}}),e},[l,o,d,s]),f=p(()=>{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 i=new Date(t,n,e-a+1),o=i.toDateString();r.push({date:i.getDate(),fullDate:i,isCurrentMonth:i.getMonth()===n,isToday:o===u,isSelected:o===h})}return r},[e,h,u]);return zt("div",{className:"df-mini-calendar-body",children:[a?zt("div",{className:"df-mini-calendar-header-nav",children:[zt("button",{type:"button",className:"df-mini-calendar-nav-btn",onClick:()=>r(-1),"aria-label":"Previous month",children:zt(ca,{})}),zt("span",{className:"df-mini-calendar-month-label",children:m}),zt("button",{type:"button",className:"df-mini-calendar-nav-btn",onClick:()=>r(1),"aria-label":"Next month",children:zt(ua,{})})]}):null,zt("div",{className:"df-mini-calendar-grid",children:[g.map((e,t)=>zt("div",{className:"df-mini-calendar-header",children:e},`weekday-${t}`)),f.map(e=>{var t;const n=null!==(t=null==v?void 0:v.get(e.fullDate.toDateString()))&&void 0!==t?t:[];return zt("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:[zt("span",{className:"df-mini-calendar-day-number",children:e.date}),l&&n.length>0&&zt("div",{className:"df-mini-calendar-dots",children:n.slice(0,4).map((e,t)=>zt("div",{"data-mini-calendar-dot":"true",className:"df-mini-calendar-dot",style:{backgroundColor:e}},`${e}-${t}`))})]},e.fullDate.getTime())})]})]})},Sr=({checked:e,onChange:t,disabled:n})=>zt("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:zt("span",{className:"df-mobile-switch-thumb"})}),Mr=({date:e,onChange:t})=>{const n=Array.from({length:24},(e,t)=>t),a=Array.from({length:12},(e,t)=>5*t),r=[...n,...n,...n],i=[...a,...a,...a],o=32,l=e.getHours(),s=5*Math.round(e.getMinutes()/5),d=(24+l)*o,c=(12+s/5)*o,[u,h]=g(d),[f,p]=g(c),y=v(null),D=v(null),w=v(null);m(()=>{y.current&&(y.current.scrollTop=d,h(d)),D.current&&(D.current.scrollTop=c,p(c))},[d,c]);const b=(n,a)=>{const l=n.currentTarget;let s=l.scrollTop;if("hour"===a){const e=768;s<320?(s+=e,l.scrollTop=s):s>1600&&(s-=e,l.scrollTop=s),h(s)}else{const e=384;s<160?(s+=e,l.scrollTop=s):s>800&&(s-=e,l.scrollTop=s),p(s)}w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{((n,a)=>{const l=Math.round(a/o);if("hour"===n){const n=r[l];if(void 0!==n&&n!==e.getHours()){const a=new Date(e);a.setHours(n),t(a)}}else{const n=i[l];if(void 0!==n&&5*Math.round(e.getMinutes()/5)!==n){const a=new Date(e);a.setMinutes(n),t(a)}}})(a,s)},150)},E=(e,t)=>{const n=96+e*o+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 zt("div",{className:"df-time-wheel",children:[zt("div",{ref:y,className:"df-time-wheel-column",onScroll:e=>b(e,"hour"),children:[zt("div",{className:"df-time-wheel-spacer",style:{height:96}}),r.map((n,a)=>zt("div",{className:"df-time-wheel-option df-time-wheel-option-hour",onClick:()=>{var r;const i=new Date(e);i.setHours(n),t(i),null===(r=y.current)||void 0===r||r.scrollTo({top:a*o,behavior:"smooth"})},children:zt("div",{className:"df-time-wheel-value","data-selected":String(n===l),style:E(a,u),children:n.toString().padStart(2,"0")})},`h-${a}-${n}`)),zt("div",{className:"df-time-wheel-spacer",style:{height:96}})]}),zt("div",{ref:D,className:"df-time-wheel-column",onScroll:e=>b(e,"minute"),children:[zt("div",{className:"df-time-wheel-spacer",style:{height:96}}),i.map((n,a)=>zt("div",{className:"df-time-wheel-option df-time-wheel-option-minute",onClick:()=>{var r;const i=new Date(e);i.setMinutes(n),t(i),null===(r=D.current)||void 0===r||r.scrollTo({top:a*o,behavior:"smooth"})},children:zt("div",{className:"df-time-wheel-value","data-selected":String(n===s),style:E(a,f),children:n.toString().padStart(2,"0")})},`m-${a}-${n}`)),zt("div",{className:"df-time-wheel-spacer",style:{height:96}})]}),zt("div",{className:"df-time-wheel-selection"})]})},Nr=({isOpen:e,onClose:t,onSave:n,onEventDelete:a,draftEvent:r,app:i,timeFormat:o="24h"})=>{const{locale:l,t:s}=An(),d=i.getReadOnlyConfig(null==r?void 0:r.id),u=i.canMutateFromUI(null==r?void 0:r.id),h=!1!==d.viewable,[v,f]=g(""),y=!p(()=>{if(!(null==r?void 0:r.calendarId))return!1;const e=i.getCalendarRegistry().get(r.calendarId);return!!(null==e?void 0:e.subscription)},[i,null==r?void 0:r.calendarId])||""!==v.trim(),[D,w]=g(""),[b,E]=g(""),[C,T]=g(!1),[S,M]=g(new Date),[N,I]=g(new Date),[k,x]=g(new Date),[O,R]=g(new Date),[H,P]=g(null),[A,L]=g(e),[j,F]=g(!1),[Z,_]=g(!1);m(()=>{if(!e){F(!0);const e=setTimeout(()=>{L(!1),F(!1)},300);return()=>clearTimeout(e)}L(!0),F(!1)},[e]),m(()=>{if(e&&r){const e=i.getEvents().some(e=>e.id===r.id);_(e)}},[e,r,i]);const z=i.getCalendars(),U=z.map(e=>({label:e.name,value:e.id}));m(()=>{e&&z.length>0&&(z.some(e=>e.id===b)||"blue"!==b&&""!==b||E(z[0].id))},[z,e,b]),m(()=>(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]),m(()=>{var t,n;if(e&&r){if(w(r.title||""),E(r.calendarId||(null===(t=z[0])||void 0===t?void 0:t.id)||"blue"),T(r.allDay||!1),f(r.description||""),r.start)try{const e=Y(r.start);M(e),x(e)}catch(e){const t=new Date;M(t),x(t)}if(r.end)try{const e=Y(r.end);I(e),R(e)}catch(e){const t=new Date;I(t),R(t)}}else if(e&&!r){E((null===(n=z[0])||void 0===n?void 0:n.id)||"blue"),f("");const e=new Date;e.setMinutes(0,0,0),M(e),x(e),I(new Date(e.getTime()+36e5)),R(e)}},[e,r]);const W=p(()=>{if(!e||!r)return!1;const t=new Date(S),n=new Date(N),a=Object.assign(Object.assign({},r),{title:D,calendarId:b,allDay:C,description:v,start:C?ke(t):$(t,i.timeZone),end:C?ke(n):$(n,i.timeZone)});return!Ct(r,Ke(r,a,i.timeZone))},[e,r,D,b,C,S,N,v]);if(!A||!h)return null;const B=e=>{P(t=>t===e?null:e)},V=e=>e.toLocaleDateString(l,{day:"numeric",month:"short",year:"numeric"}),q=(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(N.getTime()+n);I(a)}else{const e=new Date(t);e.setHours(N.getHours(),N.getMinutes()),I(e)}},G=(e,t)=>{"start"===e?x(e=>{const n=new Date(e);return n.setMonth(e.getMonth()+t),n}):R(e=>{const n=new Date(e);return n.setMonth(e.getMonth()+t),n})};return c(zt("div",{className:"df-portal df-mobile-event-drawer",children:[zt("div",{className:"df-mobile-event-drawer-backdrop","data-closing":String(j),onClick:t}),zt("div",{className:"df-mobile-event-drawer-panel "+(j?"df-animate-slide-down":"df-animate-slide-up"),onClick:e=>e.stopPropagation(),children:[zt("div",{className:"df-mobile-event-drawer-header",children:[zt("button",{type:"button",onClick:t,className:"df-mobile-event-drawer-header-action",children:s("cancel")}),zt("span",{className:"df-mobile-event-drawer-title",children:s(!u&&Z?"viewEvent":Z?"editEvent":"newEvent")}),u&&zt("button",{type:"button",onClick:()=>{if(!r)return;const e=new Date(S),t=new Date(N),a=Object.assign(Object.assign({},r),{title:D,calendarId:b,allDay:C,start:C?ke(e):$(e,i.timeZone),end:C?ke(t):$(t,i.timeZone)});n(Ke(r,a,i.timeZone))},disabled:!W,className:"df-mobile-event-drawer-header-action df-mobile-event-drawer-header-action-primary "+(W?"":"df-mobile-event-drawer-header-action-disabled"),children:s(Z?"done":"create")}),!u&&zt("span",{className:"df-mobile-event-drawer-header-spacer"})]}),zt("div",{className:"df-mobile-event-drawer-body",children:[zt("div",{className:"df-mobile-event-drawer-section df-mobile-event-drawer-section-framed",children:zt("input",{type:"text",placeholder:s("titlePlaceholder"),value:D,onChange:e=>u&&w(e.currentTarget.value),readOnly:!u,className:"df-mobile-event-drawer-title-input",autoFocus:u})}),z.length>0&&zt("div",{className:"df-mobile-event-drawer-section df-mobile-event-drawer-section-framed",children:zt("div",{className:"df-mobile-event-drawer-row",children:[zt("span",{className:"df-mobile-event-drawer-label",children:s("calendar")}),zt(wr,{options:U,value:b,onChange:u?E:()=>{},registry:i.getCalendarRegistry(),variant:"mobile",disabled:!u})]})}),zt("div",{className:"df-mobile-event-drawer-section df-mobile-event-drawer-section-framed",children:zt("div",{className:"df-mobile-event-drawer-row",children:[zt("span",{className:"df-mobile-event-drawer-label",children:s("allDay")}),zt(Sr,{checked:C,onChange:u?T:()=>{},disabled:!u})]})}),zt("div",{className:"df-mobile-event-drawer-section",children:[zt("div",{className:"df-mobile-event-drawer-row df-mobile-event-drawer-row-padded",children:[zt("span",{className:"df-mobile-event-drawer-label",children:s("starts")}),zt("div",{className:"df-mobile-event-drawer-controls",children:[zt("button",{type:"button",className:"df-mobile-event-drawer-picker-trigger","data-active":String("start-date"===H),onClick:()=>u&&B("start-date"),disabled:!u,"aria-expanded":"start-date"===H,children:V(S)}),!C&&zt("button",{type:"button",className:"df-mobile-event-drawer-picker-trigger","data-active":String("start-time"===H),onClick:()=>u&&B("start-time"),disabled:!u,"aria-expanded":"start-time"===H,children:Fe(S.getHours()+S.getMinutes()/60,0,o)})]})]}),zt("div",{className:"df-mobile-event-drawer-expander","data-kind":"calendar","data-expanded":String("start-date"===H),children:zt("div",{className:"df-mobile-event-drawer-expander-content",children:zt(Tr,{currentDate:S,visibleMonth:k,onDateSelect:e=>q("start",e),onMonthChange:e=>G("start",e),showHeader:!0,events:i.getEvents(),calendarRegistry:i.getCalendarRegistry(),timeZone:i.timeZone})})}),zt("div",{className:"df-mobile-event-drawer-expander","data-kind":"time","data-expanded":String("start-time"===H),children:zt("div",{className:"df-mobile-event-drawer-expander-content",children:zt(Mr,{date:S,onChange:e=>{const t=N.getTime()-S.getTime();M(e),I(new Date(e.getTime()+t))},timeFormat:o})})})]}),zt("div",{className:"df-mobile-event-drawer-section",children:[zt("div",{className:"df-mobile-event-drawer-row df-mobile-event-drawer-row-padded",children:[zt("span",{className:"df-mobile-event-drawer-label",children:s("ends")}),zt("div",{className:"df-mobile-event-drawer-controls",children:[zt("button",{type:"button",className:"df-mobile-event-drawer-picker-trigger","data-active":String("end-date"===H),onClick:()=>u&&B("end-date"),disabled:!u,"aria-expanded":"end-date"===H,children:V(N)}),!C&&zt("button",{type:"button",className:"df-mobile-event-drawer-picker-trigger","data-active":String("end-time"===H),onClick:()=>u&&B("end-time"),disabled:!u,"aria-expanded":"end-time"===H,children:Fe(N.getHours()+N.getMinutes()/60,0,o)})]})]}),zt("div",{className:"df-mobile-event-drawer-expander","data-kind":"calendar","data-expanded":String("end-date"===H),children:zt("div",{className:"df-mobile-event-drawer-expander-content",children:zt(Tr,{currentDate:N,visibleMonth:O,onDateSelect:e=>q("end",e),onMonthChange:e=>G("end",e),showHeader:!0,events:i.getEvents(),calendarRegistry:i.getCalendarRegistry(),timeZone:i.timeZone})})}),zt("div",{className:"df-mobile-event-drawer-expander","data-kind":"time","data-expanded":String("end-time"===H),children:zt("div",{className:"df-mobile-event-drawer-expander-content",children:zt(Mr,{date:N,onChange:e=>{if(e<S){const t=N.getTime()-S.getTime();I(e),M(new Date(e.getTime()-t))}else I(e)},timeFormat:o})})})]}),y&&zt("div",{className:"df-mobile-event-drawer-section df-mobile-event-drawer-section-framed",children:zt("textarea",{placeholder:s("notesPlaceholder"),value:v,onChange:e=>u&&f(e.currentTarget.value),readOnly:!u,className:"df-mobile-event-drawer-notes"})}),u&&Z&&a&&r&&zt("div",{className:"df-mobile-event-drawer-section df-mobile-event-drawer-section-danger",children:zt("button",{type:"button",onClick:()=>a(r.id),className:"df-mobile-event-drawer-delete-button",children:s("delete")})})]})]})]}),document.body)},Ir=()=>zt("svg",{className:"df-search-results-state-icon",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:zt("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),kr=({loading:e,results:t,keyword:n,onResultClick:a,emptyText:r})=>{const{t:i,locale:o}=An(),l=p(()=>ln(new Date),[]),s=p(()=>dn(t,l),[t,l]),d=e=>on(e);return e?zt("div",{className:"df-search-results-state",children:[zt(Da,{className:"df-search-results-loader"}),zt("span",{children:"Loading..."})]}):0===t.length?n?zt("div",{className:"df-search-results-state",children:[zt(Ir,{}),zt("span",{style:{marginTop:"0.5rem",fontSize:"0.875rem"},children:"string"==typeof r?r:r&&"object"==typeof r?r[o]||r.en||"No results found":i("noResults")||"No results found"})]}):null:zt("div",{className:"df-search-results",children:s.map(e=>{const{title:t,tone:n}=sn(e.date,l,o,i);return zt("div",{className:"df-search-results-group",children:[zt("h3",{className:"df-search-results-date-header","data-tone":n,children:t}),zt("div",{className:"df-search-results-events",children:e.events.map(e=>{const t=d(e.start),n=d(e.end),r={hour:"2-digit",minute:"2-digit"},l=e.allDay?i("allDay")||"All Day":t.toLocaleTimeString(o,r),s=e.allDay?"":n.toLocaleTimeString(o,r);return zt("div",{children:[zt("div",{className:"df-search-results-event",onClick:()=>null==a?void 0:a(e),children:zt("div",{className:"df-search-results-event-inner",children:[zt("div",{className:"df-search-results-color-bar",style:{backgroundColor:e.color||"#3b82f6"}}),zt("div",{className:"df-search-results-event-content",children:[zt("div",{className:"df-search-results-event-title",children:e.title}),zt("div",{className:"df-search-results-event-time",children:[zt("div",{children:l}),s&&zt("div",{className:"df-search-results-end-time",children:s})]})]})]})}),zt("div",{className:"df-search-results-divider"})]},e.id)})})]},e.date.getTime())})})},xr=({isOpen:e,onClose:t,keyword:n,onSearchChange:a,results:r,loading:i,onResultClick:o,emptyText:l})=>{const s=v(null),{t:d}=An();return m(()=>(e?(setTimeout(()=>{var e;null===(e=s.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?c(zt("div",{className:"df-mobile-fullscreen",children:[zt("div",{className:"df-search-dialog-header",children:[zt("button",{type:"button",onClick:t,className:"df-search-dialog-back-btn",children:zt(Ma,{className:"df-search-dialog-back-icon"})}),zt("div",{className:"df-search-dialog-input-wrap",children:[zt("input",{ref:s,type:"text",placeholder:d("search")||"Search",value:n,onChange:e=>{const t=e.target.value;t!==n&&a(t)},className:"df-search-dialog-input"}),n&&zt("button",{type:"button",onClick:()=>{""!==n&&a("")},className:"df-search-dialog-input-clear",children:zt(pa,{className:"df-search-dialog-clear-icon"})})]})]}),zt("div",{className:"df-search-dialog-results",children:zt(kr,{loading:i,results:r,keyword:n,onResultClick:e=>{null==o||o(e)},emptyText:l})})]}),document.body):null},Or=({isOpen:e,loading:t,results:n,keyword:a,onResultClick:r,emptyText:i})=>zt("div",{className:"df-search-drawer","data-open":e?"true":"false",children:zt("div",{className:"df-search-drawer-content",children:zt(kr,{loading:t,results:n,keyword:a,onResultClick:r,emptyText:i})})});let Rr=null;function Hr(e){Rr=e}const Pr={enabled:!1,width:"0px",isCollapsed:!1,toggleCollapsed:()=>{},miniWidth:"0px",content:null,extraContent:null,safeAreaLeft:0};function Ar(e){return Rr&&e.hasPlugin("sidebar")?Rr(e):Pr}const Lr=({locale:e,messages:t,children:n})=>An().isDefault?zt(Pa,{locale:e,messages:t,children:n}):n,$r=({app:t,customDetailPanelContent:n,customEventDetailDialog:a,meta:r,customMessages:i,search:l,titleBarSlot:s,collapsedSafeAreaLeft:d})=>{const u=D(Za),{tick:h,selectedEventId:y}=function(e){var t;const[n,a]=g(0),[r,i]=g(null!==(t=e.state.selectedEventId)&&void 0!==t?t:null);return m(()=>{var t;a(0),i(null!==(t=e.state.selectedEventId)&&void 0!==t?t:null)},[e]),m(()=>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:r}}(t),{isMobile:w}=function(){const[e,t]=g(!1);return m(()=>{const e=()=>{t(window.matchMedia("(max-width: 768px)").matches)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),{isMobile:e}}(),b=function(t,n){const[a,r]=g(""),[i,o]=g(!1),[l,s]=g(!1),[d,c]=g(!1),[u,h]=g([]),p=v(""),y=v(!1);m(()=>{t.state.highlightedEventId&&t.selectEvent(t.state.highlightedEventId)},[t.state.highlightedEventId,t]),m(()=>{y.current&&!i&&null!==t.state.highlightedEventId&&t.highlightEvent(null),y.current=i},[i,t]),m(()=>{var r;if(!a.trim())return o(!1),h([]),p.current.trim()&&null!==t.state.highlightedEventId&&t.highlightEvent(null),void(p.current=a);const i=null!==(r=null==n?void 0:n.debounceDelay)&&void 0!==r?r:300,l=setTimeout(()=>e(this,void 0,void 0,function*(){var e;c(!0),o(!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})})}h(r),null===(e=null==n?void 0:n.onSearchStateChange)||void 0===e||e.call(n,{keyword:a,loading:!1,results:r})}catch(e){h([])}finally{c(!1)}}),i);return p.current=a,()=>clearTimeout(l)},[a,n,t]);const D=f((e,a="desktop")=>{const r=()=>{let n;n=e.start instanceof Date?e.start:"string"==typeof e.start?new Date(e.start):Y(e.start),t.setCurrentDate(n),t.highlightEvent(e.id),l&&s(!1)};(null==n?void 0:n.onResultClick)?n.onResultClick({event:e,app:t,source:a,defaultAction:r,closeSearch:()=>{"mobile"===a?s(!1):o(!1)}}):r()},[t,l,n]),w=f(()=>{r(""),s(!0)},[]),b=f(()=>{o(!1),r(""),t.highlightEvent(null)},[t]),E=f(()=>{s(!1),r(""),t.highlightEvent(null)},[t]);return{searchKeyword:a,setSearchKeyword:r,isSearchOpen:i,setIsSearchOpen:o,isMobileSearchOpen:l,setIsMobileSearchOpen:s,searchLoading:d,searchResults:u,handleSearchResultClick:D,handleSearchClick:w,handleSearchClose:b,handleMobileSearchClose:E}}(t,l),E=a||(t.getUseEventDetailDialog()?br:void 0),C=function(t,n,a){const[r,i]=g(null),o=v(null);m(()=>{i(null),o.current=null},[t]);const l=f(()=>{i(null),o.current=null,t.selectEvent(null)},[t]),s=f(e=>t.updateEvent(e.id,e),[t]),d=f(n=>e(this,void 0,void 0,function*(){yield t.deleteEvent(n),i(null),t.selectEvent(null)}),[t]),c=p(()=>{var e;if(!n||!r)return null;const a=r.split("::")[0],i=t.getEvents().find(e=>e.id===a);i&&(o.current=i);const c=null!=i?i:(null===(e=o.current)||void 0===e?void 0:e.id)===a?o.current:null;return c?{event:c,isOpen:!0,isAllDay:A(c.start),onEventUpdate:s,onEventDelete:d,onClose:l,app:t}:null},[a,r,n,l,s,d,t]);return{detailPanelEventId:r,setDetailPanelEventId:i,dialogProps:c}}(t,E,h),T=t.getUseEventDetailPanel(),S=Ar(t),M=function(e,t,n){const[a,r]=g(!1),i=v(null),[o,l]=g(!1),[s,d]=g(null),[c,u]=g(!1),h=f(()=>{u(!0)},[]),m=f(o=>{if(!e.canMutateFromUI())return;const s=e.getCalendarRegistry().getDefaultWritableCalendar();if(s){if(t){const{start:t,end:n}=qe(e.timeZone),a={id:Mt(),title:"",start:Oe(t,e.timeZone),end:Oe(n,e.timeZone),calendarId:s.id};return d(a),void l(!0)}n?a?r(!1):(i.current=o.currentTarget,r(!0)):h()}},[t,a,e,n,h]);return{isQuickCreateOpen:a,setIsQuickCreateOpen:r,quickCreateAnchorRef:i,isMobileDrawerOpen:o,setIsMobileDrawerOpen:l,mobileDraftEvent:s,setMobileDraftEvent:d,handleAddButtonClick:m,isCreateCalendarOpen:c,setIsCreateCalendarOpen:u}}(t,w,S.enabled),[N,I]=g(()=>t.getTheme());m(()=>t.subscribeThemeChange(e=>I(e)),[t]);const k=f(e=>t.setTheme(e),[t]);m(()=>{const e=t.callbacks,n=e.onDismissUI,a=e.onEventDetailToggle;return e.onDismissUI=()=>{C.detailPanelEventId&&C.setDetailPanelEventId(null),M.isMobileDrawerOpen&&M.setIsMobileDrawerOpen(!1),null==n||n()},e.onEventDetailToggle=e=>{C.setDetailPanelEventId(e),null==a||a(e)},()=>{e.onDismissUI=n,e.onEventDetailToggle=a}},[t,C,M]),m(()=>{if(!w||!C.detailPanelEventId)return;const e=C.detailPanelEventId.split("::")[0],n=t.getEvents().find(t=>t.id===e);n&&(M.setMobileDraftEvent(n),M.setIsMobileDrawerOpen(!0)),C.setDetailPanelEventId(null)},[C.detailPanelEventId,w]);const x=f(e=>{t.setCurrentDate(e),t.selectEvent(null)},[t]),O=f(e=>t.selectEvent(e),[t]),R=v(null),H={app:t,config:t.getCurrentView().config||{},customDetailPanelContent:n,customEventDetailDialog:E,useEventDetailPanel:T,switcherMode:t.state.switcherMode,calendarRef:R,meta:r,selectedEventId:y,onEventSelect:O,onDateChange:x,detailPanelEventId:C.detailPanelEventId,onDetailPanelToggle:C.setDetailPanelEventId},P=p(()=>({isCollapsed:S.isCollapsed,toggleCollapsed:S.toggleCollapsed}),[S.isCollapsed,S.toggleCollapsed]),L=null!=d,$=L?"0px":S.miniWidth,j=L&&S.isCollapsed?d:S.safeAreaLeft,F=t.getCalendarHeaderConfig(),Z=Object.assign({calendar:t,switcherMode:t.state.switcherMode,onAddCalendar:M.handleAddButtonClick,onSearchChange:b.setSearchKeyword,onSearchClick:b.handleSearchClick,searchValue:b.searchKeyword,isSearchOpen:b.isSearchOpen,isEditable:t.canMutateFromUI()},j>0?{safeAreaLeft:j}:{}),_=t.getCurrentView().component,z=t.getCustomMobileEventRenderer()||Nr;return zt(Ya,{initialTheme:N,onThemeChange:k,children:zt(Lr,{locale:t.state.locale,messages:i,children:zt("div",{className:"df-calendar-container",children:[zt(za,{store:u,generatorName:"titleBarSlot",generatorArgs:P,defaultContent:s&&("function"==typeof s?s(P):s)}),S.enabled&&zt("aside",{className:"df-calendar-sidebar-aside",style:{width:S.width},children:S.content}),zt("div",{className:"df-calendar-shell","data-sidebar-collapsed":S.isCollapsed,style:{marginLeft:S.enabled?`calc(${S.isCollapsed?$:S.width} - 1px)`:0},children:[!1===F?null:zt(za,{store:u,generatorName:"calendarHeader",generatorArgs:Z,defaultContent:o($a,Z)}),zt("div",{className:"df-calendar-content-wrap",ref:R,children:[zt("div",{className:"df-calendar-renderer",children:[zt("div",{className:"df-calendar-view-container",children:zt(_,Object.assign({},H))}),zt(Or,{isOpen:b.isSearchOpen,onClose:b.handleSearchClose,loading:b.searchLoading,results:b.searchResults,keyword:b.searchKeyword,onResultClick:e=>b.handleSearchResultClick(e,"desktop"),emptyText:null==l?void 0:l.emptyText})]}),zt(xr,{isOpen:b.isMobileSearchOpen,onClose:b.handleMobileSearchClose,keyword:b.searchKeyword,onSearchChange:b.setSearchKeyword,results:b.searchResults,loading:b.searchLoading,onResultClick:e=>b.handleSearchResultClick(e,"mobile"),emptyText:null==l?void 0:l.emptyText})]})]}),zt(Cr,{app:t,anchorRef:M.quickCreateAnchorRef,isOpen:M.isQuickCreateOpen,onClose:()=>M.setIsQuickCreateOpen(!1)}),zt(z,{isOpen:M.isMobileDrawerOpen,onClose:()=>{M.setIsMobileDrawerOpen(!1),M.setMobileDraftEvent(null)},onSave:e=>{t.getEvents().some(t=>t.id===e.id)?t.updateEvent(e.id,e):t.addEvent(e),M.setIsMobileDrawerOpen(!1),M.setMobileDraftEvent(null)},onEventDelete:e=>{t.deleteEvent(e),M.setIsMobileDrawerOpen(!1),M.setMobileDraftEvent(null)},draftEvent:M.mobileDraftEvent,app:t}),S.extraContent,M.isCreateCalendarOpen&&zt(qa,{app:t,onClose:()=>M.setIsCreateCalendarOpen(!1),onCreate:n=>e(void 0,void 0,void 0,function*(){yield t.createCalendar(n),M.setIsCreateCalendarOpen(!1)})}),(()=>{if(!C.dialogProps)return null;const e=E,t="undefined"==typeof document?null:document.body;if(!t)return null;const n=null==u?void 0:u.isOverridden("eventDetailDialog");return zt(za,{store:u,generatorName:"eventDetailDialog",generatorArgs:C.dialogProps,defaultContent:n?null:c(o(e,C.dialogProps),t)})})()]})})})};class jr{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())}}class Yr{constructor(e,t){this.app=e,this.container=null,this.unsubscribe=null,this.renderRequested=!1,this.extraProps={},this.customRenderingStore=new jr(t),t&&this.app.setOverrides(t),this.unsubscribe=e.subscribe(()=>this.requestRender())}setProps(e){Nt(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&&(l(null,this.container),this.container=null),this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null)}getCustomRenderingStore(){return this.customRenderingStore}render(){this.container&&l(o(Za.Provider,{value:this.customRenderingStore},o($r,Object.assign({app:this.app},this.extraProps))),this.container)}}function Fr(t){return e(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=Cn(n),r=n.match(/X-WR-CALNAME[^:]*:([^\r\n]+)/),i=r?r[1].trim():new URL(t).hostname,o=["#3b82f6","#10b981","#8b5cf6","#f59e0b","#ef4444","#f97316","#ec4899","#14b8a6","#6366f1","#6b7280"],l=o[Math.floor(Math.random()*o.length)],{colors:s,darkColors:d}=se(l);return{calendar:{id:Mt(),name:i,isVisible:!0,colors:s,darkColors:d,subscription:{url:t,status:"ready"}},events:a.events}})}var Zr=0;function _r(e,t,n,r,i,o){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:n,ref:l,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Zr,__i:-1,__u:0,__source:i,__self:o};if("function"==typeof e&&(l=e.defaultProps))for(s in l)void 0===d[s]&&(d[s]=l[s]);return a.vnode&&a.vnode(c),c}const zr=({className:e,width:t=24,height:n=24})=>_r("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:_r("path",{d:"m9 18 6-6-6-6"})}),Ur=u(({x:e,y:t,onClose:n,children:a,className:r},i)=>{const o=v(null);return m(()=>{const e=()=>n(),t=e=>{if(o.current&&!o.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]),c(_r("div",{ref:e=>{o.current=e,"function"==typeof i?i(e):i&&"current"in i&&(i.current=e)},className:"df-portal df-context-menu df-context-menu-content"+(r?` ${r}`:""),style:{top:t,left:e},onContextMenu:e=>e.preventDefault(),"data-context-menu-root":"true",role:"menu",children:a}),document.body)});Ur.displayName="ContextMenu";const Wr=({onClick:e,children:t,icon:n,danger:a,disabled:r})=>_r("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&&_r("span",{className:"df-context-menu-item-icon",children:n}),t]}),Br=()=>_r("div",{className:"df-context-menu-separator",role:"separator"}),Vr=({children:e})=>_r("div",{className:"df-context-menu-label",children:e}),qr=({children:e})=>{const[t,n]=g(!1),a=v(null);return m(()=>()=>{a.current&&clearTimeout(a.current)},[]),_r("div",{className:"df-context-menu-sub",onMouseEnter:()=>{a.current&&(clearTimeout(a.current),a.current=null),n(!0)},onMouseLeave:()=>{a.current=setTimeout(()=>n(!1),100)},children:(Array.isArray(e)?e:[e]).map(e=>s(e)?d(e,{isOpen:t}):e)})},Gr=({children:e,icon:t,isOpen:n})=>_r("div",{className:"df-context-menu-sub-trigger","data-open":n,role:"menuitem",tabIndex:0,children:[t&&_r("span",{className:"df-context-menu-sub-icon",children:t}),_r("span",{className:"df-context-menu-sub-label",children:e}),_r(zr,{className:"df-context-menu-sub-chevron"})]}),Kr=({children:e,isOpen:t})=>{const n=v(null),[a,r]=g("right");return m(()=>{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&&r(a.right+t.width>window.innerWidth?"left":"right")}},[t]),t?_r("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},Xr=["#ea426b","#f19a38","#f7cf46","#83d754","#51aaf2","#b672d0","#957e5e"],Jr=({selectedColor:e,onSelect:t,onCustomColor:n,customColorLabel:a="Custom Color"})=>_r("div",{className:"df-context-menu-color-picker",children:[_r("div",{className:"df-context-menu-color-grid",children:Xr.map(n=>_r("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&&_r("button",{type:"button",className:"df-context-menu-custom-color",onClick:e=>{e.stopPropagation(),n()},children:a})]}),Qr=({x:t,y:n,date:a,onClose:r,app:o,onCreateEvent:l,viewType:s})=>{const{t:d}=An();if(!o.canMutateFromUI())return null;const c=cn.hasEvent(),u=zt(i,{children:[zt(Wr,{onClick:()=>{l(),r()},children:d("newEvent")||"New Event"}),zt(Wr,{onClick:()=>e(void 0,void 0,void 0,function*(){yield((t,n,a)=>e(void 0,void 0,void 0,function*(){if(cn.hasEvent())try{let e=cn.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,i=Me(r.start),o=Me(r.end).getTime()-i.getTime(),l=e,s=new Date(n),d=a===x.MONTH||a===x.YEAR,c=0===s.getHours()&&0===s.getMinutes(),u=0!==i.getHours()||0!==i.getMinutes();!r.allDay&&(d||c&&u)&&s.setHours(i.getHours(),i.getMinutes(),i.getSeconds(),i.getMilliseconds());const h=new Date(s.getTime()+(o>0?o:36e5)),g=Object.assign(Object.assign({},l),{title:r.title,id:Mt(),start:r.allDay?ke(s):Oe(s,t.timeZone),end:r.allDay?ke(h):Oe(h,t.timeZone),calendarId:r.calendarId&&t.getCalendarRegistry().has(r.calendarId)?r.calendarId:t.getCalendarRegistry().getDefaultCalendarId()||"default"});t.addEvent(g)}}catch(e){}}))(o,a,s),r()}),disabled:!c,children:d("pasteHere")||"Paste Here"})]});return zt(Ur,{x:t,y:n,onClose:r,className:"df-context-menu",children:zt(za,{generatorName:"gridContextMenu",generatorArgs:{date:a,viewType:s,onClose:r},defaultContent:u})})},ei=({event:t,x:n,y:a,onClose:r,app:o})=>{const{t:l}=An();if(!o.canMutateFromUI(t.id))return null;const s=o.getCalendars(),d=zt(i,{children:[zt(qr,{children:[zt(Gr,{children:l("calendars")||"Calendars"}),zt(Kr,{children:s.map(e=>{const n=e.id===t.calendarId;return zt(Wr,{onClick:()=>{return n=e.id,o.updateEvent(t.id,{calendarId:n}),void r();var n},children:zt("div",{className:"df-context-menu-calendar-item",children:[zt("div",{className:"df-context-menu-calendar-check-wrap",children:n&&zt(va,{className:"df-text-primary df-context-menu-calendar-check"})}),zt("div",{className:"df-context-menu-calendar-info",children:[zt("div",{className:"df-context-menu-calendar-dot",style:{backgroundColor:e.colors.lineColor}}),zt("span",{className:"df-context-menu-calendar-label","data-selected":n,children:e.name})]})]})},e.id)})})]}),zt(Br,{}),zt(Wr,{onClick:()=>{o.deleteEvent(t.id),r()},danger:!0,children:l("delete")||"Delete"}),zt(Wr,{onClick:()=>e(void 0,void 0,void 0,function*(){try{const e=JSON.stringify(t,null,2);yield navigator.clipboard.writeText(e),cn.setEvent(t),o.deleteEvent(t.id)}catch(e){}r()}),children:l("cut")||"Cut"}),zt(Wr,{onClick:()=>e(void 0,void 0,void 0,function*(){try{const e=JSON.stringify(t,null,2);yield navigator.clipboard.writeText(e),cn.setEvent(t)}catch(e){}r()}),children:l("copy")||"Copy"})]});return zt(Ur,{x:n,y:a,onClose:r,children:zt(za,{generatorName:"eventContextMenu",generatorArgs:{event:t,onClose:r},defaultContent:d})})},ti=(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},ni=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"),i=n.closest(".df-calendar-content");return null!==(t=null!=a?a:r)&&void 0!==t?t:i},ai=(e,t,n)=>{const a=["df-event"];return e===x.DAY?a.push("df-day-event"):e===x.WEEK?a.push("df-week-event"):e===x.MONTH?(a.push("df-month-event"),n||a.push("df-month-event-stacked")):e===x.YEAR&&a.push("df-year-event"),a.push(t?"df-event-all-day":"df-event-timed"),a.join(" ")},ri=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"}},ii=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("假期")?zt(wa,{className:Kn}):t.includes("birthday")||t.includes("anniversary")||t.includes("生日")?zt(ba,{className:Kn}):t.includes("conference")||t.includes("meeting")||t.includes("会议")||t.includes("研讨")?zt(Ca,{className:Kn}):t.includes("trip")||t.includes("travel")||t.includes("旅行")?zt(Ea,{className:Kn}):zt(ya,{className:Kn})},oi=(e,t,n=7,a)=>{const r=[],i=new Date(t);return i.setDate(t.getDate()+(n-1)),i.setHours(23,59,59,999),e.forEach(e=>{const o=Ne(e.start,a),l=e.end?Ne(e.end,a):o,s=new Date(o);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()-o.getTime();e>0&&e<864e5&&(c=new Date(d),c.setDate(c.getDate()-1))}const u=B(s,c)>0;if(!u&&e.allDay){if(s<t||s>i)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 g;if(e.allDay||0!==l.getHours()||0!==l.getMinutes()||0!==l.getSeconds()?(g=new Date(d),g.setHours(23,59,59,999)):(g=new Date(d),g.setTime(g.getTime()-1)),g<t||h>i)return;const m=h<t?t:h,v=g>i?i:g,f=Math.max(0,Math.floor((m.getTime()-t.getTime())/864e5)),p=Math.min(n-1,Math.floor((v.getTime()-t.getTime())/864e5)),y=h>=t,D=g<=i,w=0===f||p===n-1;let b;b=y&&D?"single":y?w&&p===n-1?"start-week-end":"start":D?w&&0===f?"end-week-start":"end":"middle";const E=B(h,g)+1;r.push({id:`${e.id}-week-${t.getTime()}`,originalEventId:e.id,event:e,startDayIndex:f,endDayIndex:p,segmentType:b,totalDays:E,segmentIndex:0,isFirstSegment:y,isLastSegment:D})}),r},li=(e,t,n=7,a)=>{if(e.allDay)return[];const r=Ne(e.start,a),i=e.end?Ne(e.end,a):r,o=new Date(r);o.setHours(0,0,0,0);const l=new Date(i);l.setHours(0,0,0,0);const s=B(o,l);if(0===s)return[];const d=0!==i.getHours()||0!==i.getMinutes()||0!==i.getSeconds()||0!==i.getMilliseconds(),c=i.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(o);a.setDate(o.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,g=s?r.getHours()+r.getMinutes()/60:0,m=c&&d?i.getHours()+i.getMinutes()/60:24;h.push({dayIndex:l,startHour:g,endHour:m,isFirst:s,isLast:c})}return h},si={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"},di=h(({segment:e,segmentIndex:t,isDragging:n,isResizing:a=!1,isSelected:r=!1,onMoveStart:o,onResizeStart:l,onEventLongPress:s,isMobile:d=!1,isDraggable:c=!0,isEditable:u=!0,viewable:h=!0,isPopping:m,renderSlot:f,appTimeZone:y})=>{const[D,w]=g(!1),b=p(()=>{if(!y||e.event.allDay)return e.event;const t=Ie(e.event.start,y),n=e.event.end?Ie(e.event.end,y):void 0;return Object.assign(Object.assign({},e.event),{start:t,end:n})},[e.event,y]),E=17*t,C=`calc(${e.startDayIndex/7*100}% + 2px)`,T=`calc(${(e.endDayIndex-e.startDayIndex+1)/7*100}% - 4px)`,S=v(null),M=v(null),N=t=>{const n="left"===t;return(n?e.isFirstSegment:e.isLastSegment)&&l&&u?zt("div",{className:n?Xn:Jn,onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),l(t,e.event,n?"left":"right")},onClick:e=>{e.preventDefault(),e.stopPropagation()}}):null},I=ge(e.event),k=!!e.event.calendarIds&&e.event.calendarIds.length>1,x=k?pe(e.event):null,O=r||n||D,R=()=>{const t=b.allDay,n=ge(b),a=K(b.start),r=Ze(b),i=Fe(a),o=Fe(r),l=me(e.event),s=O&&k;if(t){const t=()=>e.isFirstSegment?b.title:"middle"===e.segmentType||e.isLastSegment&&e.totalDays>1?"···":b.title;return zt("div",{className:"df-month-segment-event-all-day",children:[e.isFirstSegment&&ii(b)&&zt("div",{className:"df-event-icon-slot",children:zt("div",{className:"df-event-year-icon-badge",style:{backgroundColor:he(n)},children:ii(b)})}),zt("div",{className:"df-month-segment-event-all-day-main",children:zt("div",{className:"df-month-segment-event-all-day-title "+(d?"df-mobile-mask-fade":""),style:d?si:void 0,children:t()})}),e.isLastSegment&&"single"!==e.segmentType&&zt("div",{className:"df-month-segment-event-tail",children:zt("div",{className:"df-month-segment-event-tail-dot"})})]})}const c=e.isFirstSegment||e.isLastSegment?b.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 zt("div",{className:"df-event-month-main",children:[!s&&zt("div",{className:Gn,style:l.length>1?{background:ve(l)}:{backgroundColor:l[0]}}),zt("div",{className:"df-event-month-main",children:zt("span",{className:"df-event-month-title "+(d?"df-mobile-mask-fade":""),style:d?si:void 0,children:c})}),e.isFirstSegment&&!d&&zt("span",{className:"df-month-segment-event-time "+(1===u?"df-month-segment-event-time-spaced":"df-month-segment-event-time-overlay"),style:h,children:i}),e.isLastSegment&&!b.allDay&&24!==r&&!d&&zt("span",{className:"df-month-segment-event-tail-time",children:`ends ${o}`})]})},H=e.endDayIndex-e.startDayIndex+1;return zt("div",{className:"df-month-segment-event",style:Object.assign(Object.assign({left:C,width:T,top:`${E}px`,height:"16px",pointerEvents:"auto",zIndex:10,transform:m?"scale(1.02)":"scale(1)",transition:"transform 0.5s cubic-bezier(0.22, 1, 0.36, 1)",willChange:"transform"},O?{backgroundColor:ue(I),color:"#fff"}:k?{background:ye(x),color:ce(I)}:{backgroundColor:de(I),color:ce(I)}),{cursor:c||h?"pointer":"default"}),"data-all-day":String(!!b.allDay),"data-selected":String(r),"data-dragging":String(n),"data-resizing":String(a),"data-popping":String(!!m),"data-segment-shape":ri(e),"data-segment-days":H,onMouseDown:t=>{(c||h)&&(t.preventDefault(),t.stopPropagation(),w(!0),!t.target.closest(".df-resize-handle")&&c&&(null==o||o(t,e.event)))},onMouseUp:()=>{w(!1)},onMouseLeave:()=>{w(!1)},onTouchStart:t=>{if(!o||!d||!c&&!h)return;t.stopPropagation(),w(!0);const n=t.touches[0],a=n.clientX,r=n.clientY,i=t.currentTarget;M.current={x:a,y:r},S.current=setTimeout(()=>{s&&s(e.event.id),c&&o({preventDefault:()=>{},stopPropagation:()=>{},currentTarget:i,touches:[{clientX:a,clientY:r}],cancelable:!1},e.event),S.current=null,navigator.vibrate&&navigator.vibrate(50)},500)},onTouchMove:e=>{if(S.current&&M.current){const t=Math.abs(e.touches[0].clientX-M.current.x),n=Math.abs(e.touches[0].clientY-M.current.y);(t>10||n>10)&&(clearTimeout(S.current),S.current=null,M.current=null,w(!1))}},onTouchEnd:()=>{w(!1),S.current&&(clearTimeout(S.current),S.current=null),M.current=null},title:`${b.title} (${Ut(b.start)} - ${Ut(b.end)})`,children:[d&&r&&u&&zt(i,{children:[e.isFirstSegment&&zt("div",{className:"df-event-touch-resize-indicator","data-axis":"horizontal","data-position":"left",style:{borderColor:he(I)},onTouchStart:t=>{t.stopPropagation(),null==l||l(t,e.event,"left")}}),e.isLastSegment&&zt("div",{className:"df-event-touch-resize-indicator","data-axis":"horizontal","data-position":"right",style:{borderColor:he(I)},onTouchStart:t=>{t.stopPropagation(),null==l||l(t,e.event,"right")}})]}),N("left"),zt("div",{className:"df-month-segment-event-body",style:{cursor:a?"ew-resize":"pointer"},children:f?f(R()):R()}),N("right")]})});di.displayName="MultiDayEvent";const ci=({event:e,isEditable:t,onResizeStart:n,isMultiDay:a,segment:r,isSlidingView:o,renderSlot:l})=>{const s=!1!==e.icon,d="boolean"==typeof e.icon?null:e.icon,c=o&&a&&r&&r.startDayIndex<2&&r.endDayIndex>=2?{paddingLeft:`calc(${(2-r.startDayIndex)/(r.endDayIndex-r.startDayIndex+1)*100}% + 0.75rem)`}:{},u=zt("div",{className:"df-event-content-row",children:[s&&(d?zt("div",{className:"df-event-icon-slot",children:d}):zt("span",{className:"df-event-icon-slot",children:zt(ya,{className:Kn})})),zt("div",{className:`${qn} df-event-title-tight`,children:e.title})]});return zt("div",{className:"df-event-all-day-shell",style:c,children:[l?l(u):u,n&&t&&zt(i,{children:[zt("div",{className:Xn,onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),n(t,e,"left")},onClick:e=>{e.preventDefault(),e.stopPropagation()}}),zt("div",{className:Jn,onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),n(t,e,"right")},onClick:e=>{e.preventDefault(),e.stopPropagation()}})]})]})},ui={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"},hi=({event:e,isEventSelected:t,isMobile:n})=>{const a=!1!==e.icon,r="boolean"==typeof e.icon?null:e.icon;return zt("div",{className:"df-event-month-all-day",children:[a&&(r?zt("div",{className:"df-event-icon-slot",children:r}):e.title.toLowerCase().includes("easter")||e.title.toLowerCase().includes("holiday")?zt("span",{className:"df-event-holiday-icon",children:"⭐"}):zt("span",{className:"df-event-icon-slot",children:zt(ya,{className:Kn})})),zt("span",{className:"df-event-month-title "+(n?"df-mobile-mask-fade":""),style:n?ui:void 0,children:e.title})]})},gi={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"},mi=({event:e,app:t,isEventSelected:n,hideTime:a,isMobile:r})=>{const i=`${Math.floor(K(e.start)).toString().padStart(2,"0")}:${Math.round(K(e.start)%1*60).toString().padStart(2,"0")}`,o=me(e,null==t?void 0:t.getCalendarRegistry()),l=ve(o),s=o.length>1?{background:l}:{backgroundColor:l},d=n&&o.length>1;return zt("div",{className:"df-event-month-regular","data-mobile":String(!!r),children:[zt("div",{className:"df-event-month-main",children:[!d&&zt("div",{style:s,className:Gn}),zt("span",{className:"df-event-month-title "+(r?"df-mobile-mask-fade":""),style:r?gi:void 0,children:e.title})]}),!a&&!r&&zt("span",{className:"df-event-month-time",children:i})]})},vi=({event:e,app:t,multiDaySegmentInfo:n,isEditable:a,isTouchEnabled:r,isEventSelected:o,onResizeStart:l,timeFormat:s="24h",resizeHandleOrientation:d="vertical",renderSlot:c})=>{const u=n?n.startHour:K(e.start),h=n?n.endHour:Ze(e),g=h-u,m=!n||n.isFirst,v=!n||n.isLast,f=ge(e),p=!n&&g<=.25?"compact":"default",y=me(e,null==t?void 0:t.getCalendarRegistry()),D=fe(y),w=o&&y.length>1?null:y.length>1?zt("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)"}}):zt("div",{className:"df-event-color-bar",style:{backgroundColor:D}}),b=zt(i,{children:[w,zt("div",{className:"df-event-timed-content","data-density":p,children:[zt("div",{className:`${qn} ${g<=.25?"df-event-title-tight":""}`,children:e.title}),g>.5&&zt("div",{className:"df-event-time",children:n?`${Fe(u,0,s)} - ${Fe(h,0,s)}`:_e(e,s)})]})]});return zt(i,{children:[c?c(b):b,l&&a&&"vertical"===d&&zt(i,{children:[m&&zt("div",{className:"df-event-resize-handle df-event-resize-handle-top",onMouseDown:t=>l(t,e,"top")}),v&&zt("div",{className:"df-event-resize-handle df-event-resize-handle-bottom",onMouseDown:t=>l(t,e,"bottom")}),!m&&v&&n&&zt("div",{className:Jn,onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),l(t,e,"right")},onClick:e=>{e.preventDefault(),e.stopPropagation()}})]}),r&&o&&l&&a&&"vertical"===d&&zt(i,{children:[zt("div",{className:"df-event-touch-resize-indicator","data-axis":"vertical","data-position":"top",style:{borderColor:he(f,null==t?void 0:t.getCalendarRegistry())},onTouchStart:t=>{t.stopPropagation(),l(t,e,"top")}}),zt("div",{className:"df-event-touch-resize-indicator","data-axis":"vertical","data-position":"bottom",style:{borderColor:he(f,null==t?void 0:t.getCalendarRegistry())},onTouchStart:t=>{t.stopPropagation(),l(t,e,"bottom")}})]}),l&&a&&"horizontal"===d&&zt(i,{children:[zt("div",{className:Xn,onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),l(t,e,"left")},onClick:e=>{e.preventDefault(),e.stopPropagation()}}),zt("div",{className:Jn,onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),l(t,e,"right")},onClick:e=>{e.preventDefault(),e.stopPropagation()}})]})]})},fi=({event:e,segment:t,isEditable:n,onMoveStart:a,onResizeStart:r,renderSlot:o})=>{const l=!!e.allDay,s=ge(e),d=me(e),c=ve(d),u=d.length>1?{background:c}:{backgroundColor:c},{isFirstSegment:h,isLastSegment:g}=t,m=t=>{const a="left"===t,i=a?h:g;return e.allDay&&i&&r&&n?zt("div",{className:a?Xn:Jn,onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),r(t,e,a?"left":"right")},onTouchStart:t=>{t.stopPropagation(),r(t,e,a?"left":"right")},onClick:e=>{e.preventDefault(),e.stopPropagation()}}):null},v=()=>{if(l){const n=()=>t.isFirstSegment?e.title:"···";return zt("div",{className:"df-event-year-content",onMouseDown:t=>{a&&(t.stopPropagation(),a(t,e))},children:[t.isFirstSegment&&ii(e)&&zt("div",{className:"df-event-icon-slot",children:zt("div",{className:"df-event-year-icon-badge",style:{backgroundColor:he(s)},children:ii(e)})}),zt("div",{className:"df-event-year-main",children:zt("div",{className:"df-event-year-title df-event-year-title-fade",children:n()})}),t.isLastSegment&&!t.isFirstSegment&&zt("div",{className:"df-event-year-tail",children:zt("div",{className:"df-event-year-tail-dot"})})]})}const n=t.isFirstSegment?e.title:"";return zt("div",{className:"df-event-year-content df-event-year-content-timed",onMouseDown:t=>{a&&(t.stopPropagation(),a(t,e))},children:[!l&&zt("span",{style:u,className:"df-event-year-indicator"}),zt("span",{className:"df-event-year-title df-event-year-title-strong df-event-year-title-fade",children:n}),t.isLastSegment&&!t.isFirstSegment&&zt("div",{className:"df-event-year-tail",children:zt("div",{className:"df-event-year-tail-dot"})})]})};return zt(i,{children:[m("left"),o?o(v()):v(),m("right")]})},pi=({event:e,viewType:t,isAllDay:n,isMultiDay:a,segment:r,yearSegment:i,segmentIndex:o,isBeingDragged:l,isBeingResized:s,isEventSelected:d,isPopping:c,isEditable:u,isDraggable:h,canOpenDetail:g,isTouchEnabled:m,hideTime:v,isMobile:f,isSlidingView:p,app:y,onMoveStart:D,onResizeStart:w,multiDaySegmentInfo:b,customRenderingStore:E,eventContentSlotArgs:C,timeFormat:T="24h",appTimeZone:S,renderVisualContent:M,resizeHandleOrientation:N})=>{const I=t===x.MONTH,k=t===x.YEAR,O=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(I&&a&&r)return zt(di,{segment:r,segmentIndex:null!=o?o:0,isDragging:l||d,isResizing:s,isSelected:d,onMoveStart:D,onResizeStart:w,isMobile:f,isDraggable:h,isEditable:u,viewable:g,isPopping:c,appTimeZone:S,renderSlot:e=>zt(za,{store:E,generatorName:O,generatorArgs:C,defaultContent:R(e)})});if(k&&i)return zt(fi,{event:e,segment:i,isEditable:u,onMoveStart:D,onResizeStart:w,renderSlot:e=>zt(za,{store:E,generatorName:O,generatorArgs:C,defaultContent:R(e)})});if(I){const t=n?zt(hi,{event:e,isEventSelected:d,isMobile:f}):zt(mi,{event:e,app:y,isEventSelected:d,hideTime:v,isMobile:f});return zt(za,{store:E,generatorName:O,generatorArgs:C,defaultContent:R(t)})}const H=e=>zt(za,{store:E,generatorName:O,generatorArgs:C,defaultContent:R(e)});return n?zt(ci,{event:e,isEditable:u,onResizeStart:w,isMultiDay:a,segment:r,isSlidingView:p,renderSlot:H}):zt(vi,{event:e,app:y,multiDaySegmentInfo:b,isEditable:u,isTouchEnabled:m,isEventSelected:d,onResizeStart:w,timeFormat:T,resizeHandleOrientation:N,renderSlot:H})},yi=({event:t,position:a,panelRef:r,isAllDay:i,eventVisibility:o,calendarRef:l,selectedEventElementRef:s,onEventUpdate:d,onEventDelete:u,onClose:h,app:y})=>{var D,w;const{effectiveTheme:b}=Fa(),E=Kt(b),{t:C}=An(),[T,S]=g(t),[M,N]=g(!1),I=v(t),k=v(t),x=v(!1),O=f(()=>{if(x.current)return;const e=I.current,t=k.current;if(Ct(e,t))return;const n=Ke(e,t,null==y?void 0:y.timeZone);I.current=n,k.current=n;const a=d(n);a&&Promise.resolve(a).catch(e=>{De.error("Failed to commit deferred event detail panel update",e)})},[null==y?void 0:y.timeZone,d]),R=f(e=>{if(!Ct(k.current,e)&&(k.current=e,S(e),y)){const t=y.updateEvent(e.id,e,!0);t&&Promise.resolve(t).catch(e=>{De.error("Failed to apply pending event detail panel update",e)})}},[y]);m(()=>{if(I.current.id!==t.id)return O(),x.current=!1,I.current=t,k.current=t,void S(t);Ct(I.current,k.current)&&(I.current=t,k.current=t,S(t))},[t,O]),m(()=>()=>{O()},[O]);const H=p(()=>{var e;return null!==(e=null==y?void 0:y.timeZone)&&void 0!==e?e:n.Now.timeZoneId()},[y]),P=p(()=>(y?y.getCalendarRegistry():le()).getVisible().map(e=>({label:e.name,value:e.id})),[y,null==y?void 0:y.getCalendars()]),L="dark"===E||"undefined"!=typeof document&&document.documentElement.classList.contains("dark"),$=null!==(D=null==y?void 0:y.canMutateFromUI(t.id))&&void 0!==D&&D,j=null==y?void 0:y.getReadOnlyConfig(t.id),Y=!1!==(null==j?void 0:j.viewable),F=!!T.allDay,Z=!p(()=>{if(!t.calendarId)return!1;const e=null==y?void 0:y.getCalendarRegistry().get(t.calendarId);return!!(null==e?void 0:e.subscription)},[y,t.calendarId])||""!==(T.description||"").trim();if(!Y)return null;const _=L?"#1f2937":"white",z=L?"rgb(55, 65, 81)":"rgb(229, 231, 235)",U=(()=>{let e={};if("sticky-top"===o){const t=ni(l);if(t){const n=t.getBoundingClientRect().top+3-a.top;e=Object.assign({position:"absolute",width:"12px",height:"12px",backgroundColor:_,transform:"rotate(45deg)",transformOrigin:"center",top:n-6+"px",borderRight:a.isSunday?`1px solid ${z}`:"none",borderTop:a.isSunday?`1px solid ${z}`:"none",borderLeft:a.isSunday?"none":`1px solid ${z}`,borderBottom:a.isSunday?"none":`1px solid ${z}`},a.isSunday?{right:"-6px"}:{left:"-6px"})}}else if("sticky-bottom"===o){const t=r.current;let n=200;if(t){const e=t.getBoundingClientRect(),a=window.getComputedStyle(t),r=Number.parseInt(a.paddingBottom,10)||0,i=Number.parseInt(a.borderBottomWidth,10)||0;n=e.height-r-i-6+11}e={position:"absolute",width:"12px",height:"12px",backgroundColor:_,transform:"rotate(45deg)",transformOrigin:"center",top:`${n}px`,left:a.isSunday?void 0:"-6px",right:a.isSunday?"-6px":void 0,borderRight:a.isSunday?`1px solid ${z}`:"none",borderTop:a.isSunday?`1px solid ${z}`:"none",borderLeft:a.isSunday?"none":`1px solid ${z}`,borderBottom:a.isSunday?"none":`1px solid ${z}`}}else if(a&&s.current&&l.current){const t=s.current.getBoundingClientRect(),n=ni(l);if(n){const i=n.getBoundingClientRect(),o=Math.max(t.top,i.top),l=Math.min(t.bottom,i.bottom),s=Math.max(0,l-o);let d;d=s===t.height?t.top+t.height/2:s>0?o+s/2:t.top+t.height/2;const c=d-a.top,u=r.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 g=12,m=Math.max(g,Math.min(h,c));e=Object.assign({position:"absolute",width:"12px",height:"12px",backgroundColor:_,transform:"rotate(45deg)",transformOrigin:"center",top:m-6+"px",borderRight:a.isSunday?`1px solid ${z}`:"none",borderTop:a.isSunday?`1px solid ${z}`:"none",borderLeft:a.isSunday?"none":`1px solid ${z}`,borderBottom:a.isSunday?"none":`1px solid ${z}`},a.isSunday?{right:"-6px"}:{left:"-6px"})}}return e})(),W=zt("div",{ref:r,className:`${ea} df-event-panel-content`,"data-event-detail-panel":"true","data-event-id":t.id,style:{top:`${a.top}px`,left:`${a.left}px`,zIndex:9999,pointerEvents:"auto"},children:[zt("div",{style:U}),zt("span",{className:"df-form-label",children:C("eventTitle")}),zt("div",{className:"df-form-row",style:{marginBottom:"0.75rem"},children:[zt("div",{className:"df-form-field",children:zt("input",{id:`event-title-${T.id}`,name:"title",type:"text",value:T.title,readOnly:!$||M,disabled:!$||M,onChange:e=>R(Object.assign(Object.assign({},T),{title:e.target.value})),onInput:e=>R(Object.assign(Object.assign({},T),{title:e.target.value})),className:"df-form-input"})}),$&&zt(wr,{options:P,value:T.calendarId||"blue",disabled:M,onChange:e=>{R(Object.assign(Object.assign({},T),{calendarId:e}))},registry:null==y?void 0:y.getCalendarRegistry()})]}),zt("div",F?{className:"df-event-dialog-time-row",style:{marginBottom:"0.75rem"},children:[zt("div",{className:"df-form-label",children:C("dateRange")}),zt(Dr,{value:[T.start,T.end],format:"YYYY-MM-DD",showTime:!1,timeZone:H,matchTriggerWidth:!0,disabled:!$||M,onChange:e=>{if(M)return;const[t,n]=e;R(Object.assign(Object.assign({},T),{start:t.toPlainDate(),end:n.toPlainDate()}))},locale:null==y?void 0:y.state.locale})]}:{className:"df-event-dialog-time-row",style:{marginBottom:"0.75rem"},children:[zt("div",{className:"df-form-label",children:C("timeRange")}),zt(Dr,{value:[T.start,T.end],timeZone:H,disabled:!$||M,onChange:e=>{if(M)return;const[t,n]=e;R(Object.assign(Object.assign({},T),{start:t,end:n}))},locale:null==y?void 0:y.state.locale})]}),Z&&zt("div",{className:"df-event-dialog-notes-row",style:{marginBottom:"0.75rem"},children:[zt("span",{className:"df-form-label",children:C("note")}),zt("textarea",{id:`event-note-${T.id}`,name:"note",value:null!==(w=T.description)&&void 0!==w?w:"",readOnly:!$||M,disabled:!$||M,onChange:e=>R(Object.assign(Object.assign({},T),{description:e.target.value})),onInput:e=>R(Object.assign(Object.assign({},T),{description:e.target.value})),rows:3,className:"df-form-textarea",placeholder:C("addNotePlaceholder")})]}),$&&zt("div",{className:"df-form-actions",children:[zt(Ba,F?{type:"button",className:"df-fill-primary df-hover-primary-solid df-btn-sm",onClick:()=>{var e;if(M)return;const t=A(T.start)?T.start:T.start.toPlainDate(),a=null!==(e=null==y?void 0:y.timeZone)&&void 0!==e?e:n.Now.timeZoneId(),r=n.ZonedDateTime.from({year:t.year,month:t.month,day:t.day,hour:9,minute:0,timeZone:a}),i=n.ZonedDateTime.from({year:t.year,month:t.month,day:t.day,hour:10,minute:0,timeZone:a});R(Object.assign(Object.assign({},T),{allDay:!1,start:r,end:i}))},loading:M,children:C("setAsTimed")}:{type:"button",className:"df-fill-primary df-hover-primary-solid df-btn-sm",onClick:()=>{if(M)return;const e=A(T.start)?T.start:T.start.toPlainDate(),t=A(T.end)?T.end:T.end.toPlainDate();R(Object.assign(Object.assign({},T),{allDay:!0,start:e,end:t}))},loading:M,children:C("setAsAllDay")}),zt(Ba,{type:"button",className:"df-fill-destructive df-hover-destructive df-btn-sm",onClick:()=>e(void 0,void 0,void 0,function*(){if(!M){x.current=!0,N(!0);try{yield u(T.id)}finally{N(!1)}}}),loading:M,children:C("delete")})]})]});if("undefined"==typeof window||"undefined"==typeof document)return null;const B=document.body;return B?c(W,B):null},Di=({event:e,position:t,panelRef:n,isAllDay:a,eventVisibility:r,calendarRef:i,selectedEventElementRef:o,onEventUpdate:l,onEventDelete:s,onClose:d,contentRenderer:u})=>{const{effectiveTheme:h}=Fa(),g=Kt(h),m="dark"===g?"#1f2937":"white",v="dark"===g?"rgb(55, 65, 81)":"rgb(229, 231, 235)",f=(()=>{let e={};if("sticky-top"===r){const n=ni(i);if(n){const a=n.getBoundingClientRect().top+3-t.top;e=Object.assign({position:"absolute",width:"12px",height:"12px",backgroundColor:m,transform:"rotate(45deg)",transformOrigin:"center",top:a-6+"px",borderRight:t.isSunday?`1px solid ${v}`:"none",borderTop:t.isSunday?`1px solid ${v}`:"none",borderLeft:t.isSunday?"none":`1px solid ${v}`,borderBottom:t.isSunday?"none":`1px solid ${v}`},t.isSunday?{right:"-6px"}:{left:"-6px"})}}else if("sticky-bottom"===r){const a=n.current;let r=200;if(a){const e=a.getBoundingClientRect(),t=window.getComputedStyle(a),n=Number.parseInt(t.paddingBottom,10)||0,i=Number.parseInt(t.borderBottomWidth,10)||0;r=e.height-n-i-6+11}e={position:"absolute",width:"12px",height:"12px",backgroundColor:m,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 ${v}`:"none",borderTop:t.isSunday?`1px solid ${v}`:"none",borderLeft:t.isSunday?"none":`1px solid ${v}`,borderBottom:t.isSunday?"none":`1px solid ${v}`}}else if(t&&o.current&&i.current){const a=o.current.getBoundingClientRect(),r=ni(i);if(r){const i=r.getBoundingClientRect(),o=Math.max(a.top,i.top),l=Math.min(a.bottom,i.bottom),s=Math.max(0,l-o);let d;d=s===a.height?a.top+a.height/2:s>0?o+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 g=12,f=Math.max(g,Math.min(h,c));e=Object.assign({position:"absolute",width:"12px",height:"12px",backgroundColor:m,transform:"rotate(45deg)",transformOrigin:"center",top:f-6+"px",borderRight:t.isSunday?`1px solid ${v}`:"none",borderTop:t.isSunday?`1px solid ${v}`:"none",borderLeft:t.isSunday?"none":`1px solid ${v}`,borderBottom:t.isSunday?"none":`1px solid ${v}`},t.isSunday?{right:"-6px"}:{left:"-6px"})}}return e})(),p=zt("div",{ref:n,className:`${ea} 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"===g?"#1f2937":"#ffffff"},children:[zt("div",{style:f}),zt(u,{event:e,isAllDay:a,onEventUpdate:l,onEventDelete:s,onClose:d})]});return c(p,document.body)},wi=({showDetailPanel:e,customEventDetailDialog:t,detailPanelPosition:n,event:a,detailPanelRef:r,isAllDay:i,eventVisibility:o,calendarRef:l,selectedEventElementRef:s,onEventUpdate:d,onEventDelete:c,handlePanelClose:u,customRenderingStore:h,contentSlotRenderer:g,customDetailPanelContent:m,app:v})=>{if(!e)return null;if(t)return null;if(!n)return null;const f={event:a,position:n,panelRef:r,isAllDay:i,eventVisibility:o,calendarRef:l,selectedEventElementRef:s,onEventUpdate:d,onEventDelete:c,onClose:u};return(null==h?void 0:h.isOverridden("eventDetailContent"))?zt(Di,Object.assign({},f,{contentRenderer:g})):m?zt(Di,Object.assign({},f,{contentRenderer:m})):zt(yi,Object.assign({},f,{app:v}))},bi="transform 0.5s cubic-bezier(0.22, 1, 0.36, 1)",Ei=({event:e,layout:t,isAllDay:n=!1,allDayHeight:a=28,calendarRef:r,isBeingDragged:o=!1,isBeingResized:l=!1,viewType:s,isMultiDay:d=!1,segment:c,yearSegment:u,columnsPerRow:h,segmentIndex:y=0,hourHeight:w,firstHour:b,selectedEventId:E,detailPanelEventId:C,onMoveStart:T,onResizeStart:S,onEventUpdate:M,onEventDelete:N,newlyCreatedEventId:I,onDetailPanelOpen:k,onEventSelect:O,onEventLongPress:R,onDetailPanelToggle:H,customDetailPanelContent:P,customEventDetailDialog:A,useEventDetailPanel:L,multiDaySegmentInfo:$,app:j,isMobile:Y=!1,isSlidingView:F=!1,enableTouch:Z,hideTime:_,timeFormat:z="24h",styleOverride:U,className:W,disableDefaultStyle:B=!1,renderVisualContent:V,resizeHandleOrientation:q,appTimeZone:G})=>{var X;const J=D(Za),Q=null!=Z?Z:Y,ee=s===x.YEAR,te=p(()=>{if(!G||e.allDay)return e;const t=Ie(e.start,G),n=e.end?Ie(e.end,G):void 0;return Object.assign(Object.assign({},e),{start:t,end:n})},[e,G]),[ne,ae]=g(null),[re,ie]=g(!1),oe=v(null),le=v(null),se=v(null),he=v(null),me=d&&c?`${e.id}::${c.id}`:void 0===(null==$?void 0:$.dayIndex)?ee&&u?u.id:e.id:`${e.id}::day-${$.dayIndex}`,ve=C===me,fe=!1!==L,we=ve&&!A&&fe,be=null==j?void 0:j.getReadOnlyConfig(e.id),Ee=null!==(X=null==j?void 0:j.canMutateFromUI(e.id))&&void 0!==X&&X,Ce=!1!==(null==be?void 0:be.viewable),Te=!1!==(null==be?void 0:be.draggable),{isSelected:Se,setIsSelected:Me,isPressed:Ne,setIsPressed:ke,handleTouchStart:xe,handleTouchMove:Oe,handleTouchEnd:Re,shouldSuppressClick:He}=(({event:e,isTouchEnabled:t,onMoveStart:n,onEventLongPress:a,onEventSelect:r,onDetailPanelToggle:i,canOpenDetail:o,useEventDetailPanel:l,app:s,multiDaySegmentInfo:d,isMultiDay:c,segment:u})=>{const[h,m]=g(!1),[f,p]=g(!1),y=v(null),D=v(null),w=v(0);return{isSelected:h,setIsSelected:m,isPressed:f,setIsPressed:p,handleTouchStart:r=>{if(!n||!t)return;r.stopPropagation(),p(!0);const i=r.touches[0],o=i.clientX,l=i.clientY,s=r.currentTarget;D.current={x:o,y:l},y.current=setTimeout(()=>{var t;a?a(e.id):m(!0);const r={preventDefault:()=>{},stopPropagation:()=>{},currentTarget:s,touches:[{clientX:o,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);y.current=null,D.current=null,navigator.vibrate&&navigator.vibrate(50),w.current=Date.now()+400},500)},handleTouchMove:e=>{if(t&&e.stopPropagation(),y.current&&D.current){const t=Math.abs(e.touches[0].clientX-D.current.x),n=Math.abs(e.touches[0].clientY-D.current.y);(t>10||n>10)&&(clearTimeout(y.current),y.current=null,D.current=null,p(!1))}},handleTouchEnd:n=>{p(!1),y.current&&(clearTimeout(y.current),y.current=null),t&&D.current&&(n.preventDefault(),n.stopPropagation(),w.current=Date.now()+400,s&&s.onEventClick(e),o?(r?r(e.id):m(!0),!1!==l&&(null==i||i(null))):(null==r||r(null),!1!==l&&(null==i||i(null)))),D.current=null},shouldSuppressClick:()=>Date.now()<w.current}})({event:e,isTouchEnabled:Q,onMoveStart:Te?T:void 0,onEventLongPress:R,onEventSelect:O,onDetailPanelToggle:H,canOpenDetail:Ce,useEventDetailPanel:L,app:j,multiDaySegmentInfo:$,isMultiDay:d,segment:c}),[Pe,Ae]=g("standard"),Le=e=>{he.current=e},$e=f(()=>((e,t,n,a,r,i)=>{var o;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:i?i.startDayIndex:null!==(o=e.day)&&void 0!==o?o:0})(e,C||void 0,me,he.current,$,c),[e,C,me,$,c]),je=f(e=>((e,t,n,a)=>{if(!t.current)return null;const r=t.current.getBoundingClientRect();if(n===x.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 i=ti(t,a),o=n===x.DAY?1:7,l=(r.width-i)/o,s=e-r.left-i,d=Math.floor(s/l);return Number.isFinite(d)?Math.max(0,Math.min(o-1,d)):null})(e,r,s,Y),[r,s,Y]),Ye=f(e=>((e,t,n,a)=>{if(!t.current)return null;const r=t.current.getBoundingClientRect();if(n===x.MONTH){const t=r.width/7;return{left:r.left+e*t,width:t}}const i=ti(t,a);if(n===x.DAY){const e=r.width-i;return{left:r.left+i,width:e}}const o=(r.width-i)/7;return{left:r.left+i+e*o,width:o}})(e,r,s,Y),[r,s,Y]),{detailPanelPosition:Fe,setDetailPanelPosition:_e,updatePanelPosition:ze}=(({event:e,viewType:t,isMultiDay:n,segment:a,yearSegment:r,multiDaySegmentInfo:i,calendarRef:o,eventRef:l,detailPanelRef:s,selectedEventElementRef:d,isMobile:c,eventVisibility:u,firstHour:h,hourHeight:v,columnsPerRow:p,showDetailPanel:y,detailPanelEventId:D,detailPanelKey:w,getActiveDayIdx:b,getDayMetricsWrapper:E})=>{const[C,T]=g(null),S=t===x.DAY,M=t===x.MONTH,N=t===x.YEAR,I=t===x.RESOURCE,k=f(()=>{if(!d.current&&!l.current||!o.current||!s.current)return;const e=o.current.getBoundingClientRect(),t=b(),r=E(t);let i,h;if(r)i=r.left,h=r.width;else if(M)h=e.width/7,i=e.left+t*h;else{const n=ti(o,c);h=(e.width-n)/7,i=e.left+n+t*h}const g=Math.min(window.innerWidth,e.right),m=Math.min(window.innerHeight,e.bottom);requestAnimationFrame(()=>{var r,o,c;if(!s.current)return;const h=d.current||l.current;if(!h)return;const v=s.current.getBoundingClientRect(),f=v.width,p=v.height;let y,D,w;if("sticky-top"===u||"sticky-bottom"===u||"sticky-left"===u||"sticky-right"===u){const e=null===(r=l.current)||void 0===r?void 0:r.getBoundingClientRect();if(!e)return;w=e}else w=h.getBoundingClientRect();if(M&&n&&a){const n=E(t),a=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:e.width/7,r=null!==(c=null==n?void 0:n.left)&&void 0!==c?c:e.left+t*a,i=r+a;w={top:w.top,bottom:w.bottom,left:r,right:i,width:i-r,height:w.height,x:r,y:w.top,toJSON:()=>({})}}const b=g-w.right,C=w.left-e.left;y=b>=f+20?w.right+10:C>=f+20?w.left-f-10:b>C?Math.max(e.left+10,g-f-10):e.left+10;const S=w.top-p/2+w.height/2,k=Math.max(10,e.top+10),x=m-10;D=S<k?k:S+p>x?x-p:S,T(e=>{if(!e)return null;let t=y<i;return(N||I)&&(t=y<w.left),Object.assign(Object.assign({},e),{top:D,left:y,isSunday:t})})})},[o,e.day,e.start,e.end,u,M,h,v,n,a,i,D,w,c,S,N,r,p,b,E,d,s,l]);return m(()=>{!y||C||c||(T({top:-9999,left:-9999,eventHeight:0,eventMiddleY:0,isSunday:!1}),requestAnimationFrame(()=>k()))},[y,C,k,c]),{detailPanelPosition:C,setDetailPanelPosition:T,updatePanelPosition:k}})({event:e,viewType:s,isMultiDay:d,segment:c,yearSegment:u,multiDaySegmentInfo:$,calendarRef:r,eventRef:oe,detailPanelRef:le,selectedEventElementRef:se,isMobile:Y,eventVisibility:Pe,firstHour:b,hourHeight:w,columnsPerRow:h,showDetailPanel:ve,detailPanelEventId:C,detailPanelKey:me,getActiveDayIdx:$e,getDayMetricsWrapper:Ye}),{handleClick:Ue,handleDoubleClick:We,handleContextMenu:Be,hasPendingSelection:Ve}=(({event:e,timingEvent:t,viewType:n,isAllDay:a,isMultiDay:r,segment:i,multiDaySegmentInfo:o,calendarRef:l,firstHour:s,hourHeight:d,isMobile:c,canOpenDetail:u,useEventDetailPanel:h,detailPanelKey:p,app:y,onEventSelect:D,onDetailPanelToggle:w,setIsSelected:b,setDetailPanelPosition:E,setContextMenuPosition:C,setActiveDayIndex:T,getClickedDayIdx:S,updatePanelPosition:M,selectedEventElementRef:N})=>{const I=n===x.MONTH,k=n===x.YEAR,O=n===x.RESOURCE,R=null!=t?t:e,H=v(null),[P,A]=g(!1),L=f(()=>{H.current&&(clearTimeout(H.current),H.current=null,A(!1))},[]);m(()=>()=>L(),[L]);const $=f((e,t,n)=>new Promise(a=>{let r=0,i=0,o=t,l=n;const s=()=>{const t=e.scrollLeft,n=e.scrollTop,d=Math.abs(t-o)>1||Math.abs(n-l)>1;r=d?0:r+40,i+=40,o=t,l=n,r>=120||i>=600?a():setTimeout(s,40)};setTimeout(s,40)}),[]),j=f(()=>new Promise(e=>{if(!l.current||a||I||k||d<=0)return void e();const t=ni(l);if(!t)return void e();if(O&&N.current){const n=N.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,i=t.scrollTop,o=r+(n.left-a.left)-(t.clientWidth-n.width)/2,l=i+(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,o)),u=Math.max(0,Math.min(d,l));return Math.abs(c-r)>1||Math.abs(u-i)>1?(t.scrollTo({left:c,top:u,behavior:"smooth"}),void $(t,r,i).then(e)):void e()}const n=o?o.startHour:K(R.start),r=o?o.endHour:Ze(R),i=(n-s)*d,c=i+Math.max((r-n)*d,d/4),u=t.scrollTop,h=t.clientHeight;if(i>=u&&c<=u+h)return void e();const g=((n+r)/2-s)*d-h/2,m=t.scrollHeight-h,v=Math.max(0,Math.min(m,g));Math.abs(v-u)<=1?e():(t.scrollTo({top:v,behavior:"smooth"}),$(t,t.scrollLeft,u).then(e))}),[l,a,I,k,O,o,R.start,R.end,s,d,N,$]),Y=f(t=>{L(),t.preventDefault(),t.stopPropagation(),y&&!y.canMutateFromUI(e.id)||(D&&D(e.id),C({x:t.clientX,y:t.clientY}))},[y,L,e.id,D,C]),F=f(t=>{var n,a,l;if(r){const r=S(t);T(null===r?null!==(a=null!==(n=null==o?void 0:o.dayIndex)&&void 0!==n?n:e.day)&&void 0!==a?a:null:i?Math.min(Math.max(r,i.startDayIndex),i.endDayIndex):r)}else T(null!==(l=e.day)&&void 0!==l?l:null);D?D(e.id):u&&b(!0),!1!==h&&(null==w||w(null),E(null))},[r,S,T,null==o?void 0:o.dayIndex,e,i,D,u,b,w,E]),Z=f(()=>{null==y||y.onEventClick(e)},[y,e]),_=f(e=>{F(e),Z()},[F,Z]),z=f(t=>{var n,a,o,l,s,d;if(L(),t.preventDefault(),t.stopPropagation(),!u)return;let g=t.currentTarget;if(r){const e=g.querySelector("div");e&&(g=e)}if(N.current=g,r){const r=S(t.clientX);T(null===r?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(r,null!==(o=null==i?void 0:i.startDayIndex)&&void 0!==o?o:0),null!==(l=null==i?void 0:i.endDayIndex)&&void 0!==l?l:6))}else T(null!==(s=e.day)&&void 0!==s?s:null);b(!0),null==D||D(e.id);const m=()=>{j().then(()=>{!1!==h&&(c||(null==w||w(p),E({top:-9999,left:-9999,eventHeight:0,eventMiddleY:0,isSunday:!1}),requestAnimationFrame(()=>M())))})};y?Promise.resolve(null===(d=y.onEventDoubleClick)||void 0===d?void 0:d.call(y,e,t)).then(e=>{!1!==e&&m()}).catch(e=>{De.error("Failed to handle event double click callback",e),m()}):m()},[L,u,r,N,S,T,null==i?void 0:i.startDayIndex,null==i?void 0:i.endDayIndex,e.day,y,e,j,b,k,c,D,w,p,E,M]);return{handleClick:f(e=>{e.preventDefault(),e.stopPropagation();const t=e.clientX;if(!c&&u)return L(),k||O||F(t),A(!0),void(H.current=setTimeout(()=>{(k||O)&&F(t),Z(),H.current=null,A(!1)},180));_(t)},[L,u,F,Z,k,O,c,_]),handleDoubleClick:z,handleContextMenu:Y,hasPendingSelection:P,scrollEventToCenter:j}})({event:e,timingEvent:te,viewType:s,isAllDay:n,isMultiDay:d,segment:c,multiDaySegmentInfo:$,calendarRef:r,firstHour:b,hourHeight:w,isMobile:Y,canOpenDetail:Ce,useEventDetailPanel:L,detailPanelKey:me,app:j,onEventSelect:O,onDetailPanelToggle:H,setIsSelected:Me,setDetailPanelPosition:_e,setContextMenuPosition:ae,setActiveDayIndex:Le,getClickedDayIdx:je,updatePanelPosition:ze,selectedEventElementRef:se}),qe=(void 0===E?Se:E===e.id)||Ve||!Q&&Ne||o,Ge=Q&&qe&&Ee,{calculateEventStyle:Ke}=(({event:e,timingEvent:t,layout:n,isBeingDragged:a,isAllDay:r,allDayHeight:i,viewType:o,isMultiDay:l,segment:s,yearSegment:d,columnsPerRow:c,segmentIndex:u,hourHeight:h,firstHour:g,isEventSelected:m,showDetailPanel:v,isPopping:f,isDraggable:p,canOpenDetail:y,eventVisibility:D,calendarRef:w,isMobile:b,eventRef:E,getActiveDayIdx:C,getDayMetricsWrapper:T,multiDaySegmentInfo:S})=>{const M=o===x.DAY,N=o===x.MONTH,I=o===x.YEAR,k=null!=t?t:e;return{calculateEventStyle:()=>{var e,t,o,x,O,R,H,P,A,L,$;if(I&&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:m||v?1e3:1,transform:f?"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)",bi].join(", "):bi,willChange:a?"left, top, width, transform":"transform",cursor:p||y?"pointer":"default"}}if(N)return l&&s?{opacity:1,zIndex:m||v?1e3:1,cursor:p||y?"pointer":"default"}:{opacity:1,zIndex:m||v?1e3:1,transform:f?"scale(1.05)":"scale(1)",transition:bi,cursor:p||y?"pointer":"default"};if(r){const e={height:i-4+"px",opacity:1,zIndex:m||v?1e3:1,transform:f?"scale(1.05)":"scale(1)",transition:bi,cursor:p||y?"pointer":"default"},t=u*i;if(Object.assign(e,{top:`${t}px`}),M)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,i=s.isFirstSegment?r:0,o=i+(s.isLastSegment?r:0);Object.assign(e,{width:o>0?`calc(${n}% - ${o}px)`:`${n}%`,left:i>0?`calc(${a}% + ${i}px)`:`${a}%`,position:"absolute",pointerEvents:"auto"})}else Object.assign(e,{width:"100%",left:"0px",position:"relative"});return e}const j=S?S.startHour:K(k.start),Y=S?S.endHour:Ze(k),F=(j-g)*h,Z=Math.max((Y-j)*h,h/4),_={top:`${F+3}px`,height:Z-4+"px",position:"absolute",opacity:1,zIndex:m||v?1e3:null!==(e=null==n?void 0:n.zIndex)&&void 0!==e?e:1,transform:f?"scale(1.05)":"scale(1)",transition:bi,cursor:p||y?"pointer":"default"};if(m&&v&&("sticky-left"===D||"sticky-right"===D)){const e=ni(w),n=null==e?void 0:e.getBoundingClientRect();if(n){const e=ti(w,b),a=n.left+e,r=n.right,i=null===(o=null===(t=E.current)||void 0===t?void 0:t.parentElement)||void 0===o?void 0:o.getBoundingClientRect(),l=(null!==(x=null==i?void 0:i.top)&&void 0!==x?x:n.top)+(j-g)*h+3,s=Math.max(l,n.top),d=Math.min(l+Z-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(m&&v&&("sticky-top"===D||"sticky-bottom"===D)){const e=null===(O=w.current)||void 0===O?void 0:O.getBoundingClientRect();if(e){const t=C(),a=ti(w,b),r=M?1:c||7;let i=(e.width-a)/r,o=e.left+a+(M?0:t*i);N&&(i=e.width/7,o=e.left+t*i);const l=T(t);l&&(o=l.left,i=l.width);let s=ni(w);s||(s=null!==(H=null===(R=w.current)||void 0===R?void 0:R.querySelector(".df-calendar-renderer"))&&void 0!==H?H:null);const d=null==s?void 0:s.getBoundingClientRect(),u=null===(A=null===(P=E.current)||void 0===P?void 0:P.parentElement)||void 0===A?void 0:A.getBoundingClientRect();let h,g;if(u&&u.width>0)n?(h=u.left+n.left/100*u.width,g=M?n.width/100*u.width:(n.width-1)/100*u.width):(h=u.left,g=M?u.width:u.width-3);else{const e=T(t),a=null!==(L=null==e?void 0:e.left)&&void 0!==L?L:o,r=null!==($=null==e?void 0:e.width)&&void 0!==$?$:i;h=a,g=r-3,n&&(h=a+n.left/100*r,g=M?n.width/100*r:(n.width-1)/100*r)}const m=e.left+a;if(h<m&&(g=Math.max(0,g-(m-h)),h=m),h+g>e.right&&(g=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:`${g}px`,height:"6px",zIndex:1e3,overflow:"hidden",borderRadius:"0.25rem"}}let v=d?d.bottom:e.bottom;return v=Math.min(v,window.innerHeight),v=Math.min(v,e.bottom),v=Math.max(v,e.top+6),v=Math.max(v,6),{position:"fixed",top:v-6+"px",left:`${h}px`,width:`${g}px`,height:"6px",zIndex:1e3,overflow:"hidden",borderRadius:"0.25rem"}}}if(n&&!r){const e=M?`${n.width}%`:n.width-1+"%";return Object.assign(Object.assign({},_),{left:`${n.left}%`,width:e,right:"auto"})}return Object.assign(Object.assign({},_),{left:"0px",right:M?"0px":"3px"})}}})({event:e,timingEvent:te,layout:t,isBeingDragged:o,isAllDay:n,allDayHeight:a,viewType:s,isMultiDay:d,segment:c,yearSegment:u,columnsPerRow:h,segmentIndex:y,hourHeight:w,firstHour:b,isEventSelected:qe,showDetailPanel:ve,isPopping:re,isDraggable:Te,canOpenDetail:Ce,eventVisibility:Pe,calendarRef:r,isMobile:Y,eventRef:oe,getActiveDayIdx:$e,getDayMetricsWrapper:Ye,multiDaySegmentInfo:$});(({event:e,timingEvent:t,isEventSelected:n,showDetailPanel:a,eventRef:r,calendarRef:i,isAllDay:o,viewType:l,isMobile:s=!1,multiDaySegmentInfo:d,firstHour:c,hourHeight:u,updatePanelPosition:h,eventVisibility:g,setEventVisibility:v})=>{const p=l===x.MONTH,y=l===x.YEAR,D=l===x.RESOURCE,w=null!=t?t:e,b=f(()=>{var e,t;if(!n||!a||!r.current||!i.current||o||p||y)return;const l=ni(i);if(!l)return;const m=d?d.startHour:K(w.start),f=d?d.endHour:Ze(w),b=(m-c)*u,E=b+Math.max((f-m)*u,u/4),C=l.getBoundingClientRect(),T=l.scrollTop,S=T+C.height,M=C.bottom<0,N=C.top>window.innerHeight;let I=g;if(M)I="sticky-top";else if(N)I="sticky-bottom";else{const n="sticky-left"===g||"sticky-right"===g?"standard":g;let a;if(a="standard"===n?E<T?"sticky-top":b>S-20?"sticky-bottom":"standard":"sticky-top"===n?E>=T?"standard":"sticky-top":b<=S-20?"standard":"sticky-bottom","standard"!==a)I=a;else if(D){const n=null===(t=null===(e=r.current)||void 0===e?void 0:e.parentElement)||void 0===t?void 0:t.getBoundingClientRect();if(n){const e=ti(i,s),t=C.left+e,a=C.right;I=n.right<=t?"sticky-left":n.left>=a?"sticky-right":"standard"}else I="standard"}else I="standard"}I===g?h():(v(I),setTimeout(h,0))},[n,a,i,o,p,D,s,w.start,w.end,c,u,h,d,g,v]);m(()=>{var e;if(!n||!a||o)return;const t=ni(i);if(!t)return;const r=()=>b(),l=()=>{b(),h()},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",l);let c=null;return i.current&&(c=new ResizeObserver(()=>{l()}),c.observe(i.current)),b(),()=>{s.forEach(e=>{e.removeEventListener("scroll",r)}),window.removeEventListener("scroll",r,!0),window.removeEventListener("resize",l),c&&c.disconnect()}},[n,a,o,b,h,i])})({event:e,timingEvent:te,isEventSelected:qe,showDetailPanel:ve,eventRef:oe,calendarRef:r,isAllDay:n,viewType:s,isMobile:Y,multiDaySegmentInfo:$,firstHour:b,hourHeight:w,updatePanelPosition:ze,eventVisibility:Pe,setEventVisibility:Ae});const Xe=ve&&!!A;(({eventRef:e,detailPanelRef:t,eventId:n,isEventSelected:a,showDetailPanel:r,onEventSelect:i,onDetailPanelToggle:o,setIsSelected:l,setActiveDayIndex:s})=>{m(()=>{if(!a&&!r)return;const d=d=>{var c,u;const h=d.target,g=null===(c=e.current)||void 0===c?void 0:c.contains(h),m=null!==h.closest(`[data-event-id="${n}"]`),v=null===(u=t.current)||void 0===u?void 0:u.contains(h),f=h.closest("[data-event-detail-dialog]"),p=h.closest("[data-range-picker-popup]"),y=h.closest("[data-calendar-picker-dropdown]");r?g||m||v||f||p||y||(null==i||i(null),s(null),l(!1),null==o||o(null)):!a||g||m||f||p||y||(null==i||i(null),s(null),l(!1),null==o||o(null))};return document.addEventListener("mousedown",d),()=>{document.removeEventListener("mousedown",d)}},[a,r,i,o,n])})({eventRef:oe,detailPanelRef:le,eventId:e.id,isEventSelected:!Xe&&qe,showDetailPanel:we,onEventSelect:O,onDetailPanelToggle:H,setIsSelected:Me,setActiveDayIndex:Le});const Je=f(()=>{O&&O(null),he.current=null,Me(!1),null==H||H(null)},[O,H,Me]),Qe=p(()=>({event:e,viewType:s,isAllDay:n,isMobile:Y,isSelected:qe,isDragging:o,segment:c,layout:t}),[e,s,n,Y,qe,o,c,t]),et=f(e=>zt(za,{store:J,generatorName:"eventDetailContent",generatorArgs:e}),[J]);m(()=>{if((null==j?void 0:j.state.highlightedEventId)===e.id){ie(!0);const e=setTimeout(()=>{ie(!1)},650);return()=>{clearTimeout(e),ie(!1)}}},[null==j?void 0:j.state.highlightedEventId,e.id]),m(()=>{Ee||ae(null)},[Ee]),m(()=>{const t=d&&(null==c?void 0:c.isFirstSegment)||ee&&(null==u?void 0:u.isFirstSegment)||!d&&!ee;I===e.id&&!ve&&t&&!1!==L&&setTimeout(()=>{null==H||H(me),null==k||k()},50)},[I,e.id,ve,d,c,ee,u,H,k,me]);const tt=ge(e),nt=null==j?void 0:j.getCalendarRegistry(),at=e.calendarIds&&e.calendarIds.length>1?pe(e,nt):null,rt=((e,t,n,a)=>e===x.YEAR?(e=>e?e.isFirstSegment&&e.isLastSegment?"full":e.isFirstSegment?"start":e.isLastSegment?"end":"middle":"full")(a):t?ri(n):"full")(s,n,c,u);return zt(i,{children:[zt("div",{ref:oe,"data-event-id":e.id,"data-view":s,"data-all-day":String(n),"data-selected":String(qe),"data-dragging":String(o),"data-resizing":String(l),"data-popping":String(re),"data-multi-day":String(d),"data-editable":String(Ee),"data-draggable":String(Te),"data-viewable":String(Ce),"data-segment-shape":rt,"data-month-stack":String(s===x.MONTH&&!d),"data-touch-handles":String(Ge),className:`${ai(s,n,d)} ${n&&I===e.id?"df-all-day-event-animate":""} ${null!=W?W:""}`,style:Object.assign(Object.assign(Object.assign({},B?{}:Ke()),qe?{background:ue(tt,nt),color:"#fff"}:e.calendarIds&&e.calendarIds.length>1?{background:ye(at),color:ce(tt,nt)}:{backgroundColor:de(tt,nt),color:ce(tt,nt)}),U),onClick:e=>{if(Q&&He())return e.preventDefault(),void e.stopPropagation();Ue(e)},onContextMenu:Be,onDblClick:We,onMouseDown:t=>{var n;if(Q||ke(!0),T&&Te){T(t,$?Object.assign(Object.assign({},e),{day:null!==(n=$.dayIndex)&&void 0!==n?n:e.day,_segmentInfo:$}):d&&c?Object.assign(Object.assign({},e),{day:c.startDayIndex,_segmentInfo:{dayIndex:c.startDayIndex,isFirst:c.isFirstSegment,isLast:c.isLastSegment}}):e)}},onMouseUp:()=>!Q&&ke(!1),onMouseLeave:()=>!Q&&ke(!1),onTouchStart:xe,onTouchMove:Oe,onTouchEnd:Re,children:zt(pi,{event:te,viewType:s,isAllDay:n,isMultiDay:d,segment:c,yearSegment:u,segmentIndex:y,isBeingDragged:o,isBeingResized:l,isEventSelected:qe,isPopping:re,isEditable:Ee,isDraggable:Te,canOpenDetail:Ce,isTouchEnabled:Q,hideTime:_,isMobile:Y,isSlidingView:F,app:j,onMoveStart:T,onResizeStart:S,multiDaySegmentInfo:$,customRenderingStore:J,eventContentSlotArgs:Qe,timeFormat:z,appTimeZone:G,renderVisualContent:V,resizeHandleOrientation:q})}),ve&&!A&&fe&&zt("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:9998,pointerEvents:"none"}}),zt(wi,{showDetailPanel:ve&&fe,customEventDetailDialog:A,detailPanelPosition:Fe,event:e,detailPanelRef:le,isAllDay:n,eventVisibility:Pe,calendarRef:r,selectedEventElementRef:se,onEventUpdate:M,onEventDelete:N,handlePanelClose:Je,customRenderingStore:J,contentSlotRenderer:et,customDetailPanelContent:P,app:j}),ne&&j&&Ee&&zt(ei,{event:e,x:ne.x,y:ne.y,onClose:()=>ae(null),app:j,onDetailPanelToggle:H,detailPanelKey:me})]})},Ci=({handlePreviousMonth:e,handleToday:t,handleNextMonth:n})=>{const{t:a}=An();return zt("div",{className:"df-navigation",children:[zt("button",{type:"button",className:Qn,onClick:e,"aria-label":"Previous month",children:zt(ca,{})}),zt("button",{type:"button",className:"df-today-button df-calendar-today-button",onClick:t,children:a("today")}),zt("button",{type:"button",className:Qn,onClick:n,"aria-label":"Next month",children:zt(ua,{})})]})},Ti=({viewType:e,currentDate:t,onPrevious:n,onNext:a,onToday:r,customTitle:i,customSubtitle:o,subtitleMeta:l,showTodayBox:s,stickyYear:d,stickyYearOffset:c=0,nextYear:u,nextYearOffset:h=0})=>{const{locale:g}=An(),m=void 0===s||s,v=i||(()=>{switch(e){case"day":return t.toLocaleDateString(g,{day:"numeric",month:"long",year:"numeric"});case"week":case"month":return t.toLocaleDateString(g,{month:"long",year:"numeric"});case"year":return t.getFullYear().toString();default:return""}})(),f="day"===e?o||("day"===e?t.toLocaleDateString(g,{weekday:"long"}):null):null;return zt("div",{className:"df-view-header-container",onContextMenu:e=>e.preventDefault(),children:[zt("div",{className:"df-view-header-title-area",children:zt("div","year"===e&&d?{className:"df-view-header-year-stack",children:[zt("h1",{className:`${$n} df-view-header-year-title`,style:{transform:`translateY(-${c}px)`},children:d}),u&&zt("h1",{className:`${$n} df-view-header-year-title`,style:{transform:`translateY(${h}px)`},children:u})]}:{children:[zt("div",{className:$n,children:v}),f&&zt("div",{className:"df-view-header-subtitle",children:f}),l&&zt("div",{className:"df-view-header-subtitle-row",children:l&&zt("div",{className:"df-view-header-subtitle-meta",children:l})})]})}),m&&n&&a&&r&&zt("div",{className:"df-view-header-nav",children:zt(Ci,{handlePreviousMonth:n,handleNextMonth:a,handleToday:r})})]})};function Si(e,t,n,a,r){if(a||0!==e.button)return;let i=!0;const o={move(a){i&&Math.hypot(a.clientX-e.clientX,a.clientY-e.clientY)>=5&&(i=!1,document.removeEventListener("mousemove",o.move),document.removeEventListener("mouseup",o.up),null==r||r(e,t,n),document.dispatchEvent(new MouseEvent("mousemove",{clientX:a.clientX,clientY:a.clientY,bubbles:!0,cancelable:!1})))},up(){i=!1,document.removeEventListener("mousemove",o.move),document.removeEventListener("mouseup",o.up)}};document.addEventListener("mousemove",o.move),document.addEventListener("mouseup",o.up)}function Mi(){document.dispatchEvent(new MouseEvent("mouseup",{bubbles:!0,cancelable:!1}))}const Ni=({app:e,currentDate:t,currentWeekStart:n,events:a,currentDayEvents:r,organizedAllDayEvents:o,allDayAreaHeight:l,timeSlots:s,eventLayouts:d,isToday:c,currentTime:u,selectedEventId:h,setSelectedEventId:f,newlyCreatedEventId:y,setNewlyCreatedEventId:D,detailPanelEventId:w,setDetailPanelEventId:b,dragState:E,isDragging:C,handleMoveStart:T,handleResizeStart:S,handleCreateStart:M,handleCreateAllDayEvent:N,handleTouchStart:I,handleTouchEnd:k,handleTouchMove:O,handleDragOver:R,handleDrop:H,handleEventUpdate:P,handleEventDelete:A,onDateChange:L,customDetailPanelContent:$,customEventDetailDialog:j,useEventDetailPanel:Y,calendarRef:F,allDayRowRef:Z,timeGridRef:_,switcherMode:z,isMobile:U,isTouch:W,setDraftEvent:B,setIsDrawerOpen:V,ALL_DAY_HEIGHT:q,HOUR_HEIGHT:G,FIRST_HOUR:K,LAST_HOUR:X,showAllDay:J,showStartOfDayLabel:Q,timeFormat:ee="24h",secondaryTimeSlots:te,primaryTzLabel:ne,secondaryTzLabel:ae,appTimeZone:re})=>{var ie;const oe=!!te&&te.length>0&&!U,{t:le}=An(),se=v(e.state.highlightedEventId),[de,ce]=g(null),ue=p(()=>Gt(),[]),he=p(()=>oe&&ae&&ne?zt(i,{children:[zt("span",{className:"df-time-column-tz-label",children:ae}),zt("span",{className:"df-time-column-tz-label",children:ne})]}):null,[oe,ae,ne]),ge=()=>{var e;const t=null===(e=F.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},me=e=>{var t;const n=null===(t=F.current)||void 0===t?void 0:t.querySelector(".df-calendar-content");if(!n)return null;const a=n.getBoundingClientRect(),r=n.scrollTop||0;return K+(e-a.top+r-ge())/G},ve=e.canMutateFromUI();m(()=>{ve||ce(null)},[ve]);const fe=(e,n)=>{var a,r,i,o;if(e.preventDefault(),U||!ve)return;const l=new Date(t);if(n)l.setHours(0,0,0,0);else{const t=null===(r=null===(a=F.current)||void 0===a?void 0:a.querySelector(".df-calendar-content"))||void 0===r?void 0:r.getBoundingClientRect();if(t){const n=(null===(o=null===(i=F.current)||void 0===i?void 0:i.querySelector(".df-calendar-content"))||void 0===o?void 0:o.scrollTop)||0,a=ge(),r=(e.clientY-t.top+n-a)/G+K,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)}}ce({x:e.clientX,y:e.clientY,date:l})};return zt("div",{className:"df-day-content","data-switcher-mode":z,onContextMenu:e=>e.preventDefault(),children:[zt("div",{className:"df-day-content-layout",children:[zt("div",{className:"df-day-content-header-wrap",onContextMenu:e=>e.preventDefault(),style:{paddingRight:U||!ue?"0px":"15px"},children:zt(Ti,{calendar:e,viewType:x.DAY,currentDate:t,subtitleMeta:he})}),zt("div",J?{className:da(Bn,"df-day-content-all-day-row"),ref:Z,"data-scrollbar-space":!U&&ue?"true":"false",style:{paddingRight:U||!ue?"0px":"0.6875rem"},onContextMenu:e=>fe(e,!0),children:[zt("div",{className:da(Vn,"df-day-content-all-day-label"),onContextMenu:e=>e.preventDefault(),children:le("allDay")}),zt("div",{className:"df-day-content-all-day-grid","data-scrollbar-space":!U&&ue?"true":"false",children:zt("div",{className:"df-day-content-all-day-lane",style:{minHeight:`${l}px`},onClick:()=>null==L?void 0:L(t),onMouseDown:e=>{const a=Math.floor((t.getTime()-n.getTime())/864e5);null==N||N(e,a)},onDblClick:e=>{const a=Math.floor((t.getTime()-n.getTime())/864e5);null==N||N(e,a)},onDragOver:R,onDrop:e=>{H(e,t,void 0,!0)},children:o.map(t=>zt(Ei,{event:t,isAllDay:!0,viewType:x.DAY,segmentIndex:t.row,allDayHeight:q,calendarRef:F,isBeingDragged:C&&(null==E?void 0:E.eventId)===t.id&&"move"===(null==E?void 0:E.mode),hourHeight:G,firstHour:K,onMoveStart:T,onEventUpdate:P,onEventDelete:A,newlyCreatedEventId:y,onDetailPanelOpen:()=>D(null),detailPanelEventId:w,onDetailPanelToggle:e=>b(e),selectedEventId:h,onEventSelect:t=>{const n=e.getReadOnlyConfig().viewable,r=e.canMutateFromUI(),i=a.find(e=>e.id===t);(U||W)&&i&&n&&r?(B(i),V(!0)):(f(t),e.state.highlightedEventId&&(e.highlightEvent(null),se.current=null))},onEventLongPress:e=>{(U||W)&&f(e)},customDetailPanelContent:$,customEventDetailDialog:j,useEventDetailPanel:Y,app:e,isMobile:U,enableTouch:W,appTimeZone:re},t.id))})})]}:{className:"df-day-content-all-day-spacer","data-scrollbar-space":!U&&ue?"true":"false"}),zt("div",{className:da("df-calendar-content","df-day-content-grid"),style:{scrollbarGutter:"stable"},children:zt("div",{className:"df-day-content-grid-inner",children:[c&&u&&(()=>{const e=u,t=e.getHours()+e.getMinutes()/60;return t<K||t>X?null:zt("div",{className:Un,"data-secondary-tz":oe?"true":"false",style:{top:(t-K)*G+"px",height:0,zIndex:20,marginTop:"0.75rem"},children:[zt("div",{className:"df-day-content-current-time-side",children:[zt("div",{className:"df-day-content-current-time-side-inner"}),zt("div",{className:Wn,children:Fe(t,0,ee,!1)})]}),zt("div",{className:"df-day-content-current-time-rail",children:zt("div",{className:"df-current-time-bar"})})]})})(),zt("div",{className:"df-time-column","data-secondary-tz":oe?"true":"false",onContextMenu:e=>e.preventDefault(),children:[zt("div",{className:"df-time-column-spacer df-time-day-column-spacer","data-secondary-tz":oe?"true":"false"}),s.map((e,t)=>{var n;return zt("div",{className:Zn,children:zt("div",oe?{className:"df-time-column-tz-row",children:[zt("span",{className:"df-time-column-tz-value",children:Q&&0===t?"":null!==(n=null==te?void 0:te[t])&&void 0!==n?n:""}),zt("span",{className:"df-time-column-tz-value",children:Q&&0===t?"":e.label})]}:{className:_n,children:Q&&0===t?"":e.label})},t)})]}),zt("div",{className:"df-day-content-grid-column",children:[zt("div",{className:da(na,"df-time-grid-boundary-top","df-day-content-grid-boundary"),"data-scrollbar-space":!U&&ue?"true":"false",children:zt("div",{className:da(aa,"df-midnight-label-offset"),style:{top:"auto",bottom:"-0.625rem"},children:Q?Fe(K,0,ee):""})}),zt("div",{className:"df-day-content-grid-rows",style:{WebkitTouchCallout:"none"},ref:_,"data-scrollbar-space":!U&&ue?"true":"false",children:[s.map((e,a)=>zt("div",{className:zn,"data-scrollbar-space":!U&&ue?"true":"false",onClick:()=>null==L?void 0:L(t),onMouseDown:e=>{const a=me(e.clientY);null!==a&&Si(e,Math.floor((t.getTime()-n.getTime())/864e5),a,W,M)},onDblClick:e=>{const a=me(e.clientY);if(null===a)return;const r=Math.floor((t.getTime()-n.getTime())/864e5);null==M||M(e,r,a),Mi()},onTouchStart:e=>{const a=Math.floor((t.getTime()-n.getTime())/864e5);I(e,a)},onTouchEnd:k,onTouchMove:O,onDragOver:R,onDrop:e=>{var n,a,r,i;const o=null===(a=null===(n=F.current)||void 0===n?void 0:n.querySelector(".df-calendar-content"))||void 0===a?void 0:a.getBoundingClientRect();if(!o)return;const l=(null===(i=null===(r=F.current)||void 0===r?void 0:r.querySelector(".df-calendar-content"))||void 0===i?void 0:i.scrollTop)||0,s=ge(),d=e.clientY-o.top+l-s,c=Math.floor(K+d/G);H(e,t,c)},onContextMenu:e=>fe(e,!1)},a)),zt("div",{className:da(na,"df-day-content-grid-boundary-bottom"),"data-scrollbar-space":!U&&ue?"true":"false",children:zt("div",oe?{className:"df-time-column-tz-row df-day-content-bottom-tz-row",style:{left:U?"-5rem":"-5.5rem",width:U?"5rem":"5.5rem"},children:[zt("span",{children:null!==(ie=null==te?void 0:te[0])&&void 0!==ie?ie:""}),zt("span",{children:Fe(0,0,ee)})]}:{className:da(aa,"df-midnight-label-offset"),children:Fe(0,0,ee)})}),zt("div",{className:"df-day-content-event-layer",children:r.filter(e=>!e.allDay).map(t=>{const n=d.get(t.id);return zt(Ei,{event:t,layout:n,viewType:x.DAY,calendarRef:F,isBeingDragged:C&&(null==E?void 0:E.eventId)===t.id&&"move"===(null==E?void 0:E.mode),hourHeight:G,firstHour:K,onMoveStart:T,onResizeStart:S,onEventUpdate:P,onEventDelete:A,newlyCreatedEventId:y,onDetailPanelOpen:()=>D(null),detailPanelEventId:w,onDetailPanelToggle:e=>b(e),selectedEventId:h,onEventSelect:t=>{const n=e.getReadOnlyConfig().viewable,r=a.find(e=>e.id===t);(U||W)&&r&&n?(B(r),V(!0)):(f(t),e.state.highlightedEventId&&(e.highlightEvent(null),se.current=null))},onEventLongPress:e=>{(U||W)&&f(e)},customDetailPanelContent:$,customEventDetailDialog:j,useEventDetailPanel:Y,app:e,isMobile:U,enableTouch:W,appTimeZone:re},t.id)})})]})]})]})})]}),ve&&de&&zt(Qr,{x:de.x,y:de.y,date:de.date,viewType:x.DAY,onClose:()=>ce(null),app:e,onCreateEvent:()=>{if(M){const e=Math.floor((t.getTime()-n.getTime())/864e5);if(0===de.date.getHours()&&0===de.date.getMinutes())null==N||N({clientX:de.x,clientY:de.y},e);else{const t=de.date.getHours()+de.date.getMinutes()/60,n={preventDefault:()=>{},stopPropagation:()=>{},clientX:de.x,clientY:de.y};M(n,e,t)}}}})]})},Ii=({app:e,currentDate:t,visibleMonth:n,currentDayEvents:a,selectedEvent:r,setSelectedEvent:i,handleMonthChange:o,handleDateSelect:l,switcherMode:s,timeFormat:d="24h",showEventDots:c=!0,appTimeZone:u,calendarRef:h})=>{const{t:g,locale:m}=An(),v=[...a].toSorted((e,t)=>e.allDay&&!t.allDay?-1:!e.allDay&&t.allDay?1:e.allDay||t.allDay?0:Ne(e.start,u).getTime()-Ne(t.start,u).getTime());return zt("div",{className:"df-right-panel","data-switcher-mode":s,onContextMenu:e=>e.preventDefault(),children:zt("div",{className:"df-right-panel-layout",children:[zt("div",{className:"df-mini-calendar",children:zt("div",{className:"df-right-panel-calendar-shell",children:[zt("div",{className:"df-right-panel-calendar-header",children:[zt("div",{className:"df-right-panel-header-spacer","aria-hidden":"true",children:" "}),zt(Ci,{handlePreviousMonth:()=>e.goToPrevious(),handleNextMonth:()=>e.goToNext(),handleToday:()=>e.goToToday()})]}),zt(Tr,{visibleMonth:n,currentDate:t,showHeader:!0,onMonthChange:o,onDateSelect:l,events:e.getEvents(),showEventDots:c,calendarRegistry:e.getCalendarRegistry(),timeZone:e.timeZone})]})}),zt("div",{className:"df-right-panel-events",children:zt("div",{className:"df-right-panel-events-inner",children:[zt("h3",{className:"df-right-panel-date-heading",children:t.toLocaleDateString(m,{weekday:"long",month:"long",day:"numeric"})}),0===v.length?zt("p",{className:"df-right-panel-empty",children:g("noEvents")}):zt("div",{className:"df-right-panel-list",children:v.map(t=>zt("div",{className:"df-right-panel-event-item",children:zt(Ei,{event:t,isAllDay:t.allDay,viewType:x.DAY,calendarRef:h,onEventUpdate:t=>e.updateEvent(t.id,t),onEventDelete:t=>e.deleteEvent(t),onEventSelect:t=>{if(!t)return void i(null);const n=e.getEvents().find(e=>e.id===t);i(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))})]})})]})})},ki={PARALLEL_THRESHOLD:.25,NESTED_THRESHOLD:.5,INDENT_STEP_PERCENT:2.5,MIN_WIDTH:25,MARGIN_BETWEEN:1,EDGE_MARGIN_PERCENT:.9};function xi(e){return Object.assign(Object.assign({},e),{parentId:void 0,children:[],_startHour:e.allDay?0:K(e.start),_endHour:e.allDay?0:Ze(e)})}function Oi(e){var t;return null!==(t=e._startHour)&&void 0!==t?t:K(e.start)}function Ri(e){var t;return null!==(t=e._endHour)&&void 0!==t?t:Ze(e)}function Hi(e){var t;return null!==(t=e._originalStartHour)&&void 0!==t?t:Oi(e)}function Pi(e){var t;return null!==(t=e._originalEndHour)&&void 0!==t?t:Ri(e)}function Ai(e,t){return e.day===t.day&&!e.allDay&&!t.allDay&&Oi(e)<Ri(t)&&Oi(t)<Ri(e)}function Li(e,t){const n=Ri(e)-Oi(e);if(n<1.25)return!1;const a=Oi(e)+.4*n,r=Oi(t)>=a,i=Ai(e,t);return r&&i}function $i(e,t,n=ki){if(!Ai(e,t))return!1;const a=Math.abs(Hi(e)-Hi(t));return a<=n.PARALLEL_THRESHOLD||a>n.PARALLEL_THRESHOLD&&a<n.NESTED_THRESHOLD||function(e,t){return!(!Ai(e,t)||!Li(e,t)&&!Li(t,e))}(e,t)}function ji(e,t){const n=Hi(e)<=Hi(t)&&Pi(e)>=Pi(t),a=Hi(e)<=Hi(t)&&Hi(t)<Pi(e)&&Ai(e,t);return n||a}function Yi(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)n.has(t.id)||Math.abs(Hi(a)-Hi(t))<=ki.PARALLEL_THRESHOLD&&(r.push(t),n.add(t.id));r.sort((e,t)=>Hi(e)-Hi(t));const i={events:r,startHour:Math.min(...r.map(e=>Oi(e))),endHour:Math.max(...r.map(e=>Ri(e))),originalStartHour:Math.min(...r.map(e=>Hi(e))),originalEndHour:Math.max(...r.map(e=>Pi(e)))};t.push(i)}return t.sort((e,t)=>{var n,a;return(null!==(n=e.originalStartHour)&&void 0!==n?n:e.startHour)-(null!==(a=t.originalStartHour)&&void 0!==a?a:t.startHour)}),t}function Fi(e){return"day"===e?.5:2.5}function Zi(e){const t=Ri(e)-Oi(e);return Math.max(.1,Math.min(1,t/4))}function _i(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($i(e[t],e[n],ki))return!0;return!1}function zi(e,t,n,a,r={}){const i=Fi(r.viewType);let o=e.depth*i;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*Fi(t):null}(e,r.viewType);null!==t&&(o=t)}r.viewType;const l=t+o;let s=n-o;if(l+s>t+n&&(s=t+n-l),a.set(e.event.id,{id:e.event.id,left:l,width:s,zIndex:e.depth,level:e.depth,isPrimary:0===e.depth,indentOffset:o*(r.containerWidth||320)/100,importance:Zi(e.event)}),0===e.children.length)return;const d=[...e.children].toSorted((e,t)=>Ri(t.event)-Oi(t.event)-(Ri(e.event)-Oi(e.event)));1===d.length?zi(d[0],l,s,a,r):_i(d.map(e=>e.event))?Ui(d,l,s,a,r):d.forEach(e=>zi(e,l,s,a,r))}function Ui(e,t,n,a,r={}){const i=e.length,o=e[0].depth*Fi(r.viewType);r.viewType;const l=t+o,s=n-o;if(s<=0)return void e.forEach(e=>zi(e,t,n,a,r));let d=ki.MARGIN_BETWEEN;const c=(s-d*(i-1))/i;e.forEach((e,t)=>{const n=l+t*(c+d);if(a.set(e.event.id,{id:e.event.id,left:n,width:c,zIndex:e.depth,level:e.depth,isPrimary:0===e.depth,indentOffset:o*(r.containerWidth||320)/100,importance:Zi(e.event)}),e.children.length>0){const t=[...e.children].toSorted((e,t)=>Ri(t.event)-Oi(t.event)-(Ri(e.event)-Oi(e.event)));1===t.length?zi(t[0],n,c,a,r):_i(t.map(e=>e.event))?Ui(t,n,c,a,r):t.forEach(e=>zi(e,n,c,a,r))}})}function Wi(e,t,n={}){const a=100-("day"===n.viewType?0:ki.EDGE_MARGIN_PERCENT);if(1===e.length)zi(e[0],0,a,t,n);else if(e.length>1){const r=e.length,i=(a-ki.MARGIN_BETWEEN*(r-1))/r;e.forEach((e,a)=>{zi(e,a*(i+ki.MARGIN_BETWEEN),Math.max(i,ki.MIN_WIDTH),t,n)})}}function Bi(e){let t=0;for(const n of e.children)t+=1+Bi(n);return t}function Vi(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:Bi(e)})).toSorted((e,t)=>t.load-e.load)}function qi(e){return!(e.length<2)&&e[0].load-e.at(-1).load>=2}function Gi(e,t){t.parentId=e.id,e.children.includes(t.id)||e.children.push(t.id)}function Ki(e,t){e.parent&&(e.parent.children=e.parent.children.filter(t=>t!==e));const n=t.children.find(t=>ji(t.event,e.event));n?(e.parent=n,e.depth=n.depth+1,n.children.push(e),Gi(n.event,e.event)):(e.parent=t,e.depth=t.depth+1,t.children.push(e),Gi(t.event,e.event))}function Xi(e,t){0===e.children.length?t.push(e):e.children.forEach(e=>Xi(e,t))}function Ji(e,t){const n=[];return Xi(e,n),n.find(e=>ji(t.event,e.event))||n[0]||null}function Qi(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=Ji(n.node,a.node);if(!r)break;Ki(r,a.node),n.load--,a.load++,t++}}function eo(e,t){var n,a;const r=(null!==(n=t.originalStartHour)&&void 0!==n?n:t.startHour)-(null!==(a=e.originalStartHour)&&void 0!==a?a:e.startHour);if(function(e,t){for(const n of e.events)for(const e of t.events)if(Ai(n,e)&&Math.abs(Hi(e)-Hi(n))<ki.NESTED_THRESHOLD)return!0;return!1}(e,t))return!1;if(r<ki.NESTED_THRESHOLD)return!1;for(const n of e.events)for(const e of t.events)if(ji(n,e))return!0;return!1}function to(e,t,n){const a=t.events.filter(t=>ji(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&&$i(e,a,ki)})}));return r.sort((t,n)=>t.load!==n.load?t.load-n.load:t.hasParallelSibling!==n.hasParallelSibling?t.hasParallelSibling?-1:1:Math.abs(Hi(e)-Hi(t.parent))-Math.abs(Hi(e)-Hi(n.parent))),r[0].parent}function no(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 i=Pi(e)-Hi(e),o=r.flatMap(e=>e.children);return i>Math.max(...o.map(e=>{const t=n.find(t=>t.id===e);return t?Pi(t)-Hi(t):0}),0)?r[0]:r.at(-1)||null}function ao(e,t){t.parentId=e.id,e.children.includes(t.id)||e.children.push(t.id)}function ro(e){let t=0;for(const n of e.children)t+=1+ro(n);return t}function io(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 oo(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 i=r.children.filter(e=>1===e.depth&&e.event.id!==a.event.id);let o=1/0,l=null;for(const e of i){const t=ro(e);t<o&&(o=t,l=e)}return l?l.event:null}function lo(e,t,n){const a=[];if(1===e.length){const r=to(e[0],t,n);return r&&(a.push({child:e[0],parent:r}),ao(r,e[0])),a}const r=t.events.filter(t=>e.every(e=>ji(t,e)));if(0===r.length){for(const r of e){const i=to(r,t,n);if(i)a.push({child:r,parent:i}),ao(i,r);else{const t=e.find(e=>e.id!==r.id&&Ai(e,r));if(t){const e=oo(t,io(n));e&&(a.push({child:r,parent:e}),ao(e,r))}}}return a}const i=[...e].toSorted((e,t)=>Pi(t)-Hi(t)-(Pi(e)-Hi(e)));if(i.length%r.length===0){const e=i.length/r.length;for(let t=0;t<r.length;t++){const n=r[t],o=i.slice(t*e,(t+1)*e);for(const e of o)a.push({child:e,parent:n}),ao(n,e)}}else for(const e of i){const t=no(e,r,i);t&&(a.push({child:e,parent:t}),ao(t,e))}return a}function so(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 i=e[n],o=i.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(eo(d,{events:o,startHour:i.startHour,endHour:i.endHour})){const e=lo(o,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 i=n.filter(e=>null===e.parent);return i.forEach(e=>{e.depth=0}),function(e,t){for(let n=e.length-1;n>=1;n--){const a=Vi(e[n].events.map(e=>t.find(t=>t.event.id===e.id)),t);qi(a)&&Qi(a)}}(e,n),i}const co={calculateDayEventLayouts(e,t={}){const n=e.map(xi);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 i=function(e){const t=[],n=new Set;for(const a of e){if(n.has(a.id))continue;const r=[a],i=[a];for(n.add(a.id);i.length>0;){const t=i.shift();for(const a of e)n.has(a.id)||Ai(t,a)&&(r.push(a),i.push(a),n.add(a.id))}t.push(r)}return t}(r);for(const e of i)if(1===e.length){const n="day"===t.viewType?0:ki.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 Wi(so(Yi([...e].toSorted((e,t)=>{var n,a,r,i;const o=null!==(n=e._originalStartHour)&&void 0!==n?n:e._startHour,l=null!==(a=t._originalStartHour)&&void 0!==a?a:t._startHour;if(o!==l)return o-l;const s=(null!==(r=e._originalEndHour)&&void 0!==r?r:e._endHour)-o,d=(null!==(i=t._originalEndHour)&&void 0!==i?i:t._endHour)-l;return s!==d?d-s:e._startHour!==t._startHour?e._startHour-t._startHour:t._endHour-t._startHour-(e._endHour-e._startHour)})),e),a,t);return a}},uo=(e,t,n=7,a)=>{const r=new Map;for(let i=0;i<n;i++){const o=[];e.forEach(e=>{var r;if(e.allDay)return;const l=li(e,t,n,a);if(l.length>0){const n=l.find(e=>e.dayIndex===i);if(n){const a=n.endHour>=24?23.99:n.endHour,r=Object.assign(Object.assign({},e),{start:Oe(X(ct(t,i),n.startHour)),end:Oe(X(ct(t,i),a)),day:i,_originalStartHour:K(e.start),_originalEndHour:Ze(e)});o.push(r)}}else if(e.day===i){const t=e=>a?Ne(e,a):Me(e);o.push(Object.assign(Object.assign({},e),{start:Oe(t(e.start),a),end:Oe(t(null!==(r=e.end)&&void 0!==r?r:e.start),a),day:i,_originalStartHour:K(e.start),_originalEndHour:Ze(e)}))}});const l=co.calculateDayEventLayouts(o,{viewType:"week"});r.set(i,l)}return r},ho=(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},go={HOUR_HEIGHT:72,FIRST_HOUR:0,LAST_HOUR:24,ALL_DAY_HEIGHT:28};function mo(e){const{app:t,onEventCreated:a}=e,{t:r}=An(),i=f(e=>{e.dataTransfer&&e.dataTransfer.types.includes("application/x-dayflow-calendar")&&(e.preventDefault(),e.dataTransfer.dropEffect="copy")},[]);return{handleDrop:f((e,i,o,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=n.PlainDate.from({year:i.getFullYear(),month:i.getMonth()+1,day:i.getDate()});d=e,c=e,u=!0}else if(void 0===o){const e=new Date(i);e.setHours(9,0,0,0);const n=new Date(e);n.setHours(10,0,0,0),d=Oe(e,t.timeZone),c=Oe(n,t.timeZone)}else{const e=new Date(i);e.setHours(o,0,0,0);const n=new Date(e);n.setHours(o+1,0,0,0),d=Oe(e,t.timeZone),c=Oe(n,t.timeZone)}const h=t.getCalendarRegistry().get(e.calendarId);if((null==h?void 0:h.readOnly)||(null==h?void 0:h.subscription))return null;const g={id:`event-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,title:r(u?"newAllDayCalendarEvent":"newCalendarEvent",{calendarName:e.calendarName}),description:"",start:d,end:c,calendarId:e.calendarId,allDay:u};return t.addEvent(g),null==a||a(g),g}catch(e){return null}},[t,a]),handleDragOver:i}}let vo=null;function fo(e){vo=e}const po={handleMoveStart:()=>{},handleCreateStart:()=>{},handleResizeStart:void 0,handleCreateAllDayEvent:()=>{},dragState:{active:!1,mode:null,eventId:null,targetDate:null,startDate:null,endDate:null},isDragging:!1};function yo(e,t){return vo?vo(e,t):po}const Do=({app:e,config:t,customDetailPanelContent:n,customEventDetailDialog:a,useEventDetailPanel:r,calendarRef:i,switcherMode:o="buttons",selectedEventId:l,onEventSelect:s,onDateChange:d,detailPanelEventId:c,onDetailPanelToggle:u})=>{const h=e.getEvents(),{screenSize:D}=Hn(),w="desktop"!==D,[b,E]=g(!1),{hourHeight:C=go.HOUR_HEIGHT,firstHour:T=go.FIRST_HOUR,lastHour:S=go.LAST_HOUR,allDayHeight:M=go.ALL_DAY_HEIGHT,showAllDay:N=!0,timeFormat:I="24h",secondaryTimeZone:k,showEventDots:O=!0}=t,R=C,H=T,P=S,A=M,L=!N;m(()=>{E("ontouchstart"in window||navigator.maxTouchPoints>0)},[]);const $=e.getCustomMobileEventRenderer()||Nr,[j,Y]=g(null),[F,Z]=g(null),[_,z]=g(null),U=void 0===l?F:l,W=void 0===c?_:c,B=p(()=>U&&h.find(e=>e.id===U)||null,[U,h]),V=e=>{s?s(e):Z(e)},[q,G]=g(null),[X,J]=g(!1),[Q,ee]=g(null),te=v(null),ne=e.getCurrentDate(),[ae,re]=g(ne),ie=v(ne.getTime());ne.getTime()!==ie.current&&(ie.current=ne.getTime(),ne.getFullYear()===ae.getFullYear()&&ne.getMonth()===ae.getMonth()||re(ne));const oe=f(t=>{re(n=>{const a=new Date(n.getFullYear(),n.getMonth()+t,1);return e.setVisibleMonth(a),a})},[e]),le=v(e.state.highlightedEventId);m(()=>{var t;if(e.state.highlightedEventId!==le.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=K(n.start),a=null===(t=i.current)||void 0===t?void 0:t.querySelector(".df-calendar-content");if(a){const t=(e-H)*R;requestAnimationFrame(()=>{a.scrollTo({top:Math.max(0,t-100),behavior:"smooth"})})}}}else le.current&&U===le.current&&V(null);le.current=e.state.highlightedEventId},[e.state.highlightedEventId,H,R,i,e]);const se=v(null),de=v(null),ce=p(()=>ho(ne),[ne]),ue=e.timeZone,he=p(()=>((e,t,n,a)=>{const r=new Date(t);r.setHours(0,0,0,0);const i=new Date(t);i.setHours(23,59,59,999);const o=e=>a?Ne(e,a):Me(e);return e.filter(e=>{var t;const n=o(e.start),a=o(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<=i&&t>=r}return n<i&&a>r}).map(e=>{const t=o(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,ne,ce,ue),[h,ne,ce,ue]),ge=p(()=>((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 i=e=>n?Ne(e,n):Me(e);return e.filter(e=>!e.allDay).map(e=>{var t;const o=i(e.start),l=i(null!==(t=e.end)&&void 0!==t?t:e.start);let s=Oe(o,n),d=Oe(l,n);return o<a&&(s=Oe(a,n)),l>r&&(d=Oe(r,n)),Object.assign(Object.assign({},e),{start:s,end:d,day:0,_originalStartHour:K(e.start),_originalEndHour:Ze(e)})})})(he,ne,ue),[he,ne,ue]),me=p(()=>co.calculateDayEventLayouts(ge,{viewType:"day"}),[ge]),ve=p(()=>((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(xn(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=Me(e.start),a=Me(e.end),r=Me(t.start);return n<=Me(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})(he,e.state.allDaySortComparator),[he,e.state.allDaySortComparator]),fe=p(()=>0===ve.length?A:(Math.max(...ve.map(e=>e.row))+1)*A,[ve,A]),{handleMoveStart:pe,handleCreateStart:ye,handleResizeStart:De,handleCreateAllDayEvent:we,dragState:be,isDragging:Ee}=yo(e,{calendarRef:i,allDayRowRef:N?se:void 0,timeGridRef:de,viewType:x.DAY,onEventsUpdate:(t,n,a)=>{const r=t(he),i=new Set(r.map(e=>e.id)),o=he.filter(e=>!i.has(e.id)),l=new Set(he.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&&Tt(t,e)});e.applyEventsChanges({delete:o.map(e=>e.id),add:s,update:d.map(e=>({id:e.id,updates:e}))},void 0,a)},onEventCreate:t=>{w?(ee(t),J(!0)):(e.addEvent(t),G(t.id))},onEventEdit:()=>{},currentWeekStart:ce,events:he,calculateNewEventLayout:(e,t,n)=>((e,t,n,a,r,i)=>{const o=new Date(a),l=new Date(a);o.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:Oe(o,i),end:Oe(l,i),calendarId:"blue",allDay:!1}];return co.calculateDayEventLayouts(s,{viewType:"day"}).get("-1")||null})(0,t,n,ne,ge,ue),calculateDragLayout:(e,t,n,a)=>((e,t,n,a,r,i,o)=>{const l=i.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:Oe(d,o),end:Oe(c,o),day:0})];return 0===u.length?null:co.calculateDayEventLayouts(u,{viewType:"day"}).get(e.id)||null})(e,0,n,a,ne,ge,ue),TIME_COLUMN_WIDTH:k&&!w?88:w?48:80,isMobile:w}),{handleDrop:Ce,handleDragOver:Te}=mo({app:e,onEventCreated:e=>{G(e.id)}}),Se=Array.from({length:24},(e,t)=>({hour:t+H,label:Fe(t+H,0,I)})),Ie=p(()=>k?Ue(Se,k,I,ne,ue):void 0,[k,I,H,ne,ue]),ke=p(()=>k?We(ue,ne):void 0,[k,ue,ne]),xe=p(()=>k?We(k,ne):void 0,[k,ne]),Re=f(t=>{const n=new Date(t.getFullYear(),t.getMonth(),t.getDate());e.setCurrentDate(n),re(new Date(n.getFullYear(),n.getMonth(),1))},[e]),He=p(()=>{const e=Ve(ue);return ne.toDateString()===e.toDateString()},[ne,ue]);return y(()=>{var e;if(t.scrollToCurrentTime){const t=null===(e=i.current)||void 0===e?void 0:e.querySelector(".df-calendar-content");if(t){const e=Be(ue),n=e.getHours()+e.getMinutes()/60,a=t.clientHeight;t.scrollTop=Math.max(0,(n-H)*R-a/2)}}},[ue,t.scrollToCurrentTime,H,R]),m(()=>{Y(Be(ue));const e=setInterval(()=>Y(Be(ue)),6e4);return()=>clearInterval(e)},[ue]),zt("div",{className:"df-day-view",children:[zt(Ni,{app:e,currentDate:ne,currentWeekStart:ce,events:h,currentDayEvents:he,organizedAllDayEvents:ve,allDayAreaHeight:fe,timeSlots:Se,eventLayouts:me,isToday:He,currentTime:j,selectedEventId:U,setSelectedEventId:V,newlyCreatedEventId:q,setNewlyCreatedEventId:G,detailPanelEventId:W,setDetailPanelEventId:e=>{u?u(e):z(e)},dragState:be,isDragging:Ee,handleMoveStart:pe,handleResizeStart:De,handleCreateStart:ye,handleCreateAllDayEvent:we,handleTouchStart:(e,t)=>{if(!w&&!b)return;const n=e.touches[0],a=n.clientX,r=n.clientY,o=e.currentTarget;te.current=setTimeout(()=>{var e,n,l;const s=null===(n=null===(e=i.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=i.current)||void 0===l?void 0:l.querySelector(".df-calendar-content"),c=d?d.scrollTop:0,u=r-s.top+c;null==ye||ye({preventDefault:()=>{},stopPropagation:()=>{},touches:[{clientX:a,clientY:r}],changedTouches:[{clientX:a,clientY:r}],target:o,currentTarget:o,cancelable:!0},t,H+u/R)},500)},handleTouchEnd:()=>{te.current&&(clearTimeout(te.current),te.current=null)},handleTouchMove:()=>{te.current&&(clearTimeout(te.current),te.current=null)},handleDragOver:Te,handleDrop:Ce,handleEventUpdate:t=>e.updateEvent(t.id,t),handleEventDelete:t=>e.deleteEvent(t),onDateChange:d,customDetailPanelContent:n,customEventDetailDialog:a,useEventDetailPanel:r,calendarRef:i,allDayRowRef:se,timeGridRef:de,switcherMode:o,isMobile:w,isTouch:b,setDraftEvent:ee,setIsDrawerOpen:J,ALL_DAY_HEIGHT:A,HOUR_HEIGHT:R,FIRST_HOUR:H,LAST_HOUR:P,showAllDay:N,showStartOfDayLabel:L,timeFormat:I,secondaryTimeSlots:Ie,primaryTzLabel:ke,secondaryTzLabel:xe,appTimeZone:ue}),zt(Ii,{app:e,currentDate:ne,visibleMonth:ae,currentDayEvents:he,selectedEvent:B,setSelectedEvent:e=>V(e?e.id:null),handleMonthChange:oe,handleDateSelect:Re,switcherMode:o,timeFormat:I,showEventDots:O,appTimeZone:ue,calendarRef:i}),zt($,{isOpen:X,onClose:()=>{J(!1),ee(null)},onSave:t=>{h.some(e=>e.id===t.id)?e.updateEvent(t.id,t):e.addEvent(t),J(!1),ee(null)},draftEvent:Q,app:e,timeFormat:I})]})},wo=({originalComponent:e,app:t,viewType:n,config:a,customDetailPanelContent:r,customEventDetailDialog:i,useEventDetailPanel:o,calendarRef:l,switcherMode:s,meta:d,selectedEventId:c,detailPanelEventId:u,onEventSelect:h,onDateChange:g,onDetailPanelToggle:m})=>{const v=t.getPlugin("events"),y=t.getPlugin("drag"),D=t.getCurrentDate(),w=t.state.currentView,b=t.getEvents(),E=f(e=>v?v.update(e.id,e):t.updateEvent(e.id,e),[v,t]),C=f(e=>v?v.delete(e):t.deleteEvent(e),[v,t]),T=f(e=>{v?v.add(e):t.addEvent(e)},[v,t]),S=f(e=>{g?g(e):t.setCurrentDate(e)},[t,g]),M=f(e=>{t.changeView(e)},[t]),N=p(()=>{const e=t.getViewConfig(n);return Object.assign(Object.assign({},e),a)},[a,t.state.views,n]),I=p(()=>({app:t,currentDate:D,currentView:w,events:b,onEventUpdate:E,onEventDelete:C,onEventCreate:T,onDateChange:S,onViewChange:M,config:N,customDetailPanelContent:r,customEventDetailDialog:i,useEventDetailPanel:o,calendarRef:l,switcherMode:s,meta:d,selectedEventId:c,detailPanelEventId:u,onEventSelect:h,onDetailPanelToggle:m}),[t,D,w,b,E,C,T,S,M,N,r,i,o,l,s,d,c,u,h,m]),k=p(()=>{const e={currentDate:D,events:b,setEvents:e=>{b.forEach(e=>C(e.id)),e.forEach(e=>T(e))},updateEvent:E,deleteEvent:C,addEvent:T,goToPrevious:()=>{const e=new Date(D);switch(w){case x.DAY:e.setDate(e.getDate()-1);break;case x.WEEK:e.setDate(e.getDate()-7);break;case x.MONTH:e.setMonth(e.getMonth()-1)}S(e)},goToNext:()=>{const e=new Date(D);switch(w){case x.DAY:e.setDate(e.getDate()+1);break;case x.WEEK:e.setDate(e.getDate()+7);break;case x.MONTH:e.setMonth(e.getMonth()+1)}S(e)},goToToday:()=>{S(new Date)},changeView:M,selectDate:S};return Object.assign(Object.assign({calendar:e},I),{eventsService:v,dragService:y})},[D,b,w,E,C,T,S,M,I,v,y]);return zt(e,Object.assign({},k))},bo={},Eo=e=>o(wo,Object.assign(Object.assign({},e),{viewType:x.DAY,originalComponent:Do,className:"df-day-view-factory"}));Eo.displayName="DayViewAdapter";const Co=(e={})=>{const t=Object.assign(Object.assign({},bo),e);return{type:x.DAY,component:Eo,config:t}},To=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)},So=({app:e,fullWeekDates:t=[],mobilePageStart:n,onDateChange:a})=>zt("div",{className:"df-compact-header",children:[zt("div",{className:"df-compact-header-labels",children:t.map((e,t)=>zt("div",{className:"df-compact-header-label-cell",children:zt("span",{className:"df-compact-header-label","data-today":e.isToday?"true":"false",children:To(e.dayName)})},`label-${t}`))}),zt("div",{className:"df-compact-header-dates",children:(()=>{if(!n)return null;const r=t.findIndex(e=>e.fullDate.getTime()===n.getTime());return zt(i,{children:[zt("div",{className:"df-compact-header-capsule",style:{left:-1===r?"0":`calc(${(r+.5)/7*100}% - 16px)`,top:0,width:`calc(${1/7*100}% + 32px)`,height:"32px"}}),t.map((t,n)=>{const i=t.isCurrent,o=n>=r&&n<r+2;return zt("div",{className:"df-compact-header-date-button",style:{height:"32px"},onClick:()=>{e.setCurrentDate(t.fullDate),null==a||a(t.fullDate)},children:zt("div",{className:"df-compact-header-date-pill","data-selected":i?"true":"false","data-today":t.isToday?"true":"false","data-inside-pill":o?"true":"false",children:[t.date,t.isToday&&!i&&zt("div",{className:"df-compact-header-today-dot"})]})},`date-${n}`)})]})})()})]}),Mo=({app:e,weekDaysLabels:t,mobileWeekDaysLabels:n,weekDates:a,fullWeekDates:r,isSlidingView:o,mobilePageStart:l,currentWeekStart:s,gridWidth:d,allDayAreaHeight:c,organizedAllDaySegments:u,allDayLabelText:h,isMobile:v,isTouch:f,showAllDay:y=!0,calendarRef:D,allDayRowRef:w,topFrozenContentRef:b,ALL_DAY_HEIGHT:E,HOUR_HEIGHT:C,FIRST_HOUR:T,dragState:S,isDragging:M,primaryTzLabel:N,secondaryTzLabel:I,secondaryTimeSlots:k,handleMoveStart:O,handleResizeStart:R,handleEventUpdate:H,handleEventDelete:P,setDraftEvent:A,setIsDrawerOpen:L,onDateChange:$,newlyCreatedEventId:j,setNewlyCreatedEventId:Y,selectedEventId:F,setSelectedEventId:Z,detailPanelEventId:_,setDetailPanelEventId:z,handleCreateAllDayEvent:U,handleDragOver:W,handleDrop:B,customDetailPanelContent:V,customEventDetailDialog:q,useEventDetailPanel:G})=>{const K={flexShrink:0},[X,J]=g(null),Q=p(()=>Gt(),[]),ee=!!k&&k.length>0&&!v,te=e.canMutateFromUI();return m(()=>{te||J(null)},[te]),zt("div",{className:"df-week-all-day",children:[o&&r&&l&&zt(So,{app:e,fullWeekDates:r,mobilePageStart:l,onDateChange:$}),zt("div",{className:"df-week-all-day-shell","data-show-all-day":y?"true":"false",onContextMenu:e=>e.preventDefault(),children:[y&&zt("div",{className:"df-week-all-day-side",onContextMenu:e=>e.preventDefault(),children:[zt("div",{className:"df-week-all-day-side-spacer","data-sliding-view":o?"true":"false",children:ee&&zt("div",{className:"df-time-column-tz-header df-time-column-tz-header-compact",children:[zt("span",{className:"df-time-column-tz-label",children:I}),zt("span",{className:"df-time-column-tz-label",children:N})]})}),zt("div",{className:`${Vn} df-week-all-day-label`,style:{minHeight:`${c}px`},children:h})]}),zt("div",{className:"df-week-all-day-content-wrap",style:{scrollbarGutter:"stable",minHeight:y?`${c+(o?0:36)}px`:"auto"},children:zt("div",{ref:b,className:"df-week-all-day-content",style:{width:d,minWidth:"100%",transform:o?"translateX(calc(-100% / 3))":void 0},children:[!o&&zt("div",{className:"df-week-header","data-scrollbar-space":Q?"true":"false",style:{marginRight:Q?"-50px":"0px",paddingRight:Q?"50px":"0px"},children:t.map((e,t)=>zt("div",{className:"df-week-day-cell df-week-all-day-weekday-cell","data-mobile":v?"true":"false",style:K,children:zt(i,v?{children:[zt("div",{className:"df-week-all-day-weekday-label",children:n[t]}),zt("div",{className:`${Yn} df-week-all-day-date-number df-week-all-day-date-number-mobile`,"data-today":a[t].isToday?"true":void 0,children:a[t].date})]}:{children:[zt("div",{className:"df-week-all-day-weekday-name",children:e}),zt("div",{className:`${Yn} df-week-all-day-date-number`,"data-today":a[t].isToday?"true":void 0,children:a[t].date})]})},t))}),y&&zt("div",{className:`${Bn} df-week-all-day-row`,ref:w,style:{minHeight:`${c}px`},children:zt("div",{className:"df-all-day-content df-week-all-day-row-content","data-scrollbar-space":v||!Q?"false":"true",style:{minHeight:`${c}px`},children:[t.map((e,n)=>{const a=new Date(s);return a.setDate(s.getDate()+n),zt("div",{className:"df-all-day-cell df-week-all-day-cell "+(n!==t.length-1||!v&&Q?"":"df-week-all-day-cell-no-border"),style:Object.assign({minHeight:`${c}px`},K),onMouseDown:e=>null==U?void 0:U(e,n),onDblClick:e=>null==U?void 0:U(e,n),onDragOver:W,onDrop:e=>{B(e,a,void 0,!0)},onContextMenu:e=>((e,t)=>{if(e.preventDefault(),v||!te)return;const n=new Date(s);n.setDate(s.getDate()+t),n.setHours(0,0,0,0),J({x:e.clientX,y:e.clientY,date:n})})(e,n)},`allday-${n}`)}),zt("div",{className:"df-week-all-day-event-layer",children:u.map(n=>zt(Ei,{event:n.event,segment:n,segmentIndex:n.row,isAllDay:!0,isMultiDay:!0,allDayHeight:E,calendarRef:D,viewType:x.WEEK,columnsPerRow:t.length,isBeingDragged:M&&(null==S?void 0:S.eventId)===n.event.id&&"move"===(null==S?void 0:S.mode),hourHeight:C,firstHour:T,onMoveStart:O,onResizeStart:R,onEventUpdate:H,onEventDelete:P,newlyCreatedEventId:j,onDetailPanelOpen:()=>Y(null),selectedEventId:F,detailPanelEventId:_,onEventSelect:t=>{var n;const a=!1!==e.getReadOnlyConfig(null!=t?t:void 0).viewable,r=null===(n=u.find(e=>e.event.id===t))||void 0===n?void 0:n.event;if((v||f)&&r&&a)return A(r),void L(!0);Z(t)},onEventLongPress:e=>{(v||f)&&Z(e)},onDetailPanelToggle:e=>z(e),customDetailPanelContent:V,customEventDetailDialog:q,useEventDetailPanel:G,app:e,isMobile:v,isSlidingView:o,enableTouch:f},n.event.id))})]})})]})}),te&&X&&zt(Qr,{x:X.x,y:X.y,date:X.date,viewType:x.WEEK,onClose:()=>J(null),app:e,onCreateEvent:()=>{const e=Math.floor((X.date.getTime()-s.getTime())/864e5);null==U||U({clientX:X.x,clientY:X.y},e)}})]})]})},No=({app:e,timeSlots:t,weekDaysLabels:n,currentWeekStart:a,currentWeekEvents:r,eventLayouts:o,gridWidth:l,isMobile:s,isTouch:d,scrollerRef:c,timeGridRef:u,leftFrozenContentRef:h,swipeContentRef:f,calendarRef:y,handleScroll:D,handleCreateStart:w,handleTouchStart:b,handleTouchEnd:E,handleTouchMove:C,handleDragOver:T,handleDrop:S,dragState:M,isDragging:N,handleMoveStart:I,handleResizeStart:k,handleEventUpdate:O,handleEventDelete:R,setDraftEvent:H,setIsDrawerOpen:P,onDateChange:A,newlyCreatedEventId:L,setNewlyCreatedEventId:$,selectedEventId:j,setSelectedEventId:Y,detailPanelEventId:F,setDetailPanelEventId:Z,customDetailPanelContent:_,customEventDetailDialog:z,useEventDetailPanel:U,isSlidingView:W,isCurrentWeek:B,currentTime:V,HOUR_HEIGHT:q,FIRST_HOUR:G,LAST_HOUR:K,showStartOfDayLabel:X,timeFormat:J="24h",secondaryTimeSlots:Q,appTimeZone:ee})=>{var te,ne;const ae=!!Q&&Q.length>0&&!s,re={flexShrink:0},ie=v(e.state.highlightedEventId),[oe,le]=g(null),se=p(()=>Gt(),[]),de=e.canMutateFromUI();m(()=>{de||le(null)},[de]);const ce=e=>{if(!u.current)return G;const t=u.current.getBoundingClientRect();return G+(e-t.top)/q};return zt("div",{className:"df-week-time-grid",children:[zt("div",{ref:c,className:"df-calendar-content df-week-time-grid-scroller df-week-time-grid-scroller-shell","data-sliding-view":"300%"===l?"true":"false",style:{gridTemplateColumns:"auto 1fr"},onScroll:D,children:[zt("div",{ref:h,className:"df-week-time-grid-time-column","data-secondary-tz":ae?"true":"false",onContextMenu:e=>e.preventDefault(),children:[zt("div",{className:"df-time-column-spacer df-time-week-column-spacer","data-secondary-tz":ae?"true":"false",children:ae?zt(i,{children:zt("div",{className:"df-time-column-tz-row df-time-column-tz-row-boundary",children:[zt("span",{className:"df-time-column-tz-value",children:X&&null!==(te=null==Q?void 0:Q[0])&&void 0!==te?te:""}),zt("span",{className:"df-time-column-tz-value",children:X?Fe(G,0,J):""})]})}):zt("div",{className:"df-time-column-boundary-label",children:X?Fe(G,0,J):""})}),t.map((e,t)=>{var n;return zt("div",{className:Zn,children:zt("div",ae?{className:"df-time-column-tz-row",children:[zt("span",{className:"df-time-column-tz-value",children:X&&0===t?"":null!==(n=null==Q?void 0:Q[t])&&void 0!==n?n:""}),zt("span",{className:"df-time-column-tz-value",children:X&&0===t?"":e.label})]}:{className:_n,children:X&&0===t?"":e.label})},t)}),zt("div",{className:"df-week-time-grid-boundary-tail",children:zt("div",ae?{className:"df-time-column-tz-row",children:[zt("span",{className:"df-time-column-tz-value",children:null!==(ne=null==Q?void 0:Q[0])&&void 0!==ne?ne:""}),zt("span",{className:"df-time-column-tz-value",children:Fe(0,0,J)})]}:{className:_n,children:Fe(0,0,J)})}),B&&V&&(()=>{const e=V,t=e.getHours()+e.getMinutes()/60;return t<G||t>K?null:zt("div",{className:"df-week-time-grid-current-time-label",style:{top:(t-G)*q+"px",marginTop:"0.75rem"},children:zt("div",{className:Wn,children:Fe(t,0,J,!1)})})})()]}),zt("div",{ref:f,className:"df-week-time-grid-content",style:{width:l,minWidth:"100%",transform:W?"translateX(calc(-100% / 3))":void 0},children:zt("div",{className:"df-week-time-grid-grid",children:[zt("div",{className:`${na} df-time-grid-boundary-top df-week-time-grid-boundary-row`,"data-scrollbar-space":s||!se?"false":"true",children:n.map((e,t)=>zt("div",{className:"df-week-time-grid-boundary-cell",style:re},`boundary_${t}`))}),zt("div",{ref:u,className:"df-week-time-grid-grid-inner",children:[B&&V&&(()=>{const e=V,t=e.getHours()+e.getMinutes()/60;if(t<G||t>K)return null;const r=new Date(e);r.setHours(0,0,0,0);const i=new Date(a);i.setHours(0,0,0,0);const o=r.getTime()-i.getTime(),l=Math.round(o/864e5);return zt("div",{className:Un,style:{top:(t-G)*q+"px",height:0,zIndex:20},children:[zt("div",{className:"df-week-time-grid-current-time-spacer"}),zt("div",{className:"df-week-time-grid-current-time-track",children:n.map((e,t)=>zt("div",{className:"df-week-time-grid-current-time-cell",children:zt("div",{className:"df-week-time-grid-current-line-rail","data-today":t===l?"true":"false",style:{zIndex:9999},children:t===l&&0!==l&&zt("div",{className:"df-week-time-grid-current-line-dot"})})},t))})]})})(),t.map((e,t)=>zt("div",{className:zn,"data-scrollbar-space":s||!se?"false":"true",children:n.map((n,r)=>{const i=new Date(a);return i.setDate(a.getDate()+r),zt("div",{className:"df-time-grid-cell df-week-time-grid-cell",style:re,onClick:()=>{const e=new Date(a);e.setDate(a.getDate()+r),null==A||A(e)},onMouseDown:e=>{Si(e,r,ce(e.clientY),d,w)},onDblClick:e=>{null==w||w(e,r,ce(e.clientY)),Mi()},onTouchStart:t=>b(t,r,e.hour),onTouchEnd:E,onTouchMove:C,onDragOver:T,onDrop:t=>{S(t,i,e.hour)},onContextMenu:t=>((e,t,n)=>{if(e.preventDefault(),s||!de)return;const r=new Date(a);if(r.setDate(a.getDate()+t),u.current){const t=u.current.getBoundingClientRect(),n=(e.clientY-t.top)/q+G,a=Math.floor(n),i=Math.floor(60*(n-a)),o=15*Math.round(i/15),l=60===o?a+1:a,s=60===o?0:o;r.setHours(l,s,0,0)}else r.setHours(n,0,0,0);le({x:e.clientX,y:e.clientY,date:r})})(t,r,e.hour)},`${t}-${r}`)})},t)),zt("div",{className:`${na} df-time-grid-boundary-bottom df-week-time-grid-boundary-row`,"data-scrollbar-space":s||!se?"false":"true",children:n.map((e,t)=>zt("div",{className:"df-week-time-grid-boundary-cell",style:re},`24-${t}`))}),n.map((t,i)=>{const l=n.length,c=st(i,r),u=[];return c.forEach(e=>{const t=li(e,a,n.length,ee);if(t.length>0){const n=t.find(e=>e.dayIndex===i);n&&u.push({event:e,segmentInfo:Object.assign(Object.assign({},n),{dayIndex:i})})}else u.push({event:e})}),r.forEach(e=>{if(e.allDay||e.day===i)return;const t=li(e,a,n.length,ee).find(e=>e.dayIndex===i);t&&u.push({event:e,segmentInfo:Object.assign(Object.assign({},t),{dayIndex:i})})}),zt("div",{className:"df-week-time-grid-event-layer",style:{left:`calc(${100/l*i}%)`,width:100/l+"%",height:"100%"},children:u.map(({event:t,segmentInfo:n})=>{const a=o.get(i),c=null==a?void 0:a.get(t.id);return zt(Ei,{event:t,layout:c,viewType:x.WEEK,calendarRef:y,columnsPerRow:l,isBeingDragged:N&&(null==M?void 0:M.eventId)===t.id&&"move"===(null==M?void 0:M.mode),hourHeight:q,firstHour:G,onMoveStart:I,onResizeStart:k,onEventUpdate:O,onEventDelete:R,newlyCreatedEventId:L,onDetailPanelOpen:()=>$(null),selectedEventId:j,detailPanelEventId:F,onEventSelect:t=>{const n=!1!==e.getReadOnlyConfig(null!=t?t:void 0).viewable,a=r.find(e=>e.id===t);if((s||d)&&a&&n)return H(a),void P(!0);Y(t),e.state.highlightedEventId&&(e.highlightEvent(null),ie.current=null)},onEventLongPress:e=>{(s||d)&&Y(e)},onDetailPanelToggle:e=>Z(e),customDetailPanelContent:_,customEventDetailDialog:z,useEventDetailPanel:U,multiDaySegmentInfo:n,app:e,isMobile:s,isSlidingView:W,enableTouch:d,appTimeZone:ee},n?`${t.id}-seg-${i}`:t.id)})},`events-day-${i}`)})]})]})})]}),de&&oe&&zt(Qr,{x:oe.x,y:oe.y,date:oe.date,viewType:x.WEEK,onClose:()=>le(null),app:e,onCreateEvent:()=>{if(w){const e=new Date(a);e.setHours(0,0,0,0);const t=new Date(oe.date);t.setHours(0,0,0,0);const n=t.getTime()-e.getTime(),r=Math.round(n/864e5),i=oe.date.getHours()+oe.date.getMinutes()/60,o={preventDefault:()=>{},stopPropagation:()=>{},clientX:oe.x,clientY:oe.y};w(o,r,i)}}})]})},Io=e=>{const t=n.Now.plainDateISO(e);return new Date(t.year,t.month-1,t.day).toDateString()},ko=({app:e,config:t,customDetailPanelContent:n,customEventDetailDialog:a,useEventDetailPanel:r,calendarRef:i,selectedEventId:o,onEventSelect:l,onDateChange:s,detailPanelEventId:d,onDetailPanelToggle:c})=>{var u;const{t:h,getWeekDaysLabels:D,locale:w}=An(),b=e.getCurrentDate(),E=p(()=>b,[b.getTime()]),C=e.getEvents(),{screenSize:T}=Hn(),S="desktop"!==T,M=v(null),[N,I]=g(!1),{hourHeight:k=go.HOUR_HEIGHT,firstHour:O=go.FIRST_HOUR,lastHour:R=go.LAST_HOUR,allDayHeight:H=go.ALL_DAY_HEIGHT,showAllDay:P=!0,timeFormat:A="24h",secondaryTimeZone:L}=t,$=L&&"mobile"!==T?88:"mobile"===T?48:80,j=k,Y=O,F=R,Z=H,_=!P;m(()=>{I("ontouchstart"in window||navigator.maxTouchPoints>0)},[]);const z=e.getCustomMobileEventRenderer()||Nr,U="desktop"!==T,W=U?2:7,B=U,V=null!==(u=t.startOfWeek)&&void 0!==u?u:1,q=B?"300%":"100%",G=p(()=>ho(E,V),[E,V]),J=B?3*W:7,[Q,ee]=g(null),[te,ne]=g(null),[ae,re]=g(null),ie=void 0===o?te:o,oe=void 0===d?ae:d,le=e=>{l?l(e):ne(e)},se=e=>{c?c(e):re(e)},[de,ce]=g(null),[ue,he]=g(!1),[ge,me]=g(null),ve=v(null),fe=v(null),pe=v(null),ye=v(null),De=v(null),we=v(null),{handleScroll:be,goToNext:Ee,goToPrevious:Ce,mobilePageStart:Te}=(({app:e,columnsPerPage:t,currentDate:n,displayDays:a,isSlidingView:r,scrollerRef:i,swipeContentRef:o,topFrozenContentRef:l})=>{const[s,d]=g(()=>{const e=new Date(n);return e.setHours(0,0,0,0),e}),[c,u]=g(0),[h,p]=g(!1),y=v({x:0,y:0}),D=v(!1),w=v(0);m(()=>{r&&d(e=>{const a=new Date(n);a.setHours(0,0,0,0);const r=new Date(e),i=new Date(e);return i.setDate(i.getDate()+t-1),a>=r&&a<=i?e:a})},[t,n,r]);const b=f(e=>{const{scrollLeft:t}=e.currentTarget;if(!l.current)return;const n=r?"calc(-100% / 3)":"0px",a=r?`${c}px`:`-${t}px`;l.current.style.transform=`translateX(calc(${n} + ${a}))`,l.current.style.transition=r&&h?"transform 0.3s ease-out":"none"},[r,h,c,l]);m(()=>{if(!r)return;const t=i.current;if(!t)return;const n=e=>{y.current={x:e.touches[0].clientX,y:e.touches[0].clientY},D.current=!1,w.current=0,p(!1)},c=e=>{if(h)return;const n=e.touches[0].clientX-y.current.x,a=e.touches[0].clientY-y.current.y;if(!D.current&&Math.abs(n)>10&&Math.abs(n)>Math.abs(a)&&(D.current=!0),D.current){e.cancelable&&e.preventDefault();const a=t.clientWidth/2,r=Math.max(-a,Math.min(a,n)),i=`translateX(calc(-100% / 3 + ${r}px))`;l.current&&(l.current.style.transition="none",l.current.style.transform=i),o.current&&(o.current.style.transition="none",o.current.style.transform=i),w.current=r}},g=()=>{var n;if(!D.current)return void(w.current=0);const r=w.current,i=((null===(n=o.current)||void 0===n?void 0:n.clientWidth)||t.clientWidth)/a;r>100?(p(!0),u(i),setTimeout(()=>{const t=new Date(s);t.setDate(t.getDate()-1),d(t),e.setCurrentDate(t),u(0),w.current=0,p(!1)},300)):r<-100?(p(!0),u(-i),setTimeout(()=>{const t=new Date(s);t.setDate(t.getDate()+1),d(t),e.setCurrentDate(t),u(0),w.current=0,p(!1)},300)):(p(!0),u(0),w.current=0,setTimeout(()=>{p(!1)},300))};return t.addEventListener("touchstart",n,{passive:!0}),t.addEventListener("touchmove",c,{passive:!1}),t.addEventListener("touchend",g,{passive:!0}),()=>{t.removeEventListener("touchstart",n),t.removeEventListener("touchmove",c),t.removeEventListener("touchend",g)}},[e,a,r,h,s,i,o,l]),m(()=>{if(!r)return l.current&&(l.current.style.transform="",l.current.style.transition=""),void(o.current&&(o.current.style.transform="",o.current.style.transition=""));const e=h?"transform 0.3s ease-out":"none",t=`translateX(calc(calc(-100% / 3) + ${c}px))`;l.current&&(l.current.style.transition=e,l.current.style.transform=t),o.current&&(o.current.style.transition=e,o.current.style.transform=t)},[r,h,o,c,l]);const E=f(()=>{if(!r)return!1;const t=new Date(n);return t.setDate(t.getDate()-1),d(e=>{const t=new Date(e);return t.setDate(t.getDate()-1),t}),e.setCurrentDate(t),!0},[e,n,r]);return{handleScroll:b,goToNext:f(()=>{if(!r)return!1;const t=new Date(n);return t.setDate(t.getDate()+1),d(e=>{const t=new Date(e);return t.setDate(t.getDate()+1),t}),e.setCurrentDate(t),!0},[e,n,r]),goToPrevious:E,mobilePageStart:s}})({app:e,columnsPerPage:W,currentDate:E,displayDays:J,isSlidingView:B,scrollerRef:pe,swipeContentRef:we,topFrozenContentRef:ye}),Se=B?Te:G,Ie=p(()=>{if(!B)return Se;const e=new Date(Se);return e.setDate(e.getDate()-W),e},[W,Se,B]),ke=e.timeZone,xe=p(()=>((e,t,n=7,a)=>{const r=new Date(t);r.setDate(t.getDate()+(n-1)),r.setHours(23,59,59,999);const i=e=>a?Ne(e,a):Me(e);return e.filter(e=>{var n;const a=i(e.start);a.setHours(0,0,0,0);const o=i(null!==(n=e.end)&&void 0!==n?n:e.start);return o.setHours(23,59,59,999),o>=t&&a<=r}).map(e=>{const a=i(e.start),r=Math.floor((a.getTime()-t.getTime())/864e5),o=Math.max(0,Math.min(n-1,r));return Object.assign(Object.assign({},e),{day:o})})})(C,Ie,J,ke),[C,Ie,J,ke]),Re=v(e.state.highlightedEventId);m(()=>{if(e.state.highlightedEventId!==Re.current)if(e.state.highlightedEventId){le(e.state.highlightedEventId);const t=xe.find(t=>t.id===e.state.highlightedEventId);if(t&&!t.allDay){const e=K(t.start),n=pe.current;if(n){const t=(e-Y)*j;requestAnimationFrame(()=>{n.scrollTo({top:Math.max(0,t-100),behavior:"smooth"})})}}}else Re.current&&ie===Re.current&&le(null);Re.current=e.state.highlightedEventId},[e.state.highlightedEventId,xe,Y,j]);const He=p(()=>((e,t,n=7,a)=>{const r=oi(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=xn(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 i=[];return r.forEach(e=>{let t=0,n=!1;for(;!n;){let a=!1;for(const n of i)if(n.row===t&&!(e.endDayIndex<n.startDayIndex||e.startDayIndex>n.endDayIndex)){a=!0;break}a?t++:n=!0}i.push(Object.assign(Object.assign({},e),{row:t}))}),i})(xe,Ie,J,e.state.allDaySortComparator),[xe,Ie,J,e.state.allDaySortComparator]),Pe=p(()=>{const e=B?He.filter(e=>e.endDayIndex>=W&&e.startDayIndex<=2*W-1):He;if(0===e.length)return Z;const t=Math.max(...e.map(e=>e.row));return Z+t*Z},[He,Z,B,W]),Ae=p(()=>uo(xe,Ie,J,ke),[xe,Ie,J,ke]),Le=f((t,n,a)=>{const r=t(xe),i=new Set(r.map(e=>e.id)),o=xe.filter(e=>!i.has(e.id)),l=new Set(xe.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=xe.find(t=>t.id===e.id);return t&&Tt(t,e)});e.applyEventsChanges({delete:o.map(e=>e.id),add:s,update:d.map(e=>({id:e.id,updates:e}))},n,a)},[xe,e]),$e=f(t=>{S?(me(t),he(!0)):(e.addEvent(t),ce(t.id))},[S,e]),je=f(()=>{},[]),Ye=f((e,t,n)=>((e,t,n,a,r,i=7,o)=>{var l;const s=ct(r,e),d=ct(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:Oe(s,o),end:Oe(d,o),calendarId:"blue",allDay:!1};return(null===(l=uo([...a,c],r,i,o).get(e))||void 0===l?void 0:l.get("-1"))||null})(e,t,n,xe,Ie,J,ke),[xe,Ie,J,ke]),Ze=f((e,t,n,a)=>((e,t,n,a,r,i,o=7,l)=>{var s;const d=r.map(r=>{if(r.id!==e.id)return r;const o=ct(i,t),s=X(o,n),d=X(o,a),c=Oe(s,l),u=Oe(d,l);return Object.assign(Object.assign({},r),{day:t,start:c,end:u})});return(null===(s=uo(d,i,o,l).get(t))||void 0===s?void 0:s.get(e.id))||null})(e,t,n,a,xe,Ie,J,ke),[xe,Ie,J,ke]),_e=p(()=>({calendarRef:i,allDayRowRef:P?fe:void 0,timeGridRef:M,viewType:x.WEEK,onEventsUpdate:Le,onEventCreate:$e,onEventEdit:je,currentWeekStart:Ie,events:xe,calculateNewEventLayout:Ye,calculateDragLayout:Ze,TIME_COLUMN_WIDTH:$,isMobile:S,gridWidth:q,displayDays:J}),[i,P,Le,$e,je,Ie,xe,Ye,Ze,$,S,q,J]),{handleMoveStart:ze,handleCreateStart:qe,handleResizeStart:Ge,handleCreateAllDayEvent:Ke,dragState:Xe,isDragging:Je}=yo(e,_e),{handleDrop:Qe,handleDragOver:et}=mo({app:e,onEventCreated:e=>{ce(e.id)}}),tt=p(()=>(({displayDays:e,displayStart:t,getWeekDaysLabels:n,isSlidingView:a,locale:r,startOfWeek:i})=>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",i))({displayDays:J,displayStart:Ie,getWeekDaysLabels:D,isSlidingView:B,locale:w,startOfWeek:V}),[J,Ie,D,B,w,V]),nt=p(()=>((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)})})(S,w,D,tt),[D,S,w,tt]),at=p(()=>h("allDay"),[h]),rt=Array.from({length:24},(e,t)=>({hour:t+Y,label:Fe(t+Y,0,A)})),it=p(()=>L?Ue(rt,L,A,E,ke):void 0,[L,A,Y,E,ke]),ot=p(()=>L?We(ke,E):void 0,[L,ke,E]),lt=p(()=>L?We(L,E):void 0,[L,E]),st=p(()=>((e,t,n,a)=>{const r=Io(a);return t.map((t,a)=>{const i=new Date(e);return i.setDate(e.getDate()+a),{date:i.getDate(),month:i.toLocaleString(n,{month:"short"}),fullDate:new Date(i),isToday:i.toDateString()===r}})})(Ie,tt,w,ke),[ke,Ie,w,tt]),dt=p(()=>((e,t,n,a)=>{const r=Io(a),i=new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime();return Array.from({length:7},(n,a)=>{const o=new Date(e);o.setDate(e.getDate()+a);const l=new Date(o.getFullYear(),o.getMonth(),o.getDate());return{date:o.getDate(),month:o.toLocaleString(t,{month:"short"}),fullDate:new Date(o),isToday:o.toDateString()===r,isCurrent:l.getTime()===i,dayName:o.toLocaleDateString(t,{weekday:"short"})}})})(G,w,E,ke),[ke,E,w,G]),ut=t=>e.updateEvent(t.id,t),ht=t=>e.deleteEvent(t),gt=p(()=>{const e=Ve(ke);e.setHours(0,0,0,0);const t=new Date(Ie);t.setHours(0,0,0,0);const n=new Date(t);return n.setDate(t.getDate()+J),e>=t&&e<n},[Ie,J,ke]);return y(()=>{if(t.scrollToCurrentTime&&pe.current){const e=pe.current,t=Be(ke),n=t.getHours()+t.getMinutes()/60,a=e.clientHeight;e.scrollTop=Math.max(0,(n-Y)*j-a/2)}},[ke,t.scrollToCurrentTime,Y,j]),m(()=>{ee(Be(ke));const e=setInterval(()=>ee(Be(ke)),6e4);return()=>clearInterval(e)},[ke]),zt("div",{className:"df-calendar df-week-view",children:[zt(Ti,{calendar:e,viewType:x.WEEK,currentDate:E,onPrevious:()=>{Ce()||e.goToPrevious()},onNext:()=>{Ee()||e.goToNext()},onToday:()=>e.goToToday()}),zt(Mo,{app:e,weekDaysLabels:tt,mobileWeekDaysLabels:nt,weekDates:st,fullWeekDates:dt,isSlidingView:B,mobilePageStart:Te,currentWeekStart:Ie,gridWidth:q,allDayAreaHeight:Pe,organizedAllDaySegments:He,allDayLabelText:at,isMobile:S,isTouch:N,showAllDay:P,calendarRef:i,allDayRowRef:fe,topFrozenContentRef:ye,ALL_DAY_HEIGHT:Z,HOUR_HEIGHT:j,FIRST_HOUR:Y,dragState:Xe,isDragging:Je,secondaryTimeSlots:it,primaryTzLabel:ot,secondaryTzLabel:lt,handleMoveStart:ze,handleResizeStart:Ge,handleEventUpdate:ut,handleEventDelete:ht,setDraftEvent:me,setIsDrawerOpen:he,onDateChange:s,newlyCreatedEventId:de,setNewlyCreatedEventId:ce,selectedEventId:ie,setSelectedEventId:le,detailPanelEventId:oe,setDetailPanelEventId:se,handleCreateAllDayEvent:Ke,handleDragOver:et,handleDrop:Qe,customDetailPanelContent:n,customEventDetailDialog:a,useEventDetailPanel:r}),zt(No,{app:e,timeSlots:rt,weekDaysLabels:tt,currentWeekStart:Ie,currentWeekEvents:xe,eventLayouts:Ae,gridWidth:q,isMobile:S,isSlidingView:B,isTouch:N,scrollerRef:pe,timeGridRef:M,leftFrozenContentRef:De,swipeContentRef:we,calendarRef:i,handleScroll:be,handleCreateStart:qe,handleTouchStart:(e,t,n)=>{if(!S&&!N)return;const a=e.touches[0],r=a.clientX,i=a.clientY,o=e.currentTarget;ve.current=setTimeout(()=>{null==qe||qe({preventDefault:()=>{},stopPropagation:()=>{},touches:[{clientX:r,clientY:i}],changedTouches:[{clientX:r,clientY:i}],target:o,currentTarget:o,cancelable:!0},t,n)},500)},handleTouchEnd:()=>{ve.current&&(clearTimeout(ve.current),ve.current=null)},handleTouchMove:()=>{ve.current&&(clearTimeout(ve.current),ve.current=null)},handleDragOver:et,handleDrop:Qe,dragState:Xe,isDragging:Je,handleMoveStart:ze,handleResizeStart:Ge,handleEventUpdate:ut,handleEventDelete:ht,setDraftEvent:me,setIsDrawerOpen:he,onDateChange:s,newlyCreatedEventId:de,setNewlyCreatedEventId:ce,selectedEventId:ie,setSelectedEventId:le,detailPanelEventId:oe,setDetailPanelEventId:se,customDetailPanelContent:n,customEventDetailDialog:a,useEventDetailPanel:r,isCurrentWeek:gt,currentTime:Q,HOUR_HEIGHT:j,FIRST_HOUR:Y,LAST_HOUR:F,showStartOfDayLabel:_,timeFormat:A,secondaryTimeSlots:it,appTimeZone:ke}),zt(z,{isOpen:ue,onClose:()=>{he(!1),me(null)},onSave:t=>{C.some(e=>e.id===t.id)?e.updateEvent(t.id,t):e.addEvent(t),he(!1),me(null)},draftEvent:ge,app:e,timeFormat:A})]})},xo={startOfWeek:1},Oo=e=>o(wo,Object.assign(Object.assign({},e),{viewType:x.WEEK,originalComponent:ko,className:"df-week-view-factory"}));Oo.displayName="WeekViewAdapter";const Ro=(e={})=>{const t=Object.assign(Object.assign({},xo),e);return{type:x.WEEK,component:Oo,config:t}},Ho=({app:e,appTimeZone:t,calendarRef:n,currentMonth:a,currentYear:r,customDetailPanelContent:i,customEventDetailDialog:o,useEventDetailPanel:l,day:s,dayIndex:d,dayLayout:c,detailPanelEventId:u,dragState:h,enableTouch:g,hasScrollbarSpace:m,isDragging:f,locale:p,moreLabel:y,newlyCreatedEventId:D,onCalendarDragOver:w,onCalendarDrop:b,onChangeView:E,onContextMenu:C,onCreateStart:T,onDetailPanelOpen:S,onDetailPanelToggle:M,onEventDelete:N,onEventLongPress:I,onEventSelect:k,onEventUpdate:O,onMoreEventsClick:R,onMoveStart:H,onResizeStart:P,onSelectDate:A,organizedMultiDaySegments:L,overlayVisibleLayerCount:$,screenSize:j,selectedEventId:Y,showWeekNumbers:F,totalSlotsNeeded:Z,weekHeightPx:_})=>{const z=v(null),U=v(null),W=s.date.toLocaleDateString(p,{month:p.startsWith("zh")||p.startsWith("ja")?"short":"long"})===a&&s.year===r,{hasMore:B,limit:V,timedEventsOnly:q,gapLayers:G,occupiedLayers:X,maxOccupiedLayer:J,segmentIsHidden:Q}=c;let te=0;L.slice(V).forEach(e=>{e.forEach(e=>{e.startDayIndex<=d&&e.endDayIndex>=d&&te++})}),L.slice(0,V).forEach(e=>{e.forEach(e=>{e.startDayIndex<=d&&e.endDayIndex>=d&&Q.has(e.id)&&te++})});const ne=G.filter(e=>e<V).length,ae=L.slice(0,V).filter(e=>e.some(e=>e.startDayIndex<=d&&e.endDayIndex>=d&&Q.has(e.id))).length,re=Math.max(0,V-Math.max(J+1,0)),ie=Math.min(q.length,ne+re+ae),oe=q.slice(0,ie),le=te+(q.length-ie),se=B&&$>V,de=17*($-V),ce=f&&h.eventId?h.eventId:null,ue=ce?oe.find(e=>e.id===ce):null,he=ce&&!ue?q.find(e=>e.id===ce):null,ge=ue?[ue,...oe.filter(e=>e.id!==ce)]:he&&oe.length>0?[he,...oe.slice(0,-1)]:he?[he]:oe,me=[];let ve=0;const fe=Math.min(V,Z);for(let a=0;a<fe;a++)if(X.has(a)&&!L[a].some(e=>e.startDayIndex<=d&&e.endDayIndex>=d&&Q.has(e.id)))me.push(zt("div",{className:"df-shrink-0",style:{height:"17px",minHeight:"17px"}},`placeholder-layer-${a}-${s.date.getTime()}`));else if(ve<ge.length){const a=ge[ve];me.push(zt(Ei,{event:a,isAllDay:!!a.allDay,viewType:x.MONTH,isBeingDragged:f&&h.eventId===a.id&&"move"===h.mode,calendarRef:n,hourHeight:72,firstHour:0,onEventUpdate:O,onEventDelete:N,onMoveStart:H,onResizeStart:P,onDetailPanelOpen:S,onEventSelect:k,onEventLongPress:I,newlyCreatedEventId:D,selectedEventId:Y,detailPanelEventId:u,onDetailPanelToggle:M,customDetailPanelContent:i,customEventDetailDialog:o,useEventDetailPanel:l,app:e,isMobile:"desktop"!==j,enableTouch:g,appTimeZone:t},`${a.id}-${a.day}-${K(a.start)}-${ve}`)),ve++}return zt("div",{className:da("df-month-day-cell","df-month-day-cell-surface"),style:{height:_},"data-other-month":W?"false":"true","data-trailing-border":6!==d||m?"true":"false","data-date":(pe=s.date,`${pe.getFullYear()}-${String(pe.getMonth()+1).padStart(2,"0")}-${String(pe.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"!==j&&!g)return;const t=e.touches[0];U.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&&U.current){const t=Math.abs(e.touches[0].clientX-U.current.x),n=Math.abs(e.touches[0].clientY-U.current.y);(t>10||n>10)&&(clearTimeout(z.current),z.current=null)}},onTouchEnd:()=>{z.current&&(clearTimeout(z.current),z.current=null),U.current=null},onDragOver:w,onDrop:e=>null==b?void 0:b(e,s.date),onContextMenu:e=>C(e,s.date),children:[zt("div",{className:"df-month-date-number-container",children:[F&&0===d&&"mobile"!==j&&zt("span",{className:"df-month-week-number",children:ee(s.date)}),zt("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"===j?s.date.toLocaleDateString(p,{month:"short",day:"numeric"}):s.day})]}),zt("div",{className:"df-month-day-cell-content",children:[se&&zt("div",{className:"df-month-day-cell-overlay-mask",style:{top:17*V+"px",height:`${de}px`}}),me,B&&zt("div",{className:da("df-month-more-events","df-month-day-cell-more-events"),"data-layout":"desktop"===j?"desktop":"mobile",onClick:e=>{e.stopPropagation(),R?R(s.date):(null==A||A(s.date),null==E||E(x.DAY))},children:["+",le,"desktop"===j?` ${y}`:""]})]})]},`day-${s.date.getTime()}`);var pe},Po=h(({currentMonth:e,currentYear:t,newlyCreatedEventId:a,screenSize:r,isScrolling:i,isDragging:o,showWeekNumbers:l,showMonthIndicator:s=!0,item:d,weekHeight:c,events:u,dragState:h,calendarRef:f,onEventUpdate:y,onEventDelete:D,onMoveStart:w,onCreateStart:b,onResizeStart:E,onDetailPanelOpen:C,onMoreEventsClick:T,onChangeView:S,onSelectDate:M,selectedEventId:N,onEventSelect:I,onEventLongPress:k,detailPanelEventId:O,onDetailPanelToggle:R,customDetailPanelContent:H,customEventDetailDialog:P,useEventDetailPanel:A,onCalendarDrop:L,onCalendarDragOver:$,app:j,enableTouch:Y,appTimeZone:F})=>{const{t:Z,locale:_}=An(),[z,U]=g(!1),W=v(null),[B,V]=g(null),q=j.canMutateFromUI();m(()=>{q||V(null)},[q]);const G=(e,t)=>{e.preventDefault(),"mobile"!==r&&q&&V({x:e.clientX,y:e.clientY,date:t})},X=p(()=>{const e=c-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}},[c]);m(()=>i?(U(!0),W.current&&(clearTimeout(W.current),W.current=null),()=>{W.current&&(clearTimeout(W.current),W.current=null)}):z?(W.current=setTimeout(()=>{U(!1),W.current=null},100),()=>{W.current&&(clearTimeout(W.current),W.current=null)}):void 0,[i,z]);const{weekData:J}=d,Q=J.days.find(e=>1===e.day),ee=`${c}px`,te=p(()=>Gt(),[]),ne=p(()=>oi(u,J.startDate,7,F),[u,J.startDate,F]),ae=p(()=>((e,t,a)=>{const r=[],i=new Date(t);return i.setDate(i.getDate()+6),i.setHours(23,59,59,999),e.forEach(e=>{if(!e.start||!e.end)return void De.warn("Event missing start or end date:",e);const o=Ne(e.start,a),l=e.end?Ne(e.end,a):o,s=new Date(o);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()-o.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(o);a<t&&(a=new Date(t),a.setHours(0,0,0,0));const s=l>i?i:l;for(let i=o.getTime();i<=s.getTime();i+=864e5){const o=new Date(i);if(o<t)continue;const l=n.PlainDate.from({year:o.getFullYear(),month:o.getMonth()+1,day:o.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:o.getDay()}))}),r})(u,J.startDate,F),[u,J.startDate,F]),re=p(()=>{const e=new Map;return J.days.forEach(t=>{const n=t.date.toDateString();e.set(n,ae.filter(e=>{if(!e.start||!e.end)return Ne(e.start,F).toDateString()===n;const t=Ne(e.start,F),a=Ne(e.end,F);if(!e.allDay&&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},[ae,J.days,F]),ie=p(()=>((e,t)=>{const n=t||xn(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 i=!1;for(const a of r){const r=Math.abs((null!==(t=a.yPosition)&&void 0!==t?t:0)-n)<16,o=!(e.endDayIndex<a.startDayIndex||e.startDayIndex>a.endDayIndex);if(r&&o){i=!0;break}}i?n+=16:a=!0}r.push(Object.assign(Object.assign({},e),{yPosition:n}))});const i=[];return r.forEach(e=>{var t;const n=Math.floor((null!==(t=e.yPosition)&&void 0!==t?t:0)/16);i[n]||(i[n]=[]),i[n].push(e)}),i.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})}),i})(ne,j.state.allDaySortComparator),[ne,j.state.allDaySortComparator]),oe=p(()=>ie.flat(),[ie]),le=p(()=>{const e=Array.from({length:7}).fill(0);return ie.forEach((t,n)=>{t.forEach(t=>{for(let a=t.startDayIndex;a<=t.endDayIndex;a++)e[a]=Math.max(e[a],n+1)})}),e},[ie]),se=p(()=>{const e=Array.from({length:7},()=>new Set);return ie.forEach((t,n)=>{t.forEach(t=>{for(let a=t.startDayIndex;a<=t.endDayIndex;a++)a>=0&&a<7&&e[a].add(n)})}),e},[ie]),de=p(()=>{const{maxSlots:e,maxSlotsWithMore:t}=X,n=J.days.map((n,a)=>{var r,i;const o=(e=>[...e].toSorted((e,t)=>e.allDay!==t.allDay?e.allDay?-1:1:e.allDay&&t.allDay?0:K(e.start)-K(t.start)))(null!==(r=re.get(n.date.toDateString()))&&void 0!==r?r:[]),l=o.filter(e=>!e.allDay||!oe.some(t=>t.originalEventId===e.id)),s=(null!==(i=le[a])&&void 0!==i?i:0)-1,d=se[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),g=Math.max(s+1,0)+h,m=g>e;return{totalSlotsNeeded:g,hasMore:m,limit:m?t:e,timedEventsOnly:l,gapLayers:c,occupiedLayers:d,maxOccupiedLayer:s}}),a=new Set;return ie.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 i=!1;oe.forEach(e=>{e.startDayIndex<=r&&e.endDayIndex>=r&&a.has(e.id)&&(i=!0)});const o=n.hasMore||i,l=o?t:e;return Object.assign(Object.assign({},n),{hasMore:o,limit:l,segmentIsHidden:a})})},[X,J.days,re,oe,le,se,ie]),ce=p(()=>Math.min(ie.length,X.maxSlots),[ie.length,X.maxSlots]),ue=p(()=>Math.max(0,17*ce),[ce]),he=p(()=>Q?Q.date.toLocaleDateString(_,{month:"long",year:"numeric"}):"",[Q,_]);return zt("div",{className:"df-month-week",style:{height:ee},children:[s&&Q&&zt("div",{className:"df-month-title","data-visible":z?"true":"false",style:{transition:"opacity 0.5s ease",maxWidth:"fit-content"},onContextMenu:e=>e.preventDefault(),children:zt("span",{className:"df-month-title-label",children:he})}),zt("div",{className:"df-month-week-inner",children:zt("div",{className:"df-month-week-grid-shell",children:[zt("div",{className:"df-month-week-grid",children:J.days.map((n,i)=>zt(Ho,{app:j,appTimeZone:F,calendarRef:f,currentMonth:e,currentYear:t,customDetailPanelContent:H,customEventDetailDialog:P,useEventDetailPanel:A,day:n,dayIndex:i,dayLayout:de[i],detailPanelEventId:O,dragState:h,enableTouch:Y,hasScrollbarSpace:te,isDragging:o,locale:_,moreLabel:Z("more"),newlyCreatedEventId:a,onCalendarDragOver:$,onCalendarDrop:L,onChangeView:S,onContextMenu:G,onCreateStart:b,onDetailPanelOpen:C,onDetailPanelToggle:R,onEventDelete:D,onEventLongPress:k,onEventSelect:I,onEventUpdate:y,onMoreEventsClick:T,onMoveStart:w,onResizeStart:E,onSelectDate:M,organizedMultiDaySegments:ie,overlayVisibleLayerCount:ce,screenSize:r,selectedEventId:N,showWeekNumbers:l,totalSlotsNeeded:de[i].totalSlotsNeeded,weekHeightPx:ee},`day-${n.date.getTime()}`))}),ie.length>0&&zt("div",{className:"df-month-week-event-layer",style:{top:"33px",height:`${ue}px`},children:ie.slice(0,ce).map((e,t)=>zt("div",{className:"df-month-week-event-layer-row",children:e.filter(e=>!de[0].segmentIsHidden.has(e.id)).map(e=>zt(Ei,{event:e.event,isAllDay:!0,segment:e,segmentIndex:t,viewType:x.MONTH,isMultiDay:!0,calendarRef:f,hourHeight:72,firstHour:0,onEventUpdate:y,onEventDelete:D,onMoveStart:w,onResizeStart:E,isBeingDragged:o&&h.eventId===e.event.id&&"move"===h.mode,isBeingResized:o&&h.eventId===e.event.id&&"resize"===h.mode,newlyCreatedEventId:a,onDetailPanelOpen:C,selectedEventId:N,onEventSelect:I,onEventLongPress:k,detailPanelEventId:O,onDetailPanelToggle:R,customDetailPanelContent:H,customEventDetailDialog:P,useEventDetailPanel:A,app:j,isMobile:"desktop"!==r,enableTouch:Y,appTimeZone:F},e.id))},`layer-${t}`))})]})}),q&&B&&zt(Qr,{x:B.x,y:B.y,date:B.date,viewType:x.MONTH,onClose:()=>V(null),app:j,onCreateEvent:()=>{if(b){const e={preventDefault:()=>{},stopPropagation:()=>{},clientX:B.x,clientY:B.y};b(e,B.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.useEventDetailPanel===t.useEventDetailPanel&&e.onCalendarDrop===t.onCalendarDrop&&e.onCalendarDragOver===t.onCalendarDragOver&&e.app===t.app&&e.enableTouch===t.enableTouch&&e.appTimeZone===t.appTimeZone);Po.displayName="WeekComponent";const Ao=(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},Lo=[],$o=({app:e,config:t,customDetailPanelContent:n,customEventDetailDialog:a,useEventDetailPanel:r,calendarRef:i,selectedEventId:o,onEventSelect:l,detailPanelEventId:s,onDetailPanelToggle:d})=>{var c,u,h;const{getWeekDaysLabels:D,getMonthLabels:w,locale:b}=An(),E=e.getCurrentDate(),C=e.getEvents(),T=null!==(c=t.startOfWeek)&&void 0!==c?c:1,S=e.timeZone,M=!0===(null===(u=t.scroll)||void 0===u?void 0:u.disabled),N=M&&"fade"===(null===(h=t.scroll)||void 0===h?void 0:h.transition),[I,k]=g(E),[O,P]=g(!1),[A,L]=g("forward"),$=v(E),j=v(null),Y=E.getFullYear(),F=E.getMonth();m(()=>{if(!N)return;if(Y===$.current.getFullYear()&&F===$.current.getMonth())return;const e=E>$.current;return $.current=E,L(e?"forward":"backward"),j.current&&clearTimeout(j.current),P(!0),j.current=setTimeout(()=>{k(E),P(!1)},300),()=>{j.current&&clearTimeout(j.current)}},[Y,F,N]);const Z=p(()=>N?((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 i=[];for(let e=0;e<6;e++){const t=new Date(r);t.setDate(r.getDate()+7*e),i.push(it(t))}return i})(I,T):[],[N,I,T]),_=p(()=>({opacity:O?0:1,transform:O?`translateX(${"forward"===A?"-6%":"6%"})`:"translateX(0)",transition:"opacity 300ms ease, transform 300ms ease"}),[O,A]),z=e.getCalendars().map(e=>e.id+e.colors.lineColor).join("-"),U=v(null),W=p(()=>{const e=U.current;return e&&e.length===C.length&&e.every((e,t)=>e===C[t])?e:(U.current=C,C)},[C]),B=p(()=>{const e=new Map,t=e=>{const t=new Date(e);t.setHours(0,0,0,0);const n=(t.getDay()-T+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 W.forEach(e=>{if(!e.start)return;const a=Ne(e.start,S),r=e.end?Ne(e.end,S):a,i=new Date(a);i.setHours(0,0,0,0);const o=new Date(r);o.setHours(0,0,0,0);let l=new Date(o);e.allDay||0!==r.getHours()||0!==r.getMinutes()||0!==r.getSeconds()||0!==r.getMilliseconds()||l.setDate(l.getDate()-1),l<i&&(l=new Date(i));const s=t(i),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},[W,T,S]),{screenSize:V}=Hn(),[q,G]=g(!1);m(()=>{G("ontouchstart"in window||navigator.maxTouchPoints>0)},[]);const K=e.getCustomMobileEventRenderer()||Nr,[X,J]=g(()=>{if("undefined"==typeof window)return 119;const e=window.innerHeight-150;return Math.max(80,Math.ceil(e/6))}),[Q,ee]=g(()=>"undefined"!=typeof window),te=v(X),ne=v([]),[ae,re]=g(null),[ie,oe]=g(!1),[le,se]=g(null),[de,ce]=g(null),[ue,he]=g(null),ge=void 0===o?de:o,me=void 0===s?ue:s,ve=f(e=>{l?l(e):ce(e)},[l]),fe=f(e=>{d?d(e):he(e)},[d]),pe=v(e.state.highlightedEventId);m(()=>{e.state.highlightedEventId?ve(e.state.highlightedEventId):pe.current&&ve(null),pe.current=e.state.highlightedEventId},[e.state.highlightedEventId]);const ye=p(()=>{const e=(E.getDay()-T+7)%7,t=new Date(E);return t.setDate(E.getDate()-e),t.setHours(0,0,0,0),t},[E,T]),{handleMoveStart:De,handleCreateStart:we,handleResizeStart:be,dragState:Ee,isDragging:Ce}=yo(e,{calendarRef:i,viewType:x.MONTH,onEventsUpdate:(t,n,a)=>{const r=t(W),i=new Set(r.map(e=>e.id)),o=W.filter(e=>!i.has(e.id)),l=new Set(W.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=W.find(t=>t.id===e.id);return t&&Tt(t,e)});e.applyEventsChanges({delete:o.map(e=>e.id),add:s,update:d.map(e=>({id:e.id,updates:e}))},n,a)},onEventCreate:t=>{"desktop"===V?e.addEvent(t):(se(t),oe(!0))},onEventEdit:e=>{re(e.id)},currentWeekStart:ye,events:W,isMobile:"desktop"!==V}),Te=Ee,{handleDrop:Se,handleDragOver:Me}=mo({app:e,onEventCreated:e=>{re(e.id)}}),Ie=p(()=>D(b,"short",T),[b,D,T]),xe=p(()=>{if(!Ce||!Te.eventId||!Te.startDate||!Te.endDate||"move"!==Te.mode&&"resize"!==Te.mode)return null;const e=W.find(e=>e.id===Te.eventId);return e?Object.assign(Object.assign({},e),{start:e.allDay?ke(Te.startDate):Oe(Te.startDate,S),end:e.allDay?ke(Te.endDate):Oe(Te.endDate,S)}):null},[Ce,Te.eventId,Te.startDate,Te.endDate,Te.mode,W,S]),Re=f(e=>{var t;const n=null!==(t=B.get(e.getTime()))&&void 0!==t?t:Lo;if(!xe)return n;const a=n.some(e=>e.id===xe.id),r=((e,t,n,a)=>{const{startDate:r,adjustedEnd:i}=((e,t)=>{const n=Ne(e.start,t),a=e.end?Ne(e.end,t):n,r=new Date(n);r.setHours(0,0,0,0);const i=new Date(a);i.setHours(0,0,0,0);let o=new Date(i);return e.allDay||0!==a.getHours()||0!==a.getMinutes()||0!==a.getSeconds()||0!==a.getMilliseconds()||o.setDate(o.getDate()-1),o<r&&(o=new Date(r)),{startDate:r,adjustedEnd:o}})(e,a),o=Ao(r,n).getTime(),l=Ao(i,n).getTime(),s=Ao(t,n).getTime();return s>=o&&s<=l})(xe,e,T,S);if(!a&&!r)return n;const i=n.filter(e=>e.id!==xe.id);return r&&i.push(xe),i},[B,xe,T,S]),{currentMonth:He,currentYear:Pe,isScrolling:Ae,virtualData:Le,weeksData:$e,scrollElementRef:je,isNavigating:Ye,handleScroll:Fe,handlePreviousMonth:Ze,handleNextMonth:_e,handleToday:ze,setScrollTop:Ue}=(({currentDate:e,weekHeight:t,onCurrentMonthChange:n,initialWeeksToLoad:a=104,locale:r="en-US",startOfWeek:i=1,isEnabled:o=!0,snapToMonth:l=!1})=>{const s=v(null),d=f((e,t)=>{const n=new Date(t,e,1),a=r.startsWith("zh")||r.startsWith("ja");return n.toLocaleDateString(r,{month:a?"short":"long"})},[r]),c=p(()=>{const t=new Date(e);return t.setDate(1),t.setHours(0,0,0,0),lt(t,a,i)},[e,a,i]),u=p(()=>{const n=new Date(e);n.setDate(1),n.setHours(0,0,0,0);const a=c.findIndex(e=>e.days.some(e=>e.date.toDateString()===n.toDateString()));return a>0?a*t:0},[c,e,t]),[h,D]=g(u),[w,b]=g(600),[E,C]=g(d(e.getMonth(),e.getFullYear())),[T,S]=g(e.getFullYear()),[M,N]=g(!1),[I,k]=g(c),[x,O]=g(!1),P=v(!1),[A,L]=g(!1),$=v(e),j=v(null),Y=v(null),F=v(new H),Z=v(0),_=v(0),z=v(!1),U=f(e=>{e&&(j.current=e)},[]),W=f(e=>{let t=F.current.get(e);return t||(t=it(e),F.current.set(e,t)),t},[]),B=f((e,n=26)=>{z.current||(z.current=!0,setTimeout(()=>{try{if("future"===e){const e=I.at(-1),t=[];for(let a=1;a<=n;a++){const n=new Date(e.startDate);n.setDate(n.getDate()+7*a),t.push(W(n))}k(e=>[...e,...t])}else{const e=I[0],a=[];for(let t=n;t>=1;t--){const n=new Date(e.startDate);n.setDate(n.getDate()-7*t),a.push(W(n))}const r=a.length*t;k(e=>[...a,...e]),requestAnimationFrame(()=>{D(e=>e+r),j.current&&(j.current.scrollTop+=r)})}}finally{setTimeout(()=>{z.current=!1},200)}},0))},[I,W,t]),V=p(()=>{const e=I.length*t,n=Math.floor(h/t);let a=Math.max(0,n);a=Math.min(a,Math.max(0,I.length-6));const r=Math.min(I.length-1,a+6-1),i=Math.max(0,a-15),o=Math.min(I.length-1,r+15),l=[];for(let e=i;e<=o;e++)l.push({index:e,weekData:I[e],top:e*t,height:t});return{totalHeight:e,visibleItems:l,displayStartIndex:a}},[h,w,t,I]),q=f(e=>{if(x||M||0===e.length||!A)return;const t=h+w/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=`${d(e.month,e.year)}-${e.year}`;r[t]=(r[t]||0)+1});let i="",o=0,l=0;Object.entries(r).forEach(([e,t])=>{if(t>l){l=t;const[n,a]=e.split("-");i=n,o=Number.parseInt(a,10)}}),i&&o&&(s.current?i===s.current.month&&o===s.current.year&&(s.current=null,i===E&&o===T||(C(i),S(o),null==n||n(i,o))):i===E&&o===T||(C(i),S(o),null==n||n(i,o)))},[w,E,T,x,M,n,h,A]),G=f(e=>{const n=performance.now();if(n-Z.current<R.SCROLL_THROTTLE)return;Z.current=n;const a=e.currentTarget,r=a.scrollTop;_.current=r,D(r),x||requestAnimationFrame(()=>{const{scrollHeight:e,clientHeight:n}=a;r+n>e-10*t&&!z.current&&B("future",26),r<10*t&&!z.current&&B("past",26)}),N(!0),Y.current&&clearTimeout(Y.current),Y.current=setTimeout(()=>{N(!1)},R.SCROLL_DEBOUNCE)},[t,B,x]),K=f((e,n=!0)=>{if(!j.current)return;O(!0),P.current=!0;const a=()=>{setTimeout(()=>{O(!1),P.current=!1},n?500:200)},r=I.findIndex(t=>t.days.some(t=>t.date.toDateString()===e.toDateString()));if(-1!==r){const e=r*t;return j.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=I[0],d=I.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 g=Math.min(c+10,52);if(u){const r=[];for(let e=g;e>=1;e--){const t=new Date(s.startDate);t.setDate(t.getDate()-7*e),r.push(W(t))}const i=r.length*t;k(e=>[...r,...e]),requestAnimationFrame(()=>{const o=[...r,...I].findIndex(t=>t.days.some(t=>t.date.toDateString()===e.toDateString()));if(j.current&&-1!==o){const e=o*t;j.current.scrollTop+=i,D(e=>e+i),setTimeout(()=>{j.current&&j.current.scrollTo({top:e,behavior:n?"smooth":"auto"})},50)}a()})}else if(h){const r=[];for(let e=1;e<=g;e++){const t=new Date(d.startDate);t.setDate(t.getDate()+7*e),r.push(W(t))}k(e=>[...e,...r]),requestAnimationFrame(()=>{const i=[...I,...r].findIndex(t=>t.days.some(t=>t.date.toDateString()===e.toDateString()));if(j.current&&-1!==i){const e=i*t;j.current.scrollTo({top:e,behavior:n?"smooth":"auto"})}a()})}else a()},[I,t,W]),X=f(()=>{var e;const t=V.displayStartIndex,n=Math.min(I.length-1,t+5),a={};for(let r=t;r<=n;r++)null===(e=I[r])||void 0===e||e.days.forEach(e=>{const t=`${e.month}-${e.year}`;a[t]=(a[t]||0)+1});let r=0,i=0,o=0;for(const[e,t]of Object.entries(a))t>o&&(o=t,[r,i]=e.split("-").map(Number));const l=new Date(i,r-1,1);K(l)},[V.displayStartIndex,I,K]),J=f(()=>{var e;const t=V.displayStartIndex,n=Math.min(I.length-1,t+5),a={};for(let r=t;r<=n;r++)null===(e=I[r])||void 0===e||e.days.forEach(e=>{const t=`${e.month}-${e.year}`;a[t]=(a[t]||0)+1});let r=0,i=0,o=0;for(const[e,t]of Object.entries(a))t>o&&(o=t,[r,i]=e.split("-").map(Number));const l=new Date(i,r+1,1);K(l)},[V.displayStartIndex,I,K]),Q=f(()=>{const e=new Date,a=d(e.getMonth(),e.getFullYear()),r=e.getFullYear(),i=new Date(r,e.getMonth(),1);s.current={month:a,year:r},C(a),S(r),null==n||n(a,r);const o=I.findIndex(e=>e.days.some(e=>e.date.toDateString()===i.toDateString()));if(-1===o)O(!0),P.current=!0,requestAnimationFrame(()=>{K(i,!0),setTimeout(()=>{P.current=!1,O(!1)},200)});else{const e=o*t,n=j.current;n&&(O(!0),P.current=!0,requestAnimationFrame(()=>{D(e),requestAnimationFrame(()=>{n&&(n.scrollTop=e,setTimeout(()=>{P.current=!1,O(!1)},200))})}))}},[I,t,n,K]);return m(()=>{q(V.visibleItems)},[V.visibleItems,q]),m(()=>{const t=$.current,a=t.getMonth(),r=t.getFullYear(),i=e.getMonth(),o=e.getFullYear();if(a!==i||r!==o){const e=6,t=V.displayStartIndex,a=Math.min(I.length-1,t+e-1),r={};for(let e=t;e<=a;e++){const t=I[e];t&&t.days.forEach(e=>{const t=`${e.month}-${e.year}`;r[t]=(r[t]||0)+1})}let l="",c=0;for(const[e,t]of Object.entries(r))t>c&&(c=t,l=e);if(l!==`${i}-${o}`){const e=new Date(o,i,1),t=d(i,o);s.current={month:t,year:o},C(t),S(o),null==n||n(t,o),K(e,!0)}}$.current=e},[e,n,K,V,I,d]),m(()=>{const e=j.current;if(!e)return;const t=new ResizeObserver(([e])=>{b(e.contentRect.height)});return t.observe(e),()=>t.disconnect()},[]),y(()=>{const e=j.current;e&&!A&&o&&(u>0&&(e.scrollTop=u),L(!0))},[A,u,o]),m(()=>{var e;if(!l||M||x||!A)return;const n=Math.floor(h/t),a=Math.min(I.length-1,n+5),r={};for(let t=n;t<=a;t++)null===(e=I[t])||void 0===e||e.days.forEach(e=>{const t=`${e.month}-${e.year}`;r[t]=(r[t]||0)+1});let i=0,o=0,s=0;for(const[e,t]of Object.entries(r))t>s&&(s=t,[i,o]=e.split("-").map(Number));const d=new Date(o,i,1),c=I.findIndex(e=>e.days.some(e=>e.date.toDateString()===d.toDateString()));if(-1===c)return;const u=c*t;if(Math.abs(u-h)>5){const e=setTimeout(()=>{K(d,!0)},200);return()=>clearTimeout(e)}},[M,l,x,A,h,t,I,K]),m(()=>()=>{Y.current&&clearTimeout(Y.current)},[]),{scrollTop:h,containerHeight:w,currentMonth:E,currentYear:T,isScrolling:M,isNavigating:x,virtualData:V,scrollElementRef:j,handleScroll:G,scrollToDate:K,handlePreviousMonth:X,handleNextMonth:J,handleToday:Q,setScrollTop:D,setContainerHeight:b,setCurrentMonth:C,setCurrentYear:S,setIsScrolling:N,cache:F.current,scrollElementRefCallback:U,weeksData:I}})({currentDate:E,weekHeight:X,onCurrentMonthChange:(t,n)=>{const a=b.startsWith("zh")||b.startsWith("ja"),r=w(b,a?"short":"long").indexOf(t);r>=0&&e.setVisibleMonth(new Date(n,r,1))},initialWeeksToLoad:156,locale:b,startOfWeek:T,isEnabled:Q,snapToMonth:t.snapToMonth}),We=v(0),[Be,Ve]=g(0),qe=p(()=>Be-6*X,[Be,X]),{visibleWeeks:Ge,startIndex:Ke}=p(()=>{var e,t;const{visibleItems:n,displayStartIndex:a}=Le,r=n.findIndex(e=>e.index===a);if(-1===r)return ne.current.length>0?{visibleWeeks:ne.current,startIndex:We.current}:{visibleWeeks:[],startIndex:a};const i=Math.max(0,r-2),o=n.slice(i,r+8),l=null!==(t=null===(e=n[i])||void 0===e?void 0:e.index)&&void 0!==t?t:a;return o.length>=6&&(ne.current=o,We.current=l),{visibleWeeks:o,startIndex:l}},[Le]),Xe=p(()=>Ke*X,[Ke,X]),Je=v(!0),Qe=v(!1),et=(e=>{const[t,n]=g(e);return m(()=>{const t=setTimeout(()=>{n(e)},250);return()=>{clearTimeout(t)}},[e,250]),t})(Le.displayStartIndex);m(()=>{Ye&&(Qe.current=!0)},[Ye]),m(()=>{if(Je.current)return void(Je.current=!1);const t=$e[et];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,Qe.current?"navigation":"scroll"),Qe.current=!1},[e,$e,et]);const tt=p(()=>{const e=Le.totalHeight,t=Ke*X+Ge.length*X+qe;return Math.max(0,e-t)},[Le.totalHeight,Ke,X,qe,Ge.length]);m(()=>{const e=je.current;if(!e)return;const t=new ResizeObserver(t=>{for(const n of t){const t=n.contentRect.height;if(Ve(t),t>0){const n=Math.max(80,Math.ceil(t/6));if(n!==te.current){const t=e.scrollTop;if(t>0){const a=Math.round(t/te.current)*n;e.scrollTop=a,Ue(a)}J(n),te.current=n}}}});return t.observe(e),()=>{t.disconnect()}},[je,Ue]),y(()=>{const e=window.innerHeight-150,t=Math.max(80,Math.ceil(e/6));J(t),te.current=t,ee(!0)},[]),m(()=>{if(N||!M)return;const e=je.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)}},[N,M,je]);const nt=f(t=>e.updateEvent(t.id,t),[e]),at=f(t=>e.deleteEvent(t),[e]),rt=t=>{e.changeView(t)},ot=f(()=>re(null),[]),st=f(t=>{const n=e.getReadOnlyConfig().viewable;if(("desktop"!==V||q)&&t&&n){const e=W.find(e=>e.id===t);if(e)return se(e),void oe(!0)}ve(t)},[V,q,W,ve,e]),dt=f(e=>{("desktop"!==V||q)&&ve(e)},[V,q,ve]);return zt("div",{className:Ln,children:[zt(Ti,{calendar:e,viewType:x.MONTH,currentDate:E,customTitle:(()=>{const e=b.startsWith("zh")||b.startsWith("ja");if(N){const t=w(b,e?"short":"long")[I.getMonth()],n=I.getFullYear();return e?`${n}年${t}`:`${t} ${n}`}return e?`${Pe}年${He}`:`${He} ${Pe}`})(),onPrevious:()=>{e.goToPrevious(),N||Ze()},onNext:()=>{e.goToNext(),N||_e()},onToday:()=>{e.goToToday(),N||ze()}}),zt("div",{className:"df-week-header-row",onContextMenu:e=>e.preventDefault(),children:zt("div",{className:"df-week-grid",children:Ie.map((e,t)=>zt("div",{className:"df-day-label",children:e},`${e}-${t}`))})}),zt("div",N?{ref:je,className:`${Fn} df-month-view-fade-scroller`,"data-layout-ready":Q?"true":"false",children:zt("div",{className:"df-month-view-fade-body",style:_,children:Z.map((o,l)=>{const s=Re(o.startDate),d={index:l,weekData:o,top:l*X,height:X},c=5===l?Object.assign(Object.assign({},d),{height:d.height+qe}):d;return zt(Po,{item:c,weekHeight:X,showWeekNumbers:t.showWeekNumbers,showMonthIndicator:!1,currentMonth:"",currentYear:0,screenSize:V,isScrolling:!1,calendarRef:i,events:s,onEventUpdate:nt,onEventDelete:at,onMoveStart:De,onCreateStart:we,onResizeStart:be,isDragging:Ce,dragState:Te,newlyCreatedEventId:ae,onDetailPanelOpen:ot,onMoreEventsClick:e.onMoreEventsClick,onChangeView:rt,onSelectDate:e.selectDate,selectedEventId:ge,onEventSelect:st,onEventLongPress:dt,detailPanelEventId:me,onDetailPanelToggle:fe,customDetailPanelContent:n,customEventDetailDialog:a,useEventDetailPanel:r,onCalendarDrop:Se,onCalendarDragOver:Me,calendarSignature:z,app:e,enableTouch:q,appTimeZone:S},`week-${o.startDate.getTime()}`)})})}:{ref:je,className:`${Fn} df-month-view-virtual-scroller`,"data-layout-ready":Q?"true":"false",onScroll:Fe,children:[zt("div",{style:{height:Xe}}),Ge.map((o,l)=>{const s=Re(o.weekData.startDate),d=5===l?Object.assign(Object.assign({},o),{height:o.height+qe}):o,c=!(!1===t.showMonthIndicator||!o.weekData.days.some(e=>1===e.day))&&Ae;return zt(Po,{item:d,weekHeight:X,showWeekNumbers:t.showWeekNumbers,showMonthIndicator:t.showMonthIndicator,currentMonth:He,currentYear:Pe,screenSize:V,isScrolling:c,calendarRef:i,events:s,onEventUpdate:nt,onEventDelete:at,onMoveStart:De,onCreateStart:we,onResizeStart:be,isDragging:Ce,dragState:Te,newlyCreatedEventId:ae,onDetailPanelOpen:ot,onMoreEventsClick:e.onMoreEventsClick,onChangeView:rt,onSelectDate:e.selectDate,selectedEventId:ge,onEventSelect:st,onEventLongPress:dt,detailPanelEventId:me,onDetailPanelToggle:fe,customDetailPanelContent:n,customEventDetailDialog:a,useEventDetailPanel:r,onCalendarDrop:Se,onCalendarDragOver:Me,calendarSignature:z,app:e,enableTouch:q,appTimeZone:S},`week-${o.weekData.startDate.getTime()}`)}),zt("div",{style:{height:tt}})]}),zt(K,{isOpen:ie,onClose:()=>{oe(!1),se(null)},onSave:t=>{W.some(e=>e.id===t.id)?e.updateEvent(t.id,t):e.addEvent(t),oe(!1),se(null)},draftEvent:le,app:e})]})},jo={showWeekNumbers:!1,showMonthIndicator:!0,startOfWeek:1},Yo=e=>o(wo,Object.assign(Object.assign({},e),{viewType:x.MONTH,originalComponent:$o,className:"df-month-view-factory"}));Yo.displayName="MonthViewAdapter";const Fo=(e={})=>{const t=Object.assign(Object.assign({},jo),e);return{type:x.MONTH,component:Yo,config:t}};function Zo(e,t,n,a,r){if(0===t.length)return[];const i=t[0],o=t.at(-1);if(!i||!o)return[];const l=new Date(i.getFullYear(),i.getMonth(),i.getDate()).getTime(),s=new Date(o.getFullYear(),o.getMonth(),o.getDate(),23,59,59,999).getTime(),d=e.map(e=>{const t=Ne(e.start,r),n=e.end?Ne(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=xn(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),i=Math.round((a-l)/864e5);r=Math.max(0,Math.min(r,n-1)),i=Math.max(0,Math.min(i,n-1));const o=t>=l,d=a<=s;let c=0;for(;;){h[c]||(h[c]=[]);let e=!1;for(let t=r;t<=i;t++)if(h[c][t]){e=!0;break}if(!e){for(let e=r;e<=i;e++)h[c][e]=!0;break}c++}u.push({id:`${e.id}::year-${l}`,event:e,startCellIndex:r,endCellIndex:i,isFirstSegment:o,isLastSegment:d,visualRowIndex:c})}),u}const _o=(e,t,n,a)=>{if(!e)return!1;const r=new Date(t,n,1).getTime(),i=new Date(t,n+1,0,23,59,59,999).getTime(),o=Ne(e.start,a),l=e.end?Ne(e.end,a):o,s=new Date(o.getFullYear(),o.getMonth(),o.getDate()).getTime(),d=new Date(l.getFullYear(),l.getMonth(),l.getDate(),23,59,59,999).getTime();return s<=i&&d>=r};function zo(e,t,n,a=1,r){const i=new Date(n,t,1),o=new Date(n,t+1,0).getDate(),l=(i.getDay()-a+7)%7,s=i.getTime(),d=new Date(n,t,o,23,59,59,999).getTime(),c=e.filter(e=>!!e.start).map(e=>{const t=Ne(e.start,r),n=e.end?Ne(e.end,r):t,a=new Date(t.getFullYear(),t.getMonth(),t.getDate()),i=new Date(n.getFullYear(),n.getMonth(),n.getDate());return{event:e,startMs:a.getTime(),endMs:i.getTime(),eventStartDay:a,eventEndDay:i}}).filter(e=>e.startMs<=d&&e.endMs>=s);if(0===c.length)return{segments:[],maxVisualRow:-1};const u=xn(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=[],g=[];c.forEach(({event:e,startMs:a,endMs:r,eventStartDay:i,eventEndDay:o})=>{const c=Math.max(a,s),u=Math.min(r,d),m=new Date(c).getDate(),v=new Date(u).getDate(),f=l+(m-1),p=l+(v-1),y=i.getMonth()===t&&i.getFullYear()===n,D=o.getMonth()===t&&o.getFullYear()===n;let w=0;for(;;){g[w]||(g[w]=[]);let e=!1;for(let t=f;t<=p;t++)if(g[w][t]){e=!0;break}if(!e){for(let e=f;e<=p;e++)g[w][e]=!0;break}w++}h.push({id:`${e.id}::month-${t}`,event:e,startCellIndex:f,endCellIndex:p,isFirstSegment:y,isLastSegment:D,visualRowIndex:w,monthIndex:t})});const m=h.length>0?Math.max(...h.map(e=>e.visualRowIndex)):-1;return{segments:h,maxVisualRow:m}}const Uo=h(({date:e,isToday:t,locale:n,onSelectDate:a,onCreateStart:r,onMoreEventsClick:i,moreCount:o=0,onContextMenu:l})=>{const{t:s}=An(),d=e.getDate(),c=1===d,u=e.toLocaleDateString(n,{month:"short"}).toUpperCase();return zt("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:[zt("div",{className:"df-year-day-cell-header",children:[c&&zt("span",{className:"df-year-day-cell-month-pill",children:u}),zt("span",{className:"df-year-day-cell-date","data-today":t?"true":"false",children:d})]}),o>0&&zt("div",{className:"df-year-day-cell-more-wrap",children:zt("span",{className:"df-year-day-cell-more",onClick:t=>{t.stopPropagation(),null==i||i(e)},children:["+",o," ",s("more")]})})]})});Uo.displayName="YearDayCell";const Wo=(e,t,n)=>{if(!e||0===t.length)return!1;const a=t[0],r=t.at(-1);if(!a||!r)return!1;const i=new Date(a.getFullYear(),a.getMonth(),a.getDate()).getTime(),o=new Date(r.getFullYear(),r.getMonth(),r.getDate(),23,59,59,999).getTime(),l=Ne(e.start,n),s=e.end?Ne(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<=o&&c>=i},Bo=h(({rowDays:e,events:t,columnsPerRow:n,app:a,calendarRef:r,locale:i,isDragging:o,dragState:l,onMoveStart:s,onResizeStart:d,onCreateStart:c,selectedEventId:u,onEventSelect:h,onMoreEventsClick:g,newlyCreatedEventId:m,onDetailPanelOpen:v,detailPanelEventId:y,onDetailPanelToggle:D,customDetailPanelContent:w,customEventDetailDialog:b,useEventDetailPanel:E,onContextMenu:C,appTimeZone:T,dragPreviewEvent:S})=>{const M=p(()=>{const e=Ve(T);return e.setHours(0,0,0,0),e},[T]),N=f((e,t)=>{e.preventDefault(),e.stopPropagation(),C({x:e.clientX,y:e.clientY,date:t})},[C]),I=f(e=>{a.selectDate(e)},[a]),k=p(()=>Zo(t,e,n,a.state.allDaySortComparator,T),[t,e,n,a.state.allDaySortComparator,T]),O=o&&"move"===l.mode&&!!S&&S.id===l.eventId,R=p(()=>{if(!S)return k;if(O)return k;const r=t.filter(e=>e.id!==S.id);return Wo(S,e,T)&&r.push(S),Zo(r,e,n,a.state.allDaySortComparator,T)},[S,O,k,t,e,n,a.state.allDaySortComparator,T]),H=p(()=>O?((e,t,n,a)=>{if(!e||0===t.length)return null;const r=t[0],i=t.at(-1);if(!r||!i)return null;const o=new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime(),l=new Date(i.getFullYear(),i.getMonth(),i.getDate(),23,59,59,999).getTime(),s=Ne(e.start,a),d=e.end?Ne(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<o)return null;let h=Math.round((Math.max(c,o)-o)/864e5),g=Math.round((Math.min(u,l)-o)/864e5);return h=Math.max(0,Math.min(h,n-1)),g=Math.max(0,Math.min(g,n-1)),{id:`${e.id}::preview-year-${o}`,event:e,startCellIndex:h,endCellIndex:g,isFirstSegment:c>=o,isLastSegment:u<=l,visualRowIndex:0}})(S,e,n,T):null,[O,S,e,n,T]),{visibleSegments:P,moreCounts:A}=p(()=>{const t=Array.from({length:e.length}).fill(0);R.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 R.forEach(r=>{let i=!0;const o=Math.max(0,r.startCellIndex),l=Math.min(e.length-1,r.endCellIndex);for(let e=o;e<=l;e++){const n=t[e]>3?1:2;if(r.visualRowIndex>n){i=!1;break}}if(i)n.push(r);else for(let e=o;e<=l;e++)a[e]++}),{visibleSegments:n,moreCounts:a}},[R,e.length]),L=p(()=>{if(!O||!l.eventId)return R;const e=R.filter(e=>e.event.id!==l.eventId);return H?[...e,H]:e},[O,l.eventId,R,H]);return zt("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()===M.getTime();return zt(Uo,{date:e,isToday:n,locale:i,onSelectDate:I,onCreateStart:c,onMoreEventsClick:g,moreCount:A[t],onContextMenu:N},e.getTime())}),zt("div",{className:"df-year-row-event-layer",style:{top:26,bottom:0,left:0,right:0},onContextMenu:e=>e.preventDefault(),children:zt("div",{className:"df-year-row-event-layer-inner",children:(O&&l.eventId?L.filter(e=>P.some(t=>t.id===e.id)||e.id===(null==H?void 0:H.id)):P).map(e=>zt("div",{className:"df-year-row-event-hitbox",children:zt(Ei,{event:e.event,isAllDay:!!e.event.allDay,viewType:x.YEAR,yearSegment:e,columnsPerRow:n,isBeingDragged:o&&l.eventId===e.event.id,selectedEventId:u,onMoveStart:s,onResizeStart:d,onEventSelect:h,onDetailPanelToggle:D,newlyCreatedEventId:m,onDetailPanelOpen:v,calendarRef:r,app:a,detailPanelEventId:y,customDetailPanelContent:w,customEventDetailDialog:b,useEventDetailPanel:E,firstHour:0,hourHeight:0,onEventUpdate:e=>a.updateEvent(e.id,e),onEventDelete:e=>a.deleteEvent(e),appTimeZone:T})},e.id))})})]})},(e,t)=>{var n,a;const r=null===(n=e.dragPreviewEvent)||void 0===n?void 0:n.id,i=null===(a=t.dragPreviewEvent)||void 0===a?void 0:a.id,o=!!r&&e.events.some(e=>e.id===r)||!!i&&t.events.some(e=>e.id===i),l=Wo(e.dragPreviewEvent,e.rowDays,e.appTimeZone),s=Wo(t.dragPreviewEvent,t.rowDays,t.appTimeZone);return!(o||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.useEventDetailPanel===t.useEventDetailPanel&&e.onContextMenu===t.onContextMenu&&e.appTimeZone===t.appTimeZone});Bo.displayName="YearRowComponent";const Vo=({app:e,calendarRef:t,customDetailPanelContent:a,customEventDetailDialog:r,useEventDetailPanel:i,config:o,selectedEventId:l,onEventSelect:s,detailPanelEventId:d,onDetailPanelToggle:c})=>{var u;const{t:h,locale:D}=An(),w=e.getCurrentDate(),b=w.getFullYear(),E=e.getEvents(),C=e.timeZone,T=v(null),[S,M]=g(7),[N,I]=g(!1),[k,O]=g(()=>"undefined"!=typeof window&&window.innerWidth<768),[R,H]=g(null),[P,A]=g(null),L=void 0===l?R:l,$=void 0===d?P:d,[j,Y]=g(null),F=f(e=>{s?s(e):H(e)},[s]),Z=f(e=>{c?c(e):A(e)},[c]),_=f(()=>{Y(null)},[]),[z,U]=g(null),W=e.canMutateFromUI();m(()=>{W||U(null)},[W]),m(()=>{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]"),i=t.closest("[data-range-picker-popup]"),o=t.closest("[data-calendar-picker-dropdown]"),l=t.closest(".df-context-menu");n||a||r||i||o||l||(F(null),Z(null),U(null))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const B=v(null);y(()=>{const e=T.current;if(!e)return;const t=e=>{if(e<=0)return;const t=Math.max(1,Math.floor(e/80));M(t),O(e<768),I(!0)};t(e.clientWidth);const n=new ResizeObserver(e=>{B.current&&clearTimeout(B.current),B.current=setTimeout(()=>{const n=e[0].contentRect.width;t(n)},60)});return n.observe(e),()=>{n.disconnect(),B.current&&clearTimeout(B.current)}},[]);const V=v(e.state.highlightedEventId);m(()=>{e.state.highlightedEventId?(F(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(),i=r.top-a.top+t.scrollTop-t.clientHeight/2+r.height/2;t.scrollTo({top:Math.max(0,i),behavior:"smooth"})})):V.current&&F(null),V.current=e.state.highlightedEventId},[e.state.highlightedEventId]);const{handleMoveStart:q,handleResizeStart:G,handleCreateStart:K,dragState:X,isDragging:J}=yo(e,{calendarRef:t,viewType:x.YEAR,onEventsUpdate:(t,n,a)=>{const r=t(E).filter(e=>{const t=E.find(t=>t.id===e.id);return t&&Tt(t,e)});r.length>0&&e.applyEventsChanges({update:r.map(e=>({id:e.id,updates:e}))},n,a)},currentWeekStart:new Date,events:E,onEventCreate:t=>{e.addEvent(t)},onEventEdit:e=>{Y(e.id)},isMobile:k}),Q=X,ee=null!==(u=null==o?void 0:o.showTimedEventsInYearView)&&void 0!==u&&u,te=f((t,a)=>{if(ee)null==K||K(t,a);else{const t=n.PlainDate.from({year:a.getFullYear(),month:a.getMonth()+1,day:a.getDate()}),r={id:`event-${Date.now()}`,title:h("newEvent")||"New Event",start:t,end:t,allDay:!0,calendarId:e.getCalendarRegistry().getDefaultCalendarId()||"default"};e.addEvent(r),Y(r.id)}},[ee,K,e,h]),ne=p(()=>{const e=[],t=new Date(b,0,1),n=new Date(b,11,31);for(let a=t.getTime();a<=n.getTime();a+=864e5)e.push(new Date(a));return e},[b]),ae=p(()=>function(e,t){const n=[];for(let a=0;a<e.length;a+=t)n.push(e.slice(a,a+t));return n}(ne,S),[ne,S]),re=p(()=>{const e=new Date(b,0,1),t=new Date(b,11,31,23,59,59);return E.filter(n=>{if(!n.start)return!1;if(!ee&&!n.allDay)return!1;const a=Ne(n.start,C),r=n.end?Ne(n.end,C):a;return a<=t&&r>=e})},[E,b,ee,C]),ie=p(()=>{const e=re.map(e=>{const t=Ne(e.start,C),n=e.end?Ne(e.end,C):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 ae.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(),i=new Date(a.getFullYear(),a.getMonth(),a.getDate(),23,59,59,999).getTime();return e.filter(e=>e.startMs<=i&&e.endMs>=r).map(e=>e.event)})},[ae,re,C]),oe=p(()=>{if(!J||!Q.eventId||!Q.startDate||!Q.endDate||"move"!==Q.mode&&"resize"!==Q.mode)return null;const e=re.find(e=>e.id===Q.eventId);return e?Object.assign(Object.assign({},e),{start:e.allDay?ke(Q.startDate):Oe(Q.startDate,C),end:e.allDay?ke(Q.endDate):Oe(Q.endDate,C)}):null},[J,Q.eventId,Q.startDate,Q.endDate,Q.mode,re,C]);return zt("div",{className:Ln,onContextMenu:e=>e.preventDefault(),children:[zt(Ti,{calendar:e,viewType:x.YEAR,currentDate:w,customTitle:D.startsWith("zh")||D.startsWith("ja")?`${b}年`:`${b}`,onPrevious:()=>{const t=new Date(w);t.setFullYear(t.getFullYear()-1),e.setCurrentDate(t)},onNext:()=>{const t=new Date(w);t.setFullYear(t.getFullYear()+1),e.setCurrentDate(t)},onToday:()=>{e.goToToday()}}),zt("div",{ref:T,className:`df-year-default-scroll ${Fn} df-scrollbar-hide`,children:zt("div",{className:"df-year-default-rows",style:{opacity:N?1:0,transition:"opacity 0.2s ease"},children:ae.map((n,o)=>zt(Bo,{rowDays:n,events:ie[o],columnsPerRow:S,app:e,calendarRef:t,locale:D,isDragging:J,dragState:Q,dragPreviewEvent:oe,onMoveStart:q,onResizeStart:G,onCreateStart:te,selectedEventId:L,onEventSelect:F,onMoreEventsClick:e.onMoreEventsClick,newlyCreatedEventId:j,onDetailPanelOpen:_,detailPanelEventId:$,onDetailPanelToggle:Z,customDetailPanelContent:a,customEventDetailDialog:r,useEventDetailPanel:i,onContextMenu:e=>{W&&U(e)},appTimeZone:C},o))})}),W&&z&&zt(Qr,{x:z.x,y:z.y,date:z.date,viewType:x.YEAR,onClose:()=>U(null),app:e,onCreateEvent:()=>{if(z&&z.date){const e={preventDefault:()=>{},stopPropagation:()=>{},clientX:z.x,clientY:z.y};te(e,z.date)}}})]})},qo=({app:e,calendarRef:t,customDetailPanelContent:a,customEventDetailDialog:r,useEventDetailPanel:i,config:o,selectedEventId:l,onEventSelect:s,detailPanelEventId:d,onDetailPanelToggle:c})=>{var u,h;const{t:y,locale:D,getWeekDaysLabels:w}=An(),b=e.getCurrentDate(),E=b.getFullYear(),C=e.getEvents(),T=e.timeZone,S=Ve(T);S.setHours(0,0,0,0);const M=null!==(u=null==o?void 0:o.startOfWeek)&&void 0!==u?u:1,N=v(null),I=v(null),k=v(null),[O,R]=g(0),[H,P]=g(0),[A,L]=g(null),[$,j]=g(null),Y=p(()=>Gt(),[]),F=void 0===l?A:l,Z=void 0===d?$:d,_=e=>{s?s(e):L(e)},z=e=>{c?c(e):j(e)},[U,W]=g(null),[B,V]=g(null),q=e.canMutateFromUI();m(()=>{q||V(null)},[q]),m(()=>{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]"),i=t.closest("[data-range-picker-popup]"),o=t.closest("[data-calendar-picker-dropdown]");n||a||r||i||o||(_(null),z(null))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const G=v(e.state.highlightedEventId);m(()=>{e.state.highlightedEventId?(_(e.state.highlightedEventId),requestAnimationFrame(()=>{const t=k.current;if(!t)return;const n=t.querySelector(`[data-event-id="${e.state.highlightedEventId}"]`);if(!n)return;const a=t.getBoundingClientRect(),r=n.getBoundingClientRect(),i=r.top-a.top+t.scrollTop-t.clientHeight/2+r.height/2,o=r.left-a.left+t.scrollLeft-t.clientWidth/2+r.width/2;t.scrollTo({top:Math.max(0,i),left:Math.max(0,o),behavior:"smooth"})})):G.current&&_(null),G.current=e.state.highlightedEventId},[e.state.highlightedEventId]);const K=p(()=>((e,t)=>{let n=0;for(let a=0;a<12;a++){const r=new Date(e,a,1),i=new Date(e,a+1,0).getDate(),o=(r.getDay()-t+7)%7+i;o>n&&(n=o)}return n})(E,M),[E,M]),{handleMoveStart:X,handleResizeStart:J,handleCreateStart:Q,dragState:ee,isDragging:te}=yo(e,{calendarRef:t,viewType:x.YEAR,onEventsUpdate:(t,n,a)=>{const r=t(C).filter(e=>{const t=C.find(t=>t.id===e.id);return t&&Tt(t,e)});r.length>0&&e.applyEventsChanges({update:r.map(e=>({id:e.id,updates:e}))},n,a)},currentWeekStart:new Date,events:C,onEventCreate:t=>{e.addEvent(t)},onEventEdit:e=>{W(e.id)}}),ne=ee,ae=null!==(h=null==o?void 0:o.showTimedEventsInYearView)&&void 0!==h&&h,re=f((t,a)=>{if(ae)null==Q||Q(t,a);else{const t=n.PlainDate.from({year:a.getFullYear(),month:a.getMonth()+1,day:a.getDate()}),r={id:`event-${Date.now()}`,title:y("newEvent")||"New Event",start:t,end:t,allDay:!0};e.addEvent(r),W(r.id)}},[ae,Q,e,y]),ie=p(()=>(({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()}),i=[];for(let e=0;e<t;e++)i.push(r[e%7]);return i})({locale:D,totalColumns:K,startOfWeek:M,getWeekDaysLabels:w}),[D,K,M,w]),oe=p(()=>{const e=new Date(E,0,1),t=new Date(E,11,31,23,59,59);return C.filter(n=>{if(!n.start)return!1;if(!ae&&!n.allDay)return!1;const a=Ne(n.start,T),r=n.end?Ne(n.end,T):a;return a<=t&&r>=e})},[C,E,ae,T]),le=p(()=>(({currentYear:e,locale:t,totalColumns:n,yearEvents:a,startOfWeek:r,appTimeZone:i})=>{const o=[];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"}),g=h.charAt(0).toUpperCase()+h.slice(1).toLowerCase(),{segments:m,maxVisualRow:v}=zo(a,l,e,r,i),f=v+1,p=Math.max(60,20+18*f);o.push({monthIndex:l,monthName:g,days:u,monthEvents:a.filter(t=>_o(t,e,l,i)),eventSegments:m,minHeight:p})}return o})({currentYear:E,locale:D,totalColumns:K,yearEvents:oe,startOfWeek:M,appTimeZone:T}),[E,D,K,oe,M,T]),se=p(()=>(({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?ke(t.startDate):Oe(t.startDate,a),end:r.allDay?ke(t.endDate):Oe(t.endDate,a)}):null})({isDragging:te,dragState:ne,yearEvents:oe,appTimeZone:T}),[te,ne,oe,T]),de=te&&"move"===ne.mode&&!!se&&se.id===ne.eventId,ce=p(()=>(({monthsData:e,dragPreviewEvent:t,isMovePreviewActive:n,currentYear:a,startOfWeek:r,appTimeZone:i})=>e.map(e=>{if(n)return e;if(!t||!e.monthEvents.some(e=>e.id===t.id)&&!_o(t,a,e.monthIndex,i))return e;const o=e.monthEvents.filter(e=>e.id!==(null==t?void 0:t.id));t&&_o(t,a,e.monthIndex,i)&&o.push(t);const{segments:l,maxVisualRow:s}=zo(o,e.monthIndex,a,r,i);return Object.assign(Object.assign({},e),{eventSegments:l,minHeight:Math.max(60,20+18*(s+1))})}))({monthsData:le,dragPreviewEvent:se,isMovePreviewActive:de,currentYear:E,startOfWeek:M,appTimeZone:T}),[le,se,de,E,M,T]),ue=f(e=>{const t=e.currentTarget;N.current&&(N.current.scrollLeft=t.scrollLeft),I.current&&(I.current.scrollTop=t.scrollTop)},[]);return m(()=>{const e=()=>{if(k.current){const e=k.current,t=e.offsetHeight-e.clientHeight,n=e.offsetWidth-e.clientWidth;P(e=>e===t?e:t),R(e=>e===n?e:n)}},t=k.current;if(!t)return;e();const n=new ResizeObserver(()=>{e()});return n.observe(t),()=>{n.disconnect()}},[ce]),zt("div",{className:"df-year-fixed",onContextMenu:e=>e.preventDefault(),children:[zt("div",{className:"df-year-fixed-header-span",children:zt(Ti,{calendar:e,viewType:x.YEAR,currentDate:b,customTitle:D.startsWith("zh")||D.startsWith("ja")?`${E}年`:`${E}`,onPrevious:()=>{const t=new Date(b);t.setFullYear(t.getFullYear()-1),e.setCurrentDate(t)},onNext:()=>{const t=new Date(b);t.setFullYear(t.getFullYear()+1),e.setCurrentDate(t)},onToday:()=>{e.goToToday()}})}),zt("div",{className:"df-year-fixed-corner"}),zt("div",{ref:N,className:"df-year-fixed-week-header",children:zt("div",{className:"df-year-fixed-week-header-inner",style:{minWidth:`calc(1352px + ${O}px)`},children:[zt("div",{className:"df-year-fixed-week-grid",style:{gridTemplateColumns:`repeat(${K}, minmax(0, 1fr))`,minWidth:"1352px"},children:ie.map((e,t)=>{const n=(t+M)%7;return zt("div",{className:"df-year-fixed-week-label","data-weekend":0===n||6===n?"true":"false",children:e},`label-${t}`)})}),O>0&&zt("div",{className:"df-year-fixed-week-spacer","data-scrollbar-space":Y?"true":"false",style:{width:`${O}px`}})]})}),zt("div",{ref:I,className:"df-year-fixed-month-sidebar",children:zt("div",{className:"df-year-fixed-month-sidebar-inner",children:[ce.map(e=>zt("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)),H>0&&zt("div",{className:"df-year-fixed-month-spacer","data-scrollbar-space":Y?"true":"false",style:{height:`${H}px`}})]})}),zt("div",{ref:k,className:"df-year-fixed-content",onScroll:ue,children:zt("div",{className:"df-year-fixed-content-inner",style:{minWidth:"1352px"},children:ce.map(n=>{const o=de&&se?((e,t,n,a=1,r)=>{if(!e)return null;const i=new Date(n,t,1),o=new Date(n,t+1,0).getDate(),l=(i.getDay()-a+7)%7,s=i.getTime(),d=new Date(n,t,o,23,59,59,999).getTime(),c=Ne(e.start,r),u=e.end?Ne(e.end,r):c,h=new Date(c.getFullYear(),c.getMonth(),c.getDate()),g=new Date(u.getFullYear(),u.getMonth(),u.getDate()),m=h.getTime(),v=g.getTime();if(m>d||v<s)return null;const f=Math.max(m,s),p=Math.min(v,d);return{id:`${e.id}::preview-month-${t}`,event:e,startCellIndex:l+(new Date(f).getDate()-1),endCellIndex:l+(new Date(p).getDate()-1),isFirstSegment:h.getMonth()===t&&h.getFullYear()===n,isLastSegment:g.getMonth()===t&&g.getFullYear()===n,visualRowIndex:0,monthIndex:t}})(se,n.monthIndex,E,M,T):null,l=de&&ne.eventId?[...n.eventSegments.filter(e=>e.event.id!==ne.eventId),...o?[o]:[]]:n.eventSegments;return zt("div",{className:"df-year-fixed-month-row",style:{minHeight:`${n.minHeight}px`,transition:"min-height 180ms cubic-bezier(0.22, 1, 0.36, 1)"},children:[zt("div",{className:"df-year-fixed-background-grid",style:{gridTemplateColumns:`repeat(${K}, minmax(0, 1fr))`},children:n.days.map((t,a)=>{const r=(a+M)%7,i=0===r||6===r;if(!t)return zt("div",{className:"df-year-fixed-empty-cell","data-weekend":i?"true":"false"},`empty-${n.monthIndex}-${a}`);const o=(e=>e.getTime()===S.getTime())(t);return zt("div",{"data-date":`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`,className:"df-year-fixed-day-cell","data-dragging":te?"true":"false","data-weekend":i?"true":"false",onClick:()=>e.selectDate(t),onDblClick:e=>re(e,t),onContextMenu:e=>((e,t)=>{e.preventDefault(),e.stopPropagation(),q&&V({x:e.clientX,y:e.clientY,date:t})})(e,t),children:zt("span",{className:"df-year-fixed-day-number","data-today":o?"true":"false",children:t.getDate()})},t.getTime())})}),l.length>0&&zt("div",{className:"df-year-fixed-event-layer",style:{top:20},children:zt("div",{className:"df-year-fixed-event-layer-inner",children:l.map(n=>zt("div",{className:"df-year-fixed-event-hitbox",children:zt(Ei,{event:n.event,isAllDay:!!n.event.allDay,viewType:x.YEAR,yearSegment:n,columnsPerRow:K,isBeingDragged:te&&ne.eventId===n.event.id,selectedEventId:F,onMoveStart:X,onResizeStart:J,onEventSelect:_,onDetailPanelToggle:z,newlyCreatedEventId:U,onDetailPanelOpen:()=>W(null),calendarRef:t,app:e,detailPanelEventId:Z,customDetailPanelContent:a,customEventDetailDialog:r,useEventDetailPanel:i,firstHour:0,hourHeight:0,onEventUpdate:t=>e.updateEvent(t.id,t),onEventDelete:t=>e.deleteEvent(t),appTimeZone:T})},n.id))})})]},n.monthIndex)})})}),q&&B&&zt(Qr,{x:B.x,y:B.y,date:B.date,viewType:x.YEAR,onClose:()=>V(null),app:e,onCreateEvent:()=>{const e={preventDefault:()=>{},stopPropagation:()=>{},clientX:B.x,clientY:B.y};re(e,B.date)}})]})},Go=({date:e,events:t,anchorEl:n,position:a,onClose:r,locale:o,app:l,customContent:s,appTimeZone:d})=>{const{t:u}=An(),h=v(null);m(()=>{const e=e=>{const t=e.target;!h.current||h.current.contains(t)||n.contains(t)||r()},t=e=>{"Escape"===e.key&&r()};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[n,r]);const g=l.getCalendars(),f=new Map(g.map(e=>[e.id,e])),p=e.toLocaleDateString(o,{weekday:"long",month:"long",day:"numeric"}),y=zt(i,{children:[zt("div",{className:"df-year-popup-header",children:zt("div",{className:"df-year-popup-title",children:p})}),zt("div",{className:"df-year-popup-body",children:0===t.length?zt("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 i="";return!e.allDay&&e.start&&(i=Ne(e.start,d).toLocaleTimeString(o,{hour:"2-digit",minute:"2-digit",hour12:!1}),e.end&&(i+=` – ${Ne(e.end,d).toLocaleTimeString(o,{hour:"2-digit",minute:"2-digit",hour12:!1})}`)),zt("div",{className:"df-year-popup-event",children:[zt("div",{className:"df-year-popup-dot",style:{backgroundColor:r}}),zt("div",{className:"df-year-popup-event-main",children:[zt("div",{className:"df-year-popup-event-title",children:e.title}),e.allDay&&zt("div",{className:"df-year-popup-event-meta",children:u("allDay")}),i&&zt("div",{className:"df-year-popup-event-meta",children:i})]})]},e.id)})})]});return c(zt("div",{ref:h,"data-grid-day-popup":!0,className:"df-year-popup df-animate-in df-fade-in df-zoom-in-95",style:{top:a.top,left:a.left},children:s?s(e,t):y}),document.body)};function Ko(e,t,n,a){const r=new Map,i=new Date(t,0,1);i.setHours(0,0,0,0);const o=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=Ne(l.start,a),s=l.end?Ne(l.end,a):new Date(e);if(e.setHours(0,0,0,0),s.setHours(0,0,0,0),e>o||s<i)continue;const d=e<i?new Date(i):new Date(e),c=s>o?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(),g=Math.round((c.getTime()-h)/u);for(let e=0;e<=g;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 Xo(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 i=t.top;return i+220>a-8&&(i=a-220-8),i=Math.max(8,i),{top:i,left:r}}const Jo=({app:e,config:t})=>{var n,a,r;const{locale:i,getWeekDaysLabels:o}=An(),l=e.getCurrentDate(),s=l.getFullYear(),d=e.getEvents(),c=null!==(n=null==t?void 0:t.startOfWeek)&&void 0!==n?n:1,u=null!==(a=null==t?void 0:t.showTimedEventsInYearView)&&void 0!==a&&a,h=null!==(r=null==t?void 0:t.gridHeatmapLevels)&&void 0!==r?r:5,v=e.timeZone,y=p(()=>{const e=Ve(v);return e.setHours(0,0,0,0),e},[v]),[D,w]=g(null);m(()=>{if(!D)return;const e=e=>{const t=e.target;t.closest("[data-grid-day-popup]")||t.closest("[data-grid-day-cell]")||w(null)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[D]);const b=p(()=>Ko(d,s,u,v),[d,s,u,v]),E=p(()=>Ko(d,s,!0,v),[d,s,v]),C=p(()=>o(i,"narrow",c).map(e=>i.startsWith("zh")?e.at(-1):e.charAt(0).toUpperCase()),[i,o,c]),T=p(()=>{const e=[];for(let t=0;t<12;t++){const n=new Date(s,t,1),a=new Date(s,t+1,0).getDate(),r=[];for(let e=(n.getDay()-c+7)%7-1;e>=0;e--)r.push({date:new Date(s,t,-e),isCurrentMonth:!1});for(let e=1;e<=a;e++)r.push({date:new Date(s,t,e),isCurrentMonth:!0});let o=1;for(;r.length<42;)r.push({date:new Date(s,t+1,o++),isCurrentMonth:!1});const l=n.toLocaleDateString(i,{month:"long"}),d=l.charAt(0).toUpperCase()+l.slice(1);e.push({monthIndex:t,monthName:d,cells:r})}return e},[s,i,c]),S=f((n,a,r)=>{var i,o;const l=null!==(i=null==t?void 0:t.gridDateClick)&&void 0!==i?i:"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!==(o=E.get(e))&&void 0!==o?o:[])}if("popup"===l){const e=n.currentTarget;D&&D.date.getTime()===a.getTime()&&D.monthIndex===r?w(null):w({date:a,monthIndex:r,anchorEl:e,position:Xo(e)})}else"day-view"===l&&(e.setCurrentDate(a),e.changeView(x.DAY))},[t,e,D,E]),M=f(n=>{var a,r;const i=null!==(a=null==t?void 0:t.gridDateDoubleClick)&&void 0!==a?a:"day-view";if("function"==typeof i){const e=`${n.getFullYear()}-${String(n.getMonth()+1).padStart(2,"0")}-${String(n.getDate()).padStart(2,"0")}`;return void i(n,null!==(r=E.get(e))&&void 0!==r?r:[])}"day-view"===i&&(w(null),e.setCurrentDate(n),e.changeView(x.DAY))},[t,e,E]),N=p(()=>{var e;if(!D)return[];const t=`${D.date.getFullYear()}-${String(D.date.getMonth()+1).padStart(2,"0")}-${String(D.date.getDate()).padStart(2,"0")}`;return[...null!==(e=E.get(t))&&void 0!==e?e:[]].toSorted((e,t)=>{const n=!!e.allDay;return n!==!!t.allDay?n?-1:1:0})},[D,E]);return zt("div",{className:Ln,children:[zt(Ti,{calendar:e,viewType:x.YEAR,currentDate:l,customTitle:i.startsWith("zh")||i.startsWith("ja")?`${s}年`:`${s}`,onPrevious:()=>{const t=new Date(l);t.setFullYear(t.getFullYear()-1),e.setCurrentDate(t)},onNext:()=>{const t=new Date(l);t.setFullYear(t.getFullYear()+1),e.setCurrentDate(t)},onToday:()=>e.goToToday()}),zt("div",{className:"df-year-grid",style:{gridTemplateColumns:"repeat(4, 1fr)",gridTemplateRows:"repeat(3, 1fr)"},children:T.map(e=>zt("div",{className:"df-year-grid-month df-year-grid-month",children:[zt("div",{className:"df-year-grid-month-title",children:e.monthName}),zt("div",{className:"df-year-grid-month-body",children:zt("div",{className:"df-year-grid-calendar",style:{gridTemplateColumns:"repeat(7, 1fr)",gridTemplateRows:"repeat(7, 1fr)"},children:[C.map((e,t)=>zt("div",{className:"df-year-grid-weekday",children:e},t)),e.cells.map(({date:t,isCurrentMonth:n},a)=>{var r,i;const o=`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`,l=n&&null!==(i=null===(r=b.get(o))||void 0===r?void 0:r.length)&&void 0!==i?i:0,s=(c=h,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,h):{};return zt("div",{"data-grid-day-cell":!0,className:"df-year-grid-day","data-current-month":n?"true":"false",style:u,onClick:n=>S(n,t,e.monthIndex),onDblClick:()=>M(t),children:zt("div",{className:"df-year-grid-day-inner",children:zt("span",{className:"df-year-grid-day-number","data-today":t.getTime()===y.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))}),D&&zt(Go,{date:D.date,events:N,anchorEl:D.anchorEl,position:D.position,onClose:()=>w(null),locale:i,app:e,customContent:null==t?void 0:t.gridPopupContent,appTimeZone:v})]})},Qo=e=>{var t;const n=(null===(t=e.config)||void 0===t?void 0:t.mode)||"year-canvas";return"fixed-week"===n?zt(qo,Object.assign({},e)):"grid"===n?zt(Jo,{app:e.app,config:e.config}):zt(Vo,Object.assign({},e))},el={},tl=e=>o(wo,Object.assign(Object.assign({},e),{viewType:x.YEAR,originalComponent:Qo,className:"df-year-view-factory"}));tl.displayName="YearViewAdapter";const nl=(e={})=>{const t=Object.assign(Object.assign({},el),e);return{type:x.YEAR,component:tl,config:t}};function al(e){return[Co(null==e?void 0:e.day),Ro(null==e?void 0:e.week),Fo(null==e?void 0:e.month)]}const rl={enableAutoRecalculate:!0,enableValidation:!0,defaultEvents:[],maxEventsPerDay:50};function il(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}function ol(t={}){const n=Object.assign(Object.assign({},rl),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&&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=il(a.getCurrentDate());a.state.events=ft(a.getAllEvents(),e)}},update:(t,i)=>e(this,void 0,void 0,function*(){const e=r.getById(t);if(!e)throw new Error(`Event with id ${t} not found`);const o=Object.assign(Object.assign({},e),i);if(n.enableValidation){const e=r.validateEvent(o);if(e.length>0)throw new Error(`Event validation failed: ${e.join(", ")}`)}if(yield a.updateEvent(t,i),n.enableAutoRecalculate){const e=il(a.getCurrentDate());a.state.events=ft(a.getAllEvents(),e)}}),delete:t=>e(this,void 0,void 0,function*(){yield a.deleteEvent(t)}),getByDate:e=>a.getAllEvents().filter(t=>{const n=Y(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=Y(n.start),r=Y(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)=>ft(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}}export{Ia as AlertCircle,Na as AudioLines,Ua as BlossomColorPicker,Zt as CalendarApp,Ei as CalendarEvent,ie as CalendarRegistry,Yr as CalendarRenderer,va as Check,ha as ChevronDown,ua as ChevronRight,fa as ChevronsUpDown,za as ContentSlot,Ur as ContextMenu,Jr as ContextMenuColorPicker,Wr as ContextMenuItem,Vr as ContextMenuLabel,Br as ContextMenuSeparator,qa as CreateCalendarDialog,jr as CustomRenderingStore,Dr as DayflowRangePicker,Wa as DefaultColorPicker,br as DefaultEventDetailDialog,yi as DefaultEventDetailPanel,ei as EventContextMenu,co as EventLayoutCalculator,Qr as GridContextMenu,O as LAYOUT_CONFIG,M as LOCALES,Da as Loader2,Ba as LoadingButton,Pn as LocaleContext,Pa as LocaleProvider,Tr as MiniCalendar,Ta as PanelRightClose,Sa as PanelRightOpen,ga as Plus,Ye as TIME_STEP,P as TimeZone,R as VIRTUAL_MONTH_SCROLL_CONFIG,x as ViewType,H as WeekDataCache,V as addDays,ve as buildColorBarGradient,fe as buildDiagonalColorBarGradient,ye as buildDiagonalPatternBackground,mt as calculateDayIndex,ta as calendarPickerDropdown,jn as cancelButton,xa as capitalize,cn as clipboardStore,kn as compareAllDayDisplayPriority,Lt as compareViews,En as convertToDayFlowEvent,xn as createAllDayDisplayComparator,an as createAllDayEvent,kt as createConfigSyncSnapshot,X as createDateWithHour,Co as createDayView,Qt as createEvent,gt as createEventWithDate,bt as createEventWithPlainDateTime,Dt as createEventWithRealDate,Et as createEventWithZonedDateTime,tn as createEvents,ol as createEventsPlugin,Fo as createMonthView,Ht as createNormalizedCalendarAppConfigGetter,al as createStandardViews,F as createTemporalWithHour,rn as createTimedEvent,en as createTimezoneEvent,nn as createTimezoneEvents,Ro as createWeekView,nl as createYearView,ke as dateToPlainDate,xe as dateToPlainDateTime,Oe as dateToZonedDateTime,W as daysBetween,B as daysDifference,Sn as downloadICS,S as en,vn as escapeICSValue,K as extractHourFromDate,Pe as extractHourFromTemporal,wn as extractVEvents,pn as foldLine,Bt as formatDate,Ut as formatDateConsistent,mn as formatDateToICSTimestamp,_e as formatEventTimeRange,gn as formatICSDate,Wt as formatMonthYear,yn as formatProperty,Fe as formatTime,at as generateDayData,Tn as generateICS,Ue as generateSecondaryTimeSlots,Mt as generateUniKey,Dn as generateVEvent,it as generateWeekData,lt as generateWeekRange,ot as generateWeeksData,dt as getAllDayEventsForDay,Nn as getAllDayRangeMetrics,se as getCalendarColorsForHex,pe as getCalendarEventBgColors,me as getCalendarLineColors,xt as getCallbackConfigUpdate,nt as getCurrentWeekDates,ct as getDateByDayIndex,on as getDateObj,pt as getDayIndexByDate,Q as getEndOfDay,U as getEndOfTemporal,de as getEventBgColor,Ze as getEventEndHour,ce as getEventTextColor,st as getEventsForDay,yt as getEventsForWeek,ka as getIntlLabel,he as getLineColor,Ra as getMonthLabels,rt as getMonthYearOfWeek,qe as getNextHourRangeInTimeZone,Be as getNowInTimeZone,Le as getPlainDate,ge as getPrimaryCalendarId,sn as getSearchHeaderInfo,ue as getSelectedBgColor,J as getStartOfDay,z as getStartOfTemporal,Ot as getSyncConfigUpdates,St as getTestEvents,We as getTimezoneDisplayLabel,Ve as getTodayInTimeZone,Oa as getWeekDaysLabels,ee as getWeekNumber,tt as getWeekRange,dn as groupSearchResults,Tt as hasEventChanged,Mn as importICSFile,L as isDate,Nt as isDeepEqual,Ct as isEventDeepEqual,vt as isEventInWeek,ne as isMultiDayEvent,_ as isMultiDayTemporalEvent,Ce as isPlainDate,Te as isPlainDateTime,te as isSameDay,Z as isSamePlainDate,$e as isSameTemporal,k as isValidLocale,Se as isZonedDateTime,Qe as monthNames,Vt as normalizeCssWidth,ln as normalizeDate,I as normalizeLocale,Ee as normalizeTimeZoneValue,q as now,un as pad2,Cn as parseICS,hn as parseICSDate,bn as parseVEventLines,It as pickSyncableConfig,Re as plainDateTimeToDate,He as plainDateToDate,ft as recalculateEventDays,fo as registerDragImplementation,N as registerLocale,Hr as registerSidebarImplementation,Kt as resolveAppliedTheme,On as restoreTimedDragFromAllDayTransition,Ke as restoreVisualEventToCanonical,Ge as restoreVisualTimedTemporalToCanonical,ze as roundToTimeStep,Gt as scrollbarTakesSpace,Ae as setHourInTemporal,et as shortMonthNames,ra as sidebarContainer,ia as sidebarHeader,la as sidebarHeaderTitle,oa as sidebarHeaderToggle,In as sortAllDayByTitle,Fr as subscribeCalendar,Rt as syncCalendarAppConfig,Ha as t,Me as temporalToDate,Ne as temporalToVisualDate,Ie as temporalToVisualTemporal,G as today,fn as unescapeICSValue,ut as updateEventDateAndDay,wt as updateEventWithRealDate,yo as useDragForView,An as useLocale,Ar as useSidebarBridge,Xe as weekDays,Je as weekDaysFullName,j as zonedDateTimeToDate};