{"version":3,"file":"self-C4MKRmrc.mjs","names":[],"sources":["../src/widgets/remote/contract/portal-function.ts","../src/widgets/remote/contract/capabilities/built-in.ts","../src/widgets/remote/contract/capabilities/read.ts","../src/widgets/remote/contract/capabilities/content-mutation.ts","../src/widgets/remote/contract/capabilities/self.ts"],"sourcesContent":["/** Canonical Portal function contract shared by worker and host code. */\nimport {\n  defineRemoteDomCapabilityFunction,\n  getRemoteDomCapabilityFunctionMetadata,\n  RemoteDomCapabilityFunctionError,\n  type RemoteDomCapabilityFunctionMetadata,\n  type RemoteDomSerializableValue,\n} from \"@fluid-app/widget-runtime/worker\";\n\nconst PORTAL_FUNCTION_METADATA = Symbol.for(\n  \"@fluid-app/portal-sdk/portal-function-metadata\",\n);\nconst PORTAL_FUNCTION_ERROR_PREFIX = \"PORTAL_FUNCTION_ERROR:\";\n\n/** JSON-compatible value that can cross the widget worker boundary. */\nexport type PortalFunctionJsonValue = RemoteDomSerializableValue;\n\ntype PortalFunctionJsonPrimitive = null | boolean | number | string;\n\ntype IsAny<Value> = 0 extends 1 & Value ? true : false;\n\ntype IsPortalFunctionJsonBranch<Value, Seen> =\n  Value extends PortalFunctionJsonPrimitive\n    ? true\n    : Value extends readonly (infer Item)[]\n      ? IsPortalFunctionJsonValue<Item, Seen>\n      : Value extends (...args: never[]) => unknown\n        ? false\n        : Value extends object\n          ? Extract<keyof Value, symbol> extends never\n            ? false extends {\n                [Key in keyof Value]-?: IsPortalFunctionJsonValue<\n                  Required<Value>[Key],\n                  Seen | Value\n                >;\n              }[keyof Value]\n              ? false\n              : true\n            : false\n          : false;\n\ntype IsPortalFunctionJsonValue<Value, Seen = never> =\n  IsAny<Value> extends true\n    ? false\n    : [Value] extends [never]\n      ? false\n      : [Value] extends [Seen]\n        ? true\n        : false extends (\n              Value extends unknown\n                ? IsPortalFunctionJsonBranch<Value, Seen>\n                : never\n            )\n          ? false\n          : true;\n\ntype IsExactlyVoid<Value> = [Value] extends [void]\n  ? [void] extends [Value]\n    ? true\n    : false\n  : false;\n\ntype PortalFunctionContractErrors<Output, Input> =\n  IsPortalFunctionJsonValue<Output> extends true\n    ? IsExactlyVoid<Input> extends true\n      ? []\n      : IsPortalFunctionJsonValue<Input> extends true\n        ? []\n        : [error: \"Portal function input must contain only JSON values\"]\n    : [error: \"Portal function output must contain only JSON values\"];\n\n/** Stable error classification returned by Portal functions. */\nexport type PortalFunctionErrorCode =\n  | \"NOT_MOUNTED\"\n  | \"NOT_DECLARED\"\n  | \"NOT_GRANTED\"\n  | \"INVALID_ARGUMENT\"\n  | \"UNAVAILABLE\"\n  | \"UNSUPPORTED\"\n  | \"HOST_FAILURE\"\n  | \"INVALID_RESPONSE\";\n\nconst PORTAL_FUNCTION_ERROR_CODES: ReadonlySet<PortalFunctionErrorCode> =\n  new Set([\n    \"NOT_MOUNTED\",\n    \"NOT_DECLARED\",\n    \"NOT_GRANTED\",\n    \"INVALID_ARGUMENT\",\n    \"UNAVAILABLE\",\n    \"UNSUPPORTED\",\n    \"HOST_FAILURE\",\n    \"INVALID_RESPONSE\",\n  ]);\n\n/** A stable, serializable failure reported by a Portal function call. */\nexport class PortalFunctionError extends Error {\n  /** Machine-readable failure classification. */\n  readonly code: PortalFunctionErrorCode;\n\n  /**\n   * Creates an error with a stable code and developer-facing message.\n   * @param code - Machine-readable failure classification.\n   * @param message - Developer-facing explanation safe to cross the worker boundary.\n   * @example throw new PortalFunctionError(\"INVALID_ARGUMENT\", \"An id is required.\");\n   */\n  constructor(code: PortalFunctionErrorCode, message: string) {\n    super(message);\n    this.name = \"PortalFunctionError\";\n    this.code = code;\n  }\n}\n\n/** Serializable identity of one versioned host capability method. */\nexport interface PortalFunctionDefinition {\n  /** Capability family declared by a widget. */\n  readonly capability: string;\n  /** Capability contract version. */\n  readonly version: string;\n  /** Method name within the capability. */\n  readonly method: string;\n}\n\n/** Async worker-side callable for a Portal function. */\nexport type PortalFunction<Output, Input = void> = [Input] extends [void]\n  ? () => Promise<Output>\n  : (input: Input) => Promise<Output>;\n\nexport type AnyPortalFunction = (...args: never[]) => Promise<unknown>;\n\n/** Host-side handler shape for a Portal function definition. */\nexport type PortalFunctionHandler<Output, Input = void> = [Input] extends [void]\n  ? () => Output | Promise<Output>\n  : (input: Input) => Output | Promise<Output>;\n\n/** Bound Portal function definition and host handler. */\nexport interface PortalFunctionImplementation {\n  /** Capability identity implemented by the handler. */\n  readonly definition: PortalFunctionDefinition;\n  /** Worker callable associated with the implementation. */\n  readonly portalFunction: AnyPortalFunction;\n  /** Host handler invoked for the function. */\n  readonly handler: (...args: never[]) => unknown | Promise<unknown>;\n}\n\n/**\n * Defines a typed Portal function backed by a versioned host capability.\n * Widgets must include the returned function in `defineWidget({ uses: [...] })`\n * before calling it. Inputs and outputs must contain only JSON values.\n *\n * @param definition - Stable capability, version, and method identity.\n * @returns An async worker callable that rejects with {@link PortalFunctionError}.\n * @throws {@link PortalFunctionError} when a call is not mounted or declared, has invalid input, is unsupported or unavailable, fails in the host, or returns an invalid response.\n * @remarks Define functions during module initialization. Both input and output types must contain only JSON-compatible values.\n *\n * @example\n * ```ts\n * const getGreeting = definePortalFunction<string>({\n *   capability: \"greeting\",\n *   version: \"1\",\n *   method: \"get\",\n * });\n * ```\n */\nexport function definePortalFunction<Output, Input = void>(\n  definition: PortalFunctionDefinition,\n  ..._contractErrors: PortalFunctionContractErrors<Output, Input>\n): PortalFunction<Output, Input> {\n  const remoteFunction = defineRemoteDomCapabilityFunction<\n    RemoteDomSerializableValue,\n    RemoteDomSerializableValue | void\n  >(definition);\n  const portalFunction = (async (...args: readonly unknown[]) => {\n    try {\n      if (args.length > 1) {\n        throw new PortalFunctionError(\n          \"INVALID_ARGUMENT\",\n          `Portal function \"${definition.capability}.${definition.method}\" accepts at most one argument.`,\n        );\n      }\n      const invoke = remoteFunction as (\n        input?: RemoteDomSerializableValue,\n      ) => Promise<RemoteDomSerializableValue>;\n      return args.length === 0\n        ? ((await invoke()) as Output)\n        : ((await invoke(args[0] as RemoteDomSerializableValue)) as Output);\n    } catch (error) {\n      throw toPortalFunctionError(error);\n    }\n  }) as PortalFunction<Output, Input>;\n\n  return attachPortalFunctionMetadata(portalFunction, definition);\n}\n\n/**\n * Binds a host handler to a function created by {@link definePortalFunction}.\n *\n * @param portalFunction - Defined function whose metadata identifies the capability.\n * @param handler - Host handler with the same input and output contract.\n * @returns The definition, callable, and handler as one implementation record.\n * @throws {@link PortalFunctionError} when `portalFunction` was not created by `definePortalFunction`.\n * @remarks This registration helper is for capability implementations. Widget components call the defined Portal function instead.\n * @example\n * ```ts\n * const implementation = implementPortalFunction(getGreeting, () => \"Hello\");\n * ```\n */\nexport function implementPortalFunction<Output, Input = void>(\n  portalFunction: PortalFunction<Output, Input>,\n  handler: PortalFunctionHandler<NoInfer<Output>, NoInfer<Input>>,\n): PortalFunctionImplementation {\n  const definition = getPortalFunctionMetadata(portalFunction);\n  if (!definition) {\n    throw new PortalFunctionError(\n      \"INVALID_ARGUMENT\",\n      \"implementPortalFunction requires a function created by definePortalFunction.\",\n    );\n  }\n\n  return {\n    definition,\n    portalFunction: portalFunction as AnyPortalFunction,\n    handler: handler as (...args: never[]) => unknown | Promise<unknown>,\n  };\n}\n\n/** @internal Used to normalize worker declarations and host implementations. */\nexport function getPortalFunctionMetadata(\n  value: unknown,\n): PortalFunctionDefinition | undefined {\n  if (typeof value !== \"function\") return undefined;\n\n  const portalMetadata = Reflect.get(value, PORTAL_FUNCTION_METADATA);\n  if (isPortalFunctionDefinition(portalMetadata)) return portalMetadata;\n\n  const runtimeMetadata = getRemoteDomCapabilityFunctionMetadata(value);\n  return runtimeMetadata\n    ? toPortalFunctionDefinition(runtimeMetadata)\n    : undefined;\n}\n\nexport function attachPortalFunctionMetadata<Output, Input>(\n  portalFunction: PortalFunction<Output, Input>,\n  definition: PortalFunctionDefinition,\n): PortalFunction<Output, Input> {\n  const stableDefinition = Object.freeze({ ...definition });\n  Object.defineProperty(portalFunction, PORTAL_FUNCTION_METADATA, {\n    configurable: false,\n    enumerable: false,\n    writable: false,\n    value: stableDefinition,\n  });\n  return portalFunction;\n}\n\nfunction toPortalFunctionDefinition(\n  metadata: RemoteDomCapabilityFunctionMetadata,\n): PortalFunctionDefinition {\n  return {\n    capability: metadata.capability,\n    version: metadata.version,\n    method: metadata.method,\n  };\n}\n\nfunction isPortalFunctionDefinition(\n  value: unknown,\n): value is PortalFunctionDefinition {\n  if (typeof value !== \"object\" || value === null) return false;\n  return (\n    \"capability\" in value &&\n    typeof value.capability === \"string\" &&\n    \"version\" in value &&\n    typeof value.version === \"string\" &&\n    \"method\" in value &&\n    typeof value.method === \"string\"\n  );\n}\n\nfunction toPortalFunctionError(error: unknown): PortalFunctionError {\n  if (error instanceof PortalFunctionError) return error;\n  if (error instanceof RemoteDomCapabilityFunctionError) {\n    return new PortalFunctionError(error.code, error.message);\n  }\n\n  const hostFailure = parseHostFunctionError(error);\n  if (hostFailure) return hostFailure;\n\n  return new PortalFunctionError(\n    \"HOST_FAILURE\",\n    \"The portal host could not complete this function call.\",\n  );\n}\n\nfunction parseHostFunctionError(error: unknown): PortalFunctionError | null {\n  if (!(error instanceof Error)) return null;\n  const prefixIndex = error.message.indexOf(PORTAL_FUNCTION_ERROR_PREFIX);\n  if (prefixIndex < 0) return null;\n\n  const encoded = error.message.slice(\n    prefixIndex + PORTAL_FUNCTION_ERROR_PREFIX.length,\n  );\n  const separatorIndex = encoded.indexOf(\":\");\n  if (separatorIndex < 0) return null;\n\n  const code = encoded.slice(0, separatorIndex);\n  if (!isPortalFunctionErrorCode(code)) return null;\n  const message = encoded.slice(separatorIndex + 1).trim();\n  return new PortalFunctionError(\n    code,\n    message || \"The portal host could not complete this function call.\",\n  );\n}\n\nfunction isPortalFunctionErrorCode(\n  value: string,\n): value is PortalFunctionErrorCode {\n  return PORTAL_FUNCTION_ERROR_CODES.has(value as PortalFunctionErrorCode);\n}\n","import {\n  attachPortalFunctionMetadata,\n  definePortalFunction,\n  type PortalFunction,\n} from \"../portal-function\";\n\n/** Identifier used by portal resources. IDs can be numeric or string-backed. */\nexport type PortalEntityId = string | number;\n\n/** Signed-in portal account details available to a widget. */\nexport type UserAccount = {\n  /** Numeric account identifier. */\n  readonly id: number;\n  /** Public account identifier. */\n  readonly publicId: string;\n  /** Customer or representative account role. */\n  readonly memberType: \"customer\" | \"rep\";\n  /** Given name. */\n  readonly firstName: string;\n  /** Family name. */\n  readonly lastName: string;\n  /** Name intended for display. */\n  readonly displayName: string;\n  /** Account email address. */\n  readonly email: string;\n  /** Profile biography, if set. */\n  readonly bio: string | null;\n  /** Profile avatar URL, if set. */\n  readonly avatarUrl: string | null;\n  /** Public account slug. */\n  readonly slug: string;\n  /** Social network names mapped to profile URLs. */\n  readonly socialLinks: Readonly<Record<string, string>> | null;\n  /** Default ISO country code, if set. */\n  readonly defaultCountryIso: string | null;\n  /** Active market ISO country code, if set. */\n  readonly marketCountryIso: string | null;\n};\n\n/** Store identity, branding, app links, and reward-point labels. */\nexport type PortalStore = {\n  /** Numeric store identifier. */\n  readonly id: number;\n  /** Store name. */\n  readonly name: string;\n  /** Store subdomain. */\n  readonly subdomain: string;\n  /** Store logo URL, if configured. */\n  readonly logoUrl: string | null;\n  /** Store icon URL, if configured. */\n  readonly iconUrl: string | null;\n  /** Apple App Store URL, if configured. */\n  readonly appStoreUrl: string | null;\n  /** Google Play Store URL, if configured. */\n  readonly playStoreUrl: string | null;\n  /** Whether bundle subscriptions are enabled. */\n  readonly bundleSubscriptionsEnabled: boolean;\n  /** Singular reward-points label. */\n  readonly rewardPointsLabelSingular: string;\n  /** Plural reward-points label. */\n  readonly rewardPointsLabelPlural: string;\n};\n\n/** Common identity fields for resources in a portal definition summary. */\nexport type PortalNamedEntitySummary = {\n  /** Persisted entity identifier, if available. */\n  readonly id: PortalEntityId | null;\n  /** Definition resource identifier, if available. */\n  readonly definitionId: PortalEntityId | null;\n  /** Entity name, if available. */\n  readonly name: string | null;\n  /** Entity route slug, if available. */\n  readonly slug: string | null;\n};\n\n/** Screen identity and component count returned with a portal summary. */\nexport type PortalScreenSummary = PortalNamedEntitySummary & {\n  /** Number of component nodes on the screen. */\n  readonly componentCount: number;\n};\n\n/** Navigation identity and aggregate counts returned with a portal summary. */\nexport type PortalNavigationSummary = {\n  /** Persisted navigation identifier, if available. */\n  readonly id: PortalEntityId | null;\n  /** Definition resource identifier, if available. */\n  readonly definitionId: PortalEntityId | null;\n  /** Navigation name, if available. */\n  readonly name: string | null;\n  /** Number of navigation items. */\n  readonly navigationItemCount: number;\n  /** Number of linked screens. */\n  readonly screenCount: number;\n};\n\n/** Counted, immutable collection used by portal summary responses. */\nexport type PortalSummaryCollection<Item> = {\n  /** Total item count. */\n  readonly count: number;\n  /** Summary items. */\n  readonly items: readonly Item[];\n};\n\n/** Active profile, theme, and navigation summary for the current portal. */\nexport type PortalProfileSummary = {\n  /** Profile name, if available. */\n  readonly name: string | null;\n  /** Definition resource identifier, if available. */\n  readonly definitionId: PortalEntityId | null;\n  /** Active theme identifier, if available. */\n  readonly activeThemeId: string | null;\n  /** Themes available to the profile. */\n  readonly themes: PortalSummaryCollection<PortalNamedEntitySummary>;\n  /** Primary navigation summary, if configured. */\n  readonly navigation: PortalNavigationSummary | null;\n  /** Mobile navigation summary, if configured. */\n  readonly mobileNavigation: PortalNavigationSummary | null;\n};\n\n/** Published portal definition, profile, and screen summary. */\nexport type PortalAppSummary = {\n  /** Current definition identifier, if available. */\n  readonly definitionId: PortalEntityId | null;\n  /** Active immutable version number, if published. */\n  readonly publishedVersion: number | null;\n  /** Active profile summary, if configured. */\n  readonly profile: PortalProfileSummary | null;\n  /** Screen summaries. */\n  readonly screens: PortalSummaryCollection<PortalScreenSummary>;\n};\n\n/** One resolved navigation item, including its nested children. */\nexport type PortalNavigationItem = {\n  /** Persisted navigation-item identifier, if available. */\n  readonly id: number | null;\n  /** Destination slug, if the item targets a screen. */\n  readonly slug: string | null;\n  /** Visible navigation label. */\n  readonly label: string;\n  /** Icon identifier, if configured. */\n  readonly icon: string | null;\n  /** Navigation section, if configured. */\n  readonly section: string | null;\n  /** Target screen identifier, if configured. */\n  readonly screenId: number | null;\n  /** Sort position, if available. */\n  readonly position: number | null;\n  /** Parent item identifier, if nested. */\n  readonly parentId: number | null;\n  /** Origin of the navigation item. */\n  readonly source: \"user\" | \"system\" | \"code\" | null;\n  /** Nested child items. */\n  readonly children: readonly PortalNavigationItem[];\n};\n\n/** Current route and resolved navigation tree for the mounted portal. */\nexport type PortalNavigationState = {\n  /** Slug of the current route. */\n  readonly currentSlug: string;\n  /** Slug of the previous route, if known. */\n  readonly previousSlug: string | null;\n  /** Portal base path used to build hrefs. */\n  readonly basePath: string;\n  /** Resolved navigation tree. */\n  readonly navItems: readonly PortalNavigationItem[];\n};\n\n/** Route target accepted by {@link buildPortalHref} and {@link navigateTo}. */\nexport type PortalNavigationTarget =\n  | string\n  | {\n      /** Portal screen slug. */\n      readonly slug: string;\n    }\n  | {\n      /** Portal-relative or allowed absolute href. */\n      readonly href: string;\n    };\n\n/** Whether fullscreen is supported and active for the current widget mount. */\nexport type FullscreenState = {\n  /** Whether the widget is currently fullscreen. */\n  readonly fullscreen: boolean;\n  /** Whether the current host can enter fullscreen. */\n  readonly available: boolean;\n};\n\nexport const ACCOUNT_DEFINITION = {\n  capability: \"account\",\n  version: \"1\",\n  method: \"get\",\n} as const;\nexport const STORE_DEFINITION = {\n  capability: \"store\",\n  version: \"1\",\n  method: \"get\",\n} as const;\nexport const APP_DEFINITION = {\n  capability: \"fluidApp\",\n  version: \"1\",\n  method: \"get\",\n} as const;\nexport const PROFILE_DEFINITION = {\n  capability: \"fluidProfile\",\n  version: \"1\",\n  method: \"get\",\n} as const;\nexport const NAVIGATION_STATE_DEFINITION = {\n  capability: \"appNavigation\",\n  version: \"1\",\n  method: \"get\",\n} as const;\nexport const BUILD_HREF_DEFINITION = {\n  capability: \"appNavigation\",\n  version: \"1\",\n  method: \"buildHref\",\n} as const;\nexport const NAVIGATE_DEFINITION = {\n  capability: \"appNavigation\",\n  version: \"1\",\n  method: \"navigate\",\n} as const;\nexport const FULLSCREEN_STATE_DEFINITION = {\n  capability: \"fullscreen\",\n  version: \"1\",\n  method: \"get\",\n} as const;\nexport const REQUEST_FULLSCREEN_DEFINITION = {\n  capability: \"fullscreen\",\n  version: \"1\",\n  method: \"request\",\n} as const;\nexport const EXIT_FULLSCREEN_DEFINITION = {\n  capability: \"fullscreen\",\n  version: \"1\",\n  method: \"exit\",\n} as const;\nexport const ALLOW_ANCHOR_URL_DEFINITION = {\n  capability: \"externalNavigation\",\n  version: \"1\",\n  method: \"allowAnchorUrl\",\n} as const;\n\n/**\n * Gets the signed-in account from the mounted Portal host.\n *\n * @returns The current {@link UserAccount}.\n * @throws {@link PortalFunctionError} when the function is undeclared, unavailable, or fails in the host.\n * @remarks Declare `getUserAccount` in the widget's `uses` list. Call it only after the widget mounts.\n * @example const account = await getUserAccount();\n */\nexport const getUserAccount: PortalFunction<UserAccount> =\n  definePortalFunction<UserAccount>(ACCOUNT_DEFINITION);\n/**\n * Gets the store that owns the mounted Portal.\n * @returns The current {@link PortalStore}.\n * @throws {@link PortalFunctionError} when undeclared, unavailable, or rejected by the host.\n * @remarks Declare `getStore` in `uses` and call it only after mount.\n * @example const store = await getStore();\n */\nexport const getStore: PortalFunction<PortalStore> =\n  definePortalFunction<PortalStore>(STORE_DEFINITION);\n/**\n * Gets the current Portal Definition summary.\n * @returns The current {@link PortalAppSummary}.\n * @throws {@link PortalFunctionError} when undeclared, unavailable, or rejected by the host.\n * @remarks Declare `getPortalApp` in `uses` and call it only after mount.\n * @example const app = await getPortalApp();\n */\nexport const getPortalApp: PortalFunction<PortalAppSummary> =\n  definePortalFunction<PortalAppSummary>(APP_DEFINITION);\n/**\n * Gets the active Portal profile summary.\n * @returns The active {@link PortalProfileSummary}.\n * @throws {@link PortalFunctionError} when undeclared, unavailable, or rejected by the host.\n * @remarks Declare `getPortalProfile` in `uses` and call it only after mount.\n * @example const profile = await getPortalProfile();\n */\nexport const getPortalProfile: PortalFunction<PortalProfileSummary> =\n  definePortalFunction<PortalProfileSummary>(PROFILE_DEFINITION);\n/**\n * Gets the current route and resolved navigation tree.\n * @returns The current {@link PortalNavigationState}.\n * @throws {@link PortalFunctionError} when undeclared, unavailable, or rejected by the host.\n * @remarks Declare `getNavigationState` in `uses` and call it only after mount.\n * @example const navigation = await getNavigationState();\n */\nexport const getNavigationState: PortalFunction<PortalNavigationState> =\n  definePortalFunction<PortalNavigationState>(NAVIGATION_STATE_DEFINITION);\n/**\n * Converts a Portal navigation target to an href for the current mount.\n * @param target - Screen slug, href, or shorthand string target.\n * @returns A host-approved href.\n * @throws {@link PortalFunctionError} when undeclared, invalid, unavailable, or rejected by the host.\n * @remarks Declare `buildPortalHref` in `uses` and call it only after mount.\n * @example const href = await buildPortalHref({ slug: \"shop\" });\n */\nexport const buildPortalHref: PortalFunction<string, PortalNavigationTarget> =\n  definePortalFunction<string, PortalNavigationTarget>(BUILD_HREF_DEFINITION);\n\nconst navigate = definePortalFunction<null, PortalNavigationTarget>(\n  NAVIGATE_DEFINITION,\n);\n/**\n * Navigates the mounted Portal to a target.\n * @param target - Screen slug, href, or shorthand string target.\n * @returns A promise that resolves after the host accepts the navigation.\n * @throws {@link PortalFunctionError} when undeclared, invalid, unavailable, or rejected by the host.\n * @remarks Declare `navigateTo` in `uses`. It changes host navigation and requires a mounted widget.\n * @example await navigateTo({ slug: \"shop\" });\n */\nexport const navigateTo: PortalFunction<void, PortalNavigationTarget> =\n  attachPortalFunctionMetadata<void, PortalNavigationTarget>(async (target) => {\n    await navigate(target);\n  }, NAVIGATE_DEFINITION);\n\n/**\n * Gets fullscreen availability and state for the current widget mount.\n * @returns The current {@link FullscreenState}.\n * @throws {@link PortalFunctionError} when undeclared, unavailable, or rejected by the host.\n * @remarks Declare `getFullscreenState` in `uses` and call it only after mount.\n * @example const state = await getFullscreenState();\n */\nexport const getFullscreenState: PortalFunction<FullscreenState> =\n  definePortalFunction<FullscreenState>(FULLSCREEN_STATE_DEFINITION);\n\nconst request = definePortalFunction<null>(REQUEST_FULLSCREEN_DEFINITION);\n/**\n * Requests fullscreen for the current widget mount.\n * @returns A promise that resolves when the host completes the request.\n * @throws {@link PortalFunctionError} when undeclared, unsupported, unavailable, or rejected by the host.\n * @remarks Declare `requestFullscreen` in `uses`. Browser policy can require a user gesture.\n * @example await requestFullscreen();\n */\nexport const requestFullscreen: PortalFunction<void> =\n  attachPortalFunctionMetadata<void, void>(async () => {\n    await request();\n  }, REQUEST_FULLSCREEN_DEFINITION);\n\nconst exit = definePortalFunction<null>(EXIT_FULLSCREEN_DEFINITION);\n/**\n * Exits fullscreen for the current widget mount.\n * @returns A promise that resolves when the host completes the request.\n * @throws {@link PortalFunctionError} when undeclared, unsupported, unavailable, or rejected by the host.\n * @remarks Declare `exitFullscreen` in `uses` and call it only after mount.\n * @example await exitFullscreen();\n */\nexport const exitFullscreen: PortalFunction<void> =\n  attachPortalFunctionMetadata<void, void>(async () => {\n    await exit();\n  }, EXIT_FULLSCREEN_DEFINITION);\n\n/**\n * Allows one exact absolute HTTP(S) URL for an anchor in the current mount.\n * Declare this function in `uses` and call it before rendering or changing the link.\n *\n * @param url - Exact absolute URL to allow.\n * @returns The allowed URL for assignment to the anchor.\n * @throws {@link PortalFunctionError} for invalid or disallowed URLs and host failures.\n * @remarks Declare `allowAnchorUrl` in `uses`. Approval is scoped to the current mount and exact URL.\n *\n * @example\n * ```ts\n * const href = await allowAnchorUrl(\"https://example.com/help\");\n * ```\n */\nexport const allowAnchorUrl: PortalFunction<string, string> =\n  definePortalFunction<string, string>(ALLOW_ANCHOR_URL_DEFINITION);\n","import {\n  definePortalFunction,\n  type PortalFunction,\n  type PortalFunctionDefinition,\n  type PortalFunctionJsonValue,\n} from \"../portal-function\";\n\n/** Cursor pagination accepted by Portal list functions. */\nexport type PortalPageInput = {\n  /** Opaque cursor returned as {@link PortalPage.nextCursor} by the previous call. */\n  readonly cursor?: string;\n  /** Maximum number of items to request. The host can enforce a smaller limit. */\n  readonly limit?: number;\n};\n\n/** One page of Portal resources. */\nexport type PortalPage<Item> = {\n  /** Resources in this page. */\n  readonly items: readonly Item[];\n  /** Opaque cursor for the next page, or `null` when this is the last page. */\n  readonly nextCursor: string | null;\n};\n\n/** Country and state data available in the current Portal. */\nexport type PortalCountry = {\n  /** ISO country code. */\n  readonly code: string;\n  /** Localized country name. */\n  readonly name: string;\n  /** ISO currency code used by the country. */\n  readonly currencyCode: string;\n  /** States or other first-level administrative areas in the country. */\n  readonly states: readonly {\n    /** State or administrative-area code. */\n    readonly code: string;\n    /** Localized state or administrative-area name. */\n    readonly name: string;\n  }[];\n};\n\n/**\n * Filters for {@link listCountries}. Cursor pagination fields remain accepted\n * for compatibility, but the Portal tenant endpoint returns the complete list.\n */\nexport type ListCountriesInput = {\n  /** @deprecated The Portal tenant endpoint returns every country and ignores this field. */\n  readonly cursor?: string;\n  /** @deprecated The Portal tenant endpoint returns every country and ignores this field. */\n  readonly limit?: number;\n  /** ISO language code used to localize returned names. */\n  readonly languageIso?: string;\n};\n\n/** Language available in the current Portal. */\nexport type PortalLanguage = {\n  /** ISO language code. */\n  readonly code: string;\n  /** Display name of the language. */\n  readonly name: string;\n};\n\n/** Country and language used by {@link getAddressFields}. */\nexport type GetAddressFieldsInput = {\n  /** ISO code of the country whose address form is requested. */\n  readonly countryCode: string;\n  /** ISO language code used to localize field labels. */\n  readonly languageIso?: string;\n};\n\n/** Localized address-field configuration for a country. */\nexport type PortalAddressFields = {\n  /** ISO code of the requested country. */\n  readonly countryCode: string;\n  /** Localized country name. */\n  readonly countryName: string;\n  /** Address fields in display order. */\n  readonly fields: readonly {\n    /** Stable address-field key. */\n    readonly field: string;\n    /** Localized label for the field. */\n    readonly label: string;\n    /** Whether the address requires the field. */\n    readonly required: boolean;\n  }[];\n};\n\n/** Image metadata returned with a product or enrollment pack. */\nexport type PortalImage = {\n  /** Absolute image URL, or `null` when no image URL is available. */\n  readonly url: string | null;\n  /** Alternative text, or `null` when none is available. */\n  readonly alt: string | null;\n};\n\n/** Purchasable variant of a Portal product. */\nexport type PortalProductVariant = {\n  /** Variant identifier, or `null` when the source has no identifier. */\n  readonly id: number | null;\n  /** Whether the variant can currently be purchased. */\n  readonly available: boolean | null;\n  /** ISO currency code for monetary fields. */\n  readonly currency: string | null;\n  /** Variant images. */\n  readonly images: readonly PortalImage[];\n  /** Whether this is the product's master variant. */\n  readonly isMaster: boolean | null;\n  /** Variant display position. */\n  readonly position: number | null;\n  /** Retail price serialized as a decimal string. */\n  readonly price: string | null;\n  /** Stock-keeping unit. */\n  readonly sku: string | null;\n  /** Variant display title. */\n  readonly title: string | null;\n  /** Wholesale price serialized as a decimal string. */\n  readonly wholesalePrice: string | null;\n  /**\n   * Commission volume serialized as a decimal string.\n   *\n   * `null` whenever the viewer may not see volume — either the merchant has\n   * hidden CV/QV from customer-facing surfaces, or this viewer is not entitled\n   * to it. Render conditionally: the field is always present, but its value can\n   * legitimately be absent per company and per viewer.\n   */\n  readonly cv: string | null;\n  /**\n   * Qualifying volume serialized as a decimal string. `null` under the same\n   * conditions as {@link cv}.\n   */\n  readonly qv: string | null;\n};\n\n/** Product data available to a widget. */\nexport type PortalProduct = {\n  /** Product identifier, or `null` when the source has no identifier. */\n  readonly id: number | null;\n  /** Product display name. */\n  readonly name: string | null;\n  /** URL-safe product slug. */\n  readonly slug: string | null;\n  /** Product description. */\n  readonly description: string | null;\n  /** Retail price serialized as a decimal string. */\n  readonly price: string | null;\n  /** Wholesale price serialized as a decimal string. */\n  readonly wholesalePrice: string | null;\n  /** ISO currency code for monetary fields. */\n  readonly currency: string | null;\n  /** Product publication or availability status. */\n  readonly status: string | null;\n  /** Product images. */\n  readonly images: readonly PortalImage[];\n  /** Purchasable product variants. */\n  readonly variants: readonly PortalProductVariant[];\n  /** Number of associated media items. */\n  readonly mediaCount: number | null;\n  /** ISO 8601 creation timestamp. */\n  readonly createdAt: string | null;\n  /** Whether the product represents a bundle. */\n  readonly isBundle: boolean;\n  /** Minimum and maximum one-time prices as decimal strings. */\n  readonly priceRange: {\n    /** Minimum one-time price. */\n    readonly min: string;\n    /** Maximum one-time price. */\n    readonly max: string;\n  } | null;\n  /** Minimum and maximum subscription prices as decimal strings. */\n  readonly subscriptionPriceRange: {\n    /** Minimum subscription price. */\n    readonly min: string;\n    /** Maximum subscription price. */\n    readonly max: string;\n  } | null;\n  /** Absolute URL of the product in the shop. */\n  readonly shopLink: string | null;\n  /** Whether purchasing the product requires customization choices. */\n  readonly hasCustomizations: boolean | null;\n  /**\n   * Commission volume serialized as a decimal string.\n   *\n   * `null` whenever the viewer may not see volume — either the merchant has\n   * hidden CV/QV from customer-facing surfaces, or this viewer is not entitled\n   * to it. Render conditionally: the field is always present, but its value can\n   * legitimately be absent per company and per viewer.\n   */\n  readonly cv: string | null;\n  /**\n   * Qualifying volume serialized as a decimal string. `null` under the same\n   * conditions as {@link cv}.\n   */\n  readonly qv: string | null;\n};\n\n/** Pagination and ordering for {@link listProducts}. */\nexport type ListProductsInput = PortalPageInput & {\n  /** Product ordering. */\n  readonly sort?:\n    | \"title_asc\"\n    | \"title_desc\"\n    | \"price_asc\"\n    | \"price_desc\"\n    | \"created_at_asc\"\n    | \"created_at_desc\";\n};\n\n/** Product identifier accepted by {@link getProduct}. */\nexport type GetProductInput = {\n  /** Product identifier. */\n  readonly id: string | number;\n};\n\n/** Query and pagination for {@link searchProducts}. */\nexport type SearchProductsInput = PortalPageInput & {\n  /** Text to match against searchable product data. */\n  readonly query: string;\n};\n\n/** Media associated with a product. */\nexport type PortalProductMedia = {\n  /** Media identifier. */\n  readonly id: number | null;\n  /** Media display title. */\n  readonly title: string | null;\n  /** Media format or type. */\n  readonly mediaType: string | null;\n  /** Absolute media URL. */\n  readonly url: string | null;\n};\n\n/** Product identifier accepted by {@link listProductMedia}. */\nexport type ListProductMediaInput = {\n  /** Product whose media is requested. */\n  readonly productId: string | number;\n};\n\n/** Supported aggregation windows for product and content metrics. */\nexport type PortalMetricsPeriod = \"7d\" | \"30d\" | \"90d\" | \"1y\" | \"all\";\n\n/** Metric selection for {@link listProductMetrics}. */\nexport type ListProductMetricsInput = {\n  /** Whether to return direct visits or visits attributed to shares. */\n  readonly kind: \"visits\" | \"shareVisits\";\n  /** Aggregation window. */\n  readonly period?: PortalMetricsPeriod;\n  /** Maximum number of metric rows to return. */\n  readonly limit?: number;\n};\n\n/** Aggregated metric value for a Portal resource. */\nexport type PortalMetric = {\n  /** Resource identifier, or `null` for an aggregate without one resource. */\n  readonly id: number | null;\n  /** Metric total for the requested period. */\n  readonly total: number;\n};\n\n/** Calendar event visible to the signed-in Portal user. */\nexport type PortalCalendarEvent = {\n  /** Event identifier. */\n  readonly id: number;\n  /** Event title. */\n  readonly title: string;\n  /** Event description. */\n  readonly description: string | null;\n  /** Event color value supplied by the host. */\n  readonly color: string | null;\n  /** Absolute event URL. */\n  readonly url: string | null;\n  /** ISO 8601 event start. */\n  readonly start: string;\n  /** ISO 8601 event end. */\n  readonly end: string;\n  /** IANA time-zone name. */\n  readonly timeZone: string | null;\n  /** Event status. */\n  readonly status: string | null;\n  /** Absolute event image URL. */\n  readonly imageUrl: string | null;\n  /** Event venue. */\n  readonly venue: string | null;\n  /** ISO country codes where the event is available. */\n  readonly countries: readonly string[];\n  /** Whether the event spans a whole day rather than explicit times. */\n  readonly isAllDay: boolean;\n};\n\n/** Call-to-action configuration attached to content media. */\nexport type PortalMediaCta = {\n  /** Whether the call to action is enabled. */\n  readonly enabled: boolean;\n  /** Action behavior, or `null` when no behavior is configured. */\n  readonly type: \"link\" | \"cart\" | \"email\" | \"phone\" | null;\n  /** Text shown on the action button. */\n  readonly buttonText: string | null;\n  /** Button color value supplied by the host. */\n  readonly buttonColor: string | null;\n  /** Accessible or supporting description of the action. */\n  readonly buttonDescription: string | null;\n  /** URL or URI used by the action. */\n  readonly actionUrl: string | null;\n};\n\n/** Content-library media item available to a widget. */\nexport type PortalMedia = {\n  /** Media identifier. */\n  readonly id: number;\n  /** Media title. */\n  readonly title: string;\n  /** Media description. */\n  readonly description: string | null;\n  /** Media format supplied by the content library. */\n  readonly contentFormat: string | null;\n  /** Publication or processing status. */\n  readonly status: string | null;\n  /** Absolute content URL. */\n  readonly url: string | null;\n  /** Absolute thumbnail URL. */\n  readonly thumbnailUrl: string | null;\n  /** Configured call to action. */\n  readonly cta: PortalMediaCta | null;\n  /** Search-engine metadata for the media item. */\n  readonly seo: {\n    /** Search result title. */\n    readonly title: string | null;\n    /** Search result description. */\n    readonly description: string | null;\n    /** Absolute social or search preview image URL. */\n    readonly imageUrl: string | null;\n    /** Whether crawlers should be asked not to index the item. */\n    readonly blockCrawler: boolean;\n  } | null;\n  /** ISO 8601 creation timestamp. */\n  readonly createdAt: string;\n  /** ISO 8601 last-update timestamp. */\n  readonly updatedAt: string;\n};\n\n/** Filters, localization, ordering, and pagination for {@link listContentMedia}. */\nexport type ListContentMediaInput = PortalPageInput & {\n  /** Text to match against media titles. */\n  readonly title?: string;\n  /** Ownership scope for the returned media. */\n  readonly ownership?: \"all\" | \"mine\" | \"company\";\n  /** Media format to return. */\n  readonly contentFormat?: \"video\" | \"image\" | \"pdf\" | \"ppt\";\n  /** Media ordering. */\n  readonly sort?: \"title_asc\" | \"title_desc\";\n  /** ISO language code for localized content. */\n  readonly languageIso?: string;\n};\n\n/** Media identifier and localization for {@link getContentMedia}. */\nexport type GetContentMediaInput = {\n  /** Content-media identifier. */\n  readonly id: number;\n  /** ISO language code for localized content. */\n  readonly languageIso?: string;\n};\n\n/** Content playlist available to a widget. */\nexport type PortalPlaylist = {\n  /** Playlist identifier. */\n  readonly id: number;\n  /** Playlist title. */\n  readonly title: string;\n  /** Playlist description. */\n  readonly description: string | null;\n  /** Number of items in the playlist. */\n  readonly itemsCount: number;\n  /** Whether the signed-in user has favorited the playlist. */\n  readonly isFavorited: boolean;\n  /** Absolute playlist image URL. */\n  readonly imageUrl: string | null;\n  /** ISO 8601 creation timestamp. */\n  readonly createdAt: string;\n  /** ISO 8601 last-update timestamp. */\n  readonly updatedAt: string;\n};\n\n/** Filters, ordering, and pagination for {@link listPlaylists}. */\nexport type ListPlaylistsInput = PortalPageInput & {\n  /** Text to match against playlist titles. */\n  readonly title?: string;\n  /** Ownership scope for the returned playlists. */\n  readonly ownership?: \"all\" | \"mine\" | \"company\";\n  /** Playlist ordering. */\n  readonly sort?:\n    | \"title_asc\"\n    | \"title_desc\"\n    | \"created_at_asc\"\n    | \"created_at_desc\";\n};\n\n/** Playlist identifier accepted by {@link getPlaylist}. */\nexport type GetPlaylistInput = {\n  /** Playlist identifier. */\n  readonly id: number;\n};\n\n/** Product summary embedded in a playlist item. */\nexport type PortalPlaylistProduct = {\n  /** Product identifier. */\n  readonly id: number;\n  /** Product display name. */\n  readonly name: string;\n  /** URL-safe product slug. */\n  readonly slug: string | null;\n  /** Product description. */\n  readonly description: string | null;\n  /** Retail price serialized as a decimal string. */\n  readonly price: string | null;\n  /** Wholesale price serialized as a decimal string. */\n  readonly wholesalePrice: string | null;\n  /** ISO currency code for monetary fields. */\n  readonly currency: string | null;\n  /** Product publication or availability status. */\n  readonly status: string | null;\n  /** Product images. */\n  readonly images: readonly PortalImage[];\n  /** Number of associated media items. */\n  readonly mediaCount: number | null;\n  /** ISO 8601 creation timestamp. */\n  readonly createdAt: string | null;\n};\n\n/**\n * Content embedded in a playlist item.\n *\n * Narrow on `type` before accessing fields specific to media, pages, products,\n * or enrollment packs.\n */\nexport type PortalPlaylistItemContent =\n  | {\n      /** Identifies content-library media. */\n      readonly type: \"media\";\n      /** Media identifier. */\n      readonly id: number;\n      /** Media title. */\n      readonly title: string;\n      /** Media description. */\n      readonly description: string | null;\n      /** Absolute media URL. */\n      readonly url: string | null;\n      /** Absolute thumbnail URL. */\n      readonly thumbnailUrl: string | null;\n    }\n  | {\n      /** Identifies a content page. */\n      readonly type: \"page\";\n      /** Page identifier. */\n      readonly id: number;\n      /** Page title. */\n      readonly title: string | null;\n      /** URL-safe page slug. */\n      readonly slug: string | null;\n      /** Page publication status. */\n      readonly status: \"published\" | \"unpublished\";\n      /** Page description. */\n      readonly description: string | null;\n      /** Absolute page image URL. */\n      readonly imageUrl: string | null;\n    }\n  | {\n      /** Identifies a product. */\n      readonly type: \"product\";\n      /** Embedded product summary. */\n      readonly product: PortalPlaylistProduct;\n    }\n  | {\n      /** Identifies an enrollment pack. */\n      readonly type: \"enrollmentPack\";\n      /** Enrollment-pack identifier. */\n      readonly id: number;\n      /** Enrollment-pack title. */\n      readonly title: string;\n      /** URL-safe enrollment-pack slug. */\n      readonly slug: string | null;\n      /** Enrollment-pack description. */\n      readonly description: string | null;\n      /** Absolute enrollment-pack URL. */\n      readonly url: string | null;\n      /** Enrollment-pack images. */\n      readonly images: readonly PortalImage[];\n    };\n\n/** One positioned resource in a content playlist. */\nexport type PortalPlaylistItem = {\n  /** Playlist-item identifier. */\n  readonly id: number;\n  /** Kind of resource referenced by the item. */\n  readonly contentType: \"media\" | \"page\" | \"product\" | \"enrollmentPack\";\n  /** Identifier of the referenced resource. */\n  readonly contentId: number;\n  /** Display position within the playlist. */\n  readonly position: number | null;\n  /** ISO 8601 creation timestamp. */\n  readonly createdAt: string;\n  /** Embedded resource data. Narrow the {@link PortalPlaylistItemContent} value on its `type` field. */\n  readonly content: PortalPlaylistItemContent;\n};\n\n/** Playlist, localization, and pagination for {@link listPlaylistItems}. */\nexport type ListPlaylistItemsInput = PortalPageInput & {\n  /** Playlist whose items are requested. */\n  readonly playlistId: number;\n  /** ISO language code for localized item content. */\n  readonly languageIso?: string;\n};\n\n/** Content-page summary available to a widget. */\nexport type PortalPageContent = {\n  /** Page identifier. */\n  readonly id: number;\n  /** Page title. */\n  readonly title: string | null;\n  /** URL-safe page slug. */\n  readonly slug: string | null;\n  /** Whether code or the visual builder owns the page. */\n  readonly source: \"code\" | \"builder\" | null;\n  /** Page publication status. */\n  readonly status: \"published\" | \"unpublished\";\n  /** Page description. */\n  readonly description: string | null;\n  /** Absolute page image URL. */\n  readonly imageUrl: string | null;\n  /** Countries where the page is available. */\n  readonly countries: readonly PortalCountry[];\n};\n\n/** Filters, localization, ordering, and pagination for {@link listPages}. */\nexport type ListPagesInput = PortalPageInput & {\n  /** Text to match against page titles. */\n  readonly title?: string;\n  /** Page ordering. */\n  readonly sort?: \"title_asc\" | \"title_desc\";\n  /** ISO language code for localized page content. */\n  readonly languageIso?: string;\n};\n\n/** Page identifier and localization for {@link getPage}. */\nexport type GetPageInput = {\n  /** Page identifier. */\n  readonly id: number;\n  /** ISO language code for localized page content. */\n  readonly languageIso?: string;\n};\n\n/** Content page together with its share URL. */\nexport type PortalPageDetail = {\n  /** Page data. */\n  readonly page: PortalPageContent;\n  /** Absolute URL for sharing the page. */\n  readonly shareLink: string | null;\n};\n\n/** Enrollment pack available to a widget. */\nexport type PortalEnrollmentPack = {\n  /** Enrollment-pack identifier. */\n  readonly id: number;\n  /** Enrollment-pack title. */\n  readonly title: string;\n  /** URL-safe enrollment-pack slug. */\n  readonly slug: string | null;\n  /** Enrollment-pack description. */\n  readonly description: string | null;\n  /** Absolute enrollment-pack URL. */\n  readonly url: string | null;\n  /** Canonical absolute URL. */\n  readonly canonicalUrl: string | null;\n  /** Enrollment-pack images. */\n  readonly images: readonly PortalImage[];\n};\n\n/** Enrollment-pack identifier accepted by {@link getEnrollmentPack}. */\nexport type GetEnrollmentPackInput = {\n  /** Enrollment-pack identifier. */\n  readonly id: number;\n};\n\ntype ListContentMetricsBaseInput = {\n  /** Whether to return direct visits or visits attributed to shares. */\n  readonly kind: \"visits\" | \"shareVisits\";\n  /** Aggregation window. */\n  readonly period?: PortalMetricsPeriod;\n  /** Maximum number of metric rows to return. */\n  readonly limit?: number;\n};\n\n/** Resource and metric selection for {@link listContentMetrics}. */\nexport type ListContentMetricsInput =\n  | (ListContentMetricsBaseInput & {\n      /** Content resource to aggregate. */\n      readonly resource: \"media\" | \"pages\";\n      /** ISO language code for localized media or pages. */\n      readonly languageIso?: string;\n    })\n  | (ListContentMetricsBaseInput & {\n      /** Aggregate playlist metrics. Playlists do not accept `languageIso`. */\n      readonly resource: \"playlists\";\n    });\n\n/** Share record created for a Portal resource. */\nexport type PortalShare = {\n  /** Share identifier. */\n  readonly id: number;\n  /** Absolute share URL. */\n  readonly url: string;\n  /** Kind of shared resource. */\n  readonly shareableType: \"media\" | \"product\" | \"library\" | \"page\";\n  /** Identifier of the shared resource. */\n  readonly shareableId: number;\n  /** ISO 8601 creation timestamp. */\n  readonly createdAt: string;\n};\n\n/** Digital asset available from the Portal content library. */\nexport type PortalDamAsset = {\n  /** Asset identifier. */\n  readonly id: number;\n  /** Stable asset code used to query its paths. */\n  readonly code: string;\n  /** Asset display name. */\n  readonly name: string;\n  /** Asset description. */\n  readonly description: string | null;\n  /** Asset category. */\n  readonly category: string | null;\n  /** Absolute URL of the default asset variant. */\n  readonly defaultVariantUrl: string | null;\n  /** Canonical path for the asset. */\n  readonly canonicalPath: string | null;\n  /** ISO 8601 creation timestamp. */\n  readonly createdAt: string;\n  /** ISO 8601 last-update timestamp. */\n  readonly updatedAt: string | null;\n};\n\n/** Asset and pagination selection for {@link listDamAssetPaths}. */\nexport type ListDamAssetPathsInput = PortalPageInput & {\n  /** Stable asset code from {@link PortalDamAsset.code}. */\n  readonly assetCode: string;\n};\n\n/** One accessible path for a digital asset. */\nexport type PortalDamAssetPath = {\n  /** Asset-path identifier. */\n  readonly id: number;\n  /** Stable code of the parent asset. */\n  readonly assetCode: string;\n  /** Asset path supplied by the content library. */\n  readonly path: string;\n  /** ISO 8601 creation timestamp. */\n  readonly createdAt: string;\n};\n\n/** JSON value stored in an order metafield. */\nexport type PortalOrderJsonValue = PortalFunctionJsonValue;\n\n/** Metafield attached to an order. Returned only when explicitly requested. */\nexport type PortalOrderMetafield = {\n  /** Metafield namespace. */\n  readonly namespace: string;\n  /** Metafield key. */\n  readonly key: string;\n  /** JSON-compatible metafield value. */\n  readonly value: PortalOrderJsonValue;\n  /** Backend-defined metafield value type. */\n  readonly valueType: string;\n};\n\n/** Order returned by {@link listOrders}. */\nexport type PortalOrderSummary = {\n  /** Numeric order identifier. */\n  readonly id: number;\n  /** Merchant-facing order number. */\n  readonly orderNumber: string;\n  /** Customer email address, when available. */\n  readonly email: string | null;\n  /** Customer first name, when available. */\n  readonly firstName: string | null;\n  /** Customer last name, when available. */\n  readonly lastName: string | null;\n  /** Order total as a decimal string. */\n  readonly amount: string;\n  /** Order lifecycle status, for example `draft`, `completed`, or `archived`. */\n  readonly status: string;\n  /** Backend-defined fulfillment status. */\n  readonly fulfillmentStatus: string;\n  /** ISO 4217 currency code for monetary values. */\n  readonly currencyCode: string;\n  /** URL-safe token accepted by {@link getOrder}. */\n  readonly token: string;\n  /** ISO 8601 creation timestamp. */\n  readonly createdAt: string;\n  /** ISO 8601 last-update timestamp. */\n  readonly updatedAt: string;\n  /** Localized display value for the order total. */\n  readonly totalDisplayAmount: string;\n  /** Number of distinct line items. */\n  readonly itemsCount: number;\n  /** Total quantity across all line items. */\n  readonly quantityCount: number;\n  /** ISO 8601 sale timestamp, when available. */\n  readonly saleDate: string | null;\n  /** Preview data for the first line item, when available. */\n  readonly firstItem: {\n    /** First line-item title. */\n    readonly title: string;\n    /** First line-item image URL. */\n    readonly imageUrl: string;\n  } | null;\n  /** Image URLs for order-item thumbnails. */\n  readonly thumbnailImageUrls?: readonly string[];\n  /** Order metafields, when explicitly requested. */\n  readonly metafields?: readonly PortalOrderMetafield[];\n};\n\n/** Order statuses accepted by the Portal tenant order-list endpoint. */\nexport const PORTAL_ORDER_LIST_STATUSES = [\n  \"draft\",\n  \"pending\",\n  \"pending_review\",\n  \"processing\",\n  \"completed\",\n  \"cancelled\",\n  \"archived\",\n] as const;\n\n/** Order lifecycle status accepted by {@link listOrders}. */\nexport type PortalOrderListStatus = (typeof PORTAL_ORDER_LIST_STATUSES)[number];\n\n/** Filters and pagination for {@link listOrders}. */\nexport type ListOrdersInput = PortalPageInput & {\n  /** Search text matched by the Portal tenant order-list endpoint. */\n  readonly search?: string;\n  /** Order lifecycle filter accepted by the Portal tenant order-list endpoint. */\n  readonly status?: PortalOrderListStatus;\n  /** Include order metafields. They are omitted by default. */\n  readonly includeMetafields?: boolean;\n};\n\n/** Routing token and optional metafield selection for {@link getOrder}. */\nexport type GetOrderInput = {\n  /** URL-safe order token returned by {@link listOrders}. */\n  readonly token: string;\n  /** Include order metafields. They are omitted by default. */\n  readonly includeMetafields?: boolean;\n};\n\n/** Address attached to an order. */\nexport type PortalOrderAddress = {\n  /** Address identifier. */\n  readonly id: number;\n  /** Recipient name. */\n  readonly name: string | null;\n  /** Primary street-address line. */\n  readonly address1: string | null;\n  /** Secondary street-address line. */\n  readonly address2: string | null;\n  /** City or locality. */\n  readonly city: string | null;\n  /** State, province, or region. */\n  readonly state: string | null;\n  /** Postal or ZIP code. */\n  readonly postalCode: string | null;\n  /** ISO 3166-1 alpha-2 country code. */\n  readonly countryCode: string | null;\n  /** Recipient phone number. */\n  readonly phone: string | null;\n};\n\n/** Line item attached to an order. */\nexport type PortalOrderLineItem = {\n  /** Line-item identifier. */\n  readonly id: number;\n  /** Product identifier. */\n  readonly productId: number;\n  /** Product display name. */\n  readonly productName: string;\n  /** Product-variant identifier, when applicable. */\n  readonly variantId: number | null;\n  /** Product-variant display name, when applicable. */\n  readonly variantName: string | null;\n  /** Stock-keeping unit, when available. */\n  readonly sku: string | null;\n  /** Product image URL, when available. */\n  readonly imageUrl: string | null;\n  /** Purchased quantity. */\n  readonly quantity: number;\n  /** Unit price as a decimal string. */\n  readonly price: string;\n  /** Localized unit-price display value. */\n  readonly priceInCurrency: string;\n  /** Line total as a decimal string. */\n  readonly total: string;\n  /** Localized line-total display value. */\n  readonly totalInCurrency: string;\n  /** Source subscription, when the item originated from one. */\n  readonly sourceSubscription: {\n    /** URL-safe source-subscription token. */\n    readonly subscriptionToken: string;\n  } | null;\n};\n\n/** Payment summary attached to an order. */\nexport type PortalOrderPaymentMethod = {\n  /** Payment-method identifier. */\n  readonly id: number;\n  /** Payment provider or source. */\n  readonly source: string;\n  /** Backend-defined payment type. */\n  readonly paymentType: string;\n  /** Card network, when the payment used a card. */\n  readonly cardNetwork: string | null;\n  /** Last four card digits, when available. */\n  readonly last4: string | null;\n  /** Payment-method logo URL, when available. */\n  readonly logoUrl: string | null;\n};\n\n/** Shipping method attached to an order. */\nexport type PortalOrderShippingMethod = {\n  /** Shipping-method identifier, when available. */\n  readonly id: string | null;\n  /** Shipping-method display title. */\n  readonly title: string;\n};\n\n/** Shipment tracking record attached to an order. */\nexport type PortalOrderTrackingInformation = {\n  /** Tracking-record identifier. */\n  readonly id: number;\n  /** Carrier tracking number. */\n  readonly trackingNumber: string;\n  /** Shipping carrier name, when available. */\n  readonly shippingCarrier: string | null;\n  /** Carrier tracking URL, when available. */\n  readonly trackingUrl: string | null;\n};\n\n/** Display-ready tax decomposition attached to an order. */\nexport type PortalOrderTaxTotals = {\n  /** Gross merchandise subtotal as a decimal string. */\n  readonly grossSubtotal: string;\n  /** Localized gross-subtotal display value. */\n  readonly grossSubtotalInCurrency: string;\n  /** Net merchandise subtotal as a decimal string. */\n  readonly netSubtotal: string;\n  /** Localized net-subtotal display value. */\n  readonly netSubtotalInCurrency: string;\n  /** Tax charged on merchandise as a decimal string. */\n  readonly itemTax: string;\n  /** Localized item-tax display value. */\n  readonly itemTaxInCurrency: string;\n  /** Shipping amount before tax as a decimal string. */\n  readonly shippingNet: string;\n  /** Localized net-shipping display value. */\n  readonly shippingNetInCurrency: string;\n  /** Tax charged on shipping as a decimal string. */\n  readonly shippingTax: string;\n  /** Localized shipping-tax display value. */\n  readonly shippingTaxInCurrency: string;\n  /** Total tax as a decimal string. */\n  readonly totalTax: string;\n  /** Localized total-tax display value. */\n  readonly totalTaxInCurrency: string;\n  /** Whether displayed prices include tax. */\n  readonly priceInclusiveOfTax: boolean;\n  /** Merchant-defined tax label, when available. */\n  readonly taxLabel: string | null;\n};\n\n/** Complete order returned by {@link getOrder}. */\nexport type PortalOrder = {\n  /** Numeric order identifier. */\n  readonly id: number;\n  /** URL-safe order token accepted by {@link getOrder}. */\n  readonly token: string;\n  /** Merchant-facing order number, when available. */\n  readonly orderNumber: string | null;\n  /** Order lifecycle status, for example `draft`, `completed`, or `archived`. */\n  readonly status: string;\n  /** Backend-defined fulfillment status. */\n  readonly fulfillmentStatus: string;\n  /** Merchandise subtotal as a decimal string. */\n  readonly subtotal: string;\n  /** Localized subtotal display value. */\n  readonly subtotalInCurrency: string | null;\n  /** Detailed tax totals, when supplied by the tenant. */\n  readonly totals?: PortalOrderTaxTotals;\n  /** Discount total as a decimal string. */\n  readonly discount: string;\n  /** Localized discount display value. */\n  readonly discountInCurrency: string | null;\n  /** Shipping total as a decimal string. */\n  readonly shipping: string;\n  /** Localized shipping display value. */\n  readonly shippingInCurrency: string | null;\n  /** Tax total as a decimal string. */\n  readonly tax: string;\n  /** Localized tax display value. */\n  readonly taxInCurrency: string | null;\n  /** Order total as a decimal string. */\n  readonly total: string;\n  /** Localized order-total display value. */\n  readonly totalInCurrency: string | null;\n  /** ISO 4217 currency code for monetary values. */\n  readonly currency: string;\n  /** Purchased line items. */\n  readonly lineItems: readonly PortalOrderLineItem[];\n  /** Order metafields, when explicitly requested. */\n  readonly metafields?: readonly PortalOrderMetafield[];\n  /** Customer display name, when available. */\n  readonly customerName: string | null;\n  /** Customer email address, when available. */\n  readonly customerEmail: string | null;\n  /** Order shipping address, when available. */\n  readonly shippingAddress: PortalOrderAddress | null;\n  /** Order billing address, when available. */\n  readonly billingAddress: PortalOrderAddress | null;\n  /** Payment summary, when available. */\n  readonly paymentMethod: PortalOrderPaymentMethod | null;\n  /** Selected shipping method, when available. */\n  readonly shippingMethod: PortalOrderShippingMethod | null;\n  /** Whether the order originated from a subscription. */\n  readonly subscriptionOrder: boolean;\n  /** Source subscription token, when available. */\n  readonly subscriptionToken: string | null;\n  /** Shipment tracking records. */\n  readonly trackingInformations: readonly PortalOrderTrackingInformation[];\n  /** Loyalty points credited by this order. */\n  readonly totalPointsCredited?: number;\n  /** Customer loyalty-points balance after the order. */\n  readonly customerPointsBalance?: number;\n  /** Loyalty points redeemed on the order. */\n  readonly pointsApplied?: number;\n  /** Redemption amount as a decimal number. */\n  readonly pointsAppliedAmount?: number;\n  /** Localized redemption-amount display value. */\n  readonly pointsAppliedAmountInCurrency?: string | null;\n  /** Order total after point redemption as a decimal number. */\n  readonly orderTotalAfterPointsRedemption?: number;\n  /** Localized post-redemption order-total display value. */\n  readonly orderTotalAfterPointsRedemptionInCurrency?: string | null;\n  /** ISO 8601 sale timestamp, when available. */\n  readonly saleDate?: string | null;\n  /** ISO 8601 creation timestamp. */\n  readonly createdAt: string;\n  /** ISO 8601 last-update timestamp. */\n  readonly updatedAt: string;\n};\n\nexport const PORTAL_READ_FUNCTION_DEFINITIONS = {\n  listCountries: {\n    capability: \"localization\",\n    version: \"1\",\n    method: \"listCountries\",\n  },\n  listLanguages: {\n    capability: \"localization\",\n    version: \"1\",\n    method: \"listLanguages\",\n  },\n  getAddressFields: {\n    capability: \"localization\",\n    version: \"1\",\n    method: \"getAddressFields\",\n  },\n  listProducts: {\n    capability: \"products\",\n    version: \"1\",\n    method: \"listProducts\",\n  },\n  getProduct: {\n    capability: \"products\",\n    version: \"1\",\n    method: \"getProduct\",\n  },\n  searchProducts: {\n    capability: \"products\",\n    version: \"1\",\n    method: \"searchProducts\",\n  },\n  listProductMedia: {\n    capability: \"products\",\n    version: \"1\",\n    method: \"listProductMedia\",\n  },\n  listProductMetrics: {\n    capability: \"products\",\n    version: \"1\",\n    method: \"listProductMetrics\",\n  },\n  listCalendarEvents: {\n    capability: \"calendar\",\n    version: \"1\",\n    method: \"listCalendarEvents\",\n  },\n  listContentMedia: {\n    capability: \"content\",\n    version: \"1\",\n    method: \"listMedia\",\n  },\n  getContentMedia: {\n    capability: \"content\",\n    version: \"1\",\n    method: \"getMedia\",\n  },\n  listPlaylists: {\n    capability: \"content\",\n    version: \"1\",\n    method: \"listPlaylists\",\n  },\n  getPlaylist: {\n    capability: \"content\",\n    version: \"1\",\n    method: \"getPlaylist\",\n  },\n  listPlaylistItems: {\n    capability: \"content\",\n    version: \"1\",\n    method: \"listPlaylistItems\",\n  },\n  listPages: {\n    capability: \"content\",\n    version: \"1\",\n    method: \"listPages\",\n  },\n  getPage: {\n    capability: \"content\",\n    version: \"1\",\n    method: \"getPage\",\n  },\n  listEnrollmentPacks: {\n    capability: \"content\",\n    version: \"1\",\n    method: \"listEnrollmentPacks\",\n  },\n  getEnrollmentPack: {\n    capability: \"content\",\n    version: \"1\",\n    method: \"getEnrollmentPack\",\n  },\n  listContentMetrics: {\n    capability: \"content\",\n    version: \"1\",\n    method: \"listMetrics\",\n  },\n  listShares: {\n    capability: \"content\",\n    version: \"1\",\n    method: \"listShares\",\n  },\n  listDamAssets: {\n    capability: \"content\",\n    version: \"1\",\n    method: \"listDamAssets\",\n  },\n  listDamAssetPaths: {\n    capability: \"content\",\n    version: \"1\",\n    method: \"listDamAssetPaths\",\n  },\n  listOrders: {\n    capability: \"orders\",\n    version: \"1\",\n    method: \"listOrders\",\n  },\n  getOrder: {\n    capability: \"orders\",\n    version: \"1\",\n    method: \"getOrder\",\n  },\n} as const satisfies Readonly<Record<string, PortalFunctionDefinition>>;\n\n/**\n * Lists countries and their states in the requested language.\n *\n * Declare `listCountries` in the widget's `uses` list before calling it.\n *\n * `cursor` and `limit` remain accepted for compatibility but are ignored by the\n * Portal tenant adapter.\n *\n * @param input - Optional localization and legacy cursor pagination.\n * @returns All countries with a `null` next cursor.\n * @throws {@link PortalFunctionError} when `listCountries` is not declared, the input is invalid, the localization capability is unavailable, or the host call or response fails.\n *\n * @example\n * ```ts\n * const page = await listCountries({ languageIso: \"en\" });\n * ```\n */\nexport const listCountries: PortalFunction<\n  PortalPage<PortalCountry>,\n  ListCountriesInput\n> = definePortalFunction(PORTAL_READ_FUNCTION_DEFINITIONS.listCountries);\n\n/**\n * Lists languages available in the current Portal.\n *\n * Declare `listLanguages` in the widget's `uses` list before calling it.\n *\n * @param input - Optional cursor pagination.\n * @returns A page of available languages and a cursor for the next page.\n * @throws {@link PortalFunctionError} when `listLanguages` is not declared, the input is invalid, the localization capability is unavailable, or the host call or response fails.\n *\n * @example\n * ```ts\n * const languages = await listLanguages({ limit: 20 });\n * ```\n */\nexport const listLanguages: PortalFunction<\n  PortalPage<PortalLanguage>,\n  PortalPageInput\n> = definePortalFunction(PORTAL_READ_FUNCTION_DEFINITIONS.listLanguages);\n\n/**\n * Gets the localized address-field configuration for a country.\n *\n * Declare `getAddressFields` in the widget's `uses` list before calling it.\n *\n * @param input - Country code and optional label language.\n * @returns The country and its ordered address fields.\n * @throws {@link PortalFunctionError} when `getAddressFields` is not declared, the input is invalid, the localization capability is unavailable, or the host call or response fails.\n *\n * @example\n * ```ts\n * const address = await getAddressFields({ countryCode: \"US\", languageIso: \"en\" });\n * ```\n */\nexport const getAddressFields: PortalFunction<\n  PortalAddressFields,\n  GetAddressFieldsInput\n> = definePortalFunction(PORTAL_READ_FUNCTION_DEFINITIONS.getAddressFields);\n\n/**\n * Lists products available in the current Portal.\n *\n * Declare `listProducts` in the widget's `uses` list before calling it.\n *\n * @param input - Optional ordering and cursor pagination.\n * @returns A page of products and a cursor for the next page.\n * @throws {@link PortalFunctionError} when `listProducts` is not declared, the input is invalid, the products capability is unavailable, or the host call or response fails.\n *\n * @example\n * ```ts\n * const products = await listProducts({ sort: \"title_asc\", limit: 20 });\n * ```\n */\nexport const listProducts: PortalFunction<\n  PortalPage<PortalProduct>,\n  ListProductsInput\n> = definePortalFunction(PORTAL_READ_FUNCTION_DEFINITIONS.listProducts);\n\n/**\n * Gets one product by identifier.\n *\n * Declare `getProduct` in the widget's `uses` list before calling it.\n *\n * @param input - Product identifier.\n * @returns The requested product.\n * @throws {@link PortalFunctionError} when `getProduct` is not declared, the identifier is invalid or unavailable, the products capability is unavailable, or the host call or response fails.\n *\n * @example\n * ```ts\n * const product = await getProduct({ id: 42 });\n * ```\n */\nexport const getProduct: PortalFunction<PortalProduct, GetProductInput> =\n  definePortalFunction(PORTAL_READ_FUNCTION_DEFINITIONS.getProduct);\n\n/**\n * Searches products using Portal product search.\n *\n * Declare `searchProducts` in the widget's `uses` list before calling it.\n *\n * @param input - Search text and optional cursor pagination.\n * @returns A page of matching products and a cursor for the next page.\n * @throws {@link PortalFunctionError} when `searchProducts` is not declared, the input is invalid, product search is unavailable, or the host call or response fails.\n *\n * @example\n * ```ts\n * const matches = await searchProducts({ query: \"starter kit\", limit: 10 });\n * ```\n */\nexport const searchProducts: PortalFunction<\n  PortalPage<PortalProduct>,\n  SearchProductsInput\n> = definePortalFunction(PORTAL_READ_FUNCTION_DEFINITIONS.searchProducts);\n\n/**\n * Lists media associated with a product.\n *\n * Declare `listProductMedia` in the widget's `uses` list before calling it.\n *\n * @param input - Product identifier.\n * @returns The product's media items.\n * @throws {@link PortalFunctionError} when `listProductMedia` is not declared, the product identifier is invalid or unavailable, the products capability is unavailable, or the host call or response fails.\n *\n * @example\n * ```ts\n * const media = await listProductMedia({ productId: 42 });\n * ```\n */\nexport const listProductMedia: PortalFunction<\n  readonly PortalProductMedia[],\n  ListProductMediaInput\n> = definePortalFunction(PORTAL_READ_FUNCTION_DEFINITIONS.listProductMedia);\n\n/**\n * Lists visit metrics for products.\n *\n * Declare `listProductMetrics` in the widget's `uses` list before calling it.\n *\n * @param input - Metric kind, optional period, and optional result limit.\n * @returns Metric totals grouped by product.\n * @throws {@link PortalFunctionError} when `listProductMetrics` is not declared, the input is invalid, product metrics are unavailable, or the host call or response fails.\n *\n * @example\n * ```ts\n * const metrics = await listProductMetrics({ kind: \"visits\", period: \"30d\" });\n * ```\n */\nexport const listProductMetrics: PortalFunction<\n  readonly PortalMetric[],\n  ListProductMetricsInput\n> = definePortalFunction(PORTAL_READ_FUNCTION_DEFINITIONS.listProductMetrics);\n\n/**\n * Lists calendar events visible to the signed-in Portal user.\n *\n * Declare `listCalendarEvents` in the widget's `uses` list before calling it.\n *\n * @returns All events supplied by the Portal calendar capability.\n * @throws {@link PortalFunctionError} when `listCalendarEvents` is not declared, the calendar capability is unavailable, or the host call or response fails.\n *\n * @example\n * ```ts\n * const events = await listCalendarEvents();\n * ```\n */\nexport const listCalendarEvents: PortalFunction<\n  readonly PortalCalendarEvent[]\n> = definePortalFunction(PORTAL_READ_FUNCTION_DEFINITIONS.listCalendarEvents);\n\n/**\n * Lists media from the Portal content library.\n *\n * Declare `listContentMedia` in the widget's `uses` list before calling it.\n *\n * @param input - Optional filters, localization, ordering, and cursor pagination.\n * @returns A page of content media and a cursor for the next page.\n * @throws {@link PortalFunctionError} when `listContentMedia` is not declared, the input is invalid, content access is unavailable, or the host call or response fails.\n *\n * @example\n * ```ts\n * const media = await listContentMedia({ contentFormat: \"video\", limit: 20 });\n * ```\n */\nexport const listContentMedia: PortalFunction<\n  PortalPage<PortalMedia>,\n  ListContentMediaInput\n> = definePortalFunction(PORTAL_READ_FUNCTION_DEFINITIONS.listContentMedia);\n\n/**\n * Gets one content-library media item by identifier.\n *\n * Declare `getContentMedia` in the widget's `uses` list before calling it.\n *\n * @param input - Media identifier and optional content language.\n * @returns The requested media item.\n * @throws {@link PortalFunctionError} when `getContentMedia` is not declared, the input is invalid or unavailable, content access is unavailable, or the host call or response fails.\n *\n * @example\n * ```ts\n * const media = await getContentMedia({ id: 42, languageIso: \"en\" });\n * ```\n */\nexport const getContentMedia: PortalFunction<\n  PortalMedia,\n  GetContentMediaInput\n> = definePortalFunction(PORTAL_READ_FUNCTION_DEFINITIONS.getContentMedia);\n\n/**\n * Lists playlists from the Portal content library.\n *\n * Declare `listPlaylists` in the widget's `uses` list before calling it.\n *\n * @param input - Optional filters, ordering, and cursor pagination.\n * @returns A page of playlists and a cursor for the next page.\n * @throws {@link PortalFunctionError} when `listPlaylists` is not declared, the input is invalid, content access is unavailable, or the host call or response fails.\n *\n * @example\n * ```ts\n * const playlists = await listPlaylists({ ownership: \"company\", limit: 20 });\n * ```\n */\nexport const listPlaylists: PortalFunction<\n  PortalPage<PortalPlaylist>,\n  ListPlaylistsInput\n> = definePortalFunction(PORTAL_READ_FUNCTION_DEFINITIONS.listPlaylists);\n\n/**\n * Gets one content playlist by identifier.\n *\n * Declare `getPlaylist` in the widget's `uses` list before calling it.\n *\n * @param input - Playlist identifier.\n * @returns The requested playlist.\n * @throws {@link PortalFunctionError} when `getPlaylist` is not declared, the identifier is invalid or unavailable, content access is unavailable, or the host call or response fails.\n *\n * @example\n * ```ts\n * const playlist = await getPlaylist({ id: 42 });\n * ```\n */\nexport const getPlaylist: PortalFunction<PortalPlaylist, GetPlaylistInput> =\n  definePortalFunction(PORTAL_READ_FUNCTION_DEFINITIONS.getPlaylist);\n\n/**\n * Lists the ordered items in a content playlist.\n *\n * Declare `listPlaylistItems` in the widget's `uses` list before calling it.\n *\n * @param input - Playlist identifier, optional language, and cursor pagination.\n * @returns A page of playlist items and a cursor for the next page.\n * @throws {@link PortalFunctionError} when `listPlaylistItems` is not declared, the input is invalid, the playlist is unavailable, content access is unavailable, or the host call or response fails.\n *\n * @example\n * ```ts\n * const items = await listPlaylistItems({ playlistId: 42, limit: 20 });\n * ```\n */\nexport const listPlaylistItems: PortalFunction<\n  PortalPage<PortalPlaylistItem>,\n  ListPlaylistItemsInput\n> = definePortalFunction(PORTAL_READ_FUNCTION_DEFINITIONS.listPlaylistItems);\n\n/**\n * Lists content pages available to the signed-in Portal user.\n *\n * Declare `listPages` in the widget's `uses` list before calling it.\n *\n * @param input - Optional filters, localization, ordering, and cursor pagination.\n * @returns A page of content-page summaries and a cursor for the next page.\n * @throws {@link PortalFunctionError} when `listPages` is not declared, the input is invalid, content access is unavailable, or the host call or response fails.\n *\n * @example\n * ```ts\n * const pages = await listPages({ sort: \"title_asc\", limit: 20 });\n * ```\n */\nexport const listPages: PortalFunction<\n  PortalPage<PortalPageContent>,\n  ListPagesInput\n> = definePortalFunction(PORTAL_READ_FUNCTION_DEFINITIONS.listPages);\n\n/**\n * Gets one content page and its share URL.\n *\n * Declare `getPage` in the widget's `uses` list before calling it.\n *\n * @param input - Page identifier and optional content language.\n * @returns The requested page and its share URL.\n * @throws {@link PortalFunctionError} when `getPage` is not declared, the input is invalid or unavailable, content access is unavailable, or the host call or response fails.\n *\n * @example\n * ```ts\n * const detail = await getPage({ id: 42, languageIso: \"en\" });\n * ```\n */\nexport const getPage: PortalFunction<PortalPageDetail, GetPageInput> =\n  definePortalFunction(PORTAL_READ_FUNCTION_DEFINITIONS.getPage);\n\n/**\n * Lists enrollment packs available in the Portal content library.\n *\n * Declare `listEnrollmentPacks` in the widget's `uses` list before calling it.\n *\n * @param input - Optional cursor pagination.\n * @returns A page of enrollment packs and a cursor for the next page.\n * @throws {@link PortalFunctionError} when `listEnrollmentPacks` is not declared, the input is invalid, content access is unavailable, or the host call or response fails.\n *\n * @example\n * ```ts\n * const packs = await listEnrollmentPacks({ limit: 20 });\n * ```\n */\nexport const listEnrollmentPacks: PortalFunction<\n  PortalPage<PortalEnrollmentPack>,\n  PortalPageInput\n> = definePortalFunction(PORTAL_READ_FUNCTION_DEFINITIONS.listEnrollmentPacks);\n\n/**\n * Gets one enrollment pack by identifier.\n *\n * Declare `getEnrollmentPack` in the widget's `uses` list before calling it.\n *\n * @param input - Enrollment-pack identifier.\n * @returns The requested enrollment pack.\n * @throws {@link PortalFunctionError} when `getEnrollmentPack` is not declared, the identifier is invalid or unavailable, content access is unavailable, or the host call or response fails.\n *\n * @example\n * ```ts\n * const pack = await getEnrollmentPack({ id: 42 });\n * ```\n */\nexport const getEnrollmentPack: PortalFunction<\n  PortalEnrollmentPack,\n  GetEnrollmentPackInput\n> = definePortalFunction(PORTAL_READ_FUNCTION_DEFINITIONS.getEnrollmentPack);\n\n/**\n * Lists visit metrics for Portal content resources.\n *\n * Declare `listContentMetrics` in the widget's `uses` list before calling it.\n *\n * @param input - Resource, metric kind, and optional aggregation settings.\n * @returns Metric totals grouped by content resource.\n * @throws {@link PortalFunctionError} when `listContentMetrics` is not declared, the input is invalid, content metrics are unavailable, or the host call or response fails.\n *\n * @example\n * ```ts\n * const metrics = await listContentMetrics({\n *   resource: \"media\",\n *   kind: \"shareVisits\",\n *   period: \"30d\",\n * });\n * ```\n */\nexport const listContentMetrics: PortalFunction<\n  readonly PortalMetric[],\n  ListContentMetricsInput\n> = definePortalFunction(PORTAL_READ_FUNCTION_DEFINITIONS.listContentMetrics);\n\n/**\n * Lists share records created by the signed-in Portal user.\n *\n * Declare `listShares` in the widget's `uses` list before calling it.\n *\n * @param input - Optional cursor pagination.\n * @returns A page of share records and a cursor for the next page.\n * @throws {@link PortalFunctionError} when `listShares` is not declared, the input is invalid, content access is unavailable, or the host call or response fails.\n *\n * @example\n * ```ts\n * const shares = await listShares({ limit: 20 });\n * ```\n */\nexport const listShares: PortalFunction<\n  PortalPage<PortalShare>,\n  PortalPageInput\n> = definePortalFunction(PORTAL_READ_FUNCTION_DEFINITIONS.listShares);\n\n/**\n * Lists digital assets available from the Portal content library.\n *\n * Declare `listDamAssets` in the widget's `uses` list before calling it.\n *\n * @param input - Optional cursor pagination.\n * @returns A page of digital assets and a cursor for the next page.\n * @throws {@link PortalFunctionError} when `listDamAssets` is not declared, the input is invalid, digital-asset access is unavailable, or the host call or response fails.\n *\n * @example\n * ```ts\n * const assets = await listDamAssets({ limit: 20 });\n * ```\n */\nexport const listDamAssets: PortalFunction<\n  PortalPage<PortalDamAsset>,\n  PortalPageInput\n> = definePortalFunction(PORTAL_READ_FUNCTION_DEFINITIONS.listDamAssets);\n\n/**\n * Lists accessible paths for one digital asset.\n *\n * Declare `listDamAssetPaths` in the widget's `uses` list before calling it.\n *\n * @param input - Asset code and optional cursor pagination.\n * @returns A page of asset paths and a cursor for the next page.\n * @throws {@link PortalFunctionError} when `listDamAssetPaths` is not declared, the input or asset code is invalid, digital-asset access is unavailable, or the host call or response fails.\n *\n * @example\n * ```ts\n * const paths = await listDamAssetPaths({ assetCode: \"hero-image\", limit: 20 });\n * ```\n */\nexport const listDamAssetPaths: PortalFunction<\n  PortalPage<PortalDamAssetPath>,\n  ListDamAssetPathsInput\n> = definePortalFunction(PORTAL_READ_FUNCTION_DEFINITIONS.listDamAssetPaths);\n\n/**\n * Lists orders visible to the signed-in Portal user.\n *\n * This capability exposes customer contact details and order history. The host\n * requires an explicit per-widget grant before the call can run. Metafields are\n * omitted unless `includeMetafields` is `true`.\n *\n * @param input - Optional order filters, pagination, and metafield selection.\n * @returns A page of orders and a cursor for the next page.\n * @throws {@link PortalFunctionError} when the function is not declared or granted, the input is invalid, order access is unavailable, or the host call fails.\n *\n * @example\n * ```ts\n * const page = await listOrders({ status: \"completed\", limit: 20 });\n * ```\n */\n// Validate the recursive metafield value once at the transport type boundary;\n// expanding it through the complete order shape exceeds TypeScript's depth.\nexport const listOrders = definePortalFunction<null, void>(\n  PORTAL_READ_FUNCTION_DEFINITIONS.listOrders,\n) as unknown as PortalFunction<PortalPage<PortalOrderSummary>, ListOrdersInput>;\n\n/**\n * Gets one order visible to the signed-in Portal user.\n *\n * This capability exposes customer contact details, addresses, payment\n * summary, fulfillment details, and line items. The host requires an explicit\n * per-widget grant. Metafields are omitted unless `includeMetafields` is `true`.\n *\n * @param input - Order routing token and optional metafield selection.\n * @returns The complete order.\n * @throws {@link PortalFunctionError} when the function is not declared or granted, the input is invalid, order access is unavailable, or the host call fails.\n *\n * @example\n * ```ts\n * const order = await getOrder({ token: page.items[0].token });\n * ```\n */\nexport const getOrder = definePortalFunction<null, void>(\n  PORTAL_READ_FUNCTION_DEFINITIONS.getOrder,\n) as unknown as PortalFunction<PortalOrder, GetOrderInput>;\n","import type { ContentFavoriteType } from \"@fluid-app/shareables-core/favorites-api\";\nimport {\n  definePortalFunction,\n  type PortalFunction,\n  type PortalFunctionDefinition,\n} from \"../portal-function\";\nimport type {\n  PortalDamAsset,\n  PortalDamAssetPath,\n  PortalMedia,\n  PortalPage,\n  PortalPageInput,\n  PortalPlaylist,\n  PortalPlaylistItem,\n  PortalShare,\n} from \"./read\";\n\n/** Fields used to create a content-media record. */\nexport type CreateContentMediaInput = {\n  /** Media title. */\n  readonly title: string;\n  /** Optional description. */\n  readonly description?: string | null;\n  /** Host media category. */\n  readonly mediaType: string;\n  /** Media URL, if already available. */\n  readonly url?: string | null;\n  /** Content file format. */\n  readonly contentFormat?: \"image\" | \"video\" | \"pdf\" | \"ppt\";\n};\n\n/** Editable fields for a content-media record. */\nexport type UpdateContentMediaInput = {\n  /** Media identifier. */\n  readonly id: number;\n  /** Replacement title. */\n  readonly title?: string;\n  /** Replacement description. */\n  readonly description?: string | null;\n  /** Publication state. */\n  readonly status?: \"active\" | \"draft\";\n  /** Replacement media URL. */\n  readonly url?: string | null;\n  /** Replacement file format. */\n  readonly contentFormat?: \"image\" | \"video\" | \"pdf\" | \"ppt\";\n  /** Replacement thumbnail URL. */\n  readonly thumbnailUrl?: string | null;\n  /** ISO language code for localized content. */\n  readonly languageIso?: string;\n  /** Call-to-action settings. */\n  readonly cta?: {\n    /** Whether the call to action is enabled. */\n    readonly enabled?: boolean;\n    /** Link or cart action. */\n    readonly type?: \"link\" | \"cart\";\n    /** Button label. */\n    readonly buttonText?: string | null;\n    /** Button color value. */\n    readonly buttonColor?: string | null;\n    /** Accessible button description. */\n    readonly buttonDescription?: string | null;\n    /** Action destination URL. */\n    readonly actionUrl?: string | null;\n  };\n  /** Search-engine metadata. */\n  readonly seo?: {\n    /** Search result title. */\n    readonly title?: string | null;\n    /** Search result description. */\n    readonly description?: string | null;\n    /** Search result image URL. */\n    readonly imageUrl?: string | null;\n    /** Whether crawlers should be blocked. */\n    readonly blockCrawler?: boolean;\n  };\n};\n\n/** Identifies content media to delete. */\nexport type DeleteContentMediaInput = {\n  /** Media identifier. */\n  readonly id: number;\n};\n\n/** Product associated with a content-media record. */\nexport type PortalMediaProduct = {\n  /** Product identifier. */\n  readonly id: number;\n  /** Product name, if available. */\n  readonly name: string | null;\n  /** Product slug, if available. */\n  readonly slug: string | null;\n  /** Product image URL, if available. */\n  readonly imageUrl: string | null;\n  /** Retail price, if available. */\n  readonly price: string | null;\n  /** Currency code, if available. */\n  readonly currency: string | null;\n  /** ISO association timestamp, if available. */\n  readonly addedAt: string | null;\n};\n\n/** Pagination and localization for content-media products. */\nexport type ListContentMediaProductsInput = PortalPageInput & {\n  /** Media identifier. */\n  readonly mediaId: number;\n  /** ISO language code. */\n  readonly languageIso?: string;\n};\n\n/** Identifies media and product records to associate. */\nexport type AddContentMediaProductInput = {\n  /** Media identifier. */\n  readonly mediaId: number;\n  /** Product identifier. */\n  readonly productId: number;\n};\n\n/** Identifies a media-product association to remove. */\nexport type RemoveContentMediaProductInput = AddContentMediaProductInput;\n\n/** Fields used to create a content playlist. */\nexport type CreateContentPlaylistInput = {\n  /** Playlist title. */\n  readonly title: string;\n  /** Optional playlist description. */\n  readonly description?: string | null;\n};\n\n/** Editable fields for a content playlist. */\nexport type UpdateContentPlaylistInput = {\n  /** Playlist identifier. */\n  readonly id: number;\n  /** Replacement title. */\n  readonly title?: string;\n  /** Replacement description. */\n  readonly description?: string | null;\n};\n\n/** Identifies a content playlist to delete. */\nexport type DeleteContentPlaylistInput = {\n  /** Playlist identifier. */\n  readonly id: number;\n};\n\n/** Identifies content to insert into a playlist. */\nexport type AddContentPlaylistItemInput = {\n  /** Playlist identifier. */\n  readonly playlistId: number;\n  /** Kind of content to add. */\n  readonly contentType: \"media\" | \"page\" | \"product\" | \"enrollmentPack\";\n  /** Content resource identifier. */\n  readonly contentId: number;\n  /** Requested insertion position. */\n  readonly position?: number | null;\n};\n\n/** Identifies a playlist item to remove. */\nexport type RemoveContentPlaylistItemInput = {\n  /** Playlist identifier. */\n  readonly playlistId: number;\n  /** Playlist-item identifier. */\n  readonly itemId: number;\n};\n\n/** Defines playlist-item positions. */\nexport type ReorderContentPlaylistItemsInput = {\n  /** Playlist identifier. */\n  readonly playlistId: number;\n  /** Item identifiers paired with their desired order. */\n  readonly items: readonly {\n    /** Playlist-item identifier. */\n    readonly id: number;\n    /** Desired zero-based order. */\n    readonly order: number;\n  }[];\n};\n\n/** Identifies content for which to create a share link. */\nexport type CreateContentShareInput = {\n  /** Kind of resource to share. */\n  readonly shareableType: \"media\" | \"product\" | \"library\" | \"page\";\n  /** Shared resource identifier. */\n  readonly shareableId: number;\n};\n\n/** Identifies content whose favorite state should be toggled. */\nexport type ToggleContentFavoriteInput = {\n  /** Favorite resource category. */\n  readonly favoriteableType: ContentFavoriteType;\n  /** Favorite resource identifier. */\n  readonly favoriteableId: number;\n};\n\n/** Current favorite state returned after a toggle. */\nexport type PortalContentFavoriteState = {\n  /** Favorite resource category. */\n  readonly favoriteableType: ContentFavoriteType;\n  /** Favorite resource identifier. */\n  readonly favoriteableId: number;\n  /** Resulting favorite state. */\n  readonly isFavorited: boolean;\n};\n\n/** Fields used to create a digital-asset record. */\nexport type CreateDamAssetInput = {\n  /** Asset name. */\n  readonly name: string;\n  /** Optional asset description. */\n  readonly description?: string | null;\n};\n\n/** Fields used to add a path to a digital asset. */\nexport type CreateDamAssetPathInput = {\n  /** Stable asset code. */\n  readonly assetCode: string;\n  /** New asset path. */\n  readonly path: string;\n};\n\n/** Identifies a digital asset for mutation. */\nexport type MutateDamAssetInput = {\n  /** Stable asset code. */\n  readonly assetCode: string;\n};\n\nexport const PORTAL_CONTENT_MUTATION_FUNCTION_DEFINITIONS = {\n  createContentMedia: {\n    capability: \"content.write\",\n    version: \"1\",\n    method: \"createMedia\",\n  },\n  updateContentMedia: {\n    capability: \"content.write\",\n    version: \"1\",\n    method: \"updateMedia\",\n  },\n  deleteContentMedia: {\n    capability: \"content.write\",\n    version: \"1\",\n    method: \"deleteMedia\",\n  },\n  listContentMediaProducts: {\n    capability: \"content\",\n    version: \"1\",\n    method: \"listMediaProducts\",\n  },\n  addContentMediaProduct: {\n    capability: \"content.write\",\n    version: \"1\",\n    method: \"addMediaProduct\",\n  },\n  removeContentMediaProduct: {\n    capability: \"content.write\",\n    version: \"1\",\n    method: \"removeMediaProduct\",\n  },\n  createContentPlaylist: {\n    capability: \"content.write\",\n    version: \"1\",\n    method: \"createPlaylist\",\n  },\n  updateContentPlaylist: {\n    capability: \"content.write\",\n    version: \"1\",\n    method: \"updatePlaylist\",\n  },\n  deleteContentPlaylist: {\n    capability: \"content.write\",\n    version: \"1\",\n    method: \"deletePlaylist\",\n  },\n  addContentPlaylistItem: {\n    capability: \"content.write\",\n    version: \"1\",\n    method: \"addPlaylistItem\",\n  },\n  removeContentPlaylistItem: {\n    capability: \"content.write\",\n    version: \"1\",\n    method: \"removePlaylistItem\",\n  },\n  reorderContentPlaylistItems: {\n    capability: \"content.write\",\n    version: \"1\",\n    method: \"reorderPlaylistItems\",\n  },\n  createContentShare: {\n    capability: \"content.write\",\n    version: \"1\",\n    method: \"createShare\",\n  },\n  toggleContentFavorite: {\n    capability: \"content.write\",\n    version: \"1\",\n    method: \"toggleFavorite\",\n  },\n  createDamAsset: {\n    capability: \"content.write\",\n    version: \"1\",\n    method: \"createDamAsset\",\n  },\n  createDamAssetPath: {\n    capability: \"content.write\",\n    version: \"1\",\n    method: \"createDamAssetPath\",\n  },\n  discardDamAsset: {\n    capability: \"content.write\",\n    version: \"1\",\n    method: \"discardDamAsset\",\n  },\n  deleteDamAsset: {\n    capability: \"content.write\",\n    version: \"1\",\n    method: \"deleteDamAsset\",\n  },\n} as const satisfies Readonly<Record<string, PortalFunctionDefinition>>;\n\n/**\n * Creates content media in the Portal host.\n * @param input - Media metadata and optional source URL.\n * @returns The created {@link PortalMedia}.\n * @throws {@link PortalFunctionError} when undeclared, invalid, unavailable, or rejected by the host.\n * @remarks Declare `createContentMedia` in `uses`. This mutates host content after mount.\n * @example const media = await createContentMedia({ title: \"Guide\", mediaType: \"document\" });\n */\nexport const createContentMedia: PortalFunction<\n  PortalMedia,\n  CreateContentMediaInput\n> = definePortalFunction(\n  PORTAL_CONTENT_MUTATION_FUNCTION_DEFINITIONS.createContentMedia,\n);\n\n/**\n * Updates an existing content-media record.\n * @param input - Media identifier and fields to replace.\n * @returns The updated {@link PortalMedia}.\n * @throws {@link PortalFunctionError} when undeclared, invalid, unavailable, or rejected by the host.\n * @remarks Declare `updateContentMedia` in `uses`. This mutates host content after mount.\n * @example const media = await updateContentMedia({ id: 12, title: \"Updated guide\" });\n */\nexport const updateContentMedia: PortalFunction<\n  PortalMedia,\n  UpdateContentMediaInput\n> = definePortalFunction(\n  PORTAL_CONTENT_MUTATION_FUNCTION_DEFINITIONS.updateContentMedia,\n);\n\n/**\n * Deletes a content-media record.\n * @param input - Media identifier to delete.\n * @returns `null` after deletion.\n * @throws {@link PortalFunctionError} when undeclared, invalid, unavailable, or rejected by the host.\n * @remarks Declare `deleteContentMedia` in `uses`. This permanently mutates host content after mount.\n * @example await deleteContentMedia({ id: 12 });\n */\nexport const deleteContentMedia: PortalFunction<null, DeleteContentMediaInput> =\n  definePortalFunction(\n    PORTAL_CONTENT_MUTATION_FUNCTION_DEFINITIONS.deleteContentMedia,\n  );\n\n/**\n * Lists products associated with one content-media record.\n * @param input - Media identifier, pagination, and optional locale.\n * @returns A page of associated products.\n * @throws {@link PortalFunctionError} when undeclared, invalid, unavailable, or rejected by the host.\n * @remarks Declare `listContentMediaProducts` in `uses` and call it only after mount.\n * @example const products = await listContentMediaProducts({ mediaId: 12, limit: 20 });\n */\nexport const listContentMediaProducts: PortalFunction<\n  PortalPage<PortalMediaProduct>,\n  ListContentMediaProductsInput\n> = definePortalFunction(\n  PORTAL_CONTENT_MUTATION_FUNCTION_DEFINITIONS.listContentMediaProducts,\n);\n\n/**\n * Associates a product with content media.\n * @param input - Media and product identifiers.\n * @returns The created {@link PortalMediaProduct} association.\n * @throws {@link PortalFunctionError} when undeclared, invalid, unavailable, or rejected by the host.\n * @remarks Declare `addContentMediaProduct` in `uses`. This mutates host content after mount.\n * @example const product = await addContentMediaProduct({ mediaId: 12, productId: 42 });\n */\nexport const addContentMediaProduct: PortalFunction<\n  PortalMediaProduct,\n  AddContentMediaProductInput\n> = definePortalFunction(\n  PORTAL_CONTENT_MUTATION_FUNCTION_DEFINITIONS.addContentMediaProduct,\n);\n\n/**\n * Removes a product association from content media.\n * @param input - Media and product identifiers.\n * @returns `null` after removal.\n * @throws {@link PortalFunctionError} when undeclared, invalid, unavailable, or rejected by the host.\n * @remarks Declare `removeContentMediaProduct` in `uses`. This mutates host content after mount.\n * @example await removeContentMediaProduct({ mediaId: 12, productId: 42 });\n */\nexport const removeContentMediaProduct: PortalFunction<\n  null,\n  RemoveContentMediaProductInput\n> = definePortalFunction(\n  PORTAL_CONTENT_MUTATION_FUNCTION_DEFINITIONS.removeContentMediaProduct,\n);\n\n/**\n * Creates a content playlist.\n * @param input - Playlist title and optional description.\n * @returns The created {@link PortalPlaylist}.\n * @throws {@link PortalFunctionError} when undeclared, invalid, unavailable, or rejected by the host.\n * @remarks Declare `createContentPlaylist` in `uses`. This mutates host content after mount.\n * @example const playlist = await createContentPlaylist({ title: \"Launch\" });\n */\nexport const createContentPlaylist: PortalFunction<\n  PortalPlaylist,\n  CreateContentPlaylistInput\n> = definePortalFunction(\n  PORTAL_CONTENT_MUTATION_FUNCTION_DEFINITIONS.createContentPlaylist,\n);\n\n/**\n * Updates a content playlist.\n * @param input - Playlist identifier and fields to replace.\n * @returns The updated {@link PortalPlaylist}.\n * @throws {@link PortalFunctionError} when undeclared, invalid, unavailable, or rejected by the host.\n * @remarks Declare `updateContentPlaylist` in `uses`. This mutates host content after mount.\n * @example const playlist = await updateContentPlaylist({ id: 5, title: \"New launch\" });\n */\nexport const updateContentPlaylist: PortalFunction<\n  PortalPlaylist,\n  UpdateContentPlaylistInput\n> = definePortalFunction(\n  PORTAL_CONTENT_MUTATION_FUNCTION_DEFINITIONS.updateContentPlaylist,\n);\n\n/**\n * Deletes a content playlist.\n * @param input - Playlist identifier to delete.\n * @returns `null` after deletion.\n * @throws {@link PortalFunctionError} when undeclared, invalid, unavailable, or rejected by the host.\n * @remarks Declare `deleteContentPlaylist` in `uses`. This permanently mutates host content after mount.\n * @example await deleteContentPlaylist({ id: 5 });\n */\nexport const deleteContentPlaylist: PortalFunction<\n  null,\n  DeleteContentPlaylistInput\n> = definePortalFunction(\n  PORTAL_CONTENT_MUTATION_FUNCTION_DEFINITIONS.deleteContentPlaylist,\n);\n\n/**\n * Adds a content resource to a playlist.\n * @param input - Playlist, resource kind, resource identifier, and optional position.\n * @returns The created {@link PortalPlaylistItem}.\n * @throws {@link PortalFunctionError} when undeclared, invalid, unavailable, or rejected by the host.\n * @remarks Declare `addContentPlaylistItem` in `uses`. This mutates host content after mount.\n * @example const item = await addContentPlaylistItem({ playlistId: 5, contentType: \"media\", contentId: 12 });\n */\nexport const addContentPlaylistItem: PortalFunction<\n  PortalPlaylistItem,\n  AddContentPlaylistItemInput\n> = definePortalFunction(\n  PORTAL_CONTENT_MUTATION_FUNCTION_DEFINITIONS.addContentPlaylistItem,\n);\n\n/**\n * Removes an item from a content playlist.\n * @param input - Playlist and playlist-item identifiers.\n * @returns `null` after removal.\n * @throws {@link PortalFunctionError} when undeclared, invalid, unavailable, or rejected by the host.\n * @remarks Declare `removeContentPlaylistItem` in `uses`. This mutates host content after mount.\n * @example await removeContentPlaylistItem({ playlistId: 5, itemId: 8 });\n */\nexport const removeContentPlaylistItem: PortalFunction<\n  null,\n  RemoveContentPlaylistItemInput\n> = definePortalFunction(\n  PORTAL_CONTENT_MUTATION_FUNCTION_DEFINITIONS.removeContentPlaylistItem,\n);\n\n/**\n * Replaces the item order of a content playlist.\n * @param input - Playlist identifier and item-order pairs.\n * @returns `null` after reordering.\n * @throws {@link PortalFunctionError} when undeclared, invalid, unavailable, or rejected by the host.\n * @remarks Declare `reorderContentPlaylistItems` in `uses`. Send the complete desired order after mount.\n * @example await reorderContentPlaylistItems({ playlistId: 5, items: [{ id: 8, order: 0 }] });\n */\nexport const reorderContentPlaylistItems: PortalFunction<\n  null,\n  ReorderContentPlaylistItemsInput\n> = definePortalFunction(\n  PORTAL_CONTENT_MUTATION_FUNCTION_DEFINITIONS.reorderContentPlaylistItems,\n);\n\n/**\n * Creates a share link for a content resource.\n * @param input - Resource kind and identifier to share.\n * @returns The created {@link PortalShare}.\n * @throws {@link PortalFunctionError} when undeclared, invalid, unavailable, or rejected by the host.\n * @remarks Declare `createContentShare` in `uses`. This creates host data after mount.\n * @example const share = await createContentShare({ shareableType: \"media\", shareableId: 12 });\n */\nexport const createContentShare: PortalFunction<\n  PortalShare,\n  CreateContentShareInput\n> = definePortalFunction(\n  PORTAL_CONTENT_MUTATION_FUNCTION_DEFINITIONS.createContentShare,\n);\n\n/**\n * Toggles the signed-in member's favorite state for content.\n * @param input - Favorite resource kind and identifier.\n * @returns The resulting {@link PortalContentFavoriteState}.\n * @throws {@link PortalFunctionError} when undeclared, invalid, unavailable, or rejected by the host.\n * @remarks Declare `toggleContentFavorite` in `uses`. This mutates host data after mount.\n * @example const state = await toggleContentFavorite({ favoriteableType: \"Medium\", favoriteableId: 12 });\n */\nexport const toggleContentFavorite: PortalFunction<\n  PortalContentFavoriteState,\n  ToggleContentFavoriteInput\n> = definePortalFunction(\n  PORTAL_CONTENT_MUTATION_FUNCTION_DEFINITIONS.toggleContentFavorite,\n);\n\n/**\n * Creates a digital-asset record.\n * @param input - Asset name and optional description.\n * @returns The created {@link PortalDamAsset}.\n * @throws {@link PortalFunctionError} when undeclared, invalid, unavailable, or rejected by the host.\n * @remarks Declare `createDamAsset` in `uses`. This mutates host content after mount.\n * @example const asset = await createDamAsset({ name: \"Hero image\" });\n */\nexport const createDamAsset: PortalFunction<\n  PortalDamAsset,\n  CreateDamAssetInput\n> = definePortalFunction(\n  PORTAL_CONTENT_MUTATION_FUNCTION_DEFINITIONS.createDamAsset,\n);\n\n/**\n * Adds a path to a digital asset.\n * @param input - Stable asset code and path.\n * @returns The created {@link PortalDamAssetPath}.\n * @throws {@link PortalFunctionError} when undeclared, invalid, unavailable, or rejected by the host.\n * @remarks Declare `createDamAssetPath` in `uses`. This mutates host content after mount.\n * @example const path = await createDamAssetPath({ assetCode: \"hero\", path: \"/images/hero.png\" });\n */\nexport const createDamAssetPath: PortalFunction<\n  PortalDamAssetPath,\n  CreateDamAssetPathInput\n> = definePortalFunction(\n  PORTAL_CONTENT_MUTATION_FUNCTION_DEFINITIONS.createDamAssetPath,\n);\n\n/**\n * Marks a digital asset as discarded.\n * @param input - Stable asset code.\n * @returns The updated {@link PortalDamAsset}.\n * @throws {@link PortalFunctionError} when undeclared, invalid, unavailable, or rejected by the host.\n * @remarks Declare `discardDamAsset` in `uses`. This mutates host content after mount.\n * @example const asset = await discardDamAsset({ assetCode: \"hero\" });\n */\nexport const discardDamAsset: PortalFunction<\n  PortalDamAsset,\n  MutateDamAssetInput\n> = definePortalFunction(\n  PORTAL_CONTENT_MUTATION_FUNCTION_DEFINITIONS.discardDamAsset,\n);\n\n/**\n * Permanently deletes a digital asset.\n * @param input - Stable asset code.\n * @returns `null` after deletion.\n * @throws {@link PortalFunctionError} when undeclared, invalid, unavailable, or rejected by the host.\n * @remarks Declare `deleteDamAsset` in `uses`. This permanently mutates host content after mount.\n * @example await deleteDamAsset({ assetCode: \"hero\" });\n */\nexport const deleteDamAsset: PortalFunction<null, MutateDamAssetInput> =\n  definePortalFunction(\n    PORTAL_CONTENT_MUTATION_FUNCTION_DEFINITIONS.deleteDamAsset,\n  );\n","import {\n  definePortalFunction,\n  type PortalFunction,\n  type PortalFunctionDefinition,\n} from \"../portal-function\";\nimport type { UserAccount } from \"./built-in\";\n\n/** Membership identity, representative access, and granted permissions. */\nexport type PortalMemberAccess = {\n  /** Customer or representative role. */\n  readonly memberType: \"customer\" | \"rep\";\n  /** Public member slug. */\n  readonly slug: string;\n  /** Display name, if available. */\n  readonly name: string | null;\n  /** Whether representative-only surfaces are available. */\n  readonly canAccessRepSurfaces: boolean;\n  /** Permission names mapped to their granted state. */\n  readonly permissions: Readonly<Record<string, boolean>>;\n};\n\n/** Editable fields for the signed-in account. */\nexport type UpdateUserAccountInput = {\n  /** New given name. */\n  readonly firstName?: string;\n  /** New family name. */\n  readonly lastName?: string;\n  /** New biography. */\n  readonly bio?: string;\n  /** New avatar URL. */\n  readonly avatarUrl?: string;\n  /** Replacement social-link map. */\n  readonly socialLinks?: Readonly<Record<string, string>>;\n  /** Preferred ISO language code. */\n  readonly languageIso?: string;\n};\n\n/** Todo identity and lifecycle timestamps. */\nexport type PortalTodoSummary = {\n  /** Todo identifier. */\n  readonly id: number;\n  /** ISO due timestamp, if set. */\n  readonly dueAt: string | null;\n  /** ISO completion timestamp, if complete. */\n  readonly completedAt: string | null;\n  /** ISO creation timestamp. */\n  readonly createdAt: string;\n};\n\n/** Full todo record. */\nexport type PortalTodo = PortalTodoSummary & {\n  /** Todo text. */\n  readonly body: string;\n};\n\n/** Filters accepted by {@link listTodos}. */\nexport type ListTodosInput = {\n  /** Completion state to include. */\n  readonly state?: \"incomplete\" | \"completed\" | \"all\";\n};\n\n/** Fields used to create a todo. */\nexport type CreateTodoInput = {\n  /** Todo text. */\n  readonly body: string;\n  /** Optional ISO due timestamp; `null` clears the due date. */\n  readonly dueAt?: string | null;\n};\n\n/** One reward-points ledger transaction. */\nexport type PortalPointsLedgerEntry = {\n  /** Ledger entry identifier. */\n  readonly id: number;\n  /** Signed point amount. */\n  readonly amount: number;\n  /** ISO creation timestamp. */\n  readonly createdAt: string;\n  /** Host-defined transaction category, if available. */\n  readonly transactionType: string | null;\n  /** Whether the entry links to a source record. */\n  readonly hasSource: boolean;\n};\n\n/** Current reward-points balance and ledger entries. */\nexport type PortalPointsLedger = {\n  /** Current points balance. */\n  readonly balance: number;\n  /** Ledger entries in host-defined order. */\n  readonly entries: readonly PortalPointsLedgerEntry[];\n};\n\n/** Public MySite profile and aggregate performance values. */\nexport type PortalMySiteProfile = {\n  /** MySite profile identifier. */\n  readonly id: number;\n  /** Public MySite URL, if published. */\n  readonly url: string | null;\n  /** Recorded view count. */\n  readonly views: number;\n  /** Recorded lead count. */\n  readonly leads: number;\n  /** Active theme identifier, if set. */\n  readonly themeId: number | null;\n  /** Profile biography, if set. */\n  readonly bio: string | null;\n  /** Profile avatar URL, if set. */\n  readonly avatarUrl: string | null;\n  /** Public display name, if set. */\n  readonly displayName: string | null;\n  /** Public route slug, if set. */\n  readonly slug: string | null;\n};\n\n/** Editable MySite profile fields. */\nexport type UpdateMySiteProfileInput = {\n  /** New biography. */\n  readonly bio?: string;\n  /** New avatar URL. */\n  readonly avatarUrl?: string;\n  /** New display name. */\n  readonly displayName?: string;\n};\n\n/** Editable MySite publication settings. */\nexport type UpdateMySiteSettingsInput = {\n  /** Theme identifier to activate. */\n  readonly themeId?: number;\n  /** Public route slug. */\n  readonly slug?: string;\n};\n\n/** Link displayed on a MySite profile. */\nexport type PortalMySiteLink = {\n  /** Link identifier. */\n  readonly id: number;\n  /** Destination URL. */\n  readonly url: string;\n  /** Visible link title. */\n  readonly title: string;\n  /** Display position. */\n  readonly position: number;\n};\n\n/** Fields used to create a MySite link. */\nexport type CreateMySiteLinkInput = {\n  /** Destination URL. */\n  readonly url: string;\n  /** Visible link title. */\n  readonly title: string;\n};\n\n/** Fields used to update a MySite link. */\nexport type UpdateMySiteLinkInput = {\n  /** Link identifier. */\n  readonly id: number;\n  /** Replacement destination URL. */\n  readonly url?: string;\n  /** Replacement title. */\n  readonly title?: string;\n};\n\n/** Identifies a MySite link to delete. */\nexport type DeleteMySiteLinkInput = {\n  /** Link identifier. */\n  readonly id: number;\n};\n\n/** Defines the complete display order for MySite links. */\nexport type ReorderMySiteLinksInput = {\n  /** Link identifiers in desired display order. */\n  readonly orderedIds: readonly number[];\n};\n\n/** Product favorite displayed on a MySite profile. */\nexport type PortalMySiteFavorite = {\n  /** Favorite record identifier. */\n  readonly id: number;\n  /** Favorited resource identifier. */\n  readonly favoriteableId: number;\n  /** Host resource type. */\n  readonly favoriteableType: string;\n  /** Resource name, if available. */\n  readonly name: string | null;\n  /** Resource image URL, if available. */\n  readonly imageUrl: string | null;\n  /** Display position. */\n  readonly position: number;\n  /** ISO creation timestamp, if available. */\n  readonly createdAt: string | null;\n};\n\n/** Identifies a product to add to MySite favorites. */\nexport type AddMySiteFavoriteInput = {\n  /** Product identifier. */\n  readonly productId: number;\n};\n\n/** Identifies a MySite favorite to delete. */\nexport type DeleteMySiteFavoriteInput = {\n  /** Favorite record identifier. */\n  readonly id: number;\n};\n\n/** Defines the complete display order for MySite favorites. */\nexport type ReorderMySiteFavoritesInput = {\n  /** Favorite identifiers in desired display order. */\n  readonly orderedIds: readonly number[];\n};\n\n/** MySite theme available to the signed-in member. */\nexport type PortalMySiteTheme = {\n  /** Theme identifier. */\n  readonly id: number;\n  /** Theme name. */\n  readonly name: string;\n  /** Theme preview URL, if available. */\n  readonly previewUrl: string | null;\n};\n\nexport const PORTAL_SELF_FUNCTION_DEFINITIONS = {\n  getMemberAccess: {\n    capability: \"account\",\n    version: \"1\",\n    method: \"getMemberAccess\",\n  },\n  updateUserAccount: {\n    capability: \"account.write\",\n    version: \"1\",\n    method: \"update\",\n  },\n  listTodos: { capability: \"todos\", version: \"1\", method: \"list\" },\n  createTodo: { capability: \"todos.write\", version: \"1\", method: \"create\" },\n  getPointsLedger: { capability: \"points\", version: \"1\", method: \"get\" },\n  getMySiteProfile: {\n    capability: \"mySite\",\n    version: \"1\",\n    method: \"getProfile\",\n  },\n  updateMySiteProfile: {\n    capability: \"mySite.write\",\n    version: \"1\",\n    method: \"updateProfile\",\n  },\n  updateMySiteSettings: {\n    capability: \"mySite.write\",\n    version: \"1\",\n    method: \"updateSettings\",\n  },\n  listMySiteLinks: {\n    capability: \"mySite\",\n    version: \"1\",\n    method: \"listLinks\",\n  },\n  createMySiteLink: {\n    capability: \"mySite.write\",\n    version: \"1\",\n    method: \"createLink\",\n  },\n  updateMySiteLink: {\n    capability: \"mySite.write\",\n    version: \"1\",\n    method: \"updateLink\",\n  },\n  deleteMySiteLink: {\n    capability: \"mySite.write\",\n    version: \"1\",\n    method: \"deleteLink\",\n  },\n  reorderMySiteLinks: {\n    capability: \"mySite.write\",\n    version: \"1\",\n    method: \"reorderLinks\",\n  },\n  listMySiteFavorites: {\n    capability: \"mySite\",\n    version: \"1\",\n    method: \"listFavorites\",\n  },\n  addMySiteFavorite: {\n    capability: \"mySite.write\",\n    version: \"1\",\n    method: \"addFavorite\",\n  },\n  deleteMySiteFavorite: {\n    capability: \"mySite.write\",\n    version: \"1\",\n    method: \"deleteFavorite\",\n  },\n  reorderMySiteFavorites: {\n    capability: \"mySite.write\",\n    version: \"1\",\n    method: \"reorderFavorites\",\n  },\n  listMySiteThemes: {\n    capability: \"mySite\",\n    version: \"1\",\n    method: \"listThemes\",\n  },\n} as const satisfies Readonly<Record<string, PortalFunctionDefinition>>;\n\n/**\n * Gets access and permissions for the signed-in member.\n * @returns The current {@link PortalMemberAccess}.\n * @throws {@link PortalFunctionError} when undeclared, unavailable, or rejected by the host.\n * @remarks Declare `getMemberAccess` in `uses` and call it only after mount.\n * @example const access = await getMemberAccess();\n */\nexport const getMemberAccess: PortalFunction<PortalMemberAccess> =\n  definePortalFunction(PORTAL_SELF_FUNCTION_DEFINITIONS.getMemberAccess);\n\n/**\n * Updates editable fields on the signed-in account.\n * @param input - Account fields to update.\n * @returns The updated {@link UserAccount}.\n * @throws {@link PortalFunctionError} when undeclared, invalid, unavailable, or rejected by the host.\n * @remarks Declare `updateUserAccount` in `uses`. This mutates host account data after mount.\n * @example const account = await updateUserAccount({ bio: \"Hello\" });\n */\nexport const updateUserAccount: PortalFunction<\n  UserAccount,\n  UpdateUserAccountInput\n> = definePortalFunction(PORTAL_SELF_FUNCTION_DEFINITIONS.updateUserAccount);\n\n/**\n * Lists todos for the signed-in member.\n * @param input - Optional completion-state filter.\n * @returns Todo summaries matching the filter.\n * @throws {@link PortalFunctionError} when undeclared, invalid, unavailable, or rejected by the host.\n * @remarks Declare `listTodos` in `uses` and call it only after mount.\n * @example const todos = await listTodos({ state: \"incomplete\" });\n */\nexport const listTodos: PortalFunction<\n  readonly PortalTodoSummary[],\n  ListTodosInput\n> = definePortalFunction(PORTAL_SELF_FUNCTION_DEFINITIONS.listTodos);\n\n/**\n * Creates a todo for the signed-in member.\n * @param input - Todo text and optional due timestamp.\n * @returns The created {@link PortalTodo}.\n * @throws {@link PortalFunctionError} when undeclared, invalid, unavailable, or rejected by the host.\n * @remarks Declare `createTodo` in `uses`. This mutates host data after mount.\n * @example const todo = await createTodo({ body: \"Follow up\" });\n */\nexport const createTodo: PortalFunction<PortalTodo, CreateTodoInput> =\n  definePortalFunction(PORTAL_SELF_FUNCTION_DEFINITIONS.createTodo);\n\n/**\n * Gets the reward-points ledger for the signed-in member.\n * @returns The current {@link PortalPointsLedger}.\n * @throws {@link PortalFunctionError} when undeclared, unavailable, or rejected by the host.\n * @remarks Declare `getPointsLedger` in `uses` and call it only after mount.\n * @example const ledger = await getPointsLedger();\n */\nexport const getPointsLedger: PortalFunction<PortalPointsLedger> =\n  definePortalFunction(PORTAL_SELF_FUNCTION_DEFINITIONS.getPointsLedger);\n\n/**\n * Gets the MySite profile for the signed-in member.\n * @returns The current {@link PortalMySiteProfile}.\n * @throws {@link PortalFunctionError} when undeclared, unavailable, or rejected by the host.\n * @remarks Declare `getMySiteProfile` in `uses` and call it only after mount.\n * @example const profile = await getMySiteProfile();\n */\nexport const getMySiteProfile: PortalFunction<PortalMySiteProfile> =\n  definePortalFunction(PORTAL_SELF_FUNCTION_DEFINITIONS.getMySiteProfile);\n\n/**\n * Updates editable MySite profile fields.\n * @param input - Profile fields to update.\n * @returns The updated {@link PortalMySiteProfile}.\n * @throws {@link PortalFunctionError} when undeclared, invalid, unavailable, or rejected by the host.\n * @remarks Declare `updateMySiteProfile` in `uses`. This mutates host data after mount.\n * @example const profile = await updateMySiteProfile({ displayName: \"Ari\" });\n */\nexport const updateMySiteProfile: PortalFunction<\n  PortalMySiteProfile,\n  UpdateMySiteProfileInput\n> = definePortalFunction(PORTAL_SELF_FUNCTION_DEFINITIONS.updateMySiteProfile);\n\n/**\n * Updates MySite publication settings.\n * @param input - Theme or public slug settings to update.\n * @returns `null` after the host applies the settings.\n * @throws {@link PortalFunctionError} when undeclared, invalid, unavailable, or rejected by the host.\n * @remarks Declare `updateMySiteSettings` in `uses`. This mutates host data after mount.\n * @example await updateMySiteSettings({ themeId: 42 });\n */\nexport const updateMySiteSettings: PortalFunction<\n  null,\n  UpdateMySiteSettingsInput\n> = definePortalFunction(PORTAL_SELF_FUNCTION_DEFINITIONS.updateMySiteSettings);\n\n/**\n * Lists links on the signed-in member's MySite.\n * @returns MySite links in display order.\n * @throws {@link PortalFunctionError} when undeclared, unavailable, or rejected by the host.\n * @remarks Declare `listMySiteLinks` in `uses` and call it only after mount.\n * @example const links = await listMySiteLinks();\n */\nexport const listMySiteLinks: PortalFunction<readonly PortalMySiteLink[]> =\n  definePortalFunction(PORTAL_SELF_FUNCTION_DEFINITIONS.listMySiteLinks);\n\n/**\n * Creates a link on the signed-in member's MySite.\n * @param input - Destination URL and visible title.\n * @returns The created {@link PortalMySiteLink}.\n * @throws {@link PortalFunctionError} when undeclared, invalid, unavailable, or rejected by the host.\n * @remarks Declare `createMySiteLink` in `uses`. This mutates host data after mount.\n * @example const link = await createMySiteLink({ title: \"Shop\", url: \"https://example.com\" });\n */\nexport const createMySiteLink: PortalFunction<\n  PortalMySiteLink,\n  CreateMySiteLinkInput\n> = definePortalFunction(PORTAL_SELF_FUNCTION_DEFINITIONS.createMySiteLink);\n\n/**\n * Updates a link on the signed-in member's MySite.\n * @param input - Link identifier and fields to replace.\n * @returns The updated {@link PortalMySiteLink}.\n * @throws {@link PortalFunctionError} when undeclared, invalid, unavailable, or rejected by the host.\n * @remarks Declare `updateMySiteLink` in `uses`. This mutates host data after mount.\n * @example const link = await updateMySiteLink({ id: 7, title: \"New title\" });\n */\nexport const updateMySiteLink: PortalFunction<\n  PortalMySiteLink,\n  UpdateMySiteLinkInput\n> = definePortalFunction(PORTAL_SELF_FUNCTION_DEFINITIONS.updateMySiteLink);\n\n/**\n * Deletes a link from the signed-in member's MySite.\n * @param input - Link identifier to delete.\n * @returns `null` after deletion.\n * @throws {@link PortalFunctionError} when undeclared, invalid, unavailable, or rejected by the host.\n * @remarks Declare `deleteMySiteLink` in `uses`. This permanently mutates host data after mount.\n * @example await deleteMySiteLink({ id: 7 });\n */\nexport const deleteMySiteLink: PortalFunction<null, DeleteMySiteLinkInput> =\n  definePortalFunction(PORTAL_SELF_FUNCTION_DEFINITIONS.deleteMySiteLink);\n\n/**\n * Replaces the display order of all MySite links.\n * @param input - Link identifiers in the desired order.\n * @returns Updated links in display order.\n * @throws {@link PortalFunctionError} when undeclared, invalid, unavailable, or rejected by the host.\n * @remarks Declare `reorderMySiteLinks` in `uses`. Supply the complete order after mount.\n * @example const links = await reorderMySiteLinks({ orderedIds: [7, 3] });\n */\nexport const reorderMySiteLinks: PortalFunction<\n  readonly PortalMySiteLink[],\n  ReorderMySiteLinksInput\n> = definePortalFunction(PORTAL_SELF_FUNCTION_DEFINITIONS.reorderMySiteLinks);\n\n/**\n * Lists product favorites on the signed-in member's MySite.\n * @returns Favorites in display order.\n * @throws {@link PortalFunctionError} when undeclared, unavailable, or rejected by the host.\n * @remarks Declare `listMySiteFavorites` in `uses` and call it only after mount.\n * @example const favorites = await listMySiteFavorites();\n */\nexport const listMySiteFavorites: PortalFunction<\n  readonly PortalMySiteFavorite[]\n> = definePortalFunction(PORTAL_SELF_FUNCTION_DEFINITIONS.listMySiteFavorites);\n\n/**\n * Adds a product to MySite favorites.\n * @param input - Product identifier to add.\n * @returns The created {@link PortalMySiteFavorite}.\n * @throws {@link PortalFunctionError} when undeclared, invalid, unavailable, or rejected by the host.\n * @remarks Declare `addMySiteFavorite` in `uses`. This mutates host data after mount.\n * @example const favorite = await addMySiteFavorite({ productId: 42 });\n */\nexport const addMySiteFavorite: PortalFunction<\n  PortalMySiteFavorite,\n  AddMySiteFavoriteInput\n> = definePortalFunction(PORTAL_SELF_FUNCTION_DEFINITIONS.addMySiteFavorite);\n\n/**\n * Deletes a MySite favorite.\n * @param input - Favorite record identifier to delete.\n * @returns `null` after deletion.\n * @throws {@link PortalFunctionError} when undeclared, invalid, unavailable, or rejected by the host.\n * @remarks Declare `deleteMySiteFavorite` in `uses`. This permanently mutates host data after mount.\n * @example await deleteMySiteFavorite({ id: 9 });\n */\nexport const deleteMySiteFavorite: PortalFunction<\n  null,\n  DeleteMySiteFavoriteInput\n> = definePortalFunction(PORTAL_SELF_FUNCTION_DEFINITIONS.deleteMySiteFavorite);\n\n/**\n * Replaces the display order of all MySite favorites.\n * @param input - Favorite identifiers in the desired order.\n * @returns Updated favorites in display order.\n * @throws {@link PortalFunctionError} when undeclared, invalid, unavailable, or rejected by the host.\n * @remarks Declare `reorderMySiteFavorites` in `uses`. Supply the complete order after mount.\n * @example const favorites = await reorderMySiteFavorites({ orderedIds: [9, 4] });\n */\nexport const reorderMySiteFavorites: PortalFunction<\n  readonly PortalMySiteFavorite[],\n  ReorderMySiteFavoritesInput\n> = definePortalFunction(\n  PORTAL_SELF_FUNCTION_DEFINITIONS.reorderMySiteFavorites,\n);\n\n/**\n * Lists themes available to the signed-in member's MySite.\n * @returns Available {@link PortalMySiteTheme} records.\n * @throws {@link PortalFunctionError} when undeclared, unavailable, or rejected by the host.\n * @remarks Declare `listMySiteThemes` in `uses` and call it only after mount.\n * @example const themes = await listMySiteThemes();\n */\nexport const listMySiteThemes: PortalFunction<readonly PortalMySiteTheme[]> =\n  definePortalFunction(PORTAL_SELF_FUNCTION_DEFINITIONS.listMySiteThemes);\n"],"mappings":";;;AASA,MAAM,2BAA2B,OAAO,IACtC,iDACD;AACD,MAAM,+BAA+B;AAsErC,MAAM,8BACJ,IAAI,IAAI;CACN;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;;AAGJ,IAAa,sBAAb,cAAyC,MAAM;;CAE7C;;;;;;;CAQA,YAAY,MAA+B,SAAiB;AAC1D,QAAM,QAAQ;AACd,OAAK,OAAO;AACZ,OAAK,OAAO;;;;;;;;;;;;;;;;;;;;;;AAuDhB,SAAgB,qBACd,YACA,GAAG,iBAC4B;CAC/B,MAAM,iBAAiB,kCAGrB,WAAW;CACb,MAAM,kBAAkB,OAAO,GAAG,SAA6B;AAC7D,MAAI;AACF,OAAI,KAAK,SAAS,EAChB,OA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