@dayflow/core 3.5.2 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 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 k(e){const t=e.split("-")[0].toLowerCase();return t in M?t:"en"}function I(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 W(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 U(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 W(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;if(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}))}),this.calendars.size>0&&0===this.getVisible().length){const e=this.calendars.keys().next().value;if(e){const t=this.calendars.get(e);this.calendars.set(e,Object.assign(Object.assign({},t),{isVisible:!0}))}}}register(e){this.calendars.set(e.id,e)}unregister(e){const t=this.calendars.get(e),n=!1!==(null==t?void 0:t.isVisible),a=this.calendars.delete(e);if(a&&n&&0===this.getVisible().length){const e=this.getAll()[0];e&&this.setVisibility(e.id,!0)}return a}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);if(n){if(!t&&this.getVisible().length<=1&&!1!==n.isVisible)return;this.calendars.set(e,Object.assign(Object.assign({},n),{isVisible:t}))}}setAllVisibility(e){if(this.calendars.forEach((t,n)=>{this.calendars.set(n,Object.assign(Object.assign({},t),{isVisible:e}))}),!e&&this.calendars.size>0){const e=this.calendars.keys().next().value;if(e){const t=this.calendars.get(e);this.calendars.set(e,Object.assign(Object.assign({},t),{isVisible:!0}))}}}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 ke(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 Ie(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?Ie(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),We=(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""}})},Ue=(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:Ie(Y(t.start)),end:Ce(t.end)?t.end:Ie(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 kt(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 It(e){return{callbacks:e.callbacks,syncableConfig:kt(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=It(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?I(e)?e:"en-US":e&&"object"==typeof e&&!I(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 Wt=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}`},Ut=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?Ie(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()}},kn=(e,t)=>e.title.localeCompare(t.title),In=(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,In(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",Wn="df-current-time-line",Un="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"})]}),ka=({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 Ia(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=Ia(e,t);if(n)return xa(n)}const a=k(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:I(e)?e:"en-US",messages:void 0}:e&&"string"!=typeof e&&!I(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 Wa=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})},Ua=({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(Wa,{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)},k=()=>{y(!1)},I=()=>{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:I,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:k,onCancel:I,styles:O},defaultContent:zt("div",{className:"df-create-calendar-dialog-picker-card",children:[zt(Ua,{color:m,onChange:N}),zt("div",{className:"df-create-calendar-dialog-picker-actions",children:[zt("button",{type:"button",onClick:I,className:"df-btn-sm df-btn-sm-ghost",children:r("cancel")}),zt("button",{type:"button",onClick:k,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(Wa,{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 k=e;if("hour"in k&&!("timeZoneId"in k)){const e=null!=t?t:n.Now.timeZoneId();if("function"==typeof k.toZonedDateTime)try{return k.toZonedDateTime(e)}catch(e){}return n.ZonedDateTime.from({timeZone:e,year:k.year,month:k.month,day:k.day,hour:k.hour,minute:k.minute,second:null!==(r=k.second)&&void 0!==r?r:0,millisecond:null!==(i=k.millisecond)&&void 0!==i?i:0,microsecond:null!==(o=k.microsecond)&&void 0!==o?o:0,nanosecond:null!==(l=k.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 k.timeZone?k.timeZone:null===(s=k.timeZone)||void 0===s?void 0:s.id)&&void 0!==d?d:k.timeZoneId)&&void 0!==c?c:t)&&void 0!==u?u:a?gr(a):void 0)&&void 0!==h?h:n.Now.timeZoneId();if("function"==typeof k.toZonedDateTime)try{return k.toZonedDateTime(r)}catch(e){}const i=null!=a?a:n.Now.zonedDateTimeISO(r);return n.ZonedDateTime.from({timeZone:r,year:null!==(g=k.year)&&void 0!==g?g:i.year,month:null!==(m=k.month)&&void 0!==m?m:i.month,day:null!==(v=k.day)&&void 0!==v?v:i.day,hour:null!==(p=null!==(f=k.hour)&&void 0!==f?f:null==a?void 0:a.hour)&&void 0!==p?p:0,minute:null!==(D=null!==(y=k.minute)&&void 0!==y?y:null==a?void 0:a.minute)&&void 0!==D?D:0,second:null!==(b=null!==(w=k.second)&&void 0!==w?w:null==a?void 0:a.second)&&void 0!==b?b:0,millisecond:null!==(C=null!==(E=k.millisecond)&&void 0!==E?E:null==a?void 0:a.millisecond)&&void 0!==C?C:0,microsecond:null!==(S=null!==(T=k.microsecond)&&void 0!==T?T:null==a?void 0:a.microsecond)&&void 0!==S?S:0,nanosecond:null!==(N=null!==(M=k.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",showTimeFormat:a="HH:mm",showTime:r=!0,onChange:i,onOk:o,timeZone:l=n.Now.timeZoneId(),startOfWeek:s=1,disabled:d=!1,placement:u="bottomLeft",autoAdjustOverflow:h=!0,getPopupContainer:y,matchTriggerWidth:D=!1,locale:w="en-US"})=>{const b=p(()=>"string"==typeof w?w:(null==w?void 0:w.code)||"en-US",[w]),E=p(()=>void 0===r||"object"==typeof r||Boolean(r),[r]),C=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})(b,"short"),[b]),T=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})(b,"narrow",s),[b,s]),S=p(()=>E?"object"==typeof r&&(null==r?void 0:r.format)?r.format:a:"",[E,r,a]),M=p(()=>cr(t,S),[t,S]),N=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)})(M),[M]),k=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,x]=g(k),O=v(k),[R,H]=g("start"),[P,A]=g([vr(k[0],t,S),vr(k[1],t,S)]),L=v([vr(k[0],t,S),vr(k[1],t,S)]),$=v(k),[j,Y]=g(k[0].toPlainDate().with({day:1})),[F,Z]=g(!1),_=f(e=>{Z(e)},[]),[z,W]=g(u),U=v(u),B=v(null),V=v(null),q=v({start:{hour:null,minute:null},end:{hour:null,minute:null}}),G=v(!1),K=v(!1);m(()=>{L.current=P},[P]),m(()=>{$.current=I},[I]),m(()=>{const e=O.current,t=0!==n.ZonedDateTime.compare(e[0],k[0])||e[0].timeZoneId!==k[0].timeZoneId,a=0!==n.ZonedDateTime.compare(e[1],k[1])||e[1].timeZoneId!==k[1].timeZoneId;(t||a)&&x(k),O.current=k},[k]),m(()=>{Y(k[0].toPlainDate().with({day:1}))},[k[0]]);const X=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})},[]),J=f(e=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{const t=q.current[e];["hour","minute"].forEach(e=>{const n=t[e];if(!n)return;const a=n.querySelector('[data-active="true"]');a&&X(n,a,0)})})})},[X]);m(()=>{F&&E&&J(R)},[R,F,J,E]);const Q=I[0].epochMilliseconds,ee=I[0].offsetNanoseconds,te=I[1].epochMilliseconds,ne=I[1].offsetNanoseconds;m(()=>{if(K.current)return;const[e,n]=$.current,a=vr(e,t,S),r=vr(n,t,S),[i,o]=L.current;i===a&&o===r||(L.current=[a,r],A([a,r]))},[Q,ee,te,ne,t,S]),m(()=>{if(!F)return;const e=e=>{var t,n;const a=e.target;(null===(t=B.current)||void 0===t?void 0:t.contains(a))||(null===(n=V.current)||void 0===n?void 0:n.contains(a))||a.closest("[data-range-picker-popup]")||_(!1)};return document.addEventListener("pointerdown",e,!0),()=>{document.removeEventListener("pointerdown",e,!0)}},[F]),m(()=>{F||(H("start"),G.current||x(k),G.current=!1)},[F,k]);const ae=f(e=>{i&&i(e,[vr(e[0],t,S),vr(e[1],t,S)])},[S,t,i]),re=f(e=>{o&&o(e,[vr(e[0],t,S),vr(e[1],t,S)])},[S,t,o]),ie=f((e,t)=>{x(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]})},[]),oe=f((e,t)=>{if(d)return;const a="start"===e?0:1;x(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=q.current[e].hour;if(!t)return;const n=t.querySelector('[data-active="true"]');n&&X(t,n,0)})})},[d,X]),le=f((e,t)=>{if(d)return;const a="start"===e?0:1;x(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=q.current[e].minute;if(!t)return;const n=t.querySelector('[data-active="true"]');n&&X(t,n,0)})})},[d,X]),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],i=gr(r),o=hr(n,N,r,i);if(o){ie(e,o);const t=o.toPlainDate().with({day:1});return Y(t),"start"===e&&H("end"),!0}return A(e=>{const n=[...e];return n[a]=vr(I[a],t,S),n}),!1},[I,S,t,N,ie]),ce=f(e=>t=>{const n=t.currentTarget.value;K.current=!0,se(e,n);const a="start"===e?0:1,r=$.current[a],i=gr(r),o=hr(n,N,r,i);if(o){ie(e,o);const t=o.toPlainDate().with({day:1});Y(t),J(e)}},[se,N,ie,J]),ue=f(e=>n=>{var a;if(d)return;if(K.current=!1,F){const n="start"===e?0:1,a=vr($.current[n],t,S);return void A(e=>{const t=[...e];return t[n]=a,t})}const r=n.relatedTarget;r&&(null===(a=B.current)||void 0===a?void 0:a.contains(r))||de(e,n.currentTarget.value)},[de,d,F,t,S]),he=f(e=>t=>{"Enter"===t.key&&(t.preventDefault(),K.current=!1,de(e,t.currentTarget.value)),"Escape"===t.key&&t.currentTarget.blur()},[de]),ge=p(()=>{const e=j,t=0===s?7:s,n=(e.dayOfWeek-t+7)%7,a=e.subtract({days:n});return Array.from({length:42},(e,t)=>a.add({days:t}))},[j,s]),me=f((e=u)=>{if(!h||!B.current)return e;const t=B.current.getBoundingClientRect(),n=D?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},[h,D,u]),ve=f(()=>{const e=me();U.current!==e&&(U.current=e,W(e))},[me]),fe=e=>{if(d)return;H(e);const t=I["start"===e?0:1].toPlainDate().with({day:1});Y(t);const n=me();U.current!==n&&(U.current=n,W(n)),_(!0)};m(()=>{if(!F)return;ve();const e=()=>ve();return window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}},[F,ve]);return Ka("div",{className:"df-range-picker df-range-picker-root",ref:B,children:[Ka("div",{className:"df-range-picker-trigger","data-disabled":d,"data-open":F,children:[Ka("div",{className:"df-range-picker-field-group",children:Ka("input",{type:"text",name:"range-start",value:P[0],onChange:ce("start"),onFocus:()=>fe("start"),onClick:()=>fe("start"),onBlur:ue("start"),onKeyDown:he("start"),className:"df-range-picker-input","data-disabled":d,"data-focused":"start"===R&&F,placeholder:M,autoComplete:"off",disabled:d})}),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:P[1],onChange:ce("end"),onFocus:()=>fe("end"),onClick:()=>fe("end"),onBlur:ue("end"),onKeyDown:he("end"),className:"df-range-picker-input","data-disabled":d,"data-focused":"end"===R&&F,placeholder:M,autoComplete:"off",disabled:d})})]}),F&&c(Ka(yr,{visibleMonth:j,monthLabels:C,weekDayLabels:T,calendarDays:ge,draftRange:I,focusedField:R,isTimeEnabled:!!E,disabled:d,matchTriggerWidth:D,popupRef:V,timeListRefs:q,onMonthChange:e=>{Y(t=>t.add({months:e}).with({day:1}))},onYearChange:e=>{Y(t=>t.add({years:e}).with({day:1}))},onDaySelect:e=>{if(d)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"===R){const n=t(I[0],e),a=I[1].epochMilliseconds-I[0].epochMilliseconds,r=n.add({milliseconds:a});return void x([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 x([n,a])}x([I[0],a]),Y(a.toPlainDate().with({day:1}))},onHourSelect:oe,onMinuteSelect:le,onOk:()=>{G.current=!0,ae(I),re(I),_(!1)},getPopupStyle:()=>{if(!B.current)return{};const e=B.current.getBoundingClientRect(),t={position:"fixed",zIndex:9999};return U.current.startsWith("bottom")?t.top=e.bottom+8:t.bottom=window.innerHeight-e.top+8,u.endsWith("Left")?t.left=e.left:t.right=window.innerWidth-e.right,D&&(t.width=`${e.width}px`),t}}),y?y():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=p(()=>{var e,t;return null!==(t=null===(e=null==l?void 0:l.getViewConfig("week"))||void 0===e?void 0:e.startOfWeek)&&void 0!==t?t:1},[l]),N=e=>{const[t,n]=e;h(Object.assign(Object.assign({},u),{start:t.toPlainDate(),end:n.toPlainDate()}))},k=null!==(s=null==l?void 0:l.canMutateFromUI(t.id))&&void 0!==s&&s,I=null==l?void 0:l.getReadOnlyConfig(t.id),x=!1!==(null==I?void 0:I.viewable),O=f||D,R=!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||!x)return null;if("undefined"==typeof window||"undefined"==typeof document)return null;const H=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:O,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:!k||O,disabled:!k||O,onChange:e=>{h(Object.assign(Object.assign({},u),{title:e.target.value}))},className:"df-form-input"})}),k&&zt(wr,{options:C,value:u.calendarId||"blue",disabled:O,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,startOfWeek:M,matchTriggerWidth:!0,disabled:!k||O,onChange:N,onOk:N,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,startOfWeek:M,disabled:!k||O,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})]}),R&&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:!k||O,disabled:!k||O,onChange:e=>h(Object.assign(Object.assign({},u),{description:e.target.value})),rows:4,className:"df-form-textarea",placeholder:E("addNotePlaceholder")})]}),k&&zt("div",{className:"df-form-actions",children:[u.allDay?zt("button",{type:"button",disabled:O,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:O,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:O,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||O,loading:f,children:E("save")})]})]})]})]}),P=document.body;return P?c(H,P):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,k]=g(new Date),[I,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(),W=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);k(e),R(e)}catch(e){const t=new Date;k(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),k(new Date(e.getTime()+36e5)),R(e)}},[e,r]);const U=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?Ie(t):$(t,i.timeZone),end:C?Ie(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);k(a)}else{const e=new Date(t);e.setHours(N.getHours(),N.getMinutes()),k(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?Ie(e):$(e,i.timeZone),end:C?Ie(t):$(t,i.timeZone)});n(Ke(r,a,i.timeZone))},disabled:!U,className:"df-mobile-event-drawer-header-action df-mobile-event-drawer-header-action-primary "+(U?"":"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:W,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:I,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),k(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();k(e),M(new Date(e.getTime()-t))}else k(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)},kr=()=>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"})}),Ir=({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(kr,{}),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(Ir,{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(Ir,{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,k]=g(()=>t.getTheme());m(()=>t.subscribeThemeChange(e=>k(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),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:I,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"})}),Wr=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)});Wr.displayName="ContextMenu";const Ur=({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(Ur,{onClick:()=>{l(),r()},children:d("newEvent")||"New Event"}),zt(Ur,{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?Ie(s):Oe(s,t.timeZone),end:r.allDay?Ie(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(Wr,{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(Ur,{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(Ur,{onClick:()=>{o.deleteEvent(t.id),r()},danger:!0,children:l("delete")||"Delete"}),zt(Ur,{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(Ur,{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(Wr,{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=ke(e.event.start,y),n=e.event.end?ke(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},k=ge(e.event),I=!!e.event.calendarIds&&e.event.calendarIds.length>1,x=I?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&&I;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(k),color:"#fff"}:I?{background:ye(x),color:ce(k)}:{backgroundColor:de(k),color:ce(k)}),{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} (${Wt(b.start)} - ${Wt(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(k)},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(k)},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 k=t===x.MONTH,I=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(k&&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(I&&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(k){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),k=v(t),I=v(t),x=v(!1),O=f(()=>{if(x.current)return;const e=k.current,t=I.current;if(Ct(e,t))return;const n=Ke(e,t,null==y?void 0:y.timeZone);k.current=n,I.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(I.current,e)&&(I.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(k.current.id!==t.id)return O(),x.current=!1,k.current=t,I.current=t,void S(t);Ct(k.current,I.current)&&(k.current=t,I.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(()=>{var e,t;return null!==(t=null===(e=null==y?void 0:y.getViewConfig("week"))||void 0===e?void 0:e.startOfWeek)&&void 0!==t?t:1},[y]),L=p(()=>(y?y.getCalendarRegistry():le()).getVisible().map(e=>({label:e.name,value:e.id})),[y,null==y?void 0:y.getCalendars()]),$="dark"===E||"undefined"!=typeof document&&document.documentElement.classList.contains("dark"),j=null!==(D=null==y?void 0:y.canMutateFromUI(t.id))&&void 0!==D&&D,Y=null==y?void 0:y.getReadOnlyConfig(t.id),F=!1!==(null==Y?void 0:Y.viewable),Z=!!T.allDay,_=!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(!F)return null;const z=$?"#1f2937":"white",W=$?"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:z,transform:"rotate(45deg)",transformOrigin:"center",top:n-6+"px",borderRight:a.isSunday?`1px solid ${W}`:"none",borderTop:a.isSunday?`1px solid ${W}`:"none",borderLeft:a.isSunday?"none":`1px solid ${W}`,borderBottom:a.isSunday?"none":`1px solid ${W}`},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: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 ${W}`:"none",borderTop:a.isSunday?`1px solid ${W}`:"none",borderLeft:a.isSunday?"none":`1px solid ${W}`,borderBottom:a.isSunday?"none":`1px solid ${W}`}}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:z,transform:"rotate(45deg)",transformOrigin:"center",top:m-6+"px",borderRight:a.isSunday?`1px solid ${W}`:"none",borderTop:a.isSunday?`1px solid ${W}`:"none",borderLeft:a.isSunday?"none":`1px solid ${W}`,borderBottom:a.isSunday?"none":`1px solid ${W}`},a.isSunday?{right:"-6px"}:{left:"-6px"})}}return e})(),B=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:!j||M,disabled:!j||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"})}),j&&zt(wr,{options:L,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",Z?{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,startOfWeek:P,matchTriggerWidth:!0,disabled:!j||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,startOfWeek:P,disabled:!j||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})]}),_&&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:!j||M,disabled:!j||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")})]}),j&&zt("div",{className:"df-form-actions",children:[zt(Ba,Z?{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 V=document.body;return V?c(B,V):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:k,onDetailPanelOpen:I,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:W,className:U,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=ke(e.start,G),n=e.end?ke(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:Ie,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,k=t===x.RESOURCE,I=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,I=Math.max(10,e.top+10),x=m-10;D=S<I?I:S+p>x?x-p:S,T(e=>{if(!e)return null;let t=y<i;return(N||k)&&(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(()=>I()))},[y,C,I,c]),{detailPanelPosition:C,setDetailPanelPosition:T,updatePanelPosition:I}})({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:We,handleDoubleClick:Ue,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 k=n===x.MONTH,I=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||k||I||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,k,I,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,I,c,D,w,p,E,M]);return{handleClick:f(e=>{e.preventDefault(),e.stopPropagation();const t=e.clientX;if(!c&&u)return L(),I||O||F(t),A(!0),void(H.current=setTimeout(()=>{(I||O)&&F(t),Z(),H.current=null,A(!1)},180));_(t)},[L,u,F,Z,I,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,k=o===x.YEAR,I=null!=t?t:e;return{calculateEventStyle:()=>{var e,t,o,x,O,R,H,P,A,L,$;if(k&&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(I.start),Y=S?S.endHour:Ze(I),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 k=g;if(M)k="sticky-top";else if(N)k="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)k=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;k=n.right<=t?"sticky-left":n.left>=a?"sticky-right":"standard"}else k="standard"}else k="standard"}k===g?h():(v(k),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;k===e.id&&!ve&&t&&!1!==L&&setTimeout(()=>{null==H||H(me),null==I||I()},50)},[k,e.id,ve,d,c,ee,u,H,I,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&&k===e.id?"df-all-day-event-animate":""} ${null!=U?U:""}`,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)}),W),onClick:e=>{if(Q&&He())return e.preventDefault(),void e.stopPropagation();We(e)},onContextMenu:Be,onDblClick:Ue,onMouseDown:t=>{var n;if(Q||Ie(!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&&Ie(!1),onMouseLeave:()=>!Q&&Ie(!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:k,handleTouchEnd:I,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:W,isTouch:U,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&&!W,{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(),W||!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:W||!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":!W&&ue?"true":"false",style:{paddingRight:W||!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":!W&&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);(W||U)&&i&&n&&r?(B(i),V(!0)):(f(t),e.state.highlightedEventId&&(e.highlightEvent(null),se.current=null))},onEventLongPress:e=>{(W||U)&&f(e)},customDetailPanelContent:$,customEventDetailDialog:j,useEventDetailPanel:Y,app:e,isMobile:W,enableTouch:U,appTimeZone:re},t.id))})})]}:{className:"df-day-content-all-day-spacer","data-scrollbar-space":!W&&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:Wn,"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:Un,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":!W&&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":!W&&ue?"true":"false",children:[s.map((e,a)=>zt("div",{className:zn,"data-scrollbar-space":!W&&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,U,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);k(e,a)},onTouchEnd:I,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":!W&&ue?"true":"false",children:zt("div",oe?{className:"df-time-column-tz-row df-day-content-bottom-tz-row",style:{left:W?"-5rem":"-5.5rem",width:W?"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);(W||U)&&r&&n?(B(r),V(!0)):(f(t),e.state.highlightedEventId&&(e.highlightEvent(null),se.current=null))},onEventLongPress:e=>{(W||U)&&f(e)},customDetailPanelContent:$,customEventDetailDialog:j,useEventDetailPanel:Y,app:e,isMobile:W,enableTouch:U,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)}}}})]})},ki=({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))})]})})]})})},Ii={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=Ii){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))<=Ii.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],Ii))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)}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))?Wi(d,l,s,a,r):d.forEach(e=>zi(e,l,s,a,r))}function Wi(e,t,n,a,r={}){const i=e.length,o=e[0].depth*Fi(r.viewType),l=t+o,s=n-o;if(s<=0)return void e.forEach(e=>zi(e,t,n,a,r));let d=Ii.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))?Wi(t,n,c,a,r):t.forEach(e=>zi(e,n,c,a,r))}})}function Ui(e,t,n={}){const a=100-("day"===n.viewType?0:Ii.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-Ii.MARGIN_BETWEEN*(r-1))/r;e.forEach((e,a)=>{zi(e,a*(i+Ii.MARGIN_BETWEEN),Math.max(i,Ii.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))<Ii.NESTED_THRESHOLD)return!0;return!1}(e,t))return!1;if(r<Ii.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,Ii)})}));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:Ii.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 Ui(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:k="24h",secondaryTimeZone:I,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),W=void 0===l?F:l,U=void 0===c?_:c,B=p(()=>W&&h.find(e=>e.id===W)||null,[W,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&&W===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:I&&!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,k)})),ke=p(()=>I?We(Se,I,k,ne,ue):void 0,[I,k,H,ne,ue]),Ie=p(()=>I?Ue(ue,ne):void 0,[I,ue,ne]),xe=p(()=>I?Ue(I,ne):void 0,[I,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:W,setSelectedEventId:V,newlyCreatedEventId:q,setNewlyCreatedEventId:G,detailPanelEventId:U,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:k,secondaryTimeSlots:ke,primaryTzLabel:Ie,secondaryTzLabel:xe,appTimeZone:ue}),zt(ki,{app:e,currentDate:ne,visibleMonth:ae,currentDayEvents:he,selectedEvent:B,setSelectedEvent:e=>V(e?e.id:null),handleMonthChange:oe,handleDateSelect:Re,switcherMode:o,timeFormat:k,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:k})]})},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]),k=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]),I=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},k),{eventsService:v,dragService:y})},[D,b,w,E,C,T,S,M,k,v,y]);return zt(e,Object.assign({},I))},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:k,secondaryTimeSlots:I,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:W,handleDragOver:U,handleDrop:B,customDetailPanelContent:V,customEventDetailDialog:q,useEventDetailPanel:G})=>{const K={flexShrink:0},[X,J]=g(null),Q=p(()=>Gt(),[]),ee=!!I&&I.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:k}),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==W?void 0:W(e,n),onDblClick:e=>null==W?void 0:W(e,n),onDragOver:U,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==W||W({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:k,handleResizeStart:I,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:W,isSlidingView:U,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:Un,children:Fe(t,0,J,!1)})})})()]}),zt("div",{ref:f,className:"df-week-time-grid-content",style:{width:l,minWidth:"100%",transform:U?"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:Wn,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:k,onResizeStart:I,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:W,multiDaySegmentInfo:n,app:e,isMobile:s,isSlidingView:U,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)}}})]})},ko=e=>{const t=n.Now.plainDateISO(e);return new Date(t.year,t.month-1,t.day).toDateString()},Io=({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,k]=g(!1),{hourHeight:I=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=I,Y=O,F=R,Z=H,_=!P;m(()=>{k("ontouchstart"in window||navigator.maxTouchPoints>0)},[]);const z=e.getCustomMobileEventRenderer()||Nr,W="desktop"!==T,U=W?2:7,B=W,V=null!==(u=t.startOfWeek)&&void 0!==u?u:1,q=B?"300%":"100%",G=p(()=>ho(E,V),[E,V]),J=B?3*U: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:U,currentDate:E,displayDays:J,isSlidingView:B,scrollerRef:pe,swipeContentRef:we,topFrozenContentRef:ye}),Se=B?Te:G,ke=p(()=>{if(!B)return Se;const e=new Date(Se);return e.setDate(e.getDate()-U),e},[U,Se,B]),Ie=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,ke,J,Ie),[C,ke,J,Ie]),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,ke,J,e.state.allDaySortComparator),[xe,ke,J,e.state.allDaySortComparator]),Pe=p(()=>{const e=B?He.filter(e=>e.endDayIndex>=U&&e.startDayIndex<=2*U-1):He;if(0===e.length)return Z;const t=Math.max(...e.map(e=>e.row));return Z+t*Z},[He,Z,B,U]),Ae=p(()=>uo(xe,ke,J,Ie),[xe,ke,J,Ie]),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,ke,J,Ie),[xe,ke,J,Ie]),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,ke,J,Ie),[xe,ke,J,Ie]),_e=p(()=>({calendarRef:i,allDayRowRef:P?fe:void 0,timeGridRef:M,viewType:x.WEEK,onEventsUpdate:Le,onEventCreate:$e,onEventEdit:je,currentWeekStart:ke,events:xe,calculateNewEventLayout:Ye,calculateDragLayout:Ze,TIME_COLUMN_WIDTH:$,isMobile:S,gridWidth:q,displayDays:J}),[i,P,Le,$e,je,ke,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:ke,getWeekDaysLabels:D,isSlidingView:B,locale:w,startOfWeek:V}),[J,ke,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?We(rt,L,A,E,Ie):void 0,[L,A,Y,E,Ie]),ot=p(()=>L?Ue(Ie,E):void 0,[L,Ie,E]),lt=p(()=>L?Ue(L,E):void 0,[L,E]),st=p(()=>((e,t,n,a)=>{const r=ko(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}})})(ke,tt,w,Ie),[Ie,ke,w,tt]),dt=p(()=>((e,t,n,a)=>{const r=ko(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,Ie),[Ie,E,w,G]),ut=t=>e.updateEvent(t.id,t),ht=t=>e.deleteEvent(t),gt=p(()=>{const e=Ve(Ie);e.setHours(0,0,0,0);const t=new Date(ke);t.setHours(0,0,0,0);const n=new Date(t);return n.setDate(t.getDate()+J),e>=t&&e<n},[ke,J,Ie]);return y(()=>{if(t.scrollToCurrentTime&&pe.current){const e=pe.current,t=Be(Ie),n=t.getHours()+t.getMinutes()/60,a=e.clientHeight;e.scrollTop=Math.max(0,(n-Y)*j-a/2)}},[Ie,t.scrollToCurrentTime,Y,j]),m(()=>{ee(Be(Ie));const e=setInterval(()=>ee(Be(Ie)),6e4);return()=>clearInterval(e)},[Ie]),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:ke,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:ke,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:Ie}),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:Io,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:k,onEventSelect:I,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),W=v(null),U=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:I,onEventLongPress:k,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":U?"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:()=>U&&(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];W.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&&W.current){const t=Math.abs(e.touches[0].clientX-W.current.x),n=Math.abs(e.touches[0].clientY-W.current.y);(t>10||n>10)&&(clearTimeout(z.current),z.current=null)}},onTouchEnd:()=>{z.current&&(clearTimeout(z.current),z.current=null),W.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":U?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:k,onEventLongPress:I,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,W]=g(!1),U=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?(W(!0),U.current&&(clearTimeout(U.current),U.current=null),()=>{U.current&&(clearTimeout(U.current),U.current=null)}):z?(U.current=setTimeout(()=>{W(!1),U.current=null},100),()=>{U.current&&(clearTimeout(U.current),U.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:I,onEventSelect:k,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:k,onEventLongPress:I,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),[k,I]=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(()=>{I(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})(k,T):[],[N,k,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("-"),W=v(null),U=p(()=>{const e=W.current;return e&&e.length===C.length&&e.every((e,t)=>e===C[t])?e:(W.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 U.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},[U,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(U),i=new Set(r.map(e=>e.id)),o=U.filter(e=>!i.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: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:U,isMobile:"desktop"!==V}),Te=Ee,{handleDrop:Se,handleDragOver:Me}=mo({app:e,onEventCreated:e=>{re(e.id)}}),ke=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=U.find(e=>e.id===Te.eventId);return e?Object.assign(Object.assign({},e),{start:e.allDay?Ie(Te.startDate):Oe(Te.startDate,S),end:e.allDay?Ie(Te.endDate):Oe(Te.endDate,S)}):null},[Ce,Te.eventId,Te.startDate,Te.endDate,Te.mode,U,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:We}=(({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),[k,I]=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),W=f(e=>{e&&(j.current=e)},[]),U=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=k.at(-1),t=[];for(let a=1;a<=n;a++){const n=new Date(e.startDate);n.setDate(n.getDate()+7*a),t.push(U(n))}I(e=>[...e,...t])}else{const e=k[0],a=[];for(let t=n;t>=1;t--){const n=new Date(e.startDate);n.setDate(n.getDate()-7*t),a.push(U(n))}const r=a.length*t;I(e=>[...a,...e]),requestAnimationFrame(()=>{D(e=>e+r),j.current&&(j.current.scrollTop+=r)})}}finally{setTimeout(()=>{z.current=!1},200)}},0))},[k,U,t]),V=p(()=>{const e=k.length*t,n=Math.floor(h/t);let a=Math.max(0,n);a=Math.min(a,Math.max(0,k.length-6));const r=Math.min(k.length-1,a+6-1),i=Math.max(0,a-15),o=Math.min(k.length-1,r+15),l=[];for(let e=i;e<=o;e++)l.push({index:e,weekData:k[e],top:e*t,height:t});return{totalHeight:e,visibleItems:l,displayStartIndex:a}},[h,w,t,k]),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=k.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=k[0],d=k.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(U(t))}const i=r.length*t;I(e=>[...r,...e]),requestAnimationFrame(()=>{const o=[...r,...k].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(U(t))}I(e=>[...e,...r]),requestAnimationFrame(()=>{const i=[...k,...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()},[k,t,U]),X=f(()=>{var e;const t=V.displayStartIndex,n=Math.min(k.length-1,t+5),a={};for(let r=t;r<=n;r++)null===(e=k[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,k,K]),J=f(()=>{var e;const t=V.displayStartIndex,n=Math.min(k.length-1,t+5),a={};for(let r=t;r<=n;r++)null===(e=k[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,k,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=k.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))})}))}},[k,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(k.length-1,t+e-1),r={};for(let e=t;e<=a;e++){const t=k[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,k,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(k.length-1,n+5),r={};for(let t=n;t<=a;t++)null===(e=k[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=k.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,k,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:W,weeksData:k}})({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}),Ue=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:Ue.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,Ue.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,We(a)}J(n),te.current=n}}}});return t.observe(e),()=>{t.disconnect()}},[je,We]),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=U.find(e=>e.id===t);if(e)return se(e),void oe(!0)}ve(t)},[V,q,U,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")[k.getMonth()],n=k.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:ke.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=>{U.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){const n=[];for(let a=0;a<e.length;a+=t)n.push(e.slice(a,a+t));return n}function _o(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 zo=(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},Wo=(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};function Uo(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 Bo=({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}=Uo(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=>zo(t,e,l,i)),eventSegments:m,minHeight:p})}return o},Vo=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")]})})]})});Vo.displayName="YearDayCell";const qo=(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},Go=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]),k=f(e=>{a.selectDate(e)},[a]),I=p(()=>_o(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 I;if(O)return I;const r=t.filter(e=>e.id!==S.id);return qo(S,e,T)&&r.push(S),_o(r,e,n,a.state.allDaySortComparator,T)},[S,O,I,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(Vo,{date:e,isToday:n,locale:i,onSelectDate:k,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=qo(e.dragPreviewEvent,e.rowDays,e.appTimeZone),s=qo(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});Go.displayName="YearRowComponent";const Ko=({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,k]=g(!1),[I,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,W]=g(null),U=e.canMutateFromUI();m(()=>{U||W(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]"),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),W(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),k(!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:I}),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(()=>Zo(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?Ie(Q.startDate):Oe(Q.startDate,C),end:e.allDay?Ie(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(Go,{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=>{U&&W(e)},appTimeZone:C},o))})}),U&&z&&zt(Qr,{x:z.x,y:z.y,date:z.date,viewType:x.YEAR,onClose:()=>W(null),app:e,onCreateEvent:()=>{if(z&&z.date){const e={preventDefault:()=>{},stopPropagation:()=>{},clientX:z.x,clientY:z.y};te(e,z.date)}}})]})},Xo=({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),k=v(null),I=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)},[W,U]=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=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(),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(()=>Wo(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=>{U(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),U(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(()=>Bo({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?Ie(t.startDate):Oe(t.startDate,a),end:r.allDay?Ie(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)&&!zo(t,a,e.monthIndex,i))return e;const o=e.monthEvents.filter(e=>e.id!==(null==t?void 0:t.id));t&&zo(t,a,e.monthIndex,i)&&o.push(t);const{segments:l,maxVisualRow:s}=Uo(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),k.current&&(k.current.scrollTop=t.scrollTop)},[]);return m(()=>{const e=()=>{if(I.current){const e=I.current,t=e.offsetHeight-e.clientHeight,n=e.offsetWidth-e.clientWidth;P(e=>e===t?e:t),R(e=>e===n?e:n)}},t=I.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:k,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:I,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:W,onDetailPanelOpen:()=>U(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)}})]})},Jo=({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 Qo(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 el(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 tl=({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(()=>Qo(d,s,u,v),[d,s,u,v]),E=p(()=>Qo(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:el(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(Jo,{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})]})},nl=e=>{var t;const n=(null===(t=e.config)||void 0===t?void 0:t.mode)||"year-canvas";return"fixed-week"===n?zt(Xo,Object.assign({},e)):"grid"===n?zt(tl,{app:e.app,config:e.config}):zt(Ko,Object.assign({},e))},al={},rl=e=>o(wo,Object.assign(Object.assign({},e),{viewType:x.YEAR,originalComponent:nl,className:"df-year-view-factory"}));rl.displayName="YearViewAdapter";const il=(e={})=>{const t=Object.assign(Object.assign({},al),e);return{type:x.YEAR,component:rl,config:t}};function ol(e){return[Co(null==e?void 0:e.day),Ro(null==e?void 0:e.week),Fo(null==e?void 0:e.month)]}const ll={enableAutoRecalculate:!0,enableValidation:!0,defaultEvents:[],maxEventsPerDay:50};function sl(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 dl(t={}){const n=Object.assign(Object.assign({},ll),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=sl(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=sl(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{ka as AlertCircle,Na as AudioLines,Wa 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,Wr as ContextMenu,Jr as ContextMenuColorPicker,Ur as ContextMenuItem,Vr as ContextMenuLabel,Br as ContextMenuSeparator,qa as CreateCalendarDialog,jr as CustomRenderingStore,Dr as DayflowRangePicker,Ua 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,_o as analyzeMultiDayEventsForRow,ve as buildColorBarGradient,fe as buildDiagonalColorBarGradient,ye as buildDiagonalPatternBackground,Bo as buildFixedWeekMonthsData,mt as calculateDayIndex,ta as calendarPickerDropdown,jn as cancelButton,xa as capitalize,cn as clipboardStore,In as compareAllDayDisplayPriority,Lt as compareViews,En as convertToDayFlowEvent,xn as createAllDayDisplayComparator,an as createAllDayEvent,It 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,dl as createEventsPlugin,Fo as createMonthView,Ht as createNormalizedCalendarAppConfigGetter,ol as createStandardViews,F as createTemporalWithHour,rn as createTimedEvent,en as createTimezoneEvent,nn as createTimezoneEvents,Ro as createWeekView,il as createYearView,Ie as dateToPlainDate,xe as dateToPlainDateTime,Oe as dateToZonedDateTime,U 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,Wt as formatDateConsistent,mn as formatDateToICSTimestamp,_e as formatEventTimeRange,gn as formatICSDate,Ut as formatMonthYear,yn as formatProperty,Fe as formatTime,at as generateDayData,Tn as generateICS,We 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,W as getEndOfTemporal,de as getEventBgColor,Ze as getEventEndHour,ii as getEventIcon,ce as getEventTextColor,st as getEventsForDay,yt as getEventsForWeek,Wo as getFixedWeekTotalColumns,Ia 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,Ue as getTimezoneDisplayLabel,Ve as getTodayInTimeZone,Oa as getWeekDaysLabels,ee as getWeekNumber,tt as getWeekRange,Zo as groupDaysIntoRows,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,I as isValidLocale,Se as isZonedDateTime,Qe as monthNames,Vt as normalizeCssWidth,ln as normalizeDate,k as normalizeLocale,Ee as normalizeTimeZoneValue,q as now,un as pad2,Cn as parseICS,hn as parseICSDate,bn as parseVEventLines,kt 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,kn as sortAllDayByTitle,Fr as subscribeCalendar,Rt as syncCalendarAppConfig,Ha as t,Me as temporalToDate,Ne as temporalToVisualDate,ke 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};
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 M={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."}},S={en:M};function N(e){const t=e.code.split("-")[0].toLowerCase();S[t]=e}function k(e){const t=e.split("-")[0].toLowerCase();return t in S?t:"en"}function I(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.AGENDA="agenda",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 A{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=A.getKey(e),n=this.cache.get(t);if(n)return this.updateAccessOrder(t),n}set(e,t){const n=A.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 H;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 Y(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 j(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 Y(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?Y(e):new Date(e)}function Z(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 i=e;return n.PlainDateTime.from({year:i.year,month:i.month,day:i.day,hour:a,minute:r})}function F(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),i=a(t);return 0===n.PlainDate.compare(r,i)}function _(e,t){return!F(e,t)}function W(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 z(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 U(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),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 G(e=n.Now.timeZoneId()){return n.Now.zonedDateTimeISO(e)}function q(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"}(H||(H={}));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(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 Z(e,t)},J=e=>{if(e instanceof Date){const t=new Date(e);return t.setHours(0,0,0,0),t}return W(e)},Q=e=>{if(e instanceof Date){const t=new Date(e);return t.setHours(23,59,59,999),t}return z(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():F(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 ie{constructor(e,t,n="light"){this.calendars=new Map,this.defaultCalendarId=t||"blue",this.currentTheme=n;const a=e&&e.length>0;if(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}))}),this.calendars.size>0&&0===this.getVisible().length){const e=this.calendars.keys().next().value;if(e){const t=this.calendars.get(e);this.calendars.set(e,Object.assign(Object.assign({},t),{isVisible:!0}))}}}register(e){this.calendars.set(e.id,e)}unregister(e){const t=this.calendars.get(e),n=!1!==(null==t?void 0:t.isVisible),a=this.calendars.delete(e);if(a&&n&&0===this.getVisible().length){const e=this.getAll()[0];e&&this.setVisibility(e.id,!0)}return a}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);if(n){if(!t&&this.getVisible().length<=1&&!1!==n.isVisible)return;this.calendars.set(e,Object.assign(Object.assign({},n),{isVisible:t}))}}setAllVisibility(e){if(this.calendars.forEach((t,n)=>{this.calendars.set(n,Object.assign(Object.assign({},t),{isVisible:e}))}),!e&&this.calendars.size>0){const e=this.calendars.keys().next().value;if(e){const t=this.calendars.get(e);this.calendars.set(e,Object.assign(Object.assign({},t),{isVisible:!0}))}}}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(H).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 Me(e){return null!==e&&"object"==typeof e&&("timeZone"in e||"timeZoneId"in e)&&"year"in e&&!(e instanceof Date)}function Se(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(Me(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 Se(e);const a=Ee(t);if(!a)return Se(e);try{if(Me(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 Se(e)}function ke(e,t){if(!t)return e;const a=Ee(t);if(!a)return e;try{if(Me(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 Ie(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 Ae(e){return new Date(e.year,e.month-1,e.day)}function He(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 Me(e),e.with({hour:n,minute:a,second:0,millisecond:0})}function Le(e){return e instanceof Date?Ie(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 Ye=e=>new Date(e.year,e.month-1,e.day,e.hour,e.minute,e.second,Math.floor(e.millisecond)),je=.25,Ze=(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")}`},Fe=e=>{if(!e.end)return 0;const t=K(e.end);if(e.allDay||!e.start)return t;const n=j(e.start),a=j(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=Fe(e);return`${Ze(n,0,t)} - ${Ze(a,0,t)}`},We=e=>.25*Math.round(e/.25),ze=(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 Ze(r.hour,r.minute,a)}catch(e){return""}})},Ue=(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 Ye(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)},Ge=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:Ye(r),end:Ye(r.add({hours:1}))}},qe=(e,t,a)=>{var r,i;const o=j(e);if(Me(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):Me(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:Ie(j(t.start)),end:Ce(t.end)?t.end:Ie(j(t.end))}):Object.assign(Object.assign({},t),{allDay:!1,start:qe(t.start,e.allDay?t.start:e.start,n),end:qe(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=j(t.start);r.setHours(0,0,0,0);const i=j(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=j(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=j(e.start);return a>=t&&a<=n}).map(e=>{const n=mt(j(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)=>j(e.start).getTime()!==j(t.start).getTime()||j(e.end).getTime()!==j(t.end).getTime()||e.title!==t.title||e.day!==t.day||!!e.allDay!=!!t.allDay;function Mt(){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 St(){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 kt(e){return{allDaySortComparator:e.allDaySortComparator,calendars:e.calendars,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 It(e){return{callbacks:e.callbacks,syncableConfig:kt(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.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=It(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 At(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 Ht={hasChanges:!1,requiresRender:!1},Pt=(e,t)=>{if(e===t)return Ht;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=Pt(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=Pt(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}: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||(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 Yt{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()}onMobileEventDetailToggle(e){var t,n;null===(n=(t=this.getCallbacks()).onMobileEventDetailToggle)||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 jt{static getAgendaPageDays(e){var t;const n=Number(null===(t=null==e?void 0:e.config)||void 0===t?void 0:t.daysToShow);return Number.isFinite(n)&&n>0?Math.floor(n):14}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.AGENDA:{const t=new Date(this.state.currentDate);t.setHours(0,0,0,0);const n=new Date(t);n.setDate(n.getDate()+jt.getAgendaPageDays(i)),this.emitVisibleRange(t,n,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.AGENDA:{const t=this.state.views.get(this.state.currentView);e.setDate(e.getDate()-jt.getAgendaPageDays(t));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.AGENDA:{const t=this.state.views.get(this.state.currentView);e.setDate(e.getDate()+jt.getAgendaPageDays(t));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 Zt{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 Ft{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.onMobileEventDetailToggle=e=>this.eventManager.onMobileEventDetailToggle(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.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.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=Ft.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:Ft.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 Yt(this.state,this.calendarRegistry,()=>this.callbacks,this.notify,this.triggerRender,t.events||[]),this.navigation=new jt(this.state,()=>this.callbacks,this.notify,this.state.currentDate),this.pluginManager=new Zt(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,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?I(e)?e:"en-US":e&&"object"==typeof e&&!I(e.code)?Object.assign(Object.assign({},e),{code:"en-US"}):e:"en-US"}get timeZone(){return this.state.timeZone}}var _t=0;function Wt(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 zt=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;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}`},Ut=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 Gt=null;function qt(){if("undefined"==typeof document)return!1;if(null!==Gt)return Gt;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(),Gt=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?Ie(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):j(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(Me(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=St()),t}function En(e,t){var a;const{calendarId:r="default",generateNewIds:i=!0,idPrefix:o="ics-",defaultTimeZone:l}=t,s=i?`${o}${St()}`: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 Mn(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 Sn(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=j(e.start);t.setHours(0,0,0,0);const n=j(e.end);return n.setHours(0,0,0,0),{startDay:t,endDay:n,isMultiDay:n.getTime()>t.getTime()}},kn=(e,t)=>e.title.localeCompare(t.title),In=(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,In(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 An=()=>{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},Hn=r({locale:"en-US",t:e=>e,getWeekDaysLabels:()=>[],getMonthLabels:()=>[],isDefault:!0});function Pn(){return D(Hn)}const Ln="df-month-view",$n="df-view-header-title",Yn="df-btn-sm df-btn-sm-ghost",jn="df-date-number",Zn="df-scroll-container",Fn="df-time-slot",_n="df-time-label",Wn="df-time-grid-row",zn="df-current-time-line",Un="df-current-time-label",Bn="df-all-day-row",Vn="df-all-day-label",Gn="df-event-title",qn="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})=>Wt("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:Wt("path",{d:"m15 18-6-6 6-6"})}),ua=({className:e,width:t=24,height:n=24})=>Wt("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:Wt("path",{d:"m9 18 6-6-6-6"})}),ha=({className:e,width:t=24,height:n=24})=>Wt("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:Wt("path",{d:"m6 9 6 6 6-6"})}),ga=({className:e,width:t=24,height:n=24})=>Wt("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:[Wt("path",{d:"M5 12h14"}),Wt("path",{d:"M12 5v14"})]}),ma=({className:e,width:t=24,height:n=24})=>Wt("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:[Wt("circle",{cx:"11",cy:"11",r:"8"}),Wt("path",{d:"m21 21-4.3-4.3"})]}),va=({className:e,width:t=24,height:n=24})=>Wt("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:Wt("path",{d:"M20 6 9 17l-5-5"})}),fa=({className:e,width:t=24,height:n=24})=>Wt("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:[Wt("path",{d:"m7 15 5 5 5-5"}),Wt("path",{d:"m7 9 5-5 5 5"})]}),pa=({className:e,width:t=24,height:n=24})=>Wt("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:[Wt("path",{d:"M18 6 6 18"}),Wt("path",{d:"m6 6 12 12"})]}),ya=({className:e,width:t=24,height:n=24})=>Wt("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:[Wt("path",{d:"M8 2v4"}),Wt("path",{d:"M16 2v4"}),Wt("rect",{width:"18",height:"18",x:"3",y:"4",rx:"2"}),Wt("path",{d:"M3 10h18"}),Wt("path",{d:"M8 14h.01"}),Wt("path",{d:"M12 14h.01"}),Wt("path",{d:"M16 14h.01"}),Wt("path",{d:"M8 18h.01"}),Wt("path",{d:"M12 18h.01"}),Wt("path",{d:"M16 18h.01"})]}),Da=({className:e,width:t=24,height:n=24})=>Wt("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:Wt("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),wa=({className:e,width:t=24,height:n=24})=>Wt("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:[Wt("rect",{width:"18",height:"14",x:"3",y:"8",rx:"2"}),Wt("path",{d:"M12 5a3 3 0 1 0-3 3"}),Wt("path",{d:"M12 5a3 3 0 1 1 3 3"}),Wt("path",{d:"M3 12h18"}),Wt("path",{d:"M12 22V8"})]}),ba=({className:e,width:t=24,height:n=24})=>Wt("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:Wt("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})=>Wt("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:[Wt("path",{d:"M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z"}),Wt("circle",{cx:"12",cy:"10",r:"3"})]}),Ca=({className:e,width:t=24,height:n=24})=>Wt("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:Wt("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})=>Wt("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:[Wt("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),Wt("path",{d:"M15 3v18"}),Wt("path",{d:"m8 9 3 3-3 3"})]}),Ma=({className:e,width:t=24,height:n=24})=>Wt("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:[Wt("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),Wt("path",{d:"M15 3v18"}),Wt("path",{d:"m10 15-3-3 3-3"})]}),Sa=({className:e,width:t=24,height:n=24})=>Wt("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:[Wt("path",{d:"m12 19-7-7 7-7"}),Wt("path",{d:"M19 12H5"})]}),Na=({className:e,width:t=24,height:n=24})=>Wt("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:[Wt("path",{d:"M4 11a9 9 0 0 1 9 9"}),Wt("path",{d:"M4 4a16 16 0 0 1 16 16"}),Wt("circle",{cx:"5",cy:"19",r:"1"})]}),ka=({className:e,width:t=24,height:n=24})=>Wt("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:[Wt("circle",{cx:"12",cy:"12",r:"10"}),Wt("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),Wt("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]});function Ia(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 Aa(e,t="en-US"){var n;if(["today","day","week","month","year"].includes(e)){const n=Ia(e,t);if(n)return xa(n)}const a=k(t),r=S[a],i=null===(n=null==r?void 0:r.messages)||void 0===n?void 0:n[e];if(i)return i;const o=S.en.messages;return(null==o?void 0:o[e])||e}const Ha=({locale:e="en-US",messages:t,children:n})=>{const a=p(()=>"string"==typeof e?{code:I(e)?e:"en-US",messages:void 0}:e&&"string"!=typeof e&&!I(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:Aa(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 Wt(Hn.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 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}=Pn(),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:Wt("div","select"===t?{className:"df-view-switcher-select",ref:r,children:[Wt("button",{type:"button",onClick:()=>a(!n),className:"df-view-switcher-select-trigger","aria-expanded":n,"aria-haspopup":"listbox",children:[Wt("span",{children:Pa(l,e,i)}),Wt("span",{className:"df-view-switcher-select-chevron","data-open":n?"true":"false",children:Wt(ha,{width:16,height:16})})]}),n&&Wt("div",{className:"df-view-switcher-select-dropdown df-animate-in df-fade-in df-zoom-in-95",children:Wt("div",{className:"df-view-switcher-select-list",role:"listbox",children:o.map(t=>Wt("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,i)},t))})})]}:{className:"df-view-switcher",children:o.map(t=>Wt("button",{type:"button",className:"df-view-switcher-btn","data-active":l===t?"true":"false",onClick:()=>{e.changeView(t),e.triggerRender()},children:Pa(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}=An(),h="mobile"===u,{t:g}=Pn(),m=f(e=>{const t=e.currentTarget.value;t!==i&&(null==a||a(t))},[a,i]);return Wt("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:[Wt("div",{className:"df-header-left",children:n&&l&&Wt("button",{type:"button",id:"dayflow-add-event-btn",onClick:n,className:sa,title:h?g("newEvent")||"New Event":g("createCalendar")||"Add Calendar",children:Wt(ga,{})})}),Wt("div",{className:"df-header-mid",children:d&&Wt(La,{mode:t,calendar:e})}),Wt("div",{className:"df-header-right",children:[!d&&Wt(La,{mode:t,calendar:e}),h?Wt("button",{type:"button",onClick:r,className:sa,title:g("search")||"Search",children:Wt(ma,{})}):Wt("div",{className:"df-search-group",children:[Wt("div",{className:"df-search-group-icon",children:Wt(ma,{width:16,height:16})}),Wt("input",{id:"dayflow-search-input",type:"text",placeholder:g("search")||"Search",value:i,onChange:m,className:"df-search-group-input",style:{width:"12rem"}}),i&&Wt("button",{type:"button",onClick:()=>{null==a||a("")},className:"df-search-group-clear",children:Wt("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[Wt("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Wt("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})]})},Ya=r(void 0),ja=({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 Wt(Ya.Provider,{value:d,children:e})},Za=()=>{const e=D(Ya);if(void 0===e)throw new Error("useTheme must be used within a ThemeProvider");return e},Fa=r(null);let _a=0;function Wa({generatorName:e,generatorArgs:t,defaultContent:n,store:a}){const r=v(null),i=D(Fa),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++),y(()=>{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 Wt("div",{ref:r,className:"df-content-slot "+(c||"sidebar"===e?"df-content-slot-stacked":""),children:!s&&n})}const za=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]),Wt("div",{ref:n,className:e.className})},Ua=({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 Wt("div",{className:"df-default-color-picker",children:Wt(za,{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=Wt(i,{children:[v&&Wt("svg",{className:"df-loading-btn-spinner",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[Wt("circle",{className:"df-loading-btn-track",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),Wt("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"})]}),Wt("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 Wt("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"],Ga=({onClose:t,onCreate:n,app:a})=>{const{t:r}=Pn(),{effectiveTheme:o}=Za(),[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}},[]),[M,S]=g(null),N=e=>{v(e.hex)},k=()=>{y(!1)},I=()=>{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(Wt("div",{className:"df-portal df-create-calendar-dialog-backdrop",children:Wt("div",{className:"df-animate-in df-fade-in df-zoom-in-95 df-create-calendar-dialog-panel",onClick:e=>e.stopPropagation(),children:[Wt("h2",{className:"df-create-calendar-dialog-title "+(h?"df-create-calendar-dialog-title-compact":""),children:r("createCalendar")}),Wt("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==M?void 0:M.hex)&&void 0!==e?e:T(b.hue,b.saturation,b.lightness);const{colors:r,darkColors:i}=se(a),o={id:St(),name:l.trim(),colors:r,darkColors:i,isVisible:!0,isDefault:!1};yield n(o),t()}finally{u(!1)}}}),children:[h?Wt(i,{children:[Wt("div",{className:"df-create-calendar-dialog-color-row",children:[Wt("div",{className:"df-create-calendar-dialog-color-preview",style:{backgroundColor:m}}),Wt("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})]}),Wt("div",{className:"df-create-calendar-dialog-color-section",children:[Wt("div",{className:"df-create-calendar-dialog-color-grid",children:Va.map(e=>Wt("button",{type:"button",className:"df-create-calendar-dialog-color-btn","data-selected":m===e?"true":"false",style:{backgroundColor:e},onClick:()=>v(e)},e))}),Wt("div",{style:{position:"relative"},children:[Wt("button",{type:"button",onClick:()=>{w(m),y(!0)},className:"df-create-calendar-dialog-custom-color-btn",children:r("customColor")}),f&&Wt("div",{className:"df-create-calendar-dialog-picker-overlay",onClick:I,children:Wt("div",{className:"df-animate-in df-fade-in df-zoom-in-95 df-create-calendar-dialog-picker-inner",onClick:e=>e.stopPropagation(),children:Wt(Wa,{generatorName:"createCalendarDialogColorPicker",generatorArgs:{color:m,onChange:N,onAccept:k,onCancel:I,styles:O},defaultContent:Wt("div",{className:"df-create-calendar-dialog-picker-card",children:[Wt(Ua,{color:m,onChange:N}),Wt("div",{className:"df-create-calendar-dialog-picker-actions",children:[Wt("button",{type:"button",onClick:I,className:"df-btn-sm df-btn-sm-ghost",children:r("cancel")}),Wt("button",{type:"button",onClick:k,className:"df-fill-primary df-btn-sm",children:"OK"})]})]})})})})]})]})]}):Wt("div",{className:"df-create-calendar-dialog-blossom-row",children:[Wt("div",{className:"df-create-calendar-dialog-blossom-input-area",children:Wt("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})}),Wt("div",{className:"df-create-calendar-dialog-blossom-picker-wrap",children:Wt("div",{className:"df-create-calendar-dialog-blossom-picker-inner",children:Wt(za,{defaultValue:b,coreSize:36,petalSize:32,openOnHover:!1,onChange:e=>S(e),onCollapse:e=>S(e),className:"df-create-calendar-dialog-blossom-picker"})})})]}),Wt("div",{className:"df-create-calendar-dialog-actions",children:[Wt("button",{type:"button",onClick:t,disabled:d,className:"df-btn-sm df-btn-sm-ghost",children:r("cancel")}),Wt(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 qa=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:--qa,__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,t)=>Ka("span",{className:"df-range-picker-weekday-label",children:e},t))}),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,M,S,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 k=e;if("hour"in k&&!("timeZoneId"in k)){const e=null!=t?t:n.Now.timeZoneId();if("function"==typeof k.toZonedDateTime)try{return k.toZonedDateTime(e)}catch(e){}return n.ZonedDateTime.from({timeZone:e,year:k.year,month:k.month,day:k.day,hour:k.hour,minute:k.minute,second:null!==(r=k.second)&&void 0!==r?r:0,millisecond:null!==(i=k.millisecond)&&void 0!==i?i:0,microsecond:null!==(o=k.microsecond)&&void 0!==o?o:0,nanosecond:null!==(l=k.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 k.timeZone?k.timeZone:null===(s=k.timeZone)||void 0===s?void 0:s.id)&&void 0!==d?d:k.timeZoneId)&&void 0!==c?c:t)&&void 0!==u?u:a?gr(a):void 0)&&void 0!==h?h:n.Now.timeZoneId();if("function"==typeof k.toZonedDateTime)try{return k.toZonedDateTime(r)}catch(e){}const i=null!=a?a:n.Now.zonedDateTimeISO(r);return n.ZonedDateTime.from({timeZone:r,year:null!==(g=k.year)&&void 0!==g?g:i.year,month:null!==(m=k.month)&&void 0!==m?m:i.month,day:null!==(v=k.day)&&void 0!==v?v:i.day,hour:null!==(p=null!==(f=k.hour)&&void 0!==f?f:null==a?void 0:a.hour)&&void 0!==p?p:0,minute:null!==(D=null!==(y=k.minute)&&void 0!==y?y:null==a?void 0:a.minute)&&void 0!==D?D:0,second:null!==(b=null!==(w=k.second)&&void 0!==w?w:null==a?void 0:a.second)&&void 0!==b?b:0,millisecond:null!==(C=null!==(E=k.millisecond)&&void 0!==E?E:null==a?void 0:a.millisecond)&&void 0!==C?C:0,microsecond:null!==(M=null!==(T=k.microsecond)&&void 0!==T?T:null==a?void 0:a.microsecond)&&void 0!==M?M:0,nanosecond:null!==(N=null!==(S=k.nanosecond)&&void 0!==S?S: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",showTimeFormat:a="HH:mm",showTime:r=!0,onChange:i,onOk:o,timeZone:l=n.Now.timeZoneId(),startOfWeek:s=1,disabled:d=!1,placement:u="bottomLeft",autoAdjustOverflow:h=!0,getPopupContainer:y,matchTriggerWidth:D=!1,locale:w="en-US"})=>{const b=p(()=>"string"==typeof w?w:(null==w?void 0:w.code)||"en-US",[w]),E=p(()=>void 0===r||"object"==typeof r||Boolean(r),[r]),C=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})(b,"short"),[b]),T=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})(b,"narrow",s),[b,s]),M=p(()=>E?"object"==typeof r&&(null==r?void 0:r.format)?r.format:a:"",[E,r,a]),S=p(()=>cr(t,M),[t,M]),N=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]),k=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,x]=g(k),O=v(k),[R,A]=g("start"),[H,P]=g([vr(k[0],t,M),vr(k[1],t,M)]),L=v([vr(k[0],t,M),vr(k[1],t,M)]),$=v(k),[Y,j]=g(k[0].toPlainDate().with({day:1})),[Z,F]=g(!1),_=f(e=>{F(e)},[]),[W,z]=g(u),U=v(u),B=v(null),V=v(null),G=v({start:{hour:null,minute:null},end:{hour:null,minute:null}}),q=v(!1),K=v(!1);m(()=>{L.current=H},[H]),m(()=>{$.current=I},[I]),m(()=>{const e=O.current,t=0!==n.ZonedDateTime.compare(e[0],k[0])||e[0].timeZoneId!==k[0].timeZoneId,a=0!==n.ZonedDateTime.compare(e[1],k[1])||e[1].timeZoneId!==k[1].timeZoneId;(t||a)&&x(k),O.current=k},[k]),m(()=>{j(k[0].toPlainDate().with({day:1}))},[k[0]]);const X=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})},[]),J=f(e=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{const t=G.current[e];["hour","minute"].forEach(e=>{const n=t[e];if(!n)return;const a=n.querySelector('[data-active="true"]');a&&X(n,a,0)})})})},[X]);m(()=>{Z&&E&&J(R)},[R,Z,J,E]);const Q=I[0].epochMilliseconds,ee=I[0].offsetNanoseconds,te=I[1].epochMilliseconds,ne=I[1].offsetNanoseconds;m(()=>{if(K.current)return;const[e,n]=$.current,a=vr(e,t,M),r=vr(n,t,M),[i,o]=L.current;i===a&&o===r||(L.current=[a,r],P([a,r]))},[Q,ee,te,ne,t,M]),m(()=>{if(!Z)return;const e=e=>{var t,n;const a=e.target;(null===(t=B.current)||void 0===t?void 0:t.contains(a))||(null===(n=V.current)||void 0===n?void 0:n.contains(a))||a.closest("[data-range-picker-popup]")||_(!1)};return document.addEventListener("pointerdown",e,!0),()=>{document.removeEventListener("pointerdown",e,!0)}},[Z]),m(()=>{Z||(A("start"),q.current||x(k),q.current=!1)},[Z,k]);const ae=f(e=>{i&&i(e,[vr(e[0],t,M),vr(e[1],t,M)])},[M,t,i]),re=f(e=>{o&&o(e,[vr(e[0],t,M),vr(e[1],t,M)])},[M,t,o]),ie=f((e,t)=>{x(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]})},[]),oe=f((e,t)=>{if(d)return;const a="start"===e?0:1;x(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=G.current[e].hour;if(!t)return;const n=t.querySelector('[data-active="true"]');n&&X(t,n,0)})})},[d,X]),le=f((e,t)=>{if(d)return;const a="start"===e?0:1;x(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=G.current[e].minute;if(!t)return;const n=t.querySelector('[data-active="true"]');n&&X(t,n,0)})})},[d,X]),se=f((e,t)=>{const n="start"===e?0:1;P(e=>{const a=[...e];return a[n]=t,a})},[]),de=f((e,n)=>{const a="start"===e?0:1,r=I[a],i=gr(r),o=hr(n,N,r,i);if(o){ie(e,o);const t=o.toPlainDate().with({day:1});return j(t),"start"===e&&A("end"),!0}return P(e=>{const n=[...e];return n[a]=vr(I[a],t,M),n}),!1},[I,M,t,N,ie]),ce=f(e=>t=>{const n=t.currentTarget.value;K.current=!0,se(e,n);const a="start"===e?0:1,r=$.current[a],i=gr(r),o=hr(n,N,r,i);if(o){ie(e,o);const t=o.toPlainDate().with({day:1});j(t),J(e)}},[se,N,ie,J]),ue=f(e=>n=>{var a;if(d)return;if(K.current=!1,Z){const n="start"===e?0:1,a=vr($.current[n],t,M);return void P(e=>{const t=[...e];return t[n]=a,t})}const r=n.relatedTarget;r&&(null===(a=B.current)||void 0===a?void 0:a.contains(r))||de(e,n.currentTarget.value)},[de,d,Z,t,M]),he=f(e=>t=>{"Enter"===t.key&&(t.preventDefault(),K.current=!1,de(e,t.currentTarget.value)),"Escape"===t.key&&t.currentTarget.blur()},[de]),ge=p(()=>{const e=Y,t=0===s?7:s,n=(e.dayOfWeek-t+7)%7,a=e.subtract({days:n});return Array.from({length:42},(e,t)=>a.add({days:t}))},[Y,s]),me=f((e=u)=>{if(!h||!B.current)return e;const t=B.current.getBoundingClientRect(),n=D?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},[h,D,u]),ve=f(()=>{const e=me();U.current!==e&&(U.current=e,z(e))},[me]),fe=e=>{if(d)return;A(e);const t=I["start"===e?0:1].toPlainDate().with({day:1});j(t);const n=me();U.current!==n&&(U.current=n,z(n)),_(!0)};m(()=>{if(!Z)return;ve();const e=()=>ve();return window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}},[Z,ve]);return Ka("div",{className:"df-range-picker df-range-picker-root",ref:B,children:[Ka("div",{className:"df-range-picker-trigger","data-disabled":d,"data-open":Z,children:[Ka("div",{className:"df-range-picker-field-group",children:Ka("input",{type:"text",name:"range-start",value:H[0],onChange:ce("start"),onFocus:()=>fe("start"),onClick:()=>fe("start"),onBlur:ue("start"),onKeyDown:he("start"),className:"df-range-picker-input","data-disabled":d,"data-focused":"start"===R&&Z,placeholder:S,autoComplete:"off",disabled:d})}),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:()=>fe("end"),onClick:()=>fe("end"),onBlur:ue("end"),onKeyDown:he("end"),className:"df-range-picker-input","data-disabled":d,"data-focused":"end"===R&&Z,placeholder:S,autoComplete:"off",disabled:d})})]}),Z&&c(Ka(yr,{visibleMonth:Y,monthLabels:C,weekDayLabels:T,calendarDays:ge,draftRange:I,focusedField:R,isTimeEnabled:!!E,disabled:d,matchTriggerWidth:D,popupRef:V,timeListRefs:G,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(d)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"===R){const n=t(I[0],e),a=I[1].epochMilliseconds-I[0].epochMilliseconds,r=n.add({milliseconds:a});return void x([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 x([n,a])}x([I[0],a]),j(a.toPlainDate().with({day:1}))},onHourSelect:oe,onMinuteSelect:le,onOk:()=>{q.current=!0,ae(I),re(I),_(!1)},getPopupStyle:()=>{if(!B.current)return{};const e=B.current.getBoundingClientRect(),t={position:"fixed",zIndex:9999};return U.current.startsWith("bottom")?t.top=e.bottom+8:t.bottom=window.innerHeight-e.top+8,u.endsWith("Left")?t.left=e.left:t.right=window.innerWidth-e.right,D&&(t.width=`${e.width}px`),t}}),y?y():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?Wt("div",{"data-calendar-picker-dropdown":"true",style:s,className:ta,children:e.map(e=>Wt("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:[Wt("div",{className:"df-calendar-picker-option-inner",children:[Wt("div",{className:"df-calendar-picker-check-area",children:e.value===t&&Wt(va,{className:"df-text-primary"})}),Wt("span",{className:"df-calendar-picker-option-label",children:e.label})]}),Wt("span",{className:"df-calendar-picker-color-swatch df-calendar-picker-color-swatch-sm",style:{backgroundColor:p(e.value)}})]},e.value))}):Wt("ul",{"data-calendar-picker-dropdown":"true",style:s,className:ta,children:e.map(e=>Wt("li",{className:"df-calendar-picker-option","data-selected":t===e.value?"true":"false",onClick:t=>y(t,e.value),children:[Wt("div",{className:"df-calendar-picker-check-area",children:e.value===t&&Wt(va,{className:"df-text-primary"})}),Wt("span",{className:"df-calendar-picker-color-swatch-sm",style:{backgroundColor:p(e.value)}}),Wt("span",{className:"df-calendar-picker-option-label",children:e.label})]},e.value))}),document.body):null;return Wt("div","mobile"===r?{className:"df-calendar-picker",ref:u,children:[Wt("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:[Wt("span",{className:"df-calendar-picker-color-swatch df-calendar-picker-color-swatch-sm",style:{backgroundColor:p(t)}}),Wt("span",{className:"df-calendar-picker-label",children:(null==D?void 0:D.label)||t}),Wt(fa,{className:"df-text-muted"})]}),w()]}:{className:"df-calendar-picker",ref:u,children:[Wt("button",{ref:h,type:"button",onClick:e=>{e.stopPropagation(),l(!o)},className:"df-calendar-picker-trigger",children:[Wt("span",{className:"df-calendar-picker-color-swatch",style:{backgroundColor:p(t)}}),Wt(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}=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]),M=p(()=>{var e;return null!==(e=null==l?void 0:l.timeZone)&&void 0!==e?e:n.Now.timeZoneId()},[l]),S=p(()=>{var e,t;return null!==(t=null===(e=null==l?void 0:l.getViewConfig("week"))||void 0===e?void 0:e.startOfWeek)&&void 0!==t?t:1},[l]),N=e=>{const[t,n]=e;h(Object.assign(Object.assign({},u),{start:t.toPlainDate(),end:n.toPlainDate()}))},k=null!==(s=null==l?void 0:l.canMutateFromUI(t.id))&&void 0!==s&&s,I=null==l?void 0:l.getReadOnlyConfig(t.id),x=!1!==(null==I?void 0:I.viewable),O=f||D,R=!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||!x)return null;if("undefined"==typeof window||"undefined"==typeof document)return null;const A=Wt("div",{className:"df-portal df-event-dialog-overlay",style:{zIndex:9998},"data-event-detail-dialog":"true",children:[Wt("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()}}),Wt("div",{className:"df-dialog-container",children:[Wt("button",{type:"button",onClick:o,disabled:O,className:"df-event-dialog-close","aria-label":"Close",children:Wt("svg",{fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:Wt("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),Wt("div",{children:[Wt("span",{className:"df-form-label",children:E("eventTitle")}),Wt("div",{className:"df-form-row",children:[Wt("div",{className:"df-form-field",children:Wt("input",{id:`event-dialog-title-${u.id}`,name:"title",type:"text",value:u.title,readOnly:!k||O,disabled:!k||O,onChange:e=>{h(Object.assign(Object.assign({},u),{title:e.target.value}))},className:"df-form-input"})}),k&&Wt(wr,{options:C,value:u.calendarId||"blue",disabled:O,onChange:e=>h(Object.assign(Object.assign({},u),{calendarId:e})),registry:null==l?void 0:l.getCalendarRegistry()})]}),u.allDay?Wt("div",{className:"df-event-dialog-time-row",children:[Wt("div",{className:"df-form-label",children:E("dateRange")}),Wt(Dr,{value:[u.start,u.end],format:"YYYY-MM-DD",showTime:!1,timeZone:M,startOfWeek:S,matchTriggerWidth:!0,disabled:!k||O,onChange:N,onOk:N,locale:null==l?void 0:l.state.locale})]}):Wt("div",{className:"df-event-dialog-time-row",children:[Wt("div",{className:"df-form-label",children:E("timeRange")}),Wt(Dr,{value:[u.start,u.end],timeZone:M,startOfWeek:S,disabled:!k||O,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})]}),R&&Wt("div",{className:"df-event-dialog-notes-row",children:[Wt("span",{className:"df-form-label",children:E("note")}),Wt("textarea",{id:`event-dialog-note-${u.id}`,name:"note",value:null!==(d=u.description)&&void 0!==d?d:"",readOnly:!k||O,disabled:!k||O,onChange:e=>h(Object.assign(Object.assign({},u),{description:e.target.value})),rows:4,className:"df-form-textarea",placeholder:E("addNotePlaceholder")})]}),k&&Wt("div",{className:"df-form-actions",children:[u.allDay?Wt("button",{type:"button",disabled:O,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}),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")}):Wt("button",{type:"button",disabled:O,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")}),Wt(Ba,{type:"button",disabled:O,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")}),Wt(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||O,loading:f,children:E("save")})]})]})]})]}),H=document.body;return H?c(A,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(),[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),M=p(()=>Ge(e.timeZone),[e.timeZone,a]),S=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:M.start,end:M.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:M.start,end:M.end})}),a},[i,e,M]);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,S]);const N=t=>{if(!t.calendarId)return;const a=St(),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!==S.length&&("ArrowDown"===e.key?(e.preventDefault(),s(e=>(e+1)%S.length)):"ArrowUp"===e.key?(e.preventDefault(),s(e=>(e-1+S.length)%S.length)):"Enter"===e.key&&(e.preventDefault(),S[l]&&N(S[l])))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[a,S,l]),a?c(Wt("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:[Wt("div",{className:"df-quick-create-header",children:[Wt("div",{className:"df-quick-create-title",children:r("quickCreateEvent")||"Quick Create Event"}),Wt("div",{className:"df-quick-create-input-wrap",children:Wt("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)})})]}),Wt("div",{className:"df-quick-create-list",children:[0===S.length&&i&&Wt("div",{className:"df-quick-create-empty",children:r("noSuggestions")||"Type to create"}),S.map((e,t)=>{return Wt("div",{className:"df-quick-create-item","data-selected":t===l?"true":"false",onClick:()=>N(e),onMouseEnter:()=>s(t),children:[Wt("div",{className:"df-quick-create-color-bar",style:{backgroundColor:e.color}}),Wt("div",{className:"df-quick-create-item-content",children:[Wt("div",{className:"df-quick-create-item-title",children:e.title}),Wt("div",{children:Wt("span",{className:"df-quick-create-item-badge",children:"new"===e.type?r("today"):r("tomorrow")})}),Wt("div",{className:"df-quick-create-item-time",children:(n=e.start,a=e.end,`${Er(n)} - ${Er(a)}`)})]})]},`${e.type}-${t}`);var n,a})]}),Wt("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}=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==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 Wt("div",{className:"df-mini-calendar-body",children:[a?Wt("div",{className:"df-mini-calendar-header-nav",children:[Wt("button",{type:"button",className:"df-mini-calendar-nav-btn",onClick:()=>r(-1),"aria-label":"Previous month",children:Wt(ca,{})}),Wt("span",{className:"df-mini-calendar-month-label",children:m}),Wt("button",{type:"button",className:"df-mini-calendar-nav-btn",onClick:()=>r(1),"aria-label":"Next month",children:Wt(ua,{})})]}):null,Wt("div",{className:"df-mini-calendar-grid",children:[g.map((e,t)=>Wt("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 Wt("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:[Wt("span",{className:"df-mini-calendar-day-number",children:e.date}),l&&n.length>0&&Wt("div",{className:"df-mini-calendar-dots",children:n.slice(0,4).map((e,t)=>Wt("div",{"data-mini-calendar-dot":"true",className:"df-mini-calendar-dot",style:{backgroundColor:e}},`${e}-${t}`))})]},e.fullDate.getTime())})]})]})},Mr=({checked:e,onChange:t,disabled:n})=>Wt("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:Wt("span",{className:"df-mobile-switch-thumb"})}),Sr=({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 Wt("div",{className:"df-time-wheel",children:[Wt("div",{ref:y,className:"df-time-wheel-column",onScroll:e=>b(e,"hour"),children:[Wt("div",{className:"df-time-wheel-spacer",style:{height:96}}),r.map((n,a)=>Wt("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:Wt("div",{className:"df-time-wheel-value","data-selected":String(n===l),style:E(a,u),children:n.toString().padStart(2,"0")})},`h-${a}-${n}`)),Wt("div",{className:"df-time-wheel-spacer",style:{height:96}})]}),Wt("div",{ref:D,className:"df-time-wheel-column",onScroll:e=>b(e,"minute"),children:[Wt("div",{className:"df-time-wheel-spacer",style:{height:96}}),i.map((n,a)=>Wt("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:Wt("div",{className:"df-time-wheel-value","data-selected":String(n===s),style:E(a,f),children:n.toString().padStart(2,"0")})},`m-${a}-${n}`)),Wt("div",{className:"df-time-wheel-spacer",style:{height:96}})]}),Wt("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}=Pn(),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),[M,S]=g(new Date),[N,k]=g(new Date),[I,x]=g(new Date),[O,R]=g(new Date),[A,H]=g(null),[P,L]=g(e),[Y,Z]=g(!1),[F,_]=g(!1);m(()=>{if(!e){Z(!0);const e=setTimeout(()=>{L(!1),Z(!1)},300);return()=>clearTimeout(e)}L(!0),Z(!1)},[e]),m(()=>{if(e&&r){const e=i.getEvents().some(e=>e.id===r.id);_(e)}},[e,r,i]);const W=i.getCalendars(),z=W.map(e=>({label:e.name,value:e.id}));m(()=>{e&&W.length>0&&(W.some(e=>e.id===b)||"blue"!==b&&""!==b||E(W[0].id))},[W,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=W[0])||void 0===t?void 0:t.id)||"blue"),T(r.allDay||!1),f(r.description||""),r.start)try{const e=j(r.start);S(e),x(e)}catch(e){const t=new Date;S(t),x(t)}if(r.end)try{const e=j(r.end);k(e),R(e)}catch(e){const t=new Date;k(t),R(t)}}else if(e&&!r){E((null===(n=W[0])||void 0===n?void 0:n.id)||"blue"),f("");const e=new Date;e.setMinutes(0,0,0),S(e),x(e),k(new Date(e.getTime()+36e5)),R(e)}},[e,r]);const U=p(()=>{if(!e||!r)return!1;const t=new Date(M),n=new Date(N),a=Object.assign(Object.assign({},r),{title:D,calendarId:b,allDay:C,description:v,start:C?Ie(t):$(t,i.timeZone),end:C?Ie(n):$(n,i.timeZone)});return!Ct(r,Ke(r,a,i.timeZone))},[e,r,D,b,C,M,N,v]);if(!P||!h)return null;const B=e=>{H(t=>t===e?null:e)},V=e=>e.toLocaleDateString(l,{day:"numeric",month:"short",year:"numeric"}),G=(e,t)=>{if("start"===e){const e=new Date(t);e.setHours(M.getHours(),M.getMinutes());const n=e.getTime()-M.getTime();S(e);const a=new Date(N.getTime()+n);k(a)}else{const e=new Date(t);e.setHours(N.getHours(),N.getMinutes()),k(e)}},q=(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(Wt("div",{className:"df-portal df-mobile-event-drawer",children:[Wt("div",{className:"df-mobile-event-drawer-backdrop","data-closing":String(Y),onClick:t}),Wt("div",{className:"df-mobile-event-drawer-panel "+(Y?"df-animate-slide-down":"df-animate-slide-up"),onClick:e=>e.stopPropagation(),children:[Wt("div",{className:"df-mobile-event-drawer-header",children:[Wt("button",{type:"button",onClick:t,className:"df-mobile-event-drawer-header-action",children:s("cancel")}),Wt("span",{className:"df-mobile-event-drawer-title",children:s(!u&&F?"viewEvent":F?"editEvent":"newEvent")}),u&&Wt("button",{type:"button",onClick:()=>{if(!r)return;const e=new Date(M),t=new Date(N),a=Object.assign(Object.assign({},r),{title:D,calendarId:b,allDay:C,start:C?Ie(e):$(e,i.timeZone),end:C?Ie(t):$(t,i.timeZone)});n(Ke(r,a,i.timeZone))},disabled:!U,className:"df-mobile-event-drawer-header-action df-mobile-event-drawer-header-action-primary "+(U?"":"df-mobile-event-drawer-header-action-disabled"),children:s(F?"done":"create")}),!u&&Wt("span",{className:"df-mobile-event-drawer-header-spacer"})]}),Wt("div",{className:"df-mobile-event-drawer-body",children:[Wt("div",{className:"df-mobile-event-drawer-section df-mobile-event-drawer-section-framed",children:Wt("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})}),W.length>0&&Wt("div",{className:"df-mobile-event-drawer-section df-mobile-event-drawer-section-framed",children:Wt("div",{className:"df-mobile-event-drawer-row",children:[Wt("span",{className:"df-mobile-event-drawer-label",children:s("calendar")}),Wt(wr,{options:z,value:b,onChange:u?E:()=>{},registry:i.getCalendarRegistry(),variant:"mobile",disabled:!u})]})}),Wt("div",{className:"df-mobile-event-drawer-section df-mobile-event-drawer-section-framed",children:Wt("div",{className:"df-mobile-event-drawer-row",children:[Wt("span",{className:"df-mobile-event-drawer-label",children:s("allDay")}),Wt(Mr,{checked:C,onChange:u?T:()=>{},disabled:!u})]})}),Wt("div",{className:"df-mobile-event-drawer-section",children:[Wt("div",{className:"df-mobile-event-drawer-row df-mobile-event-drawer-row-padded",children:[Wt("span",{className:"df-mobile-event-drawer-label",children:s("starts")}),Wt("div",{className:"df-mobile-event-drawer-controls",children:[Wt("button",{type:"button",className:"df-mobile-event-drawer-picker-trigger","data-active":String("start-date"===A),onClick:()=>u&&B("start-date"),disabled:!u,"aria-expanded":"start-date"===A,children:V(M)}),!C&&Wt("button",{type:"button",className:"df-mobile-event-drawer-picker-trigger","data-active":String("start-time"===A),onClick:()=>u&&B("start-time"),disabled:!u,"aria-expanded":"start-time"===A,children:Ze(M.getHours()+M.getMinutes()/60,0,o)})]})]}),Wt("div",{className:"df-mobile-event-drawer-expander","data-kind":"calendar","data-expanded":String("start-date"===A),children:Wt("div",{className:"df-mobile-event-drawer-expander-content",children:Wt(Tr,{currentDate:M,visibleMonth:I,onDateSelect:e=>G("start",e),onMonthChange:e=>q("start",e),showHeader:!0,events:i.getEvents(),calendarRegistry:i.getCalendarRegistry(),timeZone:i.timeZone})})}),Wt("div",{className:"df-mobile-event-drawer-expander","data-kind":"time","data-expanded":String("start-time"===A),children:Wt("div",{className:"df-mobile-event-drawer-expander-content",children:Wt(Sr,{date:M,onChange:e=>{const t=N.getTime()-M.getTime();S(e),k(new Date(e.getTime()+t))},timeFormat:o})})})]}),Wt("div",{className:"df-mobile-event-drawer-section",children:[Wt("div",{className:"df-mobile-event-drawer-row df-mobile-event-drawer-row-padded",children:[Wt("span",{className:"df-mobile-event-drawer-label",children:s("ends")}),Wt("div",{className:"df-mobile-event-drawer-controls",children:[Wt("button",{type:"button",className:"df-mobile-event-drawer-picker-trigger","data-active":String("end-date"===A),onClick:()=>u&&B("end-date"),disabled:!u,"aria-expanded":"end-date"===A,children:V(N)}),!C&&Wt("button",{type:"button",className:"df-mobile-event-drawer-picker-trigger","data-active":String("end-time"===A),onClick:()=>u&&B("end-time"),disabled:!u,"aria-expanded":"end-time"===A,children:Ze(N.getHours()+N.getMinutes()/60,0,o)})]})]}),Wt("div",{className:"df-mobile-event-drawer-expander","data-kind":"calendar","data-expanded":String("end-date"===A),children:Wt("div",{className:"df-mobile-event-drawer-expander-content",children:Wt(Tr,{currentDate:N,visibleMonth:O,onDateSelect:e=>G("end",e),onMonthChange:e=>q("end",e),showHeader:!0,events:i.getEvents(),calendarRegistry:i.getCalendarRegistry(),timeZone:i.timeZone})})}),Wt("div",{className:"df-mobile-event-drawer-expander","data-kind":"time","data-expanded":String("end-time"===A),children:Wt("div",{className:"df-mobile-event-drawer-expander-content",children:Wt(Sr,{date:N,onChange:e=>{if(e<M){const t=N.getTime()-M.getTime();k(e),S(new Date(e.getTime()-t))}else k(e)},timeFormat:o})})})]}),y&&Wt("div",{className:"df-mobile-event-drawer-section df-mobile-event-drawer-section-framed",children:Wt("textarea",{placeholder:s("notesPlaceholder"),value:v,onChange:e=>u&&f(e.currentTarget.value),readOnly:!u,className:"df-mobile-event-drawer-notes"})}),u&&F&&a&&r&&Wt("div",{className:"df-mobile-event-drawer-section df-mobile-event-drawer-section-danger",children:Wt("button",{type:"button",onClick:()=>a(r.id),className:"df-mobile-event-drawer-delete-button",children:s("delete")})})]})]})]}),document.body)},kr=()=>Wt("svg",{className:"df-search-results-state-icon",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:Wt("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),Ir=({loading:e,results:t,keyword:n,onResultClick:a,emptyText:r})=>{const{t:i,locale:o}=Pn(),l=p(()=>ln(new Date),[]),s=p(()=>dn(t,l),[t,l]),d=e=>on(e);return e?Wt("div",{className:"df-search-results-state",children:[Wt(Da,{className:"df-search-results-loader"}),Wt("span",{children:"Loading..."})]}):0===t.length?n?Wt("div",{className:"df-search-results-state",children:[Wt(kr,{}),Wt("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:Wt("div",{className:"df-search-results",children:s.map(e=>{const{title:t,tone:n}=sn(e.date,l,o,i);return Wt("div",{className:"df-search-results-group",children:[Wt("h3",{className:"df-search-results-date-header","data-tone":n,children:t}),Wt("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 Wt("div",{children:[Wt("div",{className:"df-search-results-event",onClick:()=>null==a?void 0:a(e),children:Wt("div",{className:"df-search-results-event-inner",children:[Wt("div",{className:"df-search-results-color-bar",style:{backgroundColor:e.color||"#3b82f6"}}),Wt("div",{className:"df-search-results-event-content",children:[Wt("div",{className:"df-search-results-event-title",children:e.title}),Wt("div",{className:"df-search-results-event-time",children:[Wt("div",{children:l}),s&&Wt("div",{className:"df-search-results-end-time",children:s})]})]})]})}),Wt("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}=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(Wt("div",{className:"df-mobile-fullscreen",children:[Wt("div",{className:"df-search-dialog-header",children:[Wt("button",{type:"button",onClick:t,className:"df-search-dialog-back-btn",children:Wt(Sa,{className:"df-search-dialog-back-icon"})}),Wt("div",{className:"df-search-dialog-input-wrap",children:[Wt("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&&Wt("button",{type:"button",onClick:()=>{""!==n&&a("")},className:"df-search-dialog-input-clear",children:Wt(pa,{className:"df-search-dialog-clear-icon"})})]})]}),Wt("div",{className:"df-search-dialog-results",children:Wt(Ir,{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})=>Wt("div",{className:"df-search-drawer","data-open":e?"true":"false",children:Wt("div",{className:"df-search-drawer-content",children:Wt(Ir,{loading:t,results:n,keyword:a,onResultClick:r,emptyText:i})})});let Rr=null;function Ar(e){Rr=e}const Hr={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):Hr}const Lr=({locale:e,messages:t,children:n})=>Pn().isDefault?Wt(Ha,{locale:e,messages:t,children:n}):n,$r=({app:t,meta:n,customMessages:a,search:r,titleBarSlot:i,collapsedSafeAreaLeft:l})=>{const s=D(Fa),{tick:d,selectedEventId:u}=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:h}=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}}(),y=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):j(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,r),w=t.getUseEventDetailDialog()?br:void 0,b=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:P(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,w,d),E=t.getUseEventDetailPanel(),C=Pr(t),T=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}=Ge(e.timeZone),a={id:St(),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,h,C.enabled),[M,S]=g(()=>t.getTheme());m(()=>t.subscribeThemeChange(e=>S(e)),[t]);const N=f(e=>t.setTheme(e),[t]);m(()=>{const e=t.callbacks,n=e.onDismissUI,a=e.onEventDetailToggle,r=e.onMobileEventDetailToggle;return e.onDismissUI=()=>{b.detailPanelEventId&&b.setDetailPanelEventId(null),T.isMobileDrawerOpen&&T.setIsMobileDrawerOpen(!1),null==n||n()},e.onEventDetailToggle=e=>{b.setDetailPanelEventId(e),null==a||a(e)},e.onMobileEventDetailToggle=e=>{T.setMobileDraftEvent(e),T.setIsMobileDrawerOpen(Boolean(e)),null==r||r(e)},()=>{e.onDismissUI=n,e.onEventDetailToggle=a,e.onMobileEventDetailToggle=r}},[t,b,T]),m(()=>{if(!h||!b.detailPanelEventId)return;const e=b.detailPanelEventId.split("::")[0],n=t.getEvents().find(t=>t.id===e);n&&(T.setMobileDraftEvent(n),T.setIsMobileDrawerOpen(!0)),b.setDetailPanelEventId(null)},[b.detailPanelEventId,h]);const k=f(e=>{t.setCurrentDate(e),t.selectEvent(null)},[t]),I=f(e=>t.selectEvent(e),[t]),x=v(null),O={app:t,config:t.getCurrentView().config||{},useEventDetailPanel:E,switcherMode:t.state.switcherMode,calendarRef:x,meta:n,selectedEventId:u,onEventSelect:I,onDateChange:k,detailPanelEventId:b.detailPanelEventId,onDetailPanelToggle:b.setDetailPanelEventId},R=p(()=>({isCollapsed:C.isCollapsed,toggleCollapsed:C.toggleCollapsed}),[C.isCollapsed,C.toggleCollapsed]),A=null!=l,H=A?"0px":C.miniWidth,L=A&&C.isCollapsed?l:C.safeAreaLeft,$=t.getCalendarHeaderConfig(),Y=Object.assign({calendar:t,switcherMode:t.state.switcherMode,onAddCalendar:T.handleAddButtonClick,onSearchChange:y.setSearchKeyword,onSearchClick:y.handleSearchClick,searchValue:y.searchKeyword,isSearchOpen:y.isSearchOpen,isEditable:t.canMutateFromUI()},L>0?{safeAreaLeft:L}:{}),Z=t.getCurrentView().component,F=Nr,_={isOpen:T.isMobileDrawerOpen,onClose:()=>{T.setIsMobileDrawerOpen(!1),T.setMobileDraftEvent(null)},onSave:e=>{t.getEvents().some(t=>t.id===e.id)?t.updateEvent(e.id,e):t.addEvent(e),T.setIsMobileDrawerOpen(!1),T.setMobileDraftEvent(null)},onEventDelete:e=>{t.deleteEvent(e),T.setIsMobileDrawerOpen(!1),T.setMobileDraftEvent(null)},draftEvent:T.mobileDraftEvent,app:t};return Wt(ja,{initialTheme:M,onThemeChange:N,children:Wt(Lr,{locale:t.state.locale,messages:a,children:Wt("div",{className:"df-calendar-container",children:[Wt(Wa,{store:s,generatorName:"titleBarSlot",generatorArgs:R,defaultContent:i&&("function"==typeof i?i(R):i)}),C.enabled&&Wt("aside",{className:"df-calendar-sidebar-aside",style:{width:C.width},children:C.content}),Wt("div",{className:"df-calendar-shell","data-sidebar-enabled":C.enabled?"true":"false","data-sidebar-collapsed":C.isCollapsed,style:{marginLeft:C.enabled?`calc(${C.isCollapsed?H:C.width} - 1px)`:0},children:[!1===$?null:Wt(Wa,{store:s,generatorName:"calendarHeader",generatorArgs:Y,defaultContent:o($a,Y)}),Wt("div",{className:"df-calendar-content-wrap",ref:x,children:[Wt("div",{className:"df-calendar-renderer",children:[Wt("div",{className:"df-calendar-view-container",children:Wt(Z,Object.assign({},O))}),Wt(Or,{isOpen:y.isSearchOpen,onClose:y.handleSearchClose,loading:y.searchLoading,results:y.searchResults,keyword:y.searchKeyword,onResultClick:e=>y.handleSearchResultClick(e,"desktop"),emptyText:null==r?void 0:r.emptyText})]}),Wt(xr,{isOpen:y.isMobileSearchOpen,onClose:y.handleMobileSearchClose,keyword:y.searchKeyword,onSearchChange:y.setSearchKeyword,results:y.searchResults,loading:y.searchLoading,onResultClick:e=>y.handleSearchResultClick(e,"mobile"),emptyText:null==r?void 0:r.emptyText})]})]}),Wt(Cr,{app:t,anchorRef:T.quickCreateAnchorRef,isOpen:T.isQuickCreateOpen,onClose:()=>T.setIsQuickCreateOpen(!1)}),Wt(Wa,{store:s,generatorName:"mobileEventDetail",generatorArgs:_,defaultContent:Wt(F,Object.assign({},_))}),C.extraContent,T.isCreateCalendarOpen&&Wt(Ga,{app:t,onClose:()=>T.setIsCreateCalendarOpen(!1),onCreate:n=>e(void 0,void 0,void 0,function*(){yield t.createCalendar(n),T.setIsCreateCalendarOpen(!1)})}),(()=>{if(!b.dialogProps)return null;const e=w,t="undefined"==typeof document?null:document.body;if(!t)return null;const n=null==s?void 0:s.isOverridden("eventDetailDialog");return Wt(Wa,{store:s,generatorName:"eventDetailDialog",generatorArgs:b.dialogProps,defaultContent:n?null:c(o(e,b.dialogProps),t)})})()]})})})};class Yr{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 jr{constructor(e,t){this.app=e,this.container=null,this.unsubscribe=null,this.renderRequested=!1,this.extraProps={},this.customRenderingStore=new Yr(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(Fa.Provider,{value:this.customRenderingStore},o($r,Object.assign({app:this.app},this.extraProps))),this.container)}}function Zr(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:St(),name:i,isVisible:!0,colors:s,darkColors:d,subscription:{url:t,status:"ready"}},events:a.events}})}var Fr=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:--Fr,__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 Wr=({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"})}),zr=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)});zr.displayName="ContextMenu";const Ur=({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}),Gr=({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)})},qr=({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(Wr,{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}=Pn();if(!o.canMutateFromUI())return null;const c=cn.hasEvent(),u=Wt(i,{children:[Wt(Ur,{onClick:()=>{l(),r()},children:d("newEvent")||"New Event"}),Wt(Ur,{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=Se(r.start),o=Se(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:St(),start:r.allDay?Ie(s):Oe(s,t.timeZone),end:r.allDay?Ie(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 Wt(zr,{x:t,y:n,onClose:r,className:"df-context-menu",children:Wt(Wa,{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}=Pn();if(!o.canMutateFromUI(t.id))return null;const s=o.getCalendars(),d=Wt(i,{children:[Wt(Gr,{children:[Wt(qr,{children:l("calendars")||"Calendars"}),Wt(Kr,{children:s.map(e=>{const n=e.id===t.calendarId;return Wt(Ur,{onClick:()=>{return n=e.id,o.updateEvent(t.id,{calendarId:n}),void r();var n},children:Wt("div",{className:"df-context-menu-calendar-item",children:[Wt("div",{className:"df-context-menu-calendar-check-wrap",children:n&&Wt(va,{className:"df-text-primary df-context-menu-calendar-check"})}),Wt("div",{className:"df-context-menu-calendar-info",children:[Wt("div",{className:"df-context-menu-calendar-dot",style:{backgroundColor:e.colors.lineColor}}),Wt("span",{className:"df-context-menu-calendar-label","data-selected":n,children:e.name})]})]})},e.id)})})]}),Wt(Br,{}),Wt(Ur,{onClick:()=>{o.deleteEvent(t.id),r()},danger:!0,children:l("delete")||"Delete"}),Wt(Ur,{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"}),Wt(Ur,{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 Wt(zr,{x:n,y:a,onClose:r,children:Wt(Wa,{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("假期")?Wt(wa,{className:Kn}):t.includes("birthday")||t.includes("anniversary")||t.includes("生日")?Wt(ba,{className:Kn}):t.includes("conference")||t.includes("meeting")||t.includes("会议")||t.includes("研讨")?Wt(Ca,{className:Kn}):t.includes("trip")||t.includes("travel")||t.includes("旅行")?Wt(Ea,{className:Kn}):Wt(ya,{className:Kn})},oi=new WeakMap,li=(e,t,n=7,a)=>{const r=[],i=`${t.getTime()}|${n}|${null!=a?a:""}`,o=new Date(t);return o.setDate(t.getDate()+(n-1)),o.setHours(23,59,59,999),e.forEach(e=>{let l=oi.get(e);if(l){const e=l.get(i);if(e){for(let t=0;t<e.length;t++)r.push(e[t]);return}}const s=[],d=e=>{s.push(e),r.push(e)},c=()=>{l||(l=new Map,oi.set(e,l)),l.set(i,s)},u=Ne(e.start,a),h=e.end?Ne(e.end,a):u,g=new Date(u);g.setHours(0,0,0,0);const m=new Date(h);m.setHours(0,0,0,0);let v=new Date(m);if(!e.allDay&&0===h.getHours()&&0===h.getMinutes()&&0===h.getSeconds()){const e=h.getTime()-u.getTime();e>0&&e<864e5&&(v=new Date(m),v.setDate(v.getDate()-1))}const f=B(g,v)>0;if(!f&&e.allDay){if(g<t||g>o)return void c();const a=Math.floor((g.getTime()-t.getTime())/864e5);return a>=0&&a<=n-1&&d({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}),void c()}if(!f)return void c();const p=g;let y;if(e.allDay||0!==h.getHours()||0!==h.getMinutes()||0!==h.getSeconds()?(y=new Date(m),y.setHours(23,59,59,999)):(y=new Date(m),y.setTime(y.getTime()-1)),y<t||p>o)return void c();const D=p<t?t:p,w=y>o?o:y,b=Math.max(0,Math.floor((D.getTime()-t.getTime())/864e5)),E=Math.min(n-1,Math.floor((w.getTime()-t.getTime())/864e5)),C=p>=t,T=y<=o,M=0===b||E===n-1;let S;S=C&&T?"single":C?M&&E===n-1?"start-week-end":"start":T?M&&0===b?"end-week-start":"end":"middle";const N=B(p,y)+1;d({id:`${e.id}-week-${t.getTime()}`,originalEventId:e.id,event:e,startDayIndex:b,endDayIndex:E,segmentType:S,totalDays:N,segmentIndex:0,isFirstSegment:C,isLastSegment:T}),c()}),r},si=new WeakMap,di=(e,t,n=7,a)=>{if(e.allDay)return[];const r=`${t.getTime()}|${n}|${null!=a?a:""}`;let i=si.get(e);if(i){const e=i.get(r);if(e)return 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);const c=t=>(i||(i=new Map,si.set(e,i)),i.set(r,t),t),u=B(s,d);if(0===u)return c([]);const h=0!==l.getHours()||0!==l.getMinutes()||0!==l.getSeconds()||0!==l.getMilliseconds(),g=l.getTime()-o.getTime();if(!e.allDay&&1===u&&!h&&g<864e5)return c([]);const m=h?u:Math.max(0,u-1),v=[];for(let e=0;e<=m;e++){const a=new Date(s);a.setDate(s.getDate()+e);const r=Math.floor((a.getTime()-t.getTime())/864e5);if(r<0||r>n-1)continue;const i=0===e,d=e===m,c=i?o.getHours()+o.getMinutes()/60:0,u=d&&h?l.getHours()+l.getMinutes()/60:24;v.push({dayIndex:r,startHour:c,endHour:u,isFirst:i,isLast:d})}return c(v)},ci={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"},ui=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=ke(e.event.start,y),n=e.event.end?ke(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)`,M=v(null),S=v(null),N=t=>{const n="left"===t;return(n?e.isFirstSegment:e.isLastSegment)&&l&&u?Wt("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},k=ge(e.event),I=!!e.event.calendarIds&&e.event.calendarIds.length>1,x=I?pe(e.event):null,O=r||n||D,R=()=>{const t=b.allDay,n=ge(b),a=K(b.start),r=Fe(b),i=Ze(a),o=Ze(r),l=me(e.event),s=O&&I;if(t){const t=()=>e.isFirstSegment?b.title:"middle"===e.segmentType||e.isLastSegment&&e.totalDays>1?"···":b.title;return Wt("div",{className:"df-month-segment-event-all-day",children:[e.isFirstSegment&&ii(b)&&Wt("div",{className:"df-event-icon-slot",children:Wt("div",{className:"df-event-year-icon-badge",style:{backgroundColor:he(n)},children:ii(b)})}),Wt("div",{className:"df-month-segment-event-all-day-main",children:Wt("div",{className:"df-month-segment-event-all-day-title "+(d?"df-mobile-mask-fade":""),style:d?ci:void 0,children:t()})}),e.isLastSegment&&"single"!==e.segmentType&&Wt("div",{className:"df-month-segment-event-tail",children:Wt("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 Wt("div",{className:"df-event-month-main",children:[!s&&Wt("div",{className:qn,style:l.length>1?{background:ve(l)}:{backgroundColor:l[0]}}),Wt("div",{className:"df-event-month-main",children:Wt("span",{className:"df-event-month-title "+(d?"df-mobile-mask-fade":""),style:d?ci:void 0,children:c})}),e.isFirstSegment&&!d&&Wt("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&&Wt("span",{className:"df-month-segment-event-tail-time",children:`ends ${o}`})]})},A=e.endDayIndex-e.startDayIndex+1;return Wt("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(k),color:"#fff"}:I?{background:ye(x),color:ce(k)}:{backgroundColor:de(k),color:ce(k)}),{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":A,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;S.current={x:a,y:r},M.current=setTimeout(()=>{s&&s(e.event.id),c&&o({preventDefault:()=>{},stopPropagation:()=>{},currentTarget:i,touches:[{clientX:a,clientY:r}],cancelable:!1},e.event),M.current=null,navigator.vibrate&&navigator.vibrate(50)},500)},onTouchMove:e=>{if(M.current&&S.current){const t=Math.abs(e.touches[0].clientX-S.current.x),n=Math.abs(e.touches[0].clientY-S.current.y);(t>10||n>10)&&(clearTimeout(M.current),M.current=null,S.current=null,w(!1))}},onTouchEnd:()=>{w(!1),M.current&&(clearTimeout(M.current),M.current=null),S.current=null},title:`${b.title} (${zt(b.start)} - ${zt(b.end)})`,children:[d&&r&&u&&Wt(i,{children:[e.isFirstSegment&&Wt("div",{className:"df-event-touch-resize-indicator","data-axis":"horizontal","data-position":"left",style:{borderColor:he(k)},onTouchStart:t=>{t.stopPropagation(),null==l||l(t,e.event,"left")}}),e.isLastSegment&&Wt("div",{className:"df-event-touch-resize-indicator","data-axis":"horizontal","data-position":"right",style:{borderColor:he(k)},onTouchStart:t=>{t.stopPropagation(),null==l||l(t,e.event,"right")}})]}),N("left"),Wt("div",{className:"df-month-segment-event-body",style:{cursor:a?"ew-resize":"pointer"},children:f?f(R()):R()}),N("right")]})});ui.displayName="MultiDayEvent";const hi=({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=Wt("div",{className:"df-event-content-row",children:[s&&(d?Wt("div",{className:"df-event-icon-slot",children:d}):Wt("span",{className:"df-event-icon-slot",children:Wt(ya,{className:Kn})})),Wt("div",{className:`${Gn} df-event-title-tight`,children:e.title})]});return Wt("div",{className:"df-event-all-day-shell",style:c,children:[l?l(u):u,n&&t&&Wt(i,{children:[Wt("div",{className:Xn,onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),n(t,e,"left")},onClick:e=>{e.preventDefault(),e.stopPropagation()}}),Wt("div",{className:Jn,onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),n(t,e,"right")},onClick:e=>{e.preventDefault(),e.stopPropagation()}})]})]})},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,isEventSelected:t,isMobile:n})=>{const a=!1!==e.icon,r="boolean"==typeof e.icon?null:e.icon;return Wt("div",{className:"df-event-month-all-day",children:[a&&(r?Wt("div",{className:"df-event-icon-slot",children:r}):e.title.toLowerCase().includes("easter")||e.title.toLowerCase().includes("holiday")?Wt("span",{className:"df-event-holiday-icon",children:"⭐"}):Wt("span",{className:"df-event-icon-slot",children:Wt(ya,{className:Kn})})),Wt("span",{className:"df-event-month-title "+(n?"df-mobile-mask-fade":""),style:n?gi:void 0,children:e.title})]})},vi={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"},fi=({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 Wt("div",{className:"df-event-month-regular","data-mobile":String(!!r),children:[Wt("div",{className:"df-event-month-main",children:[!d&&Wt("div",{style:s,className:qn}),Wt("span",{className:"df-event-month-title "+(r?"df-mobile-mask-fade":""),style:r?vi:void 0,children:e.title})]}),!a&&!r&&Wt("span",{className:"df-event-month-time",children:i})]})},pi=({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:Fe(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?Wt("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)"}}):Wt("div",{className:"df-event-color-bar",style:{backgroundColor:D}}),b=Wt(i,{children:[w,Wt("div",{className:"df-event-timed-content","data-density":p,children:[Wt("div",{className:`${Gn} ${g<=.25?"df-event-title-tight":""}`,children:e.title}),g>.5&&Wt("div",{className:"df-event-time",children:n?`${Ze(u,0,s)} - ${Ze(h,0,s)}`:_e(e,s)})]})]});return Wt(i,{children:[c?c(b):b,l&&a&&"vertical"===d&&Wt(i,{children:[m&&Wt("div",{className:"df-event-resize-handle df-event-resize-handle-top",onMouseDown:t=>l(t,e,"top")}),v&&Wt("div",{className:"df-event-resize-handle df-event-resize-handle-bottom",onMouseDown:t=>l(t,e,"bottom")}),!m&&v&&n&&Wt("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&&Wt(i,{children:[Wt("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")}}),Wt("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&&Wt(i,{children:[Wt("div",{className:Xn,onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),l(t,e,"left")},onClick:e=>{e.preventDefault(),e.stopPropagation()}}),Wt("div",{className:Jn,onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),l(t,e,"right")},onClick:e=>{e.preventDefault(),e.stopPropagation()}})]})]})},yi=({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?Wt("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 Wt("div",{className:"df-event-year-content",onMouseDown:t=>{a&&(t.stopPropagation(),a(t,e))},children:[t.isFirstSegment&&ii(e)&&Wt("div",{className:"df-event-icon-slot",children:Wt("div",{className:"df-event-year-icon-badge",style:{backgroundColor:he(s)},children:ii(e)})}),Wt("div",{className:"df-event-year-main",children:Wt("div",{className:"df-event-year-title df-event-year-title-fade",children:n()})}),t.isLastSegment&&!t.isFirstSegment&&Wt("div",{className:"df-event-year-tail",children:Wt("div",{className:"df-event-year-tail-dot"})})]})}const n=t.isFirstSegment?e.title:"";return Wt("div",{className:"df-event-year-content df-event-year-content-timed",onMouseDown:t=>{a&&(t.stopPropagation(),a(t,e))},children:[!l&&Wt("span",{style:u,className:"df-event-year-indicator"}),Wt("span",{className:"df-event-year-title df-event-year-title-strong df-event-year-title-fade",children:n}),t.isLastSegment&&!t.isFirstSegment&&Wt("div",{className:"df-event-year-tail",children:Wt("div",{className:"df-event-year-tail-dot"})})]})};return Wt(i,{children:[m("left"),o?o(v()):v(),m("right")]})},Di=({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:M,renderVisualContent:S,resizeHandleOrientation:N})=>{const k=t===x.MONTH,I=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=>S?S(e):e;if(k&&a&&r)return Wt(ui,{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:M,renderSlot:e=>Wt(Wa,{store:E,generatorName:O,generatorArgs:C,defaultContent:R(e)})});if(I&&i)return Wt(yi,{event:e,segment:i,isEditable:u,onMoveStart:D,onResizeStart:w,renderSlot:e=>Wt(Wa,{store:E,generatorName:O,generatorArgs:C,defaultContent:R(e)})});if(k){const t=n?Wt(mi,{event:e,isEventSelected:d,isMobile:f}):Wt(fi,{event:e,app:y,isEventSelected:d,hideTime:v,isMobile:f});return Wt(Wa,{store:E,generatorName:O,generatorArgs:C,defaultContent:R(t)})}const A=e=>Wt(Wa,{store:E,generatorName:O,generatorArgs:C,defaultContent:R(e)});return n?Wt(hi,{event:e,isEditable:u,onResizeStart:w,isMultiDay:a,segment:r,isSlidingView:p,renderSlot:A}):Wt(pi,{event:e,app:y,multiDaySegmentInfo:b,isEditable:u,isTouchEnabled:m,isEventSelected:d,onResizeStart:w,timeFormat:T,resizeHandleOrientation:N,renderSlot:A})},wi=({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}=Za(),E=Kt(b),{t:C}=Pn(),[T,M]=g(t),[S,N]=g(!1),k=v(t),I=v(t),x=v(!1),O=f(()=>{if(x.current)return;const e=k.current,t=I.current;if(Ct(e,t))return;const n=Ke(e,t,null==y?void 0:y.timeZone);k.current=n,I.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(I.current,e)&&(I.current=e,M(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(k.current.id!==t.id)return O(),x.current=!1,k.current=t,I.current=t,void M(t);Ct(k.current,I.current)&&(k.current=t,I.current=t,M(t))},[t,O]),m(()=>()=>{O()},[O]);const A=p(()=>{var e;return null!==(e=null==y?void 0:y.timeZone)&&void 0!==e?e:n.Now.timeZoneId()},[y]),H=p(()=>{var e,t;return null!==(t=null===(e=null==y?void 0:y.getViewConfig("week"))||void 0===e?void 0:e.startOfWeek)&&void 0!==t?t:1},[y]),L=p(()=>(y?y.getCalendarRegistry():le()).getVisible().map(e=>({label:e.name,value:e.id})),[y,null==y?void 0:y.getCalendars()]),$="dark"===E||"undefined"!=typeof document&&document.documentElement.classList.contains("dark"),Y=null!==(D=null==y?void 0:y.canMutateFromUI(t.id))&&void 0!==D&&D,j=null==y?void 0:y.getReadOnlyConfig(t.id),Z=!1!==(null==j?void 0:j.viewable),F=!!T.allDay,_=!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(!Z)return null;const W=$?"#1f2937":"white",z=$?"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:W,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:W,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:W,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})(),B=Wt("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:[Wt("div",{style:U}),Wt("span",{className:"df-form-label",children:C("eventTitle")}),Wt("div",{className:"df-form-row",style:{marginBottom:"0.75rem"},children:[Wt("div",{className:"df-form-field",children:Wt("input",{id:`event-title-${T.id}`,name:"title",type:"text",value:T.title,readOnly:!Y||S,disabled:!Y||S,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"})}),Y&&Wt(wr,{options:L,value:T.calendarId||"blue",disabled:S,onChange:e=>{R(Object.assign(Object.assign({},T),{calendarId:e}))},registry:null==y?void 0:y.getCalendarRegistry()})]}),Wt("div",F?{className:"df-event-dialog-time-row",style:{marginBottom:"0.75rem"},children:[Wt("div",{className:"df-form-label",children:C("dateRange")}),Wt(Dr,{value:[T.start,T.end],format:"YYYY-MM-DD",showTime:!1,timeZone:A,startOfWeek:H,matchTriggerWidth:!0,disabled:!Y||S,onChange:e=>{if(S)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:[Wt("div",{className:"df-form-label",children:C("timeRange")}),Wt(Dr,{value:[T.start,T.end],timeZone:A,startOfWeek:H,disabled:!Y||S,onChange:e=>{if(S)return;const[t,n]=e;R(Object.assign(Object.assign({},T),{start:t,end:n}))},locale:null==y?void 0:y.state.locale})]}),_&&Wt("div",{className:"df-event-dialog-notes-row",style:{marginBottom:"0.75rem"},children:[Wt("span",{className:"df-form-label",children:C("note")}),Wt("textarea",{id:`event-note-${T.id}`,name:"note",value:null!==(w=T.description)&&void 0!==w?w:"",readOnly:!Y||S,disabled:!Y||S,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")})]}),Y&&Wt("div",{className:"df-form-actions",children:[Wt(Ba,F?{type:"button",className:"df-fill-primary df-hover-primary-solid df-btn-sm",onClick:()=>{var e;if(S)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}),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:S,children:C("setAsTimed")}:{type:"button",className:"df-fill-primary df-hover-primary-solid df-btn-sm",onClick:()=>{if(S)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:S,children:C("setAsAllDay")}),Wt(Ba,{type:"button",className:"df-fill-destructive df-hover-destructive df-btn-sm",onClick:()=>e(void 0,void 0,void 0,function*(){if(!S){x.current=!0,N(!0);try{yield u(T.id)}finally{N(!1)}}}),loading:S,children:C("delete")})]})]});if("undefined"==typeof window||"undefined"==typeof document)return null;const V=document.body;return V?c(B,V):null},bi=({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}=Za(),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=Wt("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:[Wt("div",{style:f}),Wt(u,{event:e,isAllDay:a,onEventUpdate:l,onEventDelete:s,onClose:d})]});return c(p,document.body)},Ei=({showDetailPanel:e,detailPanelPosition:t,event:n,detailPanelRef:a,isAllDay:r,eventVisibility:i,calendarRef:o,selectedEventElementRef:l,onEventUpdate:s,onEventDelete:d,handlePanelClose:c,customRenderingStore:u,contentSlotRenderer:h,app:g})=>{if(!e)return null;if(!t)return null;const m={event:n,position:t,panelRef:a,isAllDay:r,eventVisibility:i,calendarRef:o,selectedEventElementRef:l,onEventUpdate:s,onEventDelete:d,onClose:c};return(null==u?void 0:u.isOverridden("eventDetailContent"))?Wt(bi,Object.assign({},m,{contentRenderer:h})):Wt(wi,Object.assign({},m,{app:g}))},Ci="transform 0.5s cubic-bezier(0.22, 1, 0.36, 1)";var Ti=h(({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:M,onEventUpdate:S,onEventDelete:N,newlyCreatedEventId:k,onDetailPanelOpen:I,onEventSelect:O,onEventLongPress:R,onDetailPanelToggle:A,useEventDetailPanel:H,multiDaySegmentInfo:P,app:L,isMobile:$=!1,isSlidingView:Y=!1,enableTouch:j,hideTime:Z,timeFormat:F="24h",styleOverride:_,className:W,disableDefaultStyle:z=!1,renderVisualContent:U,resizeHandleOrientation:B,appTimeZone:V})=>{var G;const q=D(Fa),X=null!=j?j:$,J=s===x.YEAR,Q=p(()=>{if(!V||e.allDay)return e;const t=ke(e.start,V),n=e.end?ke(e.end,V):void 0;return Object.assign(Object.assign({},e),{start:t,end:n})},[e,V]),[ee,te]=g(null),[ne,ae]=g(!1),re=v(null),ie=v(null),oe=v(null),le=v(null),se=d&&c?`${e.id}::${c.id}`:void 0===(null==P?void 0:P.dayIndex)?J&&u?u.id:e.id:`${e.id}::day-${P.dayIndex}`,he=C===se,me=!1!==H,ve=he&&me,fe=null==L?void 0:L.getReadOnlyConfig(e.id),we=null!==(G=null==L?void 0:L.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:Me,setIsPressed:Se,handleTouchStart:Ne,handleTouchMove:Ie,handleTouchEnd:xe,shouldSuppressClick:Oe}=(({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:X,onMoveStart:Ee?T:void 0,onEventLongPress:R,onEventSelect:O,onDetailPanelToggle:A,canOpenDetail:be,useEventDetailPanel:H,app:L,multiDaySegmentInfo:P,isMultiDay:d,segment:c}),[Re,Ae]=g("standard"),He=e=>{le.current=e},Pe=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,se,le.current,P,c),[e,C,se,P,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 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,$),[r,s,$]),$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 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,$),[r,s,$]),{detailPanelPosition:Ye,setDetailPanelPosition:je,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),M=t===x.DAY,S=t===x.MONTH,N=t===x.YEAR,k=t===x.RESOURCE,I=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(S)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(S&&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 M=w.top-p/2+w.height/2,I=Math.max(10,e.top+10),x=m-10;D=M<I?I:M+p>x?x-p:M,T(e=>{if(!e)return null;let t=y<i;return(N||k)&&(t=y<w.left),Object.assign(Object.assign({},e),{top:D,left:y,isSunday:t})})})},[o,e.day,e.start,e.end,u,S,h,v,n,a,i,D,w,c,M,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(()=>I()))},[y,C,I,c]),{detailPanelPosition:C,setDetailPanelPosition:T,updatePanelPosition:I}})({event:e,viewType:s,isMultiDay:d,segment:c,yearSegment:u,multiDaySegmentInfo:P,calendarRef:r,eventRef:re,detailPanelRef:ie,selectedEventElementRef:oe,isMobile:$,eventVisibility:Re,firstHour:b,hourHeight:w,columnsPerRow:h,showDetailPanel:he,detailPanelEventId:C,detailPanelKey:se,getActiveDayIdx:Pe,getDayMetricsWrapper:$e}),{handleClick:_e,handleDoubleClick:We,handleContextMenu:ze,hasPendingSelection:Ue}=(({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:M,updatePanelPosition:S,selectedEventElementRef:N})=>{const k=n===x.MONTH,I=n===x.YEAR,O=n===x.RESOURCE,R=null!=t?t:e,A=v(null),[H,P]=g(!1),L=f(()=>{A.current&&(clearTimeout(A.current),A.current=null,P(!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)}),[]),Y=f(()=>new Promise(e=>{if(!l.current||a||k||I||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:Fe(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,k,I,O,o,R.start,R.end,s,d,N,$]),j=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]),Z=f(t=>{var n,a,l;if(r){const r=M(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,M,T,null==o?void 0:o.dayIndex,e,i,D,u,b,w,E]),F=f(()=>{null==y||y.onEventClick(e)},[y,e]),_=f(e=>{Z(e),F()},[Z,F]),W=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=M(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=()=>{Y().then(()=>{!1!==h&&(c||(null==w||w(p),E({top:-9999,left:-9999,eventHeight:0,eventMiddleY:0,isSunday:!1}),requestAnimationFrame(()=>S())))})};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,M,T,null==i?void 0:i.startDayIndex,null==i?void 0:i.endDayIndex,e.day,y,e,Y,b,I,c,D,w,p,E,S]);return{handleClick:f(e=>{e.preventDefault(),e.stopPropagation();const t=e.clientX;if(!c&&u)return L(),I||O||Z(t),P(!0),void(A.current=setTimeout(()=>{(I||O)&&Z(t),F(),A.current=null,P(!1)},180));_(t)},[L,u,Z,F,I,O,c,_]),handleDoubleClick:W,handleContextMenu:j,hasPendingSelection:H,scrollEventToCenter:Y}})({event:e,timingEvent:Q,viewType:s,isAllDay:n,isMultiDay:d,segment:c,multiDaySegmentInfo:P,calendarRef:r,firstHour:b,hourHeight:w,isMobile:$,canOpenDetail:be,useEventDetailPanel:H,detailPanelKey:se,app:L,onEventSelect:O,onDetailPanelToggle:A,setIsSelected:Te,setDetailPanelPosition:je,setContextMenuPosition:te,setActiveDayIndex:He,getClickedDayIdx:Le,updatePanelPosition:Ze,selectedEventElementRef:oe}),Be=(void 0===E?Ce:E===e.id)||Ue||!X&&Me||o,Ve=X&&Be&&we,{calculateEventStyle:Ge}=(({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:M})=>{const S=o===x.DAY,N=o===x.MONTH,k=o===x.YEAR,I=null!=t?t:e;return{calculateEventStyle:()=>{var e,t,o,x,O,R,A,H,P,L,$;if(k&&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)",Ci].join(", "):Ci,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:Ci,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:Ci,cursor:p||y?"pointer":"default"},t=u*i;if(Object.assign(e,{top:`${t}px`}),S)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 Y=M?M.startHour:K(I.start),j=M?M.endHour:Fe(I),Z=(Y-g)*h,F=Math.max((j-Y)*h,h/4),_={top:`${Z+3}px`,height:F-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:Ci,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)+(Y-g)*h+3,s=Math.max(l,n.top),d=Math.min(l+F-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=S?1:c||7;let i=(e.width-a)/r,o=e.left+a+(S?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!==(A=null===(R=w.current)||void 0===R?void 0:R.querySelector(".df-calendar-renderer"))&&void 0!==A?A:null);const d=null==s?void 0:s.getBoundingClientRect(),u=null===(P=null===(H=E.current)||void 0===H?void 0:H.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=S?n.width/100*u.width:(n.width-1)/100*u.width):(h=u.left,g=S?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=S?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=S?`${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:S?"0px":"3px"})}}})({event:e,timingEvent:Q,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:Be,showDetailPanel:he,isPopping:ne,isDraggable:Ee,canOpenDetail:be,eventVisibility:Re,calendarRef:r,isMobile:$,eventRef:re,getActiveDayIdx:Pe,getDayMetricsWrapper:$e,multiDaySegmentInfo:P});(({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:Fe(w),b=(m-c)*u,E=b+Math.max((f-m)*u,u/4),C=l.getBoundingClientRect(),T=l.scrollTop,M=T+C.height,S=C.bottom<0,N=C.top>window.innerHeight;let k=g;if(S)k="sticky-top";else if(N)k="sticky-bottom";else{const n="sticky-left"===g||"sticky-right"===g?"standard":g;let a;if(a="standard"===n?E<T?"sticky-top":b>M-20?"sticky-bottom":"standard":"sticky-top"===n?E>=T?"standard":"sticky-top":b<=M-20?"standard":"sticky-bottom","standard"!==a)k=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;k=n.right<=t?"sticky-left":n.left>=a?"sticky-right":"standard"}else k="standard"}else k="standard"}k===g?h():(v(k),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:Q,isEventSelected:Be,showDetailPanel:he,eventRef:re,calendarRef:r,isAllDay:n,viewType:s,isMobile:$,multiDaySegmentInfo:P,firstHour:b,hourHeight:w,updatePanelPosition:Ze,eventVisibility:Re,setEventVisibility:Ae}),(({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:re,detailPanelRef:ie,eventId:e.id,isEventSelected:Be,showDetailPanel:ve,onEventSelect:O,onDetailPanelToggle:A,setIsSelected:Te,setActiveDayIndex:He});const qe=f(()=>{O&&O(null),le.current=null,Te(!1),null==A||A(null)},[O,A,Te]),Ke=p(()=>({event:e,viewType:s,isAllDay:n,isMobile:$,isSelected:Be,isDragging:o,segment:c,layout:t}),[e,s,n,$,Be,o,c,t]),Xe=f(e=>Wt(Wa,{store:q,generatorName:"eventDetailContent",generatorArgs:e}),[q]);m(()=>{if((null==L?void 0:L.state.highlightedEventId)===e.id){ae(!0);const e=setTimeout(()=>{ae(!1)},650);return()=>{clearTimeout(e),ae(!1)}}},[null==L?void 0:L.state.highlightedEventId,e.id]),m(()=>{we||te(null)},[we]),m(()=>{const t=d&&(null==c?void 0:c.isFirstSegment)||J&&(null==u?void 0:u.isFirstSegment)||!d&&!J;k===e.id&&!he&&t&&!1!==H&&setTimeout(()=>{null==A||A(se),null==I||I()},50)},[k,e.id,he,d,c,J,u,A,I,se]);const Je=ge(e),Qe=null==L?void 0:L.getCalendarRegistry(),et=e.calendarIds&&e.calendarIds.length>1?pe(e,Qe):null,tt=((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 Wt(i,{children:[Wt("div",{ref:re,"data-event-id":e.id,"data-view":s,"data-all-day":String(n),"data-selected":String(Be),"data-dragging":String(o),"data-resizing":String(l),"data-popping":String(ne),"data-multi-day":String(d),"data-editable":String(we),"data-draggable":String(Ee),"data-viewable":String(be),"data-segment-shape":tt,"data-month-stack":String(s===x.MONTH&&!d),"data-touch-handles":String(Ve),className:`${ai(s,n,d)} ${n&&k===e.id?"df-all-day-event-animate":""} ${null!=W?W:""}`,style:Object.assign(Object.assign(Object.assign({},z?{}:Ge()),Be?{background:ue(Je,Qe),color:"#fff"}:e.calendarIds&&e.calendarIds.length>1?{background:ye(et),color:ce(Je,Qe)}:{backgroundColor:de(Je,Qe),color:ce(Je,Qe)}),_),onClick:e=>{if(X&&Oe())return e.preventDefault(),void e.stopPropagation();_e(e)},onContextMenu:ze,onDblClick:We,onMouseDown:t=>{var n;if(X||Se(!0),T&&Ee){T(t,P?Object.assign(Object.assign({},e),{day:null!==(n=P.dayIndex)&&void 0!==n?n:e.day,_segmentInfo:P}):d&&c?Object.assign(Object.assign({},e),{day:c.startDayIndex,_segmentInfo:{dayIndex:c.startDayIndex,isFirst:c.isFirstSegment,isLast:c.isLastSegment}}):e)}},onMouseUp:()=>!X&&Se(!1),onMouseLeave:()=>!X&&Se(!1),onTouchStart:Ne,onTouchMove:Ie,onTouchEnd:xe,children:Wt(Di,{event:Q,viewType:s,isAllDay:n,isMultiDay:d,segment:c,yearSegment:u,segmentIndex:y,isBeingDragged:o,isBeingResized:l,isEventSelected:Be,isPopping:ne,isEditable:we,isDraggable:Ee,canOpenDetail:be,isTouchEnabled:X,hideTime:Z,isMobile:$,isSlidingView:Y,app:L,onMoveStart:T,onResizeStart:M,multiDaySegmentInfo:P,customRenderingStore:q,eventContentSlotArgs:Ke,timeFormat:F,appTimeZone:V,renderVisualContent:U,resizeHandleOrientation:B})}),he&&me&&Wt("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:9998,pointerEvents:"none"}}),Wt(Ei,{showDetailPanel:he&&me,detailPanelPosition:Ye,event:e,detailPanelRef:ie,isAllDay:n,eventVisibility:Re,calendarRef:r,selectedEventElementRef:oe,onEventUpdate:S,onEventDelete:N,handlePanelClose:qe,customRenderingStore:q,contentSlotRenderer:Xe,app:L}),ee&&L&&we&&Wt(ei,{event:e,x:ee.x,y:ee.y,onClose:()=>te(null),app:L,onDetailPanelToggle:A,detailPanelKey:se})]})});const Mi=({handlePreviousMonth:e,handleToday:t,handleNextMonth:n})=>{const{t:a}=Pn();return Wt("div",{className:"df-navigation",children:[Wt("button",{type:"button",className:Qn,onClick:e,"aria-label":"Previous month",children:Wt(ca,{})}),Wt("button",{type:"button",className:"df-today-button df-calendar-today-button",onClick:t,children:a("today")}),Wt("button",{type:"button",className:Qn,onClick:n,"aria-label":"Next month",children:Wt(ua,{})})]})},Si=({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}=Pn(),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 Wt("div",{className:"df-view-header-container",onContextMenu:e=>e.preventDefault(),children:[Wt("div",{className:"df-view-header-title-area",children:Wt("div","year"===e&&d?{className:"df-view-header-year-stack",children:[Wt("h1",{className:`${$n} df-view-header-year-title`,style:{transform:`translateY(-${c}px)`},children:d}),u&&Wt("h1",{className:`${$n} df-view-header-year-title`,style:{transform:`translateY(${h}px)`},children:u})]}:{children:[Wt("div",{className:$n,children:v}),f&&Wt("div",{className:"df-view-header-subtitle",children:f}),l&&Wt("div",{className:"df-view-header-subtitle-row",children:l&&Wt("div",{className:"df-view-header-subtitle-meta",children:l})})]})}),m&&n&&a&&r&&Wt("div",{className:"df-view-header-nav",children:Wt(Mi,{handlePreviousMonth:n,handleNextMonth:a,handleToday:r})})]})};function Ni(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 ki(){document.dispatchEvent(new MouseEvent("mouseup",{bubbles:!0,cancelable:!1}))}const Ii=({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:M,handleCreateStart:S,handleCreateAllDayEvent:N,handleTouchStart:k,handleTouchEnd:I,handleTouchMove:O,handleDragOver:R,handleDrop:A,handleEventUpdate:H,handleEventDelete:P,onDateChange:L,useEventDetailPanel:$,calendarRef:Y,allDayRowRef:j,timeGridRef:Z,switcherMode:F,isMobile:_,isTouch:W,setDraftEvent:z,setIsDrawerOpen:U,ALL_DAY_HEIGHT:B,HOUR_HEIGHT:V,FIRST_HOUR:G,LAST_HOUR:q,showAllDay:K,showStartOfDayLabel:X,timeFormat:J="24h",secondaryTimeSlots:Q,primaryTzLabel:ee,secondaryTzLabel:te,appTimeZone:ne})=>{var ae;const re=!!Q&&Q.length>0&&!_,{t:ie}=Pn(),oe=v(e.state.highlightedEventId),[le,se]=g(null),de=p(()=>qt(),[]),ce=p(()=>re&&te&&ee?Wt(i,{children:[Wt("span",{className:"df-time-column-tz-label",children:te}),Wt("span",{className:"df-time-column-tz-label",children:ee})]}):null,[re,te,ee]),ue=()=>{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},he=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-ue())/V},ge=e.canMutateFromUI();m(()=>{ge||se(null)},[ge]);const me=(e,n)=>{var a,r,i,o;if(e.preventDefault(),_||!ge)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===(o=null===(i=Y.current)||void 0===i?void 0:i.querySelector(".df-calendar-content"))||void 0===o?void 0:o.scrollTop)||0,a=ue(),r=(e.clientY-t.top+n-a)/V+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)}}se({x:e.clientX,y:e.clientY,date:l})};return Wt("div",{className:"df-day-content","data-switcher-mode":F,onContextMenu:e=>e.preventDefault(),children:[Wt("div",{className:"df-day-content-layout",children:[Wt("div",{className:"df-day-content-header-wrap",onContextMenu:e=>e.preventDefault(),style:{paddingRight:_||!de?"0px":"15px"},children:Wt(Si,{calendar:e,viewType:x.DAY,currentDate:t,subtitleMeta:ce})}),Wt("div",K?{className:da(Bn,"df-day-content-all-day-row"),ref:j,"data-scrollbar-space":!_&&de?"true":"false",style:{paddingRight:_||!de?"0px":"0.6875rem"},onContextMenu:e=>me(e,!0),children:[Wt("div",{className:da(Vn,"df-day-content-all-day-label"),onContextMenu:e=>e.preventDefault(),children:ie("allDay")}),Wt("div",{className:"df-day-content-all-day-grid","data-scrollbar-space":!_&&de?"true":"false",children:Wt("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=>{A(e,t,void 0,!0)},children:o.map(t=>Wt(Ti,{event:t,isAllDay:!0,viewType:x.DAY,segmentIndex:t.row,allDayHeight:B,calendarRef:Y,isBeingDragged:C&&(null==E?void 0:E.eventId)===t.id&&"move"===(null==E?void 0:E.mode),hourHeight:V,firstHour:G,onMoveStart:T,onEventUpdate:H,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(),i=a.find(e=>e.id===t);(_||W)&&i&&n&&r?(z(i),U(!0)):(f(t),e.state.highlightedEventId&&(e.highlightEvent(null),oe.current=null))},onEventLongPress:e=>{(_||W)&&f(e)},useEventDetailPanel:$,app:e,isMobile:_,enableTouch:W,appTimeZone:ne},t.id))})})]}:{className:"df-day-content-all-day-spacer","data-scrollbar-space":!_&&de?"true":"false"}),Wt("div",{className:da("df-calendar-content","df-day-content-grid"),style:{scrollbarGutter:"stable"},children:Wt("div",{className:"df-day-content-grid-inner",children:[c&&u&&(()=>{const e=u,t=e.getHours()+e.getMinutes()/60;return t<G||t>q?null:Wt("div",{className:zn,"data-secondary-tz":re?"true":"false",style:{top:(t-G)*V+"px",height:0,zIndex:20,marginTop:"0.75rem"},children:[Wt("div",{className:"df-day-content-current-time-side",children:[Wt("div",{className:"df-day-content-current-time-side-inner"}),Wt("div",{className:Un,children:Ze(t,0,J,!1)})]}),Wt("div",{className:"df-day-content-current-time-rail",children:Wt("div",{className:"df-current-time-bar"})})]})})(),Wt("div",{className:"df-time-column","data-secondary-tz":re?"true":"false",onContextMenu:e=>e.preventDefault(),children:[Wt("div",{className:"df-time-column-spacer df-time-day-column-spacer","data-secondary-tz":re?"true":"false"}),s.map((e,t)=>{var n;return Wt("div",{className:Fn,children:Wt("div",re?{className:"df-time-column-tz-row",children:[Wt("span",{className:"df-time-column-tz-value",children:X&&0===t?"":null!==(n=null==Q?void 0:Q[t])&&void 0!==n?n:""}),Wt("span",{className:"df-time-column-tz-value",children:X&&0===t?"":e.label})]}:{className:_n,children:X&&0===t?"":e.label})},t)})]}),Wt("div",{className:"df-day-content-grid-column",children:[Wt("div",{className:da(na,"df-time-grid-boundary-top","df-day-content-grid-boundary"),"data-scrollbar-space":!_&&de?"true":"false",children:Wt("div",{className:da(aa,"df-midnight-label-offset"),style:{top:"auto",bottom:"-0.625rem"},children:X?Ze(G,0,J):""})}),Wt("div",{className:"df-day-content-grid-rows",style:{WebkitTouchCallout:"none"},ref:Z,"data-scrollbar-space":!_&&de?"true":"false",children:[s.map((e,a)=>Wt("div",{className:Wn,"data-scrollbar-space":!_&&de?"true":"false",onClick:()=>null==L?void 0:L(t),onMouseDown:e=>{const a=he(e.clientY);null!==a&&Ni(e,Math.floor((t.getTime()-n.getTime())/864e5),a,W,S)},onDblClick:e=>{const a=he(e.clientY);if(null===a)return;const r=Math.floor((t.getTime()-n.getTime())/864e5);null==S||S(e,r,a),ki()},onTouchStart:e=>{const a=Math.floor((t.getTime()-n.getTime())/864e5);k(e,a)},onTouchEnd:I,onTouchMove:O,onDragOver:R,onDrop:e=>{var n,a,r,i;const o=null===(a=null===(n=Y.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=Y.current)||void 0===r?void 0:r.querySelector(".df-calendar-content"))||void 0===i?void 0:i.scrollTop)||0,s=ue(),d=e.clientY-o.top+l-s,c=Math.floor(G+d/V);A(e,t,c)},onContextMenu:e=>me(e,!1)},a)),Wt("div",{className:da(na,"df-day-content-grid-boundary-bottom"),"data-scrollbar-space":!_&&de?"true":"false",children:Wt("div",re?{className:"df-time-column-tz-row df-day-content-bottom-tz-row",style:{left:_?"-5rem":"-5.5rem",width:_?"5rem":"5.5rem"},children:[Wt("span",{children:null!==(ae=null==Q?void 0:Q[0])&&void 0!==ae?ae:""}),Wt("span",{children:Ze(0,0,J)})]}:{className:da(aa,"df-midnight-label-offset"),children:Ze(0,0,J)})}),Wt("div",{className:"df-day-content-event-layer",children:r.filter(e=>!e.allDay).map(t=>{const n=d.get(t.id);return Wt(Ti,{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:V,firstHour:G,onMoveStart:T,onResizeStart:M,onEventUpdate:H,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);(_||W)&&r&&n?(z(r),U(!0)):(f(t),e.state.highlightedEventId&&(e.highlightEvent(null),oe.current=null))},onEventLongPress:e=>{(_||W)&&f(e)},useEventDetailPanel:$,app:e,isMobile:_,enableTouch:W,appTimeZone:ne},t.id)})})]})]})]})})]}),ge&&le&&Wt(Qr,{x:le.x,y:le.y,date:le.date,viewType:x.DAY,onClose:()=>se(null),app:e,onCreateEvent:()=>{if(S){const e=Math.floor((t.getTime()-n.getTime())/864e5);if(0===le.date.getHours()&&0===le.date.getMinutes())null==N||N({clientX:le.x,clientY:le.y},e);else{const t=le.date.getHours()+le.date.getMinutes()/60,n={preventDefault:()=>{},stopPropagation:()=>{},clientX:le.x,clientY:le.y};S(n,e,t)}}}})]})},xi=({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}=Pn(),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 Wt("div",{className:"df-right-panel","data-switcher-mode":s,onContextMenu:e=>e.preventDefault(),children:Wt("div",{className:"df-right-panel-layout",children:[Wt("div",{className:"df-mini-calendar",children:Wt("div",{className:"df-right-panel-calendar-shell",children:[Wt("div",{className:"df-right-panel-calendar-header",children:[Wt("div",{className:"df-right-panel-header-spacer","aria-hidden":"true",children:" "}),Wt(Mi,{handlePreviousMonth:()=>e.goToPrevious(),handleNextMonth:()=>e.goToNext(),handleToday:()=>e.goToToday()})]}),Wt(Tr,{visibleMonth:n,currentDate:t,showHeader:!0,onMonthChange:o,onDateSelect:l,events:e.getEvents(),showEventDots:c,calendarRegistry:e.getCalendarRegistry(),timeZone:e.timeZone})]})}),Wt("div",{className:"df-right-panel-events",children:Wt("div",{className:"df-right-panel-events-inner",children:[Wt("h3",{className:"df-right-panel-date-heading",children:t.toLocaleDateString(m,{weekday:"long",month:"long",day:"numeric"})}),0===v.length?Wt("p",{className:"df-right-panel-empty",children:g("noEvents")}):Wt("div",{className:"df-right-panel-list",children:v.map(t=>Wt("div",{className:"df-right-panel-event-item",children:Wt(Ti,{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))})]})})]})})},Oi={PARALLEL_THRESHOLD:.25,NESTED_THRESHOLD:.5,INDENT_STEP_PERCENT:2.5,MIN_WIDTH:25,MARGIN_BETWEEN:1,EDGE_MARGIN_PERCENT:.9};function Ri(e){return Object.assign(Object.assign({},e),{parentId:void 0,children:[],_startHour:e.allDay?0:K(e.start),_endHour:e.allDay?0:Fe(e)})}function Ai(e){var t;return null!==(t=e._startHour)&&void 0!==t?t:K(e.start)}function Hi(e){var t;return null!==(t=e._endHour)&&void 0!==t?t:Fe(e)}function Pi(e){var t;return null!==(t=e._originalStartHour)&&void 0!==t?t:Ai(e)}function Li(e){var t;return null!==(t=e._originalEndHour)&&void 0!==t?t:Hi(e)}function $i(e,t){return e.day===t.day&&!e.allDay&&!t.allDay&&Ai(e)<Hi(t)&&Ai(t)<Hi(e)}function Yi(e,t){const n=Hi(e)-Ai(e);if(n<1.25)return!1;const a=Ai(e)+.4*n,r=Ai(t)>=a,i=$i(e,t);return r&&i}function ji(e,t,n=Oi){if(!$i(e,t))return!1;const a=Math.abs(Pi(e)-Pi(t));return a<=n.PARALLEL_THRESHOLD||a>n.PARALLEL_THRESHOLD&&a<n.NESTED_THRESHOLD||function(e,t){return!(!$i(e,t)||!Yi(e,t)&&!Yi(t,e))}(e,t)}function Zi(e,t){const n=Pi(e)<=Pi(t)&&Li(e)>=Li(t),a=Pi(e)<=Pi(t)&&Pi(t)<Li(e)&&$i(e,t);return n||a}function Fi(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(Pi(a)-Pi(t))<=Oi.PARALLEL_THRESHOLD&&(r.push(t),n.add(t.id));r.sort((e,t)=>Pi(e)-Pi(t));const i={events:r,startHour:Math.min(...r.map(e=>Ai(e))),endHour:Math.max(...r.map(e=>Hi(e))),originalStartHour:Math.min(...r.map(e=>Pi(e))),originalEndHour:Math.max(...r.map(e=>Li(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 _i(e){return"day"===e?.5:2.5}function Wi(e){const t=Hi(e)-Ai(e);return Math.max(.1,Math.min(1,t/4))}function zi(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(ji(e[t],e[n],Oi))return!0;return!1}function Ui(e,t,n,a,r={}){const i=_i(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*_i(t):null}(e,r.viewType);null!==t&&(o=t)}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:Wi(e.event)}),0===e.children.length)return;const d=[...e.children].toSorted((e,t)=>Hi(t.event)-Ai(t.event)-(Hi(e.event)-Ai(e.event)));1===d.length?Ui(d[0],l,s,a,r):zi(d.map(e=>e.event))?Bi(d,l,s,a,r):d.forEach(e=>Ui(e,l,s,a,r))}function Bi(e,t,n,a,r={}){const i=e.length,o=e[0].depth*_i(r.viewType),l=t+o,s=n-o;if(s<=0)return void e.forEach(e=>Ui(e,t,n,a,r));let d=Oi.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:Wi(e.event)}),e.children.length>0){const t=[...e.children].toSorted((e,t)=>Hi(t.event)-Ai(t.event)-(Hi(e.event)-Ai(e.event)));1===t.length?Ui(t[0],n,c,a,r):zi(t.map(e=>e.event))?Bi(t,n,c,a,r):t.forEach(e=>Ui(e,n,c,a,r))}})}function Vi(e,t,n={}){const a=100-("day"===n.viewType?0:Oi.EDGE_MARGIN_PERCENT);if(1===e.length)Ui(e[0],0,a,t,n);else if(e.length>1){const r=e.length,i=(a-Oi.MARGIN_BETWEEN*(r-1))/r;e.forEach((e,a)=>{Ui(e,a*(i+Oi.MARGIN_BETWEEN),Math.max(i,Oi.MIN_WIDTH),t,n)})}}function Gi(e){let t=0;for(const n of e.children)t+=1+Gi(n);return t}function qi(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:Gi(e)})).toSorted((e,t)=>t.load-e.load)}function Ki(e){return!(e.length<2)&&e[0].load-e.at(-1).load>=2}function Xi(e,t){t.parentId=e.id,e.children.includes(t.id)||e.children.push(t.id)}function Ji(e,t){e.parent&&(e.parent.children=e.parent.children.filter(t=>t!==e));const n=t.children.find(t=>Zi(t.event,e.event));n?(e.parent=n,e.depth=n.depth+1,n.children.push(e),Xi(n.event,e.event)):(e.parent=t,e.depth=t.depth+1,t.children.push(e),Xi(t.event,e.event))}function Qi(e,t){0===e.children.length?t.push(e):e.children.forEach(e=>Qi(e,t))}function eo(e,t){const n=[];return Qi(e,n),n.find(e=>Zi(t.event,e.event))||n[0]||null}function to(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=eo(n.node,a.node);if(!r)break;Ji(r,a.node),n.load--,a.load++,t++}}function no(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($i(n,e)&&Math.abs(Pi(e)-Pi(n))<Oi.NESTED_THRESHOLD)return!0;return!1}(e,t))return!1;if(r<Oi.NESTED_THRESHOLD)return!1;for(const n of e.events)for(const e of t.events)if(Zi(n,e))return!0;return!1}function ao(e,t,n){const a=t.events.filter(t=>Zi(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&&ji(e,a,Oi)})}));return r.sort((t,n)=>t.load!==n.load?t.load-n.load:t.hasParallelSibling!==n.hasParallelSibling?t.hasParallelSibling?-1:1:Math.abs(Pi(e)-Pi(t.parent))-Math.abs(Pi(e)-Pi(n.parent))),r[0].parent}function ro(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=Li(e)-Pi(e),o=r.flatMap(e=>e.children);return i>Math.max(...o.map(e=>{const t=n.find(t=>t.id===e);return t?Li(t)-Pi(t):0}),0)?r[0]:r.at(-1)||null}function io(e,t){t.parentId=e.id,e.children.includes(t.id)||e.children.push(t.id)}function oo(e){let t=0;for(const n of e.children)t+=1+oo(n);return t}function lo(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 so(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=oo(e);t<o&&(o=t,l=e)}return l?l.event:null}function co(e,t,n){const a=[];if(1===e.length){const r=ao(e[0],t,n);return r&&(a.push({child:e[0],parent:r}),io(r,e[0])),a}const r=t.events.filter(t=>e.every(e=>Zi(t,e)));if(0===r.length){for(const r of e){const i=ao(r,t,n);if(i)a.push({child:r,parent:i}),io(i,r);else{const t=e.find(e=>e.id!==r.id&&$i(e,r));if(t){const e=so(t,lo(n));e&&(a.push({child:r,parent:e}),io(e,r))}}}return a}const i=[...e].toSorted((e,t)=>Li(t)-Pi(t)-(Li(e)-Pi(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}),io(n,e)}}else for(const e of i){const t=ro(e,r,i);t&&(a.push({child:e,parent:t}),io(t,e))}return a}function uo(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(no(d,{events:o,startHour:i.startHour,endHour:i.endHour})){const e=co(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=qi(e[n].events.map(e=>t.find(t=>t.event.id===e.id)),t);Ki(a)&&to(a)}}(e,n),i}const ho={calculateDayEventLayouts(e,t={}){const n=e.map(Ri);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)||$i(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:Oi.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 Vi(uo(Fi([...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}},go=(e,t,n,a,r)=>{const i=[],o=[];return e.forEach(e=>{var l;if(e.allDay)return;const s=di(e,n,a,r);if(s.length>0){const a=s.find(e=>e.dayIndex===t);if(a){const r=a.endHour>=24?23.99:a.endHour,l=Object.assign(Object.assign({},e),{start:Oe(X(ct(n,t),a.startHour)),end:Oe(X(ct(n,t),r)),day:t,_originalStartHour:K(e.start),_originalEndHour:Fe(e)});i.push(l),o.push(e)}}else if(e.day===t){const n=e=>r?Ne(e,r):Se(e);i.push(Object.assign(Object.assign({},e),{start:Oe(n(e.start),r),end:Oe(n(null!==(l=e.end)&&void 0!==l?l:e.start),r),day:t,_originalStartHour:K(e.start),_originalEndHour:Fe(e)})),o.push(e)}}),{events:i,sources:o}};let mo=null;const vo=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},fo=(e,t,n=7,a)=>{const r=`${t.getTime()}|${n}|${null!=a?a:""}`;mo&&mo.contextKey===r||(mo={contextKey:r,perDay:new Map});const i=mo.perDay,o=new Map;for(let r=0;r<n;r++){const{events:l,sources:s}=go(e,r,t,n,a),d=i.get(r);if(d&&vo(d.sources,s)){o.set(r,d.layouts);continue}const c=ho.calculateDayEventLayouts(l,{viewType:"week"});i.set(r,{sources:s,layouts:c}),o.set(r,c)}return o},po=(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},yo=new WeakMap,Do=(e,t,n,a,r,i)=>{var o;let l=yo.get(e);if(l){const e=l.get(t);if(e)return e}const s=e=>i?Ne(e,i):Se(e),d=s(e.start),c=new Date(d).setHours(0,0,0,0),u=s(null!==(o=e.end)&&void 0!==o?o:e.start),h=new Date(u).setHours(23,59,59,999)>=n&&c<=a,g=Math.floor((c-n)/864e5),m={inWeek:h,day:Math.max(0,Math.min(r-1,g))};return l||(l=new Map,yo.set(e,l)),l.set(t,m),m},wo={HOUR_HEIGHT:72,FIRST_HOUR:0,LAST_HOUR:24,ALL_DAY_HEIGHT:28};function bo(e){const{app:t,onEventCreated:a}=e,{t:r}=Pn(),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 Eo=null;function Co(e){Eo=e}const To={handleMoveStart:()=>{},handleCreateStart:()=>{},handleResizeStart:void 0,handleCreateAllDayEvent:()=>{},dragState:{active:!1,mode:null,eventId:null,targetDate:null,startDate:null,endDate:null},isDragging:!1};function Mo(e,t){return Eo?Eo(e,t):To}const So=({app:e,config:t,useEventDetailPanel:n,calendarRef:a,switcherMode:r="buttons",selectedEventId:i,onEventSelect:o,onDateChange:l,detailPanelEventId:s,onDetailPanelToggle:d})=>{const c=e.getEvents(),{screenSize:u}=An(),h="desktop"!==u,[D,w]=g(!1),{hourHeight:b=wo.HOUR_HEIGHT,firstHour:E=wo.FIRST_HOUR,lastHour:C=wo.LAST_HOUR,allDayHeight:T=wo.ALL_DAY_HEIGHT,showAllDay:M=!0,timeFormat:S="24h",secondaryTimeZone:N,showEventDots:k=!0}=t,I=b,O=E,R=C,A=T,H=!M;m(()=>{w("ontouchstart"in window||navigator.maxTouchPoints>0)},[]);const[P,L]=g(null),[$,Y]=g(null),[j,Z]=g(null),F=void 0===i?$:i,_=void 0===s?j:s,W=p(()=>F&&c.find(e=>e.id===F)||null,[F,c]),z=e=>{o?o(e):Y(e)},[U,B]=g(null),V=v(null),G=e.getCurrentDate(),[q,X]=g(G),J=v(G.getTime());G.getTime()!==J.current&&(J.current=G.getTime(),G.getFullYear()===q.getFullYear()&&G.getMonth()===q.getMonth()||X(G));const Q=f(t=>{X(n=>{const a=new Date(n.getFullYear(),n.getMonth()+t,1);return e.setVisibleMonth(a),a})},[e]),ee=v(e.state.highlightedEventId);m(()=>{var t;if(e.state.highlightedEventId!==ee.current)if(e.state.highlightedEventId){z(e.state.highlightedEventId);const n=e.getEvents().find(t=>t.id===e.state.highlightedEventId);if(n&&!n.allDay){const e=K(n.start),r=null===(t=a.current)||void 0===t?void 0:t.querySelector(".df-calendar-content");if(r){const t=(e-O)*I;requestAnimationFrame(()=>{r.scrollTo({top:Math.max(0,t-100),behavior:"smooth"})})}}}else ee.current&&F===ee.current&&z(null);ee.current=e.state.highlightedEventId},[e.state.highlightedEventId,O,I,a,e]);const te=v(null),ne=v(null),ae=p(()=>po(G),[G]),re=e.timeZone,ie=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):Se(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})})})(c,G,ae,re),[c,G,ae,re]),oe=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):Se(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:Fe(e)})})})(ie,G,re),[ie,G,re]),le=p(()=>ho.calculateDayEventLayouts(oe,{viewType:"day"}),[oe]),se=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=Se(e.start),a=Se(e.end),r=Se(t.start);return n<=Se(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})(ie,e.state.allDaySortComparator),[ie,e.state.allDaySortComparator]),de=p(()=>0===se.length?A:(Math.max(...se.map(e=>e.row))+1)*A,[se,A]),{handleMoveStart:ce,handleCreateStart:ue,handleResizeStart:he,handleCreateAllDayEvent:ge,dragState:me,isDragging:ve}=Mo(e,{calendarRef:a,allDayRowRef:M?te:void 0,timeGridRef:ne,viewType:x.DAY,onEventsUpdate:(t,n,a)=>{const r=ie,i=t(r),o=new Map(r.map(e=>[e.id,e])),l=new Set(i.map(e=>e.id)),s=r.filter(e=>!l.has(e.id)),d=i.filter(e=>!o.has(e.id)),c=i.filter(e=>{const t=o.get(e.id);return void 0!==t&&t!==e&&Tt(t,e)});e.applyEventsChanges({delete:s.map(e=>e.id),add:d,update:c.map(e=>({id:e.id,updates:e}))},void 0,a)},onEventCreate:t=>{h?e.onMobileEventDetailToggle(t):(e.addEvent(t),B(t.id))},onEventEdit:()=>{},currentWeekStart:ae,events:ie,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 ho.calculateDayEventLayouts(s,{viewType:"day"}).get("-1")||null})(0,t,n,G,oe,re),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:ho.calculateDayEventLayouts(u,{viewType:"day"}).get(e.id)||null})(e,0,n,a,G,oe,re),TIME_COLUMN_WIDTH:N&&!h?88:h?48:80,isMobile:h}),{handleDrop:fe,handleDragOver:pe}=bo({app:e,onEventCreated:e=>{B(e.id)}}),ye=Array.from({length:24},(e,t)=>({hour:t+O,label:Ze(t+O,0,S)})),De=p(()=>N?ze(ye,N,S,G,re):void 0,[N,S,O,G,re]),we=p(()=>N?Ue(re,G):void 0,[N,re,G]),be=p(()=>N?Ue(N,G):void 0,[N,G]),Ee=f(t=>{const n=new Date(t.getFullYear(),t.getMonth(),t.getDate());e.setCurrentDate(n),X(new Date(n.getFullYear(),n.getMonth(),1))},[e]),Ce=p(()=>{const e=Ve(re);return G.toDateString()===e.toDateString()},[G,re]);return y(()=>{var e;if(t.scrollToCurrentTime){const t=null===(e=a.current)||void 0===e?void 0:e.querySelector(".df-calendar-content");if(t){const e=Be(re),n=e.getHours()+e.getMinutes()/60,a=t.clientHeight;t.scrollTop=Math.max(0,(n-O)*I-a/2)}}},[re,t.scrollToCurrentTime,O,I]),m(()=>{L(Be(re));const e=setInterval(()=>L(Be(re)),6e4);return()=>clearInterval(e)},[re]),Wt("div",{className:"df-day-view",children:[Wt(Ii,{app:e,currentDate:G,currentWeekStart:ae,events:c,currentDayEvents:ie,organizedAllDayEvents:se,allDayAreaHeight:de,timeSlots:ye,eventLayouts:le,isToday:Ce,currentTime:P,selectedEventId:F,setSelectedEventId:z,newlyCreatedEventId:U,setNewlyCreatedEventId:B,detailPanelEventId:_,setDetailPanelEventId:e=>{d?d(e):Z(e)},dragState:me,isDragging:ve,handleMoveStart:ce,handleResizeStart:he,handleCreateStart:ue,handleCreateAllDayEvent:ge,handleTouchStart:(e,t)=>{if(!h&&!D)return;const n=e.touches[0],r=n.clientX,i=n.clientY,o=e.currentTarget;V.current=setTimeout(()=>{var e,n,l;const s=null===(n=null===(e=a.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=a.current)||void 0===l?void 0:l.querySelector(".df-calendar-content"),c=d?d.scrollTop:0,u=i-s.top+c;null==ue||ue({preventDefault:()=>{},stopPropagation:()=>{},touches:[{clientX:r,clientY:i}],changedTouches:[{clientX:r,clientY:i}],target:o,currentTarget:o,cancelable:!0},t,O+u/I)},500)},handleTouchEnd:()=>{V.current&&(clearTimeout(V.current),V.current=null)},handleTouchMove:()=>{V.current&&(clearTimeout(V.current),V.current=null)},handleDragOver:pe,handleDrop:fe,handleEventUpdate:t=>e.updateEvent(t.id,t),handleEventDelete:t=>e.deleteEvent(t),onDateChange:l,useEventDetailPanel:n,calendarRef:a,allDayRowRef:te,timeGridRef:ne,switcherMode:r,isMobile:h,isTouch:D,setDraftEvent:t=>e.onMobileEventDetailToggle(t),setIsDrawerOpen:t=>{t||e.onMobileEventDetailToggle(null)},ALL_DAY_HEIGHT:A,HOUR_HEIGHT:I,FIRST_HOUR:O,LAST_HOUR:R,showAllDay:M,showStartOfDayLabel:H,timeFormat:S,secondaryTimeSlots:De,primaryTzLabel:we,secondaryTzLabel:be,appTimeZone:re}),Wt(xi,{app:e,currentDate:G,visibleMonth:q,currentDayEvents:ie,selectedEvent:W,setSelectedEvent:e=>z(e?e.id:null),handleMonthChange:Q,handleDateSelect:Ee,switcherMode:r,timeFormat:S,showEventDots:k,appTimeZone:re,calendarRef:a})]})},No=({originalComponent:e,app:t,viewType:n,config:a,useEventDetailPanel:r,calendarRef:i,switcherMode:o,meta:l,selectedEventId:s,detailPanelEventId:d,onEventSelect:c,onDateChange:u,onDetailPanelToggle:h})=>{const g=t.getPlugin("events"),m=t.getPlugin("drag"),v=t.getCurrentDate(),y=t.state.currentView,D=t.getEvents(),w=f(e=>g?g.update(e.id,e):t.updateEvent(e.id,e),[g,t]),b=f(e=>g?g.delete(e):t.deleteEvent(e),[g,t]),E=f(e=>{g?g.add(e):t.addEvent(e)},[g,t]),C=f(e=>{u?u(e):t.setCurrentDate(e)},[t,u]),T=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]),S=p(()=>({app:t,currentDate:v,currentView:y,events:D,onEventUpdate:w,onEventDelete:b,onEventCreate:E,onDateChange:C,onViewChange:T,config:M,useEventDetailPanel:r,calendarRef:i,switcherMode:o,meta:l,selectedEventId:s,detailPanelEventId:d,onEventSelect:c,onDetailPanelToggle:h}),[t,v,y,D,w,b,E,C,T,M,r,i,o,l,s,d,c,h]),N=p(()=>{const e={currentDate:v,events:D,setEvents:e=>{D.forEach(e=>b(e.id)),e.forEach(e=>E(e))},updateEvent:w,deleteEvent:b,addEvent:E,goToPrevious:()=>{const e=new Date(v);switch(y){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)}C(e)},goToNext:()=>{const e=new Date(v);switch(y){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)}C(e)},goToToday:()=>{C(new Date)},changeView:T,selectDate:C};return Object.assign(Object.assign({calendar:e},S),{eventsService:g,dragService:m})},[v,D,y,w,b,E,C,T,S,g,m]);return Wt(e,Object.assign({},N))},ko={},Io=e=>o(No,Object.assign(Object.assign({},e),{viewType:x.DAY,originalComponent:So,className:"df-day-view-factory"}));Io.displayName="DayViewAdapter";const xo=(e={})=>{const t=Object.assign(Object.assign({},ko),e);return{type:x.DAY,component:Io,config:t}},Oo=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)},Ro=({app:e,fullWeekDates:t=[],mobilePageStart:n,onDateChange:a})=>Wt("div",{className:"df-compact-header",children:[Wt("div",{className:"df-compact-header-labels",children:t.map((e,t)=>Wt("div",{className:"df-compact-header-label-cell",children:Wt("span",{className:"df-compact-header-label","data-today":e.isToday?"true":"false",children:Oo(e.dayName)})},`label-${t}`))}),Wt("div",{className:"df-compact-header-dates",children:(()=>{if(!n)return null;const r=t.findIndex(e=>e.fullDate.getTime()===n.getTime());return Wt(i,{children:[Wt("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 Wt("div",{className:"df-compact-header-date-button",style:{height:"32px"},onClick:()=>{e.setCurrentDate(t.fullDate),null==a||a(t.fullDate)},children:Wt("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&&Wt("div",{className:"df-compact-header-today-dot"})]})},`date-${n}`)})]})})()})]}),Ao=e=>{const{app:t,weekDaysLabels:n,mobileWeekDaysLabels:a,weekDates:r,fullWeekDates:o,isSlidingView:l,mobilePageStart:s,currentWeekStart:d,currentWeekEvents:c,gridWidth:u,allDayAreaHeight:h,organizedAllDaySegments:v,allDayLabelText:f,isMobile:y,isTouch:D,showAllDay:w=!0,calendarRef:b,allDayRowRef:E,topFrozenContentRef:C,ALL_DAY_HEIGHT:T,HOUR_HEIGHT:M,FIRST_HOUR:S,dragState:N,isDragging:k,primaryTzLabel:I,secondaryTzLabel:O,secondaryTimeSlots:R,handleMoveStart:A,handleResizeStart:H,handleEventUpdate:P,handleEventDelete:L,setDraftEvent:$,setIsDrawerOpen:Y,onDateChange:j,onGridDateClick:Z,onGridDateDoubleClick:F,newlyCreatedEventId:_,setNewlyCreatedEventId:W,selectedEventId:z,setSelectedEventId:U,detailPanelEventId:B,setDetailPanelEventId:V,handleCreateAllDayEvent:G,handleDragOver:q,handleDrop:K,useEventDetailPanel:X}=e,J={flexShrink:0},[Q,ee]=g(null),te=p(()=>qt(),[]),ne=!!R&&R.length>0&&!y,ae=t.canMutateFromUI();return m(()=>{ae||ee(null)},[ae]),Wt("div",{className:"df-week-all-day",children:[l&&o&&s&&Wt(Ro,{app:t,fullWeekDates:o,mobilePageStart:s,onDateChange:j}),Wt("div",{className:"df-week-all-day-shell","data-show-all-day":w?"true":"false",onContextMenu:e=>e.preventDefault(),children:[w&&Wt("div",{className:"df-week-all-day-side",onContextMenu:e=>e.preventDefault(),children:[Wt("div",{className:"df-week-all-day-side-spacer","data-sliding-view":l?"true":"false",children:ne&&Wt("div",{className:"df-time-column-tz-header df-time-column-tz-header-compact",children:[Wt("span",{className:"df-time-column-tz-label",children:O}),Wt("span",{className:"df-time-column-tz-label",children:I})]})}),Wt("div",{className:`${Vn} df-week-all-day-label`,style:{minHeight:`${h}px`},children:f})]}),Wt("div",{className:"df-week-all-day-content-wrap",style:{scrollbarGutter:"stable",minHeight:w?`${h+(l?0:36)}px`:"auto"},children:Wt("div",{ref:C,className:"df-week-all-day-content",style:{width:u,minWidth:"100%",transform:l?"translateX(calc(-100% / 3))":void 0},children:[!l&&Wt("div",{className:"df-week-header","data-scrollbar-space":te?"true":"false",style:{marginRight:te?"-50px":"0px",paddingRight:te?"50px":"0px"},children:n.map((e,t)=>Wt("div",{className:"df-week-day-cell df-week-all-day-weekday-cell","data-mobile":y?"true":"false",style:J,children:Wt(i,y?{children:[Wt("div",{className:"df-week-all-day-weekday-label",children:a[t]}),Wt("div",{className:`${jn} df-week-all-day-date-number df-week-all-day-date-number-mobile`,"data-today":r[t].isToday?"true":void 0,children:r[t].date})]}:{children:[Wt("div",{className:"df-week-all-day-weekday-name",children:e}),Wt("div",{className:`${jn} df-week-all-day-date-number`,"data-today":r[t].isToday?"true":void 0,children:r[t].date})]})},t))}),w&&Wt("div",{className:`${Bn} df-week-all-day-row`,ref:E,style:{minHeight:`${h}px`},children:Wt("div",{className:"df-all-day-content df-week-all-day-row-content","data-scrollbar-space":y||!te?"false":"true",style:{minHeight:`${h}px`},children:[n.map((e,t)=>{const a=new Date(d);return a.setDate(d.getDate()+t),Wt("div",{className:"df-all-day-cell df-week-all-day-cell "+(t!==n.length-1||!y&&te?"":"df-week-all-day-cell-no-border"),style:Object.assign({minHeight:`${h}px`},J),onClick:()=>{const e=new Date(d);if(e.setDate(d.getDate()+t),Z){const n=[...st(t,c),...dt(t,c,d)];Z(e,n)}else null==j||j(e)},onMouseDown:e=>null==G?void 0:G(e,t),onDblClick:e=>{const n=new Date(d);if(n.setDate(d.getDate()+t),F){const e=[...st(t,c),...dt(t,c,d)];F(n,e)}else null==G||G(e,t)},onDragOver:q,onDrop:e=>{K(e,a,void 0,!0)},onContextMenu:e=>((e,t)=>{if(e.preventDefault(),y||!ae)return;const n=new Date(d);n.setDate(d.getDate()+t),n.setHours(0,0,0,0),ee({x:e.clientX,y:e.clientY,date:n})})(e,t)},`allday-${t}`)}),Wt("div",{className:"df-week-all-day-event-layer",children:v.map(e=>Wt(Ti,{event:e.event,segment:e,segmentIndex:e.row,isAllDay:!0,isMultiDay:!0,allDayHeight:T,calendarRef:b,viewType:x.WEEK,columnsPerRow:n.length,isBeingDragged:k&&(null==N?void 0:N.eventId)===e.event.id&&"move"===(null==N?void 0:N.mode),hourHeight:M,firstHour:S,onMoveStart:A,onResizeStart:H,onEventUpdate:P,onEventDelete:L,newlyCreatedEventId:_,onDetailPanelOpen:()=>W(null),selectedEventId:z,detailPanelEventId:B,onEventSelect:e=>{var n;const a=!1!==t.getReadOnlyConfig(null!=e?e:void 0).viewable,r=null===(n=v.find(t=>t.event.id===e))||void 0===n?void 0:n.event;if((y||D)&&r&&a)return $(r),void Y(!0);U(e)},onEventLongPress:e=>{(y||D)&&U(e)},onDetailPanelToggle:e=>V(e),useEventDetailPanel:X,app:t,isMobile:y,isSlidingView:l,enableTouch:D},e.event.id))})]})})]})}),ae&&Q&&Wt(Qr,{x:Q.x,y:Q.y,date:Q.date,viewType:x.WEEK,onClose:()=>ee(null),app:t,onCreateEvent:()=>{const e=Math.floor((Q.date.getTime()-d.getTime())/864e5);null==G||G({clientX:Q.x,clientY:Q.y},e)}})]})]})},Ho=({app:e,timeSlots:t,weekDaysLabels:n,currentWeekStart:a,currentWeekEvents:r,eventLayouts:o,gridWidth:l,isMobile:s,isSlidingView:d,isTouch:c,scrollerRef:u,timeGridRef:h,leftFrozenContentRef:y,swipeContentRef:D,calendarRef:w,handleScroll:b,handleCreateStart:E,handleTouchStart:C,handleTouchEnd:T,handleTouchMove:M,handleDragOver:S,handleDrop:N,dragState:k,isDragging:I,handleMoveStart:O,handleResizeStart:R,handleEventUpdate:A,handleEventDelete:H,setDraftEvent:P,setIsDrawerOpen:L,onDateChange:$,onGridDateClick:Y,onGridDateDoubleClick:j,newlyCreatedEventId:Z,setNewlyCreatedEventId:F,selectedEventId:_,setSelectedEventId:W,detailPanelEventId:z,setDetailPanelEventId:U,useEventDetailPanel:B,isCurrentWeek:V,currentTime:G,HOUR_HEIGHT:q,FIRST_HOUR:K,LAST_HOUR:X,showStartOfDayLabel:J,timeFormat:Q="24h",secondaryTimeSlots:ee,appTimeZone:te})=>{var ne,ae;const re=!!ee&&ee.length>0&&!s,ie={flexShrink:0},oe=v(e.state.highlightedEventId),[le,se]=g(null),de=p(()=>qt(),[]),ce=e.canMutateFromUI();m(()=>{ce||se(null)},[ce]);const ue=p(()=>{const e=new Map;return n.forEach((t,i)=>{const o=[];st(i,r).forEach(e=>{const t=di(e,a,n.length,te);if(t.length>0){const n=t.find(e=>e.dayIndex===i);n&&o.push({event:e,segmentInfo:Object.assign(Object.assign({},n),{dayIndex:i})})}else o.push({event:e})}),r.forEach(e=>{if(e.allDay||e.day===i)return;const t=di(e,a,n.length,te).find(e=>e.dayIndex===i);t&&o.push({event:e,segmentInfo:Object.assign(Object.assign({},t),{dayIndex:i})})}),e.set(i,o)}),e},[r,a,n.length,te]),he=v(()=>{});he.current=t=>{const n=!1!==e.getReadOnlyConfig(null!=t?t:void 0).viewable,a=r.find(e=>e.id===t);if((s||c)&&a&&n)return P(a),void L(!0);W(t),e.state.highlightedEventId&&(e.highlightEvent(null),oe.current=null)};const ge=f(e=>he.current(e),[]),me=f(()=>F(null),[F]),ve=f(e=>{(s||c)&&W(e)},[s,c,W]),fe=f(e=>U(e),[U]),pe=e=>{if(!h.current)return K;const t=h.current.getBoundingClientRect();return K+(e-t.top)/q};return Wt("div",{className:"df-week-time-grid",children:[Wt("div",{ref:u,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:b,children:[Wt("div",{ref:y,className:"df-week-time-grid-time-column","data-secondary-tz":re?"true":"false",onContextMenu:e=>e.preventDefault(),children:[Wt("div",{className:"df-time-column-spacer df-time-week-column-spacer","data-secondary-tz":re?"true":"false",children:re?Wt(i,{children:Wt("div",{className:"df-time-column-tz-row df-time-column-tz-row-boundary",children:[Wt("span",{className:"df-time-column-tz-value",children:J&&null!==(ne=null==ee?void 0:ee[0])&&void 0!==ne?ne:""}),Wt("span",{className:"df-time-column-tz-value",children:J?Ze(K,0,Q):""})]})}):Wt("div",{className:"df-time-column-boundary-label",children:J?Ze(K,0,Q):""})}),t.map((e,t)=>{var n;return Wt("div",{className:Fn,children:Wt("div",re?{className:"df-time-column-tz-row",children:[Wt("span",{className:"df-time-column-tz-value",children:J&&0===t?"":null!==(n=null==ee?void 0:ee[t])&&void 0!==n?n:""}),Wt("span",{className:"df-time-column-tz-value",children:J&&0===t?"":e.label})]}:{className:_n,children:J&&0===t?"":e.label})},t)}),Wt("div",{className:"df-week-time-grid-boundary-tail",children:Wt("div",re?{className:"df-time-column-tz-row",children:[Wt("span",{className:"df-time-column-tz-value",children:null!==(ae=null==ee?void 0:ee[0])&&void 0!==ae?ae:""}),Wt("span",{className:"df-time-column-tz-value",children:Ze(0,0,Q)})]}:{className:_n,children:Ze(0,0,Q)})}),V&&G&&(()=>{const e=G,t=e.getHours()+e.getMinutes()/60;return t<K||t>X?null:Wt("div",{className:"df-week-time-grid-current-time-label",style:{top:(t-K)*q+"px",marginTop:"0.75rem"},children:Wt("div",{className:Un,children:Ze(t,0,Q,!1)})})})()]}),Wt("div",{ref:D,className:"df-week-time-grid-content",style:{width:l,minWidth:"100%",transform:d?"translateX(calc(-100% / 3))":void 0},children:Wt("div",{className:"df-week-time-grid-grid",children:[Wt("div",{className:`${na} df-time-grid-boundary-top df-week-time-grid-boundary-row`,"data-scrollbar-space":s||!de?"false":"true",children:n.map((e,t)=>Wt("div",{className:"df-week-time-grid-boundary-cell",style:ie},`boundary_${t}`))}),Wt("div",{ref:h,className:"df-week-time-grid-grid-inner",children:[V&&G&&(()=>{const e=G,t=e.getHours()+e.getMinutes()/60;if(t<K||t>X)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 Wt("div",{className:zn,style:{top:(t-K)*q+"px",height:0,zIndex:20},children:[Wt("div",{className:"df-week-time-grid-current-time-spacer"}),Wt("div",{className:"df-week-time-grid-current-time-track",children:n.map((e,t)=>Wt("div",{className:"df-week-time-grid-current-time-cell",children:Wt("div",{className:"df-week-time-grid-current-line-rail","data-today":t===l?"true":"false",style:{zIndex:9999},children:t===l&&0!==l&&Wt("div",{className:"df-week-time-grid-current-line-dot"})})},t))})]})})(),t.map((e,t)=>Wt("div",{className:Wn,"data-scrollbar-space":s||!de?"false":"true",children:n.map((n,i)=>{const o=new Date(a);return o.setDate(a.getDate()+i),Wt("div",{className:"df-time-grid-cell df-week-time-grid-cell",style:ie,onClick:()=>{const e=new Date(a);if(e.setDate(a.getDate()+i),Y){const t=[...st(i,r),...dt(i,r,a)];Y(e,t)}else null==$||$(e)},onMouseDown:e=>{Ni(e,i,pe(e.clientY),c,E)},onDblClick:e=>{const t=new Date(a);if(t.setDate(a.getDate()+i),j){const e=[...st(i,r),...dt(i,r,a)];j(t,e)}else null==E||E(e,i,pe(e.clientY)),ki()},onTouchStart:t=>C(t,i,e.hour),onTouchEnd:T,onTouchMove:M,onDragOver:S,onDrop:t=>{N(t,o,e.hour)},onContextMenu:t=>((e,t,n)=>{if(e.preventDefault(),s||!ce)return;const r=new Date(a);if(r.setDate(a.getDate()+t),h.current){const t=h.current.getBoundingClientRect(),n=(e.clientY-t.top)/q+K,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);se({x:e.clientX,y:e.clientY,date:r})})(t,i,e.hour)},`${t}-${i}`)})},t)),Wt("div",{className:`${na} df-time-grid-boundary-bottom df-week-time-grid-boundary-row`,"data-scrollbar-space":s||!de?"false":"true",children:n.map((e,t)=>Wt("div",{className:"df-week-time-grid-boundary-cell",style:ie},`24-${t}`))}),n.map((t,a)=>{var r;const i=n.length,l=null!==(r=ue.get(a))&&void 0!==r?r:[];return Wt("div",{className:"df-week-time-grid-event-layer",style:{left:`calc(${100/i*a}%)`,width:100/i+"%",height:"100%"},children:l.map(({event:t,segmentInfo:n})=>{const r=o.get(a),l=null==r?void 0:r.get(t.id);return Wt(Ti,{event:t,layout:l,viewType:x.WEEK,calendarRef:w,columnsPerRow:i,isBeingDragged:I&&(null==k?void 0:k.eventId)===t.id&&"move"===(null==k?void 0:k.mode),hourHeight:q,firstHour:K,onMoveStart:O,onResizeStart:R,onEventUpdate:A,onEventDelete:H,newlyCreatedEventId:Z,onDetailPanelOpen:me,selectedEventId:_,detailPanelEventId:z,onEventSelect:ge,onEventLongPress:ve,onDetailPanelToggle:fe,useEventDetailPanel:B,multiDaySegmentInfo:n,app:e,isMobile:s,isSlidingView:d,enableTouch:c,appTimeZone:te},n?`${t.id}-seg-${a}`:t.id)})},`events-day-${a}`)})]})]})})]}),ce&&le&&Wt(Qr,{x:le.x,y:le.y,date:le.date,viewType:x.WEEK,onClose:()=>se(null),app:e,onCreateEvent:()=>{if(E){const e=new Date(a);e.setHours(0,0,0,0);const t=new Date(le.date);t.setHours(0,0,0,0);const n=t.getTime()-e.getTime(),r=Math.round(n/864e5),i=le.date.getHours()+le.date.getMinutes()/60,o={preventDefault:()=>{},stopPropagation:()=>{},clientX:le.x,clientY:le.y};E(o,r,i)}}})]})},Po=e=>{const t=n.Now.plainDateISO(e);return new Date(t.year,t.month-1,t.day).toDateString()},Lo=({app:e,config:t,onDateChange:n,useEventDetailPanel:a,calendarRef:r,selectedEventId:i,onEventSelect:o,detailPanelEventId:l,onDetailPanelToggle:s})=>{var d;const{t:c,getWeekDaysLabels:u,locale:h}=Pn(),D=e.getCurrentDate(),w=p(()=>D,[D.getTime()]),b=e.getEvents(),{screenSize:E}=An(),C="desktop"!==E,T=v(null),[M,S]=g(!1),{hourHeight:N=wo.HOUR_HEIGHT,firstHour:k=wo.FIRST_HOUR,lastHour:I=wo.LAST_HOUR,allDayHeight:O=wo.ALL_DAY_HEIGHT,showAllDay:R=!0,timeFormat:A="24h",secondaryTimeZone:H}=t,P=H&&"mobile"!==E?88:"mobile"===E?48:80,L=N,$=k,Y=I,j=O,Z=!R;m(()=>{S("ontouchstart"in window||navigator.maxTouchPoints>0)},[]);const F="desktop"!==E,_=F?2:7,W=F,z=null!==(d=t.startOfWeek)&&void 0!==d?d:1,U=W?"300%":"100%",B=p(()=>po(w,z),[w,z]),V=W?3*_:7,[G,q]=g(null),[J,Q]=g(null),[ee,te]=g(null),ne=void 0===i?J:i,ae=void 0===l?ee:l,re=e=>{o?o(e):Q(e)},ie=e=>{s?s(e):te(e)},[oe,le]=g(null),se=v(null),de=v(null),ce=v(null),ue=v(null),he=v(null),ge=v(null),{handleScroll:me,goToNext:ve,goToPrevious:fe,mobilePageStart:pe}=(({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),b=v(null);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 E=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,t)=>{y.current={x:e,y:t},D.current=!1,w.current=0,p(!1)},c=(e,n,a)=>{if(h)return;const r=e-y.current.x,i=n-y.current.y;if(!D.current&&Math.abs(r)>10&&Math.abs(r)>Math.abs(i)&&(D.current=!0),!D.current)return;null==a||a();const s=t.clientWidth/2,d=Math.max(-s,Math.min(s,r)),c=`translateX(calc(-100% / 3 + ${d}px))`;l.current&&(l.current.style.transition="none",l.current.style.transform=c),o.current&&(o.current.style.transition="none",o.current.style.transform=c),w.current=d},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)),D.current=!1},m=e=>{n(e.touches[0].clientX,e.touches[0].clientY)},v=e=>{c(e.touches[0].clientX,e.touches[0].clientY,()=>{e.cancelable&&e.preventDefault()})},f=()=>{g()},E=e=>{var a;"touch"!==e.pointerType&&0===e.button&&(b.current=e.pointerId,null===(a=t.setPointerCapture)||void 0===a||a.call(t,e.pointerId),n(e.clientX,e.clientY))},C=e=>{b.current===e.pointerId&&c(e.clientX,e.clientY,()=>{e.cancelable&&e.preventDefault()})},T=e=>{var n;b.current===e.pointerId&&(null===(n=t.releasePointerCapture)||void 0===n||n.call(t,e.pointerId),b.current=null,g())};return t.addEventListener("touchstart",m,{passive:!0}),t.addEventListener("touchmove",v,{passive:!1}),t.addEventListener("touchend",f,{passive:!0}),t.addEventListener("pointerdown",E),t.addEventListener("pointermove",C),t.addEventListener("pointerup",T),t.addEventListener("pointercancel",T),()=>{t.removeEventListener("touchstart",m),t.removeEventListener("touchmove",v),t.removeEventListener("touchend",f),t.removeEventListener("pointerdown",E),t.removeEventListener("pointermove",C),t.removeEventListener("pointerup",T),t.removeEventListener("pointercancel",T)}},[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 C=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:E,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:C,mobilePageStart:s}})({app:e,columnsPerPage:_,currentDate:w,displayDays:V,isSlidingView:W,scrollerRef:ce,swipeContentRef:ge,topFrozenContentRef:ue}),ye=W?pe:B,De=p(()=>{if(!W)return ye;const e=new Date(ye);return e.setDate(e.getDate()-_),e},[_,ye,W]),we=e.timeZone,be=p(()=>((e,t,n=7,a)=>{const r=t.getTime(),i=new Date(t);i.setDate(t.getDate()+(n-1)),i.setHours(23,59,59,999);const o=i.getTime(),l=`${r}|${n}|${null!=a?a:""}`,s=[];for(let t=0;t<e.length;t++){const i=e[t],{inWeek:d,day:c}=Do(i,l,r,o,n,a);d&&s.push(i.day===c?i:Object.assign(Object.assign({},i),{day:c}))}return s})(b,De,V,we),[b,De,V,we]),Ee=v(e.state.highlightedEventId);m(()=>{if(e.state.highlightedEventId!==Ee.current)if(e.state.highlightedEventId){re(e.state.highlightedEventId);const t=be.find(t=>t.id===e.state.highlightedEventId);if(t&&!t.allDay){const e=K(t.start),n=ce.current;if(n){const t=(e-$)*L;requestAnimationFrame(()=>{n.scrollTo({top:Math.max(0,t-100),behavior:"smooth"})})}}}else Ee.current&&ne===Ee.current&&re(null);Ee.current=e.state.highlightedEventId},[e.state.highlightedEventId,be,$,L]);const Ce=p(()=>((e,t,n=7,a)=>{const r=li(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})(be,De,V,e.state.allDaySortComparator),[be,De,V,e.state.allDaySortComparator]),Te=p(()=>{const e=W?Ce.filter(e=>e.endDayIndex>=_&&e.startDayIndex<=2*_-1):Ce;if(0===e.length)return j;const t=Math.max(...e.map(e=>e.row));return j+t*j},[Ce,j,W,_]),Me=p(()=>fo(be,De,V,we),[be,De,V,we]),Se=f((t,n,a)=>{const r=be,i=t(r),o=new Map(r.map(e=>[e.id,e])),l=new Set(i.map(e=>e.id)),s=r.filter(e=>!l.has(e.id)),d=i.filter(e=>!o.has(e.id)),c=i.filter(e=>{const t=o.get(e.id);return void 0!==t&&t!==e&&Tt(t,e)});e.applyEventsChanges({delete:s.map(e=>e.id),add:d,update:c.map(e=>({id:e.id,updates:e}))},n,a)},[be,e]),Ne=f(t=>{C?e.onMobileEventDetailToggle(t):(e.addEvent(t),le(t.id))},[C,e]),ke=f(()=>{},[]),Ie=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=fo([...a,c],r,i,o).get(e))||void 0===l?void 0:l.get("-1"))||null})(e,t,n,be,De,V,we),[be,De,V,we]),xe=f((e,t,n,a)=>((e,t,n,a,r,i,o=7,l)=>{const s=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 ho.calculateDayEventLayouts(go(s,t,i,o,l).events,{viewType:"week"}).get(e.id)||null})(e,t,n,a,be,De,V,we),[be,De,V,we]),Re=p(()=>({calendarRef:r,allDayRowRef:R?de:void 0,timeGridRef:T,viewType:x.WEEK,onEventsUpdate:Se,onEventCreate:Ne,onEventEdit:ke,currentWeekStart:De,events:be,calculateNewEventLayout:Ie,calculateDragLayout:xe,TIME_COLUMN_WIDTH:P,isMobile:C,gridWidth:U,displayDays:V}),[r,R,Se,Ne,ke,De,be,Ie,xe,P,C,U,V]),{handleMoveStart:Ae,handleCreateStart:He,handleResizeStart:Pe,handleCreateAllDayEvent:Le,dragState:$e,isDragging:Ye}=Mo(e,Re),{handleDrop:je,handleDragOver:Fe}=bo({app:e,onEventCreated:e=>{le(e.id)}}),_e=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:V,displayStart:De,getWeekDaysLabels:u,isSlidingView:W,locale:h,startOfWeek:z}),[V,De,u,W,h,z]),We=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)})})(C,h,u,_e),[u,C,h,_e]),Ge=p(()=>c("allDay"),[c]),qe=Array.from({length:24},(e,t)=>({hour:t+$,label:Ze(t+$,0,A)})),Ke=p(()=>H?ze(qe,H,A,w,we):void 0,[H,A,$,w,we]),Xe=p(()=>H?Ue(we,w):void 0,[H,we,w]),Je=p(()=>H?Ue(H,w):void 0,[H,w]),Qe=p(()=>((e,t,n,a)=>{const r=Po(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}})})(De,_e,h,we),[we,De,h,_e]),et=p(()=>((e,t,n,a)=>{const r=Po(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"})}})})(B,h,w,we),[we,w,h,B]),tt=t=>e.updateEvent(t.id,t),nt=t=>e.deleteEvent(t),at=p(()=>{const e=Ve(we);e.setHours(0,0,0,0);const t=new Date(De);t.setHours(0,0,0,0);const n=new Date(t);return n.setDate(t.getDate()+V),e>=t&&e<n},[De,V,we]);y(()=>{if(t.scrollToCurrentTime&&ce.current){const e=ce.current,t=Be(we),n=t.getHours()+t.getMinutes()/60,a=e.clientHeight;e.scrollTop=Math.max(0,(n-$)*L-a/2)}},[we,t.scrollToCurrentTime,$,L]),m(()=>{q(Be(we));const e=setInterval(()=>q(Be(we)),6e4);return()=>clearInterval(e)},[we]);const rt=f((a,r)=>{const i=null==t?void 0:t.gridDateClick;i?"function"!=typeof i?"day-view"===i&&(e.setCurrentDate(a),e.changeView(x.DAY)):i(a,r):null==n||n(a)},[t.gridDateClick,e,n]),it=f((n,a)=>{var r;const i=null!==(r=null==t?void 0:t.gridDateDoubleClick)&&void 0!==r?r:"day-view";"function"!=typeof i?"day-view"===i&&(e.setCurrentDate(n),e.changeView(x.DAY)):i(n,a)},[t.gridDateDoubleClick,e]);return Wt("div",{className:"df-calendar df-week-view",children:[Wt(Si,{calendar:e,viewType:x.WEEK,currentDate:w,onPrevious:()=>{fe()||e.goToPrevious()},onNext:()=>{ve()||e.goToNext()},onToday:()=>e.goToToday()}),Wt(Ao,{app:e,weekDaysLabels:_e,mobileWeekDaysLabels:We,weekDates:Qe,fullWeekDates:et,isSlidingView:W,mobilePageStart:pe,currentWeekStart:De,currentWeekEvents:be,gridWidth:U,allDayAreaHeight:Te,organizedAllDaySegments:Ce,allDayLabelText:Ge,isMobile:C,isTouch:M,showAllDay:R,calendarRef:r,allDayRowRef:de,topFrozenContentRef:ue,ALL_DAY_HEIGHT:j,HOUR_HEIGHT:L,FIRST_HOUR:$,dragState:$e,isDragging:Ye,secondaryTimeSlots:Ke,primaryTzLabel:Xe,secondaryTzLabel:Je,handleMoveStart:Ae,handleResizeStart:Pe,handleEventUpdate:tt,handleEventDelete:nt,setDraftEvent:t=>e.onMobileEventDetailToggle(t),setIsDrawerOpen:t=>{t||e.onMobileEventDetailToggle(null)},onDateChange:n,onGridDateClick:rt,onGridDateDoubleClick:it,newlyCreatedEventId:oe,setNewlyCreatedEventId:le,selectedEventId:ne,setSelectedEventId:re,detailPanelEventId:ae,setDetailPanelEventId:ie,handleCreateAllDayEvent:Le,handleDragOver:Fe,handleDrop:je,useEventDetailPanel:a}),Wt(Ho,{app:e,timeSlots:qe,weekDaysLabels:_e,currentWeekStart:De,currentWeekEvents:be,eventLayouts:Me,gridWidth:U,isMobile:C,isSlidingView:W,isTouch:M,scrollerRef:ce,timeGridRef:T,leftFrozenContentRef:he,swipeContentRef:ge,calendarRef:r,handleScroll:me,handleCreateStart:He,handleTouchStart:(e,t,n)=>{if(!C&&!M)return;const a=e.touches[0],r=a.clientX,i=a.clientY,o=e.currentTarget;se.current=setTimeout(()=>{null==He||He({preventDefault:()=>{},stopPropagation:()=>{},touches:[{clientX:r,clientY:i}],changedTouches:[{clientX:r,clientY:i}],target:o,currentTarget:o,cancelable:!0},t,n)},500)},handleTouchEnd:()=>{se.current&&(clearTimeout(se.current),se.current=null)},handleTouchMove:()=>{se.current&&(clearTimeout(se.current),se.current=null)},handleDragOver:Fe,handleDrop:je,dragState:$e,isDragging:Ye,handleMoveStart:Ae,handleResizeStart:Pe,handleEventUpdate:tt,handleEventDelete:nt,setDraftEvent:t=>e.onMobileEventDetailToggle(t),setIsDrawerOpen:t=>{t||e.onMobileEventDetailToggle(null)},onDateChange:n,onGridDateClick:rt,onGridDateDoubleClick:it,newlyCreatedEventId:oe,setNewlyCreatedEventId:le,selectedEventId:ne,setSelectedEventId:re,detailPanelEventId:ae,setDetailPanelEventId:ie,useEventDetailPanel:a,isCurrentWeek:at,currentTime:G,HOUR_HEIGHT:L,FIRST_HOUR:$,LAST_HOUR:Y,showStartOfDayLabel:Z,timeFormat:A,secondaryTimeSlots:Ke,appTimeZone:we})]})},$o={startOfWeek:1},Yo=e=>o(No,Object.assign(Object.assign({},e),{viewType:x.WEEK,originalComponent:Lo,className:"df-week-view-factory"}));Yo.displayName="WeekViewAdapter";const jo=(e={})=>{const t=Object.assign(Object.assign({},$o),e);return{type:x.WEEK,component:Yo,config:t}},Zo=({app:e,appTimeZone:t,calendarRef:n,currentMonth:a,currentYear:r,useEventDetailPanel:i,day:o,dayIndex:l,dayLayout:s,detailPanelEventId:d,dragState:c,enableTouch:u,hasScrollbarSpace:h,isDragging:g,locale:m,moreLabel:f,newlyCreatedEventId:p,onCalendarDragOver:y,onCalendarDrop:D,onChangeView:w,onContextMenu:b,onCreateStart:E,onDetailPanelOpen:C,onDetailPanelToggle:T,onEventDelete:M,onEventLongPress:S,onEventSelect:N,onEventUpdate:k,onMoreEventsClick:I,onMoveStart:O,onResizeStart:R,onSelectDate:A,onGridDateClick:H,onGridDateDoubleClick:P,organizedMultiDaySegments:L,overlayVisibleLayerCount:$,screenSize:Y,selectedEventId:j,showWeekNumbers:Z,totalSlotsNeeded:F,weekHeightPx:_})=>{const W=v(null),z=v(null),U=o.date.toLocaleDateString(m,{month:m.startsWith("zh")||m.startsWith("ja")?"short":"long"})===a&&o.year===r,{hasMore:B,limit:V,timedEventsOnly:G,gapLayers:q,occupiedLayers:X,maxOccupiedLayer:J,segmentIsHidden:Q}=s;let te=0;L.slice(V).forEach(e=>{e.forEach(e=>{e.startDayIndex<=l&&e.endDayIndex>=l&&te++})}),L.slice(0,V).forEach(e=>{e.forEach(e=>{e.startDayIndex<=l&&e.endDayIndex>=l&&Q.has(e.id)&&te++})});const ne=q.filter(e=>e<V).length,ae=L.slice(0,V).filter(e=>e.some(e=>e.startDayIndex<=l&&e.endDayIndex>=l&&Q.has(e.id))).length,re=Math.max(0,V-Math.max(J+1,0)),ie=Math.min(G.length,ne+re+ae),oe=G.slice(0,ie),le=te+(G.length-ie),se=B&&$>V,de=17*($-V),ce=g&&c.eventId?c.eventId:null,ue=ce?oe.find(e=>e.id===ce):null,he=ce&&!ue?G.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,F);for(let a=0;a<fe;a++)if(X.has(a)&&!L[a].some(e=>e.startDayIndex<=l&&e.endDayIndex>=l&&Q.has(e.id)))me.push(Wt("div",{className:"df-shrink-0",style:{height:"17px",minHeight:"17px"}},`placeholder-layer-${a}-${o.date.getTime()}`));else if(ve<ge.length){const a=ge[ve];me.push(Wt(Ti,{event:a,isAllDay:!!a.allDay,viewType:x.MONTH,isBeingDragged:g&&c.eventId===a.id&&"move"===c.mode,calendarRef:n,hourHeight:72,firstHour:0,onEventUpdate:k,onEventDelete:M,onMoveStart:O,onResizeStart:R,onDetailPanelOpen:C,onEventSelect:N,onEventLongPress:S,newlyCreatedEventId:p,selectedEventId:j,detailPanelEventId:d,onDetailPanelToggle:T,useEventDetailPanel:i,app:e,isMobile:"desktop"!==Y,enableTouch:u,appTimeZone:t},`${a.id}-${a.day}-${K(a.start)}-${ve}`)),ve++}const pe=[...G,...L.flat().filter(e=>e.startDayIndex<=l&&e.endDayIndex>=l).map(e=>e.event)];return Wt("div",{className:da("df-month-day-cell","df-month-day-cell-surface"),style:{height:_},"data-other-month":U?"false":"true","data-trailing-border":6!==l||h?"true":"false","data-date":(ye=o.date,`${ye.getFullYear()}-${String(ye.getMonth()+1).padStart(2,"0")}-${String(ye.getDate()).padStart(2,"0")}`),onClick:()=>{U&&(H?H(o.date,pe):null==A||A(o.date))},onDblClick:e=>{P?P(e,o.date,pe):null==E||E(e,o.date)},onTouchStart:e=>{if("mobile"!==Y&&!u)return;const t=e.touches[0];z.current={x:t.clientX,y:t.clientY},W.current=setTimeout(()=>{null==E||E(e,o.date),W.current=null,navigator.vibrate&&navigator.vibrate(50)},500)},onTouchMove:e=>{if(W.current&&z.current){const t=Math.abs(e.touches[0].clientX-z.current.x),n=Math.abs(e.touches[0].clientY-z.current.y);(t>10||n>10)&&(clearTimeout(W.current),W.current=null)}},onTouchEnd:()=>{W.current&&(clearTimeout(W.current),W.current=null),z.current=null},onDragOver:y,onDrop:e=>null==D?void 0:D(e,o.date),onContextMenu:e=>b(e,o.date),children:[Wt("div",{className:"df-month-date-number-container",children:[Z&&0===l&&"mobile"!==Y&&Wt("span",{className:"df-month-week-number",children:ee(o.date)}),Wt("span",{className:"df-month-date-number","data-today":o.isToday?"true":void 0,"data-other-month":U?void 0:"true",children:1===o.day&&"desktop"===Y?o.date.toLocaleDateString(m,{month:"short",day:"numeric"}):o.day})]}),Wt("div",{className:"df-month-day-cell-content",children:[se&&Wt("div",{className:"df-month-day-cell-overlay-mask",style:{top:17*V+"px",height:`${de}px`}}),me,B&&Wt("div",{className:da("df-month-more-events","df-month-day-cell-more-events"),"data-layout":"desktop"===Y?"desktop":"mobile",onClick:e=>{e.stopPropagation(),I?I(o.date):(null==A||A(o.date),null==w||w(x.DAY))},children:["+",le,"desktop"===Y?` ${f}`:""]})]})]},`day-${o.date.getTime()}`);var ye},Fo=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:M,onSelectDate:S,onGridDateClick:N,onGridDateDoubleClick:k,selectedEventId:I,onEventSelect:O,onEventLongPress:R,detailPanelEventId:A,onDetailPanelToggle:H,useEventDetailPanel:P,onCalendarDrop:L,onCalendarDragOver:$,app:Y,enableTouch:j,appTimeZone:Z})=>{const{t:F,locale:_}=Pn(),[W,z]=g(!1),U=v(null),[B,V]=g(null),G=Y.canMutateFromUI();m(()=>{G||V(null)},[G]);const q=(e,t)=>{e.preventDefault(),"mobile"!==r&&G&&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?(z(!0),U.current&&(clearTimeout(U.current),U.current=null),()=>{U.current&&(clearTimeout(U.current),U.current=null)}):W?(U.current=setTimeout(()=>{z(!1),U.current=null},100),()=>{U.current&&(clearTimeout(U.current),U.current=null)}):void 0,[i,W]);const{weekData:J}=d,Q=J.days.find(e=>1===e.day),ee=`${c}px`,te=p(()=>qt(),[]),ne=p(()=>li(u,J.startDate,7,Z),[u,J.startDate,Z]),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,Z),[u,J.startDate,Z]),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,Z).toDateString()===n;const t=Ne(e.start,Z),a=Ne(e.end,Z);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,Z]),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,Y.state.allDaySortComparator),[ne,Y.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 Wt("div",{className:"df-month-week",style:{height:ee},children:[s&&Q&&Wt("div",{className:"df-month-title","data-visible":W?"true":"false",style:{transition:"opacity 0.5s ease",maxWidth:"fit-content"},onContextMenu:e=>e.preventDefault(),children:Wt("span",{className:"df-month-title-label",children:he})}),Wt("div",{className:"df-month-week-inner",children:Wt("div",{className:"df-month-week-grid-shell",children:[Wt("div",{className:"df-month-week-grid",children:J.days.map((n,i)=>Wt(Zo,{app:Y,appTimeZone:Z,calendarRef:f,currentMonth:e,currentYear:t,useEventDetailPanel:P,day:n,dayIndex:i,dayLayout:de[i],detailPanelEventId:A,dragState:h,enableTouch:j,hasScrollbarSpace:te,isDragging:o,locale:_,moreLabel:F("more"),newlyCreatedEventId:a,onCalendarDragOver:$,onCalendarDrop:L,onChangeView:M,onContextMenu:q,onCreateStart:b,onDetailPanelOpen:C,onDetailPanelToggle:H,onEventDelete:D,onEventLongPress:R,onEventSelect:O,onEventUpdate:y,onMoreEventsClick:T,onMoveStart:w,onResizeStart:E,onSelectDate:S,onGridDateClick:N,onGridDateDoubleClick:k,organizedMultiDaySegments:ie,overlayVisibleLayerCount:ce,screenSize:r,selectedEventId:I,showWeekNumbers:l,totalSlotsNeeded:de[i].totalSlotsNeeded,weekHeightPx:ee},`day-${n.date.getTime()}`))}),ie.length>0&&Wt("div",{className:"df-month-week-event-layer",style:{top:"33px",height:`${ue}px`},children:ie.slice(0,ce).map((e,t)=>Wt("div",{className:"df-month-week-event-layer-row",children:e.filter(e=>!de[0].segmentIsHidden.has(e.id)).map(e=>Wt(Ti,{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:I,onEventSelect:O,onEventLongPress:R,detailPanelEventId:A,onDetailPanelToggle:H,useEventDetailPanel:P,app:Y,isMobile:"desktop"!==r,enableTouch:j,appTimeZone:Z},e.id))},`layer-${t}`))})]})}),G&&B&&Wt(Qr,{x:B.x,y:B.y,date:B.date,viewType:x.MONTH,onClose:()=>V(null),app:Y,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.onGridDateClick===t.onGridDateClick&&e.onGridDateDoubleClick===t.onGridDateDoubleClick&&e.selectedEventId===t.selectedEventId&&e.onEventSelect===t.onEventSelect&&e.onEventLongPress===t.onEventLongPress&&e.detailPanelEventId===t.detailPanelEventId&&e.onDetailPanelToggle===t.onDetailPanelToggle&&e.useEventDetailPanel===t.useEventDetailPanel&&e.onCalendarDrop===t.onCalendarDrop&&e.onCalendarDragOver===t.onCalendarDragOver&&e.app===t.app&&e.enableTouch===t.enableTouch&&e.appTimeZone===t.appTimeZone);Fo.displayName="WeekComponent";const _o=(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},Wo=[],zo=({app:e,config:t,onDateChange:n,useEventDetailPanel:a,calendarRef:r,selectedEventId:i,onEventSelect:o,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,M=!0===(null===(c=t.scroll)||void 0===c?void 0:c.disabled),S=M&&"fade"===(null===(u=t.scroll)||void 0===u?void 0:u.transition),[N,k]=g(b),[I,O]=g(!1),[H,P]=g("forward"),L=v(b),$=v(null),Y=b.getFullYear(),j=b.getMonth();m(()=>{if(!S)return;if(Y===L.current.getFullYear()&&j===L.current.getMonth())return;const e=b>L.current;return L.current=b,P(e?"forward":"backward"),$.current&&clearTimeout($.current),O(!0),$.current=setTimeout(()=>{k(b),O(!1)},300),()=>{$.current&&clearTimeout($.current)}},[Y,j,S]);const Z=p(()=>S?((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})(N,C):[],[S,N,C]),F=p(()=>({opacity:I?0:1,transform:I?`translateX(${"forward"===H?"-6%":"6%"})`:"translateX(0)",transition:"opacity 300ms ease, transform 300ms ease"}),[I,H]),_=e.getCalendars().map(e=>e.id+e.colors.lineColor).join("-"),W=v(null),z=p(()=>{const e=W.current;return e&&e.length===E.length&&e.every((e,t)=>e===E[t])?e:(W.current=E,E)},[E]),U=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 z.forEach(e=>{if(!e.start)return;const a=Ne(e.start,T),r=e.end?Ne(e.end,T):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},[z,C,T]),{screenSize:B}=An(),[V,G]=g(!1);m(()=>{G("ontouchstart"in window||navigator.maxTouchPoints>0)},[]);const[q,K]=g(()=>{if("undefined"==typeof window)return 119;const e=window.innerHeight-150;return Math.max(80,Math.ceil(e/6))}),[X,J]=g(()=>"undefined"!=typeof window),Q=v(q),ee=v([]),[te,ne]=g(null),[ae,re]=g(null),[ie,oe]=g(null),le=void 0===i?ae:i,se=void 0===l?ie:l,de=f(e=>{o?o(e):re(e)},[o]),ce=f(e=>{s?s(e):oe(e)},[s]),ue=v(e.state.highlightedEventId);m(()=>{e.state.highlightedEventId?de(e.state.highlightedEventId):ue.current&&de(null),ue.current=e.state.highlightedEventId},[e.state.highlightedEventId]);const he=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:ge,handleCreateStart:me,handleResizeStart:ve,dragState:fe,isDragging:pe}=Mo(e,{calendarRef:r,viewType:x.MONTH,onEventsUpdate:(t,n,a)=>{const r=z,i=t(r),o=new Map(r.map(e=>[e.id,e])),l=new Set(i.map(e=>e.id)),s=r.filter(e=>!l.has(e.id)),d=i.filter(e=>!o.has(e.id)),c=i.filter(e=>{const t=o.get(e.id);return void 0!==t&&t!==e&&Tt(t,e)});e.applyEventsChanges({delete:s.map(e=>e.id),add:d,update:c.map(e=>({id:e.id,updates:e}))},n,a)},onEventCreate:t=>{"desktop"===B?e.addEvent(t):e.onMobileEventDetailToggle(t)},onEventEdit:e=>{ne(e.id)},currentWeekStart:he,events:z,isMobile:"desktop"!==B}),ye=fe,{handleDrop:De,handleDragOver:we}=bo({app:e,onEventCreated:e=>{ne(e.id)}}),be=p(()=>h(w,"short",C),[w,h,C]),Ee=p(()=>{if(!pe||!ye.eventId||!ye.startDate||!ye.endDate||"move"!==ye.mode&&"resize"!==ye.mode)return null;const e=z.find(e=>e.id===ye.eventId);return e?Object.assign(Object.assign({},e),{start:e.allDay?Ie(ye.startDate):Oe(ye.startDate,T),end:e.allDay?Ie(ye.endDate):Oe(ye.endDate,T)}):null},[pe,ye.eventId,ye.startDate,ye.endDate,ye.mode,z,T]),Ce=f(e=>{var t;const n=null!==(t=U.get(e.getTime()))&&void 0!==t?t:Wo;if(!Ee)return n;const a=n.some(e=>e.id===Ee.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=_o(r,n).getTime(),l=_o(i,n).getTime(),s=_o(t,n).getTime();return s>=o&&s<=l})(Ee,e,C,T);if(!a&&!r)return n;const i=n.filter(e=>e.id!==Ee.id);return r&&i.push(Ee),i},[U,Ee,C,T]),{currentMonth:Te,currentYear:Me,isScrolling:Se,virtualData:ke,weeksData:xe,scrollElementRef:Re,isNavigating:Ae,handleScroll:He,handlePreviousMonth:Pe,handleNextMonth:Le,handleToday:$e,setScrollTop:Ye}=(({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,M]=g(e.getFullYear()),[S,N]=g(!1),[k,I]=g(c),[x,O]=g(!1),H=v(!1),[P,L]=g(!1),$=v(e),Y=v(null),j=v(null),Z=v(new A),F=v(0),_=v(0),W=v(!1),z=f(e=>{e&&(Y.current=e)},[]),U=f(e=>{let t=Z.current.get(e);return t||(t=it(e),Z.current.set(e,t)),t},[]),B=f((e,n=26)=>{W.current||(W.current=!0,setTimeout(()=>{try{if("future"===e){const e=k.at(-1),t=[];for(let a=1;a<=n;a++){const n=new Date(e.startDate);n.setDate(n.getDate()+7*a),t.push(U(n))}I(e=>[...e,...t])}else{const e=k[0],a=[];for(let t=n;t>=1;t--){const n=new Date(e.startDate);n.setDate(n.getDate()-7*t),a.push(U(n))}const r=a.length*t;I(e=>[...a,...e]),requestAnimationFrame(()=>{D(e=>e+r),Y.current&&(Y.current.scrollTop+=r)})}}finally{setTimeout(()=>{W.current=!1},200)}},0))},[k,U,t]),V=p(()=>{const e=k.length*t,n=Math.floor(h/t);let a=Math.max(0,n);a=Math.min(a,Math.max(0,k.length-6));const r=Math.min(k.length-1,a+6-1),i=Math.max(0,a-15),o=Math.min(k.length-1,r+15),l=[];for(let e=i;e<=o;e++)l.push({index:e,weekData:k[e],top:e*t,height:t});return{totalHeight:e,visibleItems:l,displayStartIndex:a}},[h,w,t,k]),G=f(e=>{if(x||S||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 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),M(o),null==n||n(i,o))):i===E&&o===T||(C(i),M(o),null==n||n(i,o)))},[w,E,T,x,S,n,h,P]),q=f(e=>{const n=performance.now();if(n-F.current<R.SCROLL_THROTTLE)return;F.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&&!W.current&&B("future",26),r<10*t&&!W.current&&B("past",26)}),N(!0),j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{N(!1)},R.SCROLL_DEBOUNCE)},[t,B,x]),K=f((e,n=!0)=>{if(!Y.current)return;O(!0),H.current=!0;const a=()=>{setTimeout(()=>{O(!1),H.current=!1},n?500:200)},r=k.findIndex(t=>t.days.some(t=>t.date.toDateString()===e.toDateString()));if(-1!==r){const e=r*t;return Y.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=k[0],d=k.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(U(t))}const i=r.length*t;I(e=>[...r,...e]),requestAnimationFrame(()=>{const o=[...r,...k].findIndex(t=>t.days.some(t=>t.date.toDateString()===e.toDateString()));if(Y.current&&-1!==o){const e=o*t;Y.current.scrollTop+=i,D(e=>e+i),setTimeout(()=>{Y.current&&Y.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(U(t))}I(e=>[...e,...r]),requestAnimationFrame(()=>{const i=[...k,...r].findIndex(t=>t.days.some(t=>t.date.toDateString()===e.toDateString()));if(Y.current&&-1!==i){const e=i*t;Y.current.scrollTo({top:e,behavior:n?"smooth":"auto"})}a()})}else a()},[k,t,U]),X=f(()=>{var e;const t=V.displayStartIndex,n=Math.min(k.length-1,t+5),a={};for(let r=t;r<=n;r++)null===(e=k[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,k,K]),J=f(()=>{var e;const t=V.displayStartIndex,n=Math.min(k.length-1,t+5),a={};for(let r=t;r<=n;r++)null===(e=k[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,k,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),M(r),null==n||n(a,r);const o=k.findIndex(e=>e.days.some(e=>e.date.toDateString()===i.toDateString()));if(-1===o)O(!0),H.current=!0,requestAnimationFrame(()=>{K(i,!0),setTimeout(()=>{H.current=!1,O(!1)},200)});else{const e=o*t,n=Y.current;n&&(O(!0),H.current=!0,requestAnimationFrame(()=>{D(e),requestAnimationFrame(()=>{n&&(n.scrollTop=e,setTimeout(()=>{H.current=!1,O(!1)},200))})}))}},[k,t,n,K]);return m(()=>{G(V.visibleItems)},[V.visibleItems,G]),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(k.length-1,t+e-1),r={};for(let e=t;e<=a;e++){const t=k[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),M(o),null==n||n(t,o),K(e,!0)}}$.current=e},[e,n,K,V,k,d]),m(()=>{const e=Y.current;if(!e)return;const t=new ResizeObserver(([e])=>{b(e.contentRect.height)});return t.observe(e),()=>t.disconnect()},[]),y(()=>{const e=Y.current;e&&!P&&o&&(u>0&&(e.scrollTop=u),L(!0))},[P,u,o]),m(()=>{var e;if(!l||S||x||!P)return;const n=Math.floor(h/t),a=Math.min(k.length-1,n+5),r={};for(let t=n;t<=a;t++)null===(e=k[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=k.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)}},[S,l,x,P,h,t,k,K]),m(()=>()=>{j.current&&clearTimeout(j.current)},[]),{scrollTop:h,containerHeight:w,currentMonth:E,currentYear:T,isScrolling:S,isNavigating:x,virtualData:V,scrollElementRef:Y,handleScroll:q,scrollToDate:K,handlePreviousMonth:X,handleNextMonth:J,handleToday:Q,setScrollTop:D,setContainerHeight:b,setCurrentMonth:C,setCurrentYear:M,setIsScrolling:N,cache:Z.current,scrollElementRefCallback:z,weeksData:k}})({currentDate:b,weekHeight:q,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:X,snapToMonth:t.snapToMonth}),je=v(0),[Ze,Fe]=g(0),_e=p(()=>Ze-6*q,[Ze,q]),{visibleWeeks:We,startIndex:ze}=p(()=>{var e,t;const{visibleItems:n,displayStartIndex:a}=ke,r=n.findIndex(e=>e.index===a);if(-1===r)return ee.current.length>0?{visibleWeeks:ee.current,startIndex:je.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&&(ee.current=o,je.current=l),{visibleWeeks:o,startIndex:l}},[ke]),Ue=p(()=>ze*q,[ze,q]),Be=v(!0),Ve=v(!1),Ge=(e=>{const[t,n]=g(e);return m(()=>{const t=setTimeout(()=>{n(e)},250);return()=>{clearTimeout(t)}},[e,250]),t})(ke.displayStartIndex);m(()=>{Ae&&(Ve.current=!0)},[Ae]),m(()=>{if(Be.current)return void(Be.current=!1);const t=xe[Ge];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,Ve.current?"navigation":"scroll"),Ve.current=!1},[e,xe,Ge]);const qe=p(()=>{const e=ke.totalHeight,t=ze*q+We.length*q+_e;return Math.max(0,e-t)},[ke.totalHeight,ze,q,_e,We.length]);m(()=>{const e=Re.current;if(!e)return;const t=new ResizeObserver(t=>{for(const n of t){const t=n.contentRect.height;if(Fe(t),t>0){const n=Math.max(80,Math.ceil(t/6));if(n!==Q.current){const t=e.scrollTop;if(t>0){const a=Math.round(t/Q.current)*n;e.scrollTop=a,Ye(a)}K(n),Q.current=n}}}});return t.observe(e),()=>{t.disconnect()}},[Re,Ye]),y(()=>{const e=window.innerHeight-150,t=Math.max(80,Math.ceil(e/6));K(t),Q.current=t,J(!0)},[]),m(()=>{if(S||!M)return;const e=Re.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)}},[S,M,Re]);const Ke=f(t=>e.updateEvent(t.id,t),[e]),Xe=f(t=>e.deleteEvent(t),[e]),Je=t=>{e.changeView(t)},Qe=f(()=>ne(null),[]),et=f(t=>{const n=e.getReadOnlyConfig().viewable;if(("desktop"!==B||V)&&t&&n){const n=z.find(e=>e.id===t);if(n)return void e.onMobileEventDetailToggle(n)}de(t)},[B,V,z,de,e]),tt=f(e=>{("desktop"!==B||V)&&de(e)},[B,V,de]),nt=f((n,a)=>{const r=null==t?void 0:t.gridDateClick;r?"function"!=typeof r?"week-view"===r?(e.setCurrentDate(n),e.changeView(x.WEEK)):"day-view"===r&&(e.setCurrentDate(n),e.changeView(x.DAY)):r(n,a):e.selectDate(n)},[t.gridDateClick,e]),at=f((n,a,r)=>{var i;const o=null!==(i=null==t?void 0:t.gridDateDoubleClick)&&void 0!==i?i:"week-view";"function"!=typeof o?"week-view"===o?(e.setCurrentDate(a),e.changeView(x.WEEK)):"day-view"===o&&(e.setCurrentDate(a),e.changeView(x.DAY)):o(a,r)},[t.gridDateDoubleClick,e]);return Wt("div",{className:Ln,children:[Wt(Si,{calendar:e,viewType:x.MONTH,currentDate:b,customTitle:(()=>{const e=w.startsWith("zh")||w.startsWith("ja");if(S){const t=D(w,e?"short":"long")[N.getMonth()],n=N.getFullYear();return e?`${n}年${t}`:`${t} ${n}`}return e?`${Me}年${Te}`:`${Te} ${Me}`})(),onPrevious:()=>{e.goToPrevious(),S||Pe()},onNext:()=>{e.goToNext(),S||Le()},onToday:()=>{e.goToToday(),S||$e()}}),Wt("div",{className:"df-week-header-row",onContextMenu:e=>e.preventDefault(),children:Wt("div",{className:"df-week-grid",children:be.map((e,t)=>Wt("div",{className:"df-day-label",children:e},`${e}-${t}`))})}),Wt("div",S?{ref:Re,className:`${Zn} df-month-view-fade-scroller`,"data-layout-ready":X?"true":"false",children:Wt("div",{className:"df-month-view-fade-body",style:F,children:Z.map((n,i)=>{const o=Ce(n.startDate),l={index:i,weekData:n,top:i*q,height:q},s=5===i?Object.assign(Object.assign({},l),{height:l.height+_e}):l;return Wt(Fo,{item:s,weekHeight:q,showWeekNumbers:t.showWeekNumbers,showMonthIndicator:!1,currentMonth:"",currentYear:0,screenSize:B,isScrolling:!1,calendarRef:r,events:o,onEventUpdate:Ke,onEventDelete:Xe,onMoveStart:ge,onCreateStart:me,onResizeStart:ve,isDragging:pe,dragState:ye,newlyCreatedEventId:te,onDetailPanelOpen:Qe,onMoreEventsClick:e.onMoreEventsClick,onChangeView:Je,onSelectDate:e.selectDate,onGridDateClick:nt,onGridDateDoubleClick:at,selectedEventId:le,onEventSelect:et,onEventLongPress:tt,detailPanelEventId:se,onDetailPanelToggle:ce,useEventDetailPanel:a,onCalendarDrop:De,onCalendarDragOver:we,calendarSignature:_,app:e,enableTouch:V,appTimeZone:T},`week-${n.startDate.getTime()}`)})})}:{ref:Re,className:`${Zn} df-month-view-virtual-scroller`,"data-layout-ready":X?"true":"false",onScroll:He,children:[Wt("div",{style:{height:Ue}}),We.map((n,i)=>{const o=Ce(n.weekData.startDate),l=5===i?Object.assign(Object.assign({},n),{height:n.height+_e}):n,s=!(!1===t.showMonthIndicator||!n.weekData.days.some(e=>1===e.day))&&Se;return Wt(Fo,{item:l,weekHeight:q,showWeekNumbers:t.showWeekNumbers,showMonthIndicator:t.showMonthIndicator,currentMonth:Te,currentYear:Me,screenSize:B,isScrolling:s,calendarRef:r,events:o,onEventUpdate:Ke,onEventDelete:Xe,onMoveStart:ge,onCreateStart:me,onResizeStart:ve,isDragging:pe,dragState:ye,newlyCreatedEventId:te,onDetailPanelOpen:Qe,onMoreEventsClick:e.onMoreEventsClick,onChangeView:Je,onSelectDate:e.selectDate,onGridDateClick:nt,onGridDateDoubleClick:at,selectedEventId:le,onEventSelect:et,onEventLongPress:tt,detailPanelEventId:se,onDetailPanelToggle:ce,useEventDetailPanel:a,onCalendarDrop:De,onCalendarDragOver:we,calendarSignature:_,app:e,enableTouch:V,appTimeZone:T},`week-${n.weekData.startDate.getTime()}`)}),Wt("div",{style:{height:qe}})]})]})},Uo={showWeekNumbers:!1,showMonthIndicator:!0,startOfWeek:1},Bo=e=>o(No,Object.assign(Object.assign({},e),{viewType:x.MONTH,originalComponent:zo,className:"df-month-view-factory"}));Bo.displayName="MonthViewAdapter";const Vo=(e={})=>{const t=Object.assign(Object.assign({},Uo),e);return{type:x.MONTH,component:Bo,config:t}},Go=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t},qo=(e,t)=>{const n=new Date(e);return n.setDate(n.getDate()+t),n},Ko=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),Xo=(e,t)=>{const n=Ne(e.start,t),a=e.end?Ne(e.end,t):n,r=Go(n),i=Go(a);let o=new Date(i);var l;return e.allDay||Ko(r,i)||0!==(l=a).getHours()||0!==l.getMinutes()||0!==l.getSeconds()||0!==l.getMilliseconds()||(o=qo(o,-1)),o<r&&(o=new Date(r)),{start:n,end:a,startDay:r,effectiveEndDay:o}},Jo=(e,t,n,a)=>{const{start:r,end:i,startDay:o,effectiveEndDay:l}=Xo(e,n),s=l.getTime()>o.getTime();return e.allDay?{timeLabel:"All day",renderAsBadge:!0,sortMs:t.getTime()-864e5}:s?Ko(t,o)?{timeLabel:`Starts ${Ze(r.getHours(),r.getMinutes(),a)}`,renderAsBadge:!0,sortMs:r.getTime()}:Ko(t,l)?{timeLabel:`Ends ${Ze(i.getHours(),i.getMinutes(),a)}`,renderAsBadge:!1,sortMs:t.getTime()}:{timeLabel:"All day",renderAsBadge:!0,sortMs:t.getTime()-432e5}:{timeLabel:`${Ze(r.getHours(),r.getMinutes(),a)} - ${Ze(i.getHours(),i.getMinutes(),a)}`,renderAsBadge:!1,sortMs:r.getTime()}},Qo=({app:e,config:t,useEventDetailPanel:n,calendarRef:a,selectedEventId:r,detailPanelEventId:o,onEventSelect:l,onDetailPanelToggle:s})=>{var d,c,u;const{locale:h}=Pn(),{screenSize:y}=An(),w="desktop"!==y,b=D(Fa),E=e.getCurrentDate(),C=e.getEvents(),T=Number.isFinite(t.daysToShow)&&(null!==(d=t.daysToShow)&&void 0!==d?d:0)>0?Math.floor(t.daysToShow):14,M=!1!==t.showEmptyDays,S=null!==(c=t.timeFormat)&&void 0!==c?c:"24h",N=p(()=>Go(E),[E]),k=p(()=>qo(N,T),[T,N]),I=p(()=>((e,t,n,a,r,i)=>{const o=e.getCalendarRegistry(),l=e.timeZone,s=[];for(let d=0;d<a;d+=1){const a=qo(n,d),c=Go(a),u=qo(c,1),h=t.filter(e=>{const{startDay:t,effectiveEndDay:n}=Xo(e,l);return t<u&&n>=c}).map(e=>{const{startDay:t,effectiveEndDay:n}=Xo(e,l),{timeLabel:a,renderAsBadge:r,sortMs:s}=Jo(e,c,l,i),d=ge(e),u=!0===e.allDay&&n.getTime()>t.getTime();return{event:e,timeLabel:a,sortMs:s,renderAsBadge:r,isAllDay:!0===e.allDay,isMultiDayAllDay:u,continuesFromPreviousDay:u&&!Ko(c,t),continuesToNextDay:u&&!Ko(c,n),color:he(d,o),backgroundColor:de(d,o),textColor:ce(d,o)}}),g=h.filter(e=>e.isAllDay).toSorted((t,n)=>{if(t.isMultiDayAllDay!==n.isMultiDayAllDay)return t.isMultiDayAllDay?-1:1;const a=In(t.event,n.event,e.state.allDaySortComparator);return 0!==a?a:t.event.title.localeCompare(n.event.title)}),m=h.filter(e=>!e.isAllDay).toSorted((e,t)=>e.renderAsBadge!==t.renderAsBadge?e.renderAsBadge?-1:1:e.sortMs!==t.sortMs?e.sortMs-t.sortMs:e.event.title.localeCompare(t.event.title));(r||g.length>0||m.length>0)&&s.push({date:c,allDayEntries:g,timedEntries:m})}return s})(e,C,N,T,M,S),[e,T,C,N,M,S]),x=p(()=>((e,t,n)=>{const a=qo(t,-1),r=e.getFullYear()===a.getFullYear();return r&&e.getMonth()===a.getMonth()?`${e.toLocaleDateString(n,{month:"long"})} ${e.getDate()} - ${a.getDate()}, ${e.getFullYear()}`:r?`${e.toLocaleDateString(n,{month:"short",day:"numeric"})} - ${a.toLocaleDateString(n,{month:"short",day:"numeric"})}, ${e.getFullYear()}`:`${e.toLocaleDateString(n,{month:"short",day:"numeric",year:"numeric"})} - ${a.toLocaleDateString(n,{month:"short",day:"numeric",year:"numeric"})}`})(N,k,h),[h,k,N]),O=p(()=>Ve(e.timeZone),[e.timeZone]),R=v(null),A=v(null),H=v(null),[P,L]=g(null);m(()=>()=>{R.current&&clearTimeout(R.current)},[]),m(()=>{o||L(null)},[o]),m(()=>{if(!o||!P)return;const e=e=>{var t,n,a,r;const i=e.target,d=null!==(n=null===(t=H.current)||void 0===t?void 0:t.contains(i))&&void 0!==n&&n,c=null!==i.closest(`[data-event-id="${o.split("::")[0]}"]`),u=null!==(r=null===(a=A.current)||void 0===a?void 0:a.contains(i))&&void 0!==r&&r,h=i.closest("[data-event-detail-dialog]"),g=i.closest("[data-range-picker-popup]"),m=i.closest("[data-calendar-picker-dropdown]");d||c||u||h||g||m||(L(null),null==s||s(null),null==l||l(null))};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[o,P,s,l]);const $=f(t=>{if(R.current&&(clearTimeout(R.current),R.current=null),w)return e.onEventClick(t),null==l||l(t.id),void(!1!==e.getReadOnlyConfig(t.id).viewable&&(null==s||s(t.id)));R.current=setTimeout(()=>{e.onEventClick(t),null==l||l(t.id),!1!==n&&(null==s||s(null)),R.current=null},180)},[e,w,s,l,n]),Y=f((t,a)=>{R.current&&(clearTimeout(R.current),R.current=null),null==l||l(null),H.current=a.currentTarget,Promise.resolve(e.onEventDoubleClick(t,a)).then(a=>{if(!1!==a&&!1!==e.getReadOnlyConfig(t.id).viewable){const a=H.current;if(a&&!1!==n&&!e.getUseEventDetailDialog()){const e=a.getBoundingClientRect(),t=320,n=12,r=16,i=window.innerHeight,o=window.innerWidth,l=e.right+n+t>o-r,s=l?Math.max(r,e.left-t-n):Math.min(o-t-r,e.right+n),d=Math.min(Math.max(r,e.top+e.height/2-180),i-380);L({top:d,left:s,eventHeight:e.height,eventMiddleY:e.top+e.height/2,isSunday:l})}null==s||s(t.id)}}).catch(()=>{if(!1!==e.getReadOnlyConfig(t.id).viewable){const a=H.current;if(a&&!1!==n&&!e.getUseEventDetailDialog()){const e=a.getBoundingClientRect(),t=320,n=12,r=16,i=window.innerHeight,o=window.innerWidth,l=e.right+n+t>o-r,s=l?Math.max(r,e.left-t-n):Math.min(o-t-r,e.right+n),d=Math.min(Math.max(r,e.top+e.height/2-180),i-380);L({top:d,left:s,eventHeight:e.height,eventMiddleY:e.top+e.height/2,isSunday:l})}null==s||s(t.id)}})},[e,s,l,n]),j=f((n,a)=>{const r=null==t?void 0:t.gridDateClick;r&&("function"!=typeof r?"day-view"===r&&(e.setCurrentDate(n),e.changeView("day")):r(n,a))},[e,null==t?void 0:t.gridDateClick]),Z=f((n,a)=>{var r;const i=null!==(r=null==t?void 0:t.gridDateDoubleClick)&&void 0!==r?r:"day-view";"function"!=typeof i?"day-view"===i&&(e.setCurrentDate(n),e.changeView("day")):i(n,a)},[e,null==t?void 0:t.gridDateDoubleClick]),F=e=>Wt("button",{type:"button",className:"df-agenda-event","data-selected":r===e.event.id?"true":"false",onClick:t=>{t.stopPropagation(),$(e.event)},onDblClick:t=>{t.stopPropagation(),Y(e.event,t)},children:[e.renderAsBadge?Wt("span",{className:"df-agenda-badge","data-continued-left":e.continuesFromPreviousDay?"true":"false","data-continued-right":e.continuesToNextDay?"true":"false",style:{backgroundColor:e.backgroundColor,color:e.textColor},children:e.event.title}):Wt("span",{className:"df-agenda-dot",style:{backgroundColor:e.color}}),!e.renderAsBadge&&Wt("span",{className:"df-agenda-title",children:e.event.title})]}),_=P&&o&&null!==(u=C.find(e=>e.id===o.split("::")[0]))&&void 0!==u?u:null,W=f(e=>Wt(Wa,{store:b,generatorName:"eventDetailContent",generatorArgs:e}),[b]);return Wt("div",{className:"df-agenda-view",children:[Wt(Si,{calendar:e,viewType:"month",currentDate:N,customTitle:x,onPrevious:()=>e.goToPrevious(),onNext:()=>e.goToNext(),onToday:()=>e.goToToday()}),Wt("div",{className:"df-agenda-scroll",children:0===I.length?Wt("div",{className:"df-agenda-empty",children:"No events in this range."}):I.map(e=>Wt("section",{className:"df-agenda-day-section","data-today":Ko(e.date,O)?"true":"false",onClick:()=>j(e.date,[...e.allDayEntries.map(e=>e.event),...e.timedEntries.map(e=>e.event)]),onDblClick:()=>Z(e.date,[...e.allDayEntries.map(e=>e.event),...e.timedEntries.map(e=>e.event)]),children:[Wt("div",{className:"df-agenda-day-rail",children:[Wt("div",{className:"df-agenda-day-number","data-today":Ko(e.date,O)?"true":"false",children:e.date.getDate()}),Wt("div",{className:"df-agenda-day-meta",children:[Wt("div",{className:"df-agenda-day-month",children:e.date.toLocaleDateString(h,{month:"short",year:"numeric"})}),Wt("div",{className:"df-agenda-day-name",children:e.date.toLocaleDateString(h,{weekday:"long"})})]})]}),Wt("div",{className:"df-agenda-day-content",children:0===e.allDayEntries.length&&0===e.timedEntries.length?Wt("div",{className:"df-agenda-empty-row",children:"No events"}):Wt(i,{children:[e.allDayEntries.length>0&&Wt("div",{className:"df-agenda-item df-agenda-item-all-day",children:[Wt("div",{className:"df-agenda-time",children:"All day"}),Wt("div",{className:"df-agenda-all-day-events",children:e.allDayEntries.map(t=>Wt("div",{className:"df-agenda-all-day-event",children:F(t)},`${e.date.toISOString()}-${t.event.id}`))})]}),e.timedEntries.map(t=>Wt("div",{className:"df-agenda-item",children:[Wt("div",{className:"df-agenda-time",children:t.timeLabel}),F(t)]},`${e.date.toISOString()}-${t.event.id}`))]})})]},e.date.toISOString()))}),_&&!1!==n&&!e.getUseEventDetailDialog()&&Wt(i,{children:[Wt("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:9998,pointerEvents:"none"}}),Wt(Ei,{showDetailPanel:!0,detailPanelPosition:P,event:_,detailPanelRef:A,isAllDay:!0===_.allDay,eventVisibility:"standard",calendarRef:a,selectedEventElementRef:H,onEventUpdate:t=>e.updateEvent(t.id,t),onEventDelete:t=>e.deleteEvent(t),handlePanelClose:()=>{L(null),null==s||s(null),null==l||l(null)},customRenderingStore:b,contentSlotRenderer:W,app:e})]})]})},el={daysToShow:14,showEmptyDays:!0,timeFormat:"24h"},tl=e=>o(No,Object.assign(Object.assign({},e),{viewType:x.AGENDA,originalComponent:Qo,className:"df-agenda-view-factory"}));tl.displayName="AgendaViewAdapter";const nl=(e={})=>{const t=Object.assign(Object.assign({},el),e);return{type:x.AGENDA,label:"Agenda",component:tl,config:t}},al=new WeakMap,rl=(e,t)=>{const n=null!=t?t:"";let a=al.get(e);if(a){const e=a.get(n);if(e)return e}const r=Ne(e.start,t),i=e.end?Ne(e.end,t):r,o=r.getFullYear(),l=r.getMonth(),s=r.getDate(),d=i.getFullYear(),c=i.getMonth(),u=i.getDate(),h={startMs:new Date(o,l,s).getTime(),endMs:new Date(d,c,u).getTime(),endMsEod:new Date(d,c,u,23,59,59,999).getTime(),startYear:o,startMonth:l,startDate:s,endYear:d,endMonth:c,endDate:u};return a||(a=new Map,al.set(e,a)),a.set(n,h),h},il=(e,t,n)=>{const a=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime(),r=new Date(t.getFullYear(),t.getMonth(),t.getDate(),23,59,59,999).getTime();return e.filter(e=>{if(!e.start)return!1;const t=rl(e,n);return t.startMs<=r&&t.endMsEod>=a})};function ol(e,t){const n=[];for(let a=0;a<e.length;a+=t)n.push(e.slice(a,a+t));return n}function ll(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=[];for(let t=0;t<e.length;t++){const n=e[t],a=rl(n,r);a.startMs<=s&&a.endMs>=l&&d.push({event:n,startMs:a.startMs,endMs:a.endMs})}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 sl=(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=rl(e,a);return o.startMs<=i&&o.endMsEod>=r},dl=(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};function cl(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=[];for(let t=0;t<e.length;t++){const n=e[t];if(!n.start)continue;const a=rl(n,r);a.startMs<=d&&a.endMs>=s&&c.push({event:n,startMs:a.startMs,endMs:a.endMs,range:a})}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,range:i})=>{const o=Math.max(a,s),c=Math.min(r,d),u=new Date(o).getDate(),m=new Date(c).getDate(),v=l+(u-1),f=l+(m-1),p=i.startMonth===t&&i.startYear===n,y=i.endMonth===t&&i.endYear===n;let D=0;for(;;){g[D]||(g[D]=[]);let e=!1;for(let t=v;t<=f;t++)if(g[D][t]){e=!0;break}if(!e){for(let e=v;e<=f;e++)g[D][e]=!0;break}D++}h.push({id:`${e.id}::month-${t}`,event:e,startCellIndex:v,endCellIndex:f,isFirstSegment:p,isLastSegment:y,visualRowIndex:D,monthIndex:t})});const m=h.length>0?Math.max(...h.map(e=>e.visualRowIndex)):-1;return{segments:h,maxVisualRow:m}}let ul=null;const hl=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},gl=({currentYear:e,locale:t,totalColumns:n,yearEvents:a,startOfWeek:r,appTimeZone:i})=>{const o=`${e}|${r}|${n}|${null!=i?i:""}`;ul&&ul.contextKey===o||(ul={contextKey:o,perMonth:new Map});const l=ul.perMonth,s=Array.from({length:12}),d=Array.from({length:12});for(let t=0;t<12;t++)s[t]=new Date(e,t,1).getTime(),d[t]=new Date(e,t+1,0,23,59,59,999).getTime();const c=Array.from({length:12},()=>[]);for(let e=0;e<a.length;e++){const t=a[e];if(!t.start)continue;const n=rl(t,i);for(let e=0;e<12;e++)if(!(n.startMs>d[e])){if(n.endMsEod<s[e])break;c[e].push(t)}}const u=[];for(let a=0;a<12;a++){const o=new Date(e,a,1),s=new Date(e,a+1,0).getDate(),d=(o.getDay()-r+7)%7,h=[];for(let e=0;e<d;e++)h.push(null);for(let t=1;t<=s;t++)h.push(new Date(e,a,t));for(;h.length<n;)h.push(null);const g=o.toLocaleDateString(t,{month:"short"}),m=g.charAt(0).toUpperCase()+g.slice(1).toLowerCase(),v=c[a];let f;const p=l.get(a);p&&hl(p.sources,v)?f=p.result:(f=cl(v,a,e,r,i),l.set(a,{sources:v,result:f}));const{segments:y,maxVisualRow:D}=f,w=D+1,b=Math.max(60,20+18*w);u.push({monthIndex:a,monthName:m,days:h,monthEvents:v,eventSegments:y,minHeight:b})}return u},ml=h(({date:e,isToday:t,locale:n,onSelectDate:a,onCreateStart:r,onMoreEventsClick:i,moreCount:o=0,onContextMenu:l})=>{const{t:s}=Pn(),d=e.getDate(),c=1===d,u=e.toLocaleDateString(n,{month:"short"}).toUpperCase();return Wt("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:[Wt("div",{className:"df-year-day-cell-header",children:[c&&Wt("span",{className:"df-year-day-cell-month-pill",children:u}),Wt("span",{className:"df-year-day-cell-date","data-today":t?"true":"false",children:d})]}),o>0&&Wt("div",{className:"df-year-day-cell-more-wrap",children:Wt("span",{className:"df-year-day-cell-more",onClick:t=>{t.stopPropagation(),null==i||i(e)},children:["+",o," ",s("more")]})})]})});ml.displayName="YearDayCell";const vl=(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=rl(e,n);return l.startMs<=o&&l.endMsEod>=i},fl=h(({rowDays:e,events:t,columnsPerRow:n,app:a,calendarRef:r,locale:i,isDragging:o,dragState:l,onMoveStart:s,onResizeStart:d,onSelectDate:c,onCreateStart:u,selectedEventId:h,onEventSelect:g,onMoreEventsClick:m,newlyCreatedEventId:v,onDetailPanelOpen:y,detailPanelEventId:D,onDetailPanelToggle:w,useEventDetailPanel:b,onContextMenu:E,appTimeZone:C,dragPreviewEvent:T})=>{const M=p(()=>{const e=Ve(C);return e.setHours(0,0,0,0),e},[C]),S=f((e,t)=>{e.preventDefault(),e.stopPropagation(),E({x:e.clientX,y:e.clientY,date:t})},[E]),N=f(e=>a.updateEvent(e.id,e),[a]),k=f(e=>a.deleteEvent(e),[a]),I=p(()=>ll(t,e,n,a.state.allDaySortComparator,C),[t,e,n,a.state.allDaySortComparator,C]),O=o&&"move"===l.mode&&!!T&&T.id===l.eventId,R=p(()=>{if(!T)return I;if(O)return I;const r=t.filter(e=>e.id!==T.id);return vl(T,e,C)&&r.push(T),ll(r,e,n,a.state.allDaySortComparator,C)},[T,O,I,t,e,n,a.state.allDaySortComparator,C]),A=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=rl(e,a);if(s.startMs>l||s.endMs<o)return null;let d=Math.round((Math.max(s.startMs,o)-o)/864e5),c=Math.round((Math.min(s.endMs,l)-o)/864e5);return d=Math.max(0,Math.min(d,n-1)),c=Math.max(0,Math.min(c,n-1)),{id:`${e.id}::preview-year-${o}`,event:e,startCellIndex:d,endCellIndex:c,isFirstSegment:s.startMs>=o,isLastSegment:s.endMs<=l,visualRowIndex:0}})(T,e,n,C):null,[O,T,e,n,C]),{visibleSegments:H,moreCounts:P}=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 A?[...e,A]:e},[O,l.eventId,R,A]);return Wt("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 Wt(ml,{date:e,isToday:n,locale:i,onSelectDate:c,onCreateStart:u,onMoreEventsClick:m,moreCount:P[t],onContextMenu:S},e.getTime())}),Wt("div",{className:"df-year-row-event-layer",style:{top:26,bottom:0,left:0,right:0},onContextMenu:e=>e.preventDefault(),children:Wt("div",{className:"df-year-row-event-layer-inner",children:(O&&l.eventId?L.filter(e=>H.some(t=>t.id===e.id)||e.id===(null==A?void 0:A.id)):H).map(e=>Wt("div",{className:"df-year-row-event-hitbox",children:Wt(Ti,{event:e.event,isAllDay:!!e.event.allDay,viewType:x.YEAR,yearSegment:e,columnsPerRow:n,isBeingDragged:o&&l.eventId===e.event.id,selectedEventId:h,onMoveStart:s,onResizeStart:d,onEventSelect:g,onDetailPanelToggle:w,newlyCreatedEventId:v,onDetailPanelOpen:y,calendarRef:r,app:a,detailPanelEventId:D,useEventDetailPanel:b,firstHour:0,hourHeight:0,onEventUpdate:N,onEventDelete:k,appTimeZone:C})},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=vl(e.dragPreviewEvent,e.rowDays,e.appTimeZone),s=vl(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.onSelectDate===t.onSelectDate&&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.useEventDetailPanel===t.useEventDetailPanel&&e.onContextMenu===t.onContextMenu&&e.appTimeZone===t.appTimeZone});fl.displayName="YearRowComponent";const pl=({app:e,calendarRef:t,useEventDetailPanel:a,config:r,selectedEventId:i,onEventSelect:o,detailPanelEventId:l,onDetailPanelToggle:s})=>{var d;const{t:c,locale:u}=Pn(),h=e.getCurrentDate(),D=h.getFullYear(),w=e.getEvents(),b=e.timeZone,E=v(null),C=v([]),[T,M]=g(7),[S,N]=g(!1),[k,I]=g(()=>"undefined"!=typeof window&&window.innerWidth<768),[O,R]=g(null),[A,H]=g(null),P=void 0===i?O:i,L=void 0===l?A:l,[$,Y]=g(null),j=f(e=>{o?o(e):R(e)},[o]),Z=f(e=>{s?s(e):H(e)},[s]),F=f(()=>{Y(null)},[]),[_,W]=g(null),z=e.canMutateFromUI(),U=f(e=>{z&&W(e)},[z]);m(()=>{z||W(null)},[z]),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||(j(null),Z(null),W(null))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const B=v(null);y(()=>{const e=E.current;if(!e)return;const t=e=>{if(e<=0)return;const t=Math.max(1,Math.floor(e/80));M(t),I(e<768),N(!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?(j(e.state.highlightedEventId),requestAnimationFrame(()=>{const t=E.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&&j(null),V.current=e.state.highlightedEventId},[e.state.highlightedEventId]);const{handleMoveStart:G,handleResizeStart:q,handleCreateStart:K,dragState:X,isDragging:J}=Mo(e,{calendarRef:t,viewType:x.YEAR,onEventsUpdate:(t,n,a)=>{const r=t(w),i=new Map(w.map(e=>[e.id,e])),o=r.filter(e=>{const t=i.get(e.id);return void 0!==t&&t!==e&&Tt(t,e)});o.length>0&&e.applyEventsChanges({update:o.map(e=>({id:e.id,updates:e}))},n,a)},currentWeekStart:new Date,events:w,onEventCreate:t=>{e.addEvent(t)},onEventEdit:e=>{Y(e.id)},isMobile:k}),Q=X,ee=null!==(d=null==r?void 0:r.showTimedEventsInYearView)&&void 0!==d&&d,te=f(e=>il(w,e,b),[w,b]),ne=f(t=>{const n=null==r?void 0:r.gridDateClick;if("function"!=typeof n)return"day-view"===n?(e.setCurrentDate(t),void e.changeView(x.DAY)):void("none"!==n&&e.selectDate(t));n(t,te(t))},[null==r?void 0:r.gridDateClick,te,e]),ae=f((t,a)=>{const i=null==r?void 0:r.gridDateDoubleClick;if("function"!=typeof i){if("day-view"===i)return e.setCurrentDate(a),void e.changeView(x.DAY);if("none"!==i)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:c("newEvent")||"New Event",start:t,end:t,allDay:!0,calendarId:e.getCalendarRegistry().getDefaultCalendarId()||"default"};e.addEvent(r),Y(r.id)}}else i(a,te(a))},[null==r?void 0:r.gridDateDoubleClick,te,ee,K,e,c]),re=p(()=>{const e=[],t=new Date(D,0,1),n=new Date(D,11,31);for(let a=t.getTime();a<=n.getTime();a+=864e5)e.push(new Date(a));return e},[D]),ie=p(()=>ol(re,T),[re,T]),oe=p(()=>{const e=new Date(D,0,1).getTime(),t=new Date(D,11,31,23,59,59).getTime(),n=[];for(let a=0;a<w.length;a++){const r=w[a];if(!r.start)continue;if(!ee&&!r.allDay)continue;const i=rl(r,b);i.startMs<=t&&i.endMsEod>=e&&n.push(r)}return n},[w,D,ee,b]),le=p(()=>{const e=ie.map(e=>{if(0===e.length)return null;const t=e[0],n=e.at(-1);return t&&n?{rowStartMs:new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime(),rowEndMs:new Date(n.getFullYear(),n.getMonth(),n.getDate(),23,59,59,999).getTime()}:null}),t=ie.map(()=>[]);for(let n=0;n<oe.length;n++){const a=oe[n],r=rl(a,b);for(let n=0;n<e.length;n++){const i=e[n];if(i&&!(r.startMs>i.rowEndMs)){if(r.endMsEod<i.rowStartMs)break;t[n].push(a)}}}const n=C.current,a=t.map((e,t)=>{const a=n[t];return a&&a.length===e.length&&e.every((e,t)=>e===a[t])?a:e});return C.current=a,a},[ie,oe,b]),se=p(()=>{if(!J||!Q.eventId||!Q.startDate||!Q.endDate||"move"!==Q.mode&&"resize"!==Q.mode)return null;const e=oe.find(e=>e.id===Q.eventId);return e?Object.assign(Object.assign({},e),{start:e.allDay?Ie(Q.startDate):Oe(Q.startDate,b),end:e.allDay?Ie(Q.endDate):Oe(Q.endDate,b)}):null},[J,Q.eventId,Q.startDate,Q.endDate,Q.mode,oe,b]);return Wt("div",{className:Ln,onContextMenu:e=>e.preventDefault(),children:[Wt(Si,{calendar:e,viewType:x.YEAR,currentDate:h,customTitle:u.startsWith("zh")||u.startsWith("ja")?`${D}年`:`${D}`,onPrevious:()=>{const t=new Date(h);t.setFullYear(t.getFullYear()-1),e.setCurrentDate(t)},onNext:()=>{const t=new Date(h);t.setFullYear(t.getFullYear()+1),e.setCurrentDate(t)},onToday:()=>{e.goToToday()}}),Wt("div",{ref:E,className:`df-year-default-scroll ${Zn} df-scrollbar-hide`,children:Wt("div",{className:"df-year-default-rows",style:{opacity:S?1:0,transition:"opacity 0.2s ease"},children:ie.map((n,r)=>Wt(fl,{rowDays:n,events:le[r],columnsPerRow:T,app:e,calendarRef:t,locale:u,isDragging:J,dragState:Q,dragPreviewEvent:se,onMoveStart:G,onResizeStart:q,onSelectDate:ne,onCreateStart:ae,selectedEventId:P,onEventSelect:j,onMoreEventsClick:e.onMoreEventsClick,newlyCreatedEventId:$,onDetailPanelOpen:F,detailPanelEventId:L,onDetailPanelToggle:Z,useEventDetailPanel:a,onContextMenu:U,appTimeZone:b},r))})}),z&&_&&Wt(Qr,{x:_.x,y:_.y,date:_.date,viewType:x.YEAR,onClose:()=>W(null),app:e,onCreateEvent:()=>{if(_&&_.date){const e={preventDefault:()=>{},stopPropagation:()=>{},clientX:_.x,clientY:_.y};ae(e,_.date)}}})]})},yl=h(({monthData:e,currentYear:t,startOfWeek:n,totalColumns:a,app:r,calendarRef:i,isDragging:o,dragState:l,dragPreviewEvent:s,selectedEventId:d,onMoveStart:c,onResizeStart:u,onSelectDate:h,onCreateStart:g,onEventSelect:m,newlyCreatedEventId:v,onDetailPanelOpen:y,detailPanelEventId:D,onDetailPanelToggle:w,customDetailPanelContent:b,customEventDetailDialog:E,useEventDetailPanel:C,onContextMenu:T,appTimeZone:M})=>{const S=p(()=>{const e=Ve(M);return e.setHours(0,0,0,0),e},[M]),N=f(e=>r.updateEvent(e.id,e),[r]),k=f(e=>r.deleteEvent(e),[r]),I=o&&"move"===l.mode&&!!s&&s.id===l.eventId,O=p(()=>I?((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=rl(e,r);if(c.startMs>d||c.endMs<s)return null;const u=Math.max(c.startMs,s),h=Math.min(c.endMs,d);return{id:`${e.id}::preview-month-${t}`,event:e,startCellIndex:l+(new Date(u).getDate()-1),endCellIndex:l+(new Date(h).getDate()-1),isFirstSegment:c.startMonth===t&&c.startYear===n,isLastSegment:c.endMonth===t&&c.endYear===n,visualRowIndex:0,monthIndex:t}})(s,e.monthIndex,t,n,M):null,[I,s,e.monthIndex,t,n,M]),R=p(()=>{if(!I||!l.eventId)return e.eventSegments;const t=e.eventSegments.filter(e=>e.event.id!==l.eventId);return O?[...t,O]:t},[I,l.eventId,e.eventSegments,O]);return Wt("div",{className:"df-year-fixed-month-row",style:{minHeight:`${e.minHeight}px`,transition:"min-height 180ms cubic-bezier(0.22, 1, 0.36, 1)"},children:[Wt("div",{className:"df-year-fixed-background-grid",style:{gridTemplateColumns:`repeat(${a}, minmax(0, 1fr))`},children:e.days.map((t,a)=>{const r=(a+n)%7,i=0===r||6===r;if(!t)return Wt("div",{className:"df-year-fixed-empty-cell","data-weekend":i?"true":"false"},`empty-${e.monthIndex}-${a}`);const l=t.getTime()===S.getTime();return Wt("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":o?"true":"false","data-weekend":i?"true":"false",onClick:()=>h(t),onDblClick:e=>null==g?void 0:g(e,t),onContextMenu:e=>T(e,t),children:Wt("span",{className:"df-year-fixed-day-number","data-today":l?"true":"false",children:t.getDate()})},t.getTime())})}),R.length>0&&Wt("div",{className:"df-year-fixed-event-layer",style:{top:20},children:Wt("div",{className:"df-year-fixed-event-layer-inner",children:R.map(e=>Wt("div",{className:"df-year-fixed-event-hitbox",children:Wt(Ti,{event:e.event,isAllDay:!!e.event.allDay,viewType:x.YEAR,yearSegment:e,columnsPerRow:a,isBeingDragged:o&&l.eventId===e.event.id,selectedEventId:d,onMoveStart:c,onResizeStart:u,onEventSelect:m,onDetailPanelToggle:w,newlyCreatedEventId:v,onDetailPanelOpen:y,calendarRef:i,app:r,detailPanelEventId:D,useEventDetailPanel:C,firstHour:0,hourHeight:0,onEventUpdate:N,onEventDelete:k,appTimeZone:M})},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.monthData.monthEvents.some(e=>e.id===r)||!!i&&t.monthData.monthEvents.some(e=>e.id===i),l=sl(e.dragPreviewEvent,e.currentYear,e.monthData.monthIndex,e.appTimeZone),s=sl(t.dragPreviewEvent,t.currentYear,t.monthData.monthIndex,t.appTimeZone);return!(o||l||s)&&e.monthData===t.monthData&&e.currentYear===t.currentYear&&e.startOfWeek===t.startOfWeek&&e.totalColumns===t.totalColumns&&e.app===t.app&&e.calendarRef===t.calendarRef&&e.selectedEventId===t.selectedEventId&&e.onMoveStart===t.onMoveStart&&e.onResizeStart===t.onResizeStart&&e.onSelectDate===t.onSelectDate&&e.onCreateStart===t.onCreateStart&&e.onEventSelect===t.onEventSelect&&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});yl.displayName="FixedWeekMonthRow";const Dl=({app:e,calendarRef:t,useEventDetailPanel:a,config:r,selectedEventId:i,onEventSelect:o,detailPanelEventId:l,onDetailPanelToggle:s})=>{var d,c;const{t:u,locale:h,getWeekDaysLabels:y}=Pn(),D=e.getCurrentDate(),w=D.getFullYear(),b=e.getEvents(),E=e.timeZone,C=null!==(d=null==r?void 0:r.startOfWeek)&&void 0!==d?d:1,T=v(null),M=v(null),S=v(null),[N,k]=g(0),[I,O]=g(0),[R,A]=g(null),[H,P]=g(null),L=p(()=>qt(),[]),$=void 0===i?R:i,Y=void 0===l?H:l,j=f(e=>{o?o(e):A(e)},[o]),Z=f(e=>{s?s(e):P(e)},[s]),[F,_]=g(null),W=f(()=>_(null),[]),[z,U]=g(null),B=e.canMutateFromUI(),V=f((e,t)=>{e.preventDefault(),e.stopPropagation(),B&&U({x:e.clientX,y:e.clientY,date:t})},[B]);m(()=>{B||U(null)},[B]),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||(j(null),Z(null))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const G=v(e.state.highlightedEventId),q=f(()=>{if(S.current){const e=S.current,t=e.offsetHeight-e.clientHeight,n=e.offsetWidth-e.clientWidth;O(e=>e===t?e:t),k(e=>e===n?e:n)}},[]);m(()=>{const e=S.current;if(!e)return;q();const t=new ResizeObserver(()=>{q()});return t.observe(e),()=>{t.disconnect()}},[q]),m(()=>{e.state.highlightedEventId?(j(e.state.highlightedEventId),requestAnimationFrame(()=>{const t=S.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&&j(null),G.current=e.state.highlightedEventId},[e.state.highlightedEventId]);const K=p(()=>dl(w,C),[w,C]),{handleMoveStart:X,handleResizeStart:J,handleCreateStart:Q,dragState:ee,isDragging:te}=Mo(e,{calendarRef:t,viewType:x.YEAR,onEventsUpdate:(t,n,a)=>{const r=t(b),i=new Map(b.map(e=>[e.id,e])),o=r.filter(e=>{const t=i.get(e.id);return void 0!==t&&t!==e&&Tt(t,e)});o.length>0&&e.applyEventsChanges({update:o.map(e=>({id:e.id,updates:e}))},n,a)},currentWeekStart:new Date,events:b,onEventCreate:t=>{e.addEvent(t)},onEventEdit:e=>{_(e.id)}}),ne=ee,ae=null!==(c=null==r?void 0:r.showTimedEventsInYearView)&&void 0!==c&&c,re=f(e=>il(b,e,E),[b,E]),ie=f(t=>{const n=null==r?void 0:r.gridDateClick;if("function"!=typeof n)return"day-view"===n?(e.setCurrentDate(t),void e.changeView(x.DAY)):void("none"!==n&&e.selectDate(t));n(t,re(t))},[null==r?void 0:r.gridDateClick,re,e]),oe=f((t,a)=>{const i=null==r?void 0:r.gridDateDoubleClick;if("function"!=typeof i){if("day-view"===i)return e.setCurrentDate(a),void e.changeView(x.DAY);if("none"!==i)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:u("newEvent")||"New Event",start:t,end:t,allDay:!0};e.addEvent(r),_(r.id)}}else i(a,re(a))},[null==r?void 0:r.gridDateDoubleClick,re,ae,Q,e,u]),le=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:h,totalColumns:K,startOfWeek:C,getWeekDaysLabels:y}),[h,K,C,y]),se=p(()=>{const e=new Date(w,0,1).getTime(),t=new Date(w,11,31,23,59,59).getTime(),n=[];for(let a=0;a<b.length;a++){const r=b[a];if(!r.start)continue;if(!ae&&!r.allDay)continue;const i=rl(r,E);i.startMs<=t&&i.endMsEod>=e&&n.push(r)}return n},[b,w,ae,E]),de=p(()=>gl({currentYear:w,locale:h,totalColumns:K,yearEvents:se,startOfWeek:C,appTimeZone:E}),[w,h,K,se,C,E]),ce=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?Ie(t.startDate):Oe(t.startDate,a),end:r.allDay?Ie(t.endDate):Oe(t.endDate,a)}):null})({isDragging:te,dragState:ne,yearEvents:se,appTimeZone:E}),[te,ne,se,E]),ue=te&&"move"===ne.mode&&!!ce&&ce.id===ne.eventId,he=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)&&!sl(t,a,e.monthIndex,i))return e;const o=e.monthEvents.filter(e=>e.id!==(null==t?void 0:t.id));t&&sl(t,a,e.monthIndex,i)&&o.push(t);const{segments:l,maxVisualRow:s}=cl(o,e.monthIndex,a,r,i);return Object.assign(Object.assign({},e),{eventSegments:l,minHeight:Math.max(60,20+18*(s+1))})}))({monthsData:de,dragPreviewEvent:ce,isMovePreviewActive:ue,currentYear:w,startOfWeek:C,appTimeZone:E}),[de,ce,ue,w,C,E]),ge=p(()=>he.map(e=>e.minHeight).join(","),[he]);m(()=>{q()},[q,ge]);const me=f(e=>{const t=e.currentTarget;T.current&&(T.current.scrollLeft=t.scrollLeft),M.current&&(M.current.scrollTop=t.scrollTop)},[]);return Wt("div",{className:"df-year-fixed",onContextMenu:e=>e.preventDefault(),children:[Wt("div",{className:"df-year-fixed-header-span",children:Wt(Si,{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()}})}),Wt("div",{className:"df-year-fixed-corner"}),Wt("div",{ref:T,className:"df-year-fixed-week-header",children:Wt("div",{className:"df-year-fixed-week-header-inner",style:{minWidth:`calc(1352px + ${N}px)`},children:[Wt("div",{className:"df-year-fixed-week-grid",style:{gridTemplateColumns:`repeat(${K}, minmax(0, 1fr))`,minWidth:"1352px"},children:le.map((e,t)=>{const n=(t+C)%7;return Wt("div",{className:"df-year-fixed-week-label","data-weekend":0===n||6===n?"true":"false",children:e},`label-${t}`)})}),N>0&&Wt("div",{className:"df-year-fixed-week-spacer","data-scrollbar-space":L?"true":"false",style:{width:`${N}px`}})]})}),Wt("div",{ref:M,className:"df-year-fixed-month-sidebar",children:Wt("div",{className:"df-year-fixed-month-sidebar-inner",children:[he.map(e=>Wt("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)),I>0&&Wt("div",{className:"df-year-fixed-month-spacer","data-scrollbar-space":L?"true":"false",style:{height:`${I}px`}})]})}),Wt("div",{ref:S,className:"df-year-fixed-content",onScroll:me,children:Wt("div",{className:"df-year-fixed-content-inner",style:{minWidth:"1352px"},children:he.map(n=>Wt(yl,{monthData:n,currentYear:w,startOfWeek:C,totalColumns:K,app:e,calendarRef:t,isDragging:te,dragState:ne,dragPreviewEvent:ce,selectedEventId:$,onMoveStart:X,onResizeStart:J,onSelectDate:ie,onCreateStart:oe,onEventSelect:j,newlyCreatedEventId:F,onDetailPanelOpen:W,detailPanelEventId:Y,onDetailPanelToggle:Z,useEventDetailPanel:a,onContextMenu:V,appTimeZone:E},n.monthIndex))})}),B&&z&&Wt(Qr,{x:z.x,y:z.y,date:z.date,viewType:x.YEAR,onClose:()=>U(null),app:e,onCreateEvent:()=>{const e={preventDefault:()=>{},stopPropagation:()=>{},clientX:z.x,clientY:z.y};oe(e,z.date)}})]})},wl=({date:e,events:t,anchorEl:n,position:a,onClose:r,locale:o,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(o,{weekday:"long",month:"long",day:"numeric"}),y=Wt(i,{children:[Wt("div",{className:"df-year-popup-header",children:Wt("div",{className:"df-year-popup-title",children:p})}),Wt("div",{className:"df-year-popup-body",children:0===t.length?Wt("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})}`)),Wt("div",{className:"df-year-popup-event",children:[Wt("div",{className:"df-year-popup-dot",style:{backgroundColor:r}}),Wt("div",{className:"df-year-popup-event-main",children:[Wt("div",{className:"df-year-popup-event-title",children:e.title}),e.allDay&&Wt("div",{className:"df-year-popup-event-meta",children:u("allDay")}),i&&Wt("div",{className:"df-year-popup-event-meta",children:i})]})]},e.id)})})]});return c(Wt("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 bl(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 El(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 Cl=({app:e,config:t})=>{var n,a,r;const{locale:i,getWeekDaysLabels:o}=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(()=>bl(d,s,u,v),[d,s,u,v]),E=p(()=>bl(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]),M=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:El(e)})}else"day-view"===l&&(e.setCurrentDate(a),e.changeView(x.DAY))},[t,e,D,E]),S=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 Wt("div",{className:Ln,children:[Wt(Si,{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()}),Wt("div",{className:"df-year-grid",style:{gridTemplateColumns:"repeat(4, 1fr)",gridTemplateRows:"repeat(3, 1fr)"},children:T.map(e=>Wt("div",{className:"df-year-grid-month df-year-grid-month",children:[Wt("div",{className:"df-year-grid-month-title",children:e.monthName}),Wt("div",{className:"df-year-grid-month-body",children:Wt("div",{className:"df-year-grid-calendar",style:{gridTemplateColumns:"repeat(7, 1fr)",gridTemplateRows:"repeat(7, 1fr)"},children:[C.map((e,t)=>Wt("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 Wt("div",{"data-grid-day-cell":!0,className:"df-year-grid-day","data-current-month":n?"true":"false",style:u,onClick:n=>M(n,t,e.monthIndex),onDblClick:()=>S(t),children:Wt("div",{className:"df-year-grid-day-inner",children:Wt("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&&Wt(wl,{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})]})},Tl=e=>{var t;const n=(null===(t=e.config)||void 0===t?void 0:t.mode)||"year-canvas";return"fixed-week"===n?Wt(Dl,Object.assign({},e)):"grid"===n?Wt(Cl,{app:e.app,config:e.config}):Wt(pl,Object.assign({},e))},Ml={},Sl=e=>o(No,Object.assign(Object.assign({},e),{viewType:x.YEAR,originalComponent:Tl,className:"df-year-view-factory"}));Sl.displayName="YearViewAdapter";const Nl=(e={})=>{const t=Object.assign(Object.assign({},Ml),e);return{type:x.YEAR,component:Sl,config:t}};function kl(e){const t=[xo(null==e?void 0:e.day),jo(null==e?void 0:e.week),Vo(null==e?void 0:e.month)];return(null==e?void 0:e.agenda)&&t.push(nl(e.agenda)),t}const Il={enableAutoRecalculate:!0,enableValidation:!0,defaultEvents:[],maxEventsPerDay:50};function xl(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({},Il),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=xl(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=xl(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=j(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=j(n.start),r=j(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{ka as AlertCircle,Na as AudioLines,za as BlossomColorPicker,Ft as CalendarApp,Ti as CalendarEvent,ie as CalendarRegistry,jr as CalendarRenderer,va as Check,ha as ChevronDown,ua as ChevronRight,fa as ChevronsUpDown,Wa as ContentSlot,zr as ContextMenu,Jr as ContextMenuColorPicker,Ur as ContextMenuItem,Vr as ContextMenuLabel,Br as ContextMenuSeparator,Ga as CreateCalendarDialog,Yr as CustomRenderingStore,Dr as DayflowRangePicker,Ua as DefaultColorPicker,br as DefaultEventDetailDialog,wi as DefaultEventDetailPanel,ei as EventContextMenu,ho as EventLayoutCalculator,Qr as GridContextMenu,O as LAYOUT_CONFIG,S as LOCALES,Da as Loader2,Ba as LoadingButton,Hn as LocaleContext,Ha as LocaleProvider,Tr as MiniCalendar,Ta as PanelRightClose,Ma as PanelRightOpen,ga as Plus,je as TIME_STEP,H as TimeZone,R as VIRTUAL_MONTH_SCROLL_CONFIG,x as ViewType,A as WeekDataCache,V as addDays,ll as analyzeMultiDayEventsForRow,ve as buildColorBarGradient,fe as buildDiagonalColorBarGradient,ye as buildDiagonalPatternBackground,gl as buildFixedWeekMonthsData,mt as calculateDayIndex,ta as calendarPickerDropdown,Yn as cancelButton,xa as capitalize,cn as clipboardStore,In as compareAllDayDisplayPriority,Lt as compareViews,En as convertToDayFlowEvent,nl as createAgendaView,xn as createAllDayDisplayComparator,an as createAllDayEvent,It as createConfigSyncSnapshot,X as createDateWithHour,xo as createDayView,Qt as createEvent,gt as createEventWithDate,bt as createEventWithPlainDateTime,Dt as createEventWithRealDate,Et as createEventWithZonedDateTime,tn as createEvents,Ol as createEventsPlugin,Vo as createMonthView,At as createNormalizedCalendarAppConfigGetter,kl as createStandardViews,Z as createTemporalWithHour,rn as createTimedEvent,en as createTimezoneEvent,nn as createTimezoneEvents,jo as createWeekView,Nl as createYearView,Ie as dateToPlainDate,xe as dateToPlainDateTime,Oe as dateToZonedDateTime,U as daysBetween,B as daysDifference,Mn as downloadICS,M as en,vn as escapeICSValue,K as extractHourFromDate,He as extractHourFromTemporal,wn as extractVEvents,pn as foldLine,Bt as formatDate,zt as formatDateConsistent,mn as formatDateToICSTimestamp,_e as formatEventTimeRange,gn as formatICSDate,Ut as formatMonthYear,yn as formatProperty,Ze as formatTime,at as generateDayData,Tn as generateICS,ze as generateSecondaryTimeSlots,St 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,z as getEndOfTemporal,de as getEventBgColor,Fe as getEventEndHour,ii as getEventIcon,ce as getEventTextColor,st as getEventsForDay,yt as getEventsForWeek,dl as getFixedWeekTotalColumns,Ia as getIntlLabel,he as getLineColor,Ra as getMonthLabels,rt as getMonthYearOfWeek,Ge as getNextHourRangeInTimeZone,Be as getNowInTimeZone,Le as getPlainDate,ge as getPrimaryCalendarId,sn as getSearchHeaderInfo,ue as getSelectedBgColor,J as getStartOfDay,W as getStartOfTemporal,Ot as getSyncConfigUpdates,Mt as getTestEvents,Ue as getTimezoneDisplayLabel,Ve as getTodayInTimeZone,Oa as getWeekDaysLabels,ee as getWeekNumber,tt as getWeekRange,ol as groupDaysIntoRows,dn as groupSearchResults,Tt as hasEventChanged,Sn 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,F as isSamePlainDate,$e as isSameTemporal,I as isValidLocale,Me as isZonedDateTime,Qe as monthNames,Vt as normalizeCssWidth,ln as normalizeDate,k as normalizeLocale,Ee as normalizeTimeZoneValue,G as now,un as pad2,Cn as parseICS,hn as parseICSDate,bn as parseVEventLines,kt as pickSyncableConfig,Re as plainDateTimeToDate,Ae as plainDateToDate,ft as recalculateEventDays,Co as registerDragImplementation,N as registerLocale,Ar as registerSidebarImplementation,Kt as resolveAppliedTheme,On as restoreTimedDragFromAllDayTransition,Ke as restoreVisualEventToCanonical,qe as restoreVisualTimedTemporalToCanonical,We as roundToTimeStep,qt as scrollbarTakesSpace,Pe as setHourInTemporal,et as shortMonthNames,ra as sidebarContainer,ia as sidebarHeader,la as sidebarHeaderTitle,oa as sidebarHeaderToggle,kn as sortAllDayByTitle,Zr as subscribeCalendar,Rt as syncCalendarAppConfig,Aa as t,Se as temporalToDate,Ne as temporalToVisualDate,ke as temporalToVisualTemporal,q as today,fn as unescapeICSValue,ut as updateEventDateAndDay,wt as updateEventWithRealDate,Mo as useDragForView,Pn as useLocale,Pr as useSidebarBridge,Xe as weekDays,Je as weekDaysFullName,Y as zonedDateTimeToDate};