{"version":3,"sources":["../src/i18n.ts"],"names":[],"mappings":";;;AAwBO,SAAS,cAAA,CACd,QAAA,EACA,GAAA,EACA,YAAA,EACQ;AACR,EAAA,IAAI,YAAY,MAAA,CAAO,SAAA,CAAU,eAAe,IAAA,CAAK,QAAA,EAAU,GAAG,CAAA,EAAG;AACnE,IAAA,MAAM,KAAA,GAAQ,SAAS,GAAG,CAAA;AAC1B,IAAA,IAAI,OAAO,KAAA,KAAU,QAAA,IAAY,KAAA,CAAM,MAAA,GAAS,GAAG,OAAO,KAAA;AAAA,EAC5D;AACA,EAAA,OAAO,YAAA;AACT","file":"i18n.cjs","sourcesContent":["/**\n * @oshon-ai/primitives — i18n message-slot skeleton.\n *\n * Phase 3a ships the *contract* so primitives never inline user-visible\n * strings (principle #11). A full `LocaleContext` + ICU-powered runtime\n * lands in Phase 5; for now primitives take a `messages` prop and read\n * keys through `resolveMessage()`. Default text lives at the call site\n * with the primitive and is the English fallback.\n */\n\n/**\n * Shape of the `messages` prop every primitive exposes. Keys are\n * primitive-specific and documented in each manifest's `slots`.\n */\nexport type MessageBag = Readonly<Record<string, string>>;\n\n/**\n * Resolve a message key against a (possibly undefined) override bag,\n * falling back to the supplied default. Primitives call this for every\n * user-visible string.\n *\n * @example\n *   const closeLabel = resolveMessage(messages, 'close', 'Close');\n */\nexport function resolveMessage(\n  messages: MessageBag | undefined,\n  key: string,\n  defaultValue: string,\n): string {\n  if (messages && Object.prototype.hasOwnProperty.call(messages, key)) {\n    const value = messages[key];\n    if (typeof value === 'string' && value.length > 0) return value;\n  }\n  return defaultValue;\n}\n"]}