{"version":3,"file":"eventHandlerContext.mjs","names":[],"sources":["../../../../../../../src/lib/remote/eventHandlerContext.ts"],"sourcesContent":["import { createCascade, type CtxCascadeApi } from \"context\";\n\nexport interface EventHandlerContext {\n  remoteEvent?: {\n    type: string;\n  };\n  [key: string]: unknown;\n}\n\n/*\n * `@mittwald/flow-remote-elements` looks the instance up under this key instead\n * of importing it (`FlowRemoteElement.ts`). A cascade only works as one instance.\n */\nconst eventHandlerContextKey = Symbol.for(\n  \"@mittwald/flow-remote-elements/eventHandlerContext\",\n);\n\ntype EventHandlerContextRegistry = Partial<\n  Record<typeof eventHandlerContextKey, CtxCascadeApi<EventHandlerContext>>\n>;\n\nconst registry = globalThis as EventHandlerContextRegistry;\n\nexport const eventHandlerContext: CtxCascadeApi<EventHandlerContext> =\n  (registry[eventHandlerContextKey] ??= createCascade<EventHandlerContext>());\n\nexport const getRemoteEvent = () => eventHandlerContext.use()?.remoteEvent;\n"],"mappings":";;;;AAaA,IAAM,yBAAyB,OAAO,IACpC,oDACF;AAMA,IAAM,WAAW;AAEjB,IAAa,sBACV,SAAS,4BAA4B,cAAmC;AAE3E,IAAa,uBAAuB,oBAAoB,IAAI,CAAC,EAAE"}