ical-generator 11.1.1-develop.1 → 11.1.1-develop.2
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.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +48 -48
- package/dist/index.d.mts +48 -48
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
package/dist/index.d.cts
CHANGED
|
@@ -110,24 +110,24 @@ declare class ICalAttendee {
|
|
|
110
110
|
*/
|
|
111
111
|
delegatedTo(): ICalAttendee | null;
|
|
112
112
|
/**
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
113
|
+
* Set the attendee's delegated-to field.
|
|
114
|
+
*
|
|
115
|
+
* Creates a new Attendee if the passed object is not already a
|
|
116
|
+
* {@link ICalAttendee} object. Will set the `delegatedTo` and
|
|
117
|
+
* `delegatedFrom` attributes.
|
|
118
|
+
*
|
|
119
|
+
* Will also set the `status` to `DELEGATED`, if attribute is set.
|
|
120
|
+
*
|
|
121
|
+
* ```javascript
|
|
122
|
+
* const cal = ical();
|
|
123
|
+
* const event = cal.createEvent();
|
|
124
|
+
* const attendee = cal.createAttendee();
|
|
125
|
+
*
|
|
126
|
+
* attendee.delegatesTo({email: 'foo@bar.com', name: 'Foo'});
|
|
127
|
+
```
|
|
128
|
+
*
|
|
129
|
+
* @since 0.2.0
|
|
130
|
+
*/
|
|
131
131
|
delegatedTo(delegatedTo: ICalAttendee | ICalAttendeeData | null | string): this;
|
|
132
132
|
/**
|
|
133
133
|
* Create a new attendee this attendee delegates from and returns
|
|
@@ -1083,21 +1083,21 @@ declare class ICalEvent {
|
|
|
1083
1083
|
*/
|
|
1084
1084
|
alarms(): ICalAlarm[];
|
|
1085
1085
|
/**
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1086
|
+
* Add one or multiple alarms
|
|
1087
|
+
*
|
|
1088
|
+
* ```javascript
|
|
1089
|
+
* const event = ical().createEvent();
|
|
1090
|
+
*
|
|
1091
|
+
* cal.alarms([
|
|
1092
|
+
* {type: ICalAlarmType.display, trigger: 600},
|
|
1093
|
+
* {type: ICalAlarmType.audio, trigger: 300}
|
|
1094
|
+
* ]);
|
|
1095
|
+
*
|
|
1096
|
+
* cal.alarms(); // --> [ICalAlarm, ICalAlarm]
|
|
1097
|
+
```
|
|
1098
|
+
*
|
|
1099
|
+
* @since 0.2.0
|
|
1100
|
+
*/
|
|
1101
1101
|
alarms(alarms: ICalAlarm[] | ICalAlarmData[]): this;
|
|
1102
1102
|
/**
|
|
1103
1103
|
* Get the event's allDay flag
|
|
@@ -1150,21 +1150,21 @@ declare class ICalEvent {
|
|
|
1150
1150
|
*/
|
|
1151
1151
|
attachments(): string[];
|
|
1152
1152
|
/**
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1153
|
+
* Add one or multiple alarms
|
|
1154
|
+
*
|
|
1155
|
+
* ```javascript
|
|
1156
|
+
* const event = ical().createEvent();
|
|
1157
|
+
*
|
|
1158
|
+
* cal.attachments([
|
|
1159
|
+
* 'https://files.sebbo.net/calendar/attachments/foo',
|
|
1160
|
+
* 'https://files.sebbo.net/calendar/attachments/bar'
|
|
1161
|
+
* ]);
|
|
1162
|
+
*
|
|
1163
|
+
* cal.attachments(); // --> [string, string]
|
|
1164
|
+
```
|
|
1165
|
+
*
|
|
1166
|
+
* 3.2.0-develop.1
|
|
1167
|
+
*/
|
|
1168
1168
|
attachments(attachments: string[]): this;
|
|
1169
1169
|
/**
|
|
1170
1170
|
* Get all attendees
|
package/dist/index.d.mts
CHANGED
|
@@ -110,24 +110,24 @@ declare class ICalAttendee {
|
|
|
110
110
|
*/
|
|
111
111
|
delegatedTo(): ICalAttendee | null;
|
|
112
112
|
/**
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
113
|
+
* Set the attendee's delegated-to field.
|
|
114
|
+
*
|
|
115
|
+
* Creates a new Attendee if the passed object is not already a
|
|
116
|
+
* {@link ICalAttendee} object. Will set the `delegatedTo` and
|
|
117
|
+
* `delegatedFrom` attributes.
|
|
118
|
+
*
|
|
119
|
+
* Will also set the `status` to `DELEGATED`, if attribute is set.
|
|
120
|
+
*
|
|
121
|
+
* ```javascript
|
|
122
|
+
* const cal = ical();
|
|
123
|
+
* const event = cal.createEvent();
|
|
124
|
+
* const attendee = cal.createAttendee();
|
|
125
|
+
*
|
|
126
|
+
* attendee.delegatesTo({email: 'foo@bar.com', name: 'Foo'});
|
|
127
|
+
```
|
|
128
|
+
*
|
|
129
|
+
* @since 0.2.0
|
|
130
|
+
*/
|
|
131
131
|
delegatedTo(delegatedTo: ICalAttendee | ICalAttendeeData | null | string): this;
|
|
132
132
|
/**
|
|
133
133
|
* Create a new attendee this attendee delegates from and returns
|
|
@@ -1083,21 +1083,21 @@ declare class ICalEvent {
|
|
|
1083
1083
|
*/
|
|
1084
1084
|
alarms(): ICalAlarm[];
|
|
1085
1085
|
/**
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1086
|
+
* Add one or multiple alarms
|
|
1087
|
+
*
|
|
1088
|
+
* ```javascript
|
|
1089
|
+
* const event = ical().createEvent();
|
|
1090
|
+
*
|
|
1091
|
+
* cal.alarms([
|
|
1092
|
+
* {type: ICalAlarmType.display, trigger: 600},
|
|
1093
|
+
* {type: ICalAlarmType.audio, trigger: 300}
|
|
1094
|
+
* ]);
|
|
1095
|
+
*
|
|
1096
|
+
* cal.alarms(); // --> [ICalAlarm, ICalAlarm]
|
|
1097
|
+
```
|
|
1098
|
+
*
|
|
1099
|
+
* @since 0.2.0
|
|
1100
|
+
*/
|
|
1101
1101
|
alarms(alarms: ICalAlarm[] | ICalAlarmData[]): this;
|
|
1102
1102
|
/**
|
|
1103
1103
|
* Get the event's allDay flag
|
|
@@ -1150,21 +1150,21 @@ declare class ICalEvent {
|
|
|
1150
1150
|
*/
|
|
1151
1151
|
attachments(): string[];
|
|
1152
1152
|
/**
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1153
|
+
* Add one or multiple alarms
|
|
1154
|
+
*
|
|
1155
|
+
* ```javascript
|
|
1156
|
+
* const event = ical().createEvent();
|
|
1157
|
+
*
|
|
1158
|
+
* cal.attachments([
|
|
1159
|
+
* 'https://files.sebbo.net/calendar/attachments/foo',
|
|
1160
|
+
* 'https://files.sebbo.net/calendar/attachments/bar'
|
|
1161
|
+
* ]);
|
|
1162
|
+
*
|
|
1163
|
+
* cal.attachments(); // --> [string, string]
|
|
1164
|
+
```
|
|
1165
|
+
*
|
|
1166
|
+
* 3.2.0-develop.1
|
|
1167
|
+
*/
|
|
1168
1168
|
attachments(attachments: string[]): this;
|
|
1169
1169
|
/**
|
|
1170
1170
|
* Get all attendees
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
let e=function(e){return e.DAILY=`DAILY`,e.HOURLY=`HOURLY`,e.MINUTELY=`MINUTELY`,e.MONTHLY=`MONTHLY`,e.SECONDLY=`SECONDLY`,e.WEEKLY=`WEEKLY`,e.YEARLY=`YEARLY`,e}({}),t=function(e){return e.AUTOMATIC=`AUTOMATIC`,e.DISABLED=`DISABLED`,e.ENABLED=`ENABLED`,e}({}),n=function(e){return e.BICYCLE=`BICYCLE`,e.CAR=`CAR`,e.TRANSIT=`TRANSIT`,e.WALKING=`WALKING`,e}({}),r=function(e){return e.FR=`FR`,e.MO=`MO`,e.SA=`SA`,e.SU=`SU`,e.TH=`TH`,e.TU=`TU`,e.WE=`WE`,e}({});function i(e,t,n){if(Array.isArray(t))e.x=t.map(e=>{if(Array.isArray(e))return e;if(typeof e.key!=`string`||typeof e.value!=`string`)throw Error(`Either key or value is not a string!`);if(e.key.substr(0,2)!==`X-`)throw Error("Key has to start with `X-`!");return[e.key,e.value]});else if(typeof t==`object`)e.x=Object.entries(t).map(([e,t])=>{if(typeof e!=`string`||typeof t!=`string`)throw Error(`Either key or value is not a string!`);if(e.substr(0,2)!==`X-`)throw Error("Key has to start with `X-`!");return[e,t]});else if(typeof t==`string`&&typeof n==`string`){if(t.substr(0,2)!==`X-`)throw Error("Key has to start with `X-`!");e.x.push([t,n])}else return e.x.map(e=>({key:e[0],value:e[1]}))}function a(e,t){if(e instanceof Date&&isNaN(e.getTime())||typeof e==`string`&&isNaN(new Date(e).getTime()))throw Error(`\`${t}\` has to be a valid date!`);if(e instanceof Date||typeof e==`string`||typeof e==`object`&&e&&(w(e)||C(e)||S(e)||x(e))||h(e)&&e.isValid===!0||(g(e)||m(e))&&e.isValid())return e;throw Error(`\`${t}\` has to be a valid date!`)}function o(e,t){let n=Object.values(e),r=String(t).toUpperCase();if(!r||!n.includes(r))throw Error(`Input must be one of the following: ${n.join(`, `)}`);return r}function s(e,t){let n=null;if(typeof t==`string`){let e=t.match(/^(.+) ?<([^>]+)>$/);e?n={email:e[2].trim(),name:e[1].trim()}:t.includes(`@`)&&(n={email:t.trim(),name:t.trim()})}else typeof t==`object`&&(n={email:t.email,mailto:t.mailto,name:t.name,sentBy:t.sentBy});if(!n&&typeof t==`string`)throw Error("`"+e+"` isn't formated correctly. See https://sebbo2002.github.io/ical-generator/develop/reference/interfaces/ICalOrganizer.html");if(!n)throw Error("`"+e+"` needs to be a valid formed string or an object. See https://sebbo2002.github.io/ical-generator/develop/reference/interfaces/ICalOrganizer.html");if(!n.name)throw Error("`"+e+".name` is empty!");if(!n.email)throw Error("`"+e+".email` is empty!");return n}function c(e,t){return t?l(e):String(e).replace(/[\\;,]/g,e=>`\\`+e).replace(/(?:\r\n|\r|\n)/g,`\\n`)}function l(e){return String(e).replace(/\^/g,`^^`).replace(/"/g,`^'`).replace(/(?:\r\n|\r|\n)/g,`^n`)}function u(e){return e.split(`\r
|
|
2
2
|
`).map(function(e){if(e.length<=74&&A(e))return e;let t=``,n=0;for(let r=0;r<e.length;r++){let i=e.charAt(r),a=e.charCodeAt(r),o;a<128?o=1:a<2048?o=2:a>=55296&&a<=56319?(i+=e.charAt(++r),o=4):o=3,n+=o,n>74&&(t+=`\r
|
|
3
3
|
`,n=o),t+=i}return t}).join(`\r
|
|
4
|
-
`)}function d(e,t,n,r){if(e?.startsWith(`/`)&&(e=e.substr(1)),typeof t==`string`||t instanceof Date){let i=T(t)?t.withTimeZone(e):new Date(t),a=i.getUTCFullYear().toString().padStart(4,`0`)+String(i.getUTCMonth()+1).padStart(2,`0`)+i.getUTCDate().toString().padStart(2,`0`);return e&&(a=i.getFullYear().toString().padStart(2,`0`)+String(i.getMonth()+1).padStart(2,`0`)+i.getDate().toString().padStart(2,`0`)),n?a:e?(a+=`T`+i.getHours().toString().padStart(2,`0`)+i.getMinutes().toString().padStart(2,`0`)+i.getSeconds().toString().padStart(2,`0`),a):(a+=`T`+i.getUTCHours().toString().padStart(2,`0`)+i.getUTCMinutes().toString().padStart(2,`0`)+i.getUTCSeconds().toString().padStart(2,`0`)+(r?``:`Z`),a)}
|
|
4
|
+
`)}function d(e,t,n,r){if(e?.startsWith(`/`)&&(e=e.substr(1)),typeof t==`string`||t instanceof Date){let i=T(t)?t.withTimeZone(e):new Date(t),a=i.getUTCFullYear().toString().padStart(4,`0`)+String(i.getUTCMonth()+1).padStart(2,`0`)+i.getUTCDate().toString().padStart(2,`0`);return e&&(a=i.getFullYear().toString().padStart(2,`0`)+String(i.getMonth()+1).padStart(2,`0`)+i.getDate().toString().padStart(2,`0`)),n?a:e?(a+=`T`+i.getHours().toString().padStart(2,`0`)+i.getMinutes().toString().padStart(2,`0`)+i.getSeconds().toString().padStart(2,`0`),a):(a+=`T`+i.getUTCHours().toString().padStart(2,`0`)+i.getUTCMinutes().toString().padStart(2,`0`)+i.getUTCSeconds().toString().padStart(2,`0`)+(r?``:`Z`),a)}if(g(t)){let i=e?v(t)&&!t.tz()?t.clone().tz(e):t:r||n&&v(t)&&t.tz()?t:t.utc();return i.format(`YYYYMMDD`)+(n?``:`T`+i.format(`HHmmss`)+(r||e?``:`Z`))}if(h(t)){let i=e?t.setZone(e):r||n&&t.zone.type!==`system`?t:t.setZone(`utc`);return i.toFormat(`yyyyLLdd`)+(n?``:`T`+i.toFormat(`HHmmss`)+(r||e?``:`Z`))}if(w(t)){let i=t;return e&&(i=t.withTimeZone(t.timeZoneId)),!e&&t.timeZoneId!==`UTC`&&(i=t.withTimeZone(`UTC`)),d(null,i.toPlainDateTime(),n,r||!!e)}if(C(t)){if(n)return t.year.toString().padStart(4,`0`)+t.month.toString().padStart(2,`0`)+t.day.toString().padStart(2,`0`);if(e){let i=t.toZonedDateTime(e);return d(e,i,n,r)}return t.year.toString().padStart(4,`0`)+t.month.toString().padStart(2,`0`)+t.day.toString().padStart(2,`0`)+`T`+t.hour.toString().padStart(2,`0`)+t.minute.toString().padStart(2,`0`)+t.second.toString().padStart(2,`0`)+(r||e?``:`Z`)}if(S(t))return t.year.toString().padStart(4,`0`)+t.month.toString().padStart(2,`0`)+t.day.toString().padStart(2,`0`)+(n?``:`T000000`+(r||e?``:`Z`));if(x(t)){let i=e||`UTC`,a=t.toZonedDateTimeISO(i);return d(e,a,n,r)}{let i=t;if(e)i=typeof t.tz==`function`?t.tz(e):t;else if(!r){if(typeof t.utc==`function`)i=t.utc();else throw Error(`Unable to convert dayjs object to UTC value: UTC plugin is not available!`)}return i.format(`YYYYMMDD`)+(n?``:`T`+i.format(`HHmmss`)+(r||e?``:`Z`))}}function f(e,t,n,r){let i=``,a=r?.floating||!1;return r?.timezone&&(i=`;TZID=`+r.timezone,a=!0),t+i+`:`+d(e,n,!1,a)}function p(e){let t=e.x.map(([e,t])=>e.toUpperCase()+`:`+c(t,!1)).join(`\r
|
|
5
5
|
`);return t.length?t+`\r
|
|
6
6
|
`:``}function m(e){return typeof e==`object`&&!!e&&!(e instanceof Date)&&!g(e)&&!h(e)&&!b(e)}function h(e){return typeof e==`object`&&!!e&&`toJSDate`in e&&typeof e.toJSDate==`function`&&!b(e)}function g(e){return e!=null&&e._isAMomentObject!=null&&!b(e)}function _(e){return typeof e==`object`&&!!e&&`asSeconds`in e&&typeof e.asSeconds==`function`}function v(e){return g(e)&&`tz`in e&&typeof e.tz==`function`}function y(e){return typeof e==`object`&&!!e&&`between`in e&&typeof e.between==`function`&&typeof e.toString==`function`}function b(e){return w(e)||C(e)||S(e)||x(e)}function x(e){return typeof e==`object`&&!!e&&!w(e)&&!C(e)&&!S(e)&&`toZonedDateTimeISO`in e&&typeof e.toZonedDateTimeISO==`function`&&!(`year`in e)&&!(`timeZoneId`in e)}function S(e){return typeof e==`object`&&!!e&&!w(e)&&!C(e)&&`toPlainDateTime`in e&&typeof e.toPlainDateTime==`function`&&`year`in e&&typeof e.year==`number`&&`month`in e&&typeof e.month==`number`&&`day`in e&&typeof e.day==`number`&&!(`hour`in e)&&!(`timeZoneId`in e)&&!(`epochSeconds`in e)}function C(e){return typeof e==`object`&&!!e&&!w(e)&&`toZonedDateTime`in e&&typeof e.toZonedDateTime==`function`&&`toPlainDate`in e&&typeof e.toPlainDate==`function`&&`year`in e&&typeof e.year==`number`&&`month`in e&&typeof e.month==`number`&&`day`in e&&typeof e.day==`number`&&`hour`in e&&typeof e.hour==`number`&&`minute`in e&&typeof e.minute==`number`&&`second`in e&&typeof e.second==`number`&&!(`timeZone`in e)}function w(e){return typeof e==`object`&&!!e&&`timeZoneId`in e&&typeof e.timeZoneId==`string`&&`toPlainDateTime`in e&&typeof e.toPlainDateTime==`function`&&`year`in e&&typeof e.year==`number`&&`month`in e&&typeof e.month==`number`&&`day`in e&&typeof e.day==`number`&&`hour`in e&&typeof e.hour==`number`&&`minute`in e&&typeof e.minute==`number`&&`second`in e&&typeof e.second==`number`}function T(e){return e instanceof Date&&`internal`in e&&e.internal instanceof Date&&`withTimeZone`in e&&typeof e.withTimeZone==`function`&&`tzComponents`in e&&typeof e.tzComponents==`function`}function E(e){let t=l(e);return/[,:;]/.test(t)?`"`+t+`"`:t}function D(e){if(typeof e==`string`||e instanceof Date)return new Date(e);if(w(e)){let t=e.toInstant();return new Date(t.epochMilliseconds)}return C(e)?new Date(Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute,e.second)):S(e)?new Date(Date.UTC(e.year,e.month-1,e.day)):x(e)?new Date(e.epochMilliseconds):h(e)?e.toJSDate():e.toDate()}function O(e){let t=``;return e<0&&(t=`-`,e*=-1),t+=`P`,e>=86400&&(t+=Math.floor(e/86400)+`D`,e%=86400),!e&&t.length>1?t:(t+=`T`,e>=3600&&(t+=Math.floor(e/3600)+`H`,e%=3600),e>=60&&(t+=Math.floor(e/60)+`M`,e%=60),e>0?t+=e+`S`:t.length<=2&&(t+=`0S`),t)}function k(e){return e?typeof e==`string`?e:w(e)?k(e.withTimeZone(`UTC`).toPlainDateTime()):(b(e),e.toJSON()):null}function A(e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>127)return!1;return!0}let j=function(e){return e.CHAIR=`CHAIR`,e.NON=`NON-PARTICIPANT`,e.OPT=`OPT-PARTICIPANT`,e.REQ=`REQ-PARTICIPANT`,e}({}),M=function(e){return e.CLIENT=`CLIENT`,e.NONE=`NONE`,e.SERVER=`SERVER`,e}({}),N=function(e){return e.ACCEPTED=`ACCEPTED`,e.DECLINED=`DECLINED`,e.DELEGATED=`DELEGATED`,e.NEEDSACTION=`NEEDS-ACTION`,e.TENTATIVE=`TENTATIVE`,e}({}),P=function(e){return e.GROUP=`GROUP`,e.INDIVIDUAL=`INDIVIDUAL`,e.RESOURCE=`RESOURCE`,e.ROOM=`ROOM`,e.UNKNOWN=`UNKNOWN`,e}({});var F=class e{data;parent;constructor(e,t){if(this.data={delegatedFrom:null,delegatedTo:null,email:``,mailto:null,name:null,role:`REQ-PARTICIPANT`,rsvp:null,scheduleAgent:null,sentBy:null,status:null,type:null,x:[]},this.parent=t,!this.parent)throw Error("`event` option required!");if(!e.email)throw Error("No value for `email` in ICalAttendee given!");e.name!==void 0&&this.name(e.name),e.email!==void 0&&this.email(e.email),e.mailto!==void 0&&this.mailto(e.mailto),e.sentBy!==void 0&&this.sentBy(e.sentBy),e.status!==void 0&&this.status(e.status),e.role!==void 0&&this.role(e.role),e.rsvp!==void 0&&this.rsvp(e.rsvp),e.type!==void 0&&this.type(e.type),e.delegatedTo!==void 0&&this.delegatedTo(e.delegatedTo),e.delegatedFrom!==void 0&&this.delegatedFrom(e.delegatedFrom),e.delegatesTo&&this.delegatesTo(e.delegatesTo),e.delegatesFrom&&this.delegatesFrom(e.delegatesFrom),e.scheduleAgent!==void 0&&this.scheduleAgent(e.scheduleAgent),e.x!==void 0&&this.x(e.x)}delegatedFrom(t){return t===void 0?this.data.delegatedFrom:(t?typeof t==`string`?this.data.delegatedFrom=new e(s(`delegatedFrom`,t),this.parent):t instanceof e?this.data.delegatedFrom=t:this.data.delegatedFrom=new e(t,this.parent):this.data.delegatedFrom=null,this)}delegatedTo(t){return t===void 0?this.data.delegatedTo:t?(typeof t==`string`?this.data.delegatedTo=new e(s(`delegatedTo`,t),this.parent):t instanceof e?this.data.delegatedTo=t:this.data.delegatedTo=new e(t,this.parent),this.data.status=`DELEGATED`,this):(this.data.delegatedTo=null,this.data.status===`DELEGATED`&&(this.data.status=null),this)}delegatesFrom(t){let n=t instanceof e?t:this.parent.createAttendee(t);return this.delegatedFrom(n),n.delegatedTo(this),n}delegatesTo(t){let n=t instanceof e?t:this.parent.createAttendee(t);return this.delegatedTo(n),n.delegatedFrom(this),n}email(e){return e?(this.data.email=e,this):this.data.email}mailto(e){return e===void 0?this.data.mailto:(this.data.mailto=e||null,this)}name(e){return e===void 0?this.data.name:(this.data.name=e||null,this)}role(e){return e===void 0?this.data.role:(this.data.role=o(j,e),this)}rsvp(e){return e===void 0?this.data.rsvp:e===null?(this.data.rsvp=null,this):(this.data.rsvp=!!e,this)}scheduleAgent(e){return e===void 0?this.data.scheduleAgent:e?typeof e==`string`&&e.toUpperCase().startsWith(`X-`)?(this.data.scheduleAgent=e,this):(this.data.scheduleAgent=o(M,e),this):(this.data.scheduleAgent=null,this)}sentBy(e){return e?(this.data.sentBy=e,this):this.data.sentBy}status(e){return e===void 0?this.data.status:e?(this.data.status=o(N,e),this):(this.data.status=null,this)}toJSON(){return Object.assign({},this.data,{delegatedFrom:this.data.delegatedFrom?.email()||null,delegatedTo:this.data.delegatedTo?.email()||null,x:this.x()})}toString(){let e=`ATTENDEE`;if(!this.data.email)throw Error("No value for `email` in ICalAttendee given!");return e+=`;ROLE=`+this.data.role,this.data.type&&(e+=`;CUTYPE=`+this.data.type),this.data.status&&(e+=`;PARTSTAT=`+this.data.status),this.data.rsvp!==null&&(e+=`;RSVP=`+this.data.rsvp.toString().toUpperCase()),this.data.sentBy!==null&&(e+=`;SENT-BY="mailto:`+l(this.data.sentBy)+`"`),this.data.delegatedTo&&(e+=`;DELEGATED-TO="`+l(this.data.delegatedTo.email())+`"`),this.data.delegatedFrom&&(e+=`;DELEGATED-FROM="`+l(this.data.delegatedFrom.email())+`"`),this.data.name&&(e+=`;CN="`+l(this.data.name)+`"`),this.data.email&&this.data.mailto&&(e+=`;EMAIL=`+E(this.data.email)),this.data.scheduleAgent&&(e+=`;SCHEDULE-AGENT=`+this.data.scheduleAgent),this.data.x.length&&(e+=`;`+this.data.x.map(([e,t])=>e.toUpperCase()+`=`+E(t)).join(`;`)),e+=`:MAILTO:`+c(this.data.mailto||this.data.email,!1)+`\r
|
|
7
7
|
`,e}type(e){return e===void 0?this.data.type:e?(this.data.type=o(P,e),this):(this.data.type=null,this)}x(e,t){if(e===void 0)return i(this.data);if(typeof e==`string`&&typeof t==`string`)i(this.data,e,t);else if(typeof e==`object`)i(this.data,e);else throw Error(`Either key or value is not a string!`);return this}};let I=function(e){return e.audio=`audio`,e.display=`display`,e.email=`email`,e}({});const L={end:`END`,start:`START`};var R=class{data;event;constructor(e,t){if(this.data={attach:null,attendees:[],description:null,interval:null,relatesTo:null,repeat:null,summary:null,trigger:-600,type:`display`,x:[]},this.event=t,!t)throw Error("`event` option required!");e.type!==void 0&&this.type(e.type),`trigger`in e&&e.trigger!==void 0&&this.trigger(e.trigger),`triggerBefore`in e&&e.triggerBefore!==void 0&&this.triggerBefore(e.triggerBefore),`triggerAfter`in e&&e.triggerAfter!==void 0&&this.triggerAfter(e.triggerAfter),e.repeat&&this.repeat(e.repeat),e.attach!==void 0&&this.attach(e.attach),e.description!==void 0&&this.description(e.description),e.summary!==void 0&&this.summary(e.summary),e.attendees!==void 0&&this.attendees(e.attendees),e.x!==void 0&&this.x(e.x)}attach(e){if(e===void 0)return this.data.attach;if(!e)return this.data.attach=null,this;let t;if(typeof e==`string`)t={mime:null,uri:e};else if(typeof e==`object`)t={mime:e.mime||null,uri:e.uri};else throw Error("`attachment` needs to be a valid formed string or an object. See https://sebbo2002.github.io/ical-generator/develop/reference/classes/ICalAlarm.html#attach");if(!t.uri)throw Error("`attach.uri` is empty!");return this.data.attach={mime:t.mime,uri:t.uri},this}attendees(e){return e?(e.forEach(e=>this.createAttendee(e)),this):this.data.attendees}createAttendee(e){if(e instanceof F)return this.data.attendees.push(e),e;typeof e==`string`&&(e=s(`data`,e));let t=new F(e,this);return this.data.attendees.push(t),t}description(e){return e===void 0?this.data.description:e?(this.data.description=e,this):(this.data.description=null,this)}relatesTo(e){if(e===void 0)return this.data.relatesTo;if(!e)return this.data.relatesTo=null,this;if(!Object.values(L).includes(e))throw Error("`relatesTo` is not correct, must be either `START` or `END`!");return this.data.relatesTo=e,this}repeat(e){if(e===void 0)return this.data.repeat;if(!e)return this.data.repeat=null,this;if(typeof e!=`object`)throw Error("`repeat` is not correct, must be an object!");if(typeof e.times!=`number`||!isFinite(e.times))throw Error("`repeat.times` is not correct, must be numeric!");if(typeof e.interval!=`number`||!isFinite(e.interval))throw Error("`repeat.interval` is not correct, must be numeric!");return this.data.repeat=e,this}summary(e){return e===void 0?this.data.summary:e?(this.data.summary=e,this):(this.data.summary=null,this)}toJSON(){let e=this.trigger();return Object.assign({},this.data,{trigger:typeof e==`number`?e:k(e),x:this.x()})}toString(){let e=`BEGIN:VALARM\r
|