{"version":3,"sources":["../src/bridges/index.tsx","../src/components/index.tsx","../src/pages/index.tsx"],"names":["jsx","Card","jsxs","Spinner","Component","Alert","Button","toast","useRef","useMemo","useEffect","ToastProvider","ReferenceAdapterCard","ReferenceAdapterConfigForm","ReferenceAdapterList","ReferenceAdapterStatusBadge","ReferenceAdapterDetailPage","ReferenceAdaptersPage"],"mappings":";;;;;;;;AAqEO,SAAS,aAAA,CAAc;AAAA,EAC5B,OAAA;AAAA,EACA,SAAA;AAAA,EACA,KAAA,GAAQ,kBAAA;AAAA,EACR,WAAA;AAAA,EACA,QAAA;AAAA,EACA,SAAA;AAAA,EACA,IAAA,GAAO,IAAA;AAAA,EACP,YAAA,GAAe;AACjB,CAAA,EAAoC;AAClC,EAAA,MAAM,MAAA,GAAS,aAAa,OAAA,IAAW,IAAA;AAEvC,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,6DAAU,QAAA,EAAS,CAAA;AAAA,EACrB;AAEA,EAAA,uBACEA,cAAA;AAAA,IAACC,YAAA;AAAA,IAAA;AAAA,MACC,SAAA;AAAA,MACA,IAAA,EAAK,QAAA;AAAA,MACL,WAAA,EAAU,QAAA;AAAA,MACV,aAAA,EAAY,mCAAA;AAAA,MAEZ,QAAA,kBAAAC,eAAA,CAACD,YAAA,CAAK,OAAA,EAAL,EAAa,WAAU,6BAAA,EACtB,QAAA,EAAA;AAAA,wBAAAD,cAAA,CAACG,eAAA,EAAA,EAAQ,IAAA,EAAY,KAAA,EAAO,YAAA,EAAc,eAAY,MAAA,EAAO,CAAA;AAAA,wBAC7DD,eAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,SAAA,EACd,QAAA,EAAA;AAAA,0BAAAF,cAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,2BAAA,EAA6B,QAAA,EAAA,KAAA,EAAM,CAAA;AAAA,UAClD,8BACCA,cAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,gCAAA,EACb,uBACH,CAAA,GACE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KAAA,EAA+B;AAC/D,EAAA,uBAAOf,cAAAA,CAACgB,uBAAA,EAAA,EAA4B,GAAG,KAAA,EAAO,CAAA;AAChD;AAEO,SAAS,aAAa,KAAA,EAA0B;AACrD,EAAA,uBAAOhB,cAAAA,CAACiB,kBAAA,EAAA,EAAuB,GAAG,KAAA,EAAO,CAAA;AAC3C","file":"index.cjs","sourcesContent":["/**\n * @module bridges\n * @package @geenius/adapters/react-heroui\n * @description HeroUI-native bridge components for adapter loading, error,\n * and notification surfaces. The adapter contract stays in the React package;\n * this module only adds HeroUI rendering affordances.\n */\n\n\"use client\";\n\nimport {\n  Alert,\n  Button,\n  Card,\n  Spinner,\n  ToastProvider,\n  toast,\n} from \"@heroui/react\";\nimport {\n  Component,\n  type ComponentProps,\n  type ErrorInfo,\n  type JSX,\n  type ReactNode,\n  useEffect,\n  useMemo,\n  useRef,\n} from \"react\";\n\ntype SpinnerSize = ComponentProps<typeof Spinner>[\"size\"];\ntype SpinnerColor = ComponentProps<typeof Spinner>[\"color\"];\ntype ToastPlacement = ComponentProps<typeof ToastProvider>[\"placement\"];\ntype ToastStatus =\n  | \"default\"\n  | \"info\"\n  | \"success\"\n  | \"warning\"\n  | \"danger\"\n  | \"error\";\n\n/**\n * Props accepted by the HeroUI loading bridge.\n *\n * @property loading Optional loading flag. Defaults to `true` when omitted.\n * @property isLoading Alias for `loading` used by async adapter states.\n * @property label Primary loading message.\n * @property description Optional supporting loading message.\n * @property children Content rendered when loading is explicitly false.\n * @property className Optional class name passed to the HeroUI card.\n * @property size HeroUI spinner size.\n * @property spinnerColor HeroUI spinner color.\n */\nexport interface LoadingBridgeProps {\n  loading?: boolean;\n  isLoading?: boolean;\n  label?: ReactNode;\n  description?: ReactNode;\n  children?: ReactNode;\n  className?: string;\n  size?: SpinnerSize;\n  spinnerColor?: SpinnerColor;\n}\n\n/**\n * Renders a HeroUI loading surface for async adapter initialization.\n *\n * @param props Loading bridge props.\n * @returns A HeroUI card containing a spinner, or children when loading is false.\n */\nexport function LoadingBridge({\n  loading,\n  isLoading,\n  label = \"Loading adapters\",\n  description,\n  children,\n  className,\n  size = \"md\",\n  spinnerColor = \"current\",\n}: LoadingBridgeProps): JSX.Element {\n  const active = isLoading ?? loading ?? true;\n\n  if (!active) {\n    return <>{children}</>;\n  }\n\n  return (\n    <Card\n      className={className}\n      role=\"status\"\n      aria-live=\"polite\"\n      data-testid=\"gn-adapters-heroui-loading-bridge\"\n    >\n      <Card.Content className=\"flex items-center gap-3 p-4\">\n        <Spinner size={size} color={spinnerColor} aria-hidden=\"true\" />\n        <span className=\"min-w-0\">\n          <span className=\"block text-sm font-medium\">{label}</span>\n          {description ? (\n            <span className=\"block text-xs text-default-500\">\n              {description}\n            </span>\n          ) : null}\n        </span>\n      </Card.Content>\n    </Card>\n  );\n}\n\nfunction normalizeError(error: unknown): Error {\n  if (error instanceof Error) {\n    return error;\n  }\n\n  return new Error(typeof error === \"string\" ? error : \"Adapter bridge error\");\n}\n\n/**\n * Props accepted by the HeroUI error boundary bridge.\n *\n * @property children Child subtree protected by the boundary.\n * @property error Optional controlled error for async adapter workflows.\n * @property title Error alert title.\n * @property actionLabel Reset button label.\n * @property fallback Optional custom fallback node or render function.\n * @property onError Called when a child render error is caught.\n * @property onReset Called when the reset action clears a caught error.\n * @property className Optional class name passed to the HeroUI alert.\n */\nexport interface ErrorBoundaryBridgeProps {\n  children?: ReactNode;\n  error?: unknown;\n  title?: ReactNode;\n  actionLabel?: ReactNode;\n  fallback?: ReactNode | ((error: Error, reset: () => void) => ReactNode);\n  onError?: (error: Error, errorInfo: ErrorInfo) => void;\n  onReset?: () => void;\n  className?: string;\n}\n\ninterface ErrorBoundaryBridgeState {\n  caughtError: Error | null;\n}\n\n/**\n * Catches React render failures and displays them with HeroUI alert primitives.\n */\nexport class ErrorBoundaryBridge extends Component<\n  ErrorBoundaryBridgeProps,\n  ErrorBoundaryBridgeState\n> {\n  state: ErrorBoundaryBridgeState = {\n    caughtError: null,\n  };\n\n  componentDidCatch(error: Error, errorInfo: ErrorInfo): void {\n    const normalizedError = normalizeError(error);\n    this.setState({ caughtError: normalizedError });\n    this.props.onError?.(normalizedError, errorInfo);\n  }\n\n  private reset = (): void => {\n    this.setState({ caughtError: null });\n    this.props.onReset?.();\n  };\n\n  render(): ReactNode {\n    const error =\n      this.props.error !== undefined\n        ? normalizeError(this.props.error)\n        : this.state.caughtError;\n\n    if (!error) {\n      return this.props.children;\n    }\n\n    if (typeof this.props.fallback === \"function\") {\n      return this.props.fallback(error, this.reset);\n    }\n\n    if (this.props.fallback) {\n      return this.props.fallback;\n    }\n\n    return (\n      <Alert\n        status=\"danger\"\n        className={this.props.className}\n        role=\"alert\"\n        data-testid=\"gn-adapters-heroui-error-bridge\"\n      >\n        <Alert.Content>\n          <Alert.Title>{this.props.title ?? \"Adapter error\"}</Alert.Title>\n          <Alert.Description>{error.message}</Alert.Description>\n          <Button\n            type=\"button\"\n            size=\"sm\"\n            variant=\"danger-soft\"\n            onPress={this.reset}\n          >\n            {this.props.actionLabel ?? \"Retry\"}\n          </Button>\n        </Alert.Content>\n      </Alert>\n    );\n  }\n}\n\nfunction toastNodeKey(value: ReactNode): string {\n  if (value === null || value === undefined || typeof value === \"boolean\") {\n    return \"\";\n  }\n\n  if (typeof value === \"string\" || typeof value === \"number\") {\n    return String(value);\n  }\n\n  return \"react-node\";\n}\n\nfunction showToast(\n  status: ToastStatus,\n  message: ReactNode,\n  options: {\n    description?: ReactNode;\n    timeout?: number;\n    onClose?: () => void;\n  },\n): string {\n  if (status === \"success\") {\n    return toast.success(message, options);\n  }\n  if (status === \"warning\") {\n    return toast.warning(message, options);\n  }\n  if (status === \"danger\" || status === \"error\") {\n    return toast.danger(message, options);\n  }\n  if (status === \"info\") {\n    return toast.info(message, options);\n  }\n\n  return toast(message, { ...options, variant: \"default\" });\n}\n\n/**\n * Props accepted by the HeroUI toast bridge.\n *\n * @property children Optional subtree rendered inside the HeroUI toast provider.\n * @property message Declarative toast message to emit when `open` is true.\n * @property description Optional toast description.\n * @property status Toast severity.\n * @property open Whether the toast should be emitted.\n * @property toastKey Stable dedupe key for repeated declarative renders.\n * @property timeout Optional toast timeout in milliseconds.\n * @property onClose Called by HeroUI when the toast closes.\n * @property onShown Receives the HeroUI toast id after emission.\n * @property placement HeroUI toast placement.\n * @property className Optional class name passed to the HeroUI provider.\n */\nexport interface ToastBridgeProps {\n  children?: ReactNode;\n  message?: ReactNode;\n  description?: ReactNode;\n  status?: ToastStatus;\n  open?: boolean;\n  toastKey?: string;\n  timeout?: number;\n  onClose?: () => void;\n  onShown?: (toastId: string) => void;\n  placement?: ToastPlacement;\n  className?: string;\n}\n\n/**\n * Provides HeroUI toast rendering and optionally emits a declarative toast.\n *\n * @param props Toast bridge props.\n * @returns A HeroUI toast provider wrapping optional children.\n */\nexport function ToastBridge({\n  children,\n  message,\n  description,\n  status = \"default\",\n  open = false,\n  toastKey,\n  timeout,\n  onClose,\n  onShown,\n  placement = \"bottom end\",\n  className,\n}: ToastBridgeProps): JSX.Element {\n  const emittedKeyRef = useRef<string | null>(null);\n  const dedupeKey = useMemo(\n    () =>\n      toastKey ??\n      [status, toastNodeKey(message), toastNodeKey(description)].join(\":\"),\n    [description, message, status, toastKey],\n  );\n\n  useEffect(() => {\n    if (!open) {\n      emittedKeyRef.current = null;\n      return;\n    }\n\n    if (message === undefined || message === null) {\n      return;\n    }\n\n    if (emittedKeyRef.current === dedupeKey) {\n      return;\n    }\n\n    emittedKeyRef.current = dedupeKey;\n    const toastId = showToast(status, message, {\n      description,\n      timeout,\n      onClose,\n    });\n    onShown?.(toastId);\n  }, [\n    dedupeKey,\n    description,\n    message,\n    onClose,\n    onShown,\n    open,\n    status,\n    timeout,\n  ]);\n\n  return (\n    <ToastProvider\n      placement={placement}\n      className={className}\n      data-testid=\"gn-adapters-heroui-toast-bridge\"\n    >\n      {children}\n    </ToastProvider>\n  );\n}\n","/**\n * @module components\n * @package @geenius/adapters/react-heroui\n * @description Public HeroUI component wrappers for the React adapter\n * reference surface.\n */\n\n\"use client\";\n\nimport {\n  type AdapterCardProps,\n  type AdapterConfigFormProps,\n  type AdapterListProps,\n  type AdapterStatusBadgeProps,\n  AdapterCard as ReferenceAdapterCard,\n  AdapterConfigForm as ReferenceAdapterConfigForm,\n  AdapterList as ReferenceAdapterList,\n  AdapterStatusBadge as ReferenceAdapterStatusBadge,\n} from \"@geenius/adapters/react\";\n\nexport type {\n  AdapterCardProps,\n  AdapterConfigFormProps,\n  AdapterListProps,\n  AdapterStatusBadgeProps,\n};\n\nexport function AdapterCard(props: AdapterCardProps) {\n  return <ReferenceAdapterCard {...props} />;\n}\n\nexport function AdapterConfigForm(props: AdapterConfigFormProps) {\n  return <ReferenceAdapterConfigForm {...props} />;\n}\n\nexport function AdapterList(props: AdapterListProps) {\n  return <ReferenceAdapterList {...props} />;\n}\n\nexport function AdapterStatusBadge(props: AdapterStatusBadgeProps) {\n  return <ReferenceAdapterStatusBadge {...props} />;\n}\n","/**\n * @module pages\n * @package @geenius/adapters/react-heroui\n * @description Public HeroUI page wrappers for the React adapter reference\n * surface.\n */\n\n\"use client\";\n\nimport {\n  type AdapterDetailPageProps,\n  type AdaptersPageProps,\n  AdapterDetailPage as ReferenceAdapterDetailPage,\n  AdaptersPage as ReferenceAdaptersPage,\n} from \"@geenius/adapters/react\";\n\nexport type { AdapterDetailPageProps, AdaptersPageProps };\n\nexport function AdapterDetailPage(props: AdapterDetailPageProps) {\n  return <ReferenceAdapterDetailPage {...props} />;\n}\n\nexport function AdaptersPage(props: AdaptersPageProps) {\n  return <ReferenceAdaptersPage {...props} />;\n}\n"]}