{"version":3,"file":"brand.cjs","names":[],"sources":["../../src/utils/brand.ts"],"sourcesContent":["/**\n * The package's single object-branding mechanism: a `Symbol.for`-keyed property stamp.\n *\n * Why `Symbol.for` and not identity checks (`WeakSet`, `instanceof`): `Symbol.for` keys are\n * process-global, so brands survive a duplicated module graph (two copies of ore bundled into\n * one page — the exact failure mode `src/iife.ts`'s header documents). Identity-based checks\n * silently fail across those copies: an object stamped by one graph is invisible to the other.\n * Every branded runtime object in ore (`HTMLResult`, `DirectiveResult`,\n * `LiveBinding`, `CSSResult`) goes through this helper — do not introduce a second mechanism.\n */\n\nexport type Brand<T extends object> = {\n  is: (value: unknown) => value is T;\n  stamp: (obj: T) => T;\n};\n\nexport const makeBrand = <T extends object>(key: string): Brand<T> => {\n  const BRAND = Symbol.for(key);\n  const stamp = (obj: T): T => Object.assign(obj, { [BRAND]: true });\n  const is = (value: unknown): value is T => typeof value === 'object' && value !== null && BRAND in (value as object);\n\n  return { is, stamp };\n};\n"],"mappings":"AAgBA,IAAa,EAA+B,GAA0B,CACpE,IAAM,EAAQ,OAAO,IAAI,CAAG,EAI5B,MAAO,CAAE,GAFG,GAA+B,OAAO,GAAU,YAAY,GAAkB,KAAU,EAEvF,MAHE,GAAc,OAAO,OAAO,EAAK,EAAG,GAAQ,EAAK,CAAC,CAG9C,CACrB"}