iobroker.fullcalendar 3.2.0 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -19
- package/admin/assets/{index-B98AD8OO.js → index-BF-xuLMY.js} +1 -1
- package/admin/tab_m.html +1 -1
- package/build/lib/agenda.js +10 -0
- package/build/lib/agenda.js.map +1 -1
- package/build/lib/recurrence.js +186 -0
- package/build/lib/recurrence.js.map +1 -0
- package/build/main.js +468 -95
- package/build/main.js.map +1 -1
- package/img/vis2-widget-month.png +0 -0
- package/io-package.json +48 -28
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
[](https://nodei.co/npm/iobroker.fullcalendar/)
|
|
8
8
|
|
|
9
|
+
**This adapter uses Sentry libraries to automatically report exceptions and code errors to the developers.** For more details and for information how to disable the error reporting see [Sentry-Plugin Documentation](https://github.com/ioBroker/plugin-sentry#plugin-sentry)! Sentry reporting is used starting with js-controller 3.0.
|
|
10
|
+
|
|
9
11
|
Schedules with [fullcalendar](https://fullcalendar.io).
|
|
10
12
|
|
|
11
13
|
## Plan the events (control your devices)
|
|
@@ -13,6 +15,10 @@ You must not use any external resources, the scheduling is processed only in ioB
|
|
|
13
15
|
|
|
14
16
|

|
|
15
17
|
|
|
18
|
+
The vis-2 widget in the month view with a dark theme: watering, heating mode and balcony light as events.
|
|
19
|
+
|
|
20
|
+

|
|
21
|
+
|
|
16
22
|
You can control your events with a calendar and can plan to control them periodically.
|
|
17
23
|
|
|
18
24
|
- **Duration** of "On/Off" and "Toggle" events can be given in seconds, minutes or hours. With a duration of 1 second, an event works like a push button.
|
|
@@ -58,19 +64,53 @@ sendTo('fullcalendar.0', 'addEvent', { oid: 'hm-rpc.0.ABC.1.STATE', value: false
|
|
|
58
64
|
// at a time (local time, or a timestamp in ms), for 10 minutes, in the calendar "Garden"
|
|
59
65
|
sendTo('fullcalendar.0', 'addEvent', {
|
|
60
66
|
oid: 'hm-rpc.0.PUMP.1.STATE', value: true, start: '2026-10-29T07:30', duration: '10m', calendar: 'Garden', name: 'Pump',
|
|
61
|
-
}, res => log(JSON.stringify(res))); // {id, name, start, ts} or {error}
|
|
67
|
+
}, res => log(JSON.stringify(res))); // {id, name, type, start, ts} or {error}
|
|
68
|
+
// every year on June 15 at 08:00 (a birthday), the start may be in the past
|
|
69
|
+
sendTo('fullcalendar.0', 'addEvent', {
|
|
70
|
+
oid: '0_userdata.0.birthday', value: 'Anna', start: '2020-06-15T08:00', recurring: 'yearly', name: 'Birthday Anna',
|
|
71
|
+
}, res => log(JSON.stringify(res))); // {id, name, type, start: next execution, ts, cron: "0 0 8 15 6 *"}
|
|
72
|
+
// move an event to 09:30 (a series keeps its days) and let it switch for 2 minutes
|
|
73
|
+
sendTo('fullcalendar.0', 'updateEvent', { id: 'fullcalendar.0.event-…', start: '09:30', duration: '2m' }, res => log(JSON.stringify(res)));
|
|
74
|
+
// delete all events with this name
|
|
75
|
+
sendTo('fullcalendar.0', 'deleteEvent', { name: 'Birthday Anna' }, res => log(JSON.stringify(res)));
|
|
62
76
|
```
|
|
63
77
|
|
|
64
|
-
| Command
|
|
65
|
-
|
|
66
|
-
| `addEvent`
|
|
67
|
-
| `
|
|
68
|
-
| `
|
|
69
|
-
| `
|
|
70
|
-
| `
|
|
71
|
-
| `
|
|
72
|
-
|
|
73
|
-
|
|
78
|
+
| Command | Message | Answer |
|
|
79
|
+
|------------------|--------------------------------------------------------------------------------------------|---------------------------------------------------|
|
|
80
|
+
| `addEvent` | see below | `{id, name, type, start, ts, cron?}` (`start`/`ts` = first execution) |
|
|
81
|
+
| `updateEvent` | `id` and the parameters of `addEvent` to change, see below | `{id, name, type, enabled, start, ts, cron?}` (`start`/`ts` = next execution, `null` if none) |
|
|
82
|
+
| `deleteEvent` | `id`, `ids` (a list) and/or `name` (all events with exactly this name; optional `calendar`) | `{result: "ok", deleted: [id, …], notFound?: [id, …]}` |
|
|
83
|
+
| `getEvent` | `id` | `{event: definition}` |
|
|
84
|
+
| `getEvents` | optional `calendar` | `{events: [definition, …]}` |
|
|
85
|
+
| `listEvents` | optional `from`, `to` (default now … 7 days, or `days`), `calendar`, `max` | `{events: [execution, …]}` |
|
|
86
|
+
| `getCalendars` | – | `{calendars: [{id, name, enabled}, …]}` |
|
|
87
|
+
| `enableCalendar` | `calendar` (name or ID), `enabled` (`true`/`false`) | `{id, enabled}` |
|
|
88
|
+
| `getCommands` | – | `{commands: [{command, params, answer}, …]}` |
|
|
89
|
+
|
|
90
|
+
Parameters of `addEvent`:
|
|
91
|
+
|
|
92
|
+
| Parameter | Meaning |
|
|
93
|
+
|----------------------------|------------------------------------------------------------------------------------------------------------|
|
|
94
|
+
| `oid` | state to write (must exist and be writable) |
|
|
95
|
+
| `value` | value to write |
|
|
96
|
+
| `start` or `in` | `start`: local time (`"2026-10-29T07:30"`, `"07:30"` = today) or a timestamp in ms; `in`: delay (seconds, or `"90s"`, `"30m"`, `"2h"`, `"1h30m"`, `"1d"`) |
|
|
97
|
+
| `duration` / `durationSec` | after this time (same formats as `in`) the second value is written; then `type` is `"double"` by default |
|
|
98
|
+
| `type` | `"single"` (default), `"double"` (writes `endValue` after `duration`), `"toggle"` (switches back after `duration`) |
|
|
99
|
+
| `endValue` | value of `"double"`; for a boolean `value` the default is the opposite |
|
|
100
|
+
| `recurring` | `"daily"`, `"weekly"`, `"monthly"` or `"yearly"`: repeats at the time of day of `start` (also of a `start` in the past). The day comes from `start`, or from `weekdays` (list, `0` = Sunday or `"MO"`, `"TU"`…), `monthDays` (list, 1…31), `months` (list, 1…12) |
|
|
101
|
+
| `rrule` | instead of `recurring`: iCal rule, e.g. `"FREQ=YEARLY"`, `"FREQ=WEEKLY;BYDAY=MO,FR"`, `"FREQ=MONTHLY;BYMONTHDAY=1,15"`. Supported: `FREQ` (DAILY, WEEKLY, MONTHLY, YEARLY), `BYDAY` (plain weekdays), `BYMONTHDAY`, `BYMONTH`. Not supported: `INTERVAL` > 1, `COUNT`, `UNTIL`, `BYDAY=2MO` |
|
|
102
|
+
| `name` | name of the event, default: name of the state |
|
|
103
|
+
| `calendar` | name or ID of the calendar, default: the default calendar |
|
|
104
|
+
| `color` | color in the calendar |
|
|
105
|
+
|
|
106
|
+
`updateEvent` changes an event in place, the parameters not given stay as they are:
|
|
107
|
+
- `start` or `in` moves a one-shot event; of a series it changes the time of day, the days stay.
|
|
108
|
+
- `recurring` or `rrule` make it a series (at the time of `start`, or at its current time of day), `recurring: false` together with `start` or `in` makes it a one-shot event again.
|
|
109
|
+
- `value`, `oid`, `type`, `duration`/`durationSec`, `endValue`, `name`, `color` like in `addEvent`. If a boolean event switches the other way (`value`), its end value follows.
|
|
110
|
+
- `enabled: false` / `true` switches it off or on.
|
|
111
|
+
- `calendar` moves it to another calendar. The event gets a new ID then, the answer has it.
|
|
112
|
+
|
|
113
|
+
Errors come back as `{error}`, an unknown command answers with the list of the commands. A new event appears in the calendar like one created by hand and can be edited there. Recurring events run at whole minutes.
|
|
74
114
|
|
|
75
115
|
## Todo
|
|
76
116
|
- Week and day must scroll to the current time
|
|
@@ -80,6 +120,18 @@ Errors come back as `{error}`. A new event is a one-shot event and appears in th
|
|
|
80
120
|
### **WORK IN PROGRESS**
|
|
81
121
|
-->
|
|
82
122
|
## Changelog
|
|
123
|
+
### 3.3.1 (2026-10-29)
|
|
124
|
+
* (@GermanBluefox) Added the admin >= 7.6.17 dependency, the translated name of the admin tab and the uk translations (#557)
|
|
125
|
+
* (@GermanBluefox) The adapter timers (`this.setTimeout`/`this.setInterval`) are used instead of the plain ones (#557)
|
|
126
|
+
* (@GermanBluefox) Added the message `updateEvent`: move or change an event without deleting and creating it again
|
|
127
|
+
|
|
128
|
+
### 3.3.0 (2026-10-29)
|
|
129
|
+
* (bluefox) Fixed: `addEvent` ignored `type` and `durationSec`, a "double" event was saved as "single"
|
|
130
|
+
* (bluefox) Added recurring events to `addEvent`: `recurring` (daily, weekly, monthly, yearly) or an iCal `rrule`
|
|
131
|
+
* (bluefox) `deleteEvent` deletes a list of events (`ids`) or all events with a name (`name`)
|
|
132
|
+
* (bluefox) Added the messages `getEvent` and `getCommands`, an unknown command answers with the list of the commands
|
|
133
|
+
* (bluefox) Documented all messages and parameters in the README
|
|
134
|
+
|
|
83
135
|
### 3.2.0 (2026-10-29)
|
|
84
136
|
* (bluefox) Fixed white screen when adding an event in the vis-2 widget (#444)
|
|
85
137
|
* (bluefox) Fixed: the recording of a simulation stopped immediately after the start (#234)
|
|
@@ -97,14 +149,6 @@ Errors come back as `{error}`. A new event is a one-shot event and appears in th
|
|
|
97
149
|
* (bluefox) Added the messages `addEvent`, `deleteEvent`, `listEvents`, `getEvents` and `getCalendars`, e.g. for voice assistants
|
|
98
150
|
* (bluefox) A one-shot event in the past is no longer marked as disabled in memory
|
|
99
151
|
|
|
100
|
-
### 3.0.5 (2026-10-19)
|
|
101
|
-
* (ioBroker-Bot) Adapter requires js-controller >= 6.0.11 now.
|
|
102
|
-
* (bluefox) Migrated GUI to vite
|
|
103
|
-
* (bluefox) Updated packages
|
|
104
|
-
|
|
105
|
-
### 3.0.1 (2026-08-05)
|
|
106
|
-
* (bluefox) Migrated GUI to React19
|
|
107
|
-
|
|
108
152
|
[Older changelogs can be found there](CHANGELOG_OLD.md)
|
|
109
153
|
|
|
110
154
|
## License
|
|
@@ -785,4 +785,4 @@ Arguments: `+Array.prototype.slice.call(i).join(``)+`
|
|
|
785
785
|
color: inherit;
|
|
786
786
|
}
|
|
787
787
|
}
|
|
788
|
-
`}),(0,V.jsx)(ng,{children:Y.t(`Edit simulation`)}),(0,V.jsxs)(Yh,{children:[(0,V.jsxs)(`div`,{style:m5.field,children:[(0,V.jsx)($b,{label:Y.t(`Name`),value:t.common.name||``,onChange:e=>{let r=JSON.parse(JSON.stringify(t));r.common.name=e.target.value,n(r)},variant:`standard`}),(0,V.jsxs)(Cg,{variant:`standard`,children:[(0,V.jsx)(n_,{children:Y.t(`Interval`)}),(0,V.jsx)(By,{value:t.native.interval||``,onChange:e=>{let r=JSON.parse(JSON.stringify(t));r.native.interval=e.target.value,n(r)},variant:`standard`,children:[`day`,`week`].map(e=>(0,V.jsx)(Qv,{value:e,children:Y.t(e)},e))})]})]}),(0,V.jsx)(`div`,{style:m5.field,children:(0,V.jsx)(zC,{label:Y.t(`Default color`),value:t.common.color,onChange:e=>{let r=JSON.parse(JSON.stringify(t));r.common.color=e,n(r)}})}),(0,V.jsxs)(`h4`,{style:m5.headers,children:[Y.t(`States`),(0,V.jsx)(lb,{title:Y.t(`Add states for recording`),slotProps:{popper:{sx:m5.tooltip}},children:(0,V.jsx)(Pd,{style:!l.length&&t?.native?.record?.states?.length?m5.blink:void 0,size:`small`,onClick:()=>o(!0),color:`primary`,children:(0,V.jsx)(tx,{})})})]}),(0,V.jsx)(`div`,{children:t.native.record?.states.map((e,r)=>v(e,()=>{let e=JSON.parse(JSON.stringify(t));e.native.record.states.splice(r,1),n(e)}))}),(0,V.jsxs)(`h4`,{style:m5.headers,children:[Y.t(`Categories`),(0,V.jsx)(lb,{title:Y.t(`Add overlap of categories for recording`),slotProps:{popper:{sx:m5.tooltip}},children:(0,V.jsx)(Pd,{style:!l.length&&t?.native?.record?.states?.length?m5.blink:void 0,size:`small`,onClick:()=>c(!0),color:`primary`,children:(0,V.jsx)(tx,{})})})]}),(0,V.jsx)(`div`,{children:t.native.record?.enums.map((e,r)=>{let i=e.map(e=>(0,V.jsx)(LE,{value:d[e]||e,lang:Y.getLanguage()},e)),a=1,o=i.reduce((e,t)=>[e,(0,V.jsx)(`span`,{children:`+`},a++),t],null);return(0,V.jsx)(am,{onClick:()=>c(r),onDelete:()=>{let e=JSON.parse(JSON.stringify(t));e.native.record.enums.splice(r,1),n(e)},label:o,sx:{"& .MuiChip-label":m5.chipLabel},style:m5.chip},r)})}),(0,V.jsx)(`h4`,{style:{marginBottom:-0},children:Y.t(`Recorded states`)}),(0,V.jsxs)(`div`,{children:[h&&(0,V.jsx)(v_,{}),Object.keys(p).map(e=>v(e))]})]}),(0,V.jsxs)(Uh,{children:[(0,V.jsx)(Lm,{variant:`contained`,color:`secondary`,startIcon:(0,V.jsx)(_x,{}),onClick:()=>i(!0),children:Y.t(`Delete`)}),(0,V.jsx)(Lm,{disabled:y,onClick:async()=>{let n=JSON.parse(JSON.stringify(t));n.native.interval!==e.simulation.native.interval&&n.native.interval===`day`&&(console.log(n),n.native.events.forEach(e=>{console.log(e.native.cron);let t=ZH(e.native.cron);console.log(t),t.dows=[0,1,2,3,4,5,6],e.native.cron=$H(t),console.log(e.native.cron)})),await e.socket.setObject(t._id,n),e.onClose()},variant:`contained`,color:`primary`,startIcon:(0,V.jsx)(Ux,{}),children:Y.t(`Save`)}),(0,V.jsx)(Lm,{onClick:e.onClose,variant:`contained`,color:`grey`,startIcon:(0,V.jsx)(cx,{}),children:y?Y.t(`ra_Close`):Y.t(`ra_Cancel`)})]}),r&&(0,V.jsx)(AS,{fullWidth:!1,title:Y.t(`Delete simulation`),text:Y.t(`Simulation will be deleted. Confirm?`),ok:Y.t(`ra_Delete`),onClose:async n=>{n&&(await e.onDelete(t._id),e.onClose()),i(!1)}}),a&&(0,V.jsx)(RE,{imagePrefix:`../..`,multiSelect:!0,theme:e.theme,selected:t.native.record.states,onOk:e=>{let r=JSON.parse(JSON.stringify(t));r.native.record=r.native.record||{enums:[],states:[]},r.native.record.states=r.native.record.states||[],r.native.record.states=Array.isArray(e)?e:[e],n(r),o(!1)},onClose:()=>o(!1),socket:e.socket}),s===!1?null:(0,V.jsx)(p5,{socket:e.socket,enumsObjects:d,selectedEnums:typeof s==`number`?t.native.record.enums[s]:[],exceptions:t.native.record.enumsExceptions||[],onSelect:(e,r)=>{let i=JSON.parse(JSON.stringify(t));i.native.record=i.native.record||{enums:[],states:[]},i.native.record.enums=i.native.record.enums||[],i.native.record.enumsExceptions=r||[],typeof s==`number`?i.native.record.enums[s]=e:i.native.record.enums.push(e),n(i),c(!1)},onClose:()=>c(!1)})]})},g5={Y:`year`,YY:`year`,YYYY:{sectionType:`year`,contentType:`digit`,maxLength:4},M:{sectionType:`month`,contentType:`digit`,maxLength:2},MM:`month`,MMM:{sectionType:`month`,contentType:`letter`},MMMM:{sectionType:`month`,contentType:`letter`},D:{sectionType:`day`,contentType:`digit`,maxLength:2},DD:`day`,Do:{sectionType:`day`,contentType:`digit-with-letter`},E:{sectionType:`weekDay`,contentType:`digit`,maxLength:1},e:{sectionType:`weekDay`,contentType:`digit`,maxLength:1},d:{sectionType:`weekDay`,contentType:`digit`,maxLength:1},dd:{sectionType:`weekDay`,contentType:`letter`},ddd:{sectionType:`weekDay`,contentType:`letter`},dddd:{sectionType:`weekDay`,contentType:`letter`},A:`meridiem`,a:`meridiem`,H:{sectionType:`hours`,contentType:`digit`,maxLength:2},HH:`hours`,h:{sectionType:`hours`,contentType:`digit`,maxLength:2},hh:`hours`,k:{sectionType:`hours`,contentType:`digit`,maxLength:2},kk:`hours`,m:{sectionType:`minutes`,contentType:`digit`,maxLength:2},mm:`minutes`,s:{sectionType:`seconds`,contentType:`digit`,maxLength:2},ss:`seconds`},_5={year:`YYYY`,month:`MMMM`,monthShort:`MMM`,dayOfMonth:`D`,dayOfMonthFull:`Do`,weekday:`dddd`,weekdayShort:`ddd`,hours24h:`HH`,hours12h:`hh`,meridiem:`A`,minutes:`mm`,seconds:`ss`,fullDate:`ll`,keyboardDate:`L`,shortDate:`MMM D`,normalDate:`D MMMM`,normalDateWithWeekday:`ddd, MMM D`,fullTime12h:`hh:mm A`,fullTime24h:`HH:mm`,keyboardDateTime12h:`L hh:mm A`,keyboardDateTime24h:`L HH:mm`};function v5(){throw Error(BX(140))}var y5=class{isMUIAdapter=!0;isTimezoneCompatible=!0;lib=`moment`;escapedCharacters={start:`[`,end:`]`};formatTokenMap=g5;constructor({locale:e,formats:t,instance:n}={}){this.moment=n||dU,this.locale=e,this.formats=b({},_5,t)}setLocaleToValue=e=>{let t=this.getCurrentLocaleCode();return t===e.locale()?e:e.locale(t)};hasTimezonePlugin=()=>this.moment.tz!==void 0;createSystemDate=e=>{let t=this.moment(e).local();return this.locale===void 0?t:t.locale(this.locale)};createUTCDate=e=>{let t=this.moment.utc(e);return this.locale===void 0?t:t.locale(this.locale)};createTZDate=(e,t)=>{this.hasTimezonePlugin()||v5();let n=t==="default"?this.moment(e):this.moment.tz(e,t);return this.locale===void 0?n:n.locale(this.locale)};date=(e,t=`default`)=>e===null?null:t===`UTC`?this.createUTCDate(e):t===`system`||t==="default"&&!this.hasTimezonePlugin()?this.createSystemDate(e):this.createTZDate(e,t);getInvalidDate=()=>this.moment(new Date(`Invalid Date`));getTimezone=e=>{let t=e._z?.name,n=e.isUTC()?`UTC`:`system`;return t??this.moment.defaultZone?.name??n};setTimezone=(e,t)=>{if(this.getTimezone(e)===t)return e;if(t===`UTC`)return e.clone().utc();if(t===`system`)return e.clone().local();if(!this.hasTimezonePlugin())return t!=="default"&&v5(),e;let n=t==="default"?this.moment.defaultZone?.name??`system`:t;if(n===`system`)return e.clone().local();let r=e.clone();return r.tz(n),r};toJsDate=e=>e.toDate();parse=(e,t)=>e===``?null:this.locale?this.moment(e,t,this.locale,!0):this.moment(e,t,!0);getCurrentLocaleCode=()=>this.locale||dU.locale();is12HourCycleInCurrentLocale=()=>/A|a/.test(dU.localeData(this.getCurrentLocaleCode()).longDateFormat(`LT`));expandFormat=e=>e.match(/(\[[^[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})|./g).map(e=>{let t=e[0];return t===`L`||t===`;`?dU.localeData(this.getCurrentLocaleCode()).longDateFormat(e):e}).join(``);isValid=e=>e!=null&&e.isValid();format=(e,t)=>this.formatByString(e,this.formats[t]);formatByString=(e,t)=>{let n=e.clone();return n.locale(this.getCurrentLocaleCode()),n.format(t)};formatNumber=e=>e;isEqual=(e,t)=>e===null&&t===null?!0:e===null||t===null?!1:e.isSame(t);isSameYear=(e,t)=>e.isSame(t,`year`);isSameMonth=(e,t)=>e.isSame(t,`month`);isSameDay=(e,t)=>e.isSame(t,`day`);isSameHour=(e,t)=>e.isSame(t,`hour`);isAfter=(e,t)=>e.isAfter(t);isAfterYear=(e,t)=>e.isAfter(t,`year`);isAfterDay=(e,t)=>e.isAfter(t,`day`);isBefore=(e,t)=>e.isBefore(t);isBeforeYear=(e,t)=>e.isBefore(t,`year`);isBeforeDay=(e,t)=>e.isBefore(t,`day`);isWithinRange=(e,[t,n])=>e.isBetween(t,n,null,`[]`);startOfYear=e=>e.clone().startOf(`year`);startOfMonth=e=>e.clone().startOf(`month`);startOfWeek=e=>this.setLocaleToValue(e.clone()).startOf(`week`);startOfDay=e=>e.clone().startOf(`day`);endOfYear=e=>e.clone().endOf(`year`);endOfMonth=e=>e.clone().endOf(`month`);endOfWeek=e=>this.setLocaleToValue(e.clone()).endOf(`week`);endOfDay=e=>e.clone().endOf(`day`);addYears=(e,t)=>t<0?e.clone().subtract(Math.abs(t),`years`):e.clone().add(t,`years`);addMonths=(e,t)=>t<0?e.clone().subtract(Math.abs(t),`months`):e.clone().add(t,`months`);addWeeks=(e,t)=>t<0?e.clone().subtract(Math.abs(t),`weeks`):e.clone().add(t,`weeks`);addDays=(e,t)=>t<0?e.clone().subtract(Math.abs(t),`days`):e.clone().add(t,`days`);addHours=(e,t)=>t<0?e.clone().subtract(Math.abs(t),`hours`):e.clone().add(t,`hours`);addMinutes=(e,t)=>t<0?e.clone().subtract(Math.abs(t),`minutes`):e.clone().add(t,`minutes`);addSeconds=(e,t)=>t<0?e.clone().subtract(Math.abs(t),`seconds`):e.clone().add(t,`seconds`);getYear=e=>e.get(`year`);getMonth=e=>e.get(`month`);getDate=e=>e.get(`date`);getHours=e=>e.get(`hours`);getMinutes=e=>e.get(`minutes`);getSeconds=e=>e.get(`seconds`);getMilliseconds=e=>e.get(`milliseconds`);setYear=(e,t)=>e.clone().year(t);setMonth=(e,t)=>e.clone().month(t);setDate=(e,t)=>e.clone().date(t);setHours=(e,t)=>e.clone().hours(t);setMinutes=(e,t)=>e.clone().minutes(t);setSeconds=(e,t)=>e.clone().seconds(t);setMilliseconds=(e,t)=>e.clone().milliseconds(t);getDaysInMonth=e=>e.daysInMonth();getWeekArray=e=>{let t=this.startOfWeek(this.startOfMonth(e)),n=this.endOfWeek(this.endOfMonth(e)),r=0,i=t,a=i.get(`dayOfYear`),o=[];for(;i.isBefore(n);){let e=Math.floor(r/7);o[e]=o[e]||[],o[e].push(i);let t=a;i=this.addDays(i,1),a=i.get(`dayOfYear`),t===a&&(i=i.add(12,`h`).startOf(`day`)),r+=1}return o};getWeekNumber=e=>e.week();getDayOfWeek=e=>e.day()+1;getYearRange([e,t]){let n=this.startOfYear(e),r=this.endOfYear(t),i=[],a=n;for(;this.isBefore(a,r);)i.push(a),a=this.addYears(a,1);return i}},b5={field:{"& .MuiFormControl-root":{width:`100%`},display:`flex`,alignItems:`end`,gap:`20px`},tableCell:{textAlign:`center`}},x5=e=>{let[t,n]=(0,B.useState)({start:null,end:null,dow:[0,1,2,3,4,5,6]});return dU.locale(Y.getLanguage()),(0,V.jsxs)(zh,{open:!0,onClose:e.onClose,children:[(0,V.jsx)(ng,{children:Y.t(`Play simulation`)}),(0,V.jsxs)(Yh,{children:[(0,V.jsxs)(qX,{dateAdapter:y5,children:[(0,V.jsxs)(Tm,{component:`div`,sx:b5.field,style:{width:`100%`,marginBottom:20,marginTop:10},children:[(0,V.jsx)(M8,{label:`Start`,sx:e=>({borderBottom:`1px solid ${e.palette.text.primary}`,"& fieldset":{display:`none`},"& input":{padding:`${e.spacing(1.5)} 0 4px 0`},"& .MuiInputAdornment-root":{marginLeft:0,marginTop:1},"& label":{transform:`translate(0px, -9px) scale(0.75)`},"&.MuiTextField-root":{width:`100%`}}),value:t.start,onChange:e=>n({...t,start:e})}),t.start&&(0,V.jsx)(Pd,{onClick:()=>n({...t,start:null}),children:(0,V.jsx)(_x,{})})]}),(0,V.jsxs)(Tm,{component:`div`,sx:b5.field,style:{width:`100%`,marginBottom:30},children:[(0,V.jsx)(M8,{label:`End`,sx:e=>({borderBottom:`1px solid ${e.palette.text.primary}`,"& fieldset":{display:`none`},"& input":{padding:`${e.spacing(1.5)} 0 4px 0`},"& .MuiInputAdornment-root":{marginLeft:0,marginTop:1},"& label":{transform:`translate(0px, -9px) scale(0.75)`}}),value:t.end,onChange:e=>n({...t,end:e})}),t.end&&(0,V.jsx)(Pd,{onClick:()=>n({...t,end:null}),children:(0,V.jsx)(_x,{})})]})]}),(0,V.jsx)(`div`,{children:(0,V.jsxs)(`table`,{children:[(0,V.jsx)(`thead`,{children:(0,V.jsx)(`tr`,{children:[0,1,2,3,4,5,6].map(e=>(0,V.jsx)(`td`,{style:b5.tableCell,children:dU().day(e).format(`ddd`)},e))})}),(0,V.jsx)(`tbody`,{children:(0,V.jsx)(`tr`,{children:[0,1,2,3,4,5,6].map(r=>(0,V.jsx)(`td`,{children:(0,V.jsx)(Zm,{"aria-label":`play simulation`,checked:t.dow.includes(r),disabled:e.readOnly,onChange:e=>{e.target.checked?n({...t,dow:[...t.dow,r]}):n({...t,dow:t.dow.filter(e=>e!==r)})},size:`small`})},r))})})]})})]}),(0,V.jsxs)(Uh,{children:[(0,V.jsx)(Lm,{onClick:()=>{e.playSimulation(e.simulation._id,t),e.onClose()},variant:`contained`,color:`primary`,startIcon:(0,V.jsx)(Ix,{}),children:Y.t(`Play`)}),(0,V.jsx)(Lm,{onClick:e.onClose,variant:`contained`,color:`grey`,startIcon:(0,V.jsx)(cx,{}),children:Y.t(`Cancel`)})]})]})},S5={panel:e=>({height:`100%`,display:`flex`,flexDirection:`column`,borderRadius:0,borderRight:`1px solid ${e.palette.divider}`,overflow:`hidden`}),modeTabs:{flexShrink:0,minHeight:42,"& .MuiTab-root":{minHeight:42,minWidth:0,flex:1,padding:`0 8px`}},header:e=>({flexShrink:0,display:`flex`,alignItems:`center`,gap:1,minHeight:44,padding:`6px 6px 6px 12px`,borderBottom:`1px solid ${e.palette.divider}`}),headerTitle:e=>({flexGrow:1,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,fontSize:11,fontWeight:600,letterSpacing:`0.08em`,textTransform:`uppercase`,color:e.palette.text.secondary}),addButton:e=>({flexShrink:0,width:28,height:28,color:e.palette.primary.contrastText||`#fff`,backgroundColor:e.palette.primary.main,"&:hover":{color:e.palette.primary.contrastText||`#fff`,backgroundColor:e.palette.primary.dark},"& .MuiSvgIcon-root":{fontSize:18}}),alert:e=>({display:`flex`,flexShrink:0,color:e.palette.error.main,"& .MuiSvgIcon-root":{fontSize:18}}),list:{flex:1,overflowY:`auto`,overflowX:`hidden`,padding:`6px`},item:e=>({gap:1,minHeight:34,paddingTop:`3px`,paddingBottom:`3px`,paddingLeft:`8px`,paddingRight:`4px`,marginBottom:`2px`,"& .actions":{opacity:0,transition:`opacity 0.15s ease-in-out`},"&:hover .actions, &.Mui-focusVisible .actions, &.Mui-selected .actions":{opacity:1},"&.Mui-selected .MuiIconButton-root":{color:`inherit`},"&.Mui-selected .count":{backgroundColor:`rgba(255, 255, 255, 0.22)`,color:`inherit`},...e.name?.startsWith(`modern`)?void 0:{"&.Mui-selected":{backgroundColor:e.palette.primary.main,color:e.palette.primary.contrastText,"&:hover":{backgroundColor:e.palette.primary.dark}}}}),itemText:{margin:0,overflow:`hidden`},swatch:{flexShrink:0,width:10,height:10,borderRadius:`3px`,boxShadow:`inset 0 0 0 1px rgba(0, 0, 0, 0.25)`},icon:{flexShrink:0,width:16,height:16},actions:{display:`flex`,alignItems:`center`,flexShrink:0,"& .MuiIconButton-root":{padding:`4px`},"& .MuiSvgIcon-root":{fontSize:18}},count:e=>({flexShrink:0,minWidth:20,height:18,padding:`0 5px`,borderRadius:`9px`,fontSize:10,fontWeight:600,lineHeight:`18px`,textAlign:`center`,backgroundColor:Ti(e.palette.text.primary,.08),color:e.palette.text.secondary}),tooltip:{pointerEvents:`none`}};function C5(e){return(0,V.jsxs)(vu,{sx:[S5.panel,{width:e.width??`100%`}],children:[(0,V.jsxs)(Jb,{value:+!!e.isSimulations,onChange:e.onChangeMode,variant:`fullWidth`,sx:S5.modeTabs,children:[(0,V.jsx)(Sb,{title:Y.t(`Calendars`),icon:(0,V.jsx)(ox,{})}),(0,V.jsx)(Sb,{title:Y.t(`Simulations`),icon:(0,V.jsx)(Lx,{})})]}),(0,V.jsxs)(Tm,{sx:S5.header,children:[(0,V.jsx)(Tm,{component:`div`,sx:S5.headerTitle,children:e.title}),e.alive===!1&&(0,V.jsx)(lb,{title:Y.t(`Instance inactive`),slotProps:{popper:{sx:S5.tooltip}},children:(0,V.jsx)(Tm,{component:`span`,sx:S5.alert,children:(0,V.jsx)(Vx,{})})}),(0,V.jsx)(lb,{title:e.addTitle,slotProps:{popper:{sx:S5.tooltip}},children:(0,V.jsx)(Pd,{size:`small`,sx:S5.addButton,onClick:e.onAdd,children:(0,V.jsx)(tx,{})})})]}),(0,V.jsx)(C_,{dense:!0,disablePadding:!0,sx:S5.list,children:e.children})]})}function w5(e){return(0,V.jsxs)(O_,{selected:e.selected,onClick:e.onClick,sx:S5.item,children:[e.icon?(0,V.jsx)(Cw,{src:e.icon,style:S5.icon}):e.color?(0,V.jsx)(Tm,{component:`span`,sx:S5.swatch,style:{backgroundColor:e.color}}):null,(0,V.jsx)(q_,{sx:S5.itemText,title:e.name,primary:e.name,slotProps:{primary:{noWrap:!0,sx:{fontSize:13,fontWeight:e.selected?600:400,opacity:e.inactive?.5:1}}}}),e.actions?(0,V.jsx)(Tm,{component:`span`,className:`actions`,sx:S5.actions,children:e.actions}):null,e.status?(0,V.jsx)(Tm,{component:`span`,sx:S5.actions,children:e.status}):null,e.count===void 0?null:(0,V.jsx)(lb,{title:Y.t(`Events`),slotProps:{popper:{sx:S5.tooltip}},children:(0,V.jsx)(Tm,{component:`span`,className:`count`,sx:S5.count,children:e.count})})]})}var T5=260,E5={container:{display:`flex`,width:`100%`,flex:1},toCalendar:{paddingLeft:20},simulations:e=>({backgroundColor:Ti(e.palette.primary.main,e.palette.mode===`dark`?.04:.05)}),tooltip:{pointerEvents:`none`}},D5=e=>{let[t,n]=(0,B.useState)([]),[r,i]=(0,B.useState)({}),[a,o]=(0,B.useState)(window.localStorage.getItem(`fullcalendar.selectedSimulation`)||null),[s,c]=(0,B.useState)(!1),[l,u]=(0,B.useState)(!1),[d,f]=(0,B.useState)(null),[p,m]=(0,B.useState)(null),h=(e,t)=>{t&&i(n=>({...n,[e]:t.val}))},g=(e,t)=>{n(n=>{let r=JSON.parse(JSON.stringify(n)),i=r.findIndex(t=>t._id===e);if(i===-1){if(!t)return n;r.push(t)}else t?r[i]=t:r.splice(i,1);return r})},_=async()=>{let r=await e.socket.getObjectViewSystem(`state`,`fullcalendar.${e.instance}.Simulations.`,`fullcalendar.${e.instance}.Simulations.\u9999`),s={};for(let t in r)s[t]=(await e.socket.getState(t))?.val;let c=Object.values(r);c.sort((e,t)=>e.common.name.localeCompare(t.common.name)),n(c),(!a||t.length&&!t.find(e=>e._id===a))&&o(t[0]?._id||null),i(s),e.socket.subscribeObject(`fullcalendar.${e.instance}.Simulations.*`,g),e.socket.subscribeState(`fullcalendar.${e.instance}.Simulations.*`,h)};(0,B.useEffect)(()=>(_().catch(()=>{}),()=>{e.socket.unsubscribeObject(`fullcalendar.${e.instance}.Simulations.*`,g),e.socket.unsubscribeState(`fullcalendar.${e.instance}.Simulations.*`,h)}),[]),(0,B.useEffect)(()=>{(!a||t.length&&!t.find(e=>e._id===a))&&o(t[0]?._id||null)},[t]);let v=async(t,n)=>{n||=await e.socket.getObject(t),n.native.record=n.native.record||{},n.native.record.start=Date.now(),n.native.record.end=n.native.interval===`day`?new Date(Date.now()+864e5):new Date(Date.now()+6048e5),await e.socket.setObject(t,n),e.socket.setState(t,`record`)},y=async(t,n)=>{let r=await e.socket.getObject(t);r.native.play=n,await e.socket.setObject(t,r),e.socket.setState(t,`play`)},b=(0,V.jsx)(`div`,{style:E5.toCalendar,children:(0,V.jsx)(lb,{title:Y.t(`You can export events to static calender`),slotProps:{popper:{sx:E5.tooltip}},children:(0,V.jsx)(Lm,{variant:`contained`,onClick:async()=>{let n=`fullcalendar.${e.instance}.Calendars.Calendar-${sU()}`;await e.socket.setObject(n,{type:`folder`,common:{name:`NewCalendar`},native:{}});let r=t.find(e=>e._id===a).native.events;for(let t of r){let r=JSON.parse(JSON.stringify(t));r.id=`${n}.event-${sU()}`,e.socket.setObject(r.id,r)}e.updateCalendars(),e.changeCalendarType(),e.setCalendarPrefix(n)},children:Y.t(`To calendar`)})})}),x=(a&&t.find(e=>e._id===a)?a:t[0]?._id)||``;return(0,V.jsxs)(Tm,{component:`div`,style:E5.container,sx:E5.simulations,children:[(0,V.jsxs)(`div`,{children:[d&&(0,V.jsx)(h5,{socket:e.socket,simulation:t.find(e=>e._id===d),onClose:()=>f(null),theme:e.theme,onDelete:async n=>{try{if(a===n){let e=t.find(e=>e._id!==n);o(e?._id||null)}await e.socket.delObject(n)}catch(e){window.alert(`Cannot delete simulation: ${e}`)}}}),p&&(0,V.jsx)(x5,{playSimulation:y,simulation:t.find(e=>e._id===p),onClose:()=>m(null)}),s&&(0,V.jsxs)(zh,{open:!0,maxWidth:`md`,onClose:(e,t)=>{t!==`backdropClick`&&t!==`escapeKeyDown`&&c(!1)},children:[(0,V.jsx)(ng,{id:`confirmation-dialog-title`,children:Y.t(`Start recording`)}),(0,V.jsx)(Yh,{children:(0,V.jsx)($h,{children:Y.t(`Do you want to delete previously recorded events?`)})}),(0,V.jsxs)(Uh,{children:[(0,V.jsx)(Lm,{variant:`contained`,onClick:async()=>{let t=await e.socket.getObject(s);t.native.events=[],await v(t._id,t),c(!1)},style:{backgroundColor:`red`,color:`white`},autoFocus:!0,startIcon:(0,V.jsx)(_x,{}),children:Y.t(`Delete events`)}),(0,V.jsx)(Lm,{variant:`contained`,onClick:async()=>{await v(s),c(!1)},color:`grey`,startIcon:(0,V.jsx)(lx,{}),children:Y.t(`Keep events`)})]})]}),l!==!1&&(0,V.jsx)(AS,{fullWidth:!1,title:Y.t(`Stop recording`),text:Y.t(`Do you want to stop recording? You cannot restart it again.`),ok:Y.t(`Stop`),onClose:t=>{t&&e.socket.setState(l,`stop`),u(!1)}}),(0,V.jsx)(C5,{isSimulations:!0,onChangeMode:e.changeCalendarType,title:Y.t(`Simulations`),addTitle:Y.t(`Create new simulation`),alive:e.alive,width:T5,onAdd:async()=>{let n=`fullcalendar.${e.instance}.Simulations.${sU()}`;await e.socket.setObject(n,{common:{name:Y.t(`Simulation %s`,t.length+1),role:`state`,type:`string`,states:[`stop`,`record`,`play`,`pause`],color:`#3A87AD`},native:{events:[],interval:`day`,record:{states:[],enums:[],start:null,end:null}},type:`state`}),await e.socket.setState(n,`stop`),window.localStorage.setItem(`fullcalendar.selectedSimulation`,n),setTimeout(()=>{o(n),f(n)},300)},children:t.map(t=>(0,V.jsx)(w5,{name:t.common.name||t._id,color:t.common.color,icon:t.common.icon,count:t.native.events?.length||0,selected:t._id===x,onClick:()=>{window.localStorage.setItem(`fullcalendar.selectedSimulation`,t._id),o(t._id)},actions:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(lb,{title:Y.t(`Edit name and settings`),slotProps:{popper:{sx:E5.tooltip}},children:(0,V.jsx)(Pd,{onClick:e=>{e.stopPropagation(),f(t._id)},size:`small`,children:(0,V.jsx)(bx,{})})}),r[t._id]===`stop`&&(0,V.jsx)(lb,{title:Y.t(`Start recording`),slotProps:{popper:{sx:E5.tooltip}},children:(0,V.jsx)(`span`,{children:(0,V.jsx)(Pd,{onClick:async e=>{e.stopPropagation(),t.native.events.length?c(t._id):await v(t._id)},size:`small`,children:(0,V.jsx)(Ex,{})})})}),r[t._id]===`stop`&&t.native.events.length>0&&(0,V.jsx)(lb,{title:Y.t(`Start playing`),slotProps:{popper:{sx:E5.tooltip}},children:(0,V.jsx)(`span`,{children:(0,V.jsx)(Pd,{onClick:e=>{e.stopPropagation(),m(t._id)},size:`small`,children:(0,V.jsx)(Fx,{})})})})]}),status:(0,V.jsxs)(V.Fragment,{children:[(r[t._id]===`record`||r[t._id]===`pause`)&&(0,V.jsx)(lb,{title:Y.t(`Stop recording. Recording till %s`,dU(t.native.record.end).format(`DD.MM.YYYY HH:mm:ss`)),slotProps:{popper:{sx:E5.tooltip}},children:(0,V.jsx)(`span`,{style:{opacity:r[t._id]===`pause`?.5:1},children:(0,V.jsx)(Pd,{disabled:r[t._id]===`pause`,onClick:e=>{e.stopPropagation(),u(t._id)},size:`small`,children:(0,V.jsx)(qx,{style:{color:`red`}})})})}),r[t._id]===`play`&&(0,V.jsx)(lb,{title:Y.t(`Stop playing`),slotProps:{popper:{sx:E5.tooltip}},children:(0,V.jsx)(`span`,{children:(0,V.jsx)(Pd,{onClick:n=>{n.stopPropagation(),e.socket.setState(t._id,`stop`)},size:`small`,children:(0,V.jsx)(qx,{style:{color:`green`}})})})}),r[t._id]===`record`&&(0,V.jsx)(lb,{title:Y.t(`Pause recording`),slotProps:{popper:{sx:E5.tooltip}},children:(0,V.jsx)(`span`,{children:(0,V.jsx)(Pd,{onClick:n=>{n.stopPropagation(),e.socket.setState(t._id,`pause`)},size:`small`,children:(0,V.jsx)(Nx,{})})})}),r[t._id]===`pause`&&(0,V.jsx)(lb,{title:Y.t(`Resume recording. Recording till %s`,dU(t.native.record.end).format(`DD.MM.YYYY HH:mm:ss`)),slotProps:{popper:{sx:E5.tooltip}},children:(0,V.jsx)(`span`,{children:(0,V.jsx)(Pd,{onClick:n=>{n.stopPropagation(),e.socket.setState(t._id,`record`)},size:`small`,children:(0,V.jsx)(Nx,{style:{color:`yellow`}})})})})]})},t._id))})]}),a&&(0,V.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,flex:1},children:(0,V.jsx)(d5,{systemConfig:e.systemConfig,socket:e.socket,isSimulation:!0,calendarPrefix:a,simulationId:a,simulation:t.find(e=>e._id===a),simulations:t,theme:e.theme,readOnly:r[a]===`play`,simulationState:r[a],button:b},a)})]})},O5={field:{display:`flex`,alignItems:`end`,gap:20},hint:{fontSize:12,fontStyle:`italic`}},k5=e=>{let[t,n]=(0,B.useState)(e.calendar),[r,i]=(0,B.useState)(!1);return t?(0,V.jsxs)(zh,{open:!0,onClose:e.onClose,children:[(0,V.jsx)(ng,{children:Y.t(`Edit calendar`)}),(0,V.jsxs)(Yh,{children:[(0,V.jsx)(`div`,{style:O5.field,children:(0,V.jsx)($b,{label:Y.t(`Name`),value:t.common.name||``,onChange:e=>{let r=JSON.parse(JSON.stringify(t));r.common.name=e.target.value,n(r)},variant:`standard`})}),(0,V.jsx)(`div`,{style:O5.field,children:(0,V.jsx)(Dg,{control:(0,V.jsx)(Zm,{checked:t.common.enabled!==!1,onChange:e=>{let r=JSON.parse(JSON.stringify(t));r.common.enabled=e.target.checked,n(r)}}),label:(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{children:Y.t(`Active`)}),(0,V.jsx)(`div`,{style:O5.hint,children:Y.t(`Inactive calendars do not execute their events`)})]})})})]}),(0,V.jsxs)(Uh,{children:[(0,V.jsx)(Lm,{variant:`contained`,color:`secondary`,startIcon:(0,V.jsx)(_x,{}),onClick:()=>i(!0),children:Y.t(`Delete`)}),(0,V.jsx)(Lm,{disabled:!t||!e.calendar||!t.common.name||t.common.name===e.calendar.common.name&&t.common.enabled!==!1==(e.calendar.common.enabled!==!1),onClick:async()=>{await e.socket.setObject(t._id,t),await e.updateCalendars(),e.onClose()},variant:`contained`,color:`primary`,startIcon:(0,V.jsx)(Ux,{}),children:Y.t(`Save`)}),(0,V.jsx)(Lm,{onClick:e.onClose,variant:`contained`,color:`grey`,startIcon:(0,V.jsx)(cx,{}),children:Y.t(`Cancel`)})]}),r&&(0,V.jsx)(AS,{fullWidth:!1,title:Y.t(`Delete calendar`),text:Y.t(`Calendar will be deleted. Confirm?`),ok:Y.t(`Delete`),onClose:async n=>{if(n){try{let n=Object.keys(await e.socket.getObjectViewCustom(`schedule`,`schedule`,`${t._id}.`,`${t._id}.\u9999`));await e.socket.delObject(t._id),await Promise.all(n.map(t=>e.socket.delObject(t))),e.calendarPrefix===t._id&&e.setCalendarPrefix(`fullcalendar.${e.instance}`),await e.updateCalendars()}catch(e){window.alert(`Cannot delete calendar: ${e}`)}e.onClose()}i(!1)}})]}):null},A5={column:{width:`100%`,display:`flex`,flexDirection:`column`,alignItems:`start`,height:`100%`},calendars:{height:`100%`},container:{display:`flex`,width:`100%`,flex:1},tooltip:{pointerEvents:`none`}},j5=e=>{let[t,n]=(0,B.useState)(window.localStorage.getItem(`fullcalendar.calendar`)||`fullcalendar.${e.instance}`),[r,i]=(0,B.useState)(null),[a,o]=(0,B.useState)([]),[s,c]=(0,B.useState)(window.localStorage.getItem(`fullcalendar.tab`)===`1`),[l,u]=(0,B.useState)(!1),[d,f]=(0,B.useState)(window.localStorage.getItem(`fullcalendar.splitSizes`)?JSON.parse(window.localStorage.getItem(`fullcalendar.splitSizes`)):[15,85]),p=async()=>{let r=await e.socket.getObjectViewSystem(`folder`,`fullcalendar.${e.instance}.Calendars.`,`fullcalendar.${e.instance}.Calendars.\u9999`);o(Object.values(r)),Object.keys(r).includes(t)||(window.localStorage.removeItem(`fullcalendar.calendar`),n(`fullcalendar.${e.instance}`))},m=async t=>{let n=JSON.parse(JSON.stringify(t));n.common.enabled=t.common.enabled===!1,await e.socket.setObject(n._id,n),await p()},h=()=>c(e=>(window.localStorage.setItem(`fullcalendar.tab`,e?`0`:`1`),!e));return(0,B.useEffect)(()=>{let t=(e,t)=>{let n=t&&t.val||!1;u(!!n)};return p().catch(e=>console.error(e)),e.socket.subscribeState(`system.adapter.fullcalendar.${e.instance}.alive`,t).catch(e=>console.error(e)),e.socket.getState(`system.adapter.fullcalendar.${e.instance}.alive`).then(e=>u(!!(e&&e.val))).catch(e=>console.error(e)),()=>{e.socket.unsubscribeState(`system.adapter.fullcalendar.${e.instance}.alive`,t)}},[]),(0,V.jsxs)(`div`,{style:A5.column,children:[s?(0,V.jsx)(D5,{systemConfig:e.systemConfig,socket:e.socket,theme:e.theme,instance:e.instance,updateCalendars:p,changeCalendarType:h,setCalendarPrefix:n,alive:l}):(0,V.jsx)(`div`,{style:A5.container,children:(0,V.jsxs)(dD,{direction:oD.Horizontal,initialSizes:d,minWidths:[195,500],onResizeFinished:(e,t)=>{f(t),window.localStorage.setItem(`fullcalendar.splitSizes`,JSON.stringify(t))},gutterTheme:e.themeType===`dark`?sD.Dark:sD.Light,gutterClassName:e.themeType===`dark`?`Dark visGutter`:`Light visGutter`,children:[(0,V.jsx)(`div`,{style:A5.calendars,children:(0,V.jsxs)(C5,{isSimulations:!1,onChangeMode:h,title:Y.t(`Calendars`),addTitle:Y.t(`Add new calendar`),alive:l,onAdd:async()=>{let t=`fullcalendar.${e.instance}.Calendars.Calendar-${sU()}`;await e.socket.setObject(t,{type:`folder`,common:{name:`NewCalendar`},native:{}}),await p(),n(t),window.localStorage.setItem(`fullcalendar.calendar`,t),setTimeout(()=>i(t),300)},children:[(0,V.jsx)(w5,{name:Y.t(`Default`),selected:!a.find(e=>e._id===t),onClick:()=>{let t=`fullcalendar.${e.instance}`;window.localStorage.setItem(`fullcalendar.calendar`,t),n(t)}}),a.map(e=>(0,V.jsx)(w5,{name:e.common.name,color:e.common.color,icon:e.common.icon,selected:e._id===t,inactive:e.common.enabled===!1,onClick:()=>{window.localStorage.setItem(`fullcalendar.calendar`,e._id),n(e._id)},status:e.common.enabled===!1?(0,V.jsx)(lb,{title:Y.t(`Calendar is inactive. Click to activate`),slotProps:{popper:{sx:A5.tooltip}},children:(0,V.jsx)(Pd,{size:`small`,onClick:t=>{t.stopPropagation(),m(e)},children:(0,V.jsx)(wx,{})})}):null,actions:(0,V.jsxs)(V.Fragment,{children:[e.common.enabled===!1?null:(0,V.jsx)(lb,{title:Y.t(`Deactivate calendar`),slotProps:{popper:{sx:A5.tooltip}},children:(0,V.jsx)(Pd,{size:`small`,onClick:t=>{t.stopPropagation(),m(e)},children:(0,V.jsx)(Cx,{})})}),(0,V.jsx)(lb,{title:Y.t(`Edit name or delete calendar`),slotProps:{popper:{sx:A5.tooltip}},children:(0,V.jsx)(Pd,{size:`small`,onClick:t=>{i(e._id),t.stopPropagation()},children:(0,V.jsx)(bx,{})})})]})},e._id))]})}),(0,V.jsx)(d5,{systemConfig:e.systemConfig,socket:e.socket,theme:e.theme,calendarPrefix:t},t)]})}),r?(0,V.jsx)(k5,{onClose:()=>i(null),calendarPrefix:t,setCalendarPrefix:n,calendar:a.find(e=>e._id===r),socket:e.socket,instance:e.instance,updateCalendars:p}):null]})},M5=class extends HS{constructor(e){let t={...e};t.translations={en:zE,de:BE,ru:VE,pt:HE,nl:UE,fr:WE,it:GE,es:KE,pl:qE,uk:JE,"zh-cn":YE},t.sentryDSN=window.sentryDSN,window.location.port,window.socketUrl&&window.socketUrl.startsWith(`:`)&&(window.socketUrl=`${window.location.protocol}//${window.location.hostname}${window.socketUrl}`),super(e,t)}render(){return this.state.loaded?(0,V.jsx)(Kt,{injectFirst:!0,children:(0,V.jsx)(qc,{theme:this.state.theme,children:(0,V.jsx)(`div`,{style:{overflow:`auto`,height:`100%`},id:`rootDiv`,children:(0,V.jsx)(j5,{systemConfig:this._systemConfig,socket:this.socket,theme:this.state.theme,instance:this.instance,alive:!!this.state.alive,themeType:this.state.themeType})})})}):(0,V.jsx)(Kt,{injectFirst:!0,children:(0,V.jsx)(qc,{theme:this.state.theme,children:(0,V.jsx)(pS,{themeType:this.state.themeType})})})}};window.location.hostname===`localhost`||window.location.hostname===`[::1]`||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/);function N5(){`serviceWorker`in navigator&&navigator.serviceWorker.ready.then(e=>{e.unregister()})}var P5={name:`fullcalendar-admin`,version:`3.2.0`,private:!0,dependencies:{"@emotion/react":`^11.14.0`,"@emotion/styled":`^11.14.1`,"@devbookhq/splitter":`^1.4.2`,"@fullcalendar/core":`^6.1.22`,"@fullcalendar/daygrid":`^6.1.22`,"@fullcalendar/interaction":`^6.1.22`,"@fullcalendar/list":`^6.1.22`,"@fullcalendar/react":`^6.1.22`,"@fullcalendar/rrule":`^6.1.22`,"@fullcalendar/timegrid":`^6.1.22`,"@iobroker/gui-components":`^10.3.14`,"@iobroker/type-detector":`^6.2.0`,"@material-icons/svg":`^1.0.33`,"@mui/icons-material":`^9.5.0`,"@mui/material":`^9.5.0`,"@mui/system":`^9.5.0`,"@mui/x-date-pickers":`^9.16.0`,"@sentry/browser":`^11.10.0`,"@vitejs/plugin-react":`^6.1.2`,dayjs:`^1.11.23`,moment:`^2.31.0`,react:`^19.3.1`,"react-ace":`^15.0.0`,"react-dnd":`^16.0.1`,"react-dnd-html5-backend":`^16.0.1`,"react-dnd-preview":`^9.0.0`,"react-dnd-touch-backend":`^16.0.1`,"react-dom":`^19.3.1`,"react-dropzone":`^20.1.4`,"react-icons":`^5.7.0`,rrule:`^2.8.1`,suncalc2:`^1.8.1`,vite:`^8.3.5`},scripts:{start:`vite --host`,build:`vite build`,lint:`eslint -c eslint.config.mjs`,"check-ts":`tsc --noEmit --checkJS false`,tsc:`tsc --project tsconfig.json`},eslintConfig:{extends:`react-app`},homepage:`.`,browserslist:[`>0.2%`,`not dead`,`not ie <= 11`,`not op_mini all`]},F5=e=>{let t=cl(e);return t&&(t.palette.text.danger={color:`#dd5325`},t.palette.text.success={color:`#73b6a8`},t)},I5=ES.getThemeName();window.adapterName=`fullcalendar`,console.log(`iobroker.${window.adapterName}@${P5.version} using theme "${I5}"`);function L5(e,t,n){let r=(e||``).split(` `).map(e=>e.trim()).filter(e=>e),i=r.indexOf(n);return i!==-1&&r.splice(i,1),!r.includes(t)&&r.push(t),r.join(` `)}var R5=()=>{let[e,t]=(0,B.useState)(I5),n=F5(e),r=()=>n,i=n.palette.mode;return(0,B.useEffect)(()=>{i===`dark`?window.document.body.className=L5(window.document.body.className,`body-dark`,`body-light`):window.document.body.className=L5(window.document.body.className,`body-light`,`body-dark`)},[i]),(0,V.jsx)(Kt,{injectFirst:!0,children:(0,V.jsx)(qc,{theme:r(),children:(0,V.jsx)(M5,{onThemeChange:e=>t(e)})})})};function z5(){let e=document.getElementById(`root`);(0,Jc.createRoot)(e).render((0,V.jsx)(R5,{}))}z5(),N5();
|
|
788
|
+
`}),(0,V.jsx)(ng,{children:Y.t(`Edit simulation`)}),(0,V.jsxs)(Yh,{children:[(0,V.jsxs)(`div`,{style:m5.field,children:[(0,V.jsx)($b,{label:Y.t(`Name`),value:t.common.name||``,onChange:e=>{let r=JSON.parse(JSON.stringify(t));r.common.name=e.target.value,n(r)},variant:`standard`}),(0,V.jsxs)(Cg,{variant:`standard`,children:[(0,V.jsx)(n_,{children:Y.t(`Interval`)}),(0,V.jsx)(By,{value:t.native.interval||``,onChange:e=>{let r=JSON.parse(JSON.stringify(t));r.native.interval=e.target.value,n(r)},variant:`standard`,children:[`day`,`week`].map(e=>(0,V.jsx)(Qv,{value:e,children:Y.t(e)},e))})]})]}),(0,V.jsx)(`div`,{style:m5.field,children:(0,V.jsx)(zC,{label:Y.t(`Default color`),value:t.common.color,onChange:e=>{let r=JSON.parse(JSON.stringify(t));r.common.color=e,n(r)}})}),(0,V.jsxs)(`h4`,{style:m5.headers,children:[Y.t(`States`),(0,V.jsx)(lb,{title:Y.t(`Add states for recording`),slotProps:{popper:{sx:m5.tooltip}},children:(0,V.jsx)(Pd,{style:!l.length&&t?.native?.record?.states?.length?m5.blink:void 0,size:`small`,onClick:()=>o(!0),color:`primary`,children:(0,V.jsx)(tx,{})})})]}),(0,V.jsx)(`div`,{children:t.native.record?.states.map((e,r)=>v(e,()=>{let e=JSON.parse(JSON.stringify(t));e.native.record.states.splice(r,1),n(e)}))}),(0,V.jsxs)(`h4`,{style:m5.headers,children:[Y.t(`Categories`),(0,V.jsx)(lb,{title:Y.t(`Add overlap of categories for recording`),slotProps:{popper:{sx:m5.tooltip}},children:(0,V.jsx)(Pd,{style:!l.length&&t?.native?.record?.states?.length?m5.blink:void 0,size:`small`,onClick:()=>c(!0),color:`primary`,children:(0,V.jsx)(tx,{})})})]}),(0,V.jsx)(`div`,{children:t.native.record?.enums.map((e,r)=>{let i=e.map(e=>(0,V.jsx)(LE,{value:d[e]||e,lang:Y.getLanguage()},e)),a=1,o=i.reduce((e,t)=>[e,(0,V.jsx)(`span`,{children:`+`},a++),t],null);return(0,V.jsx)(am,{onClick:()=>c(r),onDelete:()=>{let e=JSON.parse(JSON.stringify(t));e.native.record.enums.splice(r,1),n(e)},label:o,sx:{"& .MuiChip-label":m5.chipLabel},style:m5.chip},r)})}),(0,V.jsx)(`h4`,{style:{marginBottom:-0},children:Y.t(`Recorded states`)}),(0,V.jsxs)(`div`,{children:[h&&(0,V.jsx)(v_,{}),Object.keys(p).map(e=>v(e))]})]}),(0,V.jsxs)(Uh,{children:[(0,V.jsx)(Lm,{variant:`contained`,color:`secondary`,startIcon:(0,V.jsx)(_x,{}),onClick:()=>i(!0),children:Y.t(`Delete`)}),(0,V.jsx)(Lm,{disabled:y,onClick:async()=>{let n=JSON.parse(JSON.stringify(t));n.native.interval!==e.simulation.native.interval&&n.native.interval===`day`&&(console.log(n),n.native.events.forEach(e=>{console.log(e.native.cron);let t=ZH(e.native.cron);console.log(t),t.dows=[0,1,2,3,4,5,6],e.native.cron=$H(t),console.log(e.native.cron)})),await e.socket.setObject(t._id,n),e.onClose()},variant:`contained`,color:`primary`,startIcon:(0,V.jsx)(Ux,{}),children:Y.t(`Save`)}),(0,V.jsx)(Lm,{onClick:e.onClose,variant:`contained`,color:`grey`,startIcon:(0,V.jsx)(cx,{}),children:y?Y.t(`ra_Close`):Y.t(`ra_Cancel`)})]}),r&&(0,V.jsx)(AS,{fullWidth:!1,title:Y.t(`Delete simulation`),text:Y.t(`Simulation will be deleted. Confirm?`),ok:Y.t(`ra_Delete`),onClose:async n=>{n&&(await e.onDelete(t._id),e.onClose()),i(!1)}}),a&&(0,V.jsx)(RE,{imagePrefix:`../..`,multiSelect:!0,theme:e.theme,selected:t.native.record.states,onOk:e=>{let r=JSON.parse(JSON.stringify(t));r.native.record=r.native.record||{enums:[],states:[]},r.native.record.states=r.native.record.states||[],r.native.record.states=Array.isArray(e)?e:[e],n(r),o(!1)},onClose:()=>o(!1),socket:e.socket}),s===!1?null:(0,V.jsx)(p5,{socket:e.socket,enumsObjects:d,selectedEnums:typeof s==`number`?t.native.record.enums[s]:[],exceptions:t.native.record.enumsExceptions||[],onSelect:(e,r)=>{let i=JSON.parse(JSON.stringify(t));i.native.record=i.native.record||{enums:[],states:[]},i.native.record.enums=i.native.record.enums||[],i.native.record.enumsExceptions=r||[],typeof s==`number`?i.native.record.enums[s]=e:i.native.record.enums.push(e),n(i),c(!1)},onClose:()=>c(!1)})]})},g5={Y:`year`,YY:`year`,YYYY:{sectionType:`year`,contentType:`digit`,maxLength:4},M:{sectionType:`month`,contentType:`digit`,maxLength:2},MM:`month`,MMM:{sectionType:`month`,contentType:`letter`},MMMM:{sectionType:`month`,contentType:`letter`},D:{sectionType:`day`,contentType:`digit`,maxLength:2},DD:`day`,Do:{sectionType:`day`,contentType:`digit-with-letter`},E:{sectionType:`weekDay`,contentType:`digit`,maxLength:1},e:{sectionType:`weekDay`,contentType:`digit`,maxLength:1},d:{sectionType:`weekDay`,contentType:`digit`,maxLength:1},dd:{sectionType:`weekDay`,contentType:`letter`},ddd:{sectionType:`weekDay`,contentType:`letter`},dddd:{sectionType:`weekDay`,contentType:`letter`},A:`meridiem`,a:`meridiem`,H:{sectionType:`hours`,contentType:`digit`,maxLength:2},HH:`hours`,h:{sectionType:`hours`,contentType:`digit`,maxLength:2},hh:`hours`,k:{sectionType:`hours`,contentType:`digit`,maxLength:2},kk:`hours`,m:{sectionType:`minutes`,contentType:`digit`,maxLength:2},mm:`minutes`,s:{sectionType:`seconds`,contentType:`digit`,maxLength:2},ss:`seconds`},_5={year:`YYYY`,month:`MMMM`,monthShort:`MMM`,dayOfMonth:`D`,dayOfMonthFull:`Do`,weekday:`dddd`,weekdayShort:`ddd`,hours24h:`HH`,hours12h:`hh`,meridiem:`A`,minutes:`mm`,seconds:`ss`,fullDate:`ll`,keyboardDate:`L`,shortDate:`MMM D`,normalDate:`D MMMM`,normalDateWithWeekday:`ddd, MMM D`,fullTime12h:`hh:mm A`,fullTime24h:`HH:mm`,keyboardDateTime12h:`L hh:mm A`,keyboardDateTime24h:`L HH:mm`};function v5(){throw Error(BX(140))}var y5=class{isMUIAdapter=!0;isTimezoneCompatible=!0;lib=`moment`;escapedCharacters={start:`[`,end:`]`};formatTokenMap=g5;constructor({locale:e,formats:t,instance:n}={}){this.moment=n||dU,this.locale=e,this.formats=b({},_5,t)}setLocaleToValue=e=>{let t=this.getCurrentLocaleCode();return t===e.locale()?e:e.locale(t)};hasTimezonePlugin=()=>this.moment.tz!==void 0;createSystemDate=e=>{let t=this.moment(e).local();return this.locale===void 0?t:t.locale(this.locale)};createUTCDate=e=>{let t=this.moment.utc(e);return this.locale===void 0?t:t.locale(this.locale)};createTZDate=(e,t)=>{this.hasTimezonePlugin()||v5();let n=t==="default"?this.moment(e):this.moment.tz(e,t);return this.locale===void 0?n:n.locale(this.locale)};date=(e,t=`default`)=>e===null?null:t===`UTC`?this.createUTCDate(e):t===`system`||t==="default"&&!this.hasTimezonePlugin()?this.createSystemDate(e):this.createTZDate(e,t);getInvalidDate=()=>this.moment(new Date(`Invalid Date`));getTimezone=e=>{let t=e._z?.name,n=e.isUTC()?`UTC`:`system`;return t??this.moment.defaultZone?.name??n};setTimezone=(e,t)=>{if(this.getTimezone(e)===t)return e;if(t===`UTC`)return e.clone().utc();if(t===`system`)return e.clone().local();if(!this.hasTimezonePlugin())return t!=="default"&&v5(),e;let n=t==="default"?this.moment.defaultZone?.name??`system`:t;if(n===`system`)return e.clone().local();let r=e.clone();return r.tz(n),r};toJsDate=e=>e.toDate();parse=(e,t)=>e===``?null:this.locale?this.moment(e,t,this.locale,!0):this.moment(e,t,!0);getCurrentLocaleCode=()=>this.locale||dU.locale();is12HourCycleInCurrentLocale=()=>/A|a/.test(dU.localeData(this.getCurrentLocaleCode()).longDateFormat(`LT`));expandFormat=e=>e.match(/(\[[^[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})|./g).map(e=>{let t=e[0];return t===`L`||t===`;`?dU.localeData(this.getCurrentLocaleCode()).longDateFormat(e):e}).join(``);isValid=e=>e!=null&&e.isValid();format=(e,t)=>this.formatByString(e,this.formats[t]);formatByString=(e,t)=>{let n=e.clone();return n.locale(this.getCurrentLocaleCode()),n.format(t)};formatNumber=e=>e;isEqual=(e,t)=>e===null&&t===null?!0:e===null||t===null?!1:e.isSame(t);isSameYear=(e,t)=>e.isSame(t,`year`);isSameMonth=(e,t)=>e.isSame(t,`month`);isSameDay=(e,t)=>e.isSame(t,`day`);isSameHour=(e,t)=>e.isSame(t,`hour`);isAfter=(e,t)=>e.isAfter(t);isAfterYear=(e,t)=>e.isAfter(t,`year`);isAfterDay=(e,t)=>e.isAfter(t,`day`);isBefore=(e,t)=>e.isBefore(t);isBeforeYear=(e,t)=>e.isBefore(t,`year`);isBeforeDay=(e,t)=>e.isBefore(t,`day`);isWithinRange=(e,[t,n])=>e.isBetween(t,n,null,`[]`);startOfYear=e=>e.clone().startOf(`year`);startOfMonth=e=>e.clone().startOf(`month`);startOfWeek=e=>this.setLocaleToValue(e.clone()).startOf(`week`);startOfDay=e=>e.clone().startOf(`day`);endOfYear=e=>e.clone().endOf(`year`);endOfMonth=e=>e.clone().endOf(`month`);endOfWeek=e=>this.setLocaleToValue(e.clone()).endOf(`week`);endOfDay=e=>e.clone().endOf(`day`);addYears=(e,t)=>t<0?e.clone().subtract(Math.abs(t),`years`):e.clone().add(t,`years`);addMonths=(e,t)=>t<0?e.clone().subtract(Math.abs(t),`months`):e.clone().add(t,`months`);addWeeks=(e,t)=>t<0?e.clone().subtract(Math.abs(t),`weeks`):e.clone().add(t,`weeks`);addDays=(e,t)=>t<0?e.clone().subtract(Math.abs(t),`days`):e.clone().add(t,`days`);addHours=(e,t)=>t<0?e.clone().subtract(Math.abs(t),`hours`):e.clone().add(t,`hours`);addMinutes=(e,t)=>t<0?e.clone().subtract(Math.abs(t),`minutes`):e.clone().add(t,`minutes`);addSeconds=(e,t)=>t<0?e.clone().subtract(Math.abs(t),`seconds`):e.clone().add(t,`seconds`);getYear=e=>e.get(`year`);getMonth=e=>e.get(`month`);getDate=e=>e.get(`date`);getHours=e=>e.get(`hours`);getMinutes=e=>e.get(`minutes`);getSeconds=e=>e.get(`seconds`);getMilliseconds=e=>e.get(`milliseconds`);setYear=(e,t)=>e.clone().year(t);setMonth=(e,t)=>e.clone().month(t);setDate=(e,t)=>e.clone().date(t);setHours=(e,t)=>e.clone().hours(t);setMinutes=(e,t)=>e.clone().minutes(t);setSeconds=(e,t)=>e.clone().seconds(t);setMilliseconds=(e,t)=>e.clone().milliseconds(t);getDaysInMonth=e=>e.daysInMonth();getWeekArray=e=>{let t=this.startOfWeek(this.startOfMonth(e)),n=this.endOfWeek(this.endOfMonth(e)),r=0,i=t,a=i.get(`dayOfYear`),o=[];for(;i.isBefore(n);){let e=Math.floor(r/7);o[e]=o[e]||[],o[e].push(i);let t=a;i=this.addDays(i,1),a=i.get(`dayOfYear`),t===a&&(i=i.add(12,`h`).startOf(`day`)),r+=1}return o};getWeekNumber=e=>e.week();getDayOfWeek=e=>e.day()+1;getYearRange([e,t]){let n=this.startOfYear(e),r=this.endOfYear(t),i=[],a=n;for(;this.isBefore(a,r);)i.push(a),a=this.addYears(a,1);return i}},b5={field:{"& .MuiFormControl-root":{width:`100%`},display:`flex`,alignItems:`end`,gap:`20px`},tableCell:{textAlign:`center`}},x5=e=>{let[t,n]=(0,B.useState)({start:null,end:null,dow:[0,1,2,3,4,5,6]});return dU.locale(Y.getLanguage()),(0,V.jsxs)(zh,{open:!0,onClose:e.onClose,children:[(0,V.jsx)(ng,{children:Y.t(`Play simulation`)}),(0,V.jsxs)(Yh,{children:[(0,V.jsxs)(qX,{dateAdapter:y5,children:[(0,V.jsxs)(Tm,{component:`div`,sx:b5.field,style:{width:`100%`,marginBottom:20,marginTop:10},children:[(0,V.jsx)(M8,{label:`Start`,sx:e=>({borderBottom:`1px solid ${e.palette.text.primary}`,"& fieldset":{display:`none`},"& input":{padding:`${e.spacing(1.5)} 0 4px 0`},"& .MuiInputAdornment-root":{marginLeft:0,marginTop:1},"& label":{transform:`translate(0px, -9px) scale(0.75)`},"&.MuiTextField-root":{width:`100%`}}),value:t.start,onChange:e=>n({...t,start:e})}),t.start&&(0,V.jsx)(Pd,{onClick:()=>n({...t,start:null}),children:(0,V.jsx)(_x,{})})]}),(0,V.jsxs)(Tm,{component:`div`,sx:b5.field,style:{width:`100%`,marginBottom:30},children:[(0,V.jsx)(M8,{label:`End`,sx:e=>({borderBottom:`1px solid ${e.palette.text.primary}`,"& fieldset":{display:`none`},"& input":{padding:`${e.spacing(1.5)} 0 4px 0`},"& .MuiInputAdornment-root":{marginLeft:0,marginTop:1},"& label":{transform:`translate(0px, -9px) scale(0.75)`}}),value:t.end,onChange:e=>n({...t,end:e})}),t.end&&(0,V.jsx)(Pd,{onClick:()=>n({...t,end:null}),children:(0,V.jsx)(_x,{})})]})]}),(0,V.jsx)(`div`,{children:(0,V.jsxs)(`table`,{children:[(0,V.jsx)(`thead`,{children:(0,V.jsx)(`tr`,{children:[0,1,2,3,4,5,6].map(e=>(0,V.jsx)(`td`,{style:b5.tableCell,children:dU().day(e).format(`ddd`)},e))})}),(0,V.jsx)(`tbody`,{children:(0,V.jsx)(`tr`,{children:[0,1,2,3,4,5,6].map(r=>(0,V.jsx)(`td`,{children:(0,V.jsx)(Zm,{"aria-label":`play simulation`,checked:t.dow.includes(r),disabled:e.readOnly,onChange:e=>{e.target.checked?n({...t,dow:[...t.dow,r]}):n({...t,dow:t.dow.filter(e=>e!==r)})},size:`small`})},r))})})]})})]}),(0,V.jsxs)(Uh,{children:[(0,V.jsx)(Lm,{onClick:()=>{e.playSimulation(e.simulation._id,t),e.onClose()},variant:`contained`,color:`primary`,startIcon:(0,V.jsx)(Ix,{}),children:Y.t(`Play`)}),(0,V.jsx)(Lm,{onClick:e.onClose,variant:`contained`,color:`grey`,startIcon:(0,V.jsx)(cx,{}),children:Y.t(`Cancel`)})]})]})},S5={panel:e=>({height:`100%`,display:`flex`,flexDirection:`column`,borderRadius:0,borderRight:`1px solid ${e.palette.divider}`,overflow:`hidden`}),modeTabs:{flexShrink:0,minHeight:42,"& .MuiTab-root":{minHeight:42,minWidth:0,flex:1,padding:`0 8px`}},header:e=>({flexShrink:0,display:`flex`,alignItems:`center`,gap:1,minHeight:44,padding:`6px 6px 6px 12px`,borderBottom:`1px solid ${e.palette.divider}`}),headerTitle:e=>({flexGrow:1,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,fontSize:11,fontWeight:600,letterSpacing:`0.08em`,textTransform:`uppercase`,color:e.palette.text.secondary}),addButton:e=>({flexShrink:0,width:28,height:28,color:e.palette.primary.contrastText||`#fff`,backgroundColor:e.palette.primary.main,"&:hover":{color:e.palette.primary.contrastText||`#fff`,backgroundColor:e.palette.primary.dark},"& .MuiSvgIcon-root":{fontSize:18}}),alert:e=>({display:`flex`,flexShrink:0,color:e.palette.error.main,"& .MuiSvgIcon-root":{fontSize:18}}),list:{flex:1,overflowY:`auto`,overflowX:`hidden`,padding:`6px`},item:e=>({gap:1,minHeight:34,paddingTop:`3px`,paddingBottom:`3px`,paddingLeft:`8px`,paddingRight:`4px`,marginBottom:`2px`,"& .actions":{opacity:0,transition:`opacity 0.15s ease-in-out`},"&:hover .actions, &.Mui-focusVisible .actions, &.Mui-selected .actions":{opacity:1},"&.Mui-selected .MuiIconButton-root":{color:`inherit`},"&.Mui-selected .count":{backgroundColor:`rgba(255, 255, 255, 0.22)`,color:`inherit`},...e.name?.startsWith(`modern`)?void 0:{"&.Mui-selected":{backgroundColor:e.palette.primary.main,color:e.palette.primary.contrastText,"&:hover":{backgroundColor:e.palette.primary.dark}}}}),itemText:{margin:0,overflow:`hidden`},swatch:{flexShrink:0,width:10,height:10,borderRadius:`3px`,boxShadow:`inset 0 0 0 1px rgba(0, 0, 0, 0.25)`},icon:{flexShrink:0,width:16,height:16},actions:{display:`flex`,alignItems:`center`,flexShrink:0,"& .MuiIconButton-root":{padding:`4px`},"& .MuiSvgIcon-root":{fontSize:18}},count:e=>({flexShrink:0,minWidth:20,height:18,padding:`0 5px`,borderRadius:`9px`,fontSize:10,fontWeight:600,lineHeight:`18px`,textAlign:`center`,backgroundColor:Ti(e.palette.text.primary,.08),color:e.palette.text.secondary}),tooltip:{pointerEvents:`none`}};function C5(e){return(0,V.jsxs)(vu,{sx:[S5.panel,{width:e.width??`100%`}],children:[(0,V.jsxs)(Jb,{value:+!!e.isSimulations,onChange:e.onChangeMode,variant:`fullWidth`,sx:S5.modeTabs,children:[(0,V.jsx)(Sb,{title:Y.t(`Calendars`),icon:(0,V.jsx)(ox,{})}),(0,V.jsx)(Sb,{title:Y.t(`Simulations`),icon:(0,V.jsx)(Lx,{})})]}),(0,V.jsxs)(Tm,{sx:S5.header,children:[(0,V.jsx)(Tm,{component:`div`,sx:S5.headerTitle,children:e.title}),e.alive===!1&&(0,V.jsx)(lb,{title:Y.t(`Instance inactive`),slotProps:{popper:{sx:S5.tooltip}},children:(0,V.jsx)(Tm,{component:`span`,sx:S5.alert,children:(0,V.jsx)(Vx,{})})}),(0,V.jsx)(lb,{title:e.addTitle,slotProps:{popper:{sx:S5.tooltip}},children:(0,V.jsx)(Pd,{size:`small`,sx:S5.addButton,onClick:e.onAdd,children:(0,V.jsx)(tx,{})})})]}),(0,V.jsx)(C_,{dense:!0,disablePadding:!0,sx:S5.list,children:e.children})]})}function w5(e){return(0,V.jsxs)(O_,{selected:e.selected,onClick:e.onClick,sx:S5.item,children:[e.icon?(0,V.jsx)(Cw,{src:e.icon,style:S5.icon}):e.color?(0,V.jsx)(Tm,{component:`span`,sx:S5.swatch,style:{backgroundColor:e.color}}):null,(0,V.jsx)(q_,{sx:S5.itemText,title:e.name,primary:e.name,slotProps:{primary:{noWrap:!0,sx:{fontSize:13,fontWeight:e.selected?600:400,opacity:e.inactive?.5:1}}}}),e.actions?(0,V.jsx)(Tm,{component:`span`,className:`actions`,sx:S5.actions,children:e.actions}):null,e.status?(0,V.jsx)(Tm,{component:`span`,sx:S5.actions,children:e.status}):null,e.count===void 0?null:(0,V.jsx)(lb,{title:Y.t(`Events`),slotProps:{popper:{sx:S5.tooltip}},children:(0,V.jsx)(Tm,{component:`span`,className:`count`,sx:S5.count,children:e.count})})]})}var T5=260,E5={container:{display:`flex`,width:`100%`,flex:1},toCalendar:{paddingLeft:20},simulations:e=>({backgroundColor:Ti(e.palette.primary.main,e.palette.mode===`dark`?.04:.05)}),tooltip:{pointerEvents:`none`}},D5=e=>{let[t,n]=(0,B.useState)([]),[r,i]=(0,B.useState)({}),[a,o]=(0,B.useState)(window.localStorage.getItem(`fullcalendar.selectedSimulation`)||null),[s,c]=(0,B.useState)(!1),[l,u]=(0,B.useState)(!1),[d,f]=(0,B.useState)(null),[p,m]=(0,B.useState)(null),h=(e,t)=>{t&&i(n=>({...n,[e]:t.val}))},g=(e,t)=>{n(n=>{let r=JSON.parse(JSON.stringify(n)),i=r.findIndex(t=>t._id===e);if(i===-1){if(!t)return n;r.push(t)}else t?r[i]=t:r.splice(i,1);return r})},_=async()=>{let r=await e.socket.getObjectViewSystem(`state`,`fullcalendar.${e.instance}.Simulations.`,`fullcalendar.${e.instance}.Simulations.\u9999`),s={};for(let t in r)s[t]=(await e.socket.getState(t))?.val;let c=Object.values(r);c.sort((e,t)=>e.common.name.localeCompare(t.common.name)),n(c),(!a||t.length&&!t.find(e=>e._id===a))&&o(t[0]?._id||null),i(s),e.socket.subscribeObject(`fullcalendar.${e.instance}.Simulations.*`,g),e.socket.subscribeState(`fullcalendar.${e.instance}.Simulations.*`,h)};(0,B.useEffect)(()=>(_().catch(()=>{}),()=>{e.socket.unsubscribeObject(`fullcalendar.${e.instance}.Simulations.*`,g),e.socket.unsubscribeState(`fullcalendar.${e.instance}.Simulations.*`,h)}),[]),(0,B.useEffect)(()=>{(!a||t.length&&!t.find(e=>e._id===a))&&o(t[0]?._id||null)},[t]);let v=async(t,n)=>{n||=await e.socket.getObject(t),n.native.record=n.native.record||{},n.native.record.start=Date.now(),n.native.record.end=n.native.interval===`day`?new Date(Date.now()+864e5):new Date(Date.now()+6048e5),await e.socket.setObject(t,n),e.socket.setState(t,`record`)},y=async(t,n)=>{let r=await e.socket.getObject(t);r.native.play=n,await e.socket.setObject(t,r),e.socket.setState(t,`play`)},b=(0,V.jsx)(`div`,{style:E5.toCalendar,children:(0,V.jsx)(lb,{title:Y.t(`You can export events to static calender`),slotProps:{popper:{sx:E5.tooltip}},children:(0,V.jsx)(Lm,{variant:`contained`,onClick:async()=>{let n=`fullcalendar.${e.instance}.Calendars.Calendar-${sU()}`;await e.socket.setObject(n,{type:`folder`,common:{name:`NewCalendar`},native:{}});let r=t.find(e=>e._id===a).native.events;for(let t of r){let r=JSON.parse(JSON.stringify(t));r.id=`${n}.event-${sU()}`,e.socket.setObject(r.id,r)}e.updateCalendars(),e.changeCalendarType(),e.setCalendarPrefix(n)},children:Y.t(`To calendar`)})})}),x=(a&&t.find(e=>e._id===a)?a:t[0]?._id)||``;return(0,V.jsxs)(Tm,{component:`div`,style:E5.container,sx:E5.simulations,children:[(0,V.jsxs)(`div`,{children:[d&&(0,V.jsx)(h5,{socket:e.socket,simulation:t.find(e=>e._id===d),onClose:()=>f(null),theme:e.theme,onDelete:async n=>{try{if(a===n){let e=t.find(e=>e._id!==n);o(e?._id||null)}await e.socket.delObject(n)}catch(e){window.alert(`Cannot delete simulation: ${e}`)}}}),p&&(0,V.jsx)(x5,{playSimulation:y,simulation:t.find(e=>e._id===p),onClose:()=>m(null)}),s&&(0,V.jsxs)(zh,{open:!0,maxWidth:`md`,onClose:(e,t)=>{t!==`backdropClick`&&t!==`escapeKeyDown`&&c(!1)},children:[(0,V.jsx)(ng,{id:`confirmation-dialog-title`,children:Y.t(`Start recording`)}),(0,V.jsx)(Yh,{children:(0,V.jsx)($h,{children:Y.t(`Do you want to delete previously recorded events?`)})}),(0,V.jsxs)(Uh,{children:[(0,V.jsx)(Lm,{variant:`contained`,onClick:async()=>{let t=await e.socket.getObject(s);t.native.events=[],await v(t._id,t),c(!1)},style:{backgroundColor:`red`,color:`white`},autoFocus:!0,startIcon:(0,V.jsx)(_x,{}),children:Y.t(`Delete events`)}),(0,V.jsx)(Lm,{variant:`contained`,onClick:async()=>{await v(s),c(!1)},color:`grey`,startIcon:(0,V.jsx)(lx,{}),children:Y.t(`Keep events`)})]})]}),l!==!1&&(0,V.jsx)(AS,{fullWidth:!1,title:Y.t(`Stop recording`),text:Y.t(`Do you want to stop recording? You cannot restart it again.`),ok:Y.t(`Stop`),onClose:t=>{t&&e.socket.setState(l,`stop`),u(!1)}}),(0,V.jsx)(C5,{isSimulations:!0,onChangeMode:e.changeCalendarType,title:Y.t(`Simulations`),addTitle:Y.t(`Create new simulation`),alive:e.alive,width:T5,onAdd:async()=>{let n=`fullcalendar.${e.instance}.Simulations.${sU()}`;await e.socket.setObject(n,{common:{name:Y.t(`Simulation %s`,t.length+1),role:`state`,type:`string`,states:[`stop`,`record`,`play`,`pause`],color:`#3A87AD`},native:{events:[],interval:`day`,record:{states:[],enums:[],start:null,end:null}},type:`state`}),await e.socket.setState(n,`stop`),window.localStorage.setItem(`fullcalendar.selectedSimulation`,n),setTimeout(()=>{o(n),f(n)},300)},children:t.map(t=>(0,V.jsx)(w5,{name:t.common.name||t._id,color:t.common.color,icon:t.common.icon,count:t.native.events?.length||0,selected:t._id===x,onClick:()=>{window.localStorage.setItem(`fullcalendar.selectedSimulation`,t._id),o(t._id)},actions:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(lb,{title:Y.t(`Edit name and settings`),slotProps:{popper:{sx:E5.tooltip}},children:(0,V.jsx)(Pd,{onClick:e=>{e.stopPropagation(),f(t._id)},size:`small`,children:(0,V.jsx)(bx,{})})}),r[t._id]===`stop`&&(0,V.jsx)(lb,{title:Y.t(`Start recording`),slotProps:{popper:{sx:E5.tooltip}},children:(0,V.jsx)(`span`,{children:(0,V.jsx)(Pd,{onClick:async e=>{e.stopPropagation(),t.native.events.length?c(t._id):await v(t._id)},size:`small`,children:(0,V.jsx)(Ex,{})})})}),r[t._id]===`stop`&&t.native.events.length>0&&(0,V.jsx)(lb,{title:Y.t(`Start playing`),slotProps:{popper:{sx:E5.tooltip}},children:(0,V.jsx)(`span`,{children:(0,V.jsx)(Pd,{onClick:e=>{e.stopPropagation(),m(t._id)},size:`small`,children:(0,V.jsx)(Fx,{})})})})]}),status:(0,V.jsxs)(V.Fragment,{children:[(r[t._id]===`record`||r[t._id]===`pause`)&&(0,V.jsx)(lb,{title:Y.t(`Stop recording. Recording till %s`,dU(t.native.record.end).format(`DD.MM.YYYY HH:mm:ss`)),slotProps:{popper:{sx:E5.tooltip}},children:(0,V.jsx)(`span`,{style:{opacity:r[t._id]===`pause`?.5:1},children:(0,V.jsx)(Pd,{disabled:r[t._id]===`pause`,onClick:e=>{e.stopPropagation(),u(t._id)},size:`small`,children:(0,V.jsx)(qx,{style:{color:`red`}})})})}),r[t._id]===`play`&&(0,V.jsx)(lb,{title:Y.t(`Stop playing`),slotProps:{popper:{sx:E5.tooltip}},children:(0,V.jsx)(`span`,{children:(0,V.jsx)(Pd,{onClick:n=>{n.stopPropagation(),e.socket.setState(t._id,`stop`)},size:`small`,children:(0,V.jsx)(qx,{style:{color:`green`}})})})}),r[t._id]===`record`&&(0,V.jsx)(lb,{title:Y.t(`Pause recording`),slotProps:{popper:{sx:E5.tooltip}},children:(0,V.jsx)(`span`,{children:(0,V.jsx)(Pd,{onClick:n=>{n.stopPropagation(),e.socket.setState(t._id,`pause`)},size:`small`,children:(0,V.jsx)(Nx,{})})})}),r[t._id]===`pause`&&(0,V.jsx)(lb,{title:Y.t(`Resume recording. Recording till %s`,dU(t.native.record.end).format(`DD.MM.YYYY HH:mm:ss`)),slotProps:{popper:{sx:E5.tooltip}},children:(0,V.jsx)(`span`,{children:(0,V.jsx)(Pd,{onClick:n=>{n.stopPropagation(),e.socket.setState(t._id,`record`)},size:`small`,children:(0,V.jsx)(Nx,{style:{color:`yellow`}})})})})]})},t._id))})]}),a&&(0,V.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,flex:1},children:(0,V.jsx)(d5,{systemConfig:e.systemConfig,socket:e.socket,isSimulation:!0,calendarPrefix:a,simulationId:a,simulation:t.find(e=>e._id===a),simulations:t,theme:e.theme,readOnly:r[a]===`play`,simulationState:r[a],button:b},a)})]})},O5={field:{display:`flex`,alignItems:`end`,gap:20},hint:{fontSize:12,fontStyle:`italic`}},k5=e=>{let[t,n]=(0,B.useState)(e.calendar),[r,i]=(0,B.useState)(!1);return t?(0,V.jsxs)(zh,{open:!0,onClose:e.onClose,children:[(0,V.jsx)(ng,{children:Y.t(`Edit calendar`)}),(0,V.jsxs)(Yh,{children:[(0,V.jsx)(`div`,{style:O5.field,children:(0,V.jsx)($b,{label:Y.t(`Name`),value:t.common.name||``,onChange:e=>{let r=JSON.parse(JSON.stringify(t));r.common.name=e.target.value,n(r)},variant:`standard`})}),(0,V.jsx)(`div`,{style:O5.field,children:(0,V.jsx)(Dg,{control:(0,V.jsx)(Zm,{checked:t.common.enabled!==!1,onChange:e=>{let r=JSON.parse(JSON.stringify(t));r.common.enabled=e.target.checked,n(r)}}),label:(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{children:Y.t(`Active`)}),(0,V.jsx)(`div`,{style:O5.hint,children:Y.t(`Inactive calendars do not execute their events`)})]})})})]}),(0,V.jsxs)(Uh,{children:[(0,V.jsx)(Lm,{variant:`contained`,color:`secondary`,startIcon:(0,V.jsx)(_x,{}),onClick:()=>i(!0),children:Y.t(`Delete`)}),(0,V.jsx)(Lm,{disabled:!t||!e.calendar||!t.common.name||t.common.name===e.calendar.common.name&&t.common.enabled!==!1==(e.calendar.common.enabled!==!1),onClick:async()=>{await e.socket.setObject(t._id,t),await e.updateCalendars(),e.onClose()},variant:`contained`,color:`primary`,startIcon:(0,V.jsx)(Ux,{}),children:Y.t(`Save`)}),(0,V.jsx)(Lm,{onClick:e.onClose,variant:`contained`,color:`grey`,startIcon:(0,V.jsx)(cx,{}),children:Y.t(`Cancel`)})]}),r&&(0,V.jsx)(AS,{fullWidth:!1,title:Y.t(`Delete calendar`),text:Y.t(`Calendar will be deleted. Confirm?`),ok:Y.t(`Delete`),onClose:async n=>{if(n){try{let n=Object.keys(await e.socket.getObjectViewCustom(`schedule`,`schedule`,`${t._id}.`,`${t._id}.\u9999`));await e.socket.delObject(t._id),await Promise.all(n.map(t=>e.socket.delObject(t))),e.calendarPrefix===t._id&&e.setCalendarPrefix(`fullcalendar.${e.instance}`),await e.updateCalendars()}catch(e){window.alert(`Cannot delete calendar: ${e}`)}e.onClose()}i(!1)}})]}):null},A5={column:{width:`100%`,display:`flex`,flexDirection:`column`,alignItems:`start`,height:`100%`},calendars:{height:`100%`},container:{display:`flex`,width:`100%`,flex:1},tooltip:{pointerEvents:`none`}},j5=e=>{let[t,n]=(0,B.useState)(window.localStorage.getItem(`fullcalendar.calendar`)||`fullcalendar.${e.instance}`),[r,i]=(0,B.useState)(null),[a,o]=(0,B.useState)([]),[s,c]=(0,B.useState)(window.localStorage.getItem(`fullcalendar.tab`)===`1`),[l,u]=(0,B.useState)(!1),[d,f]=(0,B.useState)(window.localStorage.getItem(`fullcalendar.splitSizes`)?JSON.parse(window.localStorage.getItem(`fullcalendar.splitSizes`)):[15,85]),p=async()=>{let r=await e.socket.getObjectViewSystem(`folder`,`fullcalendar.${e.instance}.Calendars.`,`fullcalendar.${e.instance}.Calendars.\u9999`);o(Object.values(r)),Object.keys(r).includes(t)||(window.localStorage.removeItem(`fullcalendar.calendar`),n(`fullcalendar.${e.instance}`))},m=async t=>{let n=JSON.parse(JSON.stringify(t));n.common.enabled=t.common.enabled===!1,await e.socket.setObject(n._id,n),await p()},h=()=>c(e=>(window.localStorage.setItem(`fullcalendar.tab`,e?`0`:`1`),!e));return(0,B.useEffect)(()=>{let t=(e,t)=>{let n=t&&t.val||!1;u(!!n)};return p().catch(e=>console.error(e)),e.socket.subscribeState(`system.adapter.fullcalendar.${e.instance}.alive`,t).catch(e=>console.error(e)),e.socket.getState(`system.adapter.fullcalendar.${e.instance}.alive`).then(e=>u(!!(e&&e.val))).catch(e=>console.error(e)),()=>{e.socket.unsubscribeState(`system.adapter.fullcalendar.${e.instance}.alive`,t)}},[]),(0,V.jsxs)(`div`,{style:A5.column,children:[s?(0,V.jsx)(D5,{systemConfig:e.systemConfig,socket:e.socket,theme:e.theme,instance:e.instance,updateCalendars:p,changeCalendarType:h,setCalendarPrefix:n,alive:l}):(0,V.jsx)(`div`,{style:A5.container,children:(0,V.jsxs)(dD,{direction:oD.Horizontal,initialSizes:d,minWidths:[195,500],onResizeFinished:(e,t)=>{f(t),window.localStorage.setItem(`fullcalendar.splitSizes`,JSON.stringify(t))},gutterTheme:e.themeType===`dark`?sD.Dark:sD.Light,gutterClassName:e.themeType===`dark`?`Dark visGutter`:`Light visGutter`,children:[(0,V.jsx)(`div`,{style:A5.calendars,children:(0,V.jsxs)(C5,{isSimulations:!1,onChangeMode:h,title:Y.t(`Calendars`),addTitle:Y.t(`Add new calendar`),alive:l,onAdd:async()=>{let t=`fullcalendar.${e.instance}.Calendars.Calendar-${sU()}`;await e.socket.setObject(t,{type:`folder`,common:{name:`NewCalendar`},native:{}}),await p(),n(t),window.localStorage.setItem(`fullcalendar.calendar`,t),setTimeout(()=>i(t),300)},children:[(0,V.jsx)(w5,{name:Y.t(`Default`),selected:!a.find(e=>e._id===t),onClick:()=>{let t=`fullcalendar.${e.instance}`;window.localStorage.setItem(`fullcalendar.calendar`,t),n(t)}}),a.map(e=>(0,V.jsx)(w5,{name:e.common.name,color:e.common.color,icon:e.common.icon,selected:e._id===t,inactive:e.common.enabled===!1,onClick:()=>{window.localStorage.setItem(`fullcalendar.calendar`,e._id),n(e._id)},status:e.common.enabled===!1?(0,V.jsx)(lb,{title:Y.t(`Calendar is inactive. Click to activate`),slotProps:{popper:{sx:A5.tooltip}},children:(0,V.jsx)(Pd,{size:`small`,onClick:t=>{t.stopPropagation(),m(e)},children:(0,V.jsx)(wx,{})})}):null,actions:(0,V.jsxs)(V.Fragment,{children:[e.common.enabled===!1?null:(0,V.jsx)(lb,{title:Y.t(`Deactivate calendar`),slotProps:{popper:{sx:A5.tooltip}},children:(0,V.jsx)(Pd,{size:`small`,onClick:t=>{t.stopPropagation(),m(e)},children:(0,V.jsx)(Cx,{})})}),(0,V.jsx)(lb,{title:Y.t(`Edit name or delete calendar`),slotProps:{popper:{sx:A5.tooltip}},children:(0,V.jsx)(Pd,{size:`small`,onClick:t=>{i(e._id),t.stopPropagation()},children:(0,V.jsx)(bx,{})})})]})},e._id))]})}),(0,V.jsx)(d5,{systemConfig:e.systemConfig,socket:e.socket,theme:e.theme,calendarPrefix:t},t)]})}),r?(0,V.jsx)(k5,{onClose:()=>i(null),calendarPrefix:t,setCalendarPrefix:n,calendar:a.find(e=>e._id===r),socket:e.socket,instance:e.instance,updateCalendars:p}):null]})},M5=class extends HS{constructor(e){let t={...e};t.translations={en:zE,de:BE,ru:VE,pt:HE,nl:UE,fr:WE,it:GE,es:KE,pl:qE,uk:JE,"zh-cn":YE},t.sentryDSN=window.sentryDSN,window.location.port,window.socketUrl&&window.socketUrl.startsWith(`:`)&&(window.socketUrl=`${window.location.protocol}//${window.location.hostname}${window.socketUrl}`),super(e,t)}render(){return this.state.loaded?(0,V.jsx)(Kt,{injectFirst:!0,children:(0,V.jsx)(qc,{theme:this.state.theme,children:(0,V.jsx)(`div`,{style:{overflow:`auto`,height:`100%`},id:`rootDiv`,children:(0,V.jsx)(j5,{systemConfig:this._systemConfig,socket:this.socket,theme:this.state.theme,instance:this.instance,alive:!!this.state.alive,themeType:this.state.themeType})})})}):(0,V.jsx)(Kt,{injectFirst:!0,children:(0,V.jsx)(qc,{theme:this.state.theme,children:(0,V.jsx)(pS,{themeType:this.state.themeType})})})}};window.location.hostname===`localhost`||window.location.hostname===`[::1]`||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/);function N5(){`serviceWorker`in navigator&&navigator.serviceWorker.ready.then(e=>{e.unregister()})}var P5={name:`fullcalendar-admin`,version:`3.3.1`,private:!0,dependencies:{"@emotion/react":`^11.14.0`,"@emotion/styled":`^11.14.1`,"@devbookhq/splitter":`^1.4.2`,"@fullcalendar/core":`^6.1.22`,"@fullcalendar/daygrid":`^6.1.22`,"@fullcalendar/interaction":`^6.1.22`,"@fullcalendar/list":`^6.1.22`,"@fullcalendar/react":`^6.1.22`,"@fullcalendar/rrule":`^6.1.22`,"@fullcalendar/timegrid":`^6.1.22`,"@iobroker/gui-components":`^10.3.14`,"@iobroker/type-detector":`^6.2.0`,"@material-icons/svg":`^1.0.33`,"@mui/icons-material":`^9.5.0`,"@mui/material":`^9.5.0`,"@mui/system":`^9.5.0`,"@mui/x-date-pickers":`^9.16.0`,"@sentry/browser":`^11.10.0`,"@vitejs/plugin-react":`^6.1.2`,dayjs:`^1.11.23`,moment:`^2.31.0`,react:`^19.3.1`,"react-ace":`^15.0.0`,"react-dnd":`^16.0.1`,"react-dnd-html5-backend":`^16.0.1`,"react-dnd-preview":`^9.0.0`,"react-dnd-touch-backend":`^16.0.1`,"react-dom":`^19.3.1`,"react-dropzone":`^20.1.4`,"react-icons":`^5.7.0`,rrule:`^2.8.1`,suncalc2:`^1.8.1`,vite:`^8.3.5`},scripts:{start:`vite --host`,build:`vite build`,lint:`eslint -c eslint.config.mjs`,"check-ts":`tsc --noEmit --checkJS false`,tsc:`tsc --project tsconfig.json`},eslintConfig:{extends:`react-app`},homepage:`.`,browserslist:[`>0.2%`,`not dead`,`not ie <= 11`,`not op_mini all`]},F5=e=>{let t=cl(e);return t&&(t.palette.text.danger={color:`#dd5325`},t.palette.text.success={color:`#73b6a8`},t)},I5=ES.getThemeName();window.adapterName=`fullcalendar`,console.log(`iobroker.${window.adapterName}@${P5.version} using theme "${I5}"`);function L5(e,t,n){let r=(e||``).split(` `).map(e=>e.trim()).filter(e=>e),i=r.indexOf(n);return i!==-1&&r.splice(i,1),!r.includes(t)&&r.push(t),r.join(` `)}var R5=()=>{let[e,t]=(0,B.useState)(I5),n=F5(e),r=()=>n,i=n.palette.mode;return(0,B.useEffect)(()=>{i===`dark`?window.document.body.className=L5(window.document.body.className,`body-dark`,`body-light`):window.document.body.className=L5(window.document.body.className,`body-light`,`body-dark`)},[i]),(0,V.jsx)(Kt,{injectFirst:!0,children:(0,V.jsx)(qc,{theme:r(),children:(0,V.jsx)(M5,{onThemeChange:e=>t(e)})})})};function z5(){let e=document.getElementById(`root`);(0,Jc.createRoot)(e).render((0,V.jsx)(R5,{}))}z5(),N5();
|
package/admin/tab_m.html
CHANGED
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
document.head.appendChild(script);
|
|
44
44
|
</script>
|
|
45
45
|
<!--script type="text/javascript" src="../../socket.io/socket.io.js"></script-->
|
|
46
|
-
<script type="module" crossorigin src="./assets/index-
|
|
46
|
+
<script type="module" crossorigin src="./assets/index-BF-xuLMY.js"></script>
|
|
47
47
|
<link rel="stylesheet" crossorigin href="./assets/index-gxlVzAAs.css">
|
|
48
48
|
</head>
|
|
49
49
|
<body>
|
package/build/lib/agenda.js
CHANGED
|
@@ -238,6 +238,16 @@ function parseTime(value) {
|
|
|
238
238
|
const [, y, M, d, h, m, s] = local;
|
|
239
239
|
return new Date(+y, +M - 1, +d, +h, +m, s ? +s : 0, 0);
|
|
240
240
|
}
|
|
241
|
+
// a time of day: today
|
|
242
|
+
const timeOfDay = /^(\d{1,2}):(\d{2})(?::(\d{2}))?$/.exec(text);
|
|
243
|
+
if (timeOfDay) {
|
|
244
|
+
const [, h, m, s] = timeOfDay;
|
|
245
|
+
if (+h > 23 || +m > 59 || (s && +s > 59)) {
|
|
246
|
+
return null;
|
|
247
|
+
}
|
|
248
|
+
const today = new Date();
|
|
249
|
+
return new Date(today.getFullYear(), today.getMonth(), today.getDate(), +h, +m, s ? +s : 0, 0);
|
|
250
|
+
}
|
|
241
251
|
const date = new Date(text);
|
|
242
252
|
return Number.isNaN(date.getTime()) ? null : date;
|
|
243
253
|
}
|
package/build/lib/agenda.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agenda.js","sourceRoot":"","sources":["../../src/lib/agenda.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwFA,8BAWC;AAmBD,sCAuBC;AAGD,oBAEC;AAGD,wBAQC;AAmBD,oCA0BC;AAUD,kCA2CC;AAGD,gCAEC;AAQD,
|
|
1
|
+
{"version":3,"file":"agenda.js","sourceRoot":"","sources":["../../src/lib/agenda.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwFA,8BAWC;AAmBD,sCAuBC;AAGD,oBAEC;AAGD,wBAQC;AAmBD,oCA0BC;AAUD,kCA2CC;AAGD,gCAEC;AAQD,8BAyBC;AAOD,8CAqBC;AAjUD;;;;;GAKG;AACH,6CAA+B;AAE/B,mCAAqE;AACrE,2CAAgE;AAuEhE;;;;;;;GAOG;AACH,SAAgB,SAAS,CAAC,MAA4C;IAClE,IAAI,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;IAC7B,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC/B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC9B,KAAK,CAAC,KAAK,EAAE,CAAC;QACd,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IACD,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACf,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,WAAW,CAAC,EAAE,IAAI,CAAC,CAAC;IAC9E,CAAC;IACD,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC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B,CAAC;IAC1C,MAAM,MAAM,GAA2B,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IAC1E,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,IAAI,GAAG,IAAI,CAAC;IAChB,IAAI,CAAyB,CAAC;IAC9B,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;QACzB,KAAK,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACzC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,KAAK,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Recurring events for the `addEvent` message: `recurring: 'daily' | 'weekly' | 'monthly' | 'yearly'` or an iCal
|
|
4
|
+
* `rrule` (`FREQ=YEARLY`) become a cron in the format the GUI writes, so the event can be edited there:
|
|
5
|
+
* `0 30 7 ? * 0-6` (daily), `0 30 7 ? * 1,3` (weekly), `0 30 7 15 1-12 *` (monthly), `0 30 7 15 6 *` (yearly).
|
|
6
|
+
* The scheduler drops the seconds field, recurring events run at whole minutes.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.FREQUENCIES = void 0;
|
|
10
|
+
exports.parseRRule = parseRRule;
|
|
11
|
+
exports.parseRecurrence = parseRecurrence;
|
|
12
|
+
exports.recurrenceToCron = recurrenceToCron;
|
|
13
|
+
exports.FREQUENCIES = ['daily', 'weekly', 'monthly', 'yearly'];
|
|
14
|
+
const WEEKDAYS = {
|
|
15
|
+
su: 0,
|
|
16
|
+
so: 0,
|
|
17
|
+
sun: 0,
|
|
18
|
+
sunday: 0,
|
|
19
|
+
sonntag: 0,
|
|
20
|
+
mo: 1,
|
|
21
|
+
mon: 1,
|
|
22
|
+
monday: 1,
|
|
23
|
+
montag: 1,
|
|
24
|
+
tu: 2,
|
|
25
|
+
di: 2,
|
|
26
|
+
tue: 2,
|
|
27
|
+
tuesday: 2,
|
|
28
|
+
dienstag: 2,
|
|
29
|
+
we: 3,
|
|
30
|
+
mi: 3,
|
|
31
|
+
wed: 3,
|
|
32
|
+
wednesday: 3,
|
|
33
|
+
mittwoch: 3,
|
|
34
|
+
th: 4,
|
|
35
|
+
do: 4,
|
|
36
|
+
thu: 4,
|
|
37
|
+
thursday: 4,
|
|
38
|
+
donnerstag: 4,
|
|
39
|
+
fr: 5,
|
|
40
|
+
fri: 5,
|
|
41
|
+
friday: 5,
|
|
42
|
+
freitag: 5,
|
|
43
|
+
sa: 6,
|
|
44
|
+
sat: 6,
|
|
45
|
+
saturday: 6,
|
|
46
|
+
samstag: 6,
|
|
47
|
+
};
|
|
48
|
+
/** Weekday as number (0 = Sunday, 7 is Sunday too) or name (`MO`, `Mon`, `monday`, `Montag`) */
|
|
49
|
+
function parseWeekday(value) {
|
|
50
|
+
if (typeof value === 'number' || (typeof value === 'string' && /^\d$/.test(value.trim()))) {
|
|
51
|
+
const day = Number(value);
|
|
52
|
+
if (Number.isInteger(day) && day >= 0 && day <= 7) {
|
|
53
|
+
return day % 7;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
else if (typeof value === 'string' && WEEKDAYS[value.trim().toLowerCase()] !== undefined) {
|
|
57
|
+
return WEEKDAYS[value.trim().toLowerCase()];
|
|
58
|
+
}
|
|
59
|
+
throw new Error(`Unknown weekday "${String(value)}" (use 0 = Sunday … 6 = Saturday, or MO, TU, WE, TH, FR, SA, SU)`);
|
|
60
|
+
}
|
|
61
|
+
function parseNumbers(value, min, max, what) {
|
|
62
|
+
const list = Array.isArray(value) ? value : String(value).split(',');
|
|
63
|
+
return list.map(item => {
|
|
64
|
+
const num = Number(typeof item === 'string' ? item.trim() : item);
|
|
65
|
+
if (!Number.isInteger(num) || num < min || num > max) {
|
|
66
|
+
throw new Error(`Invalid ${what} "${String(item)}" (${min} … ${max})`);
|
|
67
|
+
}
|
|
68
|
+
return num;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function parseWeekdays(value) {
|
|
72
|
+
const list = Array.isArray(value) ? value : String(value).split(',');
|
|
73
|
+
const days = list.map(parseWeekday);
|
|
74
|
+
return days.filter((day, i) => days.indexOf(day) === i).sort((a, b) => a - b);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* An iCal recurrence rule (`FREQ=WEEKLY;BYDAY=MO,WE`, also with a leading `RRULE:`). Supported: FREQ, BYDAY (plain
|
|
78
|
+
* weekdays), BYMONTHDAY, BYMONTH, INTERVAL=1. A cron cannot express INTERVAL > 1, COUNT, UNTIL or "the 2nd Monday".
|
|
79
|
+
*
|
|
80
|
+
* @param rrule the rule
|
|
81
|
+
*/
|
|
82
|
+
function parseRRule(rrule) {
|
|
83
|
+
const line = rrule
|
|
84
|
+
.split(/\r?\n/)
|
|
85
|
+
.map(l => l.trim())
|
|
86
|
+
.find(l => /FREQ=/i.test(l));
|
|
87
|
+
if (!line) {
|
|
88
|
+
throw new Error(`"rrule" needs FREQ, e.g. "FREQ=YEARLY"`);
|
|
89
|
+
}
|
|
90
|
+
const parts = {};
|
|
91
|
+
for (const part of line.replace(/^RRULE:/i, '').split(';')) {
|
|
92
|
+
const [key, value] = part.split('=');
|
|
93
|
+
if (key && value !== undefined) {
|
|
94
|
+
parts[key.trim().toUpperCase()] = value.trim();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
const freq = parts.FREQ?.toLowerCase();
|
|
98
|
+
if (!exports.FREQUENCIES.includes(freq)) {
|
|
99
|
+
throw new Error(`Unsupported FREQ "${parts.FREQ}" (supported: DAILY, WEEKLY, MONTHLY, YEARLY)`);
|
|
100
|
+
}
|
|
101
|
+
for (const key of Object.keys(parts)) {
|
|
102
|
+
if (key === 'INTERVAL' && parts.INTERVAL === '1') {
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
if (key === 'WKST') {
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
if (!['FREQ', 'BYDAY', 'BYMONTHDAY', 'BYMONTH'].includes(key)) {
|
|
109
|
+
throw new Error(`"${key}=${parts[key]}" is not supported in "rrule" (supported: FREQ, BYDAY, BYMONTHDAY, BYMONTH)`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const rec = { freq };
|
|
113
|
+
if (parts.BYDAY) {
|
|
114
|
+
if (/[+-]?\d/.test(parts.BYDAY)) {
|
|
115
|
+
throw new Error(`"BYDAY=${parts.BYDAY}" is not supported: only plain weekdays like MO,WE`);
|
|
116
|
+
}
|
|
117
|
+
rec.weekdays = parseWeekdays(parts.BYDAY);
|
|
118
|
+
}
|
|
119
|
+
if (parts.BYMONTHDAY) {
|
|
120
|
+
rec.monthDays = parseNumbers(parts.BYMONTHDAY, 1, 31, 'day of month');
|
|
121
|
+
}
|
|
122
|
+
if (parts.BYMONTH) {
|
|
123
|
+
rec.months = parseNumbers(parts.BYMONTH, 1, 12, 'month');
|
|
124
|
+
}
|
|
125
|
+
return rec;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* The recurrence of an `addEvent` message: `rrule`, or `recurring` (a frequency) with optional `weekdays`,
|
|
129
|
+
* `monthDays` and `months`. `null` = a one-shot event.
|
|
130
|
+
*
|
|
131
|
+
* @param params the message
|
|
132
|
+
*/
|
|
133
|
+
function parseRecurrence(params) {
|
|
134
|
+
const { recurring, rrule } = params;
|
|
135
|
+
if (typeof rrule === 'string' && rrule.trim()) {
|
|
136
|
+
return parseRRule(rrule);
|
|
137
|
+
}
|
|
138
|
+
if (recurring === undefined || recurring === null || recurring === false || recurring === '') {
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
const freq = typeof recurring === 'string' ? recurring.trim().toLowerCase() : null;
|
|
142
|
+
if (!freq || !exports.FREQUENCIES.includes(freq)) {
|
|
143
|
+
throw new Error(`"recurring" must be one of ${exports.FREQUENCIES.join(', ')} (or give an iCal "rrule" like "FREQ=YEARLY")`);
|
|
144
|
+
}
|
|
145
|
+
const rec = { freq };
|
|
146
|
+
if (params.weekdays !== undefined && params.weekdays !== null && params.weekdays !== '') {
|
|
147
|
+
rec.weekdays = parseWeekdays(params.weekdays);
|
|
148
|
+
}
|
|
149
|
+
if (params.monthDays !== undefined && params.monthDays !== null && params.monthDays !== '') {
|
|
150
|
+
rec.monthDays = parseNumbers(params.monthDays, 1, 31, 'day of month');
|
|
151
|
+
}
|
|
152
|
+
if (params.months !== undefined && params.months !== null && params.months !== '') {
|
|
153
|
+
rec.months = parseNumbers(params.months, 1, 12, 'month');
|
|
154
|
+
}
|
|
155
|
+
return rec;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* The cron of a recurring event, in the format of the GUI. The time of day (and the day, if the recurrence does not
|
|
159
|
+
* give one) is taken from `time`.
|
|
160
|
+
*
|
|
161
|
+
* @param rec the recurrence
|
|
162
|
+
* @param time first execution, or any execution of the series
|
|
163
|
+
*/
|
|
164
|
+
function recurrenceToCron(rec, time) {
|
|
165
|
+
const at = `0 ${time.getMinutes()} ${time.getHours()}`;
|
|
166
|
+
switch (rec.freq) {
|
|
167
|
+
case 'daily':
|
|
168
|
+
// FREQ=DAILY;BYDAY=MO,TU… is a weekly rule
|
|
169
|
+
return `${at} ? * ${rec.weekdays?.length ? rec.weekdays.join(',') : '0-6'}`;
|
|
170
|
+
case 'weekly':
|
|
171
|
+
return `${at} ? * ${(rec.weekdays?.length ? rec.weekdays : [time.getDay()]).join(',')}`;
|
|
172
|
+
case 'monthly':
|
|
173
|
+
if (rec.weekdays?.length) {
|
|
174
|
+
throw new Error('A monthly event on weekdays is not supported, give days of the month');
|
|
175
|
+
}
|
|
176
|
+
return `${at} ${(rec.monthDays?.length ? rec.monthDays : [time.getDate()]).join(',')} ${rec.months?.length ? rec.months.join(',') : '1-12'} *`;
|
|
177
|
+
default:
|
|
178
|
+
if (rec.weekdays?.length) {
|
|
179
|
+
throw new Error('A yearly event on weekdays is not supported, give the day and the month');
|
|
180
|
+
}
|
|
181
|
+
return `${at} ${(rec.monthDays?.length ? rec.monthDays : [time.getDate()]).join(',')} ${(rec.months?.length
|
|
182
|
+
? rec.months
|
|
183
|
+
: [time.getMonth() + 1]).join(',')} *`;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
//# sourceMappingURL=recurrence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recurrence.js","sourceRoot":"","sources":["../../src/lib/recurrence.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAyFH,gCA8CC;AAQD,0CAyBC;AASD,4CAwBC;AArMY,QAAA,WAAW,GAAgB,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;AAYjF,MAAM,QAAQ,GAA2B;IACrC,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,GAAG,EAAE,CAAC;IACN,MAAM,EAAE,CAAC;IACT,OAAO,EAAE,CAAC;IACV,EAAE,EAAE,CAAC;IACL,GAAG,EAAE,CAAC;IACN,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;IACT,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,GAAG,EAAE,CAAC;IACN,OAAO,EAAE,CAAC;IACV,QAAQ,EAAE,CAAC;IACX,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,GAAG,EAAE,CAAC;IACN,SAAS,EAAE,CAAC;IACZ,QAAQ,EAAE,CAAC;IACX,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