ical-generator 10.1.1-develop.1 → 10.2.0-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.d.cts CHANGED
@@ -1897,6 +1897,7 @@ declare enum ICalCalendarMethod {
1897
1897
  REQUEST = "REQUEST"
1898
1898
  }
1899
1899
  interface ICalCalendarData {
1900
+ color?: null | string;
1900
1901
  description?: null | string;
1901
1902
  events?: (ICalEvent | ICalEventData)[];
1902
1903
  method?: ICalCalendarMethod | null;
@@ -1913,6 +1914,7 @@ interface ICalCalendarData {
1913
1914
  }[];
1914
1915
  }
1915
1916
  interface ICalCalendarJSONData {
1917
+ color: null | string;
1916
1918
  description: null | string;
1917
1919
  events: ICalEventJSONData[];
1918
1920
  method: ICalCalendarMethod | null;
@@ -1990,6 +1992,17 @@ declare class ICalCalendar {
1990
1992
  * @since 2.0.0-develop.1
1991
1993
  */
1992
1994
  clear(): this;
1995
+ /**
1996
+ * Get your feed's color
1997
+ * @returns {null|string}
1998
+ */
1999
+ color(): null | string;
2000
+ /**
2001
+ * Set your feed's color
2002
+ * (Only supported on Apple calendar clients)
2003
+ * @param {null|string} color \# followed by six character hex color code
2004
+ */
2005
+ color(color: null | string): this;
1993
2006
  /**
1994
2007
  * Creates a new {@link ICalEvent} and returns it. Use options to prefill the event's attributes.
1995
2008
  * Calling this method without options will create an empty event.
package/dist/index.d.ts CHANGED
@@ -1897,6 +1897,7 @@ declare enum ICalCalendarMethod {
1897
1897
  REQUEST = "REQUEST"
1898
1898
  }
1899
1899
  interface ICalCalendarData {
1900
+ color?: null | string;
1900
1901
  description?: null | string;
1901
1902
  events?: (ICalEvent | ICalEventData)[];
1902
1903
  method?: ICalCalendarMethod | null;
@@ -1913,6 +1914,7 @@ interface ICalCalendarData {
1913
1914
  }[];
1914
1915
  }
1915
1916
  interface ICalCalendarJSONData {
1917
+ color: null | string;
1916
1918
  description: null | string;
1917
1919
  events: ICalEventJSONData[];
1918
1920
  method: ICalCalendarMethod | null;
@@ -1990,6 +1992,17 @@ declare class ICalCalendar {
1990
1992
  * @since 2.0.0-develop.1
1991
1993
  */
1992
1994
  clear(): this;
1995
+ /**
1996
+ * Get your feed's color
1997
+ * @returns {null|string}
1998
+ */
1999
+ color(): null | string;
2000
+ /**
2001
+ * Set your feed's color
2002
+ * (Only supported on Apple calendar clients)
2003
+ * @param {null|string} color \# followed by six character hex color code
2004
+ */
2005
+ color(color: null | string): this;
1993
2006
  /**
1994
2007
  * Creates a new {@link ICalEvent} and returns it. Use options to prefill the event's attributes.
1995
2008
  * Calling this method without options will create an empty event.
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
- var x=(u=>(u.DAILY="DAILY",u.HOURLY="HOURLY",u.MINUTELY="MINUTELY",u.MONTHLY="MONTHLY",u.SECONDLY="SECONDLY",u.WEEKLY="WEEKLY",u.YEARLY="YEARLY",u))(x||{}),E=(u=>(u.FR="FR",u.MO="MO",u.SA="SA",u.SU="SU",u.TH="TH",u.TU="TU",u.WE="WE",u))(E||{});function o(e,t,a){if(Array.isArray(t))e.x=t.map(n=>{if(Array.isArray(n))return n;if(typeof n.key!="string"||typeof n.value!="string")throw new Error("Either key or value is not a string!");if(n.key.substr(0,2)!=="X-")throw new Error("Key has to start with `X-`!");return[n.key,n.value]});else if(typeof t=="object")e.x=Object.entries(t).map(([n,i])=>{if(typeof n!="string"||typeof i!="string")throw new Error("Either key or value is not a string!");if(n.substr(0,2)!=="X-")throw new Error("Key has to start with `X-`!");return[n,i]});else if(typeof t=="string"&&typeof a=="string"){if(t.substr(0,2)!=="X-")throw new Error("Key has to start with `X-`!");e.x.push([t,a])}else return e.x.map(n=>({key:n[0],value:n[1]}))}function m(e,t){if(e instanceof Date&&isNaN(e.getTime())||typeof e=="string"&&isNaN(new Date(e).getTime()))throw new Error(`\`${t}\` has to be a valid date!`);if(e instanceof Date||typeof e=="string"||typeof e=="object"&&e!==null&&(C(e)||b(e)||R(e)||V(e))||N(e)&&e.isValid===!0||(O(e)||q(e))&&e.isValid())return e;throw new Error(`\`${t}\` has to be a valid date!`)}function d(e,t){let a=Object.values(e),n=String(t).toUpperCase();if(!n||!a.includes(n))throw new Error(`Input must be one of the following: ${a.join(", ")}`);return n}function p(e,t){let a=null;if(typeof t=="string"){let n=t.match(/^(.+) ?<([^>]+)>$/);n?a={email:n[2].trim(),name:n[1].trim()}:t.includes("@")&&(a={email:t.trim(),name:t.trim()})}else typeof t=="object"&&(a={email:t.email,mailto:t.mailto,name:t.name,sentBy:t.sentBy});if(!a&&typeof t=="string")throw new Error("`"+e+"` isn't formated correctly. See https://sebbo2002.github.io/ical-generator/develop/reference/interfaces/ICalOrganizer.html");if(!a)throw new 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(!a.name)throw new Error("`"+e+".name` is empty!");if(!a.email)throw new Error("`"+e+".email` is empty!");return a}function r(e,t){return String(e).replace(t?/[\\"]/g:/[\\;,]/g,function(a){return"\\"+a}).replace(/(?:\r\n|\r|\n)/g,"\\n")}function L(e){return e.split(`\r
2
- `).map(function(t){let a="",n=0;for(let i=0;i<t.length;i++){let s=t.charAt(i);s>="\uD800"&&s<="\uDBFF"&&(s+=t.charAt(++i));let Y=new TextEncoder().encode(s).length;n+=Y,n>74&&(a+=`\r
3
- `,n=Y),a+=s}return a}).join(`\r
4
- `)}function l(e,t,a,n){if(e?.startsWith("/")&&(e=e.substr(1)),typeof t=="string"||t instanceof Date){let i=Q(t)?t.withTimeZone(e):new Date(t),s=i.getUTCFullYear().toString().padStart(4,"0")+String(i.getUTCMonth()+1).padStart(2,"0")+i.getUTCDate().toString().padStart(2,"0");return e&&(s=i.getFullYear().toString().padStart(2,"0")+String(i.getMonth()+1).padStart(2,"0")+i.getDate().toString().padStart(2,"0")),a?s:e?(s+="T"+i.getHours().toString().padStart(2,"0")+i.getMinutes().toString().padStart(2,"0")+i.getSeconds().toString().padStart(2,"0"),s):(s+="T"+i.getUTCHours().toString().padStart(2,"0")+i.getUTCMinutes().toString().padStart(2,"0")+i.getUTCSeconds().toString().padStart(2,"0")+(n?"":"Z"),s)}else if(O(t)){let i=e?G(t)&&!t.tz()?t.clone().tz(e):t:n||a&&G(t)&&t.tz()?t:t.utc();return i.format("YYYYMMDD")+(a?"":"T"+i.format("HHmmss")+(n||e?"":"Z"))}else if(N(t)){let i=e?t.setZone(e):n||a&&t.zone.type!=="system"?t:t.setZone("utc");return i.toFormat("yyyyLLdd")+(a?"":"T"+i.toFormat("HHmmss")+(n||e?"":"Z"))}else if(C(t)){let i=t;return e&&(i=t.withTimeZone(t.timeZoneId)),!e&&t.timeZoneId!=="UTC"&&(i=t.withTimeZone("UTC")),l(null,i.toPlainDateTime(),a,n||!!e)}else if(b(t)){if(a)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 l(e,i,a,n)}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")+(n||e?"":"Z")}else{if(R(t))return t.year.toString().padStart(4,"0")+t.month.toString().padStart(2,"0")+t.day.toString().padStart(2,"0")+(a?"":"T000000"+(n||e?"":"Z"));if(V(t)){let i=e||"UTC",s=t.toZonedDateTimeISO(i);return l(e,s,a,n)}else{let i=t;if(e)i=typeof t.tz=="function"?t.tz(e):t;else if(!n)if(typeof t.utc=="function")i=t.utc();else throw new Error("Unable to convert dayjs object to UTC value: UTC plugin is not available!");return i.format("YYYYMMDD")+(a?"":"T"+i.format("HHmmss")+(n||e?"":"Z"))}}}function S(e,t,a,n){let i="",s=n?.floating||!1;return n?.timezone&&(i=";TZID="+n.timezone,s=!0),t+i+":"+l(e,a,!1,s)}function T(e){let t=e.x.map(([a,n])=>a.toUpperCase()+":"+r(n,!1)).join(`\r
1
+ var x=(u=>(u.DAILY="DAILY",u.HOURLY="HOURLY",u.MINUTELY="MINUTELY",u.MONTHLY="MONTHLY",u.SECONDLY="SECONDLY",u.WEEKLY="WEEKLY",u.YEARLY="YEARLY",u))(x||{}),E=(u=>(u.FR="FR",u.MO="MO",u.SA="SA",u.SU="SU",u.TH="TH",u.TU="TU",u.WE="WE",u))(E||{});function o(e,t,n){if(Array.isArray(t))e.x=t.map(a=>{if(Array.isArray(a))return a;if(typeof a.key!="string"||typeof a.value!="string")throw new Error("Either key or value is not a string!");if(a.key.substr(0,2)!=="X-")throw new Error("Key has to start with `X-`!");return[a.key,a.value]});else if(typeof t=="object")e.x=Object.entries(t).map(([a,i])=>{if(typeof a!="string"||typeof i!="string")throw new Error("Either key or value is not a string!");if(a.substr(0,2)!=="X-")throw new Error("Key has to start with `X-`!");return[a,i]});else if(typeof t=="string"&&typeof n=="string"){if(t.substr(0,2)!=="X-")throw new Error("Key has to start with `X-`!");e.x.push([t,n])}else return e.x.map(a=>({key:a[0],value:a[1]}))}function m(e,t){if(e instanceof Date&&isNaN(e.getTime())||typeof e=="string"&&isNaN(new Date(e).getTime()))throw new Error(`\`${t}\` has to be a valid date!`);if(e instanceof Date||typeof e=="string"||typeof e=="object"&&e!==null&&(C(e)||A(e)||R(e)||V(e))||N(e)&&e.isValid===!0||(O(e)||q(e))&&e.isValid())return e;throw new Error(`\`${t}\` has to be a valid date!`)}function d(e,t){let n=Object.values(e),a=String(t).toUpperCase();if(!a||!n.includes(a))throw new Error(`Input must be one of the following: ${n.join(", ")}`);return a}function p(e,t){let n=null;if(typeof t=="string"){let a=t.match(/^(.+) ?<([^>]+)>$/);a?n={email:a[2].trim(),name:a[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 new Error("`"+e+"` isn't formated correctly. See https://sebbo2002.github.io/ical-generator/develop/reference/interfaces/ICalOrganizer.html");if(!n)throw new 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 new Error("`"+e+".name` is empty!");if(!n.email)throw new Error("`"+e+".email` is empty!");return n}function r(e,t){return String(e).replace(t?/[\\"]/g:/[\\;,]/g,function(n){return"\\"+n}).replace(/(?:\r\n|\r|\n)/g,"\\n")}function L(e){return e.split(`\r
2
+ `).map(function(t){let n="",a=0;for(let i=0;i<t.length;i++){let s=t.charAt(i);s>="\uD800"&&s<="\uDBFF"&&(s+=t.charAt(++i));let Y=new TextEncoder().encode(s).length;a+=Y,a>74&&(n+=`\r
3
+ `,a=Y),n+=s}return n}).join(`\r
4
+ `)}function l(e,t,n,a){if(e?.startsWith("/")&&(e=e.substr(1)),typeof t=="string"||t instanceof Date){let i=Q(t)?t.withTimeZone(e):new Date(t),s=i.getUTCFullYear().toString().padStart(4,"0")+String(i.getUTCMonth()+1).padStart(2,"0")+i.getUTCDate().toString().padStart(2,"0");return e&&(s=i.getFullYear().toString().padStart(2,"0")+String(i.getMonth()+1).padStart(2,"0")+i.getDate().toString().padStart(2,"0")),n?s:e?(s+="T"+i.getHours().toString().padStart(2,"0")+i.getMinutes().toString().padStart(2,"0")+i.getSeconds().toString().padStart(2,"0"),s):(s+="T"+i.getUTCHours().toString().padStart(2,"0")+i.getUTCMinutes().toString().padStart(2,"0")+i.getUTCSeconds().toString().padStart(2,"0")+(a?"":"Z"),s)}else if(O(t)){let i=e?G(t)&&!t.tz()?t.clone().tz(e):t:a||n&&G(t)&&t.tz()?t:t.utc();return i.format("YYYYMMDD")+(n?"":"T"+i.format("HHmmss")+(a||e?"":"Z"))}else if(N(t)){let i=e?t.setZone(e):a||n&&t.zone.type!=="system"?t:t.setZone("utc");return i.toFormat("yyyyLLdd")+(n?"":"T"+i.toFormat("HHmmss")+(a||e?"":"Z"))}else if(C(t)){let i=t;return e&&(i=t.withTimeZone(t.timeZoneId)),!e&&t.timeZoneId!=="UTC"&&(i=t.withTimeZone("UTC")),l(null,i.toPlainDateTime(),n,a||!!e)}else if(A(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 l(e,i,n,a)}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")+(a||e?"":"Z")}else{if(R(t))return t.year.toString().padStart(4,"0")+t.month.toString().padStart(2,"0")+t.day.toString().padStart(2,"0")+(n?"":"T000000"+(a||e?"":"Z"));if(V(t)){let i=e||"UTC",s=t.toZonedDateTimeISO(i);return l(e,s,n,a)}else{let i=t;if(e)i=typeof t.tz=="function"?t.tz(e):t;else if(!a)if(typeof t.utc=="function")i=t.utc();else throw new Error("Unable to convert dayjs object to UTC value: UTC plugin is not available!");return i.format("YYYYMMDD")+(n?"":"T"+i.format("HHmmss")+(a||e?"":"Z"))}}}function S(e,t,n,a){let i="",s=a?.floating||!1;return a?.timezone&&(i=";TZID="+a.timezone,s=!0),t+i+":"+l(e,n,!1,s)}function T(e){let t=e.x.map(([n,a])=>n.toUpperCase()+":"+r(a,!1)).join(`\r
5
5
  `);return t.length?t+`\r
6
- `:""}function q(e){return typeof e=="object"&&e!==null&&!(e instanceof Date)&&!O(e)&&!N(e)&&!M(e)}function N(e){return typeof e=="object"&&e!==null&&"toJSDate"in e&&typeof e.toJSDate=="function"&&!M(e)}function O(e){return e!=null&&e._isAMomentObject!=null&&!M(e)}function H(e){return e!==null&&typeof e=="object"&&"asSeconds"in e&&typeof e.asSeconds=="function"}function G(e){return O(e)&&"tz"in e&&typeof e.tz=="function"}function w(e){return e!==null&&typeof e=="object"&&"between"in e&&typeof e.between=="function"&&typeof e.toString=="function"}function M(e){return C(e)||b(e)||R(e)||V(e)}function V(e){return typeof e=="object"&&e!==null&&!C(e)&&!b(e)&&!R(e)&&"toZonedDateTimeISO"in e&&typeof e.toZonedDateTimeISO=="function"&&!("year"in e)&&!("timeZoneId"in e)}function R(e){return typeof e=="object"&&e!==null&&!C(e)&&!b(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 b(e){return typeof e=="object"&&e!==null&&!C(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 C(e){return typeof e=="object"&&e!==null&&"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 Q(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 z(e){if(typeof e=="string"||e instanceof Date)return new Date(e);if(C(e)){let t=e.toInstant();return new Date(t.epochMilliseconds)}return b(e)?new Date(Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute,e.second)):R(e)?new Date(Date.UTC(e.year,e.month-1,e.day)):V(e)?new Date(e.epochMilliseconds):N(e)?e.toJSDate():e.toDate()}function I(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",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 h(e){return e?typeof e=="string"?e:C(e)?h(e.withTimeZone("UTC").toPlainDateTime()):(M(e),e.toJSON()):null}var U=(i=>(i.CHAIR="CHAIR",i.NON="NON-PARTICIPANT",i.OPT="OPT-PARTICIPANT",i.REQ="REQ-PARTICIPANT",i))(U||{}),W=(n=>(n.CLIENT="CLIENT",n.NONE="NONE",n.SERVER="SERVER",n))(W||{}),P=(s=>(s.ACCEPTED="ACCEPTED",s.DECLINED="DECLINED",s.DELEGATED="DELEGATED",s.NEEDSACTION="NEEDS-ACTION",s.TENTATIVE="TENTATIVE",s))(P||{}),v=(s=>(s.GROUP="GROUP",s.INDIVIDUAL="INDIVIDUAL",s.RESOURCE="RESOURCE",s.ROOM="ROOM",s.UNKNOWN="UNKNOWN",s))(v||{}),g=class e{data;parent;constructor(t,a){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=a,!this.parent)throw new Error("`event` option required!");if(!t.email)throw new Error("No value for `email` in ICalAttendee given!");t.name!==void 0&&this.name(t.name),t.email!==void 0&&this.email(t.email),t.mailto!==void 0&&this.mailto(t.mailto),t.sentBy!==void 0&&this.sentBy(t.sentBy),t.status!==void 0&&this.status(t.status),t.role!==void 0&&this.role(t.role),t.rsvp!==void 0&&this.rsvp(t.rsvp),t.type!==void 0&&this.type(t.type),t.delegatedTo!==void 0&&this.delegatedTo(t.delegatedTo),t.delegatedFrom!==void 0&&this.delegatedFrom(t.delegatedFrom),t.delegatesTo&&this.delegatesTo(t.delegatesTo),t.delegatesFrom&&this.delegatesFrom(t.delegatesFrom),t.scheduleAgent!==void 0&&this.scheduleAgent(t.scheduleAgent),t.x!==void 0&&this.x(t.x)}delegatedFrom(t){return t===void 0?this.data.delegatedFrom:(t?typeof t=="string"?this.data.delegatedFrom=new e(p("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(p("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 a=t instanceof e?t:this.parent.createAttendee(t);return this.delegatedFrom(a),a.delegatedTo(this),a}delegatesTo(t){let a=t instanceof e?t:this.parent.createAttendee(t);return this.delegatedTo(a),a.delegatedFrom(this),a}email(t){return t?(this.data.email=t,this):this.data.email}mailto(t){return t===void 0?this.data.mailto:(this.data.mailto=t||null,this)}name(t){return t===void 0?this.data.name:(this.data.name=t||null,this)}role(t){return t===void 0?this.data.role:(this.data.role=d(U,t),this)}rsvp(t){return t===void 0?this.data.rsvp:t===null?(this.data.rsvp=null,this):(this.data.rsvp=!!t,this)}scheduleAgent(t){return t===void 0?this.data.scheduleAgent:t?typeof t=="string"&&t.toUpperCase().startsWith("X-")?(this.data.scheduleAgent=t,this):(this.data.scheduleAgent=d(W,t),this):(this.data.scheduleAgent=null,this)}sentBy(t){return t?(this.data.sentBy=t,this):this.data.sentBy}status(t){return t===void 0?this.data.status:t?(this.data.status=d(P,t),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 t="ATTENDEE";if(!this.data.email)throw new Error("No value for `email` in ICalAttendee given!");return t+=";ROLE="+this.data.role,this.data.type&&(t+=";CUTYPE="+this.data.type),this.data.status&&(t+=";PARTSTAT="+this.data.status),this.data.rsvp!==null&&(t+=";RSVP="+this.data.rsvp.toString().toUpperCase()),this.data.sentBy!==null&&(t+=';SENT-BY="mailto:'+this.data.sentBy+'"'),this.data.delegatedTo&&(t+=';DELEGATED-TO="'+this.data.delegatedTo.email()+'"'),this.data.delegatedFrom&&(t+=';DELEGATED-FROM="'+this.data.delegatedFrom.email()+'"'),this.data.name&&(t+=';CN="'+r(this.data.name,!0)+'"'),this.data.email&&this.data.mailto&&(t+=";EMAIL="+r(this.data.email,!1)),this.data.scheduleAgent&&(t+=";SCHEDULE-AGENT="+this.data.scheduleAgent),this.data.x.length&&(t+=";"+this.data.x.map(([a,n])=>a.toUpperCase()+"="+r(n,!1)).join(";")),t+=":MAILTO:"+r(this.data.mailto||this.data.email,!1)+`\r
7
- `,t}type(t){return t===void 0?this.data.type:t?(this.data.type=d(v,t),this):(this.data.type=null,this)}x(t,a){if(t===void 0)return o(this.data);if(typeof t=="string"&&typeof a=="string")o(this.data,t,a);else if(typeof t=="object")o(this.data,t);else throw new Error("Either key or value is not a string!");return this}};var B=(n=>(n.audio="audio",n.display="display",n.email="email",n))(B||{}),X={end:"END",start:"START"},c=class{data;event;constructor(t,a){if(this.data={attach:null,attendees:[],description:null,interval:null,relatesTo:null,repeat:null,summary:null,trigger:-600,type:"display",x:[]},this.event=a,!a)throw new Error("`event` option required!");t.type!==void 0&&this.type(t.type),"trigger"in t&&t.trigger!==void 0&&this.trigger(t.trigger),"triggerBefore"in t&&t.triggerBefore!==void 0&&this.triggerBefore(t.triggerBefore),"triggerAfter"in t&&t.triggerAfter!==void 0&&this.triggerAfter(t.triggerAfter),t.repeat&&this.repeat(t.repeat),t.attach!==void 0&&this.attach(t.attach),t.description!==void 0&&this.description(t.description),t.summary!==void 0&&this.summary(t.summary),t.attendees!==void 0&&this.attendees(t.attendees),t.x!==void 0&&this.x(t.x)}attach(t){if(t===void 0)return this.data.attach;if(!t)return this.data.attach=null,this;let a;if(typeof t=="string")a={mime:null,uri:t};else if(typeof t=="object")a={mime:t.mime||null,uri:t.uri};else throw new 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(!a.uri)throw new Error("`attach.uri` is empty!");return this.data.attach={mime:a.mime,uri:a.uri},this}attendees(t){return t?(t.forEach(a=>this.createAttendee(a)),this):this.data.attendees}createAttendee(t){if(t instanceof g)return this.data.attendees.push(t),t;typeof t=="string"&&(t=p("data",t));let a=new g(t,this);return this.data.attendees.push(a),a}description(t){return t===void 0?this.data.description:t?(this.data.description=t,this):(this.data.description=null,this)}relatesTo(t){if(t===void 0)return this.data.relatesTo;if(!t)return this.data.relatesTo=null,this;if(!Object.values(X).includes(t))throw new Error("`relatesTo` is not correct, must be either `START` or `END`!");return this.data.relatesTo=t,this}repeat(t){if(t===void 0)return this.data.repeat;if(!t)return this.data.repeat=null,this;if(typeof t!="object")throw new Error("`repeat` is not correct, must be an object!");if(typeof t.times!="number"||!isFinite(t.times))throw new Error("`repeat.times` is not correct, must be numeric!");if(typeof t.interval!="number"||!isFinite(t.interval))throw new Error("`repeat.interval` is not correct, must be numeric!");return this.data.repeat=t,this}summary(t){return t===void 0?this.data.summary:t?(this.data.summary=t,this):(this.data.summary=null,this)}toJSON(){let t=this.trigger();return Object.assign({},this.data,{trigger:typeof t=="number"?t:h(t),x:this.x()})}toString(){let t=`BEGIN:VALARM\r
6
+ `:""}function q(e){return typeof e=="object"&&e!==null&&!(e instanceof Date)&&!O(e)&&!N(e)&&!M(e)}function N(e){return typeof e=="object"&&e!==null&&"toJSDate"in e&&typeof e.toJSDate=="function"&&!M(e)}function O(e){return e!=null&&e._isAMomentObject!=null&&!M(e)}function H(e){return e!==null&&typeof e=="object"&&"asSeconds"in e&&typeof e.asSeconds=="function"}function G(e){return O(e)&&"tz"in e&&typeof e.tz=="function"}function w(e){return e!==null&&typeof e=="object"&&"between"in e&&typeof e.between=="function"&&typeof e.toString=="function"}function M(e){return C(e)||A(e)||R(e)||V(e)}function V(e){return typeof e=="object"&&e!==null&&!C(e)&&!A(e)&&!R(e)&&"toZonedDateTimeISO"in e&&typeof e.toZonedDateTimeISO=="function"&&!("year"in e)&&!("timeZoneId"in e)}function R(e){return typeof e=="object"&&e!==null&&!C(e)&&!A(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 A(e){return typeof e=="object"&&e!==null&&!C(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 C(e){return typeof e=="object"&&e!==null&&"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 Q(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 z(e){if(typeof e=="string"||e instanceof Date)return new Date(e);if(C(e)){let t=e.toInstant();return new Date(t.epochMilliseconds)}return A(e)?new Date(Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute,e.second)):R(e)?new Date(Date.UTC(e.year,e.month-1,e.day)):V(e)?new Date(e.epochMilliseconds):N(e)?e.toJSDate():e.toDate()}function I(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",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 h(e){return e?typeof e=="string"?e:C(e)?h(e.withTimeZone("UTC").toPlainDateTime()):(M(e),e.toJSON()):null}var U=(i=>(i.CHAIR="CHAIR",i.NON="NON-PARTICIPANT",i.OPT="OPT-PARTICIPANT",i.REQ="REQ-PARTICIPANT",i))(U||{}),X=(a=>(a.CLIENT="CLIENT",a.NONE="NONE",a.SERVER="SERVER",a))(X||{}),P=(s=>(s.ACCEPTED="ACCEPTED",s.DECLINED="DECLINED",s.DELEGATED="DELEGATED",s.NEEDSACTION="NEEDS-ACTION",s.TENTATIVE="TENTATIVE",s))(P||{}),v=(s=>(s.GROUP="GROUP",s.INDIVIDUAL="INDIVIDUAL",s.RESOURCE="RESOURCE",s.ROOM="ROOM",s.UNKNOWN="UNKNOWN",s))(v||{}),g=class e{data;parent;constructor(t,n){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=n,!this.parent)throw new Error("`event` option required!");if(!t.email)throw new Error("No value for `email` in ICalAttendee given!");t.name!==void 0&&this.name(t.name),t.email!==void 0&&this.email(t.email),t.mailto!==void 0&&this.mailto(t.mailto),t.sentBy!==void 0&&this.sentBy(t.sentBy),t.status!==void 0&&this.status(t.status),t.role!==void 0&&this.role(t.role),t.rsvp!==void 0&&this.rsvp(t.rsvp),t.type!==void 0&&this.type(t.type),t.delegatedTo!==void 0&&this.delegatedTo(t.delegatedTo),t.delegatedFrom!==void 0&&this.delegatedFrom(t.delegatedFrom),t.delegatesTo&&this.delegatesTo(t.delegatesTo),t.delegatesFrom&&this.delegatesFrom(t.delegatesFrom),t.scheduleAgent!==void 0&&this.scheduleAgent(t.scheduleAgent),t.x!==void 0&&this.x(t.x)}delegatedFrom(t){return t===void 0?this.data.delegatedFrom:(t?typeof t=="string"?this.data.delegatedFrom=new e(p("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(p("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(t){return t?(this.data.email=t,this):this.data.email}mailto(t){return t===void 0?this.data.mailto:(this.data.mailto=t||null,this)}name(t){return t===void 0?this.data.name:(this.data.name=t||null,this)}role(t){return t===void 0?this.data.role:(this.data.role=d(U,t),this)}rsvp(t){return t===void 0?this.data.rsvp:t===null?(this.data.rsvp=null,this):(this.data.rsvp=!!t,this)}scheduleAgent(t){return t===void 0?this.data.scheduleAgent:t?typeof t=="string"&&t.toUpperCase().startsWith("X-")?(this.data.scheduleAgent=t,this):(this.data.scheduleAgent=d(X,t),this):(this.data.scheduleAgent=null,this)}sentBy(t){return t?(this.data.sentBy=t,this):this.data.sentBy}status(t){return t===void 0?this.data.status:t?(this.data.status=d(P,t),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 t="ATTENDEE";if(!this.data.email)throw new Error("No value for `email` in ICalAttendee given!");return t+=";ROLE="+this.data.role,this.data.type&&(t+=";CUTYPE="+this.data.type),this.data.status&&(t+=";PARTSTAT="+this.data.status),this.data.rsvp!==null&&(t+=";RSVP="+this.data.rsvp.toString().toUpperCase()),this.data.sentBy!==null&&(t+=';SENT-BY="mailto:'+this.data.sentBy+'"'),this.data.delegatedTo&&(t+=';DELEGATED-TO="'+this.data.delegatedTo.email()+'"'),this.data.delegatedFrom&&(t+=';DELEGATED-FROM="'+this.data.delegatedFrom.email()+'"'),this.data.name&&(t+=';CN="'+r(this.data.name,!0)+'"'),this.data.email&&this.data.mailto&&(t+=";EMAIL="+r(this.data.email,!1)),this.data.scheduleAgent&&(t+=";SCHEDULE-AGENT="+this.data.scheduleAgent),this.data.x.length&&(t+=";"+this.data.x.map(([n,a])=>n.toUpperCase()+"="+r(a,!1)).join(";")),t+=":MAILTO:"+r(this.data.mailto||this.data.email,!1)+`\r
7
+ `,t}type(t){return t===void 0?this.data.type:t?(this.data.type=d(v,t),this):(this.data.type=null,this)}x(t,n){if(t===void 0)return o(this.data);if(typeof t=="string"&&typeof n=="string")o(this.data,t,n);else if(typeof t=="object")o(this.data,t);else throw new Error("Either key or value is not a string!");return this}};var B=(a=>(a.audio="audio",a.display="display",a.email="email",a))(B||{}),W={end:"END",start:"START"},c=class{data;event;constructor(t,n){if(this.data={attach:null,attendees:[],description:null,interval:null,relatesTo:null,repeat:null,summary:null,trigger:-600,type:"display",x:[]},this.event=n,!n)throw new Error("`event` option required!");t.type!==void 0&&this.type(t.type),"trigger"in t&&t.trigger!==void 0&&this.trigger(t.trigger),"triggerBefore"in t&&t.triggerBefore!==void 0&&this.triggerBefore(t.triggerBefore),"triggerAfter"in t&&t.triggerAfter!==void 0&&this.triggerAfter(t.triggerAfter),t.repeat&&this.repeat(t.repeat),t.attach!==void 0&&this.attach(t.attach),t.description!==void 0&&this.description(t.description),t.summary!==void 0&&this.summary(t.summary),t.attendees!==void 0&&this.attendees(t.attendees),t.x!==void 0&&this.x(t.x)}attach(t){if(t===void 0)return this.data.attach;if(!t)return this.data.attach=null,this;let n;if(typeof t=="string")n={mime:null,uri:t};else if(typeof t=="object")n={mime:t.mime||null,uri:t.uri};else throw new 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(!n.uri)throw new Error("`attach.uri` is empty!");return this.data.attach={mime:n.mime,uri:n.uri},this}attendees(t){return t?(t.forEach(n=>this.createAttendee(n)),this):this.data.attendees}createAttendee(t){if(t instanceof g)return this.data.attendees.push(t),t;typeof t=="string"&&(t=p("data",t));let n=new g(t,this);return this.data.attendees.push(n),n}description(t){return t===void 0?this.data.description:t?(this.data.description=t,this):(this.data.description=null,this)}relatesTo(t){if(t===void 0)return this.data.relatesTo;if(!t)return this.data.relatesTo=null,this;if(!Object.values(W).includes(t))throw new Error("`relatesTo` is not correct, must be either `START` or `END`!");return this.data.relatesTo=t,this}repeat(t){if(t===void 0)return this.data.repeat;if(!t)return this.data.repeat=null,this;if(typeof t!="object")throw new Error("`repeat` is not correct, must be an object!");if(typeof t.times!="number"||!isFinite(t.times))throw new Error("`repeat.times` is not correct, must be numeric!");if(typeof t.interval!="number"||!isFinite(t.interval))throw new Error("`repeat.interval` is not correct, must be numeric!");return this.data.repeat=t,this}summary(t){return t===void 0?this.data.summary:t?(this.data.summary=t,this):(this.data.summary=null,this)}toJSON(){let t=this.trigger();return Object.assign({},this.data,{trigger:typeof t=="number"?t:h(t),x:this.x()})}toString(){let t=`BEGIN:VALARM\r
8
8
  `;if(t+="ACTION:"+this.data.type.toUpperCase()+`\r
9
9
  `,typeof this.data.trigger=="number"&&this.data.relatesTo===null?this.data.trigger>0?t+="TRIGGER;RELATED=END:"+I(this.data.trigger)+`\r
10
10
  `:t+="TRIGGER:"+I(this.data.trigger)+`\r
@@ -19,8 +19,8 @@ var x=(u=>(u.DAILY="DAILY",u.HOURLY="HOURLY",u.MINUTELY="MINUTELY",u.MONTHLY="MO
19
19
  `:this.data.type!=="audio"&&(t+="DESCRIPTION:"+r(this.event.summary(),!1)+`\r
20
20
  `),this.data.type==="email"&&this.data.summary?t+="SUMMARY:"+r(this.data.summary,!1)+`\r
21
21
  `:this.data.type==="email"&&(t+="SUMMARY:"+r(this.event.summary(),!1)+`\r
22
- `),this.data.type==="email"&&this.data.attendees.forEach(a=>{t+=a.toString()}),t+=T(this.data),t+=`END:VALARM\r
23
- `,t}trigger(t){if(t===void 0&&typeof this.data.trigger=="number")return-1*this.data.trigger;if(t===void 0)return this.data.trigger;if(typeof t=="number"&&isFinite(t))this.data.trigger=-1*t;else{if(!t||typeof t=="number")throw new Error("`trigger` is not correct, must be a finite number or a supported date!");this.data.trigger=m(t,"trigger")}return this}triggerAfter(t){return t===void 0?this.data.trigger:this.trigger(typeof t=="number"?-1*t:t)}triggerBefore(t){return t===void 0?this.trigger():this.trigger(t)}type(t){if(t===void 0)return this.data.type;if(!t||!Object.keys(B).includes(t))throw new Error("`type` is not correct, must be either `display` or `audio`!");return this.data.type=t,this}x(t,a){if(t===void 0)return o(this.data);if(typeof t=="string"&&typeof a=="string")o(this.data,t,a);else if(typeof t=="object")o(this.data,t);else throw new Error("Either key or value is not a string!");return this}};var y=class{data;constructor(t){if(this.data={name:""},!t.name)throw new Error("No value for `name` in ICalCategory given!");this.name(t.name)}name(t){return t===void 0?this.data.name:(this.data.name=t,this)}toJSON(){return Object.assign({},this.data)}toString(){return r(this.data.name,!1)}};var Z=(i=>(i.BUSY="BUSY",i.FREE="FREE",i.OOF="OOF",i.TENTATIVE="TENTATIVE",i))(Z||{}),F=(n=>(n.CONFIDENTIAL="CONFIDENTIAL",n.PRIVATE="PRIVATE",n.PUBLIC="PUBLIC",n))(F||{}),J=(n=>(n.CANCELLED="CANCELLED",n.CONFIRMED="CONFIRMED",n.TENTATIVE="TENTATIVE",n))(J||{}),k=(a=>(a.OPAQUE="OPAQUE",a.TRANSPARENT="TRANSPARENT",a))(k||{}),D=class{calendar;data;constructor(t,a){if(this.data={alarms:[],allDay:!1,attachments:[],attendees:[],busystatus:null,categories:[],class:null,created:null,description:null,end:null,floating:!1,id:crypto.randomUUID(),lastModified:null,location:null,organizer:null,priority:null,recurrenceId:null,repeating:null,sequence:0,stamp:new Date,start:new Date,status:null,summary:"",timezone:null,transparency:null,url:null,x:[]},this.calendar=a,!a)throw new Error("`calendar` option required!");t.id&&this.id(t.id),t.sequence!==void 0&&this.sequence(t.sequence),t.start&&this.start(t.start),t.end!==void 0&&this.end(t.end),t.recurrenceId!==void 0&&this.recurrenceId(t.recurrenceId),t.timezone!==void 0&&this.timezone(t.timezone),t.stamp!==void 0&&this.stamp(t.stamp),t.allDay!==void 0&&this.allDay(t.allDay),t.floating!==void 0&&this.floating(t.floating),t.repeating!==void 0&&this.repeating(t.repeating),t.summary!==void 0&&this.summary(t.summary),t.location!==void 0&&this.location(t.location),t.description!==void 0&&this.description(t.description),t.organizer!==void 0&&this.organizer(t.organizer),t.attendees!==void 0&&this.attendees(t.attendees),t.alarms!==void 0&&this.alarms(t.alarms),t.categories!==void 0&&this.categories(t.categories),t.status!==void 0&&this.status(t.status),t.busystatus!==void 0&&this.busystatus(t.busystatus),t.priority!==void 0&&this.priority(t.priority),t.url!==void 0&&this.url(t.url),t.attachments!==void 0&&this.attachments(t.attachments),t.transparency!==void 0&&this.transparency(t.transparency),t.created!==void 0&&this.created(t.created),t.lastModified!==void 0&&this.lastModified(t.lastModified),t.class!==void 0&&this.class(t.class),t.x!==void 0&&this.x(t.x)}alarms(t){return t?(t.forEach(a=>this.createAlarm(a)),this):this.data.alarms}allDay(t){return t===void 0?this.data.allDay:(this.data.allDay=!!t,this)}attachments(t){return t?(t.forEach(a=>this.createAttachment(a)),this):this.data.attachments}attendees(t){return t?(t.forEach(a=>this.createAttendee(a)),this):this.data.attendees}busystatus(t){return t===void 0?this.data.busystatus:t===null?(this.data.busystatus=null,this):(this.data.busystatus=d(Z,t),this)}categories(t){return t?(t.forEach(a=>this.createCategory(a)),this):this.data.categories}class(t){return t===void 0?this.data.class:t===null?(this.data.class=null,this):(this.data.class=d(F,t),this)}createAlarm(t){let a=t instanceof c?t:new c(t,this);return this.data.alarms.push(a),a}createAttachment(t){return this.data.attachments.push(t),this}createAttendee(t){if(t instanceof g)return this.data.attendees.push(t),t;typeof t=="string"&&(t=p("data",t));let a=new g(t,this);return this.data.attendees.push(a),a}createCategory(t){let a=t instanceof y?t:new y(t);return this.data.categories.push(a),a}created(t){return t===void 0?this.data.created:t===null?(this.data.created=null,this):(this.data.created=m(t,"created"),this)}description(t){return t===void 0?this.data.description:t===null?(this.data.description=null,this):(typeof t=="string"?this.data.description={plain:t}:this.data.description=t,this)}end(t){return t===void 0?(this.swapStartAndEndIfRequired(),this.data.end):t===null?(this.data.end=null,this):(this.data.end=m(t,"end"),this)}floating(t){return t===void 0?this.data.floating:(this.data.floating=!!t,this.data.floating&&(this.data.timezone=null),this)}id(t){return t===void 0?this.data.id:(this.data.id=String(t),this)}lastModified(t){return t===void 0?this.data.lastModified:t===null?(this.data.lastModified=null,this):(this.data.lastModified=m(t,"lastModified"),this)}location(t){if(t===void 0)return this.data.location;if(typeof t=="string")return this.data.location={title:t},this;if(t&&("title"in t&&!t.title||t?.geo&&(typeof t.geo.lat!="number"||!isFinite(t.geo.lat)||typeof t.geo.lon!="number"||!isFinite(t.geo.lon))||!("title"in t)&&!t?.geo))throw new Error("`location` isn't formatted correctly. See https://sebbo2002.github.io/ical-generator/develop/reference/classes/ICalEvent.html#location");return this.data.location=t||null,this}organizer(t){return t===void 0?this.data.organizer:t===null?(this.data.organizer=null,this):(this.data.organizer=p("organizer",t),this)}priority(t){if(t===void 0)return this.data.priority;if(t===null)return this.data.priority=null,this;if(t<0||t>9)throw new Error("`priority` is invalid, musst be 0 \u2264 priority \u2264 9.");return this.data.priority=Math.round(t),this}recurrenceId(t){return t===void 0?this.data.recurrenceId:t===null?(this.data.recurrenceId=null,this):(this.data.recurrenceId=m(t,"recurrenceId"),this)}repeating(t){if(t===void 0)return this.data.repeating;if(!t)return this.data.repeating=null,this;if(w(t)||typeof t=="string")return this.data.repeating=t,this;if(this.data.repeating={freq:d(x,t.freq)},t.count){if(!isFinite(t.count))throw new Error("`repeating.count` must be a finite number!");this.data.repeating.count=t.count}if(t.interval){if(!isFinite(t.interval))throw new Error("`repeating.interval` must be a finite number!");this.data.repeating.interval=t.interval}if(t.until!==void 0&&(this.data.repeating.until=m(t.until,"repeating.until")),t.byDay){let a=Array.isArray(t.byDay)?t.byDay:[t.byDay];this.data.repeating.byDay=a.map(n=>d(E,n))}if(t.byMonth){let a=Array.isArray(t.byMonth)?t.byMonth:[t.byMonth];this.data.repeating.byMonth=a.map(n=>{if(typeof n!="number"||n<1||n>12)throw new Error("`repeating.byMonth` contains invalid value `"+n+"`!");return n})}if(t.byMonthDay){let a=Array.isArray(t.byMonthDay)?t.byMonthDay:[t.byMonthDay];this.data.repeating.byMonthDay=a.map(n=>{if(typeof n!="number"||n<-31||n>31||n===0)throw new Error("`repeating.byMonthDay` contains invalid value `"+n+"`!");return n})}if(t.bySetPos){if(!this.data.repeating.byDay)throw"`repeating.bySetPos` must be used along with `repeating.byDay`!";let a=Array.isArray(t.bySetPos)?t.bySetPos:[t.bySetPos];this.data.repeating.bySetPos=a.map(n=>{if(typeof n!="number"||n<-366||n>366||n===0)throw"`repeating.bySetPos` contains invalid value `"+n+"`!";return n})}if(t.exclude){let a=Array.isArray(t.exclude)?t.exclude:[t.exclude];this.data.repeating.exclude=a.map((n,i)=>m(n,`repeating.exclude[${i}]`))}return t.startOfWeek&&(this.data.repeating.startOfWeek=d(E,t.startOfWeek)),this}sequence(t){if(t===void 0)return this.data.sequence;let a=parseInt(String(t),10);if(isNaN(a))throw new Error("`sequence` must be a number!");return this.data.sequence=t,this}stamp(t){return t===void 0?this.data.stamp:(this.data.stamp=m(t,"stamp"),this)}start(t){return t===void 0?(this.swapStartAndEndIfRequired(),this.data.start):(this.data.start=m(t,"start"),this)}status(t){return t===void 0?this.data.status:t===null?(this.data.status=null,this):(this.data.status=d(J,t),this)}summary(t){return t===void 0?this.data.summary:(this.data.summary=t?String(t):"",this)}timestamp(t){return t===void 0?this.stamp():this.stamp(t)}timezone(t){return t===void 0&&this.data.timezone!==null?this.data.timezone:t===void 0?this.calendar.timezone():(this.data.timezone=t&&t!=="UTC"?t.toString():null,this.data.timezone&&(this.data.floating=!1),this)}toJSON(){let t=null;return w(this.data.repeating)||typeof this.data.repeating=="string"?t=this.data.repeating.toString():this.data.repeating&&(t=Object.assign({},this.data.repeating,{exclude:this.data.repeating.exclude?.map(a=>h(a)),until:h(this.data.repeating.until)||void 0})),this.swapStartAndEndIfRequired(),Object.assign({},this.data,{created:h(this.data.created)||null,end:h(this.data.end)||null,lastModified:h(this.data.lastModified)||null,recurrenceId:h(this.data.recurrenceId)||null,repeating:t,stamp:h(this.data.stamp)||null,start:h(this.data.start)||null,x:this.x()})}toString(){let t="";if(t+=`BEGIN:VEVENT\r
22
+ `),this.data.type==="email"&&this.data.attendees.forEach(n=>{t+=n.toString()}),t+=T(this.data),t+=`END:VALARM\r
23
+ `,t}trigger(t){if(t===void 0&&typeof this.data.trigger=="number")return-1*this.data.trigger;if(t===void 0)return this.data.trigger;if(typeof t=="number"&&isFinite(t))this.data.trigger=-1*t;else{if(!t||typeof t=="number")throw new Error("`trigger` is not correct, must be a finite number or a supported date!");this.data.trigger=m(t,"trigger")}return this}triggerAfter(t){return t===void 0?this.data.trigger:this.trigger(typeof t=="number"?-1*t:t)}triggerBefore(t){return t===void 0?this.trigger():this.trigger(t)}type(t){if(t===void 0)return this.data.type;if(!t||!Object.keys(B).includes(t))throw new Error("`type` is not correct, must be either `display` or `audio`!");return this.data.type=t,this}x(t,n){if(t===void 0)return o(this.data);if(typeof t=="string"&&typeof n=="string")o(this.data,t,n);else if(typeof t=="object")o(this.data,t);else throw new Error("Either key or value is not a string!");return this}};var y=class{data;constructor(t){if(this.data={name:""},!t.name)throw new Error("No value for `name` in ICalCategory given!");this.name(t.name)}name(t){return t===void 0?this.data.name:(this.data.name=t,this)}toJSON(){return Object.assign({},this.data)}toString(){return r(this.data.name,!1)}};var Z=(i=>(i.BUSY="BUSY",i.FREE="FREE",i.OOF="OOF",i.TENTATIVE="TENTATIVE",i))(Z||{}),F=(a=>(a.CONFIDENTIAL="CONFIDENTIAL",a.PRIVATE="PRIVATE",a.PUBLIC="PUBLIC",a))(F||{}),J=(a=>(a.CANCELLED="CANCELLED",a.CONFIRMED="CONFIRMED",a.TENTATIVE="TENTATIVE",a))(J||{}),k=(n=>(n.OPAQUE="OPAQUE",n.TRANSPARENT="TRANSPARENT",n))(k||{}),D=class{calendar;data;constructor(t,n){if(this.data={alarms:[],allDay:!1,attachments:[],attendees:[],busystatus:null,categories:[],class:null,created:null,description:null,end:null,floating:!1,id:crypto.randomUUID(),lastModified:null,location:null,organizer:null,priority:null,recurrenceId:null,repeating:null,sequence:0,stamp:new Date,start:new Date,status:null,summary:"",timezone:null,transparency:null,url:null,x:[]},this.calendar=n,!n)throw new Error("`calendar` option required!");t.id&&this.id(t.id),t.sequence!==void 0&&this.sequence(t.sequence),t.start&&this.start(t.start),t.end!==void 0&&this.end(t.end),t.recurrenceId!==void 0&&this.recurrenceId(t.recurrenceId),t.timezone!==void 0&&this.timezone(t.timezone),t.stamp!==void 0&&this.stamp(t.stamp),t.allDay!==void 0&&this.allDay(t.allDay),t.floating!==void 0&&this.floating(t.floating),t.repeating!==void 0&&this.repeating(t.repeating),t.summary!==void 0&&this.summary(t.summary),t.location!==void 0&&this.location(t.location),t.description!==void 0&&this.description(t.description),t.organizer!==void 0&&this.organizer(t.organizer),t.attendees!==void 0&&this.attendees(t.attendees),t.alarms!==void 0&&this.alarms(t.alarms),t.categories!==void 0&&this.categories(t.categories),t.status!==void 0&&this.status(t.status),t.busystatus!==void 0&&this.busystatus(t.busystatus),t.priority!==void 0&&this.priority(t.priority),t.url!==void 0&&this.url(t.url),t.attachments!==void 0&&this.attachments(t.attachments),t.transparency!==void 0&&this.transparency(t.transparency),t.created!==void 0&&this.created(t.created),t.lastModified!==void 0&&this.lastModified(t.lastModified),t.class!==void 0&&this.class(t.class),t.x!==void 0&&this.x(t.x)}alarms(t){return t?(t.forEach(n=>this.createAlarm(n)),this):this.data.alarms}allDay(t){return t===void 0?this.data.allDay:(this.data.allDay=!!t,this)}attachments(t){return t?(t.forEach(n=>this.createAttachment(n)),this):this.data.attachments}attendees(t){return t?(t.forEach(n=>this.createAttendee(n)),this):this.data.attendees}busystatus(t){return t===void 0?this.data.busystatus:t===null?(this.data.busystatus=null,this):(this.data.busystatus=d(Z,t),this)}categories(t){return t?(t.forEach(n=>this.createCategory(n)),this):this.data.categories}class(t){return t===void 0?this.data.class:t===null?(this.data.class=null,this):(this.data.class=d(F,t),this)}createAlarm(t){let n=t instanceof c?t:new c(t,this);return this.data.alarms.push(n),n}createAttachment(t){return this.data.attachments.push(t),this}createAttendee(t){if(t instanceof g)return this.data.attendees.push(t),t;typeof t=="string"&&(t=p("data",t));let n=new g(t,this);return this.data.attendees.push(n),n}createCategory(t){let n=t instanceof y?t:new y(t);return this.data.categories.push(n),n}created(t){return t===void 0?this.data.created:t===null?(this.data.created=null,this):(this.data.created=m(t,"created"),this)}description(t){return t===void 0?this.data.description:t===null?(this.data.description=null,this):(typeof t=="string"?this.data.description={plain:t}:this.data.description=t,this)}end(t){return t===void 0?(this.swapStartAndEndIfRequired(),this.data.end):t===null?(this.data.end=null,this):(this.data.end=m(t,"end"),this)}floating(t){return t===void 0?this.data.floating:(this.data.floating=!!t,this.data.floating&&(this.data.timezone=null),this)}id(t){return t===void 0?this.data.id:(this.data.id=String(t),this)}lastModified(t){return t===void 0?this.data.lastModified:t===null?(this.data.lastModified=null,this):(this.data.lastModified=m(t,"lastModified"),this)}location(t){if(t===void 0)return this.data.location;if(typeof t=="string")return this.data.location={title:t},this;if(t&&("title"in t&&!t.title||t?.geo&&(typeof t.geo.lat!="number"||!isFinite(t.geo.lat)||typeof t.geo.lon!="number"||!isFinite(t.geo.lon))||!("title"in t)&&!t?.geo))throw new Error("`location` isn't formatted correctly. See https://sebbo2002.github.io/ical-generator/develop/reference/classes/ICalEvent.html#location");return this.data.location=t||null,this}organizer(t){return t===void 0?this.data.organizer:t===null?(this.data.organizer=null,this):(this.data.organizer=p("organizer",t),this)}priority(t){if(t===void 0)return this.data.priority;if(t===null)return this.data.priority=null,this;if(t<0||t>9)throw new Error("`priority` is invalid, musst be 0 \u2264 priority \u2264 9.");return this.data.priority=Math.round(t),this}recurrenceId(t){return t===void 0?this.data.recurrenceId:t===null?(this.data.recurrenceId=null,this):(this.data.recurrenceId=m(t,"recurrenceId"),this)}repeating(t){if(t===void 0)return this.data.repeating;if(!t)return this.data.repeating=null,this;if(w(t)||typeof t=="string")return this.data.repeating=t,this;if(this.data.repeating={freq:d(x,t.freq)},t.count){if(!isFinite(t.count))throw new Error("`repeating.count` must be a finite number!");this.data.repeating.count=t.count}if(t.interval){if(!isFinite(t.interval))throw new Error("`repeating.interval` must be a finite number!");this.data.repeating.interval=t.interval}if(t.until!==void 0&&(this.data.repeating.until=m(t.until,"repeating.until")),t.byDay){let n=Array.isArray(t.byDay)?t.byDay:[t.byDay];this.data.repeating.byDay=n.map(a=>d(E,a))}if(t.byMonth){let n=Array.isArray(t.byMonth)?t.byMonth:[t.byMonth];this.data.repeating.byMonth=n.map(a=>{if(typeof a!="number"||a<1||a>12)throw new Error("`repeating.byMonth` contains invalid value `"+a+"`!");return a})}if(t.byMonthDay){let n=Array.isArray(t.byMonthDay)?t.byMonthDay:[t.byMonthDay];this.data.repeating.byMonthDay=n.map(a=>{if(typeof a!="number"||a<-31||a>31||a===0)throw new Error("`repeating.byMonthDay` contains invalid value `"+a+"`!");return a})}if(t.bySetPos){if(!this.data.repeating.byDay)throw"`repeating.bySetPos` must be used along with `repeating.byDay`!";let n=Array.isArray(t.bySetPos)?t.bySetPos:[t.bySetPos];this.data.repeating.bySetPos=n.map(a=>{if(typeof a!="number"||a<-366||a>366||a===0)throw"`repeating.bySetPos` contains invalid value `"+a+"`!";return a})}if(t.exclude){let n=Array.isArray(t.exclude)?t.exclude:[t.exclude];this.data.repeating.exclude=n.map((a,i)=>m(a,`repeating.exclude[${i}]`))}return t.startOfWeek&&(this.data.repeating.startOfWeek=d(E,t.startOfWeek)),this}sequence(t){if(t===void 0)return this.data.sequence;let n=parseInt(String(t),10);if(isNaN(n))throw new Error("`sequence` must be a number!");return this.data.sequence=t,this}stamp(t){return t===void 0?this.data.stamp:(this.data.stamp=m(t,"stamp"),this)}start(t){return t===void 0?(this.swapStartAndEndIfRequired(),this.data.start):(this.data.start=m(t,"start"),this)}status(t){return t===void 0?this.data.status:t===null?(this.data.status=null,this):(this.data.status=d(J,t),this)}summary(t){return t===void 0?this.data.summary:(this.data.summary=t?String(t):"",this)}timestamp(t){return t===void 0?this.stamp():this.stamp(t)}timezone(t){return t===void 0&&this.data.timezone!==null?this.data.timezone:t===void 0?this.calendar.timezone():(this.data.timezone=t&&t!=="UTC"?t.toString():null,this.data.timezone&&(this.data.floating=!1),this)}toJSON(){let t=null;return w(this.data.repeating)||typeof this.data.repeating=="string"?t=this.data.repeating.toString():this.data.repeating&&(t=Object.assign({},this.data.repeating,{exclude:this.data.repeating.exclude?.map(n=>h(n)),until:h(this.data.repeating.until)||void 0})),this.swapStartAndEndIfRequired(),Object.assign({},this.data,{created:h(this.data.created)||null,end:h(this.data.end)||null,lastModified:h(this.data.lastModified)||null,recurrenceId:h(this.data.recurrenceId)||null,repeating:t,stamp:h(this.data.stamp)||null,start:h(this.data.start)||null,x:this.x()})}toString(){let t="";if(t+=`BEGIN:VEVENT\r
24
24
  `,t+="UID:"+this.data.id+`\r
25
25
  `,t+="SEQUENCE:"+this.data.sequence+`\r
26
26
  `,this.swapStartAndEndIfRequired(),t+="DTSTAMP:"+l(this.calendar.timezone(),this.data.stamp)+`\r
@@ -30,15 +30,15 @@ var x=(u=>(u.DAILY="DAILY",u.HOURLY="HOURLY",u.MINUTELY="MINUTELY",u.MONTHLY="MO
30
30
  `,t+=`X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE\r
31
31
  `):(t+=S(this.timezone(),"DTSTART",this.data.start,this.data)+`\r
32
32
  `,this.data.end&&(t+=S(this.timezone(),"DTEND",this.data.end,this.data)+`\r
33
- `)),w(this.data.repeating)||typeof this.data.repeating=="string"){let a=this.data.repeating.toString().replace(/\r\n/g,`
33
+ `)),w(this.data.repeating)||typeof this.data.repeating=="string"){let n=this.data.repeating.toString().replace(/\r\n/g,`
34
34
  `).split(`
35
- `).filter(n=>n&&!n.startsWith("DTSTART:")).join(`\r
36
- `);!a.includes(`\r
37
- `)&&!a.startsWith("RRULE:")&&(a="RRULE:"+a),t+=a.trim()+`\r
35
+ `).filter(a=>a&&!a.startsWith("DTSTART:")).join(`\r
36
+ `);!n.includes(`\r
37
+ `)&&!n.startsWith("RRULE:")&&(n="RRULE:"+n),t+=n.trim()+`\r
38
38
  `}else this.data.repeating&&(t+="RRULE:FREQ="+this.data.repeating.freq,this.data.repeating.count&&(t+=";COUNT="+this.data.repeating.count),this.data.repeating.interval&&(t+=";INTERVAL="+this.data.repeating.interval),this.data.repeating.until&&(t+=";UNTIL="+l(this.calendar.timezone(),this.data.repeating.until,!1,this.floating())),this.data.repeating.byDay&&(t+=";BYDAY="+this.data.repeating.byDay.join(",")),this.data.repeating.byMonth&&(t+=";BYMONTH="+this.data.repeating.byMonth.join(",")),this.data.repeating.byMonthDay&&(t+=";BYMONTHDAY="+this.data.repeating.byMonthDay.join(",")),this.data.repeating.bySetPos&&(t+=";BYSETPOS="+this.data.repeating.bySetPos.join(",")),this.data.repeating.startOfWeek&&(t+=";WKST="+this.data.repeating.startOfWeek),t+=`\r
39
- `,this.data.repeating.exclude&&(this.data.allDay?t+="EXDATE;VALUE=DATE:"+this.data.repeating.exclude.map(a=>l(this.calendar.timezone(),a,!0)).join(",")+`\r
40
- `:(t+="EXDATE",this.timezone()?t+=";TZID="+this.timezone()+":"+this.data.repeating.exclude.map(a=>l(this.timezone(),a,!1,!0)).join(",")+`\r
41
- `:t+=":"+this.data.repeating.exclude.map(a=>l(this.timezone(),a,!1,this.floating())).join(",")+`\r
39
+ `,this.data.repeating.exclude&&(this.data.allDay?t+="EXDATE;VALUE=DATE:"+this.data.repeating.exclude.map(n=>l(this.calendar.timezone(),n,!0)).join(",")+`\r
40
+ `:(t+="EXDATE",this.timezone()?t+=";TZID="+this.timezone()+":"+this.data.repeating.exclude.map(n=>l(this.timezone(),n,!1,!0)).join(",")+`\r
41
+ `:t+=":"+this.data.repeating.exclude.map(n=>l(this.timezone(),n,!1,this.floating())).join(",")+`\r
42
42
  `)));return this.data.recurrenceId&&(t+=S(this.timezone(),"RECURRENCE-ID",this.data.recurrenceId,this.data)+`\r
43
43
  `),t+="SUMMARY:"+r(this.data.summary,!1)+`\r
44
44
  `,this.data.transparency&&(t+="TRANSP:"+r(this.data.transparency,!1)+`\r
@@ -49,9 +49,9 @@ var x=(u=>(u.DAILY="DAILY",u.HOURLY="HOURLY",u.MINUTELY="MINUTELY",u.MONTHLY="MO
49
49
  `),this.data.description&&(t+="DESCRIPTION:"+r(this.data.description.plain,!1)+`\r
50
50
  `,this.data.description.html&&(t+="X-ALT-DESC;FMTTYPE=text/html:"+r(this.data.description.html,!1)+`\r
51
51
  `)),this.data.organizer&&(t+='ORGANIZER;CN="'+r(this.data.organizer.name,!0)+'"',this.data.organizer.sentBy&&(t+=';SENT-BY="mailto:'+r(this.data.organizer.sentBy,!0)+'"'),this.data.organizer.email&&this.data.organizer.mailto&&(t+=";EMAIL="+r(this.data.organizer.email,!1)),t+=":",this.data.organizer.email&&(t+="mailto:"+r(this.data.organizer.mailto||this.data.organizer.email,!1)),t+=`\r
52
- `),this.data.attendees.forEach(function(a){t+=a.toString()}),this.data.alarms.forEach(function(a){t+=a.toString()}),this.data.categories.length>0&&(t+="CATEGORIES:"+this.data.categories.map(a=>a.toString()).join()+`\r
52
+ `),this.data.attendees.forEach(function(n){t+=n.toString()}),this.data.alarms.forEach(function(n){t+=n.toString()}),this.data.categories.length>0&&(t+="CATEGORIES:"+this.data.categories.map(n=>n.toString()).join()+`\r
53
53
  `),this.data.url&&(t+="URL;VALUE=URI:"+r(this.data.url,!1)+`\r
54
- `),this.data.attachments.length>0&&this.data.attachments.forEach(a=>{t+="ATTACH:"+r(a,!1)+`\r
54
+ `),this.data.attachments.length>0&&this.data.attachments.forEach(n=>{t+="ATTACH:"+r(n,!1)+`\r
55
55
  `}),this.data.status&&(t+="STATUS:"+this.data.status.toUpperCase()+`\r
56
56
  `),this.data.busystatus&&(t+="X-MICROSOFT-CDO-BUSYSTATUS:"+this.data.busystatus.toUpperCase()+`\r
57
57
  `),this.data.priority!==null&&(t+="PRIORITY:"+this.data.priority+`\r
@@ -59,7 +59,7 @@ var x=(u=>(u.DAILY="DAILY",u.HOURLY="HOURLY",u.MINUTELY="MINUTELY",u.MONTHLY="MO
59
59
  `),this.data.lastModified&&(t+="LAST-MODIFIED:"+l(this.calendar.timezone(),this.data.lastModified)+`\r
60
60
  `),this.data.class&&(t+="CLASS:"+this.data.class.toUpperCase()+`\r
61
61
  `),t+=`END:VEVENT\r
62
- `,t}transparency(t){return t===void 0?this.data.transparency:t?(this.data.transparency=d(k,t),this):(this.data.transparency=null,this)}uid(t){return t===void 0?this.id():this.id(t)}url(t){return t===void 0?this.data.url:(this.data.url=t?String(t):null,this)}x(t,a){return t===void 0?o(this.data):(typeof t=="string"&&typeof a=="string"&&o(this.data,t,a),typeof t=="object"&&o(this.data,t),this)}swapStartAndEndIfRequired(){if(this.data.start&&this.data.end&&z(this.data.start).getTime()>z(this.data.end).getTime()){let t=this.data.start;this.data.start=this.data.end,this.data.end=t}}};var j=(f=>(f.ADD="ADD",f.CANCEL="CANCEL",f.COUNTER="COUNTER",f.DECLINECOUNTER="DECLINECOUNTER",f.PUBLISH="PUBLISH",f.REFRESH="REFRESH",f.REPLY="REPLY",f.REQUEST="REQUEST",f))(j||{}),A=class{data;constructor(t={}){this.data={description:null,events:[],method:null,name:null,prodId:"//sebbo.net//ical-generator//EN",scale:null,source:null,timezone:null,ttl:null,url:null,x:[]},t.prodId!==void 0&&this.prodId(t.prodId),t.method!==void 0&&this.method(t.method),t.name!==void 0&&this.name(t.name),t.description!==void 0&&this.description(t.description),t.timezone!==void 0&&this.timezone(t.timezone),t.source!==void 0&&this.source(t.source),t.url!==void 0&&this.url(t.url),t.scale!==void 0&&this.scale(t.scale),t.ttl!==void 0&&this.ttl(t.ttl),t.events!==void 0&&this.events(t.events),t.x!==void 0&&this.x(t.x)}clear(){return this.data.events=[],this}createEvent(t){let a=t instanceof D?t:new D(t,this);return this.data.events.push(a),a}description(t){return t===void 0?this.data.description:(this.data.description=t?String(t):null,this)}events(t){return t?(t.forEach(a=>this.createEvent(a)),this):this.data.events}length(){return this.data.events.length}method(t){return t===void 0?this.data.method:t?(this.data.method=d(j,t),this):(this.data.method=null,this)}name(t){return t===void 0?this.data.name:(this.data.name=t?String(t):null,this)}prodId(t){if(!t)return this.data.prodId;if(typeof t=="string")return this.data.prodId=t,this;if(typeof t!="object")throw new Error("`prodid` needs to be a string or an object!");if(!t.company)throw new Error("`prodid.company` is a mandatory item!");if(!t.product)throw new Error("`prodid.product` is a mandatory item!");let a=(t.language||"EN").toUpperCase();return this.data.prodId="//"+t.company+"//"+t.product+"//"+a,this}scale(t){return t===void 0?this.data.scale:(t===null?this.data.scale=null:this.data.scale=t.toUpperCase(),this)}source(t){return t===void 0?this.data.source:(this.data.source=t||null,this)}timezone(t){return t===void 0?this.data.timezone?.name||null:(t==="UTC"?this.data.timezone=null:typeof t=="string"?this.data.timezone={name:t}:t===null?this.data.timezone=null:this.data.timezone=t,this)}toJSON(){return Object.assign({},this.data,{events:this.data.events.map(t=>t.toJSON()),timezone:this.timezone(),x:this.x()})}toString(){let t="";return t=`BEGIN:VCALENDAR\r
62
+ `,t}transparency(t){return t===void 0?this.data.transparency:t?(this.data.transparency=d(k,t),this):(this.data.transparency=null,this)}uid(t){return t===void 0?this.id():this.id(t)}url(t){return t===void 0?this.data.url:(this.data.url=t?String(t):null,this)}x(t,n){return t===void 0?o(this.data):(typeof t=="string"&&typeof n=="string"&&o(this.data,t,n),typeof t=="object"&&o(this.data,t),this)}swapStartAndEndIfRequired(){if(this.data.start&&this.data.end&&z(this.data.start).getTime()>z(this.data.end).getTime()){let t=this.data.start;this.data.start=this.data.end,this.data.end=t}}};var j=(f=>(f.ADD="ADD",f.CANCEL="CANCEL",f.COUNTER="COUNTER",f.DECLINECOUNTER="DECLINECOUNTER",f.PUBLISH="PUBLISH",f.REFRESH="REFRESH",f.REPLY="REPLY",f.REQUEST="REQUEST",f))(j||{}),b=class{data;constructor(t={}){this.data={color:null,description:null,events:[],method:null,name:null,prodId:"//sebbo.net//ical-generator//EN",scale:null,source:null,timezone:null,ttl:null,url:null,x:[]},t.prodId!==void 0&&this.prodId(t.prodId),t.method!==void 0&&this.method(t.method),t.name!==void 0&&this.name(t.name),t.description!==void 0&&this.description(t.description),t.timezone!==void 0&&this.timezone(t.timezone),t.source!==void 0&&this.source(t.source),t.url!==void 0&&this.url(t.url),t.scale!==void 0&&this.scale(t.scale),t.ttl!==void 0&&this.ttl(t.ttl),t.color!==void 0&&this.color(t.color),t.events!==void 0&&this.events(t.events),t.x!==void 0&&this.x(t.x)}clear(){return this.data.events=[],this}color(t){if(t===void 0)return this.data.color;if(typeof t=="string"&&!/^#[A-F0-9]{6}$/gi.test(t))throw new Error("`color` is malformed!");return this.data.color=t?String(t).toUpperCase():null,this}createEvent(t){let n=t instanceof D?t:new D(t,this);return this.data.events.push(n),n}description(t){return t===void 0?this.data.description:(this.data.description=t?String(t):null,this)}events(t){return t?(t.forEach(n=>this.createEvent(n)),this):this.data.events}length(){return this.data.events.length}method(t){return t===void 0?this.data.method:t?(this.data.method=d(j,t),this):(this.data.method=null,this)}name(t){return t===void 0?this.data.name:(this.data.name=t?String(t):null,this)}prodId(t){if(!t)return this.data.prodId;if(typeof t=="string")return this.data.prodId=t,this;if(typeof t!="object")throw new Error("`prodid` needs to be a string or an object!");if(!t.company)throw new Error("`prodid.company` is a mandatory item!");if(!t.product)throw new Error("`prodid.product` is a mandatory item!");let n=(t.language||"EN").toUpperCase();return this.data.prodId="//"+t.company+"//"+t.product+"//"+n,this}scale(t){return t===void 0?this.data.scale:(t===null?this.data.scale=null:this.data.scale=t.toUpperCase(),this)}source(t){return t===void 0?this.data.source:(this.data.source=t||null,this)}timezone(t){return t===void 0?this.data.timezone?.name||null:(t==="UTC"?this.data.timezone=null:typeof t=="string"?this.data.timezone={name:t}:t===null?this.data.timezone=null:this.data.timezone=t,this)}toJSON(){return Object.assign({},this.data,{events:this.data.events.map(t=>t.toJSON()),timezone:this.timezone(),x:this.x()})}toString(){let t="";return t=`BEGIN:VCALENDAR\r
63
63
  VERSION:2.0\r
64
64
  `,t+="PRODID:-"+this.data.prodId+`\r
65
65
  `,this.data.url&&(t+="URL:"+this.data.url+`\r
@@ -69,12 +69,13 @@ VERSION:2.0\r
69
69
  `),this.data.name&&(t+="NAME:"+this.data.name+`\r
70
70
  `,t+="X-WR-CALNAME:"+this.data.name+`\r
71
71
  `),this.data.description&&(t+="X-WR-CALDESC:"+this.data.description+`\r
72
- `),this.data.timezone?.generator&&[...new Set([this.timezone(),...this.data.events.map(n=>n.timezone())])].filter(n=>n!==null&&!n.startsWith("/")).forEach(n=>{if(!this.data.timezone?.generator)return;let i=this.data.timezone.generator(n);i&&(t+=i.replace(/\r\n/g,`
72
+ `),this.data.timezone?.generator&&[...new Set([this.timezone(),...this.data.events.map(a=>a.timezone())])].filter(a=>a!==null&&!a.startsWith("/")).forEach(a=>{if(!this.data.timezone?.generator)return;let i=this.data.timezone.generator(a);i&&(t+=i.replace(/\r\n/g,`
73
73
  `).replace(/\n/g,`\r
74
74
  `).trim()+`\r
75
75
  `)}),this.data.timezone?.name&&(t+="TIMEZONE-ID:"+this.data.timezone.name+`\r
76
76
  `,t+="X-WR-TIMEZONE:"+this.data.timezone.name+`\r
77
77
  `),this.data.ttl&&(t+="REFRESH-INTERVAL;VALUE=DURATION:"+I(this.data.ttl)+`\r
78
78
  `,t+="X-PUBLISHED-TTL:"+I(this.data.ttl)+`\r
79
- `),this.data.events.forEach(a=>t+=a.toString()),t+=T(this.data),t+="END:VCALENDAR",L(t)}ttl(t){return t===void 0?this.data.ttl:(H(t)?this.data.ttl=t.asSeconds():t&&t>0?this.data.ttl=t:this.data.ttl=null,this)}url(t){return t===void 0?this.data.url:(this.data.url=t||null,this)}x(t,a){if(t===void 0)return o(this.data);if(typeof t=="string"&&typeof a=="string")o(this.data,t,a);else if(typeof t=="object")o(this.data,t);else throw new Error("Either key or value is not a string!");return this}};function K(e){return new A(e)}var bt=K;export{c as ICalAlarm,X as ICalAlarmRelatesTo,B as ICalAlarmType,g as ICalAttendee,U as ICalAttendeeRole,P as ICalAttendeeStatus,v as ICalAttendeeType,A as ICalCalendar,j as ICalCalendarMethod,y as ICalCategory,D as ICalEvent,Z as ICalEventBusyStatus,F as ICalEventClass,x as ICalEventRepeatingFreq,J as ICalEventStatus,k as ICalEventTransparency,E as ICalWeekday,bt as default,r as escape,L as foldLines,l as formatDate,S as formatDateTZ};
79
+ `),this.data.color&&(t+="X-APPLE-CALENDAR-COLOR:"+this.data.color+`\r
80
+ `),this.data.events.forEach(n=>t+=n.toString()),t+=T(this.data),t+="END:VCALENDAR",L(t)}ttl(t){return t===void 0?this.data.ttl:(H(t)?this.data.ttl=t.asSeconds():t&&t>0?this.data.ttl=t:this.data.ttl=null,this)}url(t){return t===void 0?this.data.url:(this.data.url=t||null,this)}x(t,n){if(t===void 0)return o(this.data);if(typeof t=="string"&&typeof n=="string")o(this.data,t,n);else if(typeof t=="object")o(this.data,t);else throw new Error("Either key or value is not a string!");return this}};function K(e){return new b(e)}var At=K;export{c as ICalAlarm,W as ICalAlarmRelatesTo,B as ICalAlarmType,g as ICalAttendee,U as ICalAttendeeRole,P as ICalAttendeeStatus,v as ICalAttendeeType,b as ICalCalendar,j as ICalCalendarMethod,y as ICalCategory,D as ICalEvent,Z as ICalEventBusyStatus,F as ICalEventClass,x as ICalEventRepeatingFreq,J as ICalEventStatus,k as ICalEventTransparency,E as ICalWeekday,At as default,r as escape,L as foldLines,l as formatDate,S as formatDateTZ};
80
81
  //# sourceMappingURL=index.js.map