{"version":3,"sources":["/home/runner/work/openframe-oss-lib/openframe-oss-lib/openframe-frontend-core/dist/chunk-WLSFBRT5.cjs","../src/embed-shims/next-image.tsx"],"names":[],"mappings":"AAAA,6rBAAY;AACZ;AACA;ACoBA,8BAAiF;AA4CtE,+CAAA;AAtBX,IAAI,KAAA,EAA+B,IAAA;AAQ5B,SAAS,aAAA,CAAiB,SAAA,EAAmC;AAKlE,EAAA,KAAA,EAAO,SAAA;AACT;AAEA,IAAM,MAAA,EAAQ,+BAAA,SAAkD,aAAA,CAAc,KAAA,EAAO,GAAA,EAAK;AAIxF,EAAA,GAAA,CAAI,IAAA,EAAM;AACR,IAAA,MAAM,KAAA,EAAO,IAAA;AACb,IAAA,uBAAO,6BAAA,IAAC,EAAA,EAAK,GAAA,EAAW,GAAG,MAAA,CAAO,CAAA;AAAA,EACpC;AAIA,EAAA,MAAM;AAAA,IACJ,GAAA;AAAA,IACA,GAAA;AAAA,IACA,KAAA;AAAA,IACA,MAAA;AAAA,IACA,IAAA;AAAA,IACA,KAAA,EAAO,MAAA;AAAA,IACP,OAAA,EAAS,QAAA;AAAA,IACT,QAAA,EAAU,SAAA;AAAA,IACV,WAAA,EAAa,YAAA;AAAA,IACb,WAAA,EAAa,YAAA;AAAA,IACb,WAAA,EAAa,YAAA;AAAA,IACb,iBAAA;AAAA,IACA,MAAA,EAAQ,OAAA;AAAA,IACR,KAAA;AAAA,IACA,GAAG;AAAA,EACL,EAAA,EAAI,KAAA;AACJ,EAAA,MAAM,OAAA,EAAS,OAAO,IAAA,IAAQ,SAAA,EAAW,IAAA,kBAAM,GAAA,2BAAK,KAAA;AAUpD,EAAA,MAAM,WAAA,EAAa,KAAA,EACf;AAAA,IACE,QAAA,EAAU,UAAA;AAAA,IACV,KAAA,EAAO,CAAA;AAAA,IACP,KAAA,EAAO,MAAA;AAAA,IACP,MAAA,EAAQ,MAAA;AAAA,IACR,GAAG;AAAA,EACL,EAAA,EACA,KAAA;AACJ,EAAA,uBACE,6BAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,GAAA,EAAK,MAAA;AAAA,MACL,GAAA,mBAAK,GAAA,UAAO,IAAA;AAAA,MACZ,KAAA,EAAO,KAAA,EAAO,KAAA,EAAA,EAAY,KAAA;AAAA,MAC1B,MAAA,EAAQ,KAAA,EAAO,KAAA,EAAA,EAAY,MAAA;AAAA,MAC3B,KAAA,EAAO,UAAA;AAAA,MACP,MAAA,EAAQ,kBAAA,EAAoB,CAAA,CAAA,EAAA,GAAK,iBAAA,CAAkB,CAAA,CAAE,aAAa,EAAA,EAAI,KAAA,CAAA;AAAA,MACrE,GAAG;AAAA,IAAA;AAAA,EACN,CAAA;AAEJ,CAAC,CAAA;AAED,IAAO,mBAAA,EAAQ,KAAA;ADnEf;AACA;AACE;AACA;AACF,uFAAC","file":"/home/runner/work/openframe-oss-lib/openframe-oss-lib/openframe-frontend-core/dist/chunk-WLSFBRT5.cjs","sourcesContent":[null,"/**\n * `next/image` shim — environment-aware Image component.\n *\n * Defaults to a plain `<img>` so non-Next hosts (Vite, CRA, esbuild)\n * work out of the box without aliasing tricks. Next.js hosts can opt\n * into the REAL `next/image` (with Image Optimization) by calling\n * {@link registerImage} ONCE at app init:\n *\n *   // hub: lib/embed-shim-registration.ts\n *   import NextImage from 'next/image'\n *   import { registerImage } from '@flamingo-stack/openframe-frontend-core/embed-shims'\n *   registerImage(NextImage)\n *\n * After registration, every lib component that renders this shim\n * delegates to `NextImage` — full Image Optimization, blur placeholders,\n * priority, etc. Without registration, the shim falls through to the\n * plain `<img>` path that drops Next-specific props.\n *\n * Lib internals import this shim directly (relative path); hub-side\n * code goes through the barrel (`@flamingo-stack/.../embed-shims`).\n */\n'use client';\nimport { forwardRef, type ComponentType, type ImgHTMLAttributes, type Ref } from 'react';\n\ntype ImageProps = Omit<ImgHTMLAttributes<HTMLImageElement>, 'src' | 'placeholder'> & {\n  src?: string | { src: string };\n  alt?: string;\n  width?: number | string;\n  height?: number | string;\n  fill?: boolean;\n  sizes?: string;\n  quality?: number;\n  priority?: boolean;\n  loading?: 'eager' | 'lazy';\n  placeholder?: 'blur' | 'empty' | `data:image/${string}`;\n  blurDataURL?: string;\n  unoptimized?: boolean;\n  onLoadingComplete?: (img: HTMLImageElement) => void;\n  loader?: unknown;\n};\n\n/** What the shim renders once a host has registered `next/image`. */\ntype RegisteredImage = ComponentType<ImageProps & { ref?: Ref<HTMLImageElement> }>;\n\nlet impl: RegisteredImage | null = null;\n\n/**\n * Register the real `next/image` so this shim delegates to it instead\n * of rendering a plain `<img>`. Call ONCE at app init in a Next.js host\n * — subsequent calls overwrite the registration silently. Safe to skip\n * entirely in non-Next environments.\n */\nexport function registerImage<P>(component: ComponentType<P>): void {\n  // The registration contract IS the assertion: the host states that its\n  // component handles the props this shim forwards (`next/image` does). One\n  // narrow assertion here, instead of `any` on the slot and on this\n  // signature, which erased the type for every caller.\n  impl = component as RegisteredImage;\n}\n\nconst Image = forwardRef<HTMLImageElement, ImageProps>(function NextImageShim(props, ref) {\n  // Real impl path — registered by the host. Hand off untouched so\n  // every Next-specific prop (priority, placeholder, sizes, loader…)\n  // reaches the real component intact.\n  if (impl) {\n    const Real = impl;\n    return <Real ref={ref} {...props} />;\n  }\n\n  // Fallback path — plain <img>. Drops Next-only props and reduces\n  // `StaticImageData` src to a string.\n  const {\n    src,\n    alt,\n    width,\n    height,\n    fill,\n    sizes: _sizes,\n    quality: _quality,\n    priority: _priority,\n    placeholder: _placeholder,\n    blurDataURL: _blurDataURL,\n    unoptimized: _unoptimized,\n    onLoadingComplete,\n    loader: _loader,\n    style,\n    ...rest\n  } = props;\n  const srcStr = typeof src === 'string' ? src : src?.src;\n  // Mirrors the real `next/image` fill style EXACTLY, which means no\n  // `objectFit`: Next sets position/inset/size and leaves object-fit to the\n  // caller's className. This shim used to force `objectFit: 'cover'`, and\n  // because an inline style beats a class, every `fill` + `object-contain`\n  // call site (blog-card, entity-portrait-card, onboarding-guide-card,\n  // program-card, og-link-preview, parallax-image-showcase, product-release-card)\n  // silently rendered CROPPED on non-Next hosts and contained on Next ones —\n  // the one divergence a shim must never have. All 20 `fill` call sites in this\n  // library pass an explicit object-fit class, so nothing relied on the default.\n  const finalStyle = fill\n    ? {\n        position: 'absolute' as const,\n        inset: 0,\n        width: '100%',\n        height: '100%',\n        ...style,\n      }\n    : style;\n  return (\n    <img\n      ref={ref}\n      src={srcStr}\n      alt={alt ?? ''}\n      width={fill ? undefined : width}\n      height={fill ? undefined : height}\n      style={finalStyle}\n      onLoad={onLoadingComplete ? e => onLoadingComplete(e.currentTarget) : undefined}\n      {...rest}\n    />\n  );\n});\n\nexport default Image;\n"]}