{"version":3,"sources":["../../../src/react-lazy/index.tsx"],"sourcesContent":["\"use client\";\n\n// @ai-matrx/associations/react/lazy — the PACKAGE-OWNED split entry.\n//\n// THE PROBLEM this closes (C23 § framework differences): `/react` is one\n// chunk. A surface that statically imports a single card pulls the whole\n// faces bundle — every picker, the comment thread, the window shell — into\n// whatever route bundle it lands in. Hosts were solving that themselves,\n// each with its own hand-written `next/dynamic({ ssr: false })` glue per\n// component. The split is a package concern, so the package ships it.\n//\n// Every export here is the SAME component under the same props, behind a\n// real lazy edge: the body arrives only when the component first renders.\n//\n//   import { AssociationCardGrid } from \"@ai-matrx/associations/react/lazy\";\n//\n// MECHANISM: the loader dynamic-imports this package's OWN `/react` subpath\n// by name. That specifier stays external in our build, so the CONSUMER's\n// bundler (Next/webpack, Vite/rollup) resolves it and emits the real chunk —\n// exactly what a host's `next/dynamic` was doing, minus the host code and\n// minus the `next` dependency. No framework import is involved, so Next,\n// Vite, the Tauri shell and Jest all behave identically.\n//\n// SSR: these faces are `\"use client\"` and are all opened by a user gesture,\n// so the loader fires client-side and no server render ever reaches them —\n// the reason hosts wrote `ssr: false` disappears rather than being ported.\n//\n// Not lazy, deliberately: `AssociationsProvider`, the hooks, and the\n// registry/`contentRoles` helpers. Those are boot-time and light; a lazy\n// provider would suspend the whole tree.\n\nimport { Suspense, lazy, type ComponentType, type ReactNode } from \"react\";\n\nimport type {\n  AssociationCardGridProps,\n  AssociationCardProps,\n  AssociationListProps,\n  AssociationCaptureToolbarProps,\n  AssociationEntitySelectProps,\n  AssociationWindowProps,\n  AttachedItemsSheetProps,\n  CategorySelectProps,\n  CategoryTagPickerProps,\n  CommentThreadProps,\n  UniversalAssociationPickerProps,\n} from \"../react/index\";\nimport type { AssociationPickerProps } from \"../ports\";\n\n/** The one dynamic edge — every face rides it, so there is one chunk. */\nconst faces = () => import(\"@ai-matrx/associations/react\");\n\nfunction split<P extends object>(\n  pick: (m: Awaited<ReturnType<typeof faces>>) => ComponentType<P>,\n  fallback?: ReactNode,\n): ComponentType<P> {\n  const Loaded = lazy(async () => ({ default: pick(await faces()) }));\n  return function LazyFace(props: P) {\n    return (\n      <Suspense fallback={fallback ?? null}>\n        <Loaded {...props} />\n      </Suspense>\n    );\n  };\n}\n\nexport const AssociationWindow = split<AssociationWindowProps>(\n  (m) => m.AssociationWindow,\n);\nexport const AssociationPicker = split<AssociationPickerProps>(\n  (m) => m.AssociationPicker,\n);\nexport const UniversalAssociationPicker =\n  split<UniversalAssociationPickerProps>((m) => m.UniversalAssociationPicker);\nexport const AttachedItemsSheet = split<AttachedItemsSheetProps>(\n  (m) => m.AttachedItemsSheet,\n);\nexport const AssociationCard = split<AssociationCardProps>(\n  (m) => m.AssociationCard,\n);\nexport const AssociationCardGrid = split<AssociationCardGridProps>(\n  (m) => m.AssociationCardGrid,\n);\nexport const AssociationList = split<AssociationListProps>(\n  (m) => m.AssociationList,\n);\nexport const AssociationCaptureToolbar = split<AssociationCaptureToolbarProps>(\n  (m) => m.AssociationCaptureToolbar,\n);\nexport const AssociationEntitySelect = split<AssociationEntitySelectProps>(\n  (m) => m.AssociationEntitySelect,\n);\nexport const CategorySelect = split<CategorySelectProps>(\n  (m) => m.CategorySelect,\n);\nexport const CategoryTagPicker = split<CategoryTagPickerProps>(\n  (m) => m.CategoryTagPicker,\n);\nexport const CommentThread = split<CommentThreadProps>((m) => m.CommentThread);\n\nexport type {\n  AssociationCardGridProps,\n  AssociationCardProps,\n  AssociationListProps,\n  AssociationCaptureToolbarProps,\n  AssociationEntitySelectProps,\n  AssociationPickerProps,\n  AssociationWindowProps,\n  AttachedItemsSheetProps,\n  CategorySelectProps,\n  CategoryTagPickerProps,\n  CommentThreadProps,\n  UniversalAssociationPickerProps,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA+BA,mBAAmE;AA4B3D;AAVR,IAAM,QAAQ,MAAM,OAAO,8BAA8B;AAEzD,SAAS,MACP,MACA,UACkB;AAClB,QAAM,aAAS,mBAAK,aAAa,EAAE,SAAS,KAAK,MAAM,MAAM,CAAC,EAAE,EAAE;AAClE,SAAO,SAAS,SAAS,OAAU;AACjC,WACE,4CAAC,yBAAS,UAAU,YAAY,MAC9B,sDAAC,UAAQ,GAAG,OAAO,GACrB;AAAA,EAEJ;AACF;AAEO,IAAM,oBAAoB;AAAA,EAC/B,CAAC,MAAM,EAAE;AACX;AACO,IAAM,oBAAoB;AAAA,EAC/B,CAAC,MAAM,EAAE;AACX;AACO,IAAM,6BACX,MAAuC,CAAC,MAAM,EAAE,0BAA0B;AACrE,IAAM,qBAAqB;AAAA,EAChC,CAAC,MAAM,EAAE;AACX;AACO,IAAM,kBAAkB;AAAA,EAC7B,CAAC,MAAM,EAAE;AACX;AACO,IAAM,sBAAsB;AAAA,EACjC,CAAC,MAAM,EAAE;AACX;AACO,IAAM,kBAAkB;AAAA,EAC7B,CAAC,MAAM,EAAE;AACX;AACO,IAAM,4BAA4B;AAAA,EACvC,CAAC,MAAM,EAAE;AACX;AACO,IAAM,0BAA0B;AAAA,EACrC,CAAC,MAAM,EAAE;AACX;AACO,IAAM,iBAAiB;AAAA,EAC5B,CAAC,MAAM,EAAE;AACX;AACO,IAAM,oBAAoB;AAAA,EAC/B,CAAC,MAAM,EAAE;AACX;AACO,IAAM,gBAAgB,MAA0B,CAAC,MAAM,EAAE,aAAa;","names":[]}