{"version":3,"file":"install.mjs","sources":["../../../../../packages/utils/vue/install.ts"],"sourcesContent":["import { NOOP } from '../functions'\n\nimport type { App, Directive } from 'vue'\nimport type { SFCInstallWithContext, SFCWithInstall } from './typescript'\n\nexport const withInstall = >(\n main: T,\n extra?: E\n) => {\n ;(main as SFCWithInstall).install = (app): void => {\n for (const comp of [main, ...Object.values(extra ?? {})]) {\n app.component(comp.name, comp)\n }\n }\n\n if (extra) {\n for (const [key, comp] of Object.entries(extra)) {\n ;(main as any)[key] = comp\n }\n }\n return main as SFCWithInstall & E\n}\n\nexport const withInstallFunction = (fn: T, name: string) => {\n ;(fn as SFCWithInstall).install = (app: App) => {\n ;(fn as SFCInstallWithContext)._context = app._context\n app.config.globalProperties[name] = fn\n }\n\n return fn as SFCInstallWithContext\n}\n\nexport const withInstallDirective = (\n directive: T,\n name: string\n) => {\n ;(directive as SFCWithInstall).install = (app: App): void => {\n app.directive(name, directive)\n }\n\n return directive as SFCWithInstall\n}\n\nexport const withNoopInstall = (component: T) => {\n ;(component as SFCWithInstall).install = NOOP\n\n return component as SFCWithInstall\n}\n"],"names":[],"mappings":";;;AACY,MAAC,WAAW,GAAG,CAAC,IAAI,EAAE,KAAK,KAAK;AAC5C,EAAE,CAAC;AACH,EAAE,IAAI,CAAC,OAAO,GAAG,CAAC,GAAG,KAAK;AAC1B,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,IAAI,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,IAAI,IAAI,GAAG,KAAK,GAAG,EAAE,CAAC,CAAC,EAAE;AAC7E,MAAM,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACrC,KAAK;AACL,GAAG,CAAC;AACJ,EAAE,IAAI,KAAK,EAAE;AACb,IAAI,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;AACrD,MAAM,CAAC;AACP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