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AA+BP,mBA/BO,yBA+BI;AACT,mBAAO,KAAK,cAAL,CAAoB,2BAApB,EAAoC,EAApC,EAAwC,CAC7C,KAAK,OAAL,KAAiB,KAAjB,GACI,IADJ,GAEI,KAAK,MAAL,CAAY,QAAZ,IAAwB,KAAK,cAAL,CAAoB,2BAApB,EAAuC;AAC/D,uBAAO;AACL,2BAAQ,KAAK,OAAL,KAAiB,IAAjB,IAAyB,KAAK,OAAL,KAAiB,EAA3C,GACF,KAAK,KAAL,IAAc,SADZ,GAEH,KAAK,OAHJ;AAIL,0BAAM,EAJD;AAKL,2BAAO,CALF;AAML,mCAAe;AANV;AADwD,aAAvC,CAHiB,CAAxC,CAAP;AAcD,SA9CM;AA+CP,mBA/CO,yBA+CI;AACT,gBAAI,KAAK,QAAT,EAAmB,KAAK,QAAL;AACpB,SAjDM;AAkDP,oBAlDO,0BAkDK;AACV,gBAAI,CAAC,KAAK,QAAV,EAAoB,KAAK,QAAL;AACrB,SApDM;AAqDP,iBArDO,qBAqDI,CArDJ,EAqDK;AACV,gBACG,EAAE,OAAF,KAAc,kBAAS,IAAvB,IAA+B,KAAK,QAArC,IACC,EAAE,OAAF,KAAc,kBAAS,KAAvB,IAAgC,CAAC,KAAK,QAFzC,EAGE,KAAK,QAAL;AACH;AA1DM;AA7BI,C","sourcesContent":["import '../../stylus/components/_selection-controls.styl'\nimport '../../stylus/components/_switch.styl'\n\n// Mixins\nimport Selectable from '../../mixins/selectable'\n\n// Directives\nimport Touch from '../../directives/touch'\n\n// Components\nimport { VFabTransition } from '../transitions'\nimport VProgressCircular from '../VProgressCircular/VProgressCircular'\n\n// Helpers\nimport { keyCodes } from '../../util/helpers'\n\n/* @vue/component */\nexport default {\n name: 'v-switch',\n\n directives: { Touch },\n\n mixins: [\n Selectable\n ],\n\n props: {\n loading: {\n type: [Boolean, String],\n default: false\n }\n },\n\n computed: {\n classes () {\n return {\n 'v-input--selection-controls v-input--switch': true\n }\n },\n switchData () {\n return this.setTextColor(this.loading ? undefined : this.computedColor, {\n class: this.themeClasses\n })\n }\n },\n\n methods: {\n genDefaultSlot () {\n return [\n this.genSwitch(),\n this.genLabel()\n ]\n },\n genSwitch () {\n return this.$createElement('div', {\n staticClass: 'v-input--selection-controls__input'\n }, [\n this.genInput('checkbox', this.$attrs),\n this.genRipple(this.setTextColor(this.computedColor, {\n directives: [{\n name: 'touch',\n value: {\n left: this.onSwipeLeft,\n right: this.onSwipeRight\n }\n }]\n })),\n this.$createElement('div', {\n staticClass: 'v-input--switch__track',\n ...this.switchData\n }),\n this.$createElement('div', {\n staticClass: 'v-input--switch__thumb',\n ...this.switchData\n }, [this.genProgress()])\n ])\n },\n genProgress () {\n return this.$createElement(VFabTransition, {}, [\n this.loading === false\n ? null\n : this.$slots.progress || this.$createElement(VProgressCircular, {\n props: {\n color: (this.loading === true || this.loading === '')\n ? (this.color || 'primary')\n : this.loading,\n size: 16,\n width: 2,\n indeterminate: true\n }\n })\n ])\n },\n onSwipeLeft () {\n if (this.isActive) this.onChange()\n },\n onSwipeRight () {\n if (!this.isActive) this.onChange()\n },\n onKeydown (e) {\n if (\n (e.keyCode === keyCodes.left && this.isActive) ||\n (e.keyCode === keyCodes.right && !this.isActive)\n ) this.onChange()\n }\n }\n}\n"],"sourceRoot":""}