import { i, x } from "./lit-z6_uA4GX.mjs"; import { n as n$1, t } from "./property-D0NJdseG.mjs"; import { e, n } from "./ref-CPp9J0V5.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 ImportCalendarForm = class extends i { constructor() { super(); this.user = ""; this.cal_id = self.crypto.randomUUID(); this.dialog = e(); this.form = e(); } createRenderRoot() { return this; } render() { return x`

Import calendar



`; } async submit(e2) { e2.preventDefault(); this.principal || (this.principal = this.user); if (!this.principal) { alert("Empty principal"); return; } if (!this.cal_id) { alert("Empty id"); return; } let response = await fetch(`/caldav/principal/${this.principal}/${this.cal_id}`, { method: "IMPORT", headers: { "Content-Type": "text/calendar" }, body: this.file }); if (response.status >= 400) { alert(`Error ${response.status}: ${await response.text()}`); return null; } window.location.reload(); return null; } }; __decorateClass([ n$1() ], ImportCalendarForm.prototype, "user", 2); __decorateClass([ n$1() ], ImportCalendarForm.prototype, "principal", 2); __decorateClass([ n$1() ], ImportCalendarForm.prototype, "cal_id", 2); ImportCalendarForm = __decorateClass([ t("import-calendar-form") ], ImportCalendarForm); export { ImportCalendarForm };