import {
  Language,
  SettingsService,
  Theme,
  VideoPlayer,
  require_semver
} from "./chunk-5UUJX4KD.js";
import {
  HeaderComponent
} from "./chunk-JOGBMUUB.js";
import {
  EpgService
} from "./chunk-5NNFPLKO.js";
import {
  DialogService,
  UserService
} from "./chunk-ZAEY5WWV.js";
import {
  MAT_DIALOG_DATA,
  MAT_FORM_FIELD,
  MatCheckbox,
  MatCheckboxModule,
  MatDialog,
  MatDialogModule,
  MatDialogTitle,
  MatError,
  MatFormField,
  MatFormFieldControl,
  MatFormFieldModule,
  MatInput,
  MatInputModule,
  MatLabel,
  MatSnackBar,
  PlaylistsService,
  RemoteConfigService,
  Router,
  STORE_KEY,
  StorageMap,
  Store,
  addManyPlaylists,
  patchState,
  removeAllPlaylists,
  selectIsEpgAvailable,
  signalStore,
  withHooks,
  withMethods,
  withState
} from "./chunk-ILMKZBO5.js";
import {
  MatDivider,
  MatDividerModule,
  MatTooltip,
  MatTooltipModule
} from "./chunk-XP45YGFO.js";
import {
  A,
  ANIMATION_MODULE_TYPE,
  ActiveDescendantKeyManager,
  CdkConnectedOverlay,
  CdkOverlayOrigin,
  CdkScrollableModule,
  ChangeDetectionStrategy,
  ChangeDetectorRef,
  CommonModule,
  Component,
  ContentChild,
  ContentChildren,
  DOWN_ARROW,
  DataService,
  DefaultValueAccessor,
  Directionality,
  Directive,
  ENTER,
  ESCAPE,
  ElementRef,
  ErrorStateMatcher,
  EventEmitter,
  FormArray,
  FormArrayName,
  FormBuilder,
  FormControl,
  FormControlName,
  FormGroupDirective,
  FormsModule,
  HostAttributeToken,
  Inject,
  InjectionToken,
  Input,
  KeyValuePipe,
  LEFT_ARROW,
  LiveAnnouncer,
  MAT_OPTGROUP,
  MAT_OPTION_PARENT_COMPONENT,
  MatButton,
  MatButtonModule,
  MatCommonModule,
  MatIcon,
  MatIconButton,
  MatIconModule,
  MatOption,
  MatOptionModule,
  NgClass,
  NgControl,
  NgControlStatus,
  NgControlStatusGroup,
  NgForOf,
  NgForm,
  NgIf,
  NgModule,
  Optional,
  Output,
  Overlay,
  OverlayModule,
  RIGHT_ARROW,
  ReactiveFormsModule,
  Renderer2,
  SETTINGS_UPDATE,
  SET_MPV_PLAYER_PATH,
  SET_VLC_PLAYER_PATH,
  SPACE,
  SelectionModel,
  Subject,
  TranslateModule,
  TranslatePipe,
  TranslateService,
  UP_ARROW,
  Validators,
  ViewChild,
  ViewEncapsulation,
  ViewportRuler,
  _ErrorStateTracker,
  _IdGenerator,
  __async,
  __spreadProps,
  __spreadValues,
  __toESM,
  _countGroupLabelsBeforeOption,
  _getOptionScrollPosition,
  addAriaReferencedId,
  booleanAttribute,
  defer,
  filter,
  firstValueFrom,
  hasModifierKey,
  inject,
  map,
  merge,
  numberAttribute,
  removeAriaReferencedId,
  setClassMetadata,
  startWith,
  switchMap,
  take,
  takeUntil,
  ɵNgNoValidate,
  ɵsetClassDebugInfo,
  ɵɵNgOnChangesFeature,
  ɵɵProvidersFeature,
  ɵɵadvance,
  ɵɵattribute,
  ɵɵclassMapInterpolate1,
  ɵɵclassProp,
  ɵɵconditional,
  ɵɵcontentQuery,
  ɵɵdefineComponent,
  ɵɵdefineDirective,
  ɵɵdefineInjector,
  ɵɵdefineNgModule,
  ɵɵdirectiveInject,
  ɵɵelement,
  ɵɵelementContainerEnd,
  ɵɵelementContainerStart,
  ɵɵelementEnd,
  ɵɵelementStart,
  ɵɵgetCurrentView,
  ɵɵlistener,
  ɵɵloadQuery,
  ɵɵnamespaceSVG,
  ɵɵnextContext,
  ɵɵpipe,
  ɵɵpipeBind1,
  ɵɵprojection,
  ɵɵprojectionDef,
  ɵɵproperty,
  ɵɵqueryRefresh,
  ɵɵreference,
  ɵɵresetView,
  ɵɵrestoreView,
  ɵɵtemplate,
  ɵɵtext,
  ɵɵtextInterpolate,
  ɵɵtextInterpolate1,
  ɵɵviewQuery
} from "./chunk-OHPFONIX.js";

