var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
    function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
    var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
    var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
    var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
    var _, done = false;
    for (var i = decorators.length - 1; i >= 0; i--) {
        var context = {};
        for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
        for (var p in contextIn.access) context.access[p] = contextIn.access[p];
        context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
        var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
        if (kind === "accessor") {
            if (result === void 0) continue;
            if (result === null || typeof result !== "object") throw new TypeError("Object expected");
            if (_ = accept(result.get)) descriptor.get = _;
            if (_ = accept(result.set)) descriptor.set = _;
            if (_ = accept(result.init)) initializers.unshift(_);
        }
        else if (_ = accept(result)) {
            if (kind === "field") initializers.unshift(_);
            else descriptor[key] = _;
        }
    }
    if (target) Object.defineProperty(target, contextIn.name, descriptor);
    done = true;
};
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
    var useValue = arguments.length > 2;
    for (var i = 0; i < initializers.length; i++) {
        value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
    }
    return useValue ? value : void 0;
};
import { DeesElement, customElement, html, css, cssManager, property, } from '@design.estate/dees-element';
let SzServicesBackupsView = (() => {
    let _classDecorators = [customElement('sz-services-backups-view')];
    let _classDescriptor;
    let _classExtraInitializers = [];
    let _classThis;
    let _classSuper = DeesElement;
    let _schedules_decorators;
    let _schedules_initializers = [];
    let _schedules_extraInitializers = [];
    let _backups_decorators;
    let _backups_initializers = [];
    let _backups_extraInitializers = [];
    var SzServicesBackupsView = class extends _classSuper {
        static { _classThis = this; }
        static {
            const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
            _schedules_decorators = [property({ type: Array })];
            _backups_decorators = [property({ type: Array })];
            __esDecorate(this, null, _schedules_decorators, { kind: "accessor", name: "schedules", static: false, private: false, access: { has: obj => "schedules" in obj, get: obj => obj.schedules, set: (obj, value) => { obj.schedules = value; } }, metadata: _metadata }, _schedules_initializers, _schedules_extraInitializers);
            __esDecorate(this, null, _backups_decorators, { kind: "accessor", name: "backups", static: false, private: false, access: { has: obj => "backups" in obj, get: obj => obj.backups, set: (obj, value) => { obj.backups = value; } }, metadata: _metadata }, _backups_initializers, _backups_extraInitializers);
            __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
            SzServicesBackupsView = _classThis = _classDescriptor.value;
            if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
        }
        static demo = () => html `
    <div style="padding: 24px; max-width: 1200px;">
      <sz-services-backups-view
        .schedules=${[
            { id: '1', scope: 'All Services', retention: 'D:7, W:4, M:12', schedule: '0 2 * * *', lastRun: '1/2/2026, 2:00:03 AM', nextRun: '1/3/2026, 2:00:00 AM', status: 'active' },
        ]}
        .backups=${[
            { id: '1', service: 'test-nginx', createdAt: '1/2/2026, 2:00:03 AM', size: '22.0 MB', includes: ['Image'] },
            { id: '2', service: 'hello-world', createdAt: '1/2/2026, 2:00:02 AM', size: '21.5 MB', includes: ['Image'] },
            { id: '3', service: 'test-ch-final', createdAt: '1/2/2026, 2:00:00 AM', size: '22.0 MB', includes: ['Image', 'clickhouse'] },
        ]}
      ></sz-services-backups-view>
    </div>
  `;
        static demoGroups = ['Services'];
        #schedules_accessor_storage = __runInitializers(this, _schedules_initializers, []);
        get schedules() { return this.#schedules_accessor_storage; }
        set schedules(value) { this.#schedules_accessor_storage = value; }
        #backups_accessor_storage = (__runInitializers(this, _schedules_extraInitializers), __runInitializers(this, _backups_initializers, []));
        get backups() { return this.#backups_accessor_storage; }
        set backups(value) { this.#backups_accessor_storage = value; }
        static styles = [
            cssManager.defaultStyles,
            css `
      :host {
        display: block;
      }

      dees-tile {
        display: block;
        margin-bottom: 24px;
      }

      .section-header {
        height: 36px;
        display: flex;
        align-items: center;
        padding: 0 16px;
        width: 100%;
        box-sizing: border-box;
      }

      .section-heading {
        flex: 1;
        display: flex;
        align-items: baseline;
        gap: 8px;
        min-width: 0;
      }

      .section-title {
        font-weight: 500;
        font-size: 13px;
        letter-spacing: -0.01em;
        color: var(--dees-color-text-secondary);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .section-subtitle {
        font-size: 12px;
        color: var(--dees-color-text-muted);
        letter-spacing: -0.01em;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .section-footer {
        display: flex;
        flex-direction: row;
        justify-content: flex-end;
        align-items: center;
        gap: 0;
        height: 36px;
        width: 100%;
        box-sizing: border-box;
      }

      .tile-button {
        padding: 0 16px;
        height: 100%;
        text-align: center;
        font-size: 12px;
        font-weight: 500;
        cursor: pointer;
        user-select: none;
        transition: all 0.15s ease;
        background: transparent;
        border: none;
        border-left: 1px solid var(--dees-color-border-subtle);
        color: var(--dees-color-text-muted);
        white-space: nowrap;
        display: flex;
        align-items: center;
        gap: 6px;
      }

      .tile-button:first-child {
        border-left: none;
      }

      .tile-button:hover {
        background: var(--dees-color-hover);
        color: var(--dees-color-text-primary);
      }

      .tile-button.primary {
        color: ${cssManager.bdTheme('hsl(217.2 91.2% 59.8%)', 'hsl(213.1 93.9% 67.8%)')};
        font-weight: 600;
      }

      .tile-button.primary:hover {
        background: ${cssManager.bdTheme('hsl(217.2 91.2% 59.8% / 0.08)', 'hsl(213.1 93.9% 67.8% / 0.08)')};
        color: ${cssManager.bdTheme('hsl(217.2 91.2% 50%)', 'hsl(213.1 93.9% 75%)')};
      }

      .table-header {
        display: grid;
        gap: 16px;
        padding: 12px 16px;
        background: ${cssManager.bdTheme('#f4f4f5', '#18181b')};
        border-bottom: 1px solid ${cssManager.bdTheme('#e4e4e7', '#27272a')};
        font-size: 12px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: ${cssManager.bdTheme('#71717a', '#a1a1aa')};
      }

      .schedules-header {
        grid-template-columns: 1fr 1fr 1fr 1.5fr 1.5fr 80px 120px;
      }

      .backups-header {
        grid-template-columns: 1.5fr 1.5fr 100px 1fr 120px;
      }

      .table-row {
        display: grid;
        gap: 16px;
        padding: 12px 16px;
        border-bottom: 1px solid ${cssManager.bdTheme('#f4f4f5', '#27272a')};
        font-size: 14px;
        color: ${cssManager.bdTheme('#18181b', '#fafafa')};
        align-items: center;
      }

      .schedules-row {
        grid-template-columns: 1fr 1fr 1fr 1.5fr 1.5fr 80px 120px;
      }

      .backups-row {
        grid-template-columns: 1.5fr 1.5fr 100px 1fr 120px;
      }

      .table-row:last-child {
        border-bottom: none;
      }

      .table-row:hover {
        background: ${cssManager.bdTheme('#f4f4f5', '#18181b')};
      }

      .status-badge {
        display: inline-flex;
        align-items: center;
        padding: 2px 8px;
        border-radius: 9999px;
        font-size: 12px;
        font-weight: 500;
      }

      .status-badge.active {
        background: ${cssManager.bdTheme('#dcfce7', 'rgba(34, 197, 94, 0.2)')};
        color: ${cssManager.bdTheme('#16a34a', '#22c55e')};
      }

      .status-badge.failed {
        background: ${cssManager.bdTheme('#fee2e2', 'rgba(239, 68, 68, 0.2)')};
        color: ${cssManager.bdTheme('#dc2626', '#ef4444')};
      }

      .status-badge.disabled {
        background: ${cssManager.bdTheme('#f4f4f5', '#27272a')};
        color: ${cssManager.bdTheme('#71717a', '#a1a1aa')};
      }

      .meta-text {
        font-size: 13px;
        color: ${cssManager.bdTheme('#71717a', '#a1a1aa')};
      }

      .includes-list {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
      }

      .include-badge {
        padding: 2px 8px;
        background: ${cssManager.bdTheme('#dbeafe', 'rgba(59, 130, 246, 0.2)')};
        color: ${cssManager.bdTheme('#2563eb', '#60a5fa')};
        border-radius: 4px;
        font-size: 11px;
        font-weight: 500;
      }

      .row-actions {
        display: flex;
        gap: 4px;
      }

      .icon-button {
        padding: 6px;
        background: transparent;
        border: 1px solid ${cssManager.bdTheme('#e4e4e7', '#27272a')};
        border-radius: 4px;
        color: ${cssManager.bdTheme('#71717a', '#a1a1aa')};
        cursor: pointer;
        transition: all 200ms ease;
      }

      .icon-button:hover {
        background: ${cssManager.bdTheme('#f4f4f5', '#18181b')};
        color: ${cssManager.bdTheme('#18181b', '#fafafa')};
      }

      .icon-button.danger:hover {
        background: ${cssManager.bdTheme('#fee2e2', 'rgba(239, 68, 68, 0.2)')};
        color: ${cssManager.bdTheme('#dc2626', '#ef4444')};
        border-color: ${cssManager.bdTheme('#fee2e2', 'rgba(239, 68, 68, 0.3)')};
      }
    `,
        ];
        render() {
            return html `
      <dees-tile>
        <div slot="header" class="section-header">
          <div class="section-heading">
            <span class="section-title">Backup Schedules</span>
            <span class="section-subtitle">Configure automated backup schedules for your services</span>
          </div>
        </div>
        <div class="table-header schedules-header">
          <span>Scope</span>
          <span>Retention</span>
          <span>Schedule</span>
          <span>Last Run</span>
          <span>Next Run</span>
          <span>Status</span>
          <span>Actions</span>
        </div>
        ${this.schedules.map(schedule => html `
          <div class="table-row schedules-row">
            <span>${schedule.scope}</span>
            <span class="meta-text" title="Keep: ${schedule.retention}">${schedule.retention}</span>
            <span class="meta-text">${schedule.schedule}</span>
            <span class="meta-text">${schedule.lastRun || '-'}</span>
            <span class="meta-text">${schedule.nextRun || '-'}</span>
            <span>
              <span class="status-badge ${schedule.status}" title="${schedule.error || ''}">
                ${schedule.status === 'active' ? 'Active' : schedule.status === 'failed' ? 'Failed' : 'Disabled'}
              </span>
            </span>
            <span class="row-actions">
              <button class="icon-button" title="Run backup now" @click=${() => this.handleRunNow(schedule)}>
                <svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><polygon points="5,3 19,12 5,21"/></svg>
              </button>
              <button class="icon-button" title="${schedule.status === 'disabled' ? 'Enable' : 'Disable'}" @click=${() => this.handleToggle(schedule)}>
                <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
                  ${schedule.status === 'disabled'
                ? html `<polyline points="20 6 9 17 4 12"></polyline>`
                : html `<rect x="6" y="6" width="12" height="12" rx="1"/>`}
                </svg>
              </button>
              <button class="icon-button danger" title="Delete" @click=${() => this.handleDeleteSchedule(schedule)}>
                <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
                  <polyline points="3,6 5,6 21,6"/><path d="M19,6v14a2,2,0,0,1-2,2H7a2,2,0,0,1-2-2V6m3,0V4a2,2,0,0,1,2-2h4a2,2,0,0,1,2,2v2"/>
                </svg>
              </button>
            </span>
          </div>
        `)}
        <div slot="footer" class="section-footer">
          <button class="tile-button" @click=${() => this.handleImport()}>
            <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
              <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
              <polyline points="17 8 12 3 7 8"/>
              <line x1="12" y1="3" x2="12" y2="15"/>
            </svg>
            Import Backup
          </button>
          <button class="tile-button primary" @click=${() => this.handleCreateSchedule()}>
            <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
              <line x1="12" y1="5" x2="12" y2="19"></line>
              <line x1="5" y1="12" x2="19" y2="12"></line>
            </svg>
            Create Schedule
          </button>
        </div>
      </dees-tile>

      <dees-tile>
        <div slot="header" class="section-header">
          <div class="section-heading">
            <span class="section-title">All Backups</span>
            <span class="section-subtitle">Browse and manage all backups across services</span>
          </div>
        </div>
        <div class="table-header backups-header">
          <span>Service</span>
          <span>Created</span>
          <span>Size</span>
          <span>Includes</span>
          <span>Actions</span>
        </div>
        ${this.backups.map(backup => html `
          <div class="table-row backups-row">
            <span>${backup.service}</span>
            <span class="meta-text">${backup.createdAt}</span>
            <span class="meta-text">${backup.size}</span>
            <span class="includes-list">
              ${backup.includes.map(inc => html `<span class="include-badge">${inc}</span>`)}
            </span>
            <span class="row-actions">
              <button class="icon-button" title="Download backup" @click=${() => this.handleDownload(backup)}>
                <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
                  <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
                  <polyline points="7 10 12 15 17 10"/>
                  <line x1="12" y1="15" x2="12" y2="3"/>
                </svg>
              </button>
              <button class="icon-button danger" title="Delete" @click=${() => this.handleDeleteBackup(backup)}>
                <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
                  <polyline points="3,6 5,6 21,6"/><path d="M19,6v14a2,2,0,0,1-2,2H7a2,2,0,0,1-2-2V6m3,0V4a2,2,0,0,1,2-2h4a2,2,0,0,1,2,2v2"/>
                </svg>
              </button>
            </span>
          </div>
        `)}
      </dees-tile>
    `;
        }
        handleImport() {
            this.dispatchEvent(new CustomEvent('import', { bubbles: true, composed: true }));
        }
        handleCreateSchedule() {
            this.dispatchEvent(new CustomEvent('create-schedule', { bubbles: true, composed: true }));
        }
        handleRunNow(schedule) {
            this.dispatchEvent(new CustomEvent('run-now', { detail: schedule, bubbles: true, composed: true }));
        }
        handleToggle(schedule) {
            this.dispatchEvent(new CustomEvent('toggle-schedule', { detail: schedule, bubbles: true, composed: true }));
        }
        handleDeleteSchedule(schedule) {
            this.dispatchEvent(new CustomEvent('delete-schedule', { detail: schedule, bubbles: true, composed: true }));
        }
        handleDownload(backup) {
            this.dispatchEvent(new CustomEvent('download', { detail: backup, bubbles: true, composed: true }));
        }
        handleDeleteBackup(backup) {
            this.dispatchEvent(new CustomEvent('delete-backup', { detail: backup, bubbles: true, composed: true }));
        }
        constructor() {
            super(...arguments);
            __runInitializers(this, _backups_extraInitializers);
        }
        static {
            __runInitializers(_classThis, _classExtraInitializers);
        }
    };
    return SzServicesBackupsView = _classThis;
})();
export { SzServicesBackupsView };
//# sourceMappingURL=data:application/json;base64, 