{"version":3,"file":"masterteam-components-runtime-action.mjs","sources":["../../../../packages/masterteam/components/runtime-action/runtime-action.types.ts","../../../../packages/masterteam/components/runtime-action/payload-builder.ts","../../../../packages/masterteam/components/runtime-action/runtime-action-context.store.ts","../../../../packages/masterteam/components/runtime-action/runtime-action.runner.ts","../../../../packages/masterteam/components/runtime-action/masterteam-components-runtime-action.ts"],"sourcesContent":["export interface RuntimeActionTranslatable {\r\n  display?: string;\r\n  en?: string;\r\n  ar?: string;\r\n}\r\n\r\nexport type RuntimeActionAfterSuccess = 'refresh' | 'close';\r\n\r\nexport interface RuntimeActionReason {\r\n  source?: string;\r\n  code?: string;\r\n  message?: string;\r\n  blocking?: boolean;\r\n  details?: string | null;\r\n  ruleKey?: string | null;\r\n  requestId?: number | null;\r\n  requestStatus?: string | null;\r\n  requestSchemaId?: number | null;\r\n  relatedRequestIds?: number[];\r\n}\r\n\r\nexport interface RuntimeAction {\r\n  actionKey: string;\r\n  actionName?: RuntimeActionTranslatable | string | null;\r\n  httpMethod?: string | null;\r\n  url?: string | null;\r\n  isAvailable?: boolean;\r\n  afterSuccess?: RuntimeActionAfterSuccess | null;\r\n  stepIds?: Array<number | string>;\r\n  needConfirmation?: boolean;\r\n  payloadKeys?: string[];\r\n  requiredPayloadKeys?: string[];\r\n  payloadTemplate?: Record<string, unknown> | null;\r\n  formId?: string | number | null;\r\n\r\n  targetType?: string;\r\n  targetId?: number;\r\n  moduleKey?: string;\r\n  operationKey?: string;\r\n  primaryReasonCode?: string | null;\r\n  reasons?: RuntimeActionReason[];\r\n}\r\n\r\nexport type RuntimeActionStatus = 'success' | 'error' | 'cancelled';\r\n\r\nexport interface RuntimeActionResult {\r\n  status: RuntimeActionStatus;\r\n  actionKey: string;\r\n  afterSuccess: RuntimeActionAfterSuccess | null;\r\n  response?: unknown;\r\n  error?: unknown;\r\n}\r\n\r\nexport interface RuntimeActionExecuteOptions {\r\n  externalPayloadResolvers?: Record<string, () => unknown>;\r\n  defaultAfterSuccess?: RuntimeActionAfterSuccess;\r\n  successMessage?: (response: unknown, action: RuntimeAction) => string;\r\n  errorMessage?: (error: unknown, action: RuntimeAction) => string;\r\n  transformPayload?: (\r\n    payload: Record<string, unknown> | undefined,\r\n    action: RuntimeAction,\r\n  ) => Record<string, unknown> | undefined;\r\n  silent?: boolean;\r\n}\r\n\r\nexport interface RuntimeActionFormValue {\r\n  requestPropertyId?: number;\r\n  propertyKey: string;\r\n  value: unknown;\r\n}\r\n\r\nexport interface RuntimeActionFormSource {\r\n  getSubmitValues(): RuntimeActionFormValue[] | undefined;\r\n}\r\n\r\nexport function resolveActionLabel(action: RuntimeAction): string {\r\n  const name = action.actionName;\r\n  if (typeof name === 'string') {\r\n    return name || action.actionKey;\r\n  }\r\n  return name?.display || action.actionKey;\r\n}\r\n","import { RuntimeAction } from './runtime-action.types';\r\n\r\nexport function buildActionPayload(\r\n  action: RuntimeAction,\r\n  formValue: Record<string, unknown> | undefined,\r\n  externalResolvers: Record<string, () => unknown> = {},\r\n): Record<string, unknown> | undefined {\r\n  const templatePayload = buildTemplatePayload(\r\n    action,\r\n    formValue,\r\n    externalResolvers,\r\n  );\r\n  if (templatePayload) {\r\n    return templatePayload;\r\n  }\r\n\r\n  const payloadKeys = action.payloadKeys ?? [];\r\n  if (!payloadKeys.length) {\r\n    return undefined;\r\n  }\r\n\r\n  const payload: Record<string, unknown> = {};\r\n\r\n  for (const key of payloadKeys) {\r\n    const formFieldValue = formValue?.[key];\r\n    if (formFieldValue !== undefined) {\r\n      payload[key] = normalizePayloadValue(key, formFieldValue);\r\n      continue;\r\n    }\r\n\r\n    const externalValue = resolveExternalPayloadValue(\r\n      key,\r\n      action,\r\n      externalResolvers,\r\n    );\r\n    if (externalValue !== undefined) {\r\n      payload[key] = externalValue;\r\n      continue;\r\n    }\r\n\r\n    const defaultValue = resolveDefaultPayloadValue(key);\r\n    if (defaultValue !== undefined) {\r\n      payload[key] = defaultValue;\r\n    }\r\n  }\r\n\r\n  return Object.keys(payload).length ? payload : undefined;\r\n}\r\n\r\nfunction buildTemplatePayload(\r\n  action: RuntimeAction,\r\n  formValue: Record<string, unknown> | undefined,\r\n  externalResolvers: Record<string, () => unknown>,\r\n): Record<string, unknown> | null {\r\n  const template = action.payloadTemplate as Record<string, unknown> | null;\r\n  if (!template || typeof template !== 'object') {\r\n    return null;\r\n  }\r\n\r\n  const payload: Record<string, unknown> = {};\r\n  const payloadKeys = action.payloadKeys ?? Object.keys(template);\r\n\r\n  for (const key of payloadKeys) {\r\n    if (key === 'fields') {\r\n      // The backend declares the operation's inputs as a `fields` template of\r\n      // `{ propertyKey, value: null }` placeholders. Only a host that rendered\r\n      // the operation's real form can fill them (see `hasActionInputFields`),\r\n      // so the values are taken whole from the form or left as declared —\r\n      // never patched per property key from here.\r\n      payload[key] = formValue?.['fields'] ?? template['fields'];\r\n      continue;\r\n    }\r\n\r\n    const formFieldValue = formValue?.[key];\r\n    if (formFieldValue !== undefined) {\r\n      payload[key] = normalizePayloadValue(key, formFieldValue);\r\n      continue;\r\n    }\r\n\r\n    const externalValue = resolveExternalPayloadValue(\r\n      key,\r\n      action,\r\n      externalResolvers,\r\n    );\r\n    if (externalValue !== undefined) {\r\n      payload[key] = externalValue;\r\n      continue;\r\n    }\r\n\r\n    if (template[key] !== undefined) {\r\n      payload[key] = template[key];\r\n      continue;\r\n    }\r\n\r\n    const defaultValue = resolveDefaultPayloadValue(key);\r\n    if (defaultValue !== undefined) {\r\n      payload[key] = defaultValue;\r\n    }\r\n  }\r\n\r\n  return Object.keys(payload).length ? payload : null;\r\n}\r\n\r\nfunction resolveExternalPayloadValue(\r\n  key: string,\r\n  action: RuntimeAction,\r\n  externalResolvers: Record<string, () => unknown>,\r\n): unknown {\r\n  const resolver = externalResolvers[key];\r\n  if (resolver) {\r\n    return resolver();\r\n  }\r\n\r\n  if (key === 'stepId') {\r\n    return action.stepIds?.[0];\r\n  }\r\n\r\n  return undefined;\r\n}\r\n\r\nexport function normalizePayloadValue(key: string, value: unknown): unknown {\r\n  if (key === 'attachments') {\r\n    if (value == null) {\r\n      return [];\r\n    }\r\n    return Array.isArray(value) ? value : [value];\r\n  }\r\n\r\n  return value;\r\n}\r\n\r\nexport function resolveDefaultPayloadValue(key: string): unknown {\r\n  switch (key) {\r\n    case 'attachments':\r\n      return [];\r\n    case 'delegatedUser':\r\n    case 'note':\r\n    case 'reason':\r\n      return null;\r\n    case 'values':\r\n      return [];\r\n    default:\r\n      return undefined;\r\n  }\r\n}\r\n\r\n/**\r\n * The declared operation inputs the payload would submit with no value — the\r\n * `{ propertyKey, value: null }` placeholders the backend sent, still unfilled.\r\n *\r\n * A non-empty result means the action was fired without rendering its form, and\r\n * submitting it would write nulls over the record (or fail the contract's\r\n * `operation_input.required` rule). Hosts fill these by running the operation\r\n * through `process-form-load` / `process-submit` instead.\r\n */\r\nexport function getUnfilledActionInputKeys(\r\n  payload: Record<string, unknown> | undefined,\r\n): string[] {\r\n  const fields = payload?.['fields'];\r\n  if (!Array.isArray(fields)) {\r\n    return [];\r\n  }\r\n\r\n  return fields\r\n    .filter(\r\n      (field) =>\r\n        !!field &&\r\n        typeof field === 'object' &&\r\n        (field as { value?: unknown }).value == null,\r\n    )\r\n    .map((field) => (field as { propertyKey?: unknown }).propertyKey)\r\n    .filter(\r\n      (key): key is string => typeof key === 'string' && key.trim() !== '',\r\n    );\r\n}\r\n\r\nexport function getMissingRequiredPayloadKeys(\r\n  action: RuntimeAction,\r\n  payload: Record<string, unknown> | undefined,\r\n): string[] {\r\n  return (action.requiredPayloadKeys ?? []).filter((key) =>\r\n    isMissingPayloadValue(payload?.[key]),\r\n  );\r\n}\r\n\r\nexport function isMissingPayloadValue(value: unknown): boolean {\r\n  if (value == null) {\r\n    return true;\r\n  }\r\n\r\n  if (typeof value === 'string') {\r\n    return value.trim().length === 0;\r\n  }\r\n\r\n  if (Array.isArray(value)) {\r\n    return value.length === 0;\r\n  }\r\n\r\n  return false;\r\n}\r\n\r\nexport function normalizeHttpMethod(\r\n  value: string | null | undefined,\r\n): string | null {\r\n  if (!value || typeof value !== 'string') {\r\n    return null;\r\n  }\r\n\r\n  const method = value.trim().toUpperCase();\r\n  return method.length ? method : null;\r\n}\r\n\r\nexport function methodSupportsBody(method: string): boolean {\r\n  return ['POST', 'PUT', 'PATCH', 'DELETE'].includes(method);\r\n}\r\n\r\nexport function buildRequestOptions(\r\n  method: string,\r\n  payload: Record<string, unknown> | undefined,\r\n): Record<string, unknown> {\r\n  if (!payload || !methodSupportsBody(method)) {\r\n    return { observe: 'body' };\r\n  }\r\n\r\n  return {\r\n    body: payload,\r\n    observe: 'body',\r\n  };\r\n}\r\n\r\n/**\r\n * The action collects free-form request metadata — a reason, a note, a\r\n * delegate, attachments — which the generic confirm dialog can render on its\r\n * own because the keys are fixed and operation-independent.\r\n *\r\n * Operation *inputs* are a different thing entirely: see\r\n * {@link hasActionInputFields}.\r\n */\r\nexport function hasActionFormFields(action: RuntimeAction): boolean {\r\n  return (action.payloadKeys ?? []).some((key) =>\r\n    ['delegatedUser', 'reason', 'note', 'attachments'].includes(key),\r\n  );\r\n}\r\n\r\n/**\r\n * The action declares operation inputs the user still has to supply — its\r\n * `payloadTemplate.fields` is a non-empty list of `{ propertyKey, value: null }`\r\n * placeholders.\r\n *\r\n * Firing such an action straight from its template submits those nulls, so a\r\n * host must instead run the operation through its own form: `process-form-load`\r\n * for the effective form and current values, `process-submit/validate`, then\r\n * `process-submit`. The backend owns which fields those are — never infer them\r\n * from the operation key.\r\n */\r\nexport function hasActionInputFields(action: RuntimeAction): boolean {\r\n  const fields = (action.payloadTemplate as { fields?: unknown } | null)\r\n    ?.fields;\r\n  return Array.isArray(fields) && fields.length > 0;\r\n}\r\n\r\n/**\r\n * The property keys an action declares as its operation inputs, in the\r\n * backend's own casing. Pass them to `mt-client-form`'s `allowedFieldKeys` to\r\n * scope a configured form down to the inputs this action actually writes.\r\n */\r\nexport function getActionInputFieldKeys(action: RuntimeAction): string[] {\r\n  const fields = (action.payloadTemplate as { fields?: unknown } | null)\r\n    ?.fields;\r\n  if (!Array.isArray(fields)) {\r\n    return [];\r\n  }\r\n\r\n  return fields\r\n    .map((field) =>\r\n      field && typeof field === 'object'\r\n        ? (field as { propertyKey?: unknown }).propertyKey\r\n        : null,\r\n    )\r\n    .filter(\r\n      (key): key is string => typeof key === 'string' && key.trim() !== '',\r\n    );\r\n}\r\n","import { Injectable, signal } from '@angular/core';\r\n\r\nimport {\r\n  RuntimeActionFormSource,\r\n  RuntimeActionFormValue,\r\n} from './runtime-action.types';\r\n\r\n@Injectable()\r\nexport class RuntimeActionContextStore {\r\n  private readonly formSource = signal<RuntimeActionFormSource | null>(null);\r\n\r\n  setFormSource(source: RuntimeActionFormSource | null): void {\r\n    this.formSource.set(source);\r\n  }\r\n\r\n  resolveFormValues(): RuntimeActionFormValue[] {\r\n    const values = this.formSource()?.getSubmitValues();\r\n    return Array.isArray(values)\r\n      ? values.map((value) => ({\r\n          requestPropertyId: value.requestPropertyId,\r\n          propertyKey: value.propertyKey,\r\n          value: value.value,\r\n        }))\r\n      : [];\r\n  }\r\n}\r\n","import { HttpClient } from '@angular/common/http';\r\nimport { Injectable, InjectionToken, Type, inject } from '@angular/core';\r\nimport { TranslocoService } from '@jsverse/transloco';\r\nimport { ConfirmationService } from '@masterteam/components/confirmation';\r\nimport { ModalService } from '@masterteam/components/modal';\r\nimport { ToastService } from '@masterteam/components/toast';\r\nimport { firstValueFrom, map } from 'rxjs';\r\n\r\nimport {\r\n  buildActionPayload,\r\n  buildRequestOptions,\r\n  getMissingRequiredPayloadKeys,\r\n  getUnfilledActionInputKeys,\r\n  hasActionFormFields,\r\n  normalizeHttpMethod,\r\n} from './payload-builder';\r\nimport {\r\n  RuntimeAction,\r\n  RuntimeActionAfterSuccess,\r\n  RuntimeActionExecuteOptions,\r\n  RuntimeActionResult,\r\n  resolveActionLabel,\r\n} from './runtime-action.types';\r\n\r\nexport const RUNTIME_ACTION_CONFIRM_DIALOG = new InjectionToken<Type<unknown>>(\r\n  'RUNTIME_ACTION_CONFIRM_DIALOG',\r\n);\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class RuntimeActionRunner {\r\n  private readonly http = inject(HttpClient);\r\n  private readonly confirmation = inject(ConfirmationService);\r\n  private readonly modal = inject(ModalService);\r\n  private readonly toast = inject(ToastService);\r\n  private readonly transloco = inject(TranslocoService);\r\n  private readonly confirmDialogClass = inject(RUNTIME_ACTION_CONFIRM_DIALOG, {\r\n    optional: true,\r\n  });\r\n\r\n  async execute(\r\n    action: RuntimeAction,\r\n    options: RuntimeActionExecuteOptions = {},\r\n  ): Promise<RuntimeActionResult> {\r\n    const method = normalizeHttpMethod(action.httpMethod);\r\n    const url = action.url?.trim();\r\n\r\n    if (!method || !url || action.isAvailable === false) {\r\n      return cancelledOrError(\r\n        action,\r\n        'error',\r\n        new Error(this.notExecutableMessage(action)),\r\n      );\r\n    }\r\n\r\n    const performRun = (\r\n      formValue?: Record<string, unknown>,\r\n    ): Promise<RuntimeActionResult> => {\r\n      let payload = buildActionPayload(\r\n        action,\r\n        formValue,\r\n        options.externalPayloadResolvers ?? {},\r\n      );\r\n\r\n      if (options.transformPayload) {\r\n        payload = options.transformPayload(payload, action);\r\n      }\r\n\r\n      // An action that declares operation inputs cannot be fired from its\r\n      // template alone: the backend sends those fields as `value: null`\r\n      // placeholders for a form to fill, so submitting them as-is writes nulls\r\n      // over the record. Only checked when no form value was collected — a host\r\n      // that supplied one owns what it put in `fields`, cleared values included.\r\n      // The way to run such an action is `process-form-load` →\r\n      // `process-submit/validate` → `process-submit`; see `hasActionInputFields`.\r\n      const missing = [\r\n        ...getMissingRequiredPayloadKeys(action, payload),\r\n        ...(formValue ? [] : getUnfilledActionInputKeys(payload)),\r\n      ];\r\n      if (missing.length) {\r\n        const message = this.transloco.translate(\r\n          'components.runtimeAction.missingArgs',\r\n          { action: resolveActionLabel(action), missing: missing.join(', ') },\r\n        );\r\n        if (!options.silent) {\r\n          this.toast.error(message);\r\n        }\r\n        return Promise.resolve({\r\n          status: 'error',\r\n          actionKey: action.actionKey,\r\n          afterSuccess: null,\r\n          error: new Error(message),\r\n        });\r\n      }\r\n\r\n      return this.run(action, method, url, payload, options);\r\n    };\r\n\r\n    if (action.needConfirmation) {\r\n      if (hasActionFormFields(action) && this.confirmDialogClass) {\r\n        return this.runWithFormDialog(action, performRun);\r\n      }\r\n\r\n      const confirmed = await this.confirmPlain(action);\r\n      if (!confirmed) {\r\n        return {\r\n          status: 'cancelled',\r\n          actionKey: action.actionKey,\r\n          afterSuccess: null,\r\n        };\r\n      }\r\n    }\r\n\r\n    return performRun();\r\n  }\r\n\r\n  private runWithFormDialog(\r\n    action: RuntimeAction,\r\n    performRun: (\r\n      value: Record<string, unknown>,\r\n    ) => Promise<RuntimeActionResult>,\r\n  ): Promise<RuntimeActionResult> {\r\n    return new Promise((resolve) => {\r\n      let pendingRun: Promise<RuntimeActionResult> | null = null;\r\n      let finalResult: RuntimeActionResult | null = null;\r\n\r\n      const ref = this.modal.openModal(this.confirmDialogClass!, 'dialog', {\r\n        header: resolveActionLabel(action),\r\n        width: '40rem',\r\n        dismissableMask: true,\r\n        inputValues: {\r\n          action,\r\n          onSubmit: async (value: Record<string, unknown>) => {\r\n            pendingRun = performRun(value);\r\n            const result = await pendingRun;\r\n            finalResult = result;\r\n            return result.status === 'success';\r\n          },\r\n        },\r\n      });\r\n\r\n      ref.onClose.subscribe(async () => {\r\n        if (finalResult) {\r\n          resolve(finalResult);\r\n          return;\r\n        }\r\n        if (pendingRun) {\r\n          try {\r\n            resolve(await pendingRun);\r\n          } catch (error) {\r\n            resolve({\r\n              status: 'error',\r\n              actionKey: action.actionKey,\r\n              afterSuccess: null,\r\n              error,\r\n            });\r\n          }\r\n          return;\r\n        }\r\n        resolve({\r\n          status: 'cancelled',\r\n          actionKey: action.actionKey,\r\n          afterSuccess: null,\r\n        });\r\n      });\r\n    });\r\n  }\r\n\r\n  private confirmPlain(action: RuntimeAction): Promise<boolean> {\r\n    return new Promise((resolve) => {\r\n      const label = resolveActionLabel(action);\r\n      this.confirmation.confirm({\r\n        type: 'dialog',\r\n        header: label,\r\n        message: this.transloco.translate(\r\n          'components.runtimeAction.confirmDefault',\r\n          { action: label },\r\n        ),\r\n        acceptLabel: label,\r\n        icon: 'alert.alert-triangle',\r\n        accept: () => resolve(true),\r\n        reject: () => resolve(false),\r\n      });\r\n    });\r\n  }\r\n\r\n  private async run(\r\n    action: RuntimeAction,\r\n    method: string,\r\n    url: string,\r\n    payload: Record<string, unknown> | undefined,\r\n    options: RuntimeActionExecuteOptions,\r\n  ): Promise<RuntimeActionResult> {\r\n    const fallbackErrorMessage = this.transloco.translate(\r\n      'components.runtimeAction.executeFailed',\r\n      { action: resolveActionLabel(action) },\r\n    );\r\n\r\n    try {\r\n      const response = await firstValueFrom(\r\n        this.http\r\n          .request<unknown>(method, url, buildRequestOptions(method, payload))\r\n          .pipe(\r\n            map((res) => ensureSuccessfulEnvelope(res, fallbackErrorMessage)),\r\n          ),\r\n      );\r\n\r\n      if (options.successMessage && !options.silent) {\r\n        this.toast.success(options.successMessage(response, action));\r\n      }\r\n\r\n      return {\r\n        status: 'success',\r\n        actionKey: action.actionKey,\r\n        afterSuccess: resolveAfterSuccess(action, options.defaultAfterSuccess),\r\n        response,\r\n      };\r\n    } catch (error) {\r\n      const message =\r\n        options.errorMessage?.(error, action) ??\r\n        resolveHttpErrorMessage(error, fallbackErrorMessage);\r\n\r\n      if (!options.silent) {\r\n        this.toast.error(message);\r\n      }\r\n\r\n      return {\r\n        status: 'error',\r\n        actionKey: action.actionKey,\r\n        afterSuccess: null,\r\n        error,\r\n      };\r\n    }\r\n  }\r\n\r\n  private notExecutableMessage(action: RuntimeAction): string {\r\n    if (action.isAvailable === false) {\r\n      return this.transloco.translate('components.runtimeAction.notAvailable', {\r\n        action: action.actionKey,\r\n      });\r\n    }\r\n    if (!action.url) {\r\n      return this.transloco.translate('components.runtimeAction.noUrl', {\r\n        action: action.actionKey,\r\n      });\r\n    }\r\n    return this.transloco.translate('components.runtimeAction.noHttpMethod', {\r\n      action: action.actionKey,\r\n    });\r\n  }\r\n}\r\n\r\nfunction cancelledOrError(\r\n  action: RuntimeAction,\r\n  status: 'error' | 'cancelled',\r\n  error?: unknown,\r\n): RuntimeActionResult {\r\n  return {\r\n    status,\r\n    actionKey: action.actionKey,\r\n    afterSuccess: null,\r\n    error,\r\n  };\r\n}\r\n\r\nfunction resolveAfterSuccess(\r\n  action: RuntimeAction,\r\n  fallback: RuntimeActionAfterSuccess | undefined,\r\n): RuntimeActionAfterSuccess {\r\n  if (action.afterSuccess === 'close' || action.afterSuccess === 'refresh') {\r\n    return action.afterSuccess;\r\n  }\r\n  return fallback ?? 'refresh';\r\n}\r\n\r\nfunction ensureSuccessfulEnvelope(\r\n  response: unknown,\r\n  fallback: string,\r\n): unknown {\r\n  if (!response || typeof response !== 'object') {\r\n    return response;\r\n  }\r\n\r\n  const envelope = response as { code?: number };\r\n  if (typeof envelope.code === 'number' && envelope.code !== 1) {\r\n    throw new Error(resolveEnvelopeErrorMessage(response, fallback));\r\n  }\r\n  return response;\r\n}\r\n\r\nfunction resolveEnvelopeErrorMessage(\r\n  response: unknown,\r\n  fallback: string,\r\n): string {\r\n  if (!response || typeof response !== 'object') {\r\n    return fallback;\r\n  }\r\n  const envelope = response as {\r\n    message?: string | null;\r\n    errors?: { message?: string } | null;\r\n  };\r\n  return envelope.errors?.message ?? envelope.message ?? fallback;\r\n}\r\n\r\nfunction resolveHttpErrorMessage(error: unknown, fallback: string): string {\r\n  if (!error || typeof error !== 'object') {\r\n    return fallback;\r\n  }\r\n  const httpError = error as {\r\n    message?: string;\r\n    error?: { message?: string | null } | null;\r\n  };\r\n  return httpError.error?.message ?? httpError.message ?? fallback;\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;AA2EM,SAAU,kBAAkB,CAAC,MAAqB,EAAA;AACtD,IAAA,MAAM,IAAI,GAAG,MA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