{"version":3,"sources":["../../src/__generated__/codegen/fragment-masking.ts"],"names":["useFragment","_documentNode","fragmentType","makeFragmentData","data","_fragment","isFragmentReady","queryNode","fragmentNode","_a","_b","_c","deferredFields","fragName","fields","field"],"mappings":"AAwDO,kFAASA,CAAAA,CACdC,CAAAA,CACAC,CAAAA,CACgE,CAChE,OAAOA,CACT,CAGO,SAASC,CAAAA,CAGdC,CAAAA,CAAUC,CAAAA,CAA+B,CACzC,OAAOD,CACT,CACO,SAASE,CAAAA,CACdC,CAAAA,CACAC,CAAAA,CACAJ,CAAAA,CAC2C,CA1E7C,IAAAK,CAAAA,CAAAC,CAAAA,CAAAC,CAAAA,CA2EE,IAAMC,CAAAA,CAAAA,CAAiBH,CAAAA,CAAAF,CAAAA,CAAU,QAAA,CAAA,EAAV,IAAA,CAAA,KAAA,CAAA,CAAAE,CAAAA,CAAoB,cAAA,CACrCI,CAAAA,CAAAA,CAAWH,CAAAA,CAAAF,CAAAA,CAAa,QAAA,CAAA,EAAb,IAAA,CAAA,KAAA,CAAA,CAAAE,CAAAA,CAAuB,YAAA,CAExC,EAAA,CAAI,CAACE,CAAAA,EAAkB,CAACC,CAAAA,CAAU,MAAO,CAAA,CAAA,CAEzC,IAAMC,CAAAA,CAAAA,CAASH,CAAAA,CAAAC,CAAAA,CAAeC,CAAQ,CAAA,CAAA,EAAvB,IAAA,CAAAF,CAAAA,CAA4B,CAAC,CAAA,CAC5C,OAAOG,CAAAA,CAAO,MAAA,CAAS,CAAA,EAAKA,CAAAA,CAAO,KAAA,CAAMC,CAAAA,EAASX,CAAAA,EAAQW,EAAAA,GAASX,CAAI,CACzE,CAAA,4CAAA","file":"/home/renatorib/p/publissue/packages/api/dist/__chunks/EFJEAJ5H.cjs","sourcesContent":["/* eslint-disable */\nimport { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core';\nimport { Incremental, TypedDocumentString } from './graphql';\n\n\nexport type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>> = TDocumentType extends DocumentTypeDecoration<\n  infer TType,\n  any\n>\n  ? [TType] extends [{ ' $fragmentName'?: infer TKey }]\n    ? TKey extends string\n      ? { ' $fragmentRefs'?: { [key in TKey]: TType } }\n      : never\n    : never\n  : never;\n\n// return non-nullable if `fragmentType` is non-nullable\nexport function useFragment<TType>(\n  _documentNode: DocumentTypeDecoration<TType, any>,\n  fragmentType: FragmentType<DocumentTypeDecoration<TType, any>>\n): TType;\n// return nullable if `fragmentType` is undefined\nexport function useFragment<TType>(\n  _documentNode: DocumentTypeDecoration<TType, any>,\n  fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | undefined\n): TType | undefined;\n// return nullable if `fragmentType` is nullable\nexport function useFragment<TType>(\n  _documentNode: DocumentTypeDecoration<TType, any>,\n  fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null\n): TType | null;\n// return nullable if `fragmentType` is nullable or undefined\nexport function useFragment<TType>(\n  _documentNode: DocumentTypeDecoration<TType, any>,\n  fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null | undefined\n): TType | null | undefined;\n// return array of non-nullable if `fragmentType` is array of non-nullable\nexport function useFragment<TType>(\n  _documentNode: DocumentTypeDecoration<TType, any>,\n  fragmentType: Array<FragmentType<DocumentTypeDecoration<TType, any>>>\n): Array<TType>;\n// return array of nullable if `fragmentType` is array of nullable\nexport function useFragment<TType>(\n  _documentNode: DocumentTypeDecoration<TType, any>,\n  fragmentType: Array<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined\n): Array<TType> | null | undefined;\n// return readonly array of non-nullable if `fragmentType` is array of non-nullable\nexport function useFragment<TType>(\n  _documentNode: DocumentTypeDecoration<TType, any>,\n  fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>\n): ReadonlyArray<TType>;\n// return readonly array of nullable if `fragmentType` is array of nullable\nexport function useFragment<TType>(\n  _documentNode: DocumentTypeDecoration<TType, any>,\n  fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined\n): ReadonlyArray<TType> | null | undefined;\nexport function useFragment<TType>(\n  _documentNode: DocumentTypeDecoration<TType, any>,\n  fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | Array<FragmentType<DocumentTypeDecoration<TType, any>>> | ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined\n): TType | Array<TType> | ReadonlyArray<TType> | null | undefined {\n  return fragmentType as any;\n}\n\n\nexport function makeFragmentData<\n  F extends DocumentTypeDecoration<any, any>,\n  FT extends ResultOf<F>\n>(data: FT, _fragment: F): FragmentType<F> {\n  return data as FragmentType<F>;\n}\nexport function isFragmentReady<TQuery, TFrag>(\n  queryNode: TypedDocumentString<TQuery, any>,\n  fragmentNode: TypedDocumentString<TFrag, any>,\n  data: FragmentType<TypedDocumentString<Incremental<TFrag>, any>> | null | undefined\n): data is FragmentType<typeof fragmentNode> {\n  const deferredFields = queryNode.__meta__?.deferredFields as Record<string, (keyof TFrag)[]>;\n  const fragName = fragmentNode.__meta__?.fragmentName as string | undefined;\n\n  if (!deferredFields || !fragName) return true;\n\n  const fields = deferredFields[fragName] ?? [];\n  return fields.length > 0 && fields.every(field => data && field in data);\n}\n"]}