import { ChangeDetectionStrategy, Component, forwardRef, Input } from '@angular/core';
import { CommonModule } from '@angular/common';
import { NG_VALUE_ACCESSOR, FormsModule, ReactiveFormsModule } from '@angular/forms';
import { UniqueIdService } from '@ironsource/fusion-ui/services/unique-id';
import { BehaviorSubject } from 'rxjs';
import * as i0 from "@angular/core";
import * as i1 from "@ironsource/fusion-ui/services/unique-id";
import * as i2 from "@angular/common";
function ToggleComponent_div_7_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 5);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate(ctx_r0.error);
} }
function ToggleComponent_div_8_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 6);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext();
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate(ctx_r1.helper);
} }
const _c0 = ["*"];
export class ToggleComponent {
    set error(value) {
        this._error = value;
    }
    get error() {
        return this._error;
    }
    set disabled(value) {
        this.setDisabledState(value);
    }
    set helper(value) {
        this._helper = value;
    }
    get helper() {
        return this._helper;
    }
    constructor(uniqueIdService) {
        this.uniqueIdService = uniqueIdService;
        /** @internal */
        this.checked$ = new BehaviorSubject(false);
        /** @internal */
        this.disabled$ = new BehaviorSubject(false);
        // Implement ControlValueAccessor methods
        /**
         * Method to call when value has changes.
         * @ignore
         */
        this.propagateChange = (_) => { };
        /**
         * Method to call when the component is touched (when it was is clicked).
         * @ignore
         */
        this.propagateTouched = () => { };
        this.id = `fuToggle_${this.uniqueIdService.getUniqueId()}`;
    }
    /** @ignore */
    change($event) {
        this.propagateTouched();
        this.checked$.next($event.target.checked);
        this.propagateChange(this.checked$.getValue());
    }
    /**
     * update value from model to the component
     * @ignore
     */
    writeValue(value) {
        this.checked$.next(!!value);
    }
    /**
     * Informs the outside world about changes.
     * see method propagateChange call - this.propagateChange(this.model);
     * @ignore
     */
    registerOnChange(fn) {
        this.propagateChange = fn;
    }
    /**
     * on click
     * @ignore
     */
    registerOnTouched(fn) {
        this.propagateTouched = fn;
    }
    /**
     * on set form controll enabled / disabled
     * also do UI Component enabled / disabled
     * @ignore
     */
    setDisabledState(disabled) {
        this.disabled$.next(disabled);
    }
    static { this.ɵfac = function ToggleComponent_Factory(t) { return new (t || ToggleComponent)(i0.ɵɵdirectiveInject(i1.UniqueIdService)); }; }
    static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ToggleComponent, selectors: [["fusion-toggle"]], inputs: { error: "error", disabled: "disabled", helper: "helper" }, standalone: true, features: [i0.ɵɵProvidersFeature([
                {
                    provide: NG_VALUE_ACCESSOR,
                    useExisting: forwardRef(() => ToggleComponent),
                    multi: true
                }
            ]), i0.ɵɵStandaloneFeature], ngContentSelectors: _c0, decls: 9, vars: 9, consts: [["type", "checkbox", 3, "id", "checked", "disabled", "change"], [1, "fu-toggle-slider"], [1, "fu-toggle-content"], ["class", "fu-error-msg", 4, "ngIf"], ["class", "fu-helper-text", 4, "ngIf"], [1, "fu-error-msg"], [1, "fu-helper-text"]], template: function ToggleComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵprojectionDef();
            i0.ɵɵelementStart(0, "label")(1, "input", 0);
            i0.ɵɵlistener("change", function ToggleComponent_Template_input_change_1_listener($event) { return ctx.change($event); });
            i0.ɵɵpipe(2, "async");
            i0.ɵɵpipe(3, "async");
            i0.ɵɵelementEnd();
            i0.ɵɵelement(4, "div", 1);
            i0.ɵɵelementStart(5, "div", 2);
            i0.ɵɵprojection(6);
            i0.ɵɵelementEnd()();
            i0.ɵɵtemplate(7, ToggleComponent_div_7_Template, 2, 1, "div", 3)(8, ToggleComponent_div_8_Template, 2, 1, "div", 4);
        } if (rf & 2) {
            i0.ɵɵadvance();
            i0.ɵɵproperty("id", ctx.id)("checked", i0.ɵɵpipeBind1(2, 5, ctx.checked$))("disabled", i0.ɵɵpipeBind1(3, 7, ctx.disabled$));
            i0.ɵɵadvance(6);
            i0.ɵɵproperty("ngIf", ctx.error);
            i0.ɵɵadvance();
            i0.ɵɵproperty("ngIf", ctx.helper);
        } }, dependencies: [CommonModule, i2.NgIf, i2.AsyncPipe, FormsModule, ReactiveFormsModule], styles: ["@font-face{font-family:NHaasGroteskDSPro;src:url(https://fusion.ironsrc.net/assets/fonts/NHaasGroteskDSPro-75Bd.eot);src:url(https://fusion.ironsrc.net/assets/fonts/NHaasGroteskDSPro-75Bd.eot?#iefix) format(\"embedded-opentype\"),url(https://fusion.ironsrc.net/assets/fonts/NHaasGroteskDSPro-75Bd.woff2) format(\"woff2\"),url(https://fusion.ironsrc.net/assets/fonts/NHaasGroteskDSPro-75Bd.woff) format(\"woff\"),url(https://fusion.ironsrc.net/assets/fonts/NHaasGroteskDSPro-75Bd.ttf) format(\"truetype\")}@font-face{font-family:NHaasGroteskDSPro-65Md;src:url(https://fusion.ironsrc.net/assets/fonts/NHaasGroteskDSPro-65Md.eot);src:url(https://fusion.ironsrc.net/assets/fonts/NHaasGroteskDSPro-65Md.eot?#iefix) format(\"embedded-opentype\"),url(https://fusion.ironsrc.net/assets/fonts/NHaasGroteskDSPro-65Md.woff2) format(\"woff2\"),url(https://fusion.ironsrc.net/assets/fonts/NHaasGroteskDSPro-65Md.woff) format(\"woff\"),url(https://fusion.ironsrc.net/assets/fonts/NHaasGroteskDSPro-65Md.ttf) format(\"truetype\")}@font-face{font-family:HelveticaNeue;src:url(https://fusion.ironsrc.net/assets/fonts/HelveticaNeue.eot);src:url(https://fusion.ironsrc.net/assets/fonts/HelveticaNeue.eot?#iefix) format(\"embedded-opentype\"),url(https://fusion.ironsrc.net/assets/fonts/HelveticaNeue.woff2) format(\"woff2\"),url(https://fusion.ironsrc.net/assets/fonts/HelveticaNeue.woff) format(\"woff\"),url(https://fusion.ironsrc.net/assets/fonts/HelveticaNeue.ttf) format(\"truetype\")}@font-face{font-family:HelveticaNeue-Medium;src:url(https://fusion.ironsrc.net/assets/fonts/HelveticaNeue-Medium.eot);src:url(https://fusion.ironsrc.net/assets/fonts/HelveticaNeue-Medium.eot?#iefix) format(\"embedded-opentype\"),url(https://fusion.ironsrc.net/assets/fonts/HelveticaNeue-Medium.woff2) format(\"woff2\"),url(https://fusion.ironsrc.net/assets/fonts/HelveticaNeue-Medium.woff) format(\"woff\"),url(https://fusion.ironsrc.net/assets/fonts/HelveticaNeue-Medium.ttf) format(\"truetype\")}.font-heading-6[_ngcontent-%COMP%], .font-heading-5[_ngcontent-%COMP%], .font-heading-4[_ngcontent-%COMP%], .font-heading-3[_ngcontent-%COMP%], .font-heading-2[_ngcontent-%COMP%], .font-heading-1[_ngcontent-%COMP%]{font-family:NHaasGroteskDSPro,sans-serif}.font-heading-1[_ngcontent-%COMP%]{font-size:60px}.font-heading-2[_ngcontent-%COMP%]{font-size:32px}.font-heading-3[_ngcontent-%COMP%]{font-size:22px}.font-heading-4[_ngcontent-%COMP%]{font-size:18px}.font-heading-5[_ngcontent-%COMP%]{font-size:15px}.font-heading-6[_ngcontent-%COMP%]{font-size:13px}.font-heading-label[_ngcontent-%COMP%]{font-size:11px;font-family:NHaasGroteskDSPro-65Md,sans-serif;letter-spacing:.25px}[_nghost-%COMP%]   .fu-error-msg[_ngcontent-%COMP%], [_nghost-%COMP%]   .fu-helper-text[_ngcontent-%COMP%], .font-caption[_ngcontent-%COMP%], .font-bodyXSmall[_ngcontent-%COMP%], [_nghost-%COMP%]   label[_ngcontent-%COMP%]   .fu-toggle-content[_ngcontent-%COMP%], .font-bodySmall[_ngcontent-%COMP%], .font-bodyMedium[_ngcontent-%COMP%], .font-bodyLarge[_ngcontent-%COMP%]{font-family:HelveticaNeue,helvetica,sans-serif;line-height:1.5}.font-bodyXSmallStrong[_ngcontent-%COMP%], .font-bodySmallStrong[_ngcontent-%COMP%], .font-bodyMediumStrong[_ngcontent-%COMP%], .font-bodyLargeStrong[_ngcontent-%COMP%]{font-family:HelveticaNeue-Medium,helvetica,sans-serif;line-height:1.5}.font-bodyLarge[_ngcontent-%COMP%], .font-bodyLargeStrong[_ngcontent-%COMP%]{font-size:16px}.font-bodyMedium[_ngcontent-%COMP%], .font-bodyMediumStrong[_ngcontent-%COMP%]{font-size:14px}[_nghost-%COMP%]   label[_ngcontent-%COMP%]   .fu-toggle-content[_ngcontent-%COMP%], .font-bodySmall[_ngcontent-%COMP%]{font-size:13px;letter-spacing:.24px}.font-bodySmallStrong[_ngcontent-%COMP%]{font-size:13px;letter-spacing:.24px}.font-bodyXSmall[_ngcontent-%COMP%], .font-bodyXSmallStrong[_ngcontent-%COMP%]{font-size:12px;letter-spacing:.24px}[_nghost-%COMP%]   .fu-error-msg[_ngcontent-%COMP%], [_nghost-%COMP%]   .fu-helper-text[_ngcontent-%COMP%], .font-caption[_ngcontent-%COMP%]{font-size:11px}[_nghost-%COMP%]   *[_ngcontent-%COMP%]{box-sizing:border-box}[_nghost-%COMP%]{margin:0;padding:0;vertical-align:initial;text-align:initial}@keyframes _ngcontent-%COMP%_rotation{0%{transform:rotate(0)}to{transform:rotate(359deg)}}@keyframes _ngcontent-%COMP%_shineAnimation{0%{background-position:-750px 0}to{background-position:750px 0}}[_nghost-%COMP%]   label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px}[_nghost-%COMP%]   label[_ngcontent-%COMP%]   .fu-toggle-content[_ngcontent-%COMP%]{color:var(--fu-black-500, #53575B)}[_nghost-%COMP%]   label[_ngcontent-%COMP%]   .fu-toggle-content[_ngcontent-%COMP%]:hover{cursor:pointer}[_nghost-%COMP%]   label[_ngcontent-%COMP%]   .fu-toggle-slider[_ngcontent-%COMP%]{vertical-align:middle;background:var(--fu-light-500, #D2D5D8);display:inline-block;width:28px;height:16px;border-radius:8px;position:relative;transition:background-color linear .3s 0s}[_nghost-%COMP%]   label[_ngcontent-%COMP%]   .fu-toggle-slider[_ngcontent-%COMP%]:hover{cursor:pointer}[_nghost-%COMP%]   label[_ngcontent-%COMP%]   .fu-toggle-slider[_ngcontent-%COMP%]:before{content:\"\";display:block;width:12px;height:12px;background:#fff;position:absolute;top:2px;left:2px;border-radius:6px;transition:left linear .3s 0s}[_nghost-%COMP%]   label[_ngcontent-%COMP%]   input[type=checkbox][_ngcontent-%COMP%]{display:none}[_nghost-%COMP%]   label[_ngcontent-%COMP%]   input[type=checkbox][_ngcontent-%COMP%]:checked + .fu-toggle-slider[_ngcontent-%COMP%]{background-color:var(--checked-bg-color, var(--fu-primary-500, #3083FF))}[_nghost-%COMP%]   label[_ngcontent-%COMP%]   input[type=checkbox][_ngcontent-%COMP%]:checked + .fu-toggle-slider[_ngcontent-%COMP%]:before{left:14px}[_nghost-%COMP%]   label[_ngcontent-%COMP%]   input[type=checkbox][_ngcontent-%COMP%]:disabled ~ .fu-toggle-slider[_ngcontent-%COMP%]{opacity:75%;pointer-events:unset}[_nghost-%COMP%]   label[_ngcontent-%COMP%]   input[type=checkbox][_ngcontent-%COMP%]:disabled ~ .fu-toggle-slider[_ngcontent-%COMP%]:hover{cursor:default}[_nghost-%COMP%]   label[_ngcontent-%COMP%]   input[type=checkbox][_ngcontent-%COMP%]:disabled ~ .fu-toggle-content[_ngcontent-%COMP%]{color:var(--fu-light-800, #8E959D)}[_nghost-%COMP%]   label[_ngcontent-%COMP%]   input[type=checkbox][_ngcontent-%COMP%]:disabled ~ .fu-toggle-content[_ngcontent-%COMP%]:hover{cursor:default}[_nghost-%COMP%]   .fu-error-msg[_ngcontent-%COMP%], [_nghost-%COMP%]   .fu-helper-text[_ngcontent-%COMP%]{color:var(--fu-negative-700, #DA564F)}[_nghost-%COMP%]   .fu-helper-text[_ngcontent-%COMP%]{color:var(--fu-black-200, #696A6B)}"], changeDetection: 0 }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ToggleComponent, [{
        type: Component,
        args: [{ selector: 'fusion-toggle', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [CommonModule, FormsModule, ReactiveFormsModule], providers: [
                    {
                        provide: NG_VALUE_ACCESSOR,
                        useExisting: forwardRef(() => ToggleComponent),
                        multi: true
                    }
                ], template: "<label>\n    <input type=\"checkbox\"\n        [id]=\"id\"\n        [checked]=\"checked$ | async\"\n        [disabled]=\"disabled$ | async\"\n        (change)=\"change($event)\"\n    />\n  <div class=\"fu-toggle-slider\"></div>\n  <div class=\"fu-toggle-content\"><ng-content></ng-content></div>\n</label>\n<div class=\"fu-error-msg\" *ngIf=\"error\">{{error}}</div>\n<div class=\"fu-helper-text\" *ngIf=\"helper\">{{helper}}</div>\n", styles: ["@font-face{font-family:NHaasGroteskDSPro;src:url(https://fusion.ironsrc.net/assets/fonts/NHaasGroteskDSPro-75Bd.eot);src:url(https://fusion.ironsrc.net/assets/fonts/NHaasGroteskDSPro-75Bd.eot?#iefix) format(\"embedded-opentype\"),url(https://fusion.ironsrc.net/assets/fonts/NHaasGroteskDSPro-75Bd.woff2) format(\"woff2\"),url(https://fusion.ironsrc.net/assets/fonts/NHaasGroteskDSPro-75Bd.woff) format(\"woff\"),url(https://fusion.ironsrc.net/assets/fonts/NHaasGroteskDSPro-75Bd.ttf) format(\"truetype\")}@font-face{font-family:NHaasGroteskDSPro-65Md;src:url(https://fusion.ironsrc.net/assets/fonts/NHaasGroteskDSPro-65Md.eot);src:url(https://fusion.ironsrc.net/assets/fonts/NHaasGroteskDSPro-65Md.eot?#iefix) format(\"embedded-opentype\"),url(https://fusion.ironsrc.net/assets/fonts/NHaasGroteskDSPro-65Md.woff2) format(\"woff2\"),url(https://fusion.ironsrc.net/assets/fonts/NHaasGroteskDSPro-65Md.woff) format(\"woff\"),url(https://fusion.ironsrc.net/assets/fonts/NHaasGroteskDSPro-65Md.ttf) format(\"truetype\")}@font-face{font-family:HelveticaNeue;src:url(https://fusion.ironsrc.net/assets/fonts/HelveticaNeue.eot);src:url(https://fusion.ironsrc.net/assets/fonts/HelveticaNeue.eot?#iefix) format(\"embedded-opentype\"),url(https://fusion.ironsrc.net/assets/fonts/HelveticaNeue.woff2) format(\"woff2\"),url(https://fusion.ironsrc.net/assets/fonts/HelveticaNeue.woff) format(\"woff\"),url(https://fusion.ironsrc.net/assets/fonts/HelveticaNeue.ttf) format(\"truetype\")}@font-face{font-family:HelveticaNeue-Medium;src:url(https://fusion.ironsrc.net/assets/fonts/HelveticaNeue-Medium.eot);src:url(https://fusion.ironsrc.net/assets/fonts/HelveticaNeue-Medium.eot?#iefix) format(\"embedded-opentype\"),url(https://fusion.ironsrc.net/assets/fonts/HelveticaNeue-Medium.woff2) format(\"woff2\"),url(https://fusion.ironsrc.net/assets/fonts/HelveticaNeue-Medium.woff) format(\"woff\"),url(https://fusion.ironsrc.net/assets/fonts/HelveticaNeue-Medium.ttf) format(\"truetype\")}.font-heading-6,.font-heading-5,.font-heading-4,.font-heading-3,.font-heading-2,.font-heading-1{font-family:NHaasGroteskDSPro,sans-serif}.font-heading-1{font-size:60px}.font-heading-2{font-size:32px}.font-heading-3{font-size:22px}.font-heading-4{font-size:18px}.font-heading-5{font-size:15px}.font-heading-6{font-size:13px}.font-heading-label{font-size:11px;font-family:NHaasGroteskDSPro-65Md,sans-serif;letter-spacing:.25px}:host .fu-error-msg,:host .fu-helper-text,.font-caption,.font-bodyXSmall,:host label .fu-toggle-content,.font-bodySmall,.font-bodyMedium,.font-bodyLarge{font-family:HelveticaNeue,helvetica,sans-serif;line-height:1.5}.font-bodyXSmallStrong,.font-bodySmallStrong,.font-bodyMediumStrong,.font-bodyLargeStrong{font-family:HelveticaNeue-Medium,helvetica,sans-serif;line-height:1.5}.font-bodyLarge,.font-bodyLargeStrong{font-size:16px}.font-bodyMedium,.font-bodyMediumStrong{font-size:14px}:host label .fu-toggle-content,.font-bodySmall{font-size:13px;letter-spacing:.24px}.font-bodySmallStrong{font-size:13px;letter-spacing:.24px}.font-bodyXSmall,.font-bodyXSmallStrong{font-size:12px;letter-spacing:.24px}:host .fu-error-msg,:host .fu-helper-text,.font-caption{font-size:11px}:host *{box-sizing:border-box}:host{margin:0;padding:0;vertical-align:initial;text-align:initial}@keyframes rotation{0%{transform:rotate(0)}to{transform:rotate(359deg)}}@keyframes shineAnimation{0%{background-position:-750px 0}to{background-position:750px 0}}:host label{display:flex;align-items:center;gap:8px}:host label .fu-toggle-content{color:var(--fu-black-500, #53575B)}:host label .fu-toggle-content:hover{cursor:pointer}:host label .fu-toggle-slider{vertical-align:middle;background:var(--fu-light-500, #D2D5D8);display:inline-block;width:28px;height:16px;border-radius:8px;position:relative;transition:background-color linear .3s 0s}:host label .fu-toggle-slider:hover{cursor:pointer}:host label .fu-toggle-slider:before{content:\"\";display:block;width:12px;height:12px;background:#fff;position:absolute;top:2px;left:2px;border-radius:6px;transition:left linear .3s 0s}:host label input[type=checkbox]{display:none}:host label input[type=checkbox]:checked+.fu-toggle-slider{background-color:var(--checked-bg-color, var(--fu-primary-500, #3083FF))}:host label input[type=checkbox]:checked+.fu-toggle-slider:before{left:14px}:host label input[type=checkbox]:disabled~.fu-toggle-slider{opacity:75%;pointer-events:unset}:host label input[type=checkbox]:disabled~.fu-toggle-slider:hover{cursor:default}:host label input[type=checkbox]:disabled~.fu-toggle-content{color:var(--fu-light-800, #8E959D)}:host label input[type=checkbox]:disabled~.fu-toggle-content:hover{cursor:default}:host .fu-error-msg,:host .fu-helper-text{color:var(--fu-negative-700, #DA564F)}:host .fu-helper-text{color:var(--fu-black-200, #696A6B)}\n"] }]
    }], () => [{ type: i1.UniqueIdService }], { error: [{
            type: Input
        }], disabled: [{
            type: Input
        }], helper: [{
            type: Input
        }] }); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ToggleComponent, { className: "ToggleComponent", filePath: "toggle.component.ts", lineNumber: 22 }); })();
//# sourceMappingURL=data:application/json;base64, 