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AL,KAAc,IAAlB,EAAwB;AACtB;AACA,eAAO,IAAP;AACD,OAHD,MAGO,IAAI,KAAK,KAAL,KAAe,IAAnB,EAAyB;AAC9B;AACA,eAAO,KAAP;AACD,OAHM,MAGA;AACL;AACA,eAAO,KAAK,KAAL,CAAW,MAAlB;AACD;AACF,KAfO;AAgBR,IAAA,YAhBQ,0BAgBI;AACV,aAAO;AACL,uBAAe,KAAK,MADf;AAEL,wBAAgB,CAAC,KAAK;AAFjB,OAAP;AAID,KArBO;;AAsBR;AACA,IAAA,UAvBQ,wBAuBE;AACR,UAAI,KAAK,IAAL,KAAc,IAAlB,EAAwB;AACtB;AACA,eAAO,IAAP;AACD,OAHD,MAGO,IAAI,KAAK,KAAL,KAAe,IAAnB,EAAyB;AAC9B;AACA,eAAO,KAAP;AACD,OAHM,MAGA;AACL;AACA,eAAO,KAAK,SAAZ;AACD;AACF,KAlCO;AAmCR,IAAA,gBAnCQ,8BAmCQ;AACd,aAAO;AACL,uBAAe,KAAK,UADf;AAEL,wBAAgB,CAAC,KAAK;AAFjB,OAAP;AAID;AAxCO,GApCqC;AA+E/C,EAAA,KAAK,EAAE;AACL,IAAA,MAAM,EAAE;AACN,MAAA,OADM,mBACG,MADH,EACW,MADX,EACiB;AACrB,YAAI,MAAM,KAAK,MAAf,EAAuB;AACrB,eAAK,gBAAL,CAAsB,MAAtB,GAA+B,KAAK,MAApC;AACD;AACF,OALK;AAMN,MAAA,SAAS,EAAE;AANL;AADH;AA/EwC,CAA/B,CAAlB;;eA2Fe,S","sourcesContent":["import Vue from 'vue'\nimport { PropValidator, RenderContext } from 'vue/types/options'\n\n/* eslint-disable-next-line no-use-before-define */\ninterface Themeable extends Vue {\n theme: {\n isDark: boolean\n }\n}\n\nexport function functionalThemeClasses (context: RenderContext): object {\n const vm = {\n ...context.props,\n ...context.injections,\n }\n const isDark = Themeable.options.computed.isDark.call(vm)\n return Themeable.options.computed.themeClasses.call({ isDark })\n}\n\n/* @vue/component */\nconst Themeable = Vue.extend().extend({\n name: 'themeable',\n\n provide (): object {\n return {\n theme: this.themeableProvide,\n }\n },\n\n inject: {\n theme: {\n default: {\n isDark: false,\n },\n },\n },\n\n props: {\n dark: {\n type: Boolean,\n default: null,\n } as PropValidator,\n light: {\n type: Boolean,\n default: null,\n } as PropValidator,\n },\n\n data () {\n return {\n themeableProvide: {\n isDark: false,\n },\n }\n },\n\n computed: {\n appIsDark (): boolean {\n return this.$vuetify.theme.dark || false\n },\n isDark (): boolean {\n if (this.dark === true) {\n // explicitly dark\n return true\n } else if (this.light === true) {\n // explicitly light\n return false\n } else {\n // inherit from parent, or default false if there is none\n return this.theme.isDark\n }\n },\n themeClasses (): object {\n return {\n 'theme--dark': this.isDark,\n 'theme--light': !this.isDark,\n }\n },\n /** Used by menus and dialogs, inherits from v-app instead of the parent */\n rootIsDark (): boolean {\n if (this.dark === true) {\n // explicitly dark\n return true\n } else if (this.light === true) {\n // explicitly light\n return false\n } else {\n // inherit from v-app\n return this.appIsDark\n }\n },\n rootThemeClasses (): Dictionary {\n return {\n 'theme--dark': this.rootIsDark,\n 'theme--light': !this.rootIsDark,\n }\n },\n },\n\n watch: {\n isDark: {\n handler (newVal, oldVal) {\n if (newVal !== oldVal) {\n this.themeableProvide.isDark = this.isDark\n }\n },\n immediate: true,\n },\n },\n})\n\nexport default Themeable\n"],"sourceRoot":"","file":"index.js"}