// node_modules/.pnpm/@angular+material@19.2.1_@angular+cdk@19.2.1_@angular+common@19.2.0_@angular+core@19.2._71945f1a9b5212ccdaaad33f8363c671/node_modules/@angular/material/fesm2022/select.mjs
var _c0 = ["trigger"];
var _c1 = ["panel"];
var _c2 = [[["mat-select-trigger"]], "*"];
var _c3 = ["mat-select-trigger", "*"];
function MatSelect_Conditional_4_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "span", 4);
    \u0275\u0275text(1);
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext();
    \u0275\u0275advance();
    \u0275\u0275textInterpolate(ctx_r1.placeholder);
  }
}
function MatSelect_Conditional_5_Conditional_1_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275projection(0);
  }
}
function MatSelect_Conditional_5_Conditional_2_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "span", 11);
    \u0275\u0275text(1);
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext(2);
    \u0275\u0275advance();
    \u0275\u0275textInterpolate(ctx_r1.triggerValue);
  }
}
function MatSelect_Conditional_5_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "span", 5);
    \u0275\u0275template(1, MatSelect_Conditional_5_Conditional_1_Template, 1, 0)(2, MatSelect_Conditional_5_Conditional_2_Template, 2, 1, "span", 11);
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext();
    \u0275\u0275advance();
    \u0275\u0275conditional(ctx_r1.customTrigger ? 1 : 2);
  }
}
function MatSelect_ng_template_10_Template(rf, ctx) {
  if (rf & 1) {
    const _r3 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "div", 12, 1);
    \u0275\u0275listener("keydown", function MatSelect_ng_template_10_Template_div_keydown_0_listener($event) {
      \u0275\u0275restoreView(_r3);
      const ctx_r1 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r1._handleKeydown($event));
    });
    \u0275\u0275projection(2, 1);
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const ctx_r1 = \u0275\u0275nextContext();
    \u0275\u0275classMapInterpolate1("mat-mdc-select-panel mdc-menu-surface mdc-menu-surface--open ", ctx_r1._getPanelTheme(), "");
    \u0275\u0275classProp("mat-select-panel-animations-enabled", !ctx_r1._animationsDisabled);
    \u0275\u0275property("ngClass", ctx_r1.panelClass);
    \u0275\u0275attribute("id", ctx_r1.id + "-panel")("aria-multiselectable", ctx_r1.multiple)("aria-label", ctx_r1.ariaLabel || null)("aria-labelledby", ctx_r1._getPanelAriaLabelledby());
  }
}
function getMatSelectDynamicMultipleError() {
  return Error("Cannot change `multiple` mode of select after initialization.");
}
function getMatSelectNonArrayValueError() {
  return Error("Value must be an array in multiple-selection mode.");
}
function getMatSelectNonFunctionValueError() {
  return Error("`compareWith` must be a function.");
}
var MAT_SELECT_SCROLL_STRATEGY = new InjectionToken("mat-select-scroll-strategy", {
  providedIn: "root",
  factory: () => {
    const overlay = inject(Overlay);
    return () => overlay.scrollStrategies.reposition();
  }
});
function MAT_SELECT_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay) {
  return () => overlay.scrollStrategies.reposition();
}
var MAT_SELECT_CONFIG = new InjectionToken("MAT_SELECT_CONFIG");
var MAT_SELECT_SCROLL_STRATEGY_PROVIDER = {
  provide: MAT_SELECT_SCROLL_STRATEGY,
  deps: [Overlay],
  useFactory: MAT_SELECT_SCROLL_STRATEGY_PROVIDER_FACTORY
};
var MAT_SELECT_TRIGGER = new InjectionToken("MatSelectTrigger");
var MatSelectChange = class {
  source;
  value;
  constructor(source, value) {
    this.source = source;
    this.value = value;
  }
};
var MatSelect = class _MatSelect {
  _viewportRuler = inject(ViewportRuler);
  _changeDetectorRef = inject(ChangeDetectorRef);
  _elementRef = inject(ElementRef);
  _dir = inject(Directionality, {
    optional: true
  });
  _idGenerator = inject(_IdGenerator);
  _renderer = inject(Renderer2);
  _parentFormField = inject(MAT_FORM_FIELD, {
    optional: true
  });
  ngControl = inject(NgControl, {
    self: true,
    optional: true
  });
  _liveAnnouncer = inject(LiveAnnouncer);
  _defaultOptions = inject(MAT_SELECT_CONFIG, {
    optional: true
  });
  _animationsDisabled = inject(ANIMATION_MODULE_TYPE, {
    optional: true
  }) === "NoopAnimations";
  _initialized = new Subject();
  _cleanupDetach;
  /** All of the defined select options. */
  options;
  // TODO(crisbeto): this is only necessary for the non-MDC select, but it's technically a
  // public API so we have to keep it. It should be deprecated and removed eventually.
  /** All of the defined groups of options. */
  optionGroups;
  /** User-supplied override of the trigger element. */
  customTrigger;
  /**
   * This position config ensures that the top "start" corner of the overlay
   * is aligned with with the top "start" of the origin by default (overlapping
   * the trigger completely). If the panel cannot fit below the trigger, it
   * will fall back to a position above the trigger.
   */
  _positions = [{
    originX: "start",
    originY: "bottom",
    overlayX: "start",
    overlayY: "top"
  }, {
    originX: "end",
    originY: "bottom",
    overlayX: "end",
    overlayY: "top"
  }, {
    originX: "start",
    originY: "top",
    overlayX: "start",
    overlayY: "bottom",
    panelClass: "mat-mdc-select-panel-above"
  }, {
    originX: "end",
    originY: "top",
    overlayX: "end",
    overlayY: "bottom",
    panelClass: "mat-mdc-select-panel-above"
  }];
  /** Scrolls a particular option into the view. */
  _scrollOptionIntoView(index) {
    const option = this.options.toArray()[index];
    if (option) {
      const panel = this.panel.nativeElement;
      const labelCount = _countGroupLabelsBeforeOption(index, this.options, this.optionGroups);
      const element = option._getHostElement();
      if (index === 0 && labelCount === 1) {
        panel.scrollTop = 0;
      } else {
        panel.scrollTop = _getOptionScrollPosition(element.offsetTop, element.offsetHeight, panel.scrollTop, panel.offsetHeight);
      }
    }
  }
  /** Called when the panel has been opened and the overlay has settled on its final position. */
  _positioningSettled() {
    this._scrollOptionIntoView(this._keyManager.activeItemIndex || 0);
  }
  /** Creates a change event object that should be emitted by the select. */
  _getChangeEvent(value) {
    return new MatSelectChange(this, value);
  }
  /** Factory function used to create a scroll strategy for this select. */
  _scrollStrategyFactory = inject(MAT_SELECT_SCROLL_STRATEGY);
  /** Whether or not the overlay panel is open. */
  _panelOpen = false;
  /** Comparison function to specify which option is displayed. Defaults to object equality. */
  _compareWith = (o1, o2) => o1 === o2;
  /** Unique id for this input. */
  _uid = this._idGenerator.getId("mat-select-");
  /** Current `aria-labelledby` value for the select trigger. */
  _triggerAriaLabelledBy = null;
  /**
   * Keeps track of the previous form control assigned to the select.
   * Used to detect if it has changed.
   */
  _previousControl;
  /** Emits whenever the component is destroyed. */
  _destroy = new Subject();
  /** Tracks the error state of the select. */
  _errorStateTracker;
  /**
   * Emits whenever the component state changes and should cause the parent
   * form-field to update. Implemented as part of `MatFormFieldControl`.
   * @docs-private
   */
  stateChanges = new Subject();
  /**
   * Disable the automatic labeling to avoid issues like #27241.
   * @docs-private
   */
  disableAutomaticLabeling = true;
  /**
   * Implemented as part of MatFormFieldControl.
   * @docs-private
   */
  userAriaDescribedBy;
  /** Deals with the selection logic. */
  _selectionModel;
  /** Manages keyboard events for options in the panel. */
  _keyManager;
  /** Ideal origin for the overlay panel. */
  _preferredOverlayOrigin;
  /** Width of the overlay panel. */
  _overlayWidth;
  /** `View -> model callback called when value changes` */
  _onChange = () => {
  };
  /** `View -> model callback called when select has been touched` */
  _onTouched = () => {
  };
  /** ID for the DOM node containing the select's value. */
  _valueId = this._idGenerator.getId("mat-select-value-");
  /** Strategy that will be used to handle scrolling while the select panel is open. */
  _scrollStrategy;
  _overlayPanelClass = this._defaultOptions?.overlayPanelClass || "";
  /** Whether the select is focused. */
  get focused() {
    return this._focused || this._panelOpen;
  }
  _focused = false;
  /** A name for this control that can be used by `mat-form-field`. */
  controlType = "mat-select";
  /** Trigger that opens the select. */
  trigger;
  /** Panel containing the select options. */
  panel;
  /** Overlay pane containing the options. */
  _overlayDir;
  /** Classes to be passed to the select panel. Supports the same syntax as `ngClass`. */
  panelClass;
  /** Whether the select is disabled. */
  disabled = false;
  /** Whether ripples in the select are disabled. */
  disableRipple = false;
  /** Tab index of the select. */
  tabIndex = 0;
  /** Whether checkmark indicator for single-selection options is hidden. */
  get hideSingleSelectionIndicator() {
    return this._hideSingleSelectionIndicator;
  }
  set hideSingleSelectionIndicator(value) {
    this._hideSingleSelectionIndicator = value;
    this._syncParentProperties();
  }
  _hideSingleSelectionIndicator = this._defaultOptions?.hideSingleSelectionIndicator ?? false;
  /** Placeholder to be shown if no value has been selected. */
  get placeholder() {
    return this._placeholder;
  }
  set placeholder(value) {
    this._placeholder = value;
    this.stateChanges.next();
  }
  _placeholder;
  /** Whether the component is required. */
  get required() {
    return this._required ?? this.ngControl?.control?.hasValidator(Validators.required) ?? false;
  }
  set required(value) {
    this._required = value;
    this.stateChanges.next();
  }
  _required;
  /** Whether the user should be allowed to select multiple options. */
  get multiple() {
    return this._multiple;
  }
  set multiple(value) {
    if (this._selectionModel && (typeof ngDevMode === "undefined" || ngDevMode)) {
      throw getMatSelectDynamicMultipleError();
    }
    this._multiple = value;
  }
  _multiple = false;
  /** Whether to center the active option over the trigger. */
  disableOptionCentering = this._defaultOptions?.disableOptionCentering ?? false;
  /**
   * Function to compare the option values with the selected values. The first argument
   * is a value from an option. The second is a value from the selection. A boolean
   * should be returned.
   */
  get compareWith() {
    return this._compareWith;
  }
  set compareWith(fn) {
    if (typeof fn !== "function" && (typeof ngDevMode === "undefined" || ngDevMode)) {
      throw getMatSelectNonFunctionValueError();
    }
    this._compareWith = fn;
    if (this._selectionModel) {
      this._initializeSelection();
    }
  }
  /** Value of the select control. */
  get value() {
    return this._value;
  }
  set value(newValue) {
    const hasAssigned = this._assignValue(newValue);
    if (hasAssigned) {
      this._onChange(newValue);
    }
  }
  _value;
  /** Aria label of the select. */
  ariaLabel = "";
  /** Input that can be used to specify the `aria-labelledby` attribute. */
  ariaLabelledby;
  /** Object used to control when error messages are shown. */
  get errorStateMatcher() {
    return this._errorStateTracker.matcher;
  }
  set errorStateMatcher(value) {
    this._errorStateTracker.matcher = value;
  }
  /** Time to wait in milliseconds after the last keystroke before moving focus to an item. */
  typeaheadDebounceInterval;
  /**
   * Function used to sort the values in a select in multiple mode.
   * Follows the same logic as `Array.prototype.sort`.
   */
  sortComparator;
  /** Unique id of the element. */
  get id() {
    return this._id;
  }
  set id(value) {
    this._id = value || this._uid;
    this.stateChanges.next();
  }
  _id;
  /** Whether the select is in an error state. */
  get errorState() {
    return this._errorStateTracker.errorState;
  }
  set errorState(value) {
    this._errorStateTracker.errorState = value;
  }
  /**
   * Width of the panel. If set to `auto`, the panel will match the trigger width.
   * If set to null or an empty string, the panel will grow to match the longest option's text.
   */
  panelWidth = this._defaultOptions && typeof this._defaultOptions.panelWidth !== "undefined" ? this._defaultOptions.panelWidth : "auto";
  /**
   * By default selecting an option with a `null` or `undefined` value will reset the select's
   * value. Enable this option if the reset behavior doesn't match your requirements and instead
   * the nullable options should become selected. The value of this input can be controlled app-wide
   * using the `MAT_SELECT_CONFIG` injection token.
   */
  canSelectNullableOptions = this._defaultOptions?.canSelectNullableOptions ?? false;
  /** Combined stream of all of the child options' change events. */
  optionSelectionChanges = defer(() => {
    const options = this.options;
    if (options) {
      return options.changes.pipe(startWith(options), switchMap(() => merge(...options.map((option) => option.onSelectionChange))));
    }
    return this._initialized.pipe(switchMap(() => this.optionSelectionChanges));
  });
  /** Event emitted when the select panel has been toggled. */
  openedChange = new EventEmitter();
  /** Event emitted when the select has been opened. */
  _openedStream = this.openedChange.pipe(filter((o) => o), map(() => {
  }));
  /** Event emitted when the select has been closed. */
  _closedStream = this.openedChange.pipe(filter((o) => !o), map(() => {
  }));
  /** Event emitted when the selected value has been changed by the user. */
  selectionChange = new EventEmitter();
  /**
   * Event that emits whenever the raw value of the select changes. This is here primarily
   * to facilitate the two-way binding for the `value` input.
   * @docs-private
   */
  valueChange = new EventEmitter();
  constructor() {
    const defaultErrorStateMatcher = inject(ErrorStateMatcher);
    const parentForm = inject(NgForm, {
      optional: true
    });
    const parentFormGroup = inject(FormGroupDirective, {
      optional: true
    });
    const tabIndex = inject(new HostAttributeToken("tabindex"), {
      optional: true
    });
    if (this.ngControl) {
      this.ngControl.valueAccessor = this;
    }
    if (this._defaultOptions?.typeaheadDebounceInterval != null) {
      this.typeaheadDebounceInterval = this._defaultOptions.typeaheadDebounceInterval;
    }
    this._errorStateTracker = new _ErrorStateTracker(defaultErrorStateMatcher, this.ngControl, parentFormGroup, parentForm, this.stateChanges);
    this._scrollStrategy = this._scrollStrategyFactory();
    this.tabIndex = tabIndex == null ? 0 : parseInt(tabIndex) || 0;
    this.id = this.id;
  }
  ngOnInit() {
    this._selectionModel = new SelectionModel(this.multiple);
    this.stateChanges.next();
    this._viewportRuler.change().pipe(takeUntil(this._destroy)).subscribe(() => {
      if (this.panelOpen) {
        this._overlayWidth = this._getOverlayWidth(this._preferredOverlayOrigin);
        this._changeDetectorRef.detectChanges();
      }
    });
  }
  ngAfterContentInit() {
    this._initialized.next();
    this._initialized.complete();
    this._initKeyManager();
    this._selectionModel.changed.pipe(takeUntil(this._destroy)).subscribe((event) => {
      event.added.forEach((option) => option.select());
      event.removed.forEach((option) => option.deselect());
    });
    this.options.changes.pipe(startWith(null), takeUntil(this._destroy)).subscribe(() => {
      this._resetOptions();
      this._initializeSelection();
    });
  }
  ngDoCheck() {
    const newAriaLabelledby = this._getTriggerAriaLabelledby();
    const ngControl = this.ngControl;
    if (newAriaLabelledby !== this._triggerAriaLabelledBy) {
      const element = this._elementRef.nativeElement;
      this._triggerAriaLabelledBy = newAriaLabelledby;
      if (newAriaLabelledby) {
        element.setAttribute("aria-labelledby", newAriaLabelledby);
      } else {
        element.removeAttribute("aria-labelledby");
      }
    }
    if (ngControl) {
      if (this._previousControl !== ngControl.control) {
        if (this._previousControl !== void 0 && ngControl.disabled !== null && ngControl.disabled !== this.disabled) {
          this.disabled = ngControl.disabled;
        }
        this._previousControl = ngControl.control;
      }
      this.updateErrorState();
    }
  }
  ngOnChanges(changes) {
    if (changes["disabled"] || changes["userAriaDescribedBy"]) {
      this.stateChanges.next();
    }
    if (changes["typeaheadDebounceInterval"] && this._keyManager) {
      this._keyManager.withTypeAhead(this.typeaheadDebounceInterval);
    }
  }
  ngOnDestroy() {
    this._cleanupDetach?.();
    this._keyManager?.destroy();
    this._destroy.next();
    this._destroy.complete();
    this.stateChanges.complete();
    this._clearFromModal();
  }
  /** Toggles the overlay panel open or closed. */
  toggle() {
    this.panelOpen ? this.close() : this.open();
  }
  /** Opens the overlay panel. */
  open() {
    if (!this._canOpen()) {
      return;
    }
    if (this._parentFormField) {
      this._preferredOverlayOrigin = this._parentFormField.getConnectedOverlayOrigin();
    }
    this._cleanupDetach?.();
    this._overlayWidth = this._getOverlayWidth(this._preferredOverlayOrigin);
    this._applyModalPanelOwnership();
    this._panelOpen = true;
    this._overlayDir.positionChange.pipe(take(1)).subscribe(() => {
      this._changeDetectorRef.detectChanges();
      this._positioningSettled();
    });
    this._overlayDir.attachOverlay();
    this._keyManager.withHorizontalOrientation(null);
    this._highlightCorrectOption();
    this._changeDetectorRef.markForCheck();
    this.stateChanges.next();
    Promise.resolve().then(() => this.openedChange.emit(true));
  }
  /**
   * Track which modal we have modified the `aria-owns` attribute of. When the combobox trigger is
   * inside an aria-modal, we apply aria-owns to the parent modal with the `id` of the options
   * panel. Track the modal we have changed so we can undo the changes on destroy.
   */
  _trackedModal = null;
  /**
   * If the autocomplete trigger is inside of an `aria-modal` element, connect
   * that modal to the options panel with `aria-owns`.
   *
   * For some browser + screen reader combinations, when navigation is inside
   * of an `aria-modal` element, the screen reader treats everything outside
   * of that modal as hidden or invisible.
   *
   * This causes a problem when the combobox trigger is _inside_ of a modal, because the
   * options panel is rendered _outside_ of that modal, preventing screen reader navigation
   * from reaching the panel.
   *
   * We can work around this issue by applying `aria-owns` to the modal with the `id` of
   * the options panel. This effectively communicates to assistive technology that the
   * options panel is part of the same interaction as the modal.
   *
   * At time of this writing, this issue is present in VoiceOver.
   * See https://github.com/angular/components/issues/20694
   */
  _applyModalPanelOwnership() {
    const modal = this._elementRef.nativeElement.closest('body > .cdk-overlay-container [aria-modal="true"]');
    if (!modal) {
      return;
    }
    const panelId = `${this.id}-panel`;
    if (this._trackedModal) {
      removeAriaReferencedId(this._trackedModal, "aria-owns", panelId);
    }
    addAriaReferencedId(modal, "aria-owns", panelId);
    this._trackedModal = modal;
  }
  /** Clears the reference to the listbox overlay element from the modal it was added to. */
  _clearFromModal() {
    if (!this._trackedModal) {
      return;
    }
    const panelId = `${this.id}-panel`;
    removeAriaReferencedId(this._trackedModal, "aria-owns", panelId);
    this._trackedModal = null;
  }
  /** Closes the overlay panel and focuses the host element. */
  close() {
    if (this._panelOpen) {
      this._panelOpen = false;
      this._exitAndDetach();
      this._keyManager.withHorizontalOrientation(this._isRtl() ? "rtl" : "ltr");
      this._changeDetectorRef.markForCheck();
      this._onTouched();
      this.stateChanges.next();
      Promise.resolve().then(() => this.openedChange.emit(false));
    }
  }
  /** Triggers the exit animation and detaches the overlay at the end. */
  _exitAndDetach() {
    if (this._animationsDisabled || !this.panel) {
      this._detachOverlay();
      return;
    }
    this._cleanupDetach?.();
    this._cleanupDetach = () => {
      cleanupEvent();
      clearTimeout(exitFallbackTimer);
      this._cleanupDetach = void 0;
    };
    const panel = this.panel.nativeElement;
    const cleanupEvent = this._renderer.listen(panel, "animationend", (event) => {
      if (event.animationName === "_mat-select-exit") {
        this._cleanupDetach?.();
        this._detachOverlay();
      }
    });
    const exitFallbackTimer = setTimeout(() => {
      this._cleanupDetach?.();
      this._detachOverlay();
    }, 200);
    panel.classList.add("mat-select-panel-exit");
  }
  /** Detaches the current overlay directive. */
  _detachOverlay() {
    this._overlayDir.detachOverlay();
    this._changeDetectorRef.markForCheck();
  }
  /**
   * Sets the select's value. Part of the ControlValueAccessor interface
   * required to integrate with Angular's core forms API.
   *
   * @param value New value to be written to the model.
   */
  writeValue(value) {
    this._assignValue(value);
  }
  /**
   * Saves a callback function to be invoked when the select's value
   * changes from user input. Part of the ControlValueAccessor interface
   * required to integrate with Angular's core forms API.
   *
   * @param fn Callback to be triggered when the value changes.
   */
  registerOnChange(fn) {
    this._onChange = fn;
  }
  /**
   * Saves a callback function to be invoked when the select is blurred
   * by the user. Part of the ControlValueAccessor interface required
   * to integrate with Angular's core forms API.
   *
   * @param fn Callback to be triggered when the component has been touched.
   */
  registerOnTouched(fn) {
    this._onTouched = fn;
  }
  /**
   * Disables the select. Part of the ControlValueAccessor interface required
   * to integrate with Angular's core forms API.
   *
   * @param isDisabled Sets whether the component is disabled.
   */
  setDisabledState(isDisabled) {
    this.disabled = isDisabled;
    this._changeDetectorRef.markForCheck();
    this.stateChanges.next();
  }
  /** Whether or not the overlay panel is open. */
  get panelOpen() {
    return this._panelOpen;
  }
  /** The currently selected option. */
  get selected() {
    return this.multiple ? this._selectionModel?.selected || [] : this._selectionModel?.selected[0];
  }
  /** The value displayed in the trigger. */
  get triggerValue() {
    if (this.empty) {
      return "";
    }
    if (this._multiple) {
      const selectedOptions = this._selectionModel.selected.map((option) => option.viewValue);
      if (this._isRtl()) {
        selectedOptions.reverse();
      }
      return selectedOptions.join(", ");
    }
    return this._selectionModel.selected[0].viewValue;
  }
  /** Refreshes the error state of the select. */
  updateErrorState() {
    this._errorStateTracker.updateErrorState();
  }
  /** Whether the element is in RTL mode. */
  _isRtl() {
    return this._dir ? this._dir.value === "rtl" : false;
  }
  /** Handles all keydown events on the select. */
  _handleKeydown(event) {
    if (!this.disabled) {
      this.panelOpen ? this._handleOpenKeydown(event) : this._handleClosedKeydown(event);
    }
  }
  /** Handles keyboard events while the select is closed. */
  _handleClosedKeydown(event) {
    const keyCode = event.keyCode;
    const isArrowKey = keyCode === DOWN_ARROW || keyCode === UP_ARROW || keyCode === LEFT_ARROW || keyCode === RIGHT_ARROW;
    const isOpenKey = keyCode === ENTER || keyCode === SPACE;
    const manager = this._keyManager;
    if (!manager.isTyping() && isOpenKey && !hasModifierKey(event) || (this.multiple || event.altKey) && isArrowKey) {
      event.preventDefault();
      this.open();
    } else if (!this.multiple) {
      const previouslySelectedOption = this.selected;
      manager.onKeydown(event);
      const selectedOption = this.selected;
      if (selectedOption && previouslySelectedOption !== selectedOption) {
        this._liveAnnouncer.announce(selectedOption.viewValue, 1e4);
      }
    }
  }
  /** Handles keyboard events when the selected is open. */
  _handleOpenKeydown(event) {
    const manager = this._keyManager;
    const keyCode = event.keyCode;
    const isArrowKey = keyCode === DOWN_ARROW || keyCode === UP_ARROW;
    const isTyping = manager.isTyping();
    if (isArrowKey && event.altKey) {
      event.preventDefault();
      this.close();
    } else if (!isTyping && (keyCode === ENTER || keyCode === SPACE) && manager.activeItem && !hasModifierKey(event)) {
      event.preventDefault();
      manager.activeItem._selectViaInteraction();
    } else if (!isTyping && this._multiple && keyCode === A && event.ctrlKey) {
      event.preventDefault();
      const hasDeselectedOptions = this.options.some((opt) => !opt.disabled && !opt.selected);
      this.options.forEach((option) => {
        if (!option.disabled) {
          hasDeselectedOptions ? option.select() : option.deselect();
        }
      });
    } else {
      const previouslyFocusedIndex = manager.activeItemIndex;
      manager.onKeydown(event);
      if (this._multiple && isArrowKey && event.shiftKey && manager.activeItem && manager.activeItemIndex !== previouslyFocusedIndex) {
        manager.activeItem._selectViaInteraction();
      }
    }
  }
  /** Handles keyboard events coming from the overlay. */
  _handleOverlayKeydown(event) {
    if (event.keyCode === ESCAPE && !hasModifierKey(event)) {
      event.preventDefault();
      this.close();
    }
  }
  _onFocus() {
    if (!this.disabled) {
      this._focused = true;
      this.stateChanges.next();
    }
  }
  /**
   * Calls the touched callback only if the panel is closed. Otherwise, the trigger will
   * "blur" to the panel when it opens, causing a false positive.
   */
  _onBlur() {
    this._focused = false;
    this._keyManager?.cancelTypeahead();
    if (!this.disabled && !this.panelOpen) {
      this._onTouched();
      this._changeDetectorRef.markForCheck();
      this.stateChanges.next();
    }
  }
  /** Returns the theme to be used on the panel. */
  _getPanelTheme() {
    return this._parentFormField ? `mat-${this._parentFormField.color}` : "";
  }
  /** Whether the select has a value. */
  get empty() {
    return !this._selectionModel || this._selectionModel.isEmpty();
  }
  _initializeSelection() {
    Promise.resolve().then(() => {
      if (this.ngControl) {
        this._value = this.ngControl.value;
      }
      this._setSelectionByValue(this._value);
      this.stateChanges.next();
    });
  }
  /**
   * Sets the selected option based on a value. If no option can be
   * found with the designated value, the select trigger is cleared.
   */
  _setSelectionByValue(value) {
    this.options.forEach((option) => option.setInactiveStyles());
    this._selectionModel.clear();
    if (this.multiple && value) {
      if (!Array.isArray(value) && (typeof ngDevMode === "undefined" || ngDevMode)) {
        throw getMatSelectNonArrayValueError();
      }
      value.forEach((currentValue) => this._selectOptionByValue(currentValue));
      this._sortValues();
    } else {
      const correspondingOption = this._selectOptionByValue(value);
      if (correspondingOption) {
        this._keyManager.updateActiveItem(correspondingOption);
      } else if (!this.panelOpen) {
        this._keyManager.updateActiveItem(-1);
      }
    }
    this._changeDetectorRef.markForCheck();
  }
  /**
   * Finds and selects and option based on its value.
   * @returns Option that has the corresponding value.
   */
  _selectOptionByValue(value) {
    const correspondingOption = this.options.find((option) => {
      if (this._selectionModel.isSelected(option)) {
        return false;
      }
      try {
        return (option.value != null || this.canSelectNullableOptions) && this._compareWith(option.value, value);
      } catch (error) {
        if (typeof ngDevMode === "undefined" || ngDevMode) {
          console.warn(error);
        }
        return false;
      }
    });
    if (correspondingOption) {
      this._selectionModel.select(correspondingOption);
    }
    return correspondingOption;
  }
  /** Assigns a specific value to the select. Returns whether the value has changed. */
  _assignValue(newValue) {
    if (newValue !== this._value || this._multiple && Array.isArray(newValue)) {
      if (this.options) {
        this._setSelectionByValue(newValue);
      }
      this._value = newValue;
      return true;
    }
    return false;
  }
  // `skipPredicate` determines if key manager should avoid putting a given option in the tab
  // order. Allow disabled list items to receive focus via keyboard to align with WAI ARIA
  // recommendation.
  //
  // Normally WAI ARIA's instructions are to exclude disabled items from the tab order, but it
  // makes a few exceptions for compound widgets.
  //
  // From [Developing a Keyboard Interface](
  // https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/):
  //   "For the following composite widget elements, keep them focusable when disabled: Options in a
  //   Listbox..."
  //
  // The user can focus disabled options using the keyboard, but the user cannot click disabled
  // options.
  _skipPredicate = (option) => {
    if (this.panelOpen) {
      return false;
    }
    return option.disabled;
  };
  /** Gets how wide the overlay panel should be. */
  _getOverlayWidth(preferredOrigin) {
    if (this.panelWidth === "auto") {
      const refToMeasure = preferredOrigin instanceof CdkOverlayOrigin ? preferredOrigin.elementRef : preferredOrigin || this._elementRef;
      return refToMeasure.nativeElement.getBoundingClientRect().width;
    }
    return this.panelWidth === null ? "" : this.panelWidth;
  }
  /** Syncs the parent state with the individual options. */
  _syncParentProperties() {
    if (this.options) {
      for (const option of this.options) {
        option._changeDetectorRef.markForCheck();
      }
    }
  }
  /** Sets up a key manager to listen to keyboard events on the overlay panel. */
  _initKeyManager() {
    this._keyManager = new ActiveDescendantKeyManager(this.options).withTypeAhead(this.typeaheadDebounceInterval).withVerticalOrientation().withHorizontalOrientation(this._isRtl() ? "rtl" : "ltr").withHomeAndEnd().withPageUpDown().withAllowedModifierKeys(["shiftKey"]).skipPredicate(this._skipPredicate);
    this._keyManager.tabOut.subscribe(() => {
      if (this.panelOpen) {
        if (!this.multiple && this._keyManager.activeItem) {
          this._keyManager.activeItem._selectViaInteraction();
        }
        this.focus();
        this.close();
      }
    });
    this._keyManager.change.subscribe(() => {
      if (this._panelOpen && this.panel) {
        this._scrollOptionIntoView(this._keyManager.activeItemIndex || 0);
      } else if (!this._panelOpen && !this.multiple && this._keyManager.activeItem) {
        this._keyManager.activeItem._selectViaInteraction();
      }
    });
  }
  /** Drops current option subscriptions and IDs and resets from scratch. */
  _resetOptions() {
    const changedOrDestroyed = merge(this.options.changes, this._destroy);
    this.optionSelectionChanges.pipe(takeUntil(changedOrDestroyed)).subscribe((event) => {
      this._onSelect(event.source, event.isUserInput);
      if (event.isUserInput && !this.multiple && this._panelOpen) {
        this.close();
        this.focus();
      }
    });
    merge(...this.options.map((option) => option._stateChanges)).pipe(takeUntil(changedOrDestroyed)).subscribe(() => {
      this._changeDetectorRef.detectChanges();
      this.stateChanges.next();
    });
  }
  /** Invoked when an option is clicked. */
  _onSelect(option, isUserInput) {
    const wasSelected = this._selectionModel.isSelected(option);
    if (!this.canSelectNullableOptions && option.value == null && !this._multiple) {
      option.deselect();
      this._selectionModel.clear();
      if (this.value != null) {
        this._propagateChanges(option.value);
      }
    } else {
      if (wasSelected !== option.selected) {
        option.selected ? this._selectionModel.select(option) : this._selectionModel.deselect(option);
      }
      if (isUserInput) {
        this._keyManager.setActiveItem(option);
      }
      if (this.multiple) {
        this._sortValues();
        if (isUserInput) {
          this.focus();
        }
      }
    }
    if (wasSelected !== this._selectionModel.isSelected(option)) {
      this._propagateChanges();
    }
    this.stateChanges.next();
  }
  /** Sorts the selected values in the selected based on their order in the panel. */
  _sortValues() {
    if (this.multiple) {
      const options = this.options.toArray();
      this._selectionModel.sort((a, b) => {
        return this.sortComparator ? this.sortComparator(a, b, options) : options.indexOf(a) - options.indexOf(b);
      });
      this.stateChanges.next();
    }
  }
  /** Emits change event to set the model value. */
  _propagateChanges(fallbackValue) {
    let valueToEmit;
    if (this.multiple) {
      valueToEmit = this.selected.map((option) => option.value);
    } else {
      valueToEmit = this.selected ? this.selected.value : fallbackValue;
    }
    this._value = valueToEmit;
    this.valueChange.emit(valueToEmit);
    this._onChange(valueToEmit);
    this.selectionChange.emit(this._getChangeEvent(valueToEmit));
    this._changeDetectorRef.markForCheck();
  }
  /**
   * Highlights the selected item. If no option is selected, it will highlight
   * the first *enabled* option.
   */
  _highlightCorrectOption() {
    if (this._keyManager) {
      if (this.empty) {
        let firstEnabledOptionIndex = -1;
        for (let index = 0; index < this.options.length; index++) {
          const option = this.options.get(index);
          if (!option.disabled) {
            firstEnabledOptionIndex = index;
            break;
          }
        }
        this._keyManager.setActiveItem(firstEnabledOptionIndex);
      } else {
        this._keyManager.setActiveItem(this._selectionModel.selected[0]);
      }
    }
  }
  /** Whether the panel is allowed to open. */
  _canOpen() {
    return !this._panelOpen && !this.disabled && this.options?.length > 0 && !!this._overlayDir;
  }
  /** Focuses the select element. */
  focus(options) {
    this._elementRef.nativeElement.focus(options);
  }
  /** Gets the aria-labelledby for the select panel. */
  _getPanelAriaLabelledby() {
    if (this.ariaLabel) {
      return null;
    }
    const labelId = this._parentFormField?.getLabelId() || null;
    const labelExpression = labelId ? labelId + " " : "";
    return this.ariaLabelledby ? labelExpression + this.ariaLabelledby : labelId;
  }
  /** Determines the `aria-activedescendant` to be set on the host. */
  _getAriaActiveDescendant() {
    if (this.panelOpen && this._keyManager && this._keyManager.activeItem) {
      return this._keyManager.activeItem.id;
    }
    return null;
  }
  /** Gets the aria-labelledby of the select component trigger. */
  _getTriggerAriaLabelledby() {
    if (this.ariaLabel) {
      return null;
    }
    const labelId = this._parentFormField?.getLabelId();
    let value = (labelId ? labelId + " " : "") + this._valueId;
    if (this.ariaLabelledby) {
      value += " " + this.ariaLabelledby;
    }
    return value;
  }
  /**
   * Implemented as part of MatFormFieldControl.
   * @docs-private
   */
  setDescribedByIds(ids) {
    if (ids.length) {
      this._elementRef.nativeElement.setAttribute("aria-describedby", ids.join(" "));
    } else {
      this._elementRef.nativeElement.removeAttribute("aria-describedby");
    }
  }
  /**
   * Implemented as part of MatFormFieldControl.
   * @docs-private
   */
  onContainerClick() {
    this.focus();
    this.open();
  }
  /**
   * Implemented as part of MatFormFieldControl.
   * @docs-private
   */
  get shouldLabelFloat() {
    return this.panelOpen || !this.empty || this.focused && !!this.placeholder;
  }
  static \u0275fac = function MatSelect_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _MatSelect)();
  };
  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({
    type: _MatSelect,
    selectors: [["mat-select"]],
    contentQueries: function MatSelect_ContentQueries(rf, ctx, dirIndex) {
      if (rf & 1) {
        \u0275\u0275contentQuery(dirIndex, MAT_SELECT_TRIGGER, 5);
        \u0275\u0275contentQuery(dirIndex, MatOption, 5);
        \u0275\u0275contentQuery(dirIndex, MAT_OPTGROUP, 5);
      }
      if (rf & 2) {
        let _t;
        \u0275\u0275queryRefresh(_t = \u0275\u0275loadQuery()) && (ctx.customTrigger = _t.first);
        \u0275\u0275queryRefresh(_t = \u0275\u0275loadQuery()) && (ctx.options = _t);
        \u0275\u0275queryRefresh(_t = \u0275\u0275loadQuery()) && (ctx.optionGroups = _t);
      }
    },
    viewQuery: function MatSelect_Query(rf, ctx) {
      if (rf & 1) {
        \u0275\u0275viewQuery(_c0, 5);
        \u0275\u0275viewQuery(_c1, 5);
        \u0275\u0275viewQuery(CdkConnectedOverlay, 5);
      }
      if (rf & 2) {
        let _t;
        \u0275\u0275queryRefresh(_t = \u0275\u0275loadQuery()) && (ctx.trigger = _t.first);
        \u0275\u0275queryRefresh(_t = \u0275\u0275loadQuery()) && (ctx.panel = _t.first);
        \u0275\u0275queryRefresh(_t = \u0275\u0275loadQuery()) && (ctx._overlayDir = _t.first);
      }
    },
    hostAttrs: ["role", "combobox", "aria-haspopup", "listbox", 1, "mat-mdc-select"],
    hostVars: 19,
    hostBindings: function MatSelect_HostBindings(rf, ctx) {
      if (rf & 1) {
        \u0275\u0275listener("keydown", function MatSelect_keydown_HostBindingHandler($event) {
          return ctx._handleKeydown($event);
        })("focus", function MatSelect_focus_HostBindingHandler() {
          return ctx._onFocus();
        })("blur", function MatSelect_blur_HostBindingHandler() {
          return ctx._onBlur();
        });
      }
      if (rf & 2) {
        \u0275\u0275attribute("id", ctx.id)("tabindex", ctx.disabled ? -1 : ctx.tabIndex)("aria-controls", ctx.panelOpen ? ctx.id + "-panel" : null)("aria-expanded", ctx.panelOpen)("aria-label", ctx.ariaLabel || null)("aria-required", ctx.required.toString())("aria-disabled", ctx.disabled.toString())("aria-invalid", ctx.errorState)("aria-activedescendant", ctx._getAriaActiveDescendant());
        \u0275\u0275classProp("mat-mdc-select-disabled", ctx.disabled)("mat-mdc-select-invalid", ctx.errorState)("mat-mdc-select-required", ctx.required)("mat-mdc-select-empty", ctx.empty)("mat-mdc-select-multiple", ctx.multiple);
      }
    },
    inputs: {
      userAriaDescribedBy: [0, "aria-describedby", "userAriaDescribedBy"],
      panelClass: "panelClass",
      disabled: [2, "disabled", "disabled", booleanAttribute],
      disableRipple: [2, "disableRipple", "disableRipple", booleanAttribute],
      tabIndex: [2, "tabIndex", "tabIndex", (value) => value == null ? 0 : numberAttribute(value)],
      hideSingleSelectionIndicator: [2, "hideSingleSelectionIndicator", "hideSingleSelectionIndicator", booleanAttribute],
      placeholder: "placeholder",
      required: [2, "required", "required", booleanAttribute],
      multiple: [2, "multiple", "multiple", booleanAttribute],
      disableOptionCentering: [2, "disableOptionCentering", "disableOptionCentering", booleanAttribute],
      compareWith: "compareWith",
      value: "value",
      ariaLabel: [0, "aria-label", "ariaLabel"],
      ariaLabelledby: [0, "aria-labelledby", "ariaLabelledby"],
      errorStateMatcher: "errorStateMatcher",
      typeaheadDebounceInterval: [2, "typeaheadDebounceInterval", "typeaheadDebounceInterval", numberAttribute],
      sortComparator: "sortComparator",
      id: "id",
      panelWidth: "panelWidth",
      canSelectNullableOptions: [2, "canSelectNullableOptions", "canSelectNullableOptions", booleanAttribute]
    },
    outputs: {
      openedChange: "openedChange",
      _openedStream: "opened",
      _closedStream: "closed",
      selectionChange: "selectionChange",
      valueChange: "valueChange"
    },
    exportAs: ["matSelect"],
    features: [\u0275\u0275ProvidersFeature([{
      provide: MatFormFieldControl,
      useExisting: _MatSelect
    }, {
      provide: MAT_OPTION_PARENT_COMPONENT,
      useExisting: _MatSelect
    }]), \u0275\u0275NgOnChangesFeature],
    ngContentSelectors: _c3,
    decls: 11,
    vars: 8,
    consts: [["fallbackOverlayOrigin", "cdkOverlayOrigin", "trigger", ""], ["panel", ""], ["cdk-overlay-origin", "", 1, "mat-mdc-select-trigger", 3, "click"], [1, "mat-mdc-select-value"], [1, "mat-mdc-select-placeholder", "mat-mdc-select-min-line"], [1, "mat-mdc-select-value-text"], [1, "mat-mdc-select-arrow-wrapper"], [1, "mat-mdc-select-arrow"], ["viewBox", "0 0 24 24", "width", "24px", "height", "24px", "focusable", "false", "aria-hidden", "true"], ["d", "M7 10l5 5 5-5z"], ["cdk-connected-overlay", "", "cdkConnectedOverlayLockPosition", "", "cdkConnectedOverlayHasBackdrop", "", "cdkConnectedOverlayBackdropClass", "cdk-overlay-transparent-backdrop", 3, "backdropClick", "overlayKeydown", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayWidth"], [1, "mat-mdc-select-min-line"], ["role", "listbox", "tabindex", "-1", 3, "keydown", "ngClass"]],
    template: function MatSelect_Template(rf, ctx) {
      if (rf & 1) {
        const _r1 = \u0275\u0275getCurrentView();
        \u0275\u0275projectionDef(_c2);
        \u0275\u0275elementStart(0, "div", 2, 0);
        \u0275\u0275listener("click", function MatSelect_Template_div_click_0_listener() {
          \u0275\u0275restoreView(_r1);
          return \u0275\u0275resetView(ctx.open());
        });
        \u0275\u0275elementStart(3, "div", 3);
        \u0275\u0275template(4, MatSelect_Conditional_4_Template, 2, 1, "span", 4)(5, MatSelect_Conditional_5_Template, 3, 1, "span", 5);
        \u0275\u0275elementEnd();
        \u0275\u0275elementStart(6, "div", 6)(7, "div", 7);
        \u0275\u0275namespaceSVG();
        \u0275\u0275elementStart(8, "svg", 8);
        \u0275\u0275element(9, "path", 9);
        \u0275\u0275elementEnd()()()();
        \u0275\u0275template(10, MatSelect_ng_template_10_Template, 3, 10, "ng-template", 10);
        \u0275\u0275listener("backdropClick", function MatSelect_Template_ng_template_backdropClick_10_listener() {
          \u0275\u0275restoreView(_r1);
          return \u0275\u0275resetView(ctx.close());
        })("overlayKeydown", function MatSelect_Template_ng_template_overlayKeydown_10_listener($event) {
          \u0275\u0275restoreView(_r1);
          return \u0275\u0275resetView(ctx._handleOverlayKeydown($event));
        });
      }
      if (rf & 2) {
        const fallbackOverlayOrigin_r4 = \u0275\u0275reference(1);
        \u0275\u0275advance(3);
        \u0275\u0275attribute("id", ctx._valueId);
        \u0275\u0275advance();
        \u0275\u0275conditional(ctx.empty ? 4 : 5);
        \u0275\u0275advance(6);
        \u0275\u0275property("cdkConnectedOverlayDisableClose", true)("cdkConnectedOverlayPanelClass", ctx._overlayPanelClass)("cdkConnectedOverlayScrollStrategy", ctx._scrollStrategy)("cdkConnectedOverlayOrigin", ctx._preferredOverlayOrigin || fallbackOverlayOrigin_r4)("cdkConnectedOverlayPositions", ctx._positions)("cdkConnectedOverlayWidth", ctx._overlayWidth);
      }
    },
    dependencies: [CdkOverlayOrigin, CdkConnectedOverlay, NgClass],
    styles: ['@keyframes _mat-select-enter{from{opacity:0;transform:scaleY(0.8)}to{opacity:1;transform:none}}@keyframes _mat-select-exit{from{opacity:1}to{opacity:0}}.mat-mdc-select{display:inline-block;width:100%;outline:none;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;color:var(--mat-select-enabled-trigger-text-color, var(--mat-sys-on-surface));font-family:var(--mat-select-trigger-text-font, var(--mat-sys-body-large-font));line-height:var(--mat-select-trigger-text-line-height, var(--mat-sys-body-large-line-height));font-size:var(--mat-select-trigger-text-size, var(--mat-sys-body-large-size));font-weight:var(--mat-select-trigger-text-weight, var(--mat-sys-body-large-weight));letter-spacing:var(--mat-select-trigger-text-tracking, var(--mat-sys-body-large-tracking))}div.mat-mdc-select-panel{box-shadow:var(--mat-select-container-elevation-shadow, 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12))}.mat-mdc-select-disabled{color:var(--mat-select-disabled-trigger-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-mdc-select-disabled .mat-mdc-select-placeholder{color:var(--mat-select-disabled-trigger-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-mdc-select-trigger{display:inline-flex;align-items:center;cursor:pointer;position:relative;box-sizing:border-box;width:100%}.mat-mdc-select-disabled .mat-mdc-select-trigger{-webkit-user-select:none;user-select:none;cursor:default}.mat-mdc-select-value{width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mat-mdc-select-value-text{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mat-mdc-select-arrow-wrapper{height:24px;flex-shrink:0;display:inline-flex;align-items:center}.mat-form-field-appearance-fill .mdc-text-field--no-label .mat-mdc-select-arrow-wrapper{transform:none}.mat-mdc-form-field .mat-mdc-select.mat-mdc-select-invalid .mat-mdc-select-arrow,.mat-form-field-invalid:not(.mat-form-field-disabled) .mat-mdc-form-field-infix::after{color:var(--mat-select-invalid-arrow-color, var(--mat-sys-error))}.mat-mdc-select-arrow{width:10px;height:5px;position:relative;color:var(--mat-select-enabled-arrow-color, var(--mat-sys-on-surface-variant))}.mat-mdc-form-field.mat-focused .mat-mdc-select-arrow{color:var(--mat-select-focused-arrow-color, var(--mat-sys-primary))}.mat-mdc-form-field .mat-mdc-select.mat-mdc-select-disabled .mat-mdc-select-arrow{color:var(--mat-select-disabled-arrow-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-mdc-select-arrow svg{fill:currentColor;position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}@media(forced-colors: active){.mat-mdc-select-arrow svg{fill:CanvasText}.mat-mdc-select-disabled .mat-mdc-select-arrow svg{fill:GrayText}}div.mat-mdc-select-panel{width:100%;max-height:275px;outline:0;overflow:auto;padding:8px 0;border-radius:4px;box-sizing:border-box;position:static;background-color:var(--mat-select-panel-background-color, var(--mat-sys-surface-container))}@media(forced-colors: active){div.mat-mdc-select-panel{outline:solid 1px}}.cdk-overlay-pane:not(.mat-mdc-select-panel-above) div.mat-mdc-select-panel{border-top-left-radius:0;border-top-right-radius:0;transform-origin:top center}.mat-mdc-select-panel-above div.mat-mdc-select-panel{border-bottom-left-radius:0;border-bottom-right-radius:0;transform-origin:bottom center}div.mat-mdc-select-panel .mat-mdc-option{--mdc-list-list-item-container-color: var(--mat-select-panel-background-color)}.mat-select-panel-animations-enabled{animation:_mat-select-enter 120ms cubic-bezier(0, 0, 0.2, 1)}.mat-select-panel-animations-enabled.mat-select-panel-exit{animation:_mat-select-exit 100ms linear}.mat-mdc-select-placeholder{transition:color 400ms 133.3333333333ms cubic-bezier(0.25, 0.8, 0.25, 1);color:var(--mat-select-placeholder-text-color, var(--mat-sys-on-surface-variant))}.mat-mdc-form-field:not(.mat-form-field-animations-enabled) .mat-mdc-select-placeholder,._mat-animation-noopable .mat-mdc-select-placeholder{transition:none}.mat-form-field-hide-placeholder .mat-mdc-select-placeholder{color:rgba(0,0,0,0);-webkit-text-fill-color:rgba(0,0,0,0);transition:none;display:block}.mat-mdc-form-field-type-mat-select:not(.mat-form-field-disabled) .mat-mdc-text-field-wrapper{cursor:pointer}.mat-mdc-form-field-type-mat-select.mat-form-field-appearance-fill .mat-mdc-floating-label{max-width:calc(100% - 18px)}.mat-mdc-form-field-type-mat-select.mat-form-field-appearance-fill .mdc-floating-label--float-above{max-width:calc(100%/0.75 - 24px)}.mat-mdc-form-field-type-mat-select.mat-form-field-appearance-outline .mdc-notched-outline__notch{max-width:calc(100% - 60px)}.mat-mdc-form-field-type-mat-select.mat-form-field-appearance-outline .mdc-text-field--label-floating .mdc-notched-outline__notch{max-width:calc(100% - 24px)}.mat-mdc-select-min-line:empty::before{content:" ";white-space:pre;width:1px;display:inline-block;visibility:hidden}.mat-form-field-appearance-fill .mat-mdc-select-arrow-wrapper{transform:var(--mat-select-arrow-transform, translateY(-8px))}'],
    encapsulation: 2,
    changeDetection: 0
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatSelect, [{
    type: Component,
    args: [{
      selector: "mat-select",
      exportAs: "matSelect",
      encapsulation: ViewEncapsulation.None,
      changeDetection: ChangeDetectionStrategy.OnPush,
      host: {
        "role": "combobox",
        "aria-haspopup": "listbox",
        "class": "mat-mdc-select",
        "[attr.id]": "id",
        "[attr.tabindex]": "disabled ? -1 : tabIndex",
        "[attr.aria-controls]": 'panelOpen ? id + "-panel" : null',
        "[attr.aria-expanded]": "panelOpen",
        "[attr.aria-label]": "ariaLabel || null",
        "[attr.aria-required]": "required.toString()",
        "[attr.aria-disabled]": "disabled.toString()",
        "[attr.aria-invalid]": "errorState",
        "[attr.aria-activedescendant]": "_getAriaActiveDescendant()",
        "[class.mat-mdc-select-disabled]": "disabled",
        "[class.mat-mdc-select-invalid]": "errorState",
        "[class.mat-mdc-select-required]": "required",
        "[class.mat-mdc-select-empty]": "empty",
        "[class.mat-mdc-select-multiple]": "multiple",
        "(keydown)": "_handleKeydown($event)",
        "(focus)": "_onFocus()",
        "(blur)": "_onBlur()"
      },
      providers: [{
        provide: MatFormFieldControl,
        useExisting: MatSelect
      }, {
        provide: MAT_OPTION_PARENT_COMPONENT,
        useExisting: MatSelect
      }],
      imports: [CdkOverlayOrigin, CdkConnectedOverlay, NgClass],
      template: `<div cdk-overlay-origin
     class="mat-mdc-select-trigger"
     (click)="open()"
     #fallbackOverlayOrigin="cdkOverlayOrigin"
     #trigger>

  <div class="mat-mdc-select-value" [attr.id]="_valueId">
    @if (empty) {
      <span class="mat-mdc-select-placeholder mat-mdc-select-min-line">{{placeholder}}</span>
    } @else {
      <span class="mat-mdc-select-value-text">
        @if (customTrigger) {
          <ng-content select="mat-select-trigger"></ng-content>
        } @else {
          <span class="mat-mdc-select-min-line">{{triggerValue}}</span>
        }
      </span>
    }
  </div>

  <div class="mat-mdc-select-arrow-wrapper">
    <div class="mat-mdc-select-arrow">
      <!-- Use an inline SVG, because it works better than a CSS triangle in high contrast mode. -->
      <svg viewBox="0 0 24 24" width="24px" height="24px" focusable="false" aria-hidden="true">
        <path d="M7 10l5 5 5-5z"/>
      </svg>
    </div>
  </div>
</div>

<ng-template
  cdk-connected-overlay
  cdkConnectedOverlayLockPosition
  cdkConnectedOverlayHasBackdrop
  cdkConnectedOverlayBackdropClass="cdk-overlay-transparent-backdrop"
  [cdkConnectedOverlayDisableClose]="true"
  [cdkConnectedOverlayPanelClass]="_overlayPanelClass"
  [cdkConnectedOverlayScrollStrategy]="_scrollStrategy"
  [cdkConnectedOverlayOrigin]="_preferredOverlayOrigin || fallbackOverlayOrigin"
  [cdkConnectedOverlayPositions]="_positions"
  [cdkConnectedOverlayWidth]="_overlayWidth"
  (backdropClick)="close()"
  (overlayKeydown)="_handleOverlayKeydown($event)">
  <div
    #panel
    role="listbox"
    tabindex="-1"
    class="mat-mdc-select-panel mdc-menu-surface mdc-menu-surface--open {{ _getPanelTheme() }}"
    [class.mat-select-panel-animations-enabled]="!_animationsDisabled"
    [attr.id]="id + '-panel'"
    [attr.aria-multiselectable]="multiple"
    [attr.aria-label]="ariaLabel || null"
    [attr.aria-labelledby]="_getPanelAriaLabelledby()"
    [ngClass]="panelClass"
    (keydown)="_handleKeydown($event)">
    <ng-content></ng-content>
  </div>
</ng-template>
`,
      styles: ['@keyframes _mat-select-enter{from{opacity:0;transform:scaleY(0.8)}to{opacity:1;transform:none}}@keyframes _mat-select-exit{from{opacity:1}to{opacity:0}}.mat-mdc-select{display:inline-block;width:100%;outline:none;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;color:var(--mat-select-enabled-trigger-text-color, var(--mat-sys-on-surface));font-family:var(--mat-select-trigger-text-font, var(--mat-sys-body-large-font));line-height:var(--mat-select-trigger-text-line-height, var(--mat-sys-body-large-line-height));font-size:var(--mat-select-trigger-text-size, var(--mat-sys-body-large-size));font-weight:var(--mat-select-trigger-text-weight, var(--mat-sys-body-large-weight));letter-spacing:var(--mat-select-trigger-text-tracking, var(--mat-sys-body-large-tracking))}div.mat-mdc-select-panel{box-shadow:var(--mat-select-container-elevation-shadow, 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12))}.mat-mdc-select-disabled{color:var(--mat-select-disabled-trigger-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-mdc-select-disabled .mat-mdc-select-placeholder{color:var(--mat-select-disabled-trigger-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-mdc-select-trigger{display:inline-flex;align-items:center;cursor:pointer;position:relative;box-sizing:border-box;width:100%}.mat-mdc-select-disabled .mat-mdc-select-trigger{-webkit-user-select:none;user-select:none;cursor:default}.mat-mdc-select-value{width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mat-mdc-select-value-text{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mat-mdc-select-arrow-wrapper{height:24px;flex-shrink:0;display:inline-flex;align-items:center}.mat-form-field-appearance-fill .mdc-text-field--no-label .mat-mdc-select-arrow-wrapper{transform:none}.mat-mdc-form-field .mat-mdc-select.mat-mdc-select-invalid .mat-mdc-select-arrow,.mat-form-field-invalid:not(.mat-form-field-disabled) .mat-mdc-form-field-infix::after{color:var(--mat-select-invalid-arrow-color, var(--mat-sys-error))}.mat-mdc-select-arrow{width:10px;height:5px;position:relative;color:var(--mat-select-enabled-arrow-color, var(--mat-sys-on-surface-variant))}.mat-mdc-form-field.mat-focused .mat-mdc-select-arrow{color:var(--mat-select-focused-arrow-color, var(--mat-sys-primary))}.mat-mdc-form-field .mat-mdc-select.mat-mdc-select-disabled .mat-mdc-select-arrow{color:var(--mat-select-disabled-arrow-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-mdc-select-arrow svg{fill:currentColor;position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}@media(forced-colors: active){.mat-mdc-select-arrow svg{fill:CanvasText}.mat-mdc-select-disabled .mat-mdc-select-arrow svg{fill:GrayText}}div.mat-mdc-select-panel{width:100%;max-height:275px;outline:0;overflow:auto;padding:8px 0;border-radius:4px;box-sizing:border-box;position:static;background-color:var(--mat-select-panel-background-color, var(--mat-sys-surface-container))}@media(forced-colors: active){div.mat-mdc-select-panel{outline:solid 1px}}.cdk-overlay-pane:not(.mat-mdc-select-panel-above) div.mat-mdc-select-panel{border-top-left-radius:0;border-top-right-radius:0;transform-origin:top center}.mat-mdc-select-panel-above div.mat-mdc-select-panel{border-bottom-left-radius:0;border-bottom-right-radius:0;transform-origin:bottom center}div.mat-mdc-select-panel .mat-mdc-option{--mdc-list-list-item-container-color: var(--mat-select-panel-background-color)}.mat-select-panel-animations-enabled{animation:_mat-select-enter 120ms cubic-bezier(0, 0, 0.2, 1)}.mat-select-panel-animations-enabled.mat-select-panel-exit{animation:_mat-select-exit 100ms linear}.mat-mdc-select-placeholder{transition:color 400ms 133.3333333333ms cubic-bezier(0.25, 0.8, 0.25, 1);color:var(--mat-select-placeholder-text-color, var(--mat-sys-on-surface-variant))}.mat-mdc-form-field:not(.mat-form-field-animations-enabled) .mat-mdc-select-placeholder,._mat-animation-noopable .mat-mdc-select-placeholder{transition:none}.mat-form-field-hide-placeholder .mat-mdc-select-placeholder{color:rgba(0,0,0,0);-webkit-text-fill-color:rgba(0,0,0,0);transition:none;display:block}.mat-mdc-form-field-type-mat-select:not(.mat-form-field-disabled) .mat-mdc-text-field-wrapper{cursor:pointer}.mat-mdc-form-field-type-mat-select.mat-form-field-appearance-fill .mat-mdc-floating-label{max-width:calc(100% - 18px)}.mat-mdc-form-field-type-mat-select.mat-form-field-appearance-fill .mdc-floating-label--float-above{max-width:calc(100%/0.75 - 24px)}.mat-mdc-form-field-type-mat-select.mat-form-field-appearance-outline .mdc-notched-outline__notch{max-width:calc(100% - 60px)}.mat-mdc-form-field-type-mat-select.mat-form-field-appearance-outline .mdc-text-field--label-floating .mdc-notched-outline__notch{max-width:calc(100% - 24px)}.mat-mdc-select-min-line:empty::before{content:" ";white-space:pre;width:1px;display:inline-block;visibility:hidden}.mat-form-field-appearance-fill .mat-mdc-select-arrow-wrapper{transform:var(--mat-select-arrow-transform, translateY(-8px))}']
    }]
  }], () => [], {
    options: [{
      type: ContentChildren,
      args: [MatOption, {
        descendants: true
      }]
    }],
    optionGroups: [{
      type: ContentChildren,
      args: [MAT_OPTGROUP, {
        descendants: true
      }]
    }],
    customTrigger: [{
      type: ContentChild,
      args: [MAT_SELECT_TRIGGER]
    }],
    userAriaDescribedBy: [{
      type: Input,
      args: ["aria-describedby"]
    }],
    trigger: [{
      type: ViewChild,
      args: ["trigger"]
    }],
    panel: [{
      type: ViewChild,
      args: ["panel"]
    }],
    _overlayDir: [{
      type: ViewChild,
      args: [CdkConnectedOverlay]
    }],
    panelClass: [{
      type: Input
    }],
    disabled: [{
      type: Input,
      args: [{
        transform: booleanAttribute
      }]
    }],
    disableRipple: [{
      type: Input,
      args: [{
        transform: booleanAttribute
      }]
    }],
    tabIndex: [{
      type: Input,
      args: [{
        transform: (value) => value == null ? 0 : numberAttribute(value)
      }]
    }],
    hideSingleSelectionIndicator: [{
      type: Input,
      args: [{
        transform: booleanAttribute
      }]
    }],
    placeholder: [{
      type: Input
    }],
    required: [{
      type: Input,
      args: [{
        transform: booleanAttribute
      }]
    }],
    multiple: [{
      type: Input,
      args: [{
        transform: booleanAttribute
      }]
    }],
    disableOptionCentering: [{
      type: Input,
      args: [{
        transform: booleanAttribute
      }]
    }],
    compareWith: [{
      type: Input
    }],
    value: [{
      type: Input
    }],
    ariaLabel: [{
      type: Input,
      args: ["aria-label"]
    }],
    ariaLabelledby: [{
      type: Input,
      args: ["aria-labelledby"]
    }],
    errorStateMatcher: [{
      type: Input
    }],
    typeaheadDebounceInterval: [{
      type: Input,
      args: [{
        transform: numberAttribute
      }]
    }],
    sortComparator: [{
      type: Input
    }],
    id: [{
      type: Input
    }],
    panelWidth: [{
      type: Input
    }],
    canSelectNullableOptions: [{
      type: Input,
      args: [{
        transform: booleanAttribute
      }]
    }],
    openedChange: [{
      type: Output
    }],
    _openedStream: [{
      type: Output,
      args: ["opened"]
    }],
    _closedStream: [{
      type: Output,
      args: ["closed"]
    }],
    selectionChange: [{
      type: Output
    }],
    valueChange: [{
      type: Output
    }]
  });
})();
var MatSelectTrigger = class _MatSelectTrigger {
  static \u0275fac = function MatSelectTrigger_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _MatSelectTrigger)();
  };
  static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
    type: _MatSelectTrigger,
    selectors: [["mat-select-trigger"]],
    features: [\u0275\u0275ProvidersFeature([{
      provide: MAT_SELECT_TRIGGER,
      useExisting: _MatSelectTrigger
    }])]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatSelectTrigger, [{
    type: Directive,
    args: [{
      selector: "mat-select-trigger",
      providers: [{
        provide: MAT_SELECT_TRIGGER,
        useExisting: MatSelectTrigger
      }]
    }]
  }], null, null);
})();
var MatSelectModule = class _MatSelectModule {
  static \u0275fac = function MatSelectModule_Factory(__ngFactoryType__) {
    return new (__ngFactoryType__ || _MatSelectModule)();
  };
  static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
    type: _MatSelectModule,
    imports: [OverlayModule, MatOptionModule, MatCommonModule, MatSelect, MatSelectTrigger],
    exports: [CdkScrollableModule, MatFormFieldModule, MatSelect, MatSelectTrigger, MatOptionModule, MatCommonModule]
  });
  static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({
    providers: [MAT_SELECT_SCROLL_STRATEGY_PROVIDER],
    imports: [OverlayModule, MatOptionModule, MatCommonModule, CdkScrollableModule, MatFormFieldModule, MatOptionModule, MatCommonModule]
  });
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatSelectModule, [{
    type: NgModule,
    args: [{
      imports: [OverlayModule, MatOptionModule, MatCommonModule, MatSelect, MatSelectTrigger],
      exports: [CdkScrollableModule, MatFormFieldModule, MatSelect, MatSelectTrigger, MatOptionModule, MatCommonModule],
      providers: [MAT_SELECT_SCROLL_STRATEGY_PROVIDER]
    }]
  }], null, null);
})();

