import { type EmailAddress, type EscapeStringCharactersFunction, type LatLngPoint, type Minutes, type ISO8601DayString, type TimezoneString } from '@dereekb/util'; import { type RFC5545DateString, type RFC5545DateTimeString } from '../rrule/date.rrule.parse'; import { type ICalendarCalAddress, type ICalendarParameterValue, type ICalendarTextValue, type ICalendarValue } from './icalendar'; /** * Format used for an RFC 5545 DATE-TIME value rendered as a UTC instant. */ export declare const ICALENDAR_UTC_DATE_TIME_FORMAT = "yyyyMMdd'T'HHmmss'Z'"; /** * Format used for an RFC 5545 DATE-TIME value rendered as a wall clock in a named zone. */ export declare const ICALENDAR_LOCAL_DATE_TIME_FORMAT = "yyyyMMdd'T'HHmmss"; /** * Format used for an RFC 5545 DATE value. */ export declare const ICALENDAR_DATE_FORMAT = "yyyyMMdd"; /** * Escapes the characters RFC 5545 3.3.11 requires escaping within a TEXT value. * * NOTE: the colon is deliberately NOT escaped. Colon escaping is a vCard 2.1 rule, not an iCalendar one, and * over-escaping it visibly corrupts DESCRIPTION/SUMMARY text in every client. * * Input must have its line breaks normalized to a bare "\n" first, since escaping is per-character. * Prefer {@link iCalendarTextValue}, which does that normalization. */ export declare const escapeICalendarText: EscapeStringCharactersFunction; /** * Encodes the input as an RFC 5545 TEXT value. * * Line breaks are normalized to LF before escaping, since {@link escapeICalendarText} operates one character * at a time and would otherwise turn a single CRLF into two escaped newlines. * * @param input - Raw, unescaped text. * @returns The escaped TEXT value. * * @example * ```ts * iCalendarTextValue('Hello, World; this is\r\na test'); // 'Hello\\, World\\; this is\\na test' * ``` * * @__NO_SIDE_EFFECTS__ */ export declare function iCalendarTextValue(input: string): ICalendarTextValue; /** * Encodes an array of strings as a comma-separated RFC 5545 TEXT list. I.E. the value of CATEGORIES. * * Each element is escaped individually, so a comma inside an element does not become a list separator. * * @param input - Raw, unescaped text values. * @returns The comma-joined list of escaped TEXT values. * * @__NO_SIDE_EFFECTS__ */ export declare function iCalendarTextListValue(input: readonly string[]): ICalendarTextValue; /** * Formats a moment as an RFC 5545 DATE-TIME value in UTC. I.E. "20260315T140000Z". * * Always renders the UTC wall clock, regardless of the system timezone. * * @param date - Moment to render. * @returns The UTC DATE-TIME value. * * @__NO_SIDE_EFFECTS__ */ export declare function iCalendarUtcDateTimeString(date: Date): RFC5545DateTimeString; /** * Formats a moment as an RFC 5545 DATE-TIME value rendered as the wall clock in the given timezone. I.E. "20260315T090000". * * The result carries no "Z" suffix: the caller is responsible for emitting the accompanying TZID parameter. * * @param date - Moment to render. * @param timezone - The zone whose wall clock is rendered. * @returns The local (zoned) DATE-TIME value. * * @__NO_SIDE_EFFECTS__ */ export declare function iCalendarZonedDateTimeString(date: Date, timezone: TimezoneString): RFC5545DateTimeString; /** * Formats a moment as a floating RFC 5545 DATE-TIME value with no zone and no "Z" suffix. * * Only used within a VTIMEZONE sub-component, where DTSTART is defined to be the local time of the transition. * * @param date - Moment whose UTC wall clock is rendered as if it were floating local time. * @returns The floating DATE-TIME value. * * @__NO_SIDE_EFFECTS__ */ export declare function iCalendarFloatingDateTimeString(date: Date): RFC5545DateTimeString; /** * Renders a calendar day as an RFC 5545 DATE value. I.E. "2026-03-15" becomes "20260315". * * @param day - Calendar day to render. * @returns The RFC 5545 DATE value. * * @__NO_SIDE_EFFECTS__ */ export declare function iCalendarDateString(day: ISO8601DayString): RFC5545DateString; /** * Formats a number of minutes as an RFC 5545 DURATION value. I.E. "PT1H30M", "P2D", "-PT15M". * * Days are only emitted for whole-day durations, matching how clients render them. A zero duration is "PT0S". * * @param minutes - The duration in minutes. A negative value produces a negative duration. * @returns The DURATION value. * * @__NO_SIDE_EFFECTS__ */ export declare function iCalendarDurationString(minutes: Minutes): ICalendarValue; /** * Encodes a value for use as an iCalendar property parameter value. * * Parameter values have no escape mechanism: a value containing a colon, semicolon or comma must instead be * wrapped in double quotes, and a double quote within the value cannot be represented at all, so it is stripped. * * @param value - The raw parameter value. * @returns The encoded parameter value. * * @example * ```ts * iCalendarParameterValue('America/Denver'); // 'America/Denver' * iCalendarParameterValue('Smith, John'); // '"Smith, John"' * ``` * * @__NO_SIDE_EFFECTS__ */ export declare function iCalendarParameterValue(value: string): ICalendarParameterValue; /** * Encodes an email address or existing URI as an RFC 5545 CAL-ADDRESS value. * * A bare email address is given the "mailto:" scheme; an input that already carries a URI scheme passes through. * * @param input - An email address or an already-schemed URI. * @returns The CAL-ADDRESS value. * * @__NO_SIDE_EFFECTS__ */ export declare function iCalendarCalAddressValue(input: EmailAddress | ICalendarCalAddress): ICalendarCalAddress; /** * Encodes a point as an RFC 5545 GEO value. I.E. "39.7392;-104.9903". * * The semicolon is a structural separator here, not escaped content. * * @param point - The point to render. * @returns The GEO value. * * @__NO_SIDE_EFFECTS__ */ export declare function iCalendarGeoValue(point: LatLngPoint): ICalendarValue; /** * Renders a flag as an RFC 5545 BOOLEAN value. I.E. "TRUE", "FALSE". * * @param value - Flag to render. * @returns The RFC 5545 BOOLEAN value. * * @__NO_SIDE_EFFECTS__ */ export declare function iCalendarBooleanValue(value: boolean): ICalendarValue; /** * Encodes an integer as an RFC 5545 INTEGER value. * * @param value - The number to render. Truncated toward zero. * @returns The INTEGER value. * * @__NO_SIDE_EFFECTS__ */ export declare function iCalendarIntegerValue(value: number): ICalendarValue;