{"version":3,"file":"index.mjs","names":["EffectArray","EffectArray","skipToken","call","EffectArray","EffectArray","skipToken","EffectArray","node","options"],"sources":["../src/core/canonical-key.ts","../src/core/metadata-query.ts","../src/core/prepared-input.ts","../src/core/utility-tree.ts","../src/core/schema-key.ts","../src/rpc/errors.ts","../src/core/stream-hash-index.ts","../src/core/stream-publication.ts","../src/core/streamed-query.ts","../src/rpc/streamed-query.ts","../src/rpc/operation.ts","../src/rpc/create-utils.ts","../src/http/errors.ts","../src/http/request.ts","../src/http/streamed-query.ts","../src/http/operation.ts","../src/http/create-utils.ts","../src/core/stream-snapshot.ts","../src/core/view-prefix.ts","../src/core/query-filter.ts","../src/core/hydration.ts","../src/core/stream-recovery.ts","../src/core/configure.ts","../src/core/configure-utils.ts","../src/core/branch-filter.ts","../src/core/declared-error.ts","../src/core/consume-events.ts"],"sourcesContent":["import { Array as EffectArray, Order, Predicate } from \"effect\";\n\nimport type { JsonValue } from \"./types\";\n\nexport const canonicalizeArray = (\n  value: readonly unknown[],\n  seen = new WeakSet()\n): readonly JsonValue[] => {\n  if (seen.has(value)) {\n    throw new TypeError(\"Key values must not contain cycles\");\n  }\n  seen.add(value);\n  const copy: JsonValue[] = [];\n  for (let index = 0; index < value.length; index += 1) {\n    if (!Object.hasOwn(value, index)) {\n      throw new TypeError(\"Key values must not contain sparse arrays\");\n    }\n    // oxlint-disable-next-line eslint/no-use-before-define\n    copy.push(canonicalize(value[index], seen));\n  }\n  seen.delete(value);\n  return Object.freeze(copy);\n};\n\nconst canonicalizeObject = (\n  // oxlint-disable-next-line anti-slop/no-unsafe-dictionary-type\n  value: Record<string, unknown>,\n  seen: WeakSet<object>\n): JsonValue => {\n  const prototype: unknown = Object.getPrototypeOf(value);\n  if (prototype !== Object.prototype && prototype !== null) {\n    throw new TypeError(\"Key values must contain only plain objects\");\n  }\n  const copy: Record<string, JsonValue> = {};\n  for (const key of EffectArray.sort(Object.keys(value), Order.String)) {\n    if (key === \"__proto__\" || key === \"constructor\") {\n      throw new TypeError(\n        \"Key objects must not contain __proto__ or constructor properties\"\n      );\n    }\n    // oxlint-disable-next-line eslint/no-use-before-define\n    copy[key] = canonicalize(value[key], seen);\n  }\n  seen.delete(value);\n  return Object.freeze(copy);\n};\n\n/** Copies strict JSON into the immutable representation used by keys and filters. */\nexport const canonicalize = (\n  // oxlint-disable-next-line anti-slop/no-unknown-parameters\n  value: unknown,\n  seen = new WeakSet()\n): JsonValue => {\n  if (\n    value === null ||\n    Predicate.isString(value) ||\n    Predicate.isBoolean(value)\n  ) {\n    return value;\n  }\n  if (Predicate.isNumber(value)) {\n    if (!Number.isFinite(value)) {\n      throw new TypeError(\"Key values must contain only finite numbers\");\n    }\n    return Object.is(value, -0) ? 0 : value;\n  }\n  if (!Predicate.isObjectOrArray(value)) {\n    throw new TypeError(\"Key values must be JSON-safe\");\n  }\n  if (Array.isArray(value)) {\n    return canonicalizeArray(value, seen);\n  }\n  if (seen.has(value)) {\n    throw new TypeError(\"Key values must not contain cycles\");\n  }\n  seen.add(value);\n  return canonicalizeObject(value, seen);\n};\n","import { replaceEqualDeep } from \"@tanstack/query-core\";\nimport type { QueryFunctionContext } from \"@tanstack/query-core\";\nimport { Exit, Predicate } from \"effect\";\n\nimport type { UnaryOperation } from \"./operation\";\nimport type { RunPromiseExit } from \"./types\";\n\ntype StructuralSharing = (previous: unknown, data: unknown) => unknown;\n\nconst isStructuralSharing = (policy: unknown): policy is StructuralSharing =>\n  Predicate.isFunction(policy);\n\nconst shareQueryData = (previous: unknown, data: unknown, policy: unknown) => {\n  if (policy === false) {\n    return data;\n  }\n  if (isStructuralSharing(policy)) {\n    return policy(previous, data);\n  }\n  return replaceEqualDeep(previous, data);\n};\n\nconst fetchedPolicies = new WeakMap<object, { readonly policy: unknown }>();\n\nexport const preserveMetadataPolicy = <Data>(\n  previous: unknown,\n  data: Data\n): Data => {\n  if (Predicate.isObject(previous) && Predicate.isObject(data)) {\n    const policy = fetchedPolicies.get(previous);\n    if (policy !== undefined) {\n      fetchedPolicies.set(data, policy);\n    }\n  }\n  return data;\n};\n\nexport const prepareMetadataExecution = (\n  description: NonNullable<UnaryOperation[\"metadata\"]>,\n\n  options: Record<string, unknown>,\n  runPromiseExit: RunPromiseExit<unknown>,\n\n  requestOptions: unknown,\n  skipped: boolean\n) => {\n  const hasLocalPolicy = Object.hasOwn(options, \"structuralSharing\");\n  const localPolicy = options[\"structuralSharing\"];\n  if (!skipped) {\n    options[\"structuralSharing\"] = (previous: unknown, data: unknown) => {\n      const produced = Predicate.isObject(data)\n        ? fetchedPolicies.get(data)\n        : undefined;\n      if (Predicate.isObject(data)) {\n        fetchedPolicies.delete(data);\n      }\n      const shared = shareQueryData(\n        previous,\n        data,\n        produced === undefined ? localPolicy : produced.policy\n      );\n      return produced === undefined ? shared : description.finalizeData(shared);\n    };\n  }\n\n  return (input: unknown) =>\n    async ({ client, queryKey, signal }: QueryFunctionContext) => {\n      const policy = hasLocalPolicy\n        ? localPolicy\n        : client.defaultQueryOptions({ queryKey }).structuralSharing;\n      const exit = await runPromiseExit(\n        // oxlint-disable-next-line effecttsgo/any-unknown-in-error-context\n        description.invoke(input, requestOptions),\n        { signal }\n      );\n      if (Exit.isFailure(exit)) {\n        throw description.executionError(\"metadata\", exit.cause);\n      }\n      const data = exit.value === undefined ? null : exit.value;\n      if (Predicate.isObject(data)) {\n        fetchedPolicies.set(data, { policy });\n      }\n      return data;\n    };\n};\n","import type { QueryKey } from \"@tanstack/query-core\";\nimport { Predicate } from \"effect\";\n\nimport { canonicalize } from \"./canonical-key\";\nimport type { InferInput, SupportedQueryView } from \"./inference\";\nimport type { OperationInput, RuntimeKeyEncoder } from \"./operation\";\nimport type { JsonValue } from \"./types\";\n\n/** Opaque, owner-bound preparation. Retained execution input must remain unchanged. */\nexport interface PreparedInput<Input> {\n  readonly \"~effect-api-query/PreparedInput\": { readonly input?: Input };\n}\n\ninterface PreparedValue {\n  readonly owner: OperationInput;\n  readonly input: unknown;\n  readonly keyValue: JsonValue;\n}\nconst values = new WeakMap<object, PreparedValue>();\nconst owners = new WeakMap<\n  () => QueryKey,\n  {\n    readonly input: OperationInput;\n    readonly encoder: RuntimeKeyEncoder | undefined;\n  }\n>();\n\nexport const registerInputOwner = (\n  key: () => QueryKey,\n  input: OperationInput,\n  encoder: RuntimeKeyEncoder | undefined\n) => {\n  owners.set(key, { input, encoder });\n};\n\nexport const inputKind = (key: () => QueryKey) => owners.get(key)?.input._tag;\n\n// oxlint-disable-next-line anti-slop/no-unknown-parameters\nexport const readPreparedInput = (owner: OperationInput, input: unknown) => {\n  const prepared = Predicate.isObject(input) ? values.get(input) : undefined;\n  if (prepared !== undefined && prepared.owner !== owner) {\n    throw new TypeError(\"Prepared input belongs to another utility leaf\");\n  }\n  return prepared;\n};\n\n/** Constructs and encodes once for repeated keys/options on this utility leaf. */\nexport const prepareInput = <Leaf extends { readonly key: () => QueryKey }>(\n  leaf: Leaf & ([SupportedQueryView<Leaf>] extends [never] ? never : unknown),\n  input: InferInput<NoInfer<Leaf>>\n): PreparedInput<InferInput<Leaf>> => {\n  const owner = owners.get(leaf.key);\n  if (owner === undefined || owner.input._tag === \"Inputless\") {\n    throw new TypeError(\n      \"Prepared inputs require a generated input-bearing query leaf\"\n    );\n  }\n  const prepared = owner.input.prepare(input, owner.encoder);\n  let keyValue: JsonValue;\n  try {\n    keyValue = canonicalize(prepared.keyValue);\n  } catch (error) {\n    throw owner.input.invalidKey(error);\n  }\n  const token = Object.freeze({\n    \"~effect-api-query/PreparedInput\": Object.freeze({}),\n  });\n  values.set(token, { owner: owner.input, input: prepared.input, keyValue });\n  return token;\n};\n","import { skipToken } from \"@tanstack/query-core\";\nimport { Array as EffectArray, Effect, Exit, Predicate } from \"effect\";\nimport type { Cause } from \"effect\";\n\nimport { canonicalize, canonicalizeArray } from \"./canonical-key\";\nimport { prepareMetadataExecution } from \"./metadata-query\";\nimport type {\n  BufferedOperation,\n  OperationDescription,\n  QueryPreparation,\n  RuntimeKeyEncoder,\n  StreamingOperation,\n  TreeErrors,\n  UnaryOperation,\n  UnaryQueryOperation,\n} from \"./operation\";\nimport { readPreparedInput, registerInputOwner } from \"./prepared-input\";\nimport type { JsonValue, RunPromiseExit } from \"./types\";\n\nconst reservedPathSegments = new Set([\n  \"__proto__\",\n  \"constructor\",\n  \"infiniteKey\",\n  \"infiniteOptions\",\n  \"key\",\n  \"liveKey\",\n  \"liveOptions\",\n  \"metadataKey\",\n  \"metadataOptions\",\n  \"mutationKey\",\n  \"mutationOptions\",\n  \"prototype\",\n  \"queryKey\",\n  \"queryOptions\",\n  \"streamedKey\",\n  \"streamedOptions\",\n]);\n\ninterface PreparedQuery {\n  readonly input: unknown;\n  readonly key: readonly JsonValue[];\n}\n\ninterface ValidatedOperationPath {\n  readonly operation: OperationDescription;\n  readonly segments: readonly [string, ...string[]];\n}\n\nconst freezeKey = (parts: JsonValue[]) => Object.freeze(parts);\n\nconst normalizePrefix = (\n  prefix: readonly [JsonValue, ...JsonValue[]],\n  errors: TreeErrors\n): readonly JsonValue[] => {\n  if (!Array.isArray(prefix) || prefix.length === 0) {\n    throw errors.invalidPrefix(\"Shape\");\n  }\n\n  try {\n    return canonicalizeArray(prefix);\n  } catch (error) {\n    throw errors.invalidPrefix(\"Value\", error);\n  }\n};\n\nconst planPaths = (\n  operations: readonly OperationDescription[],\n  errors: TreeErrors\n) => {\n  const branchPaths = new Map<string, readonly string[]>();\n  const leafPaths = new Set<string>();\n  const plan: ValidatedOperationPath[] = [];\n\n  for (const operation of operations) {\n    const segments = operation.path;\n    if (\n      !EffectArray.isReadonlyArrayNonEmpty(segments) ||\n      segments.some(\n        (segment) => segment.length === 0 || reservedPathSegments.has(segment)\n      )\n    ) {\n      throw errors.invalidPath(operation.id);\n    }\n    const pathKey = JSON.stringify(segments);\n    if (leafPaths.has(pathKey)) {\n      throw errors.pathCollision(operation.id, segments, \"duplicates\");\n    }\n    const descendantPath = branchPaths.get(pathKey);\n    if (descendantPath !== undefined) {\n      throw errors.pathCollision(operation.id, descendantPath, \"collides with\");\n    }\n    const parents: string[] = [];\n    for (let index = 1; index < segments.length; index += 1) {\n      const parent = segments.slice(0, index);\n      const parentKey = JSON.stringify(parent);\n      if (leafPaths.has(parentKey)) {\n        throw errors.pathCollision(operation.id, parent, \"collides with\");\n      }\n      parents.push(parentKey);\n    }\n    for (const parent of parents) {\n      if (!branchPaths.has(parent)) {\n        branchPaths.set(parent, segments);\n      }\n    }\n    leafPaths.add(pathKey);\n    plan.push({\n      operation,\n      segments,\n    });\n  }\n  return plan;\n};\n\nconst execute = async <Operation extends UnaryQueryOperation | \"metadata\">(\n  description: {\n    readonly invoke: UnaryOperation[\"invoke\"];\n    readonly executionError: (\n      operation: Operation,\n      cause: Cause.Cause<unknown>\n    ) => Error;\n  },\n  operation: Operation,\n\n  input: unknown,\n  runPromiseExit: RunPromiseExit<unknown>,\n\n  requestOptions?: unknown,\n  signal?: AbortSignal\n) => {\n  // oxlint-disable-next-line effecttsgo/any-unknown-in-error-context\n  const effect = description.invoke(input, requestOptions);\n  const exit = await runPromiseExit(\n    // oxlint-disable-next-line effecttsgo/any-unknown-in-error-context\n    effect,\n    signal === undefined ? undefined : { signal }\n  );\n\n  if (Exit.isFailure(exit)) {\n    throw description.executionError(operation, exit.cause);\n  }\n\n  return operation !== \"mutation\" && exit.value === undefined\n    ? null\n    : exit.value;\n};\n\nconst prepareQuery = (\n  description: UnaryOperation | StreamingOperation,\n\n  input: unknown,\n  operationKey: readonly JsonValue[],\n  keyEncoder: RuntimeKeyEncoder | undefined,\n  identity: readonly JsonValue[] = []\n): PreparedQuery => {\n  if (description.input._tag === \"Inputless\") {\n    return {\n      input: undefined,\n      key:\n        identity.length === 0\n          ? operationKey\n          : freezeKey([...operationKey, ...identity]),\n    };\n  }\n  const reused = readPreparedInput(description.input, input);\n  const prepared = reused ?? description.input.prepare(input, keyEncoder);\n  try {\n    return {\n      input: prepared.input,\n      key: freezeKey([\n        ...operationKey,\n        reused === undefined\n          ? canonicalize(prepared.keyValue)\n          : reused.keyValue,\n        ...identity,\n      ]),\n    };\n  } catch (error) {\n    throw description.input.invalidKey(error);\n  }\n};\n\nconst prepareQueryOptions = (\n  description: OperationDescription,\n\n  argument: unknown\n) => {\n  if (argument !== undefined && !Predicate.isObject(argument)) {\n    throw new TypeError(\"Query options must be an object\");\n  }\n  const options = { ...argument };\n  for (const option of [\"queryKeyHashFn\", \"queryHash\"] as const) {\n    if (Object.hasOwn(options, option)) {\n      throw description.unsupportedQueryHash(option);\n    }\n  }\n  const { input } = options;\n  delete options[\"input\"];\n  const requestOptions = description.takeOptions(options);\n  return { input, options, requestOptions };\n};\n\nconst finalizeQueryOptions = <QueryFn>(\n  options: Record<string, unknown>,\n  queryKey: readonly JsonValue[],\n  queryFn: QueryFn\n) => ({\n  ...options,\n  queryFn,\n  queryKey,\n});\n\nconst createQueryBuilders = (\n  description: UnaryOperation | StreamingOperation,\n  operationKey: readonly JsonValue[],\n  keyEncoder: RuntimeKeyEncoder | undefined,\n  prepareOptions: (\n    options: Record<string, unknown>,\n\n    requestOptions: unknown,\n\n    input: unknown\n  ) => QueryPreparation,\n\n  prepareIdentity?: (options: Record<string, unknown>) => readonly JsonValue[]\n) => ({\n  key: (input?: unknown, policy?: Record<string, unknown>) => {\n    const options = description.input._tag === \"Inputless\" ? input : policy;\n    const identity =\n      prepareIdentity?.(Predicate.isObject(options) ? { ...options } : {}) ??\n      [];\n    return prepareQuery(description, input, operationKey, keyEncoder, identity)\n      .key;\n  },\n\n  options: (argument?: unknown) => {\n    const { input, options, requestOptions } = prepareQueryOptions(\n      description,\n      argument\n    );\n    const { identity, makeQuery } = prepareOptions(\n      options,\n      requestOptions,\n      input\n    );\n    if (description.input._tag !== \"Inputless\" && input === skipToken) {\n      return finalizeQueryOptions(options, operationKey, skipToken);\n    }\n    const prepared = prepareQuery(\n      description,\n      input,\n      operationKey,\n      keyEncoder,\n      identity\n    );\n    return finalizeQueryOptions(\n      options,\n      prepared.key,\n      makeQuery(prepared.input)\n    );\n  },\n});\n\nconst createInfiniteBuilders = (\n  description: UnaryOperation,\n  operationKey: readonly JsonValue[],\n  keyEncoder: RuntimeKeyEncoder | undefined,\n  runPromiseExit: RunPromiseExit<unknown>\n) => {\n  const infiniteOperationKey = freezeKey([...operationKey, \"infinite\"]);\n\n  const infiniteKey = (input?: unknown) =>\n    prepareQuery(description, input, infiniteOperationKey, keyEncoder).key;\n\n  const infiniteOptions = (argument: Record<string, unknown>) => {\n    const { input, options, requestOptions } = prepareQueryOptions(\n      description,\n      argument\n    );\n    if (description.input._tag !== \"Inputless\" && input === skipToken) {\n      return finalizeQueryOptions(options, infiniteOperationKey, skipToken);\n    }\n\n    const { initialPageParam } = options;\n    const inputForPage =\n      // oxlint-disable-next-line unicorn/no-useless-undefined\n      description.input._tag === \"Inputless\" ? () => undefined : input;\n    if (!Predicate.isFunction(inputForPage)) {\n      throw new TypeError(\"Infinite query input must be a page input function\");\n    }\n    // oxlint-disable-next-line anti-slop/require-safety-comment-for-type-assertion, typescript/no-unsafe-type-assertion\n    const pageInput = inputForPage as (pageParam: unknown) => unknown;\n    const initialInput = pageInput(initialPageParam);\n    const prepared = prepareQuery(\n      description,\n      initialInput,\n      infiniteOperationKey,\n      keyEncoder\n    );\n\n    return finalizeQueryOptions(\n      options,\n      prepared.key,\n      async ({\n        pageParam,\n        signal,\n      }: {\n        readonly pageParam: unknown;\n        readonly signal: AbortSignal;\n      }) => {\n        const pageRequest = pageInput(pageParam);\n        const executionInput =\n          description.input._tag === \"Input\"\n            ? description.input.pageInput(pageRequest)\n            : undefined;\n        return execute(\n          description,\n          \"infinite\",\n          executionInput,\n          runPromiseExit,\n          requestOptions,\n          signal\n        );\n      }\n    );\n  };\n\n  return { infiniteKey, infiniteOptions };\n};\n\nconst createMutationBuilders = (\n  description: BufferedOperation,\n  operationKey: readonly JsonValue[],\n  runPromiseExit: RunPromiseExit<unknown>\n) => {\n  const mutationKey = freezeKey([...operationKey, \"mutation\"]);\n\n  const mutationOptions = (argument: Record<string, unknown> = {}) => {\n    const options = { ...argument };\n    const requestOptions = description.takeOptions(options);\n    return {\n      ...options,\n\n      mutationFn: async (variables: unknown) =>\n        execute(\n          description,\n          \"mutation\",\n          variables,\n          runPromiseExit,\n          requestOptions\n        ),\n      mutationKey,\n    };\n  };\n  return { mutationKey: () => mutationKey, mutationOptions };\n};\n\nconst createUnaryBuilders = (\n  description: UnaryOperation,\n  operationKey: readonly JsonValue[],\n  keyEncoder: RuntimeKeyEncoder | undefined,\n  runPromiseExit: RunPromiseExit<unknown>\n) => {\n  const queryOperationKey = freezeKey([...operationKey, \"query\"]);\n  const query = createQueryBuilders(\n    description,\n    queryOperationKey,\n    keyEncoder,\n    (_options, requestOptions) => ({\n      identity: [],\n      makeQuery:\n        (input) =>\n        async ({ signal }) =>\n          execute(\n            description,\n            \"query\",\n            input,\n            runPromiseExit,\n            requestOptions,\n            signal\n          ),\n    })\n  );\n  const { metadata } = description;\n  const metadataQuery =\n    metadata === undefined\n      ? undefined\n      : createQueryBuilders(\n          description,\n          freezeKey([...operationKey, \"metadata\"]),\n          keyEncoder,\n          (options, requestOptions, input) => ({\n            identity: [],\n            makeQuery: prepareMetadataExecution(\n              metadata,\n              options,\n              runPromiseExit,\n              requestOptions,\n              description.input._tag !== \"Inputless\" && input === skipToken\n            ),\n          })\n        );\n\n  return {\n    ...createInfiniteBuilders(\n      description,\n      operationKey,\n      keyEncoder,\n      runPromiseExit\n    ),\n    ...createMutationBuilders(description, operationKey, runPromiseExit),\n    queryKey: query.key,\n    queryOptions: query.options,\n    ...(metadataQuery === undefined\n      ? undefined\n      : {\n          metadataKey: metadataQuery.key,\n          metadataOptions: metadataQuery.options,\n        }),\n  };\n};\n\nconst createStreamingBuilders = (\n  description: StreamingOperation,\n  operationKey: readonly JsonValue[],\n  keyEncoder: RuntimeKeyEncoder | undefined,\n  runPromiseExit: RunPromiseExit<unknown>\n) => {\n  const createView = (operation: \"live\" | \"streamed\") => {\n    const prepare = (\n      options: Record<string, unknown>,\n\n      requestOptions?: unknown\n    ) =>\n      description.prepareStream(\n        options,\n        operation,\n        runPromiseExit,\n        requestOptions\n      );\n    return createQueryBuilders(\n      description,\n      freezeKey([...operationKey, operation]),\n      keyEncoder,\n      prepare,\n      (options) => prepare(options).identity\n    );\n  };\n  const live = createView(\"live\");\n  const streamed = createView(\"streamed\");\n\n  return {\n    liveKey: live.key,\n    liveOptions: live.options,\n    streamedKey: streamed.key,\n    streamedOptions: streamed.options,\n  };\n};\n\nconst deepFreezeTree = (value: Record<string, unknown>) => {\n  for (const child of Object.values(value)) {\n    if (Predicate.isObject(child)) {\n      deepFreezeTree(child);\n    }\n  }\n  return Object.freeze(value);\n};\n\nconst validateKeyEncoders = (\n  operations: readonly OperationDescription[],\n  keyEncoders: ReadonlyMap<string, RuntimeKeyEncoder>,\n  errors: TreeErrors\n) => {\n  const supportedIds = new Set(\n    operations\n      .filter(\n        (operation) =>\n          operation.kind !== \"Mutation\" && operation.input._tag !== \"Inputless\"\n      )\n      .map((operation) => operation.id)\n  );\n  for (const id of keyEncoders.keys()) {\n    if (!supportedIds.has(id)) {\n      throw errors.unknownEncoder(id);\n    }\n  }\n  for (const operation of operations) {\n    if (\n      operation.kind !== \"Mutation\" &&\n      operation.input._tag === \"Input\" &&\n      operation.input.requiresEncoder &&\n      !Predicate.isFunction(keyEncoders.get(operation.id))\n    ) {\n      throw errors.missingEncoder(operation.id);\n    }\n  }\n};\n\nconst insertLeaf = (\n  tree: Record<string, unknown>,\n  prefix: readonly JsonValue[],\n  path: ValidatedOperationPath,\n  keyEncoder: RuntimeKeyEncoder | undefined,\n  runPromiseExit: RunPromiseExit<unknown>\n) => {\n  const { segments } = path;\n  const operation =\n    path.operation.kind === \"Mutation\"\n      ? path.operation\n      : { ...path.operation, input: { ...path.operation.input } };\n  let branch = tree;\n  for (let index = 0; index < segments.length - 1; index += 1) {\n    const segment = segments[index];\n    if (segment === undefined) {\n      throw new TypeError(\n        \"Validated operation paths must have defined segments\"\n      );\n    }\n    const candidate = Object.hasOwn(branch, segment)\n      ? branch[segment]\n      : undefined;\n    let child = Predicate.isObject(candidate) ? candidate : undefined;\n    if (child === undefined) {\n      const key = freezeKey([...prefix, ...segments.slice(0, index + 1)]);\n      child = { key: () => key };\n      branch[segment] = child;\n    }\n    branch = child;\n  }\n\n  const leafName = segments.at(-1);\n  if (leafName === undefined) {\n    throw new TypeError(\"Validated operation paths must have a leaf\");\n  }\n  const operationKey = freezeKey([...prefix, ...segments]);\n  let builders;\n  if (operation.kind === \"Mutation\") {\n    builders = createMutationBuilders(operation, operationKey, runPromiseExit);\n  } else if (operation.kind === \"Streaming\") {\n    builders = createStreamingBuilders(\n      operation,\n      operationKey,\n      keyEncoder,\n      runPromiseExit\n    );\n  } else {\n    builders = createUnaryBuilders(\n      operation,\n      operationKey,\n      keyEncoder,\n      runPromiseExit\n    );\n  }\n  const leaf = { key: () => operationKey, ...builders };\n  if (operation.kind !== \"Mutation\") {\n    registerInputOwner(leaf.key, operation.input, keyEncoder);\n  }\n  branch[leafName] = leaf;\n};\n\nconst createTree = (\n  prefix: readonly JsonValue[],\n  paths: readonly ValidatedOperationPath[],\n  keyEncoders: ReadonlyMap<string, RuntimeKeyEncoder>,\n  runPromiseExit: RunPromiseExit<unknown>\n) => {\n  const tree = { key: () => prefix };\n\n  for (const path of paths) {\n    insertLeaf(\n      tree,\n      prefix,\n      path,\n      keyEncoders.get(path.operation.id),\n      runPromiseExit\n    );\n  }\n  return deepFreezeTree(tree);\n};\n\nexport const createUtilityTree = (\n  operations: readonly OperationDescription[],\n  options: {\n    readonly keyPrefix: readonly [JsonValue, ...JsonValue[]];\n    readonly keyNamespace: readonly string[];\n    readonly keyEncoders: ReadonlyMap<string, RuntimeKeyEncoder>;\n    readonly runPromiseExit: RunPromiseExit<unknown> | undefined;\n    readonly errors: TreeErrors;\n  }\n): Record<string, unknown> => {\n  const prefix = freezeKey([\n    ...normalizePrefix(options.keyPrefix, options.errors),\n    ...options.keyNamespace,\n  ]);\n  const paths = planPaths(operations, options.errors);\n  validateKeyEncoders(operations, options.keyEncoders, options.errors);\n  const runner =\n    options.runPromiseExit ??\n    // oxlint-disable-next-line anti-slop/require-safety-comment-for-type-assertion, typescript/no-unsafe-type-assertion\n    (Effect.runPromiseExit as RunPromiseExit<unknown>);\n  return createTree(prefix, paths, options.keyEncoders, runner);\n};\n","import { Function, Predicate, Schema, SchemaAST } from \"effect\";\n\nexport interface SchemaKeyEncoding {\n  readonly requiresEncoder: boolean;\n  readonly cacheable: boolean;\n  // oxlint-disable-next-line anti-slop/no-unknown-parameters, anti-slop/no-unknown-returns\n  readonly encode: (input: unknown) => unknown;\n}\n\nconst safeAsts = new WeakSet();\nconst encodings = new WeakMap<Schema.Top, SchemaKeyEncoding>();\ntype SchemaKeyAnalysis = \"Safe\" | \"RequiresEncoder\" | \"Retry\";\n\nconst inspectKeyEncoding = (\n  // oxlint-disable-next-line anti-slop/no-unknown-parameters\n  value: unknown,\n  seen: Set<object>\n): SchemaKeyAnalysis => {\n  if (\n    !Predicate.isObjectOrArray(value) ||\n    seen.has(value) ||\n    safeAsts.has(value)\n  ) {\n    return \"Safe\";\n  }\n  seen.add(value);\n\n  if (Predicate.hasProperty(value, \"_tag\") && value._tag === \"Middleware\") {\n    return !Predicate.hasProperty(value, \"encode\") ||\n      value.encode !== Function.identity\n      ? \"RequiresEncoder\"\n      : \"Safe\";\n  }\n\n  if (SchemaAST.isAST(value)) {\n    const representation = value.annotations?.[\"representation\"];\n    if (\n      Predicate.hasProperty(representation, \"id\") &&\n      representation.id === \"effect/schema/Redacted\"\n    ) {\n      return \"RequiresEncoder\";\n    }\n    if (SchemaAST.isSuspend(value)) {\n      try {\n        const analysis = inspectKeyEncoding(value.thunk(), seen);\n        if (analysis !== \"Safe\") {\n          return analysis;\n        }\n      } catch {\n        return \"Retry\";\n      }\n    }\n  }\n\n  for (const child of Object.values(value)) {\n    const analysis = inspectKeyEncoding(child, seen);\n    if (analysis !== \"Safe\") {\n      return analysis;\n    }\n  }\n  return \"Safe\";\n};\n\nexport const createSchemaKeyEncoding = (\n  schema: Schema.Top\n): SchemaKeyEncoding => {\n  const cached = encodings.get(schema);\n  if (cached !== undefined) {\n    return cached;\n  }\n  const seen = new Set<object>();\n  const analysis = inspectKeyEncoding(schema.ast, seen);\n  let defaultEncode: SchemaKeyEncoding[\"encode\"] | undefined;\n\n  const encoding: SchemaKeyEncoding = {\n    requiresEncoder: analysis !== \"Safe\",\n    cacheable: analysis !== \"Retry\",\n    encode: (input) => {\n      if (defaultEncode === undefined) {\n        const encodingSchema =\n          // oxlint-disable-next-line anti-slop/no-chained-type-assertions, anti-slop/require-safety-comment-for-type-assertion, typescript/no-unsafe-type-assertion\n          schema as unknown as Schema.ConstraintEncoder<unknown>;\n        defaultEncode = Schema.encodeUnknownSync(encodingSchema);\n      }\n      return defaultEncode(input);\n    },\n  };\n  if (analysis === \"Safe\") {\n    for (const node of seen) {\n      if (SchemaAST.isAST(node)) {\n        safeAsts.add(node);\n      }\n    }\n  }\n  if (encoding.cacheable) {\n    encodings.set(schema, encoding);\n  }\n  return encoding;\n};\n","import type { Cause } from \"effect\";\n\n/** Stable codes for invalid RPC utility configuration. */\nexport type EffectRpcQueryConfigErrorCode =\n  | \"InvalidMaxChunks\"\n  | \"InvalidRefetchMode\"\n  | \"InvalidKeyPrefix\"\n  | \"InvalidRpcPath\"\n  | \"RpcPathCollision\"\n  | \"MissingKeyEncoder\"\n  | \"UnknownKeyEncoder\"\n  | \"UnsupportedQueryHash\";\n\n/** Stable codes for synchronous query-key preparation failures. */\nexport type EffectRpcQueryKeyErrorCode =\n  | \"PayloadConstructionFailed\"\n  | \"PayloadEncodingFailed\"\n  | \"KeyEncoderFailed\"\n  | \"InvalidKeyValue\";\n\n/** The TanStack operation that executed an RPC. */\nexport type RpcOperation =\n  | \"infinite\"\n  | \"live\"\n  | \"mutation\"\n  | \"query\"\n  | \"streamed\";\n\n/** Identifies the failed configuration entry and retains any underlying failure. */\nexport interface EffectRpcQueryConfigErrorOptions {\n  /** The underlying failure, when one exists. */\n  readonly cause?: unknown;\n\n  /** The existing projected path associated with a collision. */\n  readonly path?: string;\n\n  /** The RPC or encoder tag associated with the invalid configuration. */\n  readonly rpcTag?: string;\n}\n\n/**\n * Wraps a failed RPC Exit for TanStack while preserving its complete Effect Cause.\n *\n * Runner rejections pass through unchanged; this class wraps failed Exits.\n */\nexport class EffectRpcQueryError<E> extends Error {\n  /** Identifies this error without relying on `instanceof`. */\n  readonly _tag = \"EffectRpcQueryError\";\n\n  /** The literal tag of the RPC that failed. */\n  readonly rpcTag: string;\n\n  /** The operation that ran the RPC. */\n  readonly operation: RpcOperation;\n\n  /** The original Cause returned by the Effect runner. */\n  override readonly cause: Cause.Cause<E>;\n\n  constructor(rpcTag: string, operation: RpcOperation, cause: Cause.Cause<E>) {\n    super(`RPC ${rpcTag} ${operation} failed`, { cause });\n    this.name = \"EffectRpcQueryError\";\n    this.rpcTag = rpcTag;\n    this.operation = operation;\n    this.cause = cause;\n  }\n}\n\n/** Reports a live RPC stream that completed before emitting its first value. */\nexport class EffectRpcQueryEmptyStreamError extends Error {\n  /** Identifies this error without relying on `instanceof`. */\n  readonly _tag = \"EffectRpcQueryEmptyStreamError\";\n\n  /** The streaming RPC that completed empty. */\n  readonly rpcTag: string;\n\n  constructor(rpcTag: string) {\n    super(`RPC ${rpcTag} live stream completed without a value`);\n    this.name = \"EffectRpcQueryEmptyStreamError\";\n    this.rpcTag = rpcTag;\n  }\n}\n\n/** Reports invalid factory, builder, or stream cache configuration. */\nexport class EffectRpcQueryConfigError extends Error {\n  /** Identifies this error without relying on `instanceof`. */\n  readonly _tag = \"EffectRpcQueryConfigError\";\n\n  /** A stable, machine-readable description of the failure. */\n  readonly code: EffectRpcQueryConfigErrorCode;\n\n  /** The underlying failure, when one exists. */\n  override readonly cause?: unknown;\n\n  /** The existing projected path associated with a collision. */\n  readonly path: string | undefined;\n\n  /** The RPC or encoder tag associated with the invalid configuration. */\n  readonly rpcTag: string | undefined;\n\n  constructor(\n    code: EffectRpcQueryConfigErrorCode,\n    message: string,\n    options: EffectRpcQueryConfigErrorOptions = {}\n  ) {\n    super(\n      message,\n      options.cause === undefined ? undefined : { cause: options.cause }\n    );\n    this.name = \"EffectRpcQueryConfigError\";\n    this.code = code;\n    this.cause = options.cause;\n    this.path = options.path;\n    this.rpcTag = options.rpcTag;\n  }\n}\n\n/** Reports synchronous payload construction, encoding, or canonicalization failures. */\nexport class EffectRpcQueryKeyError extends Error {\n  /** Identifies this error without relying on `instanceof`. */\n  readonly _tag = \"EffectRpcQueryKeyError\";\n\n  /** A stable, machine-readable description of the failure. */\n  readonly code: EffectRpcQueryKeyErrorCode;\n\n  /** The RPC whose query key could not be prepared. */\n  readonly rpcTag: string;\n\n  /** The underlying failure, when one exists. */\n  override readonly cause?: unknown;\n\n  constructor(\n    code: EffectRpcQueryKeyErrorCode,\n    rpcTag: string,\n    message: string,\n    cause?: unknown\n  ) {\n    super(message, cause === undefined ? undefined : { cause });\n    this.name = \"EffectRpcQueryKeyError\";\n    this.code = code;\n    this.rpcTag = rpcTag;\n    this.cause = cause;\n  }\n}\n\n/** Returns whether a value is an RPC execution error from this JavaScript realm. */\nexport const isEffectRpcQueryError = (\n  value: unknown\n): value is EffectRpcQueryError<unknown> =>\n  value instanceof EffectRpcQueryError;\n","import { hashKey } from \"@tanstack/query-core\";\nimport type {\n  Query,\n  QueryCache,\n  QueryFunctionContext,\n  QueryKey,\n} from \"@tanstack/query-core\";\n\ntype HashFunction = ((key: QueryKey) => string) | undefined;\n\ninterface IndexedQuery {\n  readonly query: Query;\n  readonly order: number;\n  readonly hash: HashFunction;\n}\n\ninterface HashIndex {\n  readonly queries: Map<string, IndexedQuery>;\n  readonly groups: Map<HashFunction, Map<string, IndexedQuery>>;\n}\n\nconst indexes = new WeakMap<QueryCache, HashIndex>();\n\nconst cacheIndex = (cache: QueryCache): HashIndex => {\n  const existing = indexes.get(cache);\n  if (existing !== undefined) {\n    return existing;\n  }\n  const index: HashIndex = { queries: new Map(), groups: new Map() };\n  let nextOrder = 0;\n  const remove = (queryHash: string) => {\n    const previous = index.queries.get(queryHash);\n    if (previous === undefined) {\n      return;\n    }\n    const group = index.groups.get(previous.hash);\n    group?.delete(queryHash);\n    if (group?.size === 0) {\n      index.groups.delete(previous.hash);\n    }\n    index.queries.delete(queryHash);\n  };\n  const update = (query: Query) => {\n    const previous = index.queries.get(query.queryHash);\n    const hash = query.options.queryKeyHashFn;\n    if (previous?.query === query && previous.hash === hash) {\n      return;\n    }\n    remove(query.queryHash);\n    const entry = {\n      query,\n      hash,\n      order: previous?.query === query ? previous.order : nextOrder,\n    };\n    if (previous?.query !== query) {\n      nextOrder += 1;\n    }\n    index.queries.set(query.queryHash, entry);\n    let group = index.groups.get(hash);\n    if (group === undefined) {\n      group = new Map();\n      index.groups.set(hash, group);\n    }\n    group.set(query.queryHash, entry);\n  };\n  for (const query of cache.getAll()) {\n    update(query);\n  }\n  const unsubscribe = cache.subscribe((event) => {\n    const query = cache.get(event.query.queryHash);\n    if (query === undefined) {\n      remove(event.query.queryHash);\n    } else {\n      update(query);\n    }\n    if (index.queries.size === 0) {\n      unsubscribe();\n      indexes.delete(cache);\n    }\n  });\n  indexes.set(cache, index);\n  return index;\n};\n\nexport const validateStreamHash = (\n  { client, queryKey }: QueryFunctionContext,\n  unsupportedHash: () => Error\n) => {\n  const { queryHash, queryKeyHashFn } = client.defaultQueryOptions({\n    queryKey,\n  });\n  if (queryHash !== (queryKeyHashFn ?? hashKey)(queryKey)) {\n    throw unsupportedHash();\n  }\n  const cache = client.getQueryCache();\n  const index = cacheIndex(cache);\n  const current = cache.get(queryHash);\n  const currentOrder =\n    current === undefined\n      ? Infinity\n      : (index.queries.get(current.queryHash)?.order ?? Infinity);\n  let canonical: string | undefined;\n  for (const [hash, queries] of index.groups) {\n    if (hash === queryKeyHashFn) {\n      continue;\n    }\n    let candidate: IndexedQuery | undefined;\n    try {\n      candidate = queries.get((hash ?? hashKey)(queryKey));\n    } catch (error) {\n      for (const entry of queries.values()) {\n        if (entry.order < currentOrder) {\n          throw error;\n        }\n      }\n      continue;\n    }\n    if (candidate === undefined || candidate.query === current) {\n      continue;\n    }\n    if (candidate.order < currentOrder) {\n      throw unsupportedHash();\n    }\n    try {\n      canonical ??= hashKey(queryKey);\n      if (hashKey(candidate.query.queryKey) !== canonical) {\n        continue;\n      }\n    } catch {\n      continue;\n    }\n    throw unsupportedHash();\n  }\n  return current;\n};\n","type PullResult<A> =\n  | { readonly kind: \"value\"; readonly result: IteratorResult<A> }\n  | { readonly kind: \"error\"; readonly error: unknown };\n\nexport const streamPublicationBatches =\n  async function* streamPublicationBatches<A>(\n    source: AsyncIterable<A>,\n    batchSize: number,\n    signal: AbortSignal,\n    maxWaitMs?: number\n  ): AsyncIterable<readonly A[]> {\n    const iterator = source[Symbol.asyncIterator]();\n    let first = true;\n    let pending: A[] = [];\n    let pull: Promise<PullResult<A>> | undefined;\n    let timer: ReturnType<typeof setTimeout> | undefined;\n    let deadline: Promise<\"deadline\"> | undefined;\n    let closing: Promise<void> | undefined;\n    const close = async () => {\n      closing ??= (async () => {\n        await iterator.return?.();\n      })();\n      await closing;\n    };\n    const onAbort = () => {\n      // The finally block awaits and propagates cleanup failures.\n      // oxlint-disable-next-line promise/prefer-await-to-then\n      void close().catch(() => {\n        /* Awaited again in finally, which propagates the failure. */\n      });\n    };\n    signal.addEventListener(\"abort\", onAbort, { once: true });\n    const clearDeadline = () => {\n      clearTimeout(timer);\n      timer = undefined;\n      deadline = undefined;\n    };\n    const pullNext = async (): Promise<PullResult<A>> => {\n      try {\n        return { kind: \"value\", result: await iterator.next() };\n      } catch (error) {\n        return { kind: \"error\", error };\n      }\n    };\n    const startDeadline = (milliseconds: number) => {\n      // oxlint-disable-next-line promise/avoid-new\n      deadline = new Promise((resolve) => {\n        timer = setTimeout(() => {\n          resolve(\"deadline\");\n        }, milliseconds);\n      });\n    };\n    try {\n      while (!signal.aborted) {\n        pull ??= pullNext();\n        // Pull sequentially to preserve event order and bound in-flight work.\n        // oxlint-disable-next-line eslint/no-await-in-loop\n        const result = await (deadline === undefined\n          ? pull\n          : Promise.race([pull, deadline]));\n        if (result !== \"deadline\" && result.kind === \"error\") {\n          throw result.error;\n        }\n        if (signal.aborted) {\n          return;\n        }\n        if (result === \"deadline\") {\n          const batch = pending;\n          pending = [];\n          clearDeadline();\n          yield batch;\n          continue;\n        }\n        pull = undefined;\n        if (result.result.done === true) {\n          break;\n        }\n        pending.push(result.result.value);\n        if (first || pending.length === batchSize) {\n          first = false;\n          const batch = pending;\n          pending = [];\n          clearDeadline();\n          yield batch;\n        } else if (deadline === undefined && maxWaitMs !== undefined) {\n          startDeadline(maxWaitMs);\n        }\n      }\n    } catch (error) {\n      clearDeadline();\n      if (pending.length > 0 && !signal.aborted) {\n        yield pending;\n        pending = [];\n      }\n      throw error;\n    } finally {\n      clearDeadline();\n      signal.removeEventListener(\"abort\", onAbort);\n      await close();\n      // A deadline can win while cancellation's finalizer failure is still in the pull.\n      const remaining = await pull;\n      if (remaining?.kind === \"error\") {\n        // Preserve pull failures even when cancellation or consumer return ended the generator.\n        // oxlint-disable-next-line eslint/no-unsafe-finally\n        throw remaining.error;\n      }\n    }\n    if (pending.length > 0 && !signal.aborted) {\n      yield pending;\n    }\n  };\n","import { experimental_streamedQuery } from \"@tanstack/query-core\";\nimport type { QueryFunctionContext } from \"@tanstack/query-core\";\nimport {\n  Cause,\n  Effect,\n  Exit,\n  Predicate,\n  Pull,\n  Result,\n  Scope,\n  Stream,\n} from \"effect\";\n\nimport { validateStreamHash } from \"./stream-hash-index\";\nimport { streamPublicationBatches } from \"./stream-publication\";\nimport type { RunPromiseExit, StreamRefetchMode } from \"./types\";\n\nexport type StreamQueryPolicy =\n  | {\n      readonly maxChunks: number | undefined;\n      readonly _tag: \"Accumulated\";\n      readonly refetchMode: StreamRefetchMode;\n      readonly publicationBatchSize: number;\n      readonly publicationMaxWaitMs: number | undefined;\n    }\n  | { readonly _tag: \"Live\" };\n\n// oxlint-disable-next-line anti-slop/no-unknown-parameters\nconst validatePublicationDeadline: (\n  value: unknown\n) => asserts value is number | undefined = (publicationMaxWaitMs) => {\n  if (\n    publicationMaxWaitMs !== undefined &&\n    (!Predicate.isNumber(publicationMaxWaitMs) ||\n      !Number.isSafeInteger(publicationMaxWaitMs) ||\n      publicationMaxWaitMs <= 0 ||\n      publicationMaxWaitMs > 2_147_483_647)\n  ) {\n    throw new RangeError(\n      \"publicationMaxWaitMs must be an integer from 1 to 2147483647\"\n    );\n  }\n};\n\nexport const prepareStreamPolicy = (\n  // oxlint-disable-next-line anti-slop/no-unsafe-dictionary-type\n  options: Record<string, unknown>,\n  operation: \"live\" | \"streamed\",\n  invalid: (\n    code: \"InvalidMaxChunks\" | \"InvalidRefetchMode\",\n    message: string\n  ) => Error\n) => {\n  let policy: StreamQueryPolicy;\n  if (operation === \"streamed\") {\n    const {\n      maxChunks,\n      refetchMode = \"reset\",\n      publicationBatchSize = 1,\n      publicationMaxWaitMs,\n    } = options;\n    if (\n      maxChunks !== \"unbounded\" &&\n      (!Predicate.isNumber(maxChunks) ||\n        !Number.isSafeInteger(maxChunks) ||\n        maxChunks <= 0)\n    ) {\n      throw invalid(\n        \"InvalidMaxChunks\",\n        \"maxChunks must be a positive safe integer or 'unbounded'\"\n      );\n    }\n    if (\n      refetchMode !== \"reset\" &&\n      refetchMode !== \"append\" &&\n      refetchMode !== \"replace\"\n    ) {\n      throw invalid(\n        \"InvalidRefetchMode\",\n        \"refetchMode must be reset, append, or replace\"\n      );\n    }\n    if (\n      !Predicate.isNumber(publicationBatchSize) ||\n      !Number.isSafeInteger(publicationBatchSize) ||\n      publicationBatchSize <= 0\n    ) {\n      throw new RangeError(\n        \"publicationBatchSize must be a positive safe integer\"\n      );\n    }\n    validatePublicationDeadline(publicationMaxWaitMs);\n    policy = {\n      _tag: \"Accumulated\",\n      maxChunks: maxChunks === \"unbounded\" ? undefined : maxChunks,\n      refetchMode,\n      publicationBatchSize,\n      publicationMaxWaitMs,\n    };\n  } else {\n    policy = { _tag: \"Live\" };\n  }\n  delete options[\"refetchMode\"];\n  delete options[\"maxChunks\"];\n  delete options[\"publicationBatchSize\"];\n  delete options[\"publicationMaxWaitMs\"];\n  return {\n    policy,\n    history:\n      policy._tag === \"Live\"\n        ? undefined\n        : {\n            maxChunks: policy.maxChunks ?? null,\n            refetchMode: policy.refetchMode,\n            ...(policy.publicationBatchSize === 1\n              ? undefined\n              : { publicationBatchSize: policy.publicationBatchSize }),\n            ...(policy.publicationMaxWaitMs === undefined\n              ? undefined\n              : { publicationMaxWaitMs: policy.publicationMaxWaitMs }),\n          },\n  };\n};\n\nexport interface MakeStreamQueryOptions {\n  readonly policy: StreamQueryPolicy;\n  readonly source: Stream.Stream<unknown, unknown, unknown>;\n  readonly executionError: (cause: Cause.Cause<unknown>) => Error;\n  readonly unsupportedHash: () => Error;\n  readonly emptyError?: (() => Error) | undefined;\n  readonly runPromiseExit: RunPromiseExit<unknown>;\n}\n\nconst streamQueryIterable = <A>(\n  source: AsyncIterable<A>,\n  signal: AbortSignal,\n  emptyError: (() => Error) | undefined\n): AsyncIterable<A> => ({\n  [Symbol.asyncIterator]() {\n    const iterator = source[Symbol.asyncIterator]();\n    let closePromise: Promise<IteratorResult<A>> | undefined;\n    let emitted = false;\n    const detach = () => {\n      // oxlint-disable-next-line eslint/no-use-before-define\n      signal.removeEventListener(\"abort\", onAbort);\n    };\n    const close = async () => {\n      closePromise ??= (async () => {\n        try {\n          return (\n            (await iterator.return?.()) ?? { done: true, value: undefined }\n          );\n        } finally {\n          detach();\n        }\n      })();\n      return await closePromise;\n    };\n    const onAbort = () => {\n      // oxlint-disable-next-line promise/prefer-await-to-then\n      void Promise.resolve().then(close).catch(detach);\n    };\n    signal.addEventListener(\"abort\", onAbort, { once: true });\n\n    return {\n      async next() {\n        let result: IteratorResult<A>;\n        if (signal.aborted) {\n          result = await close();\n        } else {\n          try {\n            result = await iterator.next();\n          } catch (error) {\n            detach();\n            throw error;\n          }\n        }\n        if (result.done === true) {\n          detach();\n          if (!emitted && emptyError !== undefined) {\n            throw emptyError();\n          }\n        }\n        emitted = true;\n        return result;\n      },\n      return: close,\n      async throw(cause?: unknown) {\n        detach();\n        if (iterator.throw !== undefined) {\n          return await iterator.throw(cause);\n        }\n        await close();\n        throw cause;\n      },\n    };\n  },\n});\n\nexport const makeStreamQuery = ({\n  policy,\n  source,\n  executionError,\n  unsupportedHash,\n  emptyError,\n  runPromiseExit,\n}: MakeStreamQueryOptions) => {\n  const validateHash = (context: QueryFunctionContext) =>\n    validateStreamHash(context, unsupportedHash);\n  const streamFn = async ({ signal }: { readonly signal: AbortSignal }) => {\n    const stream = Stream.unwrap(\n      Effect.gen(function* consumeStream() {\n        const scope = yield* Scope.make();\n        yield* Effect.addFinalizer((exit) =>\n          Scope.close(scope, exit).pipe(\n            Effect.catchCause((cause) => Effect.die(executionError(cause)))\n          )\n        );\n        // oxlint-disable-next-line effecttsgo/any-unknown-in-error-context\n        const pull = yield* Stream.toPull(source).pipe(Scope.provide(scope));\n        return Stream.fromPull(\n          Effect.succeed(\n            Effect.uninterruptibleMask((restore) =>\n              // oxlint-disable-next-line effecttsgo/any-unknown-in-error-context\n              restore(pull).pipe(\n                Effect.onError((cause) =>\n                  Scope.close(scope, Pull.doneExitFromCause(cause))\n                ),\n                Effect.catchCause((cause) => {\n                  const completion = Pull.filterDone(cause);\n                  if (\n                    Result.isFailure(completion) &&\n                    (!signal.aborted ||\n                      !Cause.hasInterruptsOnly(completion.failure))\n                  ) {\n                    return Effect.fail(executionError(completion.failure));\n                  }\n                  // oxlint-disable-next-line effecttsgo/any-unknown-in-error-context\n                  return Effect.failCause(cause);\n                })\n              )\n            )\n          )\n        );\n      })\n    );\n    // oxlint-disable-next-line effecttsgo/any-unknown-in-error-context\n    const exit = await runPromiseExit(Stream.toAsyncIterableEffect(stream), {\n      signal,\n    });\n    if (Exit.isFailure(exit)) {\n      throw executionError(exit.cause);\n    }\n    return streamQueryIterable(\n      exit.value,\n      signal,\n      policy._tag === \"Live\" ? emptyError : undefined\n    );\n  };\n\n  if (policy._tag === \"Live\") {\n    const queryFn = experimental_streamedQuery({\n      initialValue: null,\n      // oxlint-disable-next-line anti-slop/no-unknown-parameters\n      reducer: (_latest: unknown, value: unknown) =>\n        value === undefined ? null : value,\n      streamFn,\n    });\n    return async (context: QueryFunctionContext) => {\n      validateHash(context);\n      return await queryFn(context);\n    };\n  }\n\n  const { maxChunks, refetchMode, publicationBatchSize, publicationMaxWaitMs } =\n    policy;\n  return async (context: QueryFunctionContext) => {\n    const query = validateHash(context);\n    const reset = refetchMode === \"reset\" && query?.isFetched() === true;\n    let emitted = false;\n    const initialValue: unknown[] = [];\n    const queryFn = experimental_streamedQuery({\n      initialValue,\n      reducer: (values: unknown[], batch: readonly unknown[]) => {\n        const history = reset && !emitted ? [] : values;\n        emitted = true;\n        if (maxChunks === undefined) {\n          return [...history, ...batch];\n        }\n        const start = Math.max(0, history.length + batch.length - maxChunks);\n        // oxlint-disable-next-line unicorn/no-new-array\n        const next = new Array<unknown>(history.length + batch.length - start);\n        for (\n          let index = start;\n          index < history.length + batch.length;\n          index += 1\n        ) {\n          next[index - start] =\n            index < history.length\n              ? history[index]\n              : batch[index - history.length];\n        }\n        return next;\n      },\n      refetchMode,\n      streamFn: async (streamContext) =>\n        streamPublicationBatches(\n          await streamFn(streamContext),\n          publicationBatchSize,\n          streamContext.signal,\n          publicationMaxWaitMs\n        ),\n    });\n    const result = await queryFn(context);\n    return reset && !emitted ? [] : result;\n  };\n};\n","import { Stream } from \"effect\";\n\nimport type { StreamingOperation } from \"../core/operation\";\nimport { makeStreamQuery, prepareStreamPolicy } from \"../core/streamed-query\";\nimport {\n  EffectRpcQueryConfigError,\n  EffectRpcQueryEmptyStreamError,\n  EffectRpcQueryError,\n} from \"./errors\";\n\nexport interface RpcStreamInvocation {\n  readonly tag: string;\n  readonly invoke: (\n    // oxlint-disable-next-line anti-slop/no-unknown-parameters\n    input: unknown,\n    // oxlint-disable-next-line anti-slop/no-unknown-parameters\n    options: unknown\n  ) => Stream.Stream<unknown, unknown, unknown>;\n}\n\nexport const createStreamPreparation =\n  (rpc: RpcStreamInvocation): StreamingOperation[\"prepareStream\"] =>\n  (options, operation, runPromiseExit, requestOptions) => {\n    const { policy, history } = prepareStreamPolicy(\n      options,\n      operation,\n      (code, message) =>\n        new EffectRpcQueryConfigError(code, message, { rpcTag: rpc.tag })\n    );\n    return {\n      identity: history === undefined ? [] : [Object.freeze(history)],\n      makeQuery: (input) =>\n        makeStreamQuery({\n          policy,\n          source: Stream.suspend(() => rpc.invoke(input, requestOptions)),\n          executionError: (cause) =>\n            new EffectRpcQueryError(rpc.tag, operation, cause),\n          unsupportedHash: () =>\n            new EffectRpcQueryConfigError(\n              \"UnsupportedQueryHash\",\n              \"Stream queries require consistent QueryClient hashing\",\n              { rpcTag: rpc.tag }\n            ),\n          emptyError: () => new EffectRpcQueryEmptyStreamError(rpc.tag),\n          runPromiseExit,\n        }),\n    };\n  };\n","import { Predicate, SchemaAST } from \"effect\";\nimport type { Effect, Stream } from \"effect\";\nimport type { RpcClient, RpcGroup } from \"effect/rpc\";\nimport { Rpc, RpcSchema } from \"effect/rpc\";\n\nimport type {\n  OperationDescription,\n  OperationInput,\n  TreeErrors,\n} from \"../core/operation\";\nimport { createSchemaKeyEncoding } from \"../core/schema-key\";\nimport {\n  EffectRpcQueryConfigError,\n  EffectRpcQueryError,\n  EffectRpcQueryKeyError,\n} from \"./errors\";\nimport { createStreamPreparation } from \"./streamed-query\";\n\ntype RpcRequest = Pick<\n  Rpc.AnyWithProps,\n  \"_tag\" | \"payloadSchema\" | \"successSchema\"\n>;\n\ntype RpcClientInvocation<Result> = (\n  tag: string,\n  // oxlint-disable-next-line anti-slop/no-unknown-parameters\n  input: unknown,\n  // oxlint-disable-next-line anti-slop/no-unknown-parameters\n  options: unknown\n) => Result;\n\nconst rpcInputs = new WeakMap<RpcRequest, OperationInput>();\n\nconst compileRpcInput = (definition: RpcRequest): OperationInput => {\n  const { payloadSchema, _tag: rpcTag } = definition;\n  if (SchemaAST.isVoid(payloadSchema.ast)) {\n    return { _tag: \"Inputless\" };\n  }\n  const keyEncoding = createSchemaKeyEncoding(payloadSchema);\n\n  return {\n    _tag: \"Input\",\n    requiresEncoder: keyEncoding.requiresEncoder,\n    cacheable: keyEncoding.cacheable,\n    pageInput: (input) => payloadSchema.make(input),\n    invalidKey: (cause) =>\n      new EffectRpcQueryKeyError(\n        \"InvalidKeyValue\",\n        rpcTag,\n        `The key payload for RPC ${rpcTag} is not JSON-safe`,\n        cause\n      ),\n    prepare: (input, encoder) => {\n      let normalized: unknown;\n      try {\n        normalized = payloadSchema.make(input);\n      } catch (error) {\n        throw new EffectRpcQueryKeyError(\n          \"PayloadConstructionFailed\",\n          rpcTag,\n          `Could not construct the payload for RPC ${rpcTag}`,\n          error\n        );\n      }\n      let keyValue: unknown;\n      try {\n        keyValue = encoder\n          ? encoder(normalized)\n          : keyEncoding.encode(normalized);\n      } catch (error) {\n        throw new EffectRpcQueryKeyError(\n          encoder ? \"KeyEncoderFailed\" : \"PayloadEncodingFailed\",\n          rpcTag,\n          `Could not encode the key payload for RPC ${rpcTag}`,\n          error\n        );\n      }\n      return { input: normalized, keyValue };\n    },\n  };\n};\n\nconst createRpcInput = (definition: RpcRequest): OperationInput => {\n  let input = rpcInputs.get(definition);\n  if (input === undefined) {\n    input = compileRpcInput(definition);\n    if (input._tag === \"Inputless\" || input.cacheable) {\n      rpcInputs.set(definition, input);\n    }\n  }\n  return input;\n};\n\n// oxlint-disable-next-line anti-slop/no-unsafe-dictionary-type\nconst takeRpcOptions = (options: Record<string, unknown>) => {\n  const { rpcOptions } = options;\n  delete options[\"rpcOptions\"];\n  return rpcOptions;\n};\n\nconst describeRpc = (\n  definition: RpcRequest,\n  // oxlint-disable-next-line anti-slop/no-unknown-parameters\n  client: unknown\n): OperationDescription => {\n  const rpcTag = definition._tag;\n  const identity = {\n    id: rpcTag,\n    path: rpcTag.split(\".\"),\n    input: createRpcInput(definition),\n    unsupportedQueryHash: (option: \"queryKeyHashFn\" | \"queryHash\") =>\n      new EffectRpcQueryConfigError(\n        \"UnsupportedQueryHash\",\n        `${option} must be configured through QueryClient defaults`,\n        { rpcTag }\n      ),\n    takeOptions: takeRpcOptions,\n  };\n  if (!RpcSchema.isStreamSchema(definition.successSchema)) {\n    // oxlint-disable-next-line anti-slop/require-safety-comment-for-type-assertion, typescript/no-unsafe-type-assertion\n    const invoke = client as RpcClientInvocation<\n      Effect.Effect<unknown, unknown, unknown>\n    >;\n    return {\n      ...identity,\n      kind: \"Unary\",\n      // oxlint-disable-next-line effecttsgo/any-unknown-in-error-context\n      invoke: (input, options) => invoke(rpcTag, input, options),\n      executionError: (operation, cause) =>\n        new EffectRpcQueryError(rpcTag, operation, cause),\n    };\n  }\n  // oxlint-disable-next-line anti-slop/require-safety-comment-for-type-assertion, typescript/no-unsafe-type-assertion\n  const invoke = client as RpcClientInvocation<\n    Stream.Stream<unknown, unknown, unknown>\n  >;\n  return {\n    ...identity,\n    kind: \"Streaming\",\n    prepareStream: createStreamPreparation({\n      tag: rpcTag,\n      invoke: (input, options) => invoke(rpcTag, input, options),\n    }),\n  };\n};\n\nexport const extractRpcs = <Rpcs extends Rpc.Any, ClientError>(\n  group: RpcGroup.Any,\n  client: RpcClient.RpcClient.Flat<Rpcs, ClientError>\n): readonly OperationDescription[] => {\n  if (\n    !Predicate.hasProperty(group, \"requests\") ||\n    !Predicate.isMap(group.requests)\n  ) {\n    throw new TypeError(\"Expected an Effect RPC group with a request map\");\n  }\n  return Array.from(group.requests.values(), (value) => {\n    if (!Rpc.isRpc(value)) {\n      throw new TypeError(\"Expected an Effect RPC declaration\");\n    }\n    return describeRpc(value, client);\n  });\n};\n\nexport const rpcTreeErrors: TreeErrors = {\n  invalidPrefix: (reason, cause) =>\n    new EffectRpcQueryConfigError(\n      \"InvalidKeyPrefix\",\n      reason === \"Shape\"\n        ? \"keyPrefix must be a non-empty readonly tuple of JSON-safe values\"\n        : \"keyPrefix must contain only JSON-safe values\",\n      { cause }\n    ),\n  invalidPath: (rpcTag) =>\n    new EffectRpcQueryConfigError(\n      \"InvalidRpcPath\",\n      `RPC tag ${rpcTag} cannot be projected into a utility path`,\n      { rpcTag }\n    ),\n  pathCollision: (rpcTag, segments, relation) => {\n    const path = segments.join(\".\");\n    return new EffectRpcQueryConfigError(\n      \"RpcPathCollision\",\n      `RPC tag ${rpcTag} ${relation} utility path ${path}`,\n      { path, rpcTag }\n    );\n  },\n  unknownEncoder: (rpcTag) =>\n    new EffectRpcQueryConfigError(\n      \"UnknownKeyEncoder\",\n      `No payload-bearing RPC exists for key encoder ${rpcTag}`,\n      { rpcTag }\n    ),\n  missingEncoder: (rpcTag) =>\n    new EffectRpcQueryConfigError(\n      \"MissingKeyEncoder\",\n      `RPC ${rpcTag} requires a safe custom key encoder`,\n      { rpcTag }\n    ),\n};\n","import type { RpcGroup } from \"effect/rpc\";\n\nimport type { JsonValue, RunPromiseExit } from \"../core/types\";\nimport { createUtilityTree } from \"../core/utility-tree\";\nimport { extractRpcs, rpcTreeErrors } from \"./operation\";\nimport type { CreateRpcQueryUtilsOptions, RpcQueryUtils } from \"./types\";\n\n/**\n * Derives an eager, frozen TanStack Query utility tree from an Effect RPC group.\n *\n * Dotted RPC tags become nested properties with unary or streaming utility leaves.\n * The caller retains ownership of the ready client's Scope and lifecycle.\n *\n * @throws {@link EffectRpcQueryConfigError} if the prefix, paths, or encoders are invalid.\n */\nexport const createRpcQueryUtils = <\n  const Group extends RpcGroup.Any,\n  const Prefix extends readonly [JsonValue, ...JsonValue[]],\n  ClientError = never,\n>(\n  group: Group,\n  options: CreateRpcQueryUtilsOptions<Group, Prefix, ClientError>\n): RpcQueryUtils<Group, Prefix, ClientError> => {\n  const rpcs = extractRpcs(group, options.client);\n  // oxlint-disable-next-line anti-slop/require-safety-comment-for-type-assertion, typescript/no-unsafe-type-assertion\n  const runPromiseExit = options.runPromiseExit as\n    | RunPromiseExit<unknown>\n    | undefined;\n  const tree = createUtilityTree(rpcs, {\n    keyPrefix: options.keyPrefix,\n    keyNamespace: [\"rpc\"],\n    keyEncoders: new Map(Object.entries(options.keyEncoders ?? {})),\n    runPromiseExit,\n    errors: rpcTreeErrors,\n  });\n  // oxlint-disable-next-line anti-slop/require-safety-comment-for-type-assertion, typescript/no-unsafe-type-assertion\n  return tree as RpcQueryUtils<Group, Prefix, ClientError>;\n};\n","import type { Cause } from \"effect\";\n\n/** Safe identity shared by HTTP execution and key errors. */\nexport interface HttpApiEndpointIdentity {\n  readonly apiId: string;\n  readonly groupId: string;\n  readonly endpoint: string;\n  readonly method: string;\n}\n\nexport type HttpApiOperation =\n  | \"query\"\n  | \"infinite\"\n  | \"mutation\"\n  | \"metadata\"\n  | \"streamed\"\n  | \"live\";\n\n/** Stable codes for invalid HTTP utility configuration. */\nexport type EffectHttpApiQueryConfigErrorCode =\n  | \"InvalidKeyPrefix\"\n  | \"InvalidEndpointPath\"\n  | \"EndpointPathCollision\"\n  | \"MissingKeyEncoder\"\n  | \"UnknownKeyEncoder\"\n  | \"UnsupportedEndpointMetadata\"\n  | \"UnsupportedQueryHash\"\n  | \"InvalidMaxChunks\"\n  | \"InvalidRefetchMode\"\n  | \"InvalidMaxEventSize\"\n  | \"InvalidSseOptions\";\n\n/** Stable codes for synchronous HTTP key failures. */\nexport type EffectHttpApiQueryKeyErrorCode =\n  | \"RequestEncodingFailed\"\n  | \"KeyEncoderFailed\"\n  | \"InvalidKeyValue\";\n\n/** Preserves the complete failed Exit Cause with declaration-only metadata. */\nexport class EffectHttpApiQueryError<E>\n  extends Error\n  implements HttpApiEndpointIdentity\n{\n  readonly _tag = \"EffectHttpApiQueryError\";\n  readonly apiId: string;\n  readonly groupId: string;\n  readonly endpoint: string;\n  readonly method: string;\n  readonly operation: HttpApiOperation;\n  override readonly cause: Cause.Cause<E>;\n\n  constructor(\n    identity: HttpApiEndpointIdentity,\n    operation: HttpApiOperation,\n    cause: Cause.Cause<E>\n  ) {\n    super(\n      `HTTP ${identity.method} ${identity.groupId}/${identity.endpoint} ${operation} failed`,\n      {\n        cause,\n      }\n    );\n    this.name = \"EffectHttpApiQueryError\";\n    this.apiId = identity.apiId;\n    this.groupId = identity.groupId;\n    this.endpoint = identity.endpoint;\n    this.method = identity.method;\n    this.operation = operation;\n    this.cause = cause;\n  }\n}\n\nexport class EffectHttpApiQueryEmptyStreamError\n  extends Error\n  implements HttpApiEndpointIdentity\n{\n  readonly _tag = \"EffectHttpApiQueryEmptyStreamError\";\n  readonly apiId: string;\n  readonly groupId: string;\n  readonly endpoint: string;\n  readonly method: string;\n  readonly operation = \"live\";\n\n  constructor(identity: HttpApiEndpointIdentity) {\n    super(\n      `HTTP ${identity.method} ${identity.groupId}/${identity.endpoint} live stream completed without a value`\n    );\n    this.name = \"EffectHttpApiQueryEmptyStreamError\";\n    this.apiId = identity.apiId;\n    this.groupId = identity.groupId;\n    this.endpoint = identity.endpoint;\n    this.method = identity.method;\n  }\n}\n\n/** Reports invalid factory, builder, or stream cache configuration. */\nexport class EffectHttpApiQueryConfigError extends Error {\n  readonly _tag = \"EffectHttpApiQueryConfigError\";\n  readonly code: EffectHttpApiQueryConfigErrorCode;\n  readonly apiId: string;\n  readonly groupId: string | undefined;\n  readonly endpoint: string | undefined;\n  readonly method: string | undefined;\n  readonly path: readonly string[] | undefined;\n  override readonly cause?: unknown;\n\n  constructor(\n    code: EffectHttpApiQueryConfigErrorCode,\n    message: string,\n    options: {\n      readonly apiId: string;\n      readonly groupId?: string;\n      readonly endpoint?: string;\n      readonly method?: string;\n      readonly path?: readonly string[];\n      readonly cause?: unknown;\n    }\n  ) {\n    super(\n      message,\n      options.cause === undefined ? undefined : { cause: options.cause }\n    );\n    this.name = \"EffectHttpApiQueryConfigError\";\n    this.code = code;\n    this.apiId = options.apiId;\n    this.groupId = options.groupId;\n    this.endpoint = options.endpoint;\n    this.method = options.method;\n    this.path = options.path;\n    this.cause = options.cause;\n  }\n}\n\n/** Reports synchronous request encoding and key canonicalization failures. */\nexport class EffectHttpApiQueryKeyError\n  extends Error\n  implements HttpApiEndpointIdentity\n{\n  readonly _tag = \"EffectHttpApiQueryKeyError\";\n  readonly code: EffectHttpApiQueryKeyErrorCode;\n  readonly apiId: string;\n  readonly groupId: string;\n  readonly endpoint: string;\n  readonly method: string;\n  override readonly cause?: unknown;\n\n  constructor(\n    code: EffectHttpApiQueryKeyErrorCode,\n    identity: HttpApiEndpointIdentity,\n    message: string,\n    cause?: unknown\n  ) {\n    super(message, cause === undefined ? undefined : { cause });\n    this.name = \"EffectHttpApiQueryKeyError\";\n    this.code = code;\n    this.apiId = identity.apiId;\n    this.groupId = identity.groupId;\n    this.endpoint = identity.endpoint;\n    this.method = identity.method;\n    this.cause = cause;\n  }\n}\n\n/** Recognizes HTTP execution errors from this JavaScript realm. */\nexport const isEffectHttpApiQueryError = (\n  value: unknown\n): value is EffectHttpApiQueryError<unknown> =>\n  value instanceof EffectHttpApiQueryError;\n","import { Predicate, Schema } from \"effect\";\nimport { HttpApiSchema } from \"effect/http-api\";\nimport type { HttpApiEndpoint } from \"effect/http-api\";\n\nimport type { OperationInput } from \"../core/operation\";\nimport { createSchemaKeyEncoding } from \"../core/schema-key\";\nimport {\n  EffectHttpApiQueryConfigError,\n  EffectHttpApiQueryKeyError,\n} from \"./errors\";\nimport type { HttpApiEndpointIdentity } from \"./errors\";\n\nconst multipartBrands = (schema: Schema.Top): ReadonlySet<string> => {\n  const brands = new Set<string>();\n  const visited = new WeakSet();\n  let current: unknown = schema;\n  while (Schema.isSchema(current) && !visited.has(current)) {\n    visited.add(current);\n    if (\n      Predicate.hasProperty(current, \"identifier\") &&\n      (current.identifier === HttpApiSchema.MultipartTypeId ||\n        current.identifier === HttpApiSchema.MultipartStreamTypeId)\n    ) {\n      brands.add(current.identifier);\n    }\n    current = Predicate.hasProperty(current, \"schema\")\n      ? current.schema\n      : undefined;\n  }\n  return brands;\n};\n\nexport type HttpRequestDescription =\n  | { readonly kind: \"Unary\"; readonly input: OperationInput }\n  | { readonly kind: \"Streaming\"; readonly input: OperationInput }\n  | { readonly kind: \"Mutation\" };\n\nconst classifyEndpoint = (\n  endpoint: HttpApiEndpoint.Top,\n  identity: HttpApiEndpointIdentity\n):\n  | {\n      readonly kind: \"Unary\" | \"Streaming\";\n      readonly schemas: readonly Schema.Top[];\n    }\n  | { readonly kind: \"Mutation\" }\n  | undefined => {\n  const payloads: Schema.Top[] = [];\n  let multipart = false;\n  let multipartStream = false;\n  for (const { encoding, schemas } of endpoint.payload.values()) {\n    for (const schema of schemas) {\n      const brands = multipartBrands(schema);\n      const buffered = brands.has(HttpApiSchema.MultipartTypeId);\n      const streamed = brands.has(HttpApiSchema.MultipartStreamTypeId);\n      const expectedBuffered =\n        encoding._tag === \"Multipart\" && encoding.mode === \"buffered\";\n      const expectedStreamed =\n        encoding._tag === \"Multipart\" && encoding.mode === \"stream\";\n      const metadataAgrees =\n        buffered === expectedBuffered && streamed === expectedStreamed;\n      if (!metadataAgrees) {\n        throw new EffectHttpApiQueryConfigError(\n          \"UnsupportedEndpointMetadata\",\n          `HTTP endpoint ${identity.groupId}/${identity.endpoint} has contradictory multipart metadata`,\n          identity\n        );\n      }\n      multipart ||= expectedBuffered;\n      multipartStream ||= expectedStreamed;\n      payloads.push(schema);\n    }\n  }\n  if (multipartStream) {\n    return undefined;\n  }\n  const successes = [...endpoint.success];\n  const streams = successes.filter((schema) =>\n    Predicate.hasProperty(\n      HttpApiSchema.isWithHeaders(schema) ? schema.schema : schema,\n      \"~effect/http-api/HttpApiSchema/Stream\"\n    )\n  );\n  if (streams.length > 0) {\n    const [success] = successes;\n    const body = HttpApiSchema.isWithHeaders(success)\n      ? success.schema\n      : success;\n    if (\n      multipart ||\n      successes.length !== 1 ||\n      !Predicate.hasProperty(body, \"_tag\") ||\n      body._tag !== \"StreamSse\"\n    ) {\n      return undefined;\n    }\n    return { kind: \"Streaming\", schemas: payloads };\n  }\n  return multipart\n    ? { kind: \"Mutation\" }\n    : { kind: \"Unary\", schemas: payloads };\n};\n\n// oxlint-disable-next-line anti-slop/no-unknown-parameters, anti-slop/no-unknown-returns\nconst omitUndefined = (value: unknown, seen = new WeakSet()): unknown => {\n  if (!Predicate.isObjectOrArray(value)) {\n    return value;\n  }\n  if (seen.has(value)) {\n    throw new TypeError(\"Key values must not contain cycles\");\n  }\n  seen.add(value);\n  let result: unknown = value;\n  if (Array.isArray(value)) {\n    let copy: unknown[] | undefined;\n    for (let index = 0; index < value.length; index += 1) {\n      if (!Object.hasOwn(value, index)) {\n        throw new TypeError(\"Key values must not contain sparse arrays\");\n      }\n      const item = value[index];\n      const next = omitUndefined(item, seen);\n      if (copy !== undefined) {\n        copy.push(next);\n      } else if (next !== item) {\n        copy = Array.from({ length: index }, (_, offset) => value[offset]);\n        copy.push(next);\n      }\n    }\n    result = copy ?? value;\n  } else if (\n    Object.getPrototypeOf(value) === Object.prototype ||\n    Object.getPrototypeOf(value) === null\n  ) {\n    let copy: [string, unknown][] | undefined;\n    const entries = Object.entries(value);\n    for (const [index, [name, item]] of entries.entries()) {\n      if (item === undefined) {\n        copy ??= entries.slice(0, index);\n      } else {\n        const next = omitUndefined(item, seen);\n        if (next !== item) {\n          copy ??= entries.slice(0, index);\n        }\n        copy?.push([name, next]);\n      }\n    }\n    result = copy === undefined ? value : Object.fromEntries(copy);\n  }\n  seen.delete(value);\n  return result;\n};\n\n// oxlint-disable-next-line anti-slop/no-unknown-parameters\nconst normalizeRequestKey = (value: unknown) => {\n  const request = omitUndefined(value);\n  if (!Predicate.isObject(request)) {\n    throw new TypeError(\"Encoded HTTP requests must be objects\");\n  }\n  if (Predicate.isObject(request[\"headers\"])) {\n    // oxlint-disable-next-line anti-slop/no-unsafe-dictionary-type, typescript/no-unsafe-assignment\n    const headers: Record<string, unknown> = Object.create(null);\n    for (const [name, headerValue] of Object.entries(request[\"headers\"])) {\n      const lower = name.toLowerCase();\n      if (\n        Object.hasOwn(headers, lower) &&\n        JSON.stringify(headers[lower]) !== JSON.stringify(headerValue)\n      ) {\n        throw new TypeError(\n          \"Encoded header names must not have conflicting values\"\n        );\n      }\n      headers[lower] = headerValue;\n    }\n    return { ...request, headers };\n  }\n  return request;\n};\n\nexport const createHttpRequest = (\n  endpoint: HttpApiEndpoint.Top,\n  identity: HttpApiEndpointIdentity\n): HttpRequestDescription | undefined => {\n  const classified = classifyEndpoint(endpoint, identity);\n  if (classified === undefined || classified.kind === \"Mutation\") {\n    return classified;\n  }\n  const payloads = classified.schemas;\n  const fields: Record<string, Schema.Top> = {};\n  if (endpoint.params !== undefined) {\n    fields[\"params\"] = endpoint.params;\n  }\n  if (endpoint.query !== undefined) {\n    fields[\"query\"] = endpoint.query;\n  }\n  if (endpoint.headers !== undefined) {\n    fields[\"headers\"] = endpoint.headers;\n  }\n  if (payloads.length > 0) {\n    fields[\"payload\"] = Schema.Union(payloads);\n  }\n  if (Object.keys(fields).length === 0) {\n    return { kind: classified.kind, input: { _tag: \"Inputless\" } };\n  }\n  const schema = Schema.Struct(fields);\n  const keyEncoding = createSchemaKeyEncoding(schema);\n  const invalidKey = (cause: unknown) =>\n    new EffectHttpApiQueryKeyError(\n      \"InvalidKeyValue\",\n      identity,\n      `The HTTP key for ${identity.groupId}/${identity.endpoint} is not JSON-safe`,\n      cause\n    );\n  return {\n    kind: classified.kind,\n    input: {\n      _tag: \"Input\",\n      requiresEncoder: payloads.length > 1 || keyEncoding.requiresEncoder,\n      cacheable: keyEncoding.cacheable,\n      pageInput: (input) => input,\n      invalidKey,\n      prepare: (input, encoder) => {\n        let keyValue: unknown;\n        try {\n          keyValue = encoder ? encoder(input) : keyEncoding.encode(input);\n        } catch (error) {\n          throw new EffectHttpApiQueryKeyError(\n            encoder ? \"KeyEncoderFailed\" : \"RequestEncodingFailed\",\n            identity,\n            `Could not encode the HTTP key for ${identity.groupId}/${identity.endpoint}`,\n            error\n          );\n        }\n        try {\n          return {\n            input,\n            keyValue: encoder ? keyValue : normalizeRequestKey(keyValue),\n          };\n        } catch (error) {\n          throw invalidKey(error);\n        }\n      },\n    },\n  };\n};\n","import { Effect, Predicate, Stream } from \"effect\";\nimport type { Sse } from \"effect/encoding\";\nimport { HttpApiSchema } from \"effect/http-api\";\n\nimport type { StreamingOperation } from \"../core/operation\";\nimport { makeStreamQuery, prepareStreamPolicy } from \"../core/streamed-query\";\nimport {\n  EffectHttpApiQueryConfigError,\n  EffectHttpApiQueryEmptyStreamError,\n  EffectHttpApiQueryError,\n} from \"./errors\";\nimport type { HttpApiEndpointIdentity } from \"./errors\";\n\nconst decoderOptions = (\n  identity: HttpApiEndpointIdentity,\n  // oxlint-disable-next-line anti-slop/no-unsafe-dictionary-type\n  options: Record<string, unknown>\n): Sse.DecodeOptions & { readonly maxEventSize: number } => {\n  const { sseOptions } = options;\n  const decoder = Predicate.isObject(sseOptions) ? sseOptions : undefined;\n  const maxEventSize = decoder?.[\"maxEventSize\"];\n  const dispatchEmptyNamedEvents = decoder?.[\"dispatchEmptyNamedEvents\"];\n  const limit = maxEventSize === undefined ? 10 * 1024 * 1024 : maxEventSize;\n  if (\n    !Predicate.isNumber(limit) ||\n    !Number.isSafeInteger(limit) ||\n    limit <= 0\n  ) {\n    throw new EffectHttpApiQueryConfigError(\n      \"InvalidMaxEventSize\",\n      \"sseOptions.maxEventSize must be a positive safe integer\",\n      identity\n    );\n  }\n  if (\n    dispatchEmptyNamedEvents !== undefined &&\n    !Predicate.isBoolean(dispatchEmptyNamedEvents)\n  ) {\n    throw new EffectHttpApiQueryConfigError(\n      \"InvalidSseOptions\",\n      \"sseOptions.dispatchEmptyNamedEvents must be a boolean\",\n      identity\n    );\n  }\n  return Object.freeze({\n    maxEventSize: limit,\n    dispatchEmptyNamedEvents: dispatchEmptyNamedEvents ?? false,\n  });\n};\n\nexport const createHttpStreamPreparation =\n  (\n    identity: HttpApiEndpointIdentity,\n    invoke: (\n      // oxlint-disable-next-line anti-slop/no-unknown-parameters\n      input: unknown,\n      sseOptions: Sse.DecodeOptions\n    ) => Effect.Effect<unknown, unknown, unknown>\n  ): StreamingOperation[\"prepareStream\"] =>\n  (options, operation, runPromiseExit) => {\n    const { policy, history } = prepareStreamPolicy(\n      options,\n      operation,\n      (code, message) =>\n        new EffectHttpApiQueryConfigError(code, message, identity)\n    );\n    const sseOptions = decoderOptions(identity, options);\n    delete options[\"sseOptions\"];\n    return {\n      identity: [\n        Object.freeze({\n          ...history,\n          maxEventSize: sseOptions.maxEventSize,\n          ...(sseOptions.dispatchEmptyNamedEvents === true\n            ? { dispatchEmptyNamedEvents: true }\n            : undefined),\n        }),\n      ],\n      makeQuery: (input) =>\n        makeStreamQuery({\n          policy,\n          source: Stream.unwrap(\n            // oxlint-disable-next-line effecttsgo/any-unknown-in-error-context\n            Effect.suspend(() => invoke(input, sseOptions)).pipe(\n              Effect.map((response) => {\n                if (\n                  Predicate.hasProperty(response, \"body\") &&\n                  Predicate.hasProperty(response, \"headers\") &&\n                  Stream.isStream(response.body)\n                ) {\n                  return response.body.pipe(\n                    Stream.map((body) =>\n                      HttpApiSchema.withHeaders({\n                        body,\n                        headers: response.headers,\n                      })\n                    )\n                  );\n                }\n                if (!Stream.isStream(response)) {\n                  throw new TypeError(\"HTTP SSE clients must return a Stream\");\n                }\n                return response;\n              })\n            )\n          ),\n          executionError: (cause) =>\n            new EffectHttpApiQueryError(identity, operation, cause),\n          unsupportedHash: () =>\n            new EffectHttpApiQueryConfigError(\n              \"UnsupportedQueryHash\",\n              \"Stream queries require consistent QueryClient hashing\",\n              identity\n            ),\n          emptyError: () => new EffectHttpApiQueryEmptyStreamError(identity),\n          runPromiseExit,\n        }),\n    };\n  };\n","import { Effect, Predicate } from \"effect\";\nimport type { Cause } from \"effect\";\nimport type { Sse } from \"effect/encoding\";\nimport type { HttpClientResponse } from \"effect/http\";\nimport type { HttpApi } from \"effect/http-api\";\n\nimport type {\n  MutationOperation,\n  StreamingOperation,\n  RuntimeKeyEncoder,\n  TreeErrors,\n  UnaryOperation,\n} from \"../core/operation\";\nimport {\n  EffectHttpApiQueryConfigError,\n  EffectHttpApiQueryError,\n} from \"./errors\";\nimport type { HttpApiEndpointIdentity } from \"./errors\";\nimport { createHttpRequest } from \"./request\";\nimport type { HttpRequestDescription } from \"./request\";\nimport { createHttpStreamPreparation } from \"./streamed-query\";\n\ntype HttpOperation = (\n  | UnaryOperation\n  | MutationOperation\n  | StreamingOperation\n) & {\n  readonly identity: HttpApiEndpointIdentity;\n};\n\ntype RuntimeHttpMethod = <Mode extends \"decoded-only\" | \"decoded-and-response\">(\n  // oxlint-disable-next-line anti-slop/no-unsafe-dictionary-type\n  request: Record<string, unknown> & { readonly responseMode: Mode }\n) => Effect.Effect<\n  Mode extends \"decoded-and-response\"\n    ? readonly [unknown, HttpClientResponse.HttpClientResponse]\n    : unknown,\n  unknown,\n  unknown\n>;\n\nexport interface CompiledHttpOperations {\n  readonly operations: readonly (\n    | UnaryOperation\n    | MutationOperation\n    | StreamingOperation\n  )[];\n  readonly errors: TreeErrors;\n  readonly keyEncoders: ReadonlyMap<string, RuntimeKeyEncoder>;\n}\n\n// oxlint-disable-next-line anti-slop/no-unknown-parameters\nconst freezeMetadata = (data: unknown) => {\n  if (!Predicate.isObject(data)) {\n    return data;\n  }\n  const { headers } = data;\n  const snapshot =\n    Predicate.isObject(headers) &&\n    (!Object.isFrozen(headers) ||\n      Object.getPrototypeOf(headers) !== Object.prototype)\n      ? Object.freeze({ ...headers })\n      : headers;\n  return Object.isFrozen(data) && snapshot === headers\n    ? data\n    : Object.freeze({ ...data, headers: snapshot });\n};\n\ninterface HttpEndpointDescription {\n  readonly identity: HttpApiEndpointIdentity;\n  readonly topLevel: boolean;\n  readonly request: HttpRequestDescription;\n}\n\nconst httpContracts = new WeakMap<\n  HttpApi.Top,\n  readonly HttpEndpointDescription[]\n>();\n\nconst describeHttpEndpoints = (\n  api: HttpApi.Top\n): readonly HttpEndpointDescription[] => {\n  const cached = httpContracts.get(api);\n  if (cached !== undefined) {\n    return cached;\n  }\n  const descriptions: HttpEndpointDescription[] = [];\n  for (const group of Object.values(api.groups)) {\n    for (const endpoint of Object.values(group.endpoints)) {\n      const identity = {\n        apiId: api.identifier,\n        groupId: group.identifier,\n        endpoint: endpoint.identifier,\n        method: endpoint.method,\n      };\n      const request = createHttpRequest(endpoint, identity);\n      if (request === undefined) {\n        continue;\n      }\n      descriptions.push({ identity, topLevel: group.topLevel, request });\n    }\n  }\n  if (\n    descriptions.every(\n      ({ request }) =>\n        request.kind === \"Mutation\" ||\n        request.input._tag === \"Inputless\" ||\n        request.input.cacheable\n    )\n  ) {\n    httpContracts.set(api, descriptions);\n  }\n  return descriptions;\n};\n\nconst extractHttpEndpoints = (\n  api: HttpApi.Top,\n  // oxlint-disable-next-line anti-slop/no-unknown-parameters\n  client: unknown\n): readonly HttpOperation[] => {\n  const operations: HttpOperation[] = [];\n  for (const { identity, topLevel, request } of describeHttpEndpoints(api)) {\n    let target = client;\n    if (!topLevel) {\n      target = Predicate.hasProperty(client, identity.groupId)\n        ? client[identity.groupId]\n        : undefined;\n    }\n    const invoke = <Mode extends \"decoded-only\" | \"decoded-and-response\">(\n      // oxlint-disable-next-line anti-slop/no-unknown-parameters\n      requestInput: unknown,\n      responseMode: Mode,\n      sseOptions?: Sse.DecodeOptions\n    ) => {\n      const method = Predicate.hasProperty(target, identity.endpoint)\n        ? target[identity.endpoint]\n        : undefined;\n      if (method === undefined) {\n        throw new TypeError(\n          `Missing HTTP client endpoint ${identity.endpoint}`\n        );\n      }\n      // oxlint-disable-next-line anti-slop/require-safety-comment-for-type-assertion, typescript/no-unsafe-type-assertion\n      const call = method as RuntimeHttpMethod;\n      // oxlint-disable-next-line effecttsgo/any-unknown-in-error-context\n      return call.bind(target)({\n        ...(Predicate.isObject(requestInput) ? requestInput : undefined),\n        responseMode,\n        ...(sseOptions === undefined ? undefined : { sseOptions }),\n      });\n    };\n    const common = {\n      identity,\n      id: JSON.stringify([identity.groupId, identity.endpoint]),\n      path: topLevel\n        ? [identity.endpoint]\n        : [identity.groupId, identity.endpoint],\n      unsupportedQueryHash: (option: \"queryKeyHashFn\" | \"queryHash\") =>\n        new EffectHttpApiQueryConfigError(\n          \"UnsupportedQueryHash\",\n          `${option} must be configured through QueryClient defaults`,\n          identity\n        ),\n      takeOptions: () => null,\n    };\n    if (request.kind === \"Streaming\") {\n      operations.push({\n        ...common,\n        ...request,\n        kind: \"Streaming\",\n        prepareStream: createHttpStreamPreparation(\n          identity,\n          (requestInput, sseOptions) =>\n            // oxlint-disable-next-line effecttsgo/any-unknown-in-error-context\n            invoke(requestInput, \"decoded-only\", sseOptions)\n        ),\n      });\n    } else {\n      operations.push({\n        ...common,\n        ...request,\n        // oxlint-disable-next-line effecttsgo/any-unknown-in-error-context\n        invoke: (requestInput) => invoke(requestInput, \"decoded-only\"),\n        ...(request.kind === \"Unary\"\n          ? {\n              metadata: {\n                // oxlint-disable-next-line anti-slop/no-unknown-parameters\n                invoke: (requestInput: unknown) =>\n                  Effect.map(\n                    // oxlint-disable-next-line effecttsgo/any-unknown-in-error-context\n                    invoke(requestInput, \"decoded-and-response\"),\n                    ([data, response]) =>\n                      freezeMetadata({\n                        data: data === undefined ? null : data,\n                        status: response.status,\n                        headers: response.headers,\n                      })\n                  ),\n                executionError: (\n                  operation: \"metadata\",\n                  cause: Cause.Cause<unknown>\n                ) => new EffectHttpApiQueryError(identity, operation, cause),\n                finalizeData: freezeMetadata,\n              },\n            }\n          : undefined),\n        executionError: (operation, cause) =>\n          new EffectHttpApiQueryError(identity, operation, cause),\n      });\n    }\n  }\n  return operations;\n};\n\nconst httpTreeErrors = (\n  api: HttpApi.Top,\n  operations: readonly HttpOperation[]\n): TreeErrors => {\n  const identities = new Map(\n    operations.map((operation) => [operation.id, operation.identity])\n  );\n  const identity = (id: string) =>\n    identities.get(id) ?? { apiId: api.identifier };\n  return {\n    invalidPrefix: (reason, cause) =>\n      new EffectHttpApiQueryConfigError(\n        \"InvalidKeyPrefix\",\n        reason === \"Shape\"\n          ? \"keyPrefix must be a non-empty readonly tuple of JSON-safe values\"\n          : \"keyPrefix must contain only JSON-safe values\",\n        { apiId: api.identifier, cause }\n      ),\n    invalidPath: (id) =>\n      new EffectHttpApiQueryConfigError(\n        \"InvalidEndpointPath\",\n        `HTTP endpoint ${id} cannot be projected into a utility path`,\n        identity(id)\n      ),\n    pathCollision: (id, path, relation) =>\n      new EffectHttpApiQueryConfigError(\n        \"EndpointPathCollision\",\n        `HTTP endpoint ${id} ${relation} utility path ${JSON.stringify(path)}`,\n        { ...identity(id), path }\n      ),\n    unknownEncoder: (id) =>\n      new EffectHttpApiQueryConfigError(\n        \"UnknownKeyEncoder\",\n        `No query-enabled HTTP endpoint exists for key encoder ${id}`,\n        identity(id)\n      ),\n    missingEncoder: (id) =>\n      new EffectHttpApiQueryConfigError(\n        \"MissingKeyEncoder\",\n        `HTTP endpoint ${id} requires a safe custom key encoder`,\n        identity(id)\n      ),\n  };\n};\n\nexport const compileHttpOperations = (\n  api: HttpApi.Top,\n  // oxlint-disable-next-line anti-slop/no-unknown-parameters\n  client: unknown,\n  // oxlint-disable-next-line anti-slop/no-unknown-parameters\n  suppliedEncoders: unknown\n): CompiledHttpOperations => {\n  const operations = extractHttpEndpoints(api, client);\n  const errors = httpTreeErrors(api, operations);\n  const encoderGroups = new Set(\n    operations\n      .filter(\n        (operation) =>\n          operation.kind !== \"Mutation\" && operation.input._tag === \"Input\"\n      )\n      .map((operation) => operation.identity.groupId)\n  );\n  const keyEncoders = new Map<string, RuntimeKeyEncoder>();\n  for (const [groupId, endpoints] of Object.entries(\n    Predicate.isObject(suppliedEncoders) ? suppliedEncoders : {}\n  )) {\n    if (!encoderGroups.has(groupId)) {\n      throw errors.unknownEncoder(JSON.stringify([groupId]));\n    }\n    if (!Predicate.isObject(endpoints)) {\n      throw new TypeError(\"HTTP key encoders must be grouped by endpoint\");\n    }\n    for (const [endpoint, encoder] of Object.entries(endpoints)) {\n      keyEncoders.set(\n        JSON.stringify([groupId, endpoint]),\n        // oxlint-disable-next-line anti-slop/require-safety-comment-for-type-assertion, typescript/no-unsafe-type-assertion\n        encoder as RuntimeKeyEncoder\n      );\n    }\n  }\n  return { operations, errors, keyEncoders };\n};\n","import { HttpApi } from \"effect/http-api\";\nimport type { HttpApiClient } from \"effect/http-api\";\n\nimport type { JsonValue, RunPromiseExit } from \"../core/types\";\nimport { createUtilityTree } from \"../core/utility-tree\";\nimport { compileHttpOperations } from \"./operation\";\nimport type {\n  CreateHttpApiQueryUtilsOptions,\n  HttpApiQueryUtils,\n} from \"./types\";\n\nexport const createHttpApiQueryUtils = <\n  const Api extends HttpApi.Constraint,\n  const Prefix extends readonly [JsonValue, ...JsonValue[]],\n  Client extends HttpApiClient.ForApi<Api, unknown, unknown>,\n>(\n  api: Api,\n  options: CreateHttpApiQueryUtilsOptions<Api, Prefix, Client>\n): HttpApiQueryUtils<Api, Prefix, Client> => {\n  if (!HttpApi.isHttpApi(api)) {\n    throw new TypeError(\"Expected an Effect HttpApi declaration\");\n  }\n  const { operations, errors, keyEncoders } = compileHttpOperations(\n    api,\n    options.client,\n    options.keyEncoders\n  );\n  // oxlint-disable-next-line anti-slop/require-safety-comment-for-type-assertion, typescript/no-unsafe-type-assertion\n  const runPromiseExit = options.runPromiseExit as\n    | RunPromiseExit<unknown>\n    | undefined;\n  const tree = createUtilityTree(operations, {\n    keyPrefix: options.keyPrefix,\n    keyNamespace: [\"http\", api.identifier],\n    keyEncoders,\n    runPromiseExit,\n    errors,\n  });\n  // oxlint-disable-next-line anti-slop/require-safety-comment-for-type-assertion, typescript/no-unsafe-type-assertion\n  return tree as HttpApiQueryUtils<Api, Prefix, Client>;\n};\n","import { CancelledError } from \"@tanstack/query-core\";\nimport type {\n  DefaultError,\n  QueryClient,\n  QueryExecuteOptions,\n  QueryFunction,\n  QueryKey,\n} from \"@tanstack/query-core\";\nimport { Predicate } from \"effect\";\n\nexport interface StreamSnapshotOptions {\n  readonly mode?: \"fresh\" | \"cached\";\n  readonly signal?: AbortSignal;\n  readonly timeoutMs?: number;\n}\n\nconst validateSnapshotControls = (\n  options: Pick<QueryExecuteOptions, \"queryHash\" | \"queryKeyHashFn\">,\n  timeoutMs: number\n): void => {\n  if (\n    Object.hasOwn(options, \"queryHash\") ||\n    Object.hasOwn(options, \"queryKeyHashFn\")\n  ) {\n    throw new TypeError(\n      \"Stream snapshots inherit hashing from QueryClient defaults\"\n    );\n  }\n  if (\n    !Number.isFinite(timeoutMs) ||\n    timeoutMs <= 0 ||\n    timeoutMs > 2_147_483_647\n  ) {\n    throw new RangeError(\"timeoutMs must be positive and at most 2147483647\");\n  }\n};\n\nexport const fetchStreamSnapshot = async <\n  TQueryFnData,\n  TError = DefaultError,\n  TData = TQueryFnData,\n  TQueryKey extends QueryKey = QueryKey,\n>(\n  queryClient: QueryClient,\n  options: QueryExecuteOptions<\n    TQueryFnData,\n    TError,\n    TData,\n    TQueryFnData,\n    TQueryKey\n  > & {\n    readonly queryFn: QueryFunction<TQueryFnData, TQueryKey>;\n    readonly queryHash?: never;\n    readonly queryKeyHashFn?: never;\n  },\n  { mode = \"fresh\", signal, timeoutMs = 10_000 }: StreamSnapshotOptions = {}\n): Promise<TData> => {\n  signal?.throwIfAborted();\n  validateSnapshotControls(options, timeoutMs);\n  if (!Predicate.isFunction(options.queryFn)) {\n    throw new TypeError(\"Stream snapshots require a callable query function\");\n  }\n  const cache = queryClient.getQueryCache();\n  const { queryHash } = queryClient.defaultQueryOptions(options);\n  const existing = cache.get(queryHash);\n  if (mode === \"cached\" && existing?.state.status === \"success\") {\n    return await queryClient.query({\n      ...options,\n      queryHash,\n      staleTime: \"static\",\n    });\n  }\n  if (\n    existing !== undefined &&\n    (existing.state.fetchStatus !== \"idle\" || existing.getObserversCount() > 0)\n  ) {\n    throw new Error(\"Stream snapshots require an idle query without observers\");\n  }\n  let published = false;\n  let started = false;\n  let executionSignal: AbortSignal | undefined;\n  let failed = false;\n  let failure: unknown;\n  let cleanup = Promise.resolve();\n  let cancellation: Promise<void> | undefined;\n  const cancel = async () => {\n    cancellation ??= queryClient.cancelQueries({\n      predicate: (query) => query.queryHash === queryHash,\n    });\n    await cancellation;\n  };\n  let ready!: () => void;\n  let rejectPublication!: (reason: AbortSignal[\"reason\"]) => void;\n  // oxlint-disable-next-line promise/avoid-new\n  const publication = new Promise<void>((resolve, reject) => {\n    ready = resolve;\n    rejectPublication = reject;\n  });\n  const stop = cache.subscribe((event) => {\n    if (\n      event.query.queryHash === queryHash &&\n      event.type === \"updated\" &&\n      event.action.type === \"success\" &&\n      event.action.manual === true\n    ) {\n      published = true;\n      ready();\n      void cancel();\n    }\n  });\n  const onAbort = () => {\n    rejectPublication(signal?.reason);\n  };\n  signal?.addEventListener(\"abort\", onAbort, { once: true });\n  const timer = setTimeout(() => {\n    rejectPublication(\n      new DOMException(\"Stream snapshot timed out\", \"TimeoutError\")\n    );\n  }, timeoutMs);\n  let result: TData;\n  try {\n    void queryClient.invalidateQueries({\n      predicate: (query) => query.queryHash === queryHash,\n      refetchType: \"none\",\n    });\n    signal?.throwIfAborted();\n    const fetching = queryClient.query({\n      ...options,\n      queryHash,\n      staleTime: 0,\n      initialDataUpdatedAt: 0,\n      queryFn: async (context) => {\n        started = true;\n        failed = false;\n        failure = undefined;\n        executionSignal = context.signal;\n        let finished!: () => void;\n        // oxlint-disable-next-line promise/avoid-new\n        cleanup = new Promise<void>((resolve) => {\n          finished = resolve;\n        });\n        try {\n          return await options.queryFn(context);\n        } catch (error) {\n          failed = true;\n          failure = error;\n          throw error;\n        } finally {\n          finished();\n        }\n      },\n    });\n    await Promise.race([publication, fetching]);\n    result = await fetching;\n    if (!published && (!started || executionSignal?.aborted === true)) {\n      throw new CancelledError({ revert: true });\n    }\n  } finally {\n    stop();\n    clearTimeout(timer);\n    signal?.removeEventListener(\"abort\", onAbort);\n    await cancel();\n    await cleanup;\n  }\n  if (failed) {\n    throw failure;\n  }\n  return result;\n};\n","import type { QueryKey } from \"@tanstack/query-core\";\n\nimport type { SupportedQueryView } from \"./inference\";\n\n/** Selects every input and stream policy for one leaf's query view. */\nexport const viewPrefix = <\n  const Key extends QueryKey,\n  Leaf extends { readonly key: () => Key },\n  View extends SupportedQueryView<Leaf>,\n>(\n  leaf: Leaf & { readonly key: () => Key },\n  view: View\n): readonly [...Key, View] => Object.freeze([...leaf.key(), view]);\n","import type { QueryFilters, QueryKey } from \"@tanstack/query-core\";\n\nimport { canonicalize } from \"./canonical-key\";\nimport type { InferInput, SupportedQueryView } from \"./inference\";\nimport type { JsonValue } from \"./types\";\nimport { viewPrefix } from \"./view-prefix\";\n\n/** Native query filters with identity supplied by the generated leaf and view. */\nexport type QueryFilterOptions = Omit<QueryFilters, \"queryKey\"> & {\n  readonly queryKey?: never;\n};\n\n/** A typed application projection into a partial canonical key payload. */\nexport type QueryFilterEncoder<Input> = (input: Input) => JsonValue;\n\n/** Builds native filters for every input of one supported query view. */\nexport function createQueryFilter<\n  Leaf extends { readonly key: () => QueryKey },\n>(\n  leaf: Leaf,\n  view: SupportedQueryView<NoInfer<Leaf>>\n): (\n  options?: QueryFilterOptions\n) => QueryFilters & { readonly queryKey: QueryKey };\n/** Builds partial-input filters without running full payload constructors or defaults. */\nexport function createQueryFilter<\n  Leaf extends { readonly key: () => QueryKey },\n  Input = InferInput<Leaf>,\n>(\n  leaf: Leaf,\n  view: SupportedQueryView<NoInfer<Leaf>>,\n  encode: QueryFilterEncoder<Input>\n): (\n  input: Input,\n  options?: QueryFilterOptions\n) => QueryFilters & { readonly queryKey: QueryKey };\nexport function createQueryFilter<\n  Leaf extends { readonly key: () => QueryKey },\n  Input = InferInput<Leaf>,\n>(\n  leaf: Leaf,\n  view: SupportedQueryView<Leaf>,\n  encode?: QueryFilterEncoder<Input>\n) {\n  const prefix = viewPrefix(leaf, view);\n  if (encode === undefined) {\n    return (\n      options?: QueryFilterOptions\n    ): QueryFilters & { readonly queryKey: QueryKey } => ({\n      ...options,\n      queryKey: prefix,\n    });\n  }\n  return (\n    input: Input,\n    options?: QueryFilterOptions\n  ): QueryFilters & { readonly queryKey: QueryKey } => ({\n    ...options,\n    queryKey: Object.freeze([...prefix, canonicalize(encode(input))]),\n  });\n}\n","import { hashKey } from \"@tanstack/query-core\";\nimport type { DehydratedState, QueryKey } from \"@tanstack/query-core\";\nimport { Array as EffectArray, Effect, Order, Schema } from \"effect\";\n\nimport type { InferQueryData, SupportedQueryView } from \"./inference\";\nimport { viewPrefix } from \"./view-prefix\";\n\n/** One generated leaf/view's cache-data codec, before observer selection. */\nexport interface HydrationCodec<\n  Data,\n  Encoded,\n  DecodingServices = never,\n  EncodingServices = never,\n> {\n  readonly prefix: QueryKey;\n  readonly schema: Schema.Codec<\n    Data,\n    Encoded,\n    DecodingServices,\n    EncodingServices\n  >;\n  readonly matches: (key: QueryKey) => boolean;\n}\n\nconst makeCodec = <S extends Schema.Codec<unknown, unknown, unknown, unknown>>(\n  prefix: QueryKey,\n  schema: S\n) => {\n  const hash = hashKey(prefix);\n  return Object.freeze({\n    prefix,\n    schema,\n    matches: (key: QueryKey) =>\n      key.length >= prefix.length &&\n      hashKey(key.slice(0, prefix.length)) === hash,\n  });\n};\n\n/** Registers a codec whose decoded type matches the generated cached representation. */\nexport const queryViewCodec = <\n  L extends { readonly key: () => QueryKey },\n  V extends Exclude<SupportedQueryView<L>, \"infinite\">,\n  S extends Schema.Codec<unknown, unknown, unknown, unknown>,\n>(\n  leaf: L,\n  view: V,\n  schema: S &\n    ([S[\"Type\"]] extends [InferQueryData<NoInfer<L>, NoInfer<V>>]\n      ? [InferQueryData<NoInfer<L>, NoInfer<V>>] extends [S[\"Type\"]]\n        ? unknown\n        : never\n      : never)\n): HydrationCodec<\n  S[\"Type\"],\n  S[\"Encoded\"],\n  S[\"DecodingServices\"],\n  S[\"EncodingServices\"]\n> => makeCodec(viewPrefix(leaf, view), schema);\n\n/** Infinite data needs an explicit page-parameter codec in addition to its page codec. */\nexport const infiniteQueryCodec = <\n  L extends { readonly key: () => QueryKey },\n  Page extends Schema.Codec<unknown, unknown, unknown, unknown>,\n  PageParam extends Schema.Codec<unknown, unknown, unknown, unknown>,\n>(\n  leaf: L & (\"infinite\" extends SupportedQueryView<L> ? unknown : never),\n  codecs: {\n    readonly page: Page &\n      ([Page[\"Type\"]] extends [\n        InferQueryData<NoInfer<L>, Extract<\"query\", SupportedQueryView<L>>>,\n      ]\n        ? [\n            InferQueryData<NoInfer<L>, Extract<\"query\", SupportedQueryView<L>>>,\n          ] extends [Page[\"Type\"]]\n          ? unknown\n          : never\n        : never);\n    readonly pageParam: PageParam;\n  }\n) =>\n  makeCodec(\n    Object.freeze([...leaf.key(), \"infinite\"]),\n    Schema.Struct({\n      pages: Schema.Array(codecs.page),\n      pageParams: Schema.Array(codecs.pageParam),\n    })\n  );\n\n/** Native synchronous callbacks for a single service-free leaf/view snapshot. */\nexport const hydrationCallbacks = <Data, Encoded>(\n  codec: HydrationCodec<Data, Encoded>\n) => ({\n  serializeData: Schema.encodeUnknownSync(codec.schema),\n  deserializeData: Schema.decodeUnknownSync(codec.schema),\n});\n\nexport class HydrationCodecError extends Error {\n  readonly _tag = \"HydrationCodecError\";\n  readonly code: \"DuplicateCodec\" | \"UnknownQuery\" | \"UnsettledQuery\";\n\n  constructor(code: HydrationCodecError[\"code\"]) {\n    super(\n      {\n        DuplicateCodec:\n          \"A hydration codec is already registered for this leaf and view\",\n        UnknownQuery: \"No hydration codec is registered for this query\",\n        UnsettledQuery:\n          \"Hydration codecs require successful queries without pending promises\",\n      }[code]\n    );\n    this.name = \"HydrationCodecError\";\n    this.code = code;\n  }\n}\n\ntype Queries = DehydratedState[\"queries\"];\n\n/** Prepares all query data before the application calls native hydrate or serializes a snapshot. */\nexport interface HydrationRegistry<\n  DecodingServices = never,\n  EncodingServices = never,\n> {\n  readonly matches: (key: QueryKey) => boolean;\n  readonly encodeQueries: (\n    queries: DehydratedState[\"queries\"]\n  ) => Effect.Effect<\n    DehydratedState[\"queries\"],\n    Schema.SchemaError | HydrationCodecError,\n    EncodingServices\n  >;\n  readonly decodeQueries: (\n    queries: DehydratedState[\"queries\"]\n  ) => Effect.Effect<\n    DehydratedState[\"queries\"],\n    Schema.SchemaError | HydrationCodecError,\n    DecodingServices\n  >;\n}\n\n/** Indexes explicit leaf/view codecs without owning a QueryClient, runner, or serialization. */\nexport const createHydrationRegistry = <\n  const Entries extends readonly HydrationCodec<\n    unknown,\n    unknown,\n    unknown,\n    unknown\n  >[],\n>(\n  entries: Entries\n): HydrationRegistry<\n  Entries[number][\"schema\"][\"DecodingServices\"],\n  Entries[number][\"schema\"][\"EncodingServices\"]\n> => {\n  type Entry = Entries[number];\n  const byLength = new Map<number, Map<string, Entry>>();\n  const codecs: readonly Entry[] = entries;\n  for (const codec of codecs) {\n    const lengthCodecs =\n      byLength.get(codec.prefix.length) ?? new Map<string, Entry>();\n    const hash = hashKey(codec.prefix);\n    if (lengthCodecs.has(hash)) {\n      throw new HydrationCodecError(\"DuplicateCodec\");\n    }\n    lengthCodecs.set(hash, codec);\n    byLength.set(codec.prefix.length, lengthCodecs);\n  }\n  const lengths = EffectArray.sort(byLength.keys(), Order.flip(Order.Number));\n  const codecFor = (key: QueryKey): Entry | undefined => {\n    for (const length of lengths) {\n      if (key.length >= length) {\n        const codec = byLength.get(length)?.get(hashKey(key.slice(0, length)));\n        if (codec !== undefined) {\n          return codec;\n        }\n      }\n    }\n    return undefined;\n  };\n  const transform = <R>(\n    queries: DehydratedState[\"queries\"],\n    convert: (\n      codec: Entry,\n      // oxlint-disable-next-line anti-slop/no-unknown-parameters\n      data: unknown\n    ) => Effect.Effect<unknown, Schema.SchemaError, R>\n  ) =>\n    Effect.forEach(\n      Effect.fnUntraced(function* transformQuery(query: Queries[number]) {\n        if (query.state.status !== \"success\" || query.promise !== undefined) {\n          return yield* Effect.fail(new HydrationCodecError(\"UnsettledQuery\"));\n        }\n        const codec = codecFor(query.queryKey);\n        if (codec === undefined) {\n          return yield* Effect.fail(new HydrationCodecError(\"UnknownQuery\"));\n        }\n        const data = yield* convert(codec, query.state.data);\n        return { ...query, state: { ...query.state, data } };\n      })\n    )(queries);\n  return {\n    matches: (key) => codecFor(key) !== undefined,\n    encodeQueries: (queries) =>\n      transform(queries, (codec, data) =>\n        // oxlint-disable-next-line effecttsgo/any-unknown-in-error-context\n        Schema.encodeUnknownEffect(codec.schema)(data)\n      ),\n    decodeQueries: (queries) =>\n      transform(queries, (codec, data) =>\n        // oxlint-disable-next-line effecttsgo/any-unknown-in-error-context\n        Schema.decodeUnknownEffect(codec.schema)(data)\n      ),\n  };\n};\n","import {\n  Cause,\n  Duration,\n  Effect,\n  Exit,\n  Option,\n  Pull,\n  Result,\n  Scope,\n  Stream,\n} from \"effect\";\n\n/** Local delivery state; it does not acknowledge server-side persistence or cleanup. */\nexport type StreamConnectionState<E> =\n  | {\n      readonly status: \"connecting\" | \"connected\";\n      readonly cursor: number;\n      readonly attempt: number;\n    }\n  | {\n      readonly status: \"backing-off\";\n      readonly cursor: number;\n      readonly attempt: number;\n      readonly delay: Duration.Duration;\n      readonly cause: Cause.Cause<E>;\n    }\n  | {\n      readonly status: \"refreshing\";\n      readonly cursor: number;\n      readonly attempt: number;\n      readonly cause: Cause.Cause<E>;\n    }\n  | { readonly status: \"completed\" | \"stopped\"; readonly cursor: number }\n  | {\n      readonly status: \"failed\";\n      readonly cursor: number;\n      readonly cause: Cause.Cause<E>;\n    };\n\nexport interface RecoverStreamOptions<A, E, R = never> {\n  /** Acquires an application-owned native stream using the last accepted cursor. */\n  readonly connect: (cursor: number) => Stream.Stream<A, E, R>;\n  /** One nonnegative safe-integer sequence per owner; older cursors are discarded. */\n  readonly cursor: (value: A) => number;\n  readonly initialCursor?: number | undefined;\n  /** One-based retry count across this consumption. Undefined stops with the original Cause. */\n  readonly retryDelay: (\n    cause: Cause.Cause<E>,\n    attempt: number\n  ) => Duration.Input | undefined;\n  readonly isReplayExpired?: ((cause: Cause.Cause<E>) => boolean) | undefined;\n  /** Refreshes authoritative reads and returns their replay cursor before reconnecting. */\n  readonly onReplayExpired?:\n    | ((cause: Cause.Cause<E>) => Effect.Effect<number, E, R>)\n    | undefined;\n  /** Runs before accepting a gap; applications can refresh affected reads here. */\n  readonly onGap?:\n    | ((previous: number, next: number) => Effect.Effect<void, E, R>)\n    | undefined;\n  readonly onState?:\n    | ((state: StreamConnectionState<E>) => Effect.Effect<void, never, R>)\n    | undefined;\n}\n\nconst checkedCursor = (cursor: number): number => {\n  if (!Number.isSafeInteger(cursor) || cursor < 0) {\n    throw new RangeError(\n      \"Stream recovery cursors must be nonnegative safe integers\"\n    );\n  }\n  return cursor;\n};\n\n/** Restarts a decoded stream without putting attempt-specific resume state in a query key. */\nexport const recoverStream = <A, E, R = never>(\n  options: RecoverStreamOptions<A, E, R>\n): Stream.Stream<A, E, R> =>\n  Stream.suspend(() => {\n    let cursor = checkedCursor(options.initialCursor ?? 0);\n    const state = (value: StreamConnectionState<E>) =>\n      options.onState?.(value) ?? Effect.void;\n    const connect = (attempt: number): Stream.Stream<A, E, R> =>\n      Stream.unwrap(\n        Effect.gen(function* connectStream() {\n          yield* state({ status: \"connecting\", cursor, attempt });\n          const scope = yield* Scope.make();\n          yield* Effect.addFinalizer((exit) => Scope.close(scope, exit));\n          const source = Stream.suspend(() => options.connect(cursor)).pipe(\n            Stream.rechunk(1),\n            Stream.mapEffect(\n              Effect.fnUntraced(function* trackCursor(value: A) {\n                const next = checkedCursor(options.cursor(value));\n                if (next <= cursor) {\n                  return Option.none<A>();\n                }\n                if (next > cursor + 1) {\n                  yield* options.onGap?.(cursor, next) ?? Effect.void;\n                }\n                cursor = next;\n                yield* state({ status: \"connected\", cursor, attempt });\n                return Option.some(value);\n              })\n            ),\n            Stream.filter(Option.isSome),\n            Stream.map((value) => value.value)\n          );\n          const pull = yield* Stream.toPull(source).pipe(Scope.provide(scope));\n          return Stream.fromPull(\n            Effect.succeed(\n              Effect.uninterruptibleMask((restore) =>\n                restore(pull).pipe(\n                  Effect.onError((cause) =>\n                    Scope.close(scope, Pull.doneExitFromCause(cause))\n                  ),\n                  Effect.catchCause((cause) => {\n                    const completion = Pull.filterDone(cause);\n                    return Effect.failCause(\n                      Result.isFailure(completion) ? completion.failure : cause\n                    );\n                  })\n                )\n              )\n            )\n          );\n        })\n      ).pipe(\n        Stream.catchCause((cause) => {\n          if (Cause.hasInterrupts(cause)) {\n            return Stream.failCause(cause);\n          }\n          return Stream.unwrap(\n            Effect.gen(function* recoverConnection() {\n              const nextAttempt = attempt + 1;\n              const delayInput = options.retryDelay(cause, nextAttempt);\n              const expired = options.isReplayExpired?.(cause) === true;\n              if (\n                delayInput === undefined ||\n                (expired && options.onReplayExpired === undefined)\n              ) {\n                return yield* Effect.failCause(cause);\n              }\n              const delay = Duration.fromInputUnsafe(delayInput);\n              yield* state({\n                status: \"backing-off\",\n                cursor,\n                attempt: nextAttempt,\n                delay,\n                cause,\n              });\n              yield* Effect.sleep(delay);\n              if (expired && options.onReplayExpired !== undefined) {\n                yield* state({\n                  status: \"refreshing\",\n                  cursor,\n                  attempt: nextAttempt,\n                  cause,\n                });\n                cursor = checkedCursor(yield* options.onReplayExpired(cause));\n              }\n              return connect(nextAttempt);\n            })\n          );\n        })\n      );\n    return connect(0).pipe(\n      Stream.onExit((exit) => {\n        if (Exit.isSuccess(exit)) {\n          return state({ status: \"completed\", cursor });\n        }\n        return state(\n          Cause.hasInterrupts(exit.cause)\n            ? { status: \"stopped\", cursor }\n            : { status: \"failed\", cursor, cause: exit.cause }\n        );\n      })\n    );\n  });\n","import { skipToken } from \"@tanstack/query-core\";\nimport type {\n  MutationFunctionContext,\n  QueryFunctionContext,\n  SkipToken,\n} from \"@tanstack/query-core\";\nimport { Array as EffectArray, Predicate } from \"effect\";\n\nimport { preserveMetadataPolicy } from \"./metadata-query\";\n\n/* oxlint-disable anti-slop/no-unsafe-dictionary-type, anti-slop/no-unknown-parameters, anti-slop/no-unknown-returns */\nexport type RuntimeOptions = Record<string, unknown>;\nexport type RuntimeQueryFunction = (\n  context: QueryFunctionContext\n) => Promise<unknown>;\nexport type RuntimeMutationFunction = (\n  input: unknown,\n  context?: MutationFunctionContext\n) => Promise<unknown>;\nexport type RuntimeQueryBuilder = (\n  options?: RuntimeOptions\n) => RuntimeOptions & { readonly queryFn: RuntimeQueryFunction | SkipToken };\nexport type RuntimeMutationBuilder = (\n  options?: RuntimeOptions\n) => RuntimeOptions & { readonly mutationFn: RuntimeMutationFunction };\ntype QueryInterceptor = (execution: {\n  readonly context: QueryFunctionContext;\n  readonly next: () => Promise<unknown>;\n}) => Promise<unknown>;\ntype MutationInterceptor = (execution: {\n  readonly input: unknown;\n  readonly context: MutationFunctionContext | undefined;\n  readonly next: () => Promise<unknown>;\n}) => Promise<unknown>;\ntype RuntimeCallback = (...args: unknown[]) => unknown;\n/* oxlint-enable anti-slop/no-unsafe-dictionary-type, anti-slop/no-unknown-parameters, anti-slop/no-unknown-returns */\n\nconst isCallback = (value: unknown): value is RuntimeCallback =>\n  Predicate.isFunction(value);\n\nexport interface RuntimeViewConfiguration {\n  readonly policy?: RuntimeOptions | undefined;\n  readonly interceptors?: readonly unknown[] | undefined;\n  readonly callbacks?: \"replace\" | \"compose\" | undefined;\n}\n\nconst once = <Data>(next: () => Promise<Data>) => {\n  let called = false;\n  return async () => {\n    if (called) {\n      throw new Error(\n        \"An execution interceptor may call next only once per attempt\"\n      );\n    }\n    called = true;\n    return await next();\n  };\n};\n\nexport const configureQuery = (\n  builder: RuntimeQueryBuilder,\n  view: string,\n  configuration: RuntimeViewConfiguration\n): RuntimeQueryBuilder => {\n  let build = builder;\n  for (const candidate of EffectArray.reverse(\n    configuration.interceptors ?? []\n  )) {\n    if (!Predicate.isFunction(candidate)) {\n      throw new TypeError(\"Query interceptors must be functions\");\n    }\n    // SAFETY: Generated leaf types guarantee the interceptor's erased runtime signature.\n    // oxlint-disable-next-line typescript/no-unsafe-type-assertion\n    const interceptor = candidate as QueryInterceptor;\n    const previous = build;\n    build = (options) => {\n      const built = previous(options);\n      const { queryFn } = built;\n      if (queryFn === skipToken) {\n        return built;\n      }\n      return {\n        ...built,\n        queryFn: async (context: QueryFunctionContext) => {\n          let original: unknown;\n          const result = await interceptor({\n            context,\n            next: once(async () => {\n              const data = await queryFn(context);\n              original = data;\n              return data;\n            }),\n          });\n          return view === \"metadata\"\n            ? preserveMetadataPolicy(original, result)\n            : result;\n        },\n      };\n    };\n  }\n  const { policy } = configuration;\n  if (policy !== undefined && Object.keys(policy).length > 0) {\n    const previous = build;\n    build = (options) => previous({ ...policy, ...options });\n  }\n  return build;\n};\n\nexport const configureMutation = (\n  builder: RuntimeMutationBuilder,\n  configuration: RuntimeViewConfiguration\n): RuntimeMutationBuilder => {\n  let build = builder;\n  for (const candidate of EffectArray.reverse(\n    configuration.interceptors ?? []\n  )) {\n    if (!Predicate.isFunction(candidate)) {\n      throw new TypeError(\"Mutation interceptors must be functions\");\n    }\n    // SAFETY: Generated leaf types guarantee the interceptor's erased runtime signature.\n    // oxlint-disable-next-line typescript/no-unsafe-type-assertion\n    const interceptor = candidate as MutationInterceptor;\n    const previous = build;\n    build = (options) => {\n      const built = previous(options);\n      return {\n        ...built,\n        // oxlint-disable-next-line anti-slop/no-unknown-parameters\n        mutationFn: async (input: unknown, context?: MutationFunctionContext) =>\n          await interceptor({\n            input,\n            context,\n            next: once(async () => await built.mutationFn(input, context)),\n          }),\n      };\n    };\n  }\n  const { policy } = configuration;\n  if (policy !== undefined && Object.keys(policy).length > 0) {\n    const previous = build;\n    build =\n      configuration.callbacks === \"compose\"\n        ? (options = {}) => {\n            const merged = { ...policy, ...options };\n            for (const name of [\"onSuccess\", \"onError\", \"onSettled\"] as const) {\n              const before = policy[name];\n              const after = options[name];\n              if (Object.hasOwn(options, name) && after === undefined) {\n                continue;\n              }\n              if (isCallback(before)) {\n                merged[name] = async (...args: unknown[]) => {\n                  await before(...args);\n                  if (isCallback(after)) {\n                    await after(...args);\n                  }\n                };\n              }\n            }\n            return previous(merged);\n          }\n        : (options) => previous({ ...policy, ...options });\n  }\n  return build;\n};\n","import type {\n  MutationObserverOptions,\n  MutationFunctionContext,\n  QueryFunctionContext,\n  QueryKey,\n  QueryObserverOptions,\n} from \"@tanstack/query-core\";\nimport { Array as EffectArray, Order, Predicate } from \"effect\";\n\nimport { configureMutation, configureQuery } from \"./configure\";\nimport type {\n  RuntimeMutationBuilder,\n  RuntimeQueryBuilder,\n  RuntimeViewConfiguration,\n} from \"./configure\";\nimport type { MutationLeaf, QueryView, SupportedQueryView } from \"./inference\";\nimport type { MutationInterceptor, QueryInterceptor } from \"./interceptor\";\nimport type {\n  LocalQueryOption,\n  MutationPolicy,\n  MutationPolicyOptions,\n  QueryPolicy,\n} from \"./policy\";\nimport { inputKind } from \"./prepared-input\";\nimport type {\n  OwnedMutationOption,\n  StreamedPolicyOptions,\n  KeysOfUnion,\n  UnaryQueryBuilder,\n  UnaryQueryBuilderDescriptor,\n} from \"./types\";\n\nexport interface UtilityNode {\n  readonly key: () => QueryKey;\n}\n\nexport interface QueryConfiguration<\n  Leaf,\n  View extends SupportedQueryView<Leaf>,\n> {\n  readonly policy?: QueryPolicy<Leaf, View> &\n    (View extends \"streamed\" ? Partial<StreamedPolicyOptions> : unknown);\n  readonly interceptors?: readonly QueryInterceptor<Leaf, View>[];\n}\n\nexport type MutationConfiguration<Leaf> = MutationPolicyOptions & {\n  readonly policy?: MutationPolicy<Leaf>;\n  readonly interceptors?: readonly MutationInterceptor<Leaf>[];\n};\n\nexport type SharedQueryInterceptor<View extends QueryView> = <Data>(execution: {\n  readonly context: QueryFunctionContext<\n    QueryKey,\n    View extends \"infinite\" ? unknown : never\n  >;\n  readonly next: () => Promise<Data>;\n}) => Promise<Data>;\n\nexport type SharedMutationInterceptor = <Data>(execution: {\n  readonly input: unknown;\n  readonly context: MutationFunctionContext | undefined;\n  readonly next: () => Promise<Data>;\n}) => Promise<Data>;\n\nexport interface SharedQueryConfiguration<View extends QueryView> {\n  readonly policy?: Omit<\n    QueryObserverOptions<unknown, unknown>,\n    LocalQueryOption\n  > &\n    (View extends \"streamed\" ? Partial<StreamedPolicyOptions> : unknown);\n  readonly interceptors?: readonly SharedQueryInterceptor<View>[];\n}\n\nexport type SharedMutationConfiguration = MutationPolicyOptions & {\n  readonly policy?: Omit<\n    MutationObserverOptions<unknown, unknown, unknown>,\n    OwnedMutationOption | \"onMutate\"\n  >;\n  readonly interceptors?: readonly SharedMutationInterceptor[];\n};\n\nexport type InheritedMethods = {\n  readonly [\n    Key in\n      | \"toString\"\n      | \"toLocaleString\"\n      | \"valueOf\"\n      | \"hasOwnProperty\"\n      | \"isPrototypeOf\"\n      | \"propertyIsEnumerable\"\n  ]: (...args: never[]) => unknown;\n};\n\n// Generated branches contain only their key builder and named children.\nexport type ChildNames<Node> = Exclude<Extract<keyof Node, string>, \"key\">;\n\nexport type Children<Node> = [ChildNames<Node>] extends [never]\n  ? never\n  : {\n      readonly [Key in ChildNames<Node>]?:\n        | UtilsConfiguration<Node[Key]>\n        | (Key extends keyof InheritedMethods ? InheritedMethods[Key] : never);\n    };\n\nexport type LeafMembers<Node> = Node extends MutationLeaf\n  ? Node\n  : [SupportedQueryView<Node>] extends [never]\n    ? never\n    : Node;\n\n/** Typed defaults and ordered interceptors for a generated tree, branch, or leaf. */\nexport type UtilsConfiguration<Node> = [LeafMembers<Node>] extends [never]\n  ? {\n      readonly [View in QueryView]?: SharedQueryConfiguration<View>;\n    } & {\n      readonly mutation?: SharedMutationConfiguration;\n      readonly scoped?: Children<Node>;\n    }\n  : {\n      readonly [View in QueryView]?: View extends SupportedQueryView<Node>\n        ? QueryConfiguration<Node, Extract<View, SupportedQueryView<Node>>>\n        : never;\n    } & {\n      readonly mutation?: [Node] extends [MutationLeaf]\n        ? MutationConfiguration<Node>\n        : never;\n      readonly scoped?: never;\n    };\n\nexport type ExtraProperties<Expected, Actual> = {\n  readonly [Key in Exclude<KeysOfUnion<Actual>, keyof Expected>]: never;\n};\n\nexport type Property<Value, Key extends PropertyKey> = Value extends unknown\n  ? Key extends keyof Value\n    ? Value[Key]\n    : never\n  : never;\n\nexport type ExactView<Expected, Actual> = ExtraProperties<Expected, Actual> &\n  (\"policy\" extends KeysOfUnion<Actual>\n    ? {\n        readonly policy?: ExtraProperties<\n          NonNullable<Property<Expected, \"policy\">>,\n          NonNullable<Property<Actual, \"policy\">>\n        >;\n      }\n    : unknown);\n\nexport type ExactChildConfiguration<Node, Key, Actual> =\n  Key extends keyof InheritedMethods\n    ? [Exclude<Actual, InheritedMethods[Key]>] extends [never]\n      ? never\n      :\n          | ExactConfiguration<Node, Exclude<Actual, InheritedMethods[Key]>>\n          | Extract<Actual, InheritedMethods[Key]>\n    : ExactConfiguration<Node, Actual>;\n\nexport type ExactConfiguration<Node, Actual> = [Actual] extends [\n  UtilsConfiguration<Node>,\n]\n  ? ExtraProperties<UtilsConfiguration<Node>, Actual> & {\n      readonly [\n        Key in KeysOfUnion<Actual> & keyof UtilsConfiguration<Node>\n      ]?: Key extends \"scoped\"\n        ? NonNullable<Property<Actual, Key>> extends object\n          ? ExtraProperties<\n              Children<Node>,\n              NonNullable<Property<Actual, Key>>\n            > & {\n              readonly [\n                Child in KeysOfUnion<NonNullable<Property<Actual, Key>>> &\n                  keyof Node\n              ]?: ExactChildConfiguration<\n                Node[Child],\n                Child,\n                NonNullable<Property<NonNullable<Property<Actual, Key>>, Child>>\n              >;\n            }\n          : unknown\n        : ExactView<\n            NonNullable<UtilsConfiguration<Node>[Key]>,\n            NonNullable<Property<Actual, Key>>\n          >;\n    }\n  : never;\n\nexport type StreamPolicy<Configuration> = Configuration extends {\n  readonly streamed: { readonly policy: infer Policy };\n}\n  ? Policy\n  : unknown;\n\nexport type ScopedConfiguration<\n  Configuration,\n  Key extends PropertyKey,\n> = Configuration extends { readonly scoped: infer Scoped }\n  ? Key extends keyof Scoped\n    ? Scoped[Key]\n    : unknown\n  : unknown;\n\nexport type RetentionDefault<Configuration, Inherited> =\n  StreamPolicy<Configuration> extends { readonly maxChunks: infer MaxChunks }\n    ? { readonly maxChunks: MaxChunks }\n    : Inherited;\n\nexport type WithDefaultRetention<Builder> =\n  UnaryQueryBuilderDescriptor<Builder> extends infer Descriptor\n    ? Descriptor extends {\n        readonly input: infer Input;\n        readonly data: infer Data;\n        readonly error: infer Error;\n        readonly key: infer Key extends QueryKey;\n        readonly skippedKey: infer SkippedKey extends QueryKey;\n        readonly adapterOptions: (options: infer AdapterOptions) => void;\n        readonly inputless: infer Inputless extends boolean;\n      }\n      ? UnaryQueryBuilder<\n          Input,\n          Data,\n          Error,\n          Key,\n          SkippedKey,\n          Omit<AdapterOptions, \"maxChunks\"> & {\n            readonly maxChunks?: StreamedPolicyOptions[\"maxChunks\"];\n          },\n          Inputless\n        >\n      : Builder\n    : Builder;\n\nexport type WithDefaultKeyRetention<KeyBuilder> = KeyBuilder extends (\n  ...args: infer Args\n) => infer Key\n  ? Args extends readonly [infer Input, infer Policy]\n    ? (input: Input, policy?: Partial<Policy>) => Key\n    : Args extends readonly [infer Policy]\n      ? (policy?: Partial<Policy>) => Key\n      : KeyBuilder\n  : KeyBuilder;\n\n/** Preserves leaf builders and makes configured stream retention optional at call sites. */\nexport type ConfiguredUtils<Node, Configuration, Inherited = unknown> = {\n  readonly [Key in keyof Node]: Node[Key] extends UtilityNode\n    ? Key extends string\n      ? ConfiguredUtils<\n          Node[Key],\n          ScopedConfiguration<Configuration, Key>,\n          RetentionDefault<Configuration, Inherited>\n        >\n      : Node[Key]\n    : RetentionDefault<Configuration, Inherited> extends {\n          readonly maxChunks: StreamedPolicyOptions[\"maxChunks\"];\n        }\n      ? Key extends \"streamedOptions\"\n        ? WithDefaultRetention<Node[Key]>\n        : Key extends \"streamedKey\"\n          ? WithDefaultKeyRetention<Node[Key]>\n          : Node[Key]\n      : Node[Key];\n};\n\ntype RuntimeConfiguration = Partial<\n  Record<QueryView | \"mutation\", RuntimeViewConfiguration>\n> & {\n  readonly scoped?: Readonly<Record<string, RuntimeConfiguration | undefined>>;\n};\n\ntype RuntimeNode = Record<string, unknown> & UtilityNode;\ntype RuntimeBuilder = (...args: unknown[]) => unknown;\n\ninterface ConfigurationLayer {\n  readonly depth: number;\n  readonly options: RuntimeConfiguration;\n}\n\nconst configuredLeaves = new WeakMap<\n  RuntimeNode,\n  {\n    readonly original: RuntimeNode;\n    readonly layers: readonly ConfigurationLayer[];\n  }\n>();\n\nconst views: readonly QueryView[] = [\n  \"query\",\n  \"infinite\",\n  \"metadata\",\n  \"live\",\n  \"streamed\",\n];\n\nconst snapshotConfiguration = (\n  configuration: RuntimeConfiguration\n): RuntimeConfiguration => {\n  const snapshot: RuntimeConfiguration = {};\n  for (const view of [...views, \"mutation\"] as const) {\n    const entry = configuration[view];\n    if (entry !== undefined) {\n      snapshot[view] = Object.freeze({\n        ...entry,\n        policy:\n          entry.policy === undefined\n            ? undefined\n            : Object.freeze({ ...entry.policy }),\n        interceptors:\n          entry.interceptors === undefined\n            ? undefined\n            : Object.freeze([...entry.interceptors]),\n      });\n    }\n  }\n  return Object.freeze(snapshot);\n};\n\nconst scopeConfigurations = (\n  layers: readonly ConfigurationLayer[]\n): readonly RuntimeConfiguration[] => {\n  const scopes = new Map<number, RuntimeConfiguration>();\n  for (const { depth, options } of layers) {\n    const scope = scopes.get(depth) ?? {};\n    for (const view of [...views, \"mutation\"] as const) {\n      const entry = options[view];\n      if (entry === undefined) {\n        continue;\n      }\n      const previous = scope[view];\n      scope[view] = {\n        policy: { ...previous?.policy, ...entry.policy },\n        interceptors: [\n          ...(previous?.interceptors ?? []),\n          ...(entry.interceptors ?? []),\n        ],\n        callbacks: entry.callbacks ?? previous?.callbacks,\n      };\n    }\n    scopes.set(depth, scope);\n  }\n  return [...scopes.values()];\n};\n\nconst configureLeaf = (\n  node: RuntimeNode,\n  configurations: readonly RuntimeConfiguration[]\n): RuntimeNode => {\n  const configured = { ...node };\n  for (const view of views) {\n    if (!Object.hasOwn(node, `${view}Options`)) {\n      continue;\n    }\n    const inherited = configurations.flatMap((entry) =>\n      entry[view] === undefined ? [] : [entry[view]]\n    );\n    if (inherited.length === 0) {\n      continue;\n    }\n    const policy: Record<string, unknown> = {};\n    for (const entry of inherited) {\n      Object.assign(policy, entry.policy);\n    }\n    const name = `${view}Options`;\n    const builder = node[name];\n    if (!Predicate.isFunction(builder)) {\n      throw new TypeError(`${name} must be a function`);\n    }\n    // SAFETY: Generated query builders return their owned query function and options.\n    // oxlint-disable-next-line typescript/no-unsafe-type-assertion\n    configured[name] = configureQuery(builder as RuntimeQueryBuilder, view, {\n      policy,\n      interceptors: inherited.flatMap((entry) => entry.interceptors ?? []),\n    });\n    if (view === \"streamed\") {\n      const { streamedKey } = node;\n      if (!Predicate.isFunction(streamedKey)) {\n        throw new TypeError(\"Streamed queries require a key builder\");\n      }\n      // oxlint-disable-next-line anti-slop/require-safety-comment-for-type-assertion, typescript/no-unsafe-type-assertion\n      const buildKey = streamedKey as RuntimeBuilder;\n      const history = Object.fromEntries(\n        Object.entries(policy).filter(([option]) =>\n          [\n            \"maxChunks\",\n            \"refetchMode\",\n            \"publicationBatchSize\",\n            \"publicationMaxWaitMs\",\n          ].includes(option)\n        )\n      );\n      configured[\"streamedKey\"] =\n        inputKind(node.key) === \"Inputless\"\n          ? (options?: Partial<StreamedPolicyOptions>) =>\n              buildKey({ ...history, ...options })\n          : (input: unknown, options?: Partial<StreamedPolicyOptions>) =>\n              buildKey(input, { ...history, ...options });\n    }\n  }\n  if (Object.hasOwn(node, \"mutationOptions\")) {\n    const mutations = configurations.flatMap((entry) =>\n      entry.mutation === undefined ? [] : [entry.mutation]\n    );\n    if (mutations.length > 0) {\n      const candidate = node[\"mutationOptions\"];\n      if (!Predicate.isFunction(candidate)) {\n        throw new TypeError(\"mutationOptions must be a function\");\n      }\n      // SAFETY: Generated mutation builders return their owned mutation function and options.\n      // oxlint-disable-next-line typescript/no-unsafe-type-assertion\n      let builder = candidate as RuntimeMutationBuilder;\n      for (const entry of mutations) {\n        builder = configureMutation(builder, {\n          policy: entry.policy,\n          callbacks: entry.callbacks,\n        });\n      }\n      const interceptors = mutations.flatMap(\n        (entry) => entry.interceptors ?? []\n      );\n      if (interceptors.length > 0) {\n        builder = configureMutation(builder, { interceptors });\n      }\n      configured[\"mutationOptions\"] = builder;\n    }\n  }\n  return configured;\n};\n\nconst configureNode = (\n  node: RuntimeNode,\n  inherited: readonly ConfigurationLayer[],\n  configuration: RuntimeConfiguration\n): RuntimeNode => {\n  const configurations = [\n    ...inherited,\n    {\n      depth: node.key().length,\n      options: snapshotConfiguration(configuration),\n    },\n  ];\n  const children = Object.entries(node).filter(\n    (entry): entry is [string, RuntimeNode] =>\n      Predicate.hasProperty(entry[1], \"key\") &&\n      Predicate.isFunction(entry[1].key)\n  );\n  for (const name of Object.keys(configuration.scoped ?? {})) {\n    if (!children.some(([key]) => key === name)) {\n      throw new TypeError(`Unknown utility scope: ${name}`);\n    }\n  }\n  if (children.length === 0) {\n    const previous = configuredLeaves.get(node);\n    const original = previous?.original ?? node;\n    const layers = EffectArray.sortWith(\n      [...(previous?.layers ?? []), ...configurations],\n      (layer) => layer.depth,\n      Order.Number\n    );\n    const configured = Object.freeze({\n      ...configureLeaf(original, scopeConfigurations(layers)),\n    });\n    configuredLeaves.set(configured, { original, layers });\n    return configured;\n  }\n  return Object.freeze({\n    ...node,\n    ...Object.fromEntries(\n      children.map(([key, child]) => [\n        key,\n        configureNode(\n          child,\n          configurations,\n          configuration.scoped !== undefined &&\n            Object.hasOwn(configuration.scoped, key)\n            ? (configuration.scoped[key] ?? {})\n            : {}\n        ),\n      ])\n    ),\n  });\n};\n\n/** Applies root, branch, and leaf configuration while preserving generated cache identity. */\nexport const configureUtils = <\n  Node extends UtilityNode,\n  const Configuration extends object,\n>(\n  tree: Node,\n  configuration: Configuration &\n    NoInfer<UtilsConfiguration<Node>> &\n    NoInfer<ExactConfiguration<Node, Configuration>>\n): ConfiguredUtils<Node, Configuration> => {\n  // oxlint-disable-next-line anti-slop/require-safety-comment-for-type-assertion, typescript/no-unsafe-type-assertion\n  const node = tree as RuntimeNode;\n  // oxlint-disable-next-line anti-slop/require-safety-comment-for-type-assertion, typescript/no-unsafe-type-assertion\n  const options = configuration as RuntimeConfiguration;\n  // oxlint-disable-next-line anti-slop/require-safety-comment-for-type-assertion, typescript/no-unsafe-type-assertion\n  return configureNode(node, [], options) as ConfiguredUtils<\n    Node,\n    Configuration\n  >;\n};\n","import { hashKey } from \"@tanstack/query-core\";\nimport type { QueryFilters, QueryKey } from \"@tanstack/query-core\";\nimport { Predicate } from \"effect\";\n\nimport type { QueryView } from \"./inference\";\nimport type { QueryFilterOptions } from \"./query-filter\";\n\ninterface BranchNode {\n  readonly key: () => QueryKey;\n}\n// Generated branches and leaves expose a key function; other child properties are builders.\n// oxlint-disable-next-line anti-slop/no-unknown-parameters\nconst isBranchNode = (node: unknown): node is BranchNode =>\n  Predicate.hasProperty(node, \"key\") && Predicate.isFunction(node.key);\n\n/** Selects one view across a generated root, branch or leaf without changing cache keys. */\nexport const createBranchQueryFilter = (\n  branch: { readonly key: () => QueryKey },\n  view: QueryView\n): ((\n  options?: QueryFilterOptions\n) => QueryFilters & { readonly queryKey: QueryKey }) => {\n  const byLength = new Map<number, Set<string>>();\n  const seen = new WeakSet();\n  const visit = (node: BranchNode) => {\n    if (seen.has(node)) {\n      return;\n    }\n    seen.add(node);\n    if (Predicate.hasProperty(node, `${view}Options`)) {\n      const prefix: QueryKey = [...node.key(), view];\n      const entries = byLength.get(prefix.length) ?? new Set<string>();\n      entries.add(hashKey(prefix));\n      byLength.set(prefix.length, entries);\n    }\n    for (const child of Object.values(node)) {\n      if (isBranchNode(child)) {\n        visit(child);\n      }\n    }\n  };\n  visit(branch);\n  const queryKey = branch.key();\n  return (options = {}) => ({\n    ...options,\n    queryKey,\n    predicate: (query) => {\n      for (const [length, prefixes] of byLength) {\n        if (\n          query.queryKey.length >= length &&\n          prefixes.has(hashKey(query.queryKey.slice(0, length)))\n        ) {\n          return options.predicate?.(query) ?? true;\n        }\n      }\n      return false;\n    },\n  });\n};\n","import type { Cause } from \"effect\";\nimport { Option, Predicate } from \"effect\";\n\nimport { isEffectHttpApiQueryError } from \"../http/errors\";\nimport { isEffectRpcQueryError } from \"../rpc/errors\";\n\nexport type FailureOf<Error> = Error extends {\n  readonly cause: Cause.Cause<infer Failure>;\n}\n  ? Failure\n  : never;\nexport type TaggedFailure<Error> = Extract<\n  FailureOf<Error>,\n  { readonly _tag: string }\n>;\n\n/** Matches one typed failure only; defects, interruptions and composite Causes never match. */\nexport const findDeclaredError = <\n  Error,\n  Tag extends TaggedFailure<Error>[\"_tag\"],\n>(\n  error: Error,\n  tag: Tag\n): Option.Option<Extract<TaggedFailure<Error>, { readonly _tag: Tag }>> => {\n  if (!isEffectRpcQueryError(error) && !isEffectHttpApiQueryError(error)) {\n    return Option.none();\n  }\n  const [reason] = error.cause.reasons;\n  if (error.cause.reasons.length !== 1 || reason?._tag !== \"Fail\") {\n    return Option.none();\n  }\n  const failure = reason.error;\n  if (!Predicate.hasProperty(failure, \"_tag\") || failure._tag !== tag) {\n    return Option.none();\n  }\n  // SAFETY: The wrapper's typed Cause and discriminant identify the declared union member.\n  // oxlint-disable-next-line anti-slop/require-safety-comment-for-type-assertion, typescript/no-unsafe-type-assertion\n  const matched = failure as Extract<\n    TaggedFailure<Error>,\n    { readonly _tag: Tag }\n  >;\n  return Option.some(matched);\n};\n","import { Effect, Stream } from \"effect\";\nimport type { Exit } from \"effect\";\n\nexport interface ConsumeEventsOptions<\n  A,\n  E,\n  R,\n  HandlerError = never,\n  HandlerServices = never,\n> {\n  readonly onEvent: (\n    event: A\n  ) => Effect.Effect<void, HandlerError, HandlerServices>;\n  /** Runs before consuming; this is not a transport connection acknowledgement. */\n  readonly onStart?: Effect.Effect<void, HandlerError, HandlerServices>;\n  /** Runs after stream cleanup, including failure or interruption. */\n  readonly onExit?: (\n    exit: Exit.Exit<void, E | HandlerError>\n  ) => Effect.Effect<void, never, R | HandlerServices>;\n}\n\n/** Consumes events sequentially without retaining history or owning a runtime or cache. */\nexport const consumeEvents = <\n  A,\n  E,\n  R,\n  HandlerError = never,\n  HandlerServices = never,\n>(\n  source: Stream.Stream<A, E, R>,\n  options: ConsumeEventsOptions<A, E, R, HandlerError, HandlerServices>\n): Effect.Effect<void, E | HandlerError, R | HandlerServices> =>\n  Effect.suspend(() =>\n    (options.onStart ?? Effect.void).pipe(\n      Effect.andThen(Stream.runForEach(source, options.onEvent)),\n      Effect.onExit((exit) => options.onExit?.(exit) ?? Effect.void)\n    )\n  );\n"],"mappings":";;;;;AAIA,MAAa,qBACX,OACA,uBAAO,IAAI,QAAQ,MACM;CACzB,IAAI,KAAK,IAAI,KAAK,GAChB,MAAM,IAAI,UAAU,oCAAoC;CAE1D,KAAK,IAAI,KAAK;CACd,MAAM,OAAoB,CAAC;CAC3B,KAAK,IAAI,QAAQ,GAAG,QAAQ,MAAM,QAAQ,SAAS,GAAG;EACpD,IAAI,CAAC,OAAO,OAAO,OAAO,KAAK,GAC7B,MAAM,IAAI,UAAU,2CAA2C;EAGjE,KAAK,KAAK,aAAa,MAAM,QAAQ,IAAI,CAAC;CAC5C;CACA,KAAK,OAAO,KAAK;CACjB,OAAO,OAAO,OAAO,IAAI;AAC3B;AAEA,MAAM,sBAEJ,OACA,SACc;CACd,MAAM,YAAqB,OAAO,eAAe,KAAK;CACtD,IAAI,cAAc,OAAO,aAAa,cAAc,MAClD,MAAM,IAAI,UAAU,4CAA4C;CAElE,MAAM,OAAkC,CAAC;CACzC,KAAK,MAAM,OAAOA,QAAY,KAAK,OAAO,KAAK,KAAK,GAAG,MAAM,MAAM,GAAG;EACpE,IAAI,QAAQ,eAAe,QAAQ,eACjC,MAAM,IAAI,UACR,kEACF;EAGF,KAAK,OAAO,aAAa,MAAM,MAAM,IAAI;CAC3C;CACA,KAAK,OAAO,KAAK;CACjB,OAAO,OAAO,OAAO,IAAI;AAC3B;;AAGA,MAAa,gBAEX,OACA,uBAAO,IAAI,QAAQ,MACL;CACd,IACE,UAAU,QACV,UAAU,SAAS,KAAK,KACxB,UA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