import { i, x } from "./lit-DKg0et_P.mjs"; import { n as n$1, t } from "./property-C8WJQOrH.mjs"; import { e, n } from "./ref-BivNNNRN.mjs"; import { e as escapeXml } from "./index-fgowJCc1.mjs"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __decorateClass = (decorators, target, key, kind) => { var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target; for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--) if (decorator = decorators[i2]) result = (kind ? decorator(target, key, result) : decorator(result)) || result; if (kind && result) __defProp(target, key, result); return result; }; let CreateCalendarForm = class extends i { constructor() { super(...arguments); this.principal = ""; this.addr_id = ""; this.displayname = ""; this.description = ""; this.color = ""; this.dialog = e(); this.form = e(); this.timezones = []; } createRenderRoot() { return this; } render() { return x`

Create calendar




`; } async submit(e2) { e2.preventDefault(); if (!this.addr_id) { alert("Empty id"); return; } if (!this.displayname) { alert("Empty displayname"); return; } let response = await fetch(`/caldav/principal/${this.principal}/_birthdays_${this.addr_id}`, { method: "MKCOL", headers: { "Content-Type": "application/xml" }, body: ` ${escapeXml(this.displayname)} ${this.description ? `${escapeXml(this.description)}` : ""} ${this.color ? `${escapeXml(this.color)}` : ""} ` }); if (response.status >= 400) { alert(`Error ${response.status}: ${await response.text()}`); return null; } window.location.reload(); return null; } }; __decorateClass([ n$1() ], CreateCalendarForm.prototype, "principal", 2); __decorateClass([ n$1() ], CreateCalendarForm.prototype, "addr_id", 2); __decorateClass([ n$1() ], CreateCalendarForm.prototype, "displayname", 2); __decorateClass([ n$1() ], CreateCalendarForm.prototype, "description", 2); __decorateClass([ n$1() ], CreateCalendarForm.prototype, "color", 2); __decorateClass([ n$1() ], CreateCalendarForm.prototype, "timezones", 2); CreateCalendarForm = __decorateClass([ t("create-birthday-calendar-form") ], CreateCalendarForm); export { CreateCalendarForm };