{"version":3,"file":"applyMixins.mjs","sources":["../../../src/util/applyMixins.ts"],"sourcesContent":["import type { Constructor } from '../typedefs';\n\n/***\n * https://www.typescriptlang.org/docs/handbook/mixins.html#alternative-pattern\n */\nexport function applyMixins<T extends Constructor, S extends Constructor>(\n  derivedCtor: T,\n  constructors: S[],\n) {\n  constructors.forEach((baseCtor) => {\n    Object.getOwnPropertyNames(baseCtor.prototype).forEach((name) => {\n      name !== 'constructor' &&\n        Object.defineProperty(\n          derivedCtor.prototype,\n          name,\n          Object.getOwnPropertyDescriptor(baseCtor.prototype, name) ||\n            Object.create(null),\n        );\n    });\n  });\n  return derivedCtor as T & { prototype: InstanceType<T & S> };\n}\n"],"names":["applyMixins","derivedCtor","constructors","forEach","baseCtor","Object","getOwnPropertyNames","prototype","name","defineProperty","getOwnPropertyDescriptor","create"],"mappings":"AAEA;AACA;AACA;AACO,SAASA,WAAWA,CACzBC,WAAc,EACdC,YAAiB,EACjB;AACAA,EAAAA,YAAY,CAACC,OAAO,CAAEC,QAAQ,IAAK;IACjCC,MAAM,CAACC,mBAAmB,CAACF,QAAQ,CAACG,SAAS,CAAC,CAACJ,OAAO,CAAEK,IAAI,IAAK;AAC/DA,MAAAA,IAAI,KAAK,aAAa,IACpBH,MAAM,CAACI,cAAc,CACnBR,WAAW,CAACM,SAAS,EACrBC,IAAI,EACJH,MAAM,CAACK,wBAAwB,CAACN,QAAQ,CAACG,SAAS,EAAEC,IAAI,CAAC,IACvDH,MAAM,CAACM,MAAM,CAAC,IAAI,CACtB,CAAC,CAAA;AACL,KAAC,CAAC,CAAA;AACJ,GAAC,CAAC,CAAA;AACF,EAAA,OAAOV,WAAW,CAAA;AACpB;;;;"}