// src/app/settings/settings.component.ts
var semver = __toESM(require_semver());

// src/app/settings/stream-format.enum.ts
var StreamFormat;
(function(StreamFormat2) {
  StreamFormat2["TsStreamFormat"] = "ts";
  StreamFormat2["M3u8StreamFormat"] = "m3u8";
})(StreamFormat || (StreamFormat = {}));

// src/app/services/settings-store.service.ts
var DEFAULT_SETTINGS = {
  player: VideoPlayer.VideoJs,
  streamFormat: StreamFormat.M3u8StreamFormat,
  language: Language.ENGLISH,
  showCaptions: false,
  theme: Theme.LightTheme,
  mpvPlayerPath: "",
  vlcPlayerPath: "",
  remoteControl: false,
  remoteControlPort: 3e3,
  epgUrl: []
};
var SettingsStore = signalStore({ providedIn: "root" }, withState(DEFAULT_SETTINGS), withMethods((store, storage = inject(StorageMap)) => ({
  loadSettings() {
    return __async(this, null, function* () {
      const stored = yield firstValueFrom(storage.get(STORE_KEY.Settings));
      if (stored) {
        patchState(store, __spreadValues(__spreadValues({}, DEFAULT_SETTINGS), stored));
      }
    });
  },
  updateSettings(settings) {
    return __async(this, null, function* () {
      patchState(store, settings);
      yield firstValueFrom(storage.set(STORE_KEY.Settings, settings));
    });
  },
  getSettings() {
    return {
      player: store.player(),
      streamFormat: store.streamFormat(),
      language: store.language(),
      showCaptions: store.showCaptions(),
      theme: store.theme(),
      mpvPlayerPath: store.mpvPlayerPath(),
      vlcPlayerPath: store.vlcPlayerPath(),
      remoteControl: store.remoteControl(),
      remoteControlPort: store.remoteControlPort(),
      epgUrl: store.epgUrl()
    };
  }
})), withHooks({
  onInit(store) {
    store.loadSettings();
  }
}));

// src/app/settings/settings.component.ts
function SettingsComponent_Conditional_0_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275text(0, "\n    ");
    \u0275\u0275element(1, "app-header", 20);
    \u0275\u0275pipe(2, "translate");
    \u0275\u0275pipe(3, "translate");
    \u0275\u0275pipe(4, "translate");
    \u0275\u0275text(5, "\n");
  }
  if (rf & 2) {
    \u0275\u0275advance();
    \u0275\u0275property("title", \u0275\u0275pipeBind1(2, 2, "SETTINGS.TITLE"))("subtitle", \u0275\u0275pipeBind1(3, 4, "SETTINGS.SUBTITLE") + ". " + \u0275\u0275pipeBind1(4, 6, "SETTINGS.DESCRIPTION"));
  }
}
function SettingsComponent_Conditional_1_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275text(0, "\n    ");
    \u0275\u0275elementStart(1, "h2", 21);
    \u0275\u0275text(2);
    \u0275\u0275pipe(3, "translate");
    \u0275\u0275elementEnd();
    \u0275\u0275text(4, "\n");
  }
  if (rf & 2) {
    \u0275\u0275advance(2);
    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(3, 1, "SETTINGS.TITLE"));
  }
}
function SettingsComponent_ng_container_6_div_13_Template(rf, ctx) {
  if (rf & 1) {
    const _r2 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "div", 25);
    \u0275\u0275text(1, "\n                        ");
    \u0275\u0275elementStart(2, "mat-form-field", 26);
    \u0275\u0275text(3, "\n                            ");
    \u0275\u0275elementStart(4, "mat-label");
    \u0275\u0275text(5);
    \u0275\u0275pipe(6, "translate");
    \u0275\u0275elementEnd();
    \u0275\u0275text(7, "\n                            ");
    \u0275\u0275element(8, "input", 27, 0);
    \u0275\u0275text(10, "\n                            ");
    \u0275\u0275elementStart(11, "mat-error");
    \u0275\u0275text(12);
    \u0275\u0275pipe(13, "translate");
    \u0275\u0275elementEnd();
    \u0275\u0275text(14, "\n                        ");
    \u0275\u0275elementEnd();
    \u0275\u0275text(15, "\n                        ");
    \u0275\u0275elementStart(16, "button", 28);
    \u0275\u0275pipe(17, "translate");
    \u0275\u0275listener("click", function SettingsComponent_ng_container_6_div_13_Template_button_click_16_listener() {
      const i_r3 = \u0275\u0275restoreView(_r2).index;
      const ctx_r3 = \u0275\u0275nextContext(2);
      return \u0275\u0275resetView(ctx_r3.refreshEpg(ctx_r3.epgUrl.value[i_r3]));
    });
    \u0275\u0275text(18, "\n                            ");
    \u0275\u0275elementStart(19, "mat-icon");
    \u0275\u0275text(20, "refresh");
    \u0275\u0275elementEnd();
    \u0275\u0275text(21, "\n                        ");
    \u0275\u0275elementEnd();
    \u0275\u0275text(22, "\n                        ");
    \u0275\u0275elementStart(23, "button", 29);
    \u0275\u0275pipe(24, "translate");
    \u0275\u0275listener("click", function SettingsComponent_ng_container_6_div_13_Template_button_click_23_listener() {
      const i_r3 = \u0275\u0275restoreView(_r2).index;
      const ctx_r3 = \u0275\u0275nextContext(2);
      return \u0275\u0275resetView(ctx_r3.removeEpgSource(i_r3));
    });
    \u0275\u0275text(25, "\n                            ");
    \u0275\u0275elementStart(26, "mat-icon");
    \u0275\u0275text(27, "remove");
    \u0275\u0275elementEnd();
    \u0275\u0275text(28, "\n                        ");
    \u0275\u0275elementEnd();
    \u0275\u0275text(29, "\n                    ");
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const i_r3 = ctx.index;
    const epgField_r5 = \u0275\u0275reference(9);
    \u0275\u0275advance(5);
    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(6, 6, "SETTINGS.EPG_URL_PLACEHOLDER"));
    \u0275\u0275advance(3);
    \u0275\u0275property("formControlName", i_r3);
    \u0275\u0275advance(4);
    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(13, 8, "SETTINGS.EPG_URL_ERROR"));
    \u0275\u0275advance(4);
    \u0275\u0275property("matTooltip", \u0275\u0275pipeBind1(17, 10, "SETTINGS.REFRESH_EPG"))("disabled", epgField_r5.value === "");
    \u0275\u0275advance(7);
    \u0275\u0275property("matTooltip", \u0275\u0275pipeBind1(24, 12, "SETTINGS.REFRESH_EPG"));
  }
}
function SettingsComponent_ng_container_6_Template(rf, ctx) {
  if (rf & 1) {
    const _r1 = \u0275\u0275getCurrentView();
    \u0275\u0275elementContainerStart(0, 22);
    \u0275\u0275text(1, "\n            ");
    \u0275\u0275elementStart(2, "div", 4);
    \u0275\u0275text(3, "\n                ");
    \u0275\u0275elementStart(4, "div", 5);
    \u0275\u0275text(5);
    \u0275\u0275pipe(6, "translate");
    \u0275\u0275elementStart(7, "p");
    \u0275\u0275text(8, "Add single or multiple URLs as EPG sources");
    \u0275\u0275elementEnd();
    \u0275\u0275text(9, "\n                ");
    \u0275\u0275elementEnd();
    \u0275\u0275text(10, "\n                ");
    \u0275\u0275elementStart(11, "div", 5);
    \u0275\u0275text(12, "\n                    ");
    \u0275\u0275template(13, SettingsComponent_ng_container_6_div_13_Template, 30, 14, "div", 23);
    \u0275\u0275text(14, "\n                    ");
    \u0275\u0275elementStart(15, "button", 24);
    \u0275\u0275listener("click", function SettingsComponent_ng_container_6_Template_button_click_15_listener() {
      \u0275\u0275restoreView(_r1);
      const ctx_r3 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(ctx_r3.addEpgSource());
    });
    \u0275\u0275text(16);
    \u0275\u0275pipe(17, "translate");
    \u0275\u0275elementEnd();
    \u0275\u0275text(18, "\n                ");
    \u0275\u0275elementEnd();
    \u0275\u0275text(19, "\n            ");
    \u0275\u0275elementEnd();
    \u0275\u0275text(20, "\n        ");
    \u0275\u0275element(21, "mat-divider");
    \u0275\u0275text(22, "\n        ");
    \u0275\u0275elementContainerEnd();
  }
  if (rf & 2) {
    const ctx_r3 = \u0275\u0275nextContext();
    \u0275\u0275advance(5);
    \u0275\u0275textInterpolate1("\n                    ", \u0275\u0275pipeBind1(6, 3, "SETTINGS.EPG_URL_LABEL"), "\n                    ");
    \u0275\u0275advance(8);
    \u0275\u0275property("ngForOf", ctx_r3.epgUrl.controls);
    \u0275\u0275advance(3);
    \u0275\u0275textInterpolate1("\n                        ", \u0275\u0275pipeBind1(17, 5, "SETTINGS.ADD_EPG_SOURCE"), "\n                    ");
  }
}
function SettingsComponent_mat_option_28_Template(rf, ctx) {
  if (rf & 1) {
    const _r6 = \u0275\u0275getCurrentView();
    \u0275\u0275elementStart(0, "mat-option", 30);
    \u0275\u0275listener("click", function SettingsComponent_mat_option_28_Template_mat_option_click_0_listener() {
      const player_r7 = \u0275\u0275restoreView(_r6).$implicit;
      const ctx_r3 = \u0275\u0275nextContext();
      return \u0275\u0275resetView(player_r7.id === "shaka" && !ctx_r3.hasSubscription() ? ctx_r3.onShakaPlayerSelect() : null);
    });
    \u0275\u0275text(1);
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const player_r7 = ctx.$implicit;
    \u0275\u0275property("value", player_r7.id);
    \u0275\u0275attribute("data-test-id", player_r7.id);
    \u0275\u0275advance();
    \u0275\u0275textInterpolate1("", player_r7.label, "\n                        ");
  }
}
function SettingsComponent_Conditional_34_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275text(0, "\n            ");
    \u0275\u0275elementStart(1, "div", 4);
    \u0275\u0275text(2, "\n                ");
    \u0275\u0275elementStart(3, "div", 5);
    \u0275\u0275text(4);
    \u0275\u0275pipe(5, "translate");
    \u0275\u0275elementStart(6, "p");
    \u0275\u0275text(7);
    \u0275\u0275pipe(8, "translate");
    \u0275\u0275elementEnd();
    \u0275\u0275text(9, "\n                ");
    \u0275\u0275elementEnd();
    \u0275\u0275text(10, "\n                ");
    \u0275\u0275elementStart(11, "div", 5);
    \u0275\u0275text(12, "\n                    ");
    \u0275\u0275elementStart(13, "mat-form-field", 6);
    \u0275\u0275text(14, "\n                        ");
    \u0275\u0275elementStart(15, "mat-label", 31);
    \u0275\u0275text(16);
    \u0275\u0275pipe(17, "translate");
    \u0275\u0275elementEnd();
    \u0275\u0275text(18, "\n                        ");
    \u0275\u0275element(19, "input", 32);
    \u0275\u0275text(20, "\n                    ");
    \u0275\u0275elementEnd();
    \u0275\u0275text(21, "\n                ");
    \u0275\u0275elementEnd();
    \u0275\u0275text(22, "\n            ");
    \u0275\u0275elementEnd();
    \u0275\u0275text(23, "\n        ");
  }
  if (rf & 2) {
    \u0275\u0275advance(4);
    \u0275\u0275textInterpolate1("\n                    ", \u0275\u0275pipeBind1(5, 3, "SETTINGS.MPV_PLAYER_PATH_LABEL"), "\n                    ");
    \u0275\u0275advance(3);
    \u0275\u0275textInterpolate1("\n                        ", \u0275\u0275pipeBind1(8, 5, "SETTINGS.MPV_PLAYER_PATH_DESCRIPTION"), "\n                    ");
    \u0275\u0275advance(9);
    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(17, 7, "SETTINGS.MPV_PLAYER_PATH"));
  }
}
function SettingsComponent_Conditional_35_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275text(0, "\n            ");
    \u0275\u0275elementStart(1, "div", 4);
    \u0275\u0275text(2, "\n                ");
    \u0275\u0275elementStart(3, "div", 5);
    \u0275\u0275text(4);
    \u0275\u0275pipe(5, "translate");
    \u0275\u0275elementStart(6, "p");
    \u0275\u0275text(7);
    \u0275\u0275pipe(8, "translate");
    \u0275\u0275elementEnd();
    \u0275\u0275text(9, "\n                ");
    \u0275\u0275elementEnd();
    \u0275\u0275text(10, "\n                ");
    \u0275\u0275elementStart(11, "div", 5);
    \u0275\u0275text(12, "\n                    ");
    \u0275\u0275elementStart(13, "mat-form-field", 6);
    \u0275\u0275text(14, "\n                        ");
    \u0275\u0275elementStart(15, "mat-label", 33);
    \u0275\u0275text(16);
    \u0275\u0275pipe(17, "translate");
    \u0275\u0275elementEnd();
    \u0275\u0275text(18, "\n                        ");
    \u0275\u0275element(19, "input", 34);
    \u0275\u0275text(20, "\n                    ");
    \u0275\u0275elementEnd();
    \u0275\u0275text(21, "\n                ");
    \u0275\u0275elementEnd();
    \u0275\u0275text(22, "\n            ");
    \u0275\u0275elementEnd();
    \u0275\u0275text(23, "\n        ");
  }
  if (rf & 2) {
    \u0275\u0275advance(4);
    \u0275\u0275textInterpolate1("\n                    ", \u0275\u0275pipeBind1(5, 3, "SETTINGS.VLC_PLAYER_PATH_LABEL"), "\n                    ");
    \u0275\u0275advance(3);
    \u0275\u0275textInterpolate1("\n                        ", \u0275\u0275pipeBind1(8, 5, "SETTINGS.VLC_PLAYER_PATH_DESCRIPTION"), "\n                    ");
    \u0275\u0275advance(9);
    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(17, 7, "SETTINGS.VLC_PLAYER_PATH"));
  }
}
function SettingsComponent_mat_option_58_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "mat-option", 35);
    \u0275\u0275text(1);
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const streamFormat_r8 = ctx.$implicit;
    \u0275\u0275property("value", streamFormat_r8.value);
    \u0275\u0275attribute("data-test-id", streamFormat_r8.value);
    \u0275\u0275advance();
    \u0275\u0275textInterpolate1("", streamFormat_r8.value, "\n                        ");
  }
}
function SettingsComponent_mat_option_87_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "mat-option", 35);
    \u0275\u0275text(1);
    \u0275\u0275pipe(2, "translate");
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const language_r9 = ctx.$implicit;
    \u0275\u0275property("value", language_r9.value);
    \u0275\u0275attribute("data-test-id", language_r9.value);
    \u0275\u0275advance();
    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(2, 3, "LANGUAGES." + language_r9.key));
  }
}
function SettingsComponent_mat_option_116_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275elementStart(0, "mat-option", 35);
    \u0275\u0275text(1);
    \u0275\u0275pipe(2, "translate");
    \u0275\u0275elementEnd();
  }
  if (rf & 2) {
    const theme_r10 = ctx.$implicit;
    \u0275\u0275property("value", theme_r10.value);
    \u0275\u0275attribute("data-test-id", theme_r10.value);
    \u0275\u0275advance();
    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(2, 3, "THEMES." + theme_r10.value));
  }
}
function SettingsComponent_Conditional_142_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275text(0, "\n            ");
    \u0275\u0275element(1, "mat-divider");
    \u0275\u0275text(2, "\n            ");
    \u0275\u0275elementStart(3, "div", 4);
    \u0275\u0275text(4, "\n                ");
    \u0275\u0275elementStart(5, "div", 5);
    \u0275\u0275text(6);
    \u0275\u0275pipe(7, "translate");
    \u0275\u0275elementStart(8, "p");
    \u0275\u0275text(9);
    \u0275\u0275pipe(10, "translate");
    \u0275\u0275elementEnd();
    \u0275\u0275text(11, "\n                ");
    \u0275\u0275elementEnd();
    \u0275\u0275text(12, "\n                ");
    \u0275\u0275elementStart(13, "div", 13);
    \u0275\u0275text(14, "\n                    ");
    \u0275\u0275elementStart(15, "mat-form-field", 26);
    \u0275\u0275text(16, "\n                        ");
    \u0275\u0275element(17, "input", 36);
    \u0275\u0275text(18, "\n                    ");
    \u0275\u0275elementEnd();
    \u0275\u0275text(19, "\n                ");
    \u0275\u0275elementEnd();
    \u0275\u0275text(20, "\n            ");
    \u0275\u0275elementEnd();
    \u0275\u0275text(21, "\n        ");
  }
  if (rf & 2) {
    \u0275\u0275advance(6);
    \u0275\u0275textInterpolate1("\n                    ", \u0275\u0275pipeBind1(7, 2, "SETTINGS.REMOTE_CONTROL_PORT"), "\n                    ");
    \u0275\u0275advance(3);
    \u0275\u0275textInterpolate1("\n                        ", \u0275\u0275pipeBind1(10, 4, "SETTINGS.REMOTE_CONTROL_PORT_DESCRIPTION"), "\n                    ");
  }
}
function SettingsComponent_Conditional_204_Template(rf, ctx) {
  if (rf & 1) {
    \u0275\u0275text(0, "\n            ");
    \u0275\u0275elementStart(1, "div", 4);
    \u0275\u0275text(2);
    \u0275\u0275pipe(3, "translate");
    \u0275\u0275elementStart(4, "a", 37);
    \u0275\u0275text(5);
    \u0275\u0275pipe(6, "translate");
    \u0275\u0275elementEnd();
    \u0275\u0275text(7, "\n            ");
    \u0275\u0275elementEnd();
    \u0275\u0275text(8, "\n        ");
  }
  if (rf & 2) {
    \u0275\u0275advance(2);
    \u0275\u0275textInterpolate1("\n                ", \u0275\u0275pipeBind1(3, 2, "SETTINGS.EPG_NOTE"), "\n                \xA0");
    \u0275\u0275advance(3);
    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(6, 4, "SETTINGS.EPG_NOTE_URL_TEXT"));
  }
}
var SettingsComponent = class _SettingsComponent {
  /**
   * Checks if the Shaka player is available based on subscription status
   * @returns true if user has active subscription or subscription check is disabled
   */
  hasSubscription() {
    if (!this.remoteConfigService.getConfig().showUserAvatar) {
      return true;
    }
    return this.userService.hasActiveSubscription();
  }
  /**
   * Handles the selection of Shaka player with subscription check
   */
  onShakaPlayerSelect() {
    if (!this.hasSubscription()) {
      this.dialogService.openConfirmDialog({
        title: this.translate.instant("SUBSCRIPTION_REQUIRED"),
        message: this.translate.instant("SUBSCRIPTION_MESSAGE"),
        onConfirm: () => {
          window.open(this.userService.getPricingUrl(this.remoteConfigService.getConfig().baseUrl));
        }
      });
      this.settingsForm.get("player").setValue(VideoPlayer.VideoJs);
      return false;
    }
  }
  /**
   * Creates an instance of SettingsComponent and injects
   * required dependencies into the component
   */
  constructor(dialogService, dataService, epgService, formBuilder, playlistsService, router, settingsService, snackBar, store, translate, matDialog, remoteConfigService, userService, data) {
    this.dialogService = dialogService;
    this.dataService = dataService;
    this.epgService = epgService;
    this.formBuilder = formBuilder;
    this.playlistsService = playlistsService;
    this.router = router;
    this.settingsService = settingsService;
    this.snackBar = snackBar;
    this.store = store;
    this.translate = translate;
    this.matDialog = matDialog;
    this.remoteConfigService = remoteConfigService;
    this.userService = userService;
    this.isDialog = false;
    this.languageEnum = Language;
    this.streamFormatEnum = StreamFormat;
    this.isTauri = this.dataService.getAppEnvironment() === "tauri";
    this.isPwa = this.dataService.getAppEnvironment() === "pwa";
    this.osPlayers = [
      {
        id: VideoPlayer.MPV,
        label: "MPV Player"
      },
      {
        id: VideoPlayer.VLC,
        label: "VLC"
      }
    ];
    this.players = [
      {
        id: VideoPlayer.Html5Player,
        label: "HTML5 Video Player"
      },
      {
        id: VideoPlayer.VideoJs,
        label: "VideoJs Player"
      },
      {
        id: VideoPlayer.ShakaPlayer,
        label: "Shaka Player (Pro)"
      },
      /* {
          id: VideoPlayer.DPlayer,
          label: 'DPlayer',
      },
      {
          id: VideoPlayer.ArtPlayer,
          label: 'ArtPlayer',
      }, */
      ...this.isTauri ? this.osPlayers : []
    ];
    this.epgAvailable$ = this.store.select(selectIsEpgAvailable);
    this.themeEnum = Theme;
    this.settingsForm = this.formBuilder.group(__spreadProps(__spreadValues({
      player: [VideoPlayer.VideoJs]
    }, this.isTauri ? { epgUrl: new FormArray([]) } : {}), {
      streamFormat: StreamFormat.M3u8StreamFormat,
      language: Language.ENGLISH,
      showCaptions: false,
      theme: Theme.LightTheme,
      mpvPlayerPath: "",
      vlcPlayerPath: "",
      remoteControl: false,
      remoteControlPort: 3e3
    }));
    this.epgUrl = this.settingsForm.get("epgUrl");
    this.settingsStore = inject(SettingsStore);
    this.isDialog = data?.isDialog ?? false;
  }
  /**
   * Reads the config object from the browsers
   * storage (indexed db)
   */
  ngOnInit() {
    this.setSettings();
    this.checkAppVersion();
  }
  /**
   * Sets saved settings from the indexed db store
   */
  setSettings() {
    const currentSettings = this.settingsStore.getSettings();
    this.settingsForm.patchValue(currentSettings);
    if (this.isTauri && currentSettings.epgUrl) {
      this.setEpgUrls(currentSettings.epgUrl);
    }
  }
  /**
   * Sets the epg urls to the form array
   * @param epgUrls urls of the EPG sources
   */
  setEpgUrls(epgUrls) {
    const URL_REGEX = /^(http|https|file):\/\/[^ "]+$/;
    const urls = Array.isArray(epgUrls) ? epgUrls : [epgUrls];
    const filteredUrls = urls.map((url) => url.trim()).filter((url) => url !== "");
    filteredUrls.forEach((url) => {
      this.epgUrl.push(new FormControl(url, [Validators.pattern(URL_REGEX)]));
    });
  }
  /**
   * Checks whether the latest version of the application
   * is used and updates the version message in the
   * settings UI
   */
  checkAppVersion() {
    this.settingsService.getAppVersion().pipe(take(1)).subscribe((version) => this.showVersionInformation(version));
  }
  /**
   * Updates the message in settings UI about the used
   * version of the app
   * @param currentVersion current version of the application
   */
  showVersionInformation(currentVersion) {
    const isOutdated = this.isCurrentVersionOutdated(currentVersion);
    if (isOutdated) {
      this.updateMessage = `${this.translate.instant("SETTINGS.NEW_VERSION_AVAILABLE")}: ${currentVersion}`;
    } else {
      this.updateMessage = this.translate.instant("SETTINGS.LATEST_VERSION");
    }
  }
  /**
   * Compares actual with latest version of the
   * application
   * @param latestVersion latest version
   * @returns returns true if an update is available
   */
  isCurrentVersionOutdated(latestVersion) {
    this.version = this.dataService.getAppVersion();
    return semver.lt(this.version, latestVersion);
  }
  /**
   * Triggers on form submit and saves the config object to
   * the indexed db store
   */
  onSubmit() {
    this.settingsStore.updateSettings(this.settingsForm.value).then(() => {
      this.applyChangedSettings();
      this.dataService.sendIpcEvent(SETTINGS_UPDATE, this.settingsForm.value);
      this.dataService.sendIpcEvent(SET_MPV_PLAYER_PATH, this.settingsForm.value.mpvPlayerPath);
      this.dataService.sendIpcEvent(SET_VLC_PLAYER_PATH, this.settingsForm.value.mpvPlayerPath);
    });
    if (this.isDialog) {
      this.matDialog.closeAll();
    }
  }
  /**
   * Applies the changed settings to the app
   */
  applyChangedSettings() {
    this.settingsForm.markAsPristine();
    if (this.isTauri) {
      let epgUrls = this.settingsForm.value.epgUrl;
      if (epgUrls) {
        if (!Array.isArray(epgUrls)) {
          epgUrls = [epgUrls];
        }
        epgUrls = epgUrls.filter((url) => url !== "");
        if (epgUrls.length > 0) {
          this.epgService.fetchEpg(epgUrls);
        }
      }
    }
    this.translate.use(this.settingsForm.value.language);
    this.settingsService.changeTheme(this.settingsForm.value.theme);
    this.snackBar.open(this.translate.instant("SETTINGS.SETTINGS_SAVED"), null, {
      duration: 2e3,
      horizontalPosition: "start"
    });
  }
  /**
   * Navigates back to the applications homepage
   */
  backToHome() {
    if (this.isDialog) {
      this.matDialog.closeAll();
    } else {
      this.router.navigateByUrl("/");
    }
  }
  /**
   * Fetches and updates EPG from the given URL
   * @param url epg source url
   */
  refreshEpg(url) {
    this.epgService.fetchEpg([url]);
  }
  /**
   * Initializes new entry in form array for EPG URL
   */
  addEpgSource() {
    this.epgUrl.insert(this.epgUrl.length, new FormControl("", {
      validators: [
        Validators.pattern(/^(http|https|file):\/\/[^ "]+$/)
      ]
    }));
  }
  /**
   * Removes entry from form array for EPG URL
   * @param index index of the item to remove
   */
  removeEpgSource(index) {
    this.epgUrl.removeAt(index);
    this.settingsForm.markAsDirty();
  }
  exportData() {
    console.log("Data export functionality has been disabled.");
    return;
  }
  importData() {
    if (!this.hasSubscription()) {
      this.dialogService.openConfirmDialog({
        title: this.translate.instant("SUBSCRIPTION_REQUIRED"),
        message: this.translate.instant("SUBSCRIPTION_MESSAGE"),
        onConfirm: () => {
          window.open(this.userService.getPricingUrl(this.remoteConfigService.getConfig().baseUrl));
        }
      });
      return;
    }
    const input = document.createElement("input");
    input.type = "file";
    input.accept = "application/json";
    input.addEventListener("change", (event) => {
      const target = event.target;
      const file = target.files?.[0];
      if (file) {
        const reader = new FileReader();
        reader.onload = () => {
          const contents = reader.result;
          try {
            const parsedPlaylists = JSON.parse(contents.toString());
            if (!Array.isArray(parsedPlaylists)) {
              this.snackBar.open(this.translate.instant("SETTINGS.IMPORT_ERROR"), null, {
                duration: 2e3
              });
            } else {
              this.store.dispatch(addManyPlaylists({
                playlists: parsedPlaylists
              }));
            }
          } catch (error) {
            this.snackBar.open(this.translate.instant("SETTINGS.IMPORT_ERROR"), null, {
              duration: 2e3
            });
            console.error(error);
          }
        };
        reader.readAsText(file);
      }
    });
    input.click();
  }
  removeAll() {
    this.dialogService.openConfirmDialog({
      title: this.translate.instant("SETTINGS.REMOVE_DIALOG.TITLE"),
      message: this.translate.instant("SETTINGS.REMOVE_DIALOG.MESSAGE"),
      onConfirm: () => this.store.dispatch(removeAllPlaylists())
    });
  }
  static {
    this.\u0275fac = function SettingsComponent_Factory(__ngFactoryType__) {
      return new (__ngFactoryType__ || _SettingsComponent)(\u0275\u0275directiveInject(DialogService), \u0275\u0275directiveInject(DataService), \u0275\u0275directiveInject(EpgService), \u0275\u0275directiveInject(FormBuilder), \u0275\u0275directiveInject(PlaylistsService), \u0275\u0275directiveInject(Router), \u0275\u0275directiveInject(SettingsService), \u0275\u0275directiveInject(MatSnackBar), \u0275\u0275directiveInject(Store), \u0275\u0275directiveInject(TranslateService), \u0275\u0275directiveInject(MatDialog), \u0275\u0275directiveInject(RemoteConfigService), \u0275\u0275directiveInject(UserService), \u0275\u0275directiveInject(MAT_DIALOG_DATA, 8));
    };
  }
  static {
    this.\u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _SettingsComponent, selectors: [["ng-component"]], inputs: { isDialog: "isDialog" }, decls: 226, vars: 94, consts: [["epgField", ""], ["data-test-id", "settings-container", 1, "settings-container"], ["novalidate", "", 3, "ngSubmit", "formGroup"], ["formArrayName", "epgUrl", 4, "ngIf"], [1, "row"], [1, "column"], ["appearance", "outline"], ["formControlName", "player", "data-test-id", "select-video-player"], [3, "value", "click", 4, "ngFor", "ngForOf"], ["formControlName", "streamFormat", "data-test-id", "select-stream-format"], [3, "value", 4, "ngFor", "ngForOf"], ["formControlName", "language", "data-test-id", "select-language"], ["formControlName", "theme", "data-test-id", "select-theme"], [1, "column", 2, "margin-right", "10px"], ["formControlName", "showCaptions", 1, "column"], ["mat-button", "", 3, "click"], ["mat-button", "", "color", "warn", 3, "click"], ["align", "end", 1, "action-buttons"], ["mat-button", "", "color", "accent", "type", "reset", "data-test-id", "back-to-home", 3, "click"], ["mat-button", "", "color", "accent", "type", "submit", "data-test-id", "save-settings", 3, "disabled"], [3, "title", "subtitle"], ["mat-dialog-title", ""], ["formArrayName", "epgUrl"], ["style", "display: flex", 4, "ngFor", "ngForOf"], ["mat-button", "", "color", "accent", "type", "button", 3, "click"], [2, "display", "flex"], ["appearance", "outline", 1, "full-width"], ["matInput", "", "type", "url", 3, "formControlName"], ["matLine", "", "mat-icon-button", "", "color", "accent", "type", "button", 3, "click", "matTooltip", "disabled"], ["mat-icon-button", "", "matLine", "", "color", "accent", "type", "button", 3, "click", "matTooltip"], [3, "click", "value"], ["for", "mpvPlayerPath"], ["matInput", "", "type", "text", "id", "mpvPlayerPath", "formControlName", "mpvPlayerPath"], ["for", "vlcPlayerPath"], ["matInput", "", "type", "text", "id", "vlcPlayerPath", "formControlName", "vlcPlayerPath"], [3, "value"], ["matInput", "", "type", "text", "id", "remoteControlPort", "formControlName", "remoteControlPort"], ["href", "https://github.com/4gray/dailyflim/releases"]], template: function SettingsComponent_Template(rf, ctx) {
      if (rf & 1) {
        \u0275\u0275template(0, SettingsComponent_Conditional_0_Template, 6, 8)(1, SettingsComponent_Conditional_1_Template, 5, 3);
        \u0275\u0275elementStart(2, "div", 1);
        \u0275\u0275text(3, "\n    ");
        \u0275\u0275elementStart(4, "form", 2);
        \u0275\u0275listener("ngSubmit", function SettingsComponent_Template_form_ngSubmit_4_listener() {
          return ctx.onSubmit();
        });
        \u0275\u0275text(5, "\n        ");
        \u0275\u0275template(6, SettingsComponent_ng_container_6_Template, 23, 7, "ng-container", 3);
        \u0275\u0275text(7, "\n        ");
        \u0275\u0275elementStart(8, "div", 4);
        \u0275\u0275text(9, "\n            ");
        \u0275\u0275elementStart(10, "div", 5);
        \u0275\u0275text(11);
        \u0275\u0275pipe(12, "translate");
        \u0275\u0275elementStart(13, "p");
        \u0275\u0275text(14);
        \u0275\u0275pipe(15, "translate");
        \u0275\u0275elementEnd();
        \u0275\u0275text(16, "\n            ");
        \u0275\u0275elementEnd();
        \u0275\u0275text(17, "\n            ");
        \u0275\u0275elementStart(18, "div", 5);
        \u0275\u0275text(19, "\n                ");
        \u0275\u0275elementStart(20, "mat-form-field", 6);
        \u0275\u0275text(21, "\n                    ");
        \u0275\u0275elementStart(22, "mat-label");
        \u0275\u0275text(23);
        \u0275\u0275pipe(24, "translate");
        \u0275\u0275elementEnd();
        \u0275\u0275text(25, "\n                    ");
        \u0275\u0275elementStart(26, "mat-select", 7);
        \u0275\u0275text(27, "\n                        ");
        \u0275\u0275template(28, SettingsComponent_mat_option_28_Template, 2, 3, "mat-option", 8);
        \u0275\u0275text(29, "\n                    ");
        \u0275\u0275elementEnd();
        \u0275\u0275text(30, "\n                ");
        \u0275\u0275elementEnd();
        \u0275\u0275text(31, "\n            ");
        \u0275\u0275elementEnd();
        \u0275\u0275text(32, "\n        ");
        \u0275\u0275elementEnd();
        \u0275\u0275text(33, "\n        ");
        \u0275\u0275template(34, SettingsComponent_Conditional_34_Template, 24, 9)(35, SettingsComponent_Conditional_35_Template, 24, 9);
        \u0275\u0275element(36, "mat-divider");
        \u0275\u0275text(37, "\n        ");
        \u0275\u0275elementStart(38, "div", 4);
        \u0275\u0275text(39, "\n            ");
        \u0275\u0275elementStart(40, "div", 5);
        \u0275\u0275text(41);
        \u0275\u0275pipe(42, "translate");
        \u0275\u0275elementStart(43, "p");
        \u0275\u0275text(44);
        \u0275\u0275pipe(45, "translate");
        \u0275\u0275elementEnd();
        \u0275\u0275text(46, "\n            ");
        \u0275\u0275elementEnd();
        \u0275\u0275text(47, "\n            ");
        \u0275\u0275elementStart(48, "div", 5);
        \u0275\u0275text(49, "\n                ");
        \u0275\u0275elementStart(50, "mat-form-field", 6);
        \u0275\u0275text(51, "\n                    ");
        \u0275\u0275elementStart(52, "mat-label");
        \u0275\u0275text(53);
        \u0275\u0275pipe(54, "translate");
        \u0275\u0275elementEnd();
        \u0275\u0275text(55, "\n                    ");
        \u0275\u0275elementStart(56, "mat-select", 9);
        \u0275\u0275text(57, "\n                        ");
        \u0275\u0275template(58, SettingsComponent_mat_option_58_Template, 2, 3, "mat-option", 10);
        \u0275\u0275pipe(59, "keyvalue");
        \u0275\u0275text(60, "\n                    ");
        \u0275\u0275elementEnd();
        \u0275\u0275text(61, "\n                ");
        \u0275\u0275elementEnd();
        \u0275\u0275text(62, "\n            ");
        \u0275\u0275elementEnd();
        \u0275\u0275text(63, "\n        ");
        \u0275\u0275elementEnd();
        \u0275\u0275text(64, "\n        ");
        \u0275\u0275element(65, "mat-divider");
        \u0275\u0275text(66, "\n        ");
        \u0275\u0275elementStart(67, "div", 4);
        \u0275\u0275text(68, "\n            ");
        \u0275\u0275elementStart(69, "div", 5);
        \u0275\u0275text(70);
        \u0275\u0275pipe(71, "translate");
        \u0275\u0275elementStart(72, "p");
        \u0275\u0275text(73);
        \u0275\u0275pipe(74, "translate");
        \u0275\u0275elementEnd();
        \u0275\u0275text(75, "\n            ");
        \u0275\u0275elementEnd();
        \u0275\u0275text(76, "\n            ");
        \u0275\u0275elementStart(77, "div", 5);
        \u0275\u0275text(78, "\n                ");
        \u0275\u0275elementStart(79, "mat-form-field", 6);
        \u0275\u0275text(80, "\n                    ");
        \u0275\u0275elementStart(81, "mat-label");
        \u0275\u0275text(82);
        \u0275\u0275pipe(83, "translate");
        \u0275\u0275elementEnd();
        \u0275\u0275text(84, "\n                    ");
        \u0275\u0275elementStart(85, "mat-select", 11);
        \u0275\u0275text(86, "\n                        ");
        \u0275\u0275template(87, SettingsComponent_mat_option_87_Template, 3, 5, "mat-option", 10);
        \u0275\u0275pipe(88, "keyvalue");
        \u0275\u0275text(89, "\n                    ");
        \u0275\u0275elementEnd();
        \u0275\u0275text(90, "\n                ");
        \u0275\u0275elementEnd();
        \u0275\u0275text(91, "\n            ");
        \u0275\u0275elementEnd();
        \u0275\u0275text(92, "\n        ");
        \u0275\u0275elementEnd();
        \u0275\u0275text(93, "\n        ");
        \u0275\u0275element(94, "mat-divider");
        \u0275\u0275text(95, "\n        ");
        \u0275\u0275elementStart(96, "div", 4);
        \u0275\u0275text(97, "\n            ");
        \u0275\u0275elementStart(98, "div", 5);
        \u0275\u0275text(99);
        \u0275\u0275pipe(100, "translate");
        \u0275\u0275elementStart(101, "p");
        \u0275\u0275text(102);
        \u0275\u0275pipe(103, "translate");
        \u0275\u0275elementEnd();
        \u0275\u0275text(104, "\n            ");
        \u0275\u0275elementEnd();
        \u0275\u0275text(105, "\n            ");
        \u0275\u0275elementStart(106, "div", 5);
        \u0275\u0275text(107, "\n                ");
        \u0275\u0275elementStart(108, "mat-form-field", 6);
        \u0275\u0275text(109, "\n                    ");
        \u0275\u0275elementStart(110, "mat-label");
        \u0275\u0275text(111);
        \u0275\u0275pipe(112, "translate");
        \u0275\u0275elementEnd();
        \u0275\u0275text(113, "\n                    ");
        \u0275\u0275elementStart(114, "mat-select", 12);
        \u0275\u0275text(115, "\n                        ");
        \u0275\u0275template(116, SettingsComponent_mat_option_116_Template, 3, 5, "mat-option", 10);
        \u0275\u0275pipe(117, "keyvalue");
        \u0275\u0275text(118, "\n                    ");
        \u0275\u0275elementEnd();
        \u0275\u0275text(119, "\n                ");
        \u0275\u0275elementEnd();
        \u0275\u0275text(120, "\n            ");
        \u0275\u0275elementEnd();
        \u0275\u0275text(121, "\n        ");
        \u0275\u0275elementEnd();
        \u0275\u0275text(122, "\n        ");
        \u0275\u0275element(123, "mat-divider");
        \u0275\u0275text(124, "\n        ");
        \u0275\u0275elementStart(125, "div", 4);
        \u0275\u0275text(126, "\n            ");
        \u0275\u0275elementStart(127, "div", 5);
        \u0275\u0275text(128);
        \u0275\u0275pipe(129, "translate");
        \u0275\u0275elementStart(130, "p");
        \u0275\u0275text(131);
        \u0275\u0275pipe(132, "translate");
        \u0275\u0275elementEnd();
        \u0275\u0275text(133, "\n            ");
        \u0275\u0275elementEnd();
        \u0275\u0275text(134, "\n            ");
        \u0275\u0275elementStart(135, "div", 13);
        \u0275\u0275text(136, "\n                ");
        \u0275\u0275element(137, "mat-checkbox", 14);
        \u0275\u0275text(138, "\n            ");
        \u0275\u0275elementEnd();
        \u0275\u0275text(139, "\n        ");
        \u0275\u0275elementEnd();
        \u0275\u0275text(140, "\n        ");
        \u0275\u0275text(141, "\n        ");
        \u0275\u0275template(142, SettingsComponent_Conditional_142_Template, 22, 6);
        \u0275\u0275element(143, "mat-divider");
        \u0275\u0275text(144, "\n        ");
        \u0275\u0275elementStart(145, "div", 4);
        \u0275\u0275text(146, "\n            ");
        \u0275\u0275elementStart(147, "div", 5);
        \u0275\u0275text(148);
        \u0275\u0275pipe(149, "translate");
        \u0275\u0275elementStart(150, "p");
        \u0275\u0275text(151);
        \u0275\u0275pipe(152, "translate");
        \u0275\u0275elementEnd();
        \u0275\u0275text(153, "\n            ");
        \u0275\u0275elementEnd();
        \u0275\u0275text(154, "\n            ");
        \u0275\u0275elementStart(155, "div", 5);
        \u0275\u0275text(156);
        \u0275\u0275element(157, "br");
        \u0275\u0275text(158, "\n                ");
        \u0275\u0275text(159, "\n            ");
        \u0275\u0275elementEnd();
        \u0275\u0275text(160, "\n        ");
        \u0275\u0275elementEnd();
        \u0275\u0275text(161, "\n        ");
        \u0275\u0275element(162, "mat-divider");
        \u0275\u0275text(163, "\n        ");
        \u0275\u0275elementStart(164, "div", 4);
        \u0275\u0275text(165, "\n            ");
        \u0275\u0275elementStart(166, "div", 5);
        \u0275\u0275text(167);
        \u0275\u0275pipe(168, "translate");
        \u0275\u0275elementStart(169, "p");
        \u0275\u0275text(170);
        \u0275\u0275pipe(171, "translate");
        \u0275\u0275elementEnd();
        \u0275\u0275text(172, "\n            ");
        \u0275\u0275elementEnd();
        \u0275\u0275text(173, "\n            ");
        \u0275\u0275elementStart(174, "div", 5);
        \u0275\u0275text(175, "\n                ");
        \u0275\u0275elementStart(176, "button", 15);
        \u0275\u0275listener("click", function SettingsComponent_Template_button_click_176_listener($event) {
          $event.preventDefault();
          $event.stopPropagation();
          return ctx.importData();
        });
        \u0275\u0275text(177);
        \u0275\u0275pipe(178, "translate");
        \u0275\u0275elementEnd();
        \u0275\u0275text(179, "\n                ");
        \u0275\u0275elementStart(180, "button", 15);
        \u0275\u0275listener("click", function SettingsComponent_Template_button_click_180_listener($event) {
          $event.preventDefault();
          $event.stopPropagation();
          return ctx.exportData();
        });
        \u0275\u0275text(181);
        \u0275\u0275pipe(182, "translate");
        \u0275\u0275elementEnd();
        \u0275\u0275text(183, "\n            ");
        \u0275\u0275elementEnd();
        \u0275\u0275text(184, "\n        ");
        \u0275\u0275elementEnd();
        \u0275\u0275text(185, "\n\n        ");
        \u0275\u0275elementStart(186, "div", 4);
        \u0275\u0275text(187, "\n            ");
        \u0275\u0275elementStart(188, "div", 5);
        \u0275\u0275text(189);
        \u0275\u0275pipe(190, "translate");
        \u0275\u0275elementStart(191, "p");
        \u0275\u0275text(192);
        \u0275\u0275pipe(193, "translate");
        \u0275\u0275elementEnd();
        \u0275\u0275text(194, "\n            ");
        \u0275\u0275elementEnd();
        \u0275\u0275text(195, "\n            ");
        \u0275\u0275elementStart(196, "div", 5);
        \u0275\u0275text(197, "\n                ");
        \u0275\u0275elementStart(198, "button", 16);
        \u0275\u0275listener("click", function SettingsComponent_Template_button_click_198_listener($event) {
          $event.preventDefault();
          $event.stopPropagation();
          return ctx.removeAll();
        });
        \u0275\u0275text(199);
        \u0275\u0275pipe(200, "translate");
        \u0275\u0275elementEnd();
        \u0275\u0275text(201, "\n            ");
        \u0275\u0275elementEnd();
        \u0275\u0275text(202, "\n        ");
        \u0275\u0275elementEnd();
        \u0275\u0275text(203, "\n\n        ");
        \u0275\u0275template(204, SettingsComponent_Conditional_204_Template, 9, 6);
        \u0275\u0275element(205, "mat-divider");
        \u0275\u0275text(206, "\n        ");
        \u0275\u0275elementStart(207, "div", 17);
        \u0275\u0275text(208, "\n            ");
        \u0275\u0275elementStart(209, "button", 18);
        \u0275\u0275listener("click", function SettingsComponent_Template_button_click_209_listener() {
          return ctx.backToHome();
        });
        \u0275\u0275text(210, "\n                ");
        \u0275\u0275elementStart(211, "mat-icon");
        \u0275\u0275text(212, "chevron_left");
        \u0275\u0275elementEnd();
        \u0275\u0275text(213);
        \u0275\u0275pipe(214, "translate");
        \u0275\u0275elementEnd();
        \u0275\u0275text(215, "\n            ");
        \u0275\u0275elementStart(216, "button", 19);
        \u0275\u0275text(217, "\n                ");
        \u0275\u0275elementStart(218, "mat-icon");
        \u0275\u0275text(219, "save");
        \u0275\u0275elementEnd();
        \u0275\u0275text(220);
        \u0275\u0275pipe(221, "translate");
        \u0275\u0275elementEnd();
        \u0275\u0275text(222, "\n        ");
        \u0275\u0275elementEnd();
        \u0275\u0275text(223, "\n    ");
        \u0275\u0275elementEnd();
        \u0275\u0275text(224, "\n");
        \u0275\u0275elementEnd();
        \u0275\u0275text(225, "\n");
      }
      if (rf & 2) {
        \u0275\u0275conditional(!ctx.isDialog ? 0 : 1);
        \u0275\u0275advance(4);
        \u0275\u0275property("formGroup", ctx.settingsForm);
        \u0275\u0275advance(2);
        \u0275\u0275property("ngIf", ctx.isTauri);
        \u0275\u0275advance(5);
        \u0275\u0275textInterpolate1("\n                ", \u0275\u0275pipeBind1(12, 38, "SETTINGS.VIDEO_PLAYER_LABEL"), "\n                ");
        \u0275\u0275advance(3);
        \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(15, 40, "SETTINGS.VIDEO_PLAYER_DESCRIPTION"));
        \u0275\u0275advance(9);
        \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(24, 42, "SETTINGS.VIDEO_PLAYER_PLACEHOLDER"));
        \u0275\u0275advance(5);
        \u0275\u0275property("ngForOf", ctx.players);
        \u0275\u0275advance(6);
        \u0275\u0275conditional(ctx.settingsForm.value.player === "mpv" ? 34 : -1);
        \u0275\u0275advance();
        \u0275\u0275conditional(ctx.settingsForm.value.player === "vlc" ? 35 : -1);
        \u0275\u0275advance(6);
        \u0275\u0275textInterpolate1("\n                ", \u0275\u0275pipeBind1(42, 44, "SETTINGS.STREAM_FORMAT"), "\n                ");
        \u0275\u0275advance(3);
        \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(45, 46, "SETTINGS.STREAM_FORMAT_DESCRIPTION"));
        \u0275\u0275advance(9);
        \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(54, 48, "SETTINGS.VIDEO_PLAYER_PLACEHOLDER"));
        \u0275\u0275advance(5);
        \u0275\u0275property("ngForOf", \u0275\u0275pipeBind1(59, 50, ctx.streamFormatEnum));
        \u0275\u0275advance(12);
        \u0275\u0275textInterpolate1("\n                ", \u0275\u0275pipeBind1(71, 52, "SETTINGS.LANGUAGE"), "\n                ");
        \u0275\u0275advance(3);
        \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(74, 54, "SETTINGS.LANGUAGE_DESCRIPTION"));
        \u0275\u0275advance(9);
        \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(83, 56, "SETTINGS.VIDEO_PLAYER_PLACEHOLDER"));
        \u0275\u0275advance(5);
        \u0275\u0275property("ngForOf", \u0275\u0275pipeBind1(88, 58, ctx.languageEnum));
        \u0275\u0275advance(12);
        \u0275\u0275textInterpolate1("\n                ", \u0275\u0275pipeBind1(100, 60, "SETTINGS.THEME"), "\n                ");
        \u0275\u0275advance(3);
        \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(103, 62, "SETTINGS.THEME_DESCRIPTION"));
        \u0275\u0275advance(9);
        \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(112, 64, "SETTINGS.VIDEO_PLAYER_PLACEHOLDER"));
        \u0275\u0275advance(5);
        \u0275\u0275property("ngForOf", \u0275\u0275pipeBind1(117, 66, ctx.themeEnum));
        \u0275\u0275advance(12);
        \u0275\u0275textInterpolate1("\n                ", \u0275\u0275pipeBind1(129, 68, "SETTINGS.SHOW_CAPTIONS"), "\n                ");
        \u0275\u0275advance(3);
        \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(132, 70, "SETTINGS.SHOW_CAPTIONS_DESCRIPTION"));
        \u0275\u0275advance(11);
        \u0275\u0275conditional(ctx.settingsForm.value.remoteControl === true ? 142 : -1);
        \u0275\u0275advance(6);
        \u0275\u0275textInterpolate1("\n                ", \u0275\u0275pipeBind1(149, 72, "SETTINGS.VERSION"), "\n                ");
        \u0275\u0275advance(3);
        \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(152, 74, "SETTINGS.VERSION_DESCRIPTION"));
        \u0275\u0275advance(5);
        \u0275\u0275textInterpolate1("\n                ", ctx.version, " ");
        \u0275\u0275advance(11);
        \u0275\u0275textInterpolate1("\n                ", \u0275\u0275pipeBind1(168, 76, "SETTINGS.IMPORT_EXPORT_DATA"), "\n                ");
        \u0275\u0275advance(3);
        \u0275\u0275textInterpolate1("\n                    ", \u0275\u0275pipeBind1(171, 78, "SETTINGS.IMPORT_EXPORT_DATA_DESCRIPTION"), "\n                ");
        \u0275\u0275advance(7);
        \u0275\u0275textInterpolate1("\n                    ", \u0275\u0275pipeBind1(178, 80, "SETTINGS.IMPORT_DATA"), "\n                ");
        \u0275\u0275advance(4);
        \u0275\u0275textInterpolate1("\n                    ", \u0275\u0275pipeBind1(182, 82, "SETTINGS.EXPORT_DATA"), "\n                ");
        \u0275\u0275advance(8);
        \u0275\u0275textInterpolate1("\n                ", \u0275\u0275pipeBind1(190, 84, "SETTINGS.REMOVE_ALL"), "\n                ");
        \u0275\u0275advance(3);
        \u0275\u0275textInterpolate1("\n                    ", \u0275\u0275pipeBind1(193, 86, "SETTINGS.REMOVE_ALL_DESCRIPTION"), "\n                ");
        \u0275\u0275advance(7);
        \u0275\u0275textInterpolate1("\n                    ", \u0275\u0275pipeBind1(200, 88, "SETTINGS.REMOVE_ALL_BUTTON"), "\n                ");
        \u0275\u0275advance(5);
        \u0275\u0275conditional(ctx.isPwa && false ? 204 : -1);
        \u0275\u0275advance(9);
        \u0275\u0275textInterpolate1("\n                ", \u0275\u0275pipeBind1(214, 90, "SETTINGS.BACK_TO_HOME"), "\n            ");
        \u0275\u0275advance(3);
        \u0275\u0275property("disabled", ctx.settingsForm.pristine || !ctx.settingsForm.valid);
        \u0275\u0275advance(4);
        \u0275\u0275textInterpolate1("\n                ", \u0275\u0275pipeBind1(221, 92, "SETTINGS.SAVE_CHANGES"), "\n            ");
      }
    }, dependencies: [
      CommonModule,
      NgForOf,
      NgIf,
      KeyValuePipe,
      FormsModule,
      \u0275NgNoValidate,
      DefaultValueAccessor,
      NgControlStatus,
      NgControlStatusGroup,
      HeaderComponent,
      MatButtonModule,
      MatButton,
      MatIconButton,
      MatCheckboxModule,
      MatCheckbox,
      MatDividerModule,
      MatDivider,
      MatIconModule,
      MatIcon,
      MatInputModule,
      MatInput,
      MatFormField,
      MatLabel,
      MatError,
      MatSelectModule,
      MatSelect,
      MatOption,
      MatTooltipModule,
      MatTooltip,
      ReactiveFormsModule,
      FormGroupDirective,
      FormControlName,
      FormArrayName,
      TranslateModule,
      TranslatePipe,
      MatDialogModule,
      MatDialogTitle
    ], styles: ["\n\nbutton[_ngcontent-%COMP%] {\n  cursor: pointer !important;\n  text-transform: uppercase;\n}\n.settings-container[_ngcontent-%COMP%] {\n  overflow: auto;\n  height: calc(100vh - 100px);\n}\n.row[_ngcontent-%COMP%] {\n  display: flex;\n  padding: 10px;\n}\n.row[_ngcontent-%COMP%]   [_ngcontent-%COMP%]:nth-child(2) {\n  text-align: right;\n}\n.row[_ngcontent-%COMP%]   [_ngcontent-%COMP%]:nth-child(2)   mat-form-field[_ngcontent-%COMP%] {\n  font-size: 14px;\n}\n.column[_ngcontent-%COMP%] {\n  flex: 1;\n}\n.column[_ngcontent-%COMP%]   p[_ngcontent-%COMP%] {\n  font-size: 0.9em;\n  opacity: 0.6;\n  padding: 2px 0;\n  margin: 0;\n}\n.action-buttons[_ngcontent-%COMP%] {\n  margin-top: 10px;\n}\n.action-buttons[_ngcontent-%COMP%]   button[_ngcontent-%COMP%] {\n  margin: 0 10px;\n}"] });
  }
};
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(SettingsComponent, [{
    type: Component,
    args: [{ imports: [
      CommonModule,
      FormsModule,
      HeaderComponent,
      MatButtonModule,
      MatCheckboxModule,
      MatDividerModule,
      MatIconModule,
      MatInputModule,
      MatSelectModule,
      MatTooltipModule,
      ReactiveFormsModule,
      TranslateModule,
      MatDialogModule
    ], template: `@if (!isDialog) {
    <app-header
        [title]="'SETTINGS.TITLE' | translate"
        [subtitle]="
            ('SETTINGS.SUBTITLE' | translate) +
            '. ' +
            ('SETTINGS.DESCRIPTION' | translate)
        "
    />
} @else {
    <h2 mat-dialog-title>{{ 'SETTINGS.TITLE' | translate }}</h2>
}

<div class="settings-container" data-test-id="settings-container">
    <form [formGroup]="settingsForm" (ngSubmit)="onSubmit()" novalidate>
        <ng-container formArrayName="epgUrl" *ngIf="isTauri">
            <div class="row">
                <div class="column">
                    {{ 'SETTINGS.EPG_URL_LABEL' | translate }}
                    <p>Add single or multiple URLs as EPG sources</p>
                </div>
                <div class="column">
                    <div
                        *ngFor="let _ of epgUrl.controls; index as i"
                        style="display: flex"
                    >
                        <mat-form-field appearance="outline" class="full-width">
                            <mat-label>{{
                                'SETTINGS.EPG_URL_PLACEHOLDER' | translate
                            }}</mat-label>
                            <input
                                matInput
                                type="url"
                                [formControlName]="i"
                                #epgField
                            />
                            <mat-error>{{
                                'SETTINGS.EPG_URL_ERROR' | translate
                            }}</mat-error>
                        </mat-form-field>
                        <button
                            matLine
                            mat-icon-button
                            color="accent"
                            [matTooltip]="'SETTINGS.REFRESH_EPG' | translate"
                            type="button"
                            [disabled]="epgField.value === ''"
                            (click)="refreshEpg(epgUrl.value[i])"
                        >
                            <mat-icon>refresh</mat-icon>
                        </button>
                        <button
                            mat-icon-button
                            matLine
                            color="accent"
                            [matTooltip]="'SETTINGS.REFRESH_EPG' | translate"
                            type="button"
                            (click)="removeEpgSource(i)"
                        >
                            <mat-icon>remove</mat-icon>
                        </button>
                    </div>
                    <button
                        mat-button
                        color="accent"
                        type="button"
                        (click)="addEpgSource()"
                    >
                        {{ 'SETTINGS.ADD_EPG_SOURCE' | translate }}
                    </button>
                </div>
            </div>
        <mat-divider />
        </ng-container>
        <div class="row">
            <div class="column">
                {{ 'SETTINGS.VIDEO_PLAYER_LABEL' | translate }}
                <p>{{ 'SETTINGS.VIDEO_PLAYER_DESCRIPTION' | translate }}</p>
            </div>
            <div class="column">
                <mat-form-field appearance="outline">
                    <mat-label>{{
                        'SETTINGS.VIDEO_PLAYER_PLACEHOLDER' | translate
                    }}</mat-label>
                    <mat-select
                        formControlName="player"
                        data-test-id="select-video-player"
                    >
                        <mat-option
                            *ngFor="let player of players"
                            [value]="player.id"
                            [attr.data-test-id]="player.id"
                            (click)="player.id === 'shaka' && !hasSubscription() ? onShakaPlayerSelect() : null"
                            >{{ player.label }}
                        </mat-option>
                    </mat-select>
                </mat-form-field>
            </div>
        </div>
        @if (settingsForm.value.player === 'mpv') {
            <div class="row">
                <div class="column">
                    {{ 'SETTINGS.MPV_PLAYER_PATH_LABEL' | translate }}
                    <p>
                        {{ 'SETTINGS.MPV_PLAYER_PATH_DESCRIPTION' | translate }}
                    </p>
                </div>
                <div class="column">
                    <mat-form-field appearance="outline">
                        <mat-label for="mpvPlayerPath">{{
                            'SETTINGS.MPV_PLAYER_PATH' | translate
                        }}</mat-label>
                        <input
                            matInput
                            type="text"
                            id="mpvPlayerPath"
                            formControlName="mpvPlayerPath"
                        />
                    </mat-form-field>
                </div>
            </div>
        }
        @if (settingsForm.value.player === 'vlc') {
            <div class="row">
                <div class="column">
                    {{ 'SETTINGS.VLC_PLAYER_PATH_LABEL' | translate }}
                    <p>
                        {{ 'SETTINGS.VLC_PLAYER_PATH_DESCRIPTION' | translate }}
                    </p>
                </div>
                <div class="column">
                    <mat-form-field appearance="outline">
                        <mat-label for="vlcPlayerPath">{{
                            'SETTINGS.VLC_PLAYER_PATH' | translate
                        }}</mat-label>
                        <input
                            matInput
                            type="text"
                            id="vlcPlayerPath"
                            formControlName="vlcPlayerPath"
                        />
                    </mat-form-field>
                </div>
            </div>
        }
        <mat-divider />
        <div class="row">
            <div class="column">
                {{ 'SETTINGS.STREAM_FORMAT' | translate }}
                <p>{{ 'SETTINGS.STREAM_FORMAT_DESCRIPTION' | translate }}</p>
            </div>
            <div class="column">
                <mat-form-field appearance="outline">
                    <mat-label>{{
                        'SETTINGS.VIDEO_PLAYER_PLACEHOLDER' | translate
                    }}</mat-label>
                    <mat-select
                        formControlName="streamFormat"
                        data-test-id="select-stream-format"
                    >
                        <mat-option
                            *ngFor="let streamFormat of streamFormatEnum | keyvalue"
                            [value]="streamFormat.value"
                            [attr.data-test-id]="streamFormat.value"
                            >{{ streamFormat.value }}
                        </mat-option>
                    </mat-select>
                </mat-form-field>
            </div>
        </div>
        <mat-divider />
        <div class="row">
            <div class="column">
                {{ 'SETTINGS.LANGUAGE' | translate }}
                <p>{{ 'SETTINGS.LANGUAGE_DESCRIPTION' | translate }}</p>
            </div>
            <div class="column">
                <mat-form-field appearance="outline">
                    <mat-label>{{
                        'SETTINGS.VIDEO_PLAYER_PLACEHOLDER' | translate
                    }}</mat-label>
                    <mat-select
                        formControlName="language"
                        data-test-id="select-language"
                    >
                        <mat-option
                            *ngFor="let language of languageEnum | keyvalue"
                            [value]="language.value"
                            [attr.data-test-id]="language.value"
                            >{{
                                'LANGUAGES.' + language.key | translate
                            }}</mat-option
                        >
                    </mat-select>
                </mat-form-field>
            </div>
        </div>
        <mat-divider />
        <div class="row">
            <div class="column">
                {{ 'SETTINGS.THEME' | translate }}
                <p>{{ 'SETTINGS.THEME_DESCRIPTION' | translate }}</p>
            </div>
            <div class="column">
                <mat-form-field appearance="outline">
                    <mat-label>{{
                        'SETTINGS.VIDEO_PLAYER_PLACEHOLDER' | translate
                    }}</mat-label>
                    <mat-select
                        formControlName="theme"
                        data-test-id="select-theme"
                    >
                        <mat-option
                            *ngFor="let theme of themeEnum | keyvalue"
                            [value]="theme.value"
                            [attr.data-test-id]="theme.value"
                            >{{
                                'THEMES.' + theme.value | translate
                            }}</mat-option
                        >
                    </mat-select>
                </mat-form-field>
            </div>
        </div>
        <mat-divider />
        <div class="row">
            <div class="column">
                {{ 'SETTINGS.SHOW_CAPTIONS' | translate }}
                <p>{{ 'SETTINGS.SHOW_CAPTIONS_DESCRIPTION' | translate }}</p>
            </div>
            <div class="column" style="margin-right: 10px">
                <mat-checkbox
                    class="column"
                    formControlName="showCaptions"
                ></mat-checkbox>
            </div>
        </div>
        <!-- not ported to tauri yet
        @if (isPwa || isTauri) {
            <mat-divider />
            <div class="row">
                <div class="column">
                    {{ 'SETTINGS.REMOTE_CONTROL' | translate }}
                    <p>
                        {{ 'SETTINGS.REMOTE_CONTROL_DESCRIPTION' | translate }}
                    </p>
                </div>
                <div class="column" style="margin-right: 10px">
                    <mat-checkbox
                        class="column"
                        formControlName="remoteControl"
                    ></mat-checkbox>
                </div>
            </div>
        }
        -->
        @if (settingsForm.value.remoteControl === true) {
            <mat-divider />
            <div class="row">
                <div class="column">
                    {{ 'SETTINGS.REMOTE_CONTROL_PORT' | translate }}
                    <p>
                        {{
                            'SETTINGS.REMOTE_CONTROL_PORT_DESCRIPTION'
                                | translate
                        }}
                    </p>
                </div>
                <div class="column" style="margin-right: 10px">
                    <mat-form-field appearance="outline" class="full-width">
                        <input
                            matInput
                            type="text"
                            id="remoteControlPort"
                            formControlName="remoteControlPort"
                        />
                    </mat-form-field>
                </div>
            </div>
        }
        <mat-divider />
        <div class="row">
            <div class="column">
                {{ 'SETTINGS.VERSION' | translate }}
                <p>{{ 'SETTINGS.VERSION_DESCRIPTION' | translate }}</p>
            </div>
            <div class="column">
                {{ version }} <br />
                <!-- {{ updateMessage }} -->
            </div>
        </div>
        <mat-divider />
        <div class="row">
            <div class="column">
                {{ 'SETTINGS.IMPORT_EXPORT_DATA' | translate }}
                <p>
                    {{ 'SETTINGS.IMPORT_EXPORT_DATA_DESCRIPTION' | translate }}
                </p>
            </div>
            <div class="column">
                <button
                    mat-button
                    (click)="
                        $event.preventDefault();
                        $event.stopPropagation();
                        importData()
                    "
                >
                    {{ 'SETTINGS.IMPORT_DATA' | translate }}
                </button>
                <button
                    mat-button
                    (click)="
                        $event.preventDefault();
                        $event.stopPropagation();
                        exportData()
                    "
                >
                    {{ 'SETTINGS.EXPORT_DATA' | translate }}
                </button>
            </div>
        </div>

        <div class="row">
            <div class="column">
                {{ 'SETTINGS.REMOVE_ALL' | translate }}
                <p>
                    {{ 'SETTINGS.REMOVE_ALL_DESCRIPTION' | translate }}
                </p>
            </div>
            <div class="column">
                <button
                    mat-button
                    (click)="
                        $event.preventDefault();
                        $event.stopPropagation();
                        removeAll()
                    "
                    color="warn"
                >
                    {{ 'SETTINGS.REMOVE_ALL_BUTTON' | translate }}
                </button>
            </div>
        </div>

        @if (isPwa && false) {
            <div class="row">
                {{ 'SETTINGS.EPG_NOTE' | translate }}
                &nbsp;<a href="https://github.com/4gray/dailyflim/releases">{{
                    'SETTINGS.EPG_NOTE_URL_TEXT' | translate
                }}</a>
            </div>
        }

        <mat-divider />
        <div class="action-buttons" align="end">
            <button
                mat-button
                color="accent"
                type="reset"
                (click)="backToHome()"
                data-test-id="back-to-home"
            >
                <mat-icon>chevron_left</mat-icon>
                {{ 'SETTINGS.BACK_TO_HOME' | translate }}
            </button>
            <button
                mat-button
                color="accent"
                type="submit"
                [disabled]="settingsForm.pristine || !settingsForm.valid"
                data-test-id="save-settings"
            >
                <mat-icon>save</mat-icon>
                {{ 'SETTINGS.SAVE_CHANGES' | translate }}
            </button>
        </div>
    </form>
</div>
`, styles: ["/* src/app/settings/settings.component.scss */\nbutton {\n  cursor: pointer !important;\n  text-transform: uppercase;\n}\n.settings-container {\n  overflow: auto;\n  height: calc(100vh - 100px);\n}\n.row {\n  display: flex;\n  padding: 10px;\n}\n.row :nth-child(2) {\n  text-align: right;\n}\n.row :nth-child(2) mat-form-field {\n  font-size: 14px;\n}\n.column {\n  flex: 1;\n}\n.column p {\n  font-size: 0.9em;\n  opacity: 0.6;\n  padding: 2px 0;\n  margin: 0;\n}\n.action-buttons {\n  margin-top: 10px;\n}\n.action-buttons button {\n  margin: 0 10px;\n}\n"] }]
  }], () => [{ type: DialogService }, { type: DataService }, { type: EpgService }, { type: FormBuilder }, { type: PlaylistsService }, { type: Router }, { type: SettingsService }, { type: MatSnackBar }, { type: Store }, { type: TranslateService }, { type: MatDialog }, { type: RemoteConfigService }, { type: UserService }, { type: void 0, decorators: [{
    type: Optional
  }, {
    type: Inject,
    args: [MAT_DIALOG_DATA]
  }] }], { isDialog: [{
    type: Input
  }] });
})();
(() => {
  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(SettingsComponent, { className: "SettingsComponent", filePath: "src/app/settings/settings.component.ts", lineNumber: 78 });
})();

export {
  SettingsStore,
  MatSelect,
  MatSelectModule,
  SettingsComponent
};
