{"ast":null,"code":"import * as i0 from '@angular/core';\nimport { forwardRef, EventEmitter, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, Output, NgModule } from '@angular/core';\nimport * as i1 from '@angular/common';\nimport { CommonModule } from '@angular/common';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\n\nconst _c0 = function (a1, a2, a3) {\n return {\n \"p-inputswitch p-component\": true,\n \"p-inputswitch-checked\": a1,\n \"p-disabled\": a2,\n \"p-focus\": a3\n };\n};\n\nconst INPUTSWITCH_VALUE_ACCESSOR = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => InputSwitch),\n multi: true\n};\n\nclass InputSwitch {\n constructor(cd) {\n this.cd = cd;\n this.trueValue = true;\n this.falseValue = false;\n this.onChange = new EventEmitter();\n this.modelValue = false;\n this.focused = false;\n\n this.onModelChange = () => {};\n\n this.onModelTouched = () => {};\n }\n\n onClick(event, cb) {\n if (!this.disabled && !this.readonly) {\n event.preventDefault();\n this.toggle(event);\n cb.focus();\n }\n }\n\n onInputChange(event) {\n if (!this.readonly) {\n const inputChecked = event.target.checked;\n this.updateModel(event, inputChecked);\n }\n }\n\n toggle(event) {\n this.updateModel(event, !this.checked());\n }\n\n updateModel(event, value) {\n this.modelValue = value ? this.trueValue : this.falseValue;\n this.onModelChange(this.modelValue);\n this.onChange.emit({\n originalEvent: event,\n checked: this.modelValue\n });\n }\n\n onFocus(event) {\n this.focused = true;\n }\n\n onBlur(event) {\n this.focused = false;\n this.onModelTouched();\n }\n\n writeValue(value) {\n this.modelValue = value;\n this.cd.markForCheck();\n }\n\n registerOnChange(fn) {\n this.onModelChange = fn;\n }\n\n registerOnTouched(fn) {\n this.onModelTouched = fn;\n }\n\n setDisabledState(val) {\n this.disabled = val;\n this.cd.markForCheck();\n }\n\n checked() {\n return this.modelValue === this.trueValue;\n }\n\n}\n\nInputSwitch.ɵfac = function InputSwitch_Factory(t) {\n return new (t || InputSwitch)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef));\n};\n\nInputSwitch.ɵcmp = /* @__PURE__ */i0.ɵɵdefineComponent({\n type: InputSwitch,\n selectors: [[\"p-inputSwitch\"]],\n hostAttrs: [1, \"p-element\"],\n inputs: {\n style: \"style\",\n styleClass: \"styleClass\",\n tabindex: \"tabindex\",\n inputId: \"inputId\",\n name: \"name\",\n disabled: \"disabled\",\n readonly: \"readonly\",\n trueValue: \"trueValue\",\n falseValue: \"falseValue\",\n ariaLabelledBy: \"ariaLabelledBy\"\n },\n outputs: {\n onChange: \"onChange\"\n },\n features: [i0.ɵɵProvidersFeature([INPUTSWITCH_VALUE_ACCESSOR])],\n decls: 5,\n vars: 15,\n consts: [[3, \"ngClass\", \"ngStyle\", \"click\"], [1, \"p-hidden-accessible\"], [\"type\", \"checkbox\", \"role\", \"switch\", 3, \"checked\", \"disabled\", \"change\", \"focus\", \"blur\"], [\"cb\", \"\"], [1, \"p-inputswitch-slider\"]],\n template: function InputSwitch_Template(rf, ctx) {\n if (rf & 1) {\n const _r1 = i0.ɵɵgetCurrentView();\n\n i0.ɵɵelementStart(0, \"div\", 0);\n i0.ɵɵlistener(\"click\", function InputSwitch_Template_div_click_0_listener($event) {\n i0.ɵɵrestoreView(_r1);\n\n const _r0 = i0.ɵɵreference(3);\n\n return ctx.onClick($event, _r0);\n });\n i0.ɵɵelementStart(1, \"div\", 1);\n i0.ɵɵelementStart(2, \"input\", 2, 3);\n i0.ɵɵlistener(\"change\", function InputSwitch_Template_input_change_2_listener($event) {\n return ctx.onInputChange($event);\n })(\"focus\", function InputSwitch_Template_input_focus_2_listener($event) {\n return ctx.onFocus($event);\n })(\"blur\", function InputSwitch_Template_input_blur_2_listener($event) {\n return ctx.onBlur($event);\n });\n i0.ɵɵelementEnd();\n i0.ɵɵelementEnd();\n i0.ɵɵelement(4, \"span\", 4);\n i0.ɵɵelementEnd();\n }\n\n if (rf & 2) {\n i0.ɵɵclassMap(ctx.styleClass);\n i0.ɵɵproperty(\"ngClass\", i0.ɵɵpureFunction3(11, _c0, ctx.checked(), ctx.disabled, ctx.focused))(\"ngStyle\", ctx.style);\n i0.ɵɵadvance(2);\n i0.ɵɵproperty(\"checked\", ctx.checked())(\"disabled\", ctx.disabled);\n i0.ɵɵattribute(\"id\", ctx.inputId)(\"name\", ctx.name)(\"tabindex\", ctx.tabindex)(\"aria-checked\", ctx.checked())(\"aria-labelledby\", ctx.ariaLabelledBy);\n }\n },\n directives: [i1.NgClass, i1.NgStyle],\n styles: [\".p-inputswitch{position:relative;display:inline-block;-webkit-user-select:none;user-select:none}.p-inputswitch-slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0}.p-inputswitch-slider:before{position:absolute;content:\\\"\\\";top:50%}\\n\"],\n encapsulation: 2,\n changeDetection: 0\n});\n\n(function () {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && i0.ɵsetClassMetadata(InputSwitch, [{\n type: Component,\n args: [{\n selector: 'p-inputSwitch',\n template: `\n