{"version":3,"file":"masterteam-components-entities.mjs","sources":["../../../../packages/masterteam/components/entities/entity.model.ts","../../../../packages/masterteam/components/entities/entity-sections.util.ts","../../../../packages/masterteam/components/entities/entity-display.utils.ts","../../../../packages/masterteam/components/entities/stakeholder-name.utils.ts","../../../../packages/masterteam/components/entities/entity-runtime-context.ts","../../../../packages/masterteam/components/entities/calculation-explanation/calculation-explanation.service.ts","../../../../packages/masterteam/components/entities/calculation-explanation/calculation-explanation-format.ts","../../../../packages/masterteam/components/entities/calculation-explanation/calculation-explanation-view.ts","../../../../packages/masterteam/components/entities/active-lang.ts","../../../../packages/masterteam/components/entities/calculation-explanation/calculation-explanation-context.ts","../../../../packages/masterteam/components/entities/calculation-explanation/calculation-explanation-equation.ts","../../../../packages/masterteam/components/entities/calculation-explanation/calculation-explanation-checks.ts","../../../../packages/masterteam/components/entities/calculation-explanation/calculation-explanation-summary.ts","../../../../packages/masterteam/components/entities/calculation-explanation/calculation-explanation-section.ts","../../../../packages/masterteam/components/entities/calculation-explanation/calculation-explanation-details.ts","../../../../packages/masterteam/components/entities/calculation-explanation/calculation-explanation-panel.ts","../../../../packages/masterteam/components/entities/calculation-explanation/entity-calculation-explanation.ts","../../../../packages/masterteam/components/entities/entity-calculated-indicator/entity-calculated-indicator.ts","../../../../packages/masterteam/components/entities/currency-display.utils.ts","../../../../packages/masterteam/components/entities/calculation-change.utils.ts","../../../../packages/masterteam/components/entities/entity-calculation-change/entity-calculation-change.ts","../../../../packages/masterteam/components/entities/entity-preview/entity-preview-context.ts","../../../../packages/masterteam/components/entities/entity-field/entity-field.ts","../../../../packages/masterteam/components/entities/entity-text/entity-text.ts","../../../../packages/masterteam/components/entities/entity-text/entity-text.html","../../../../packages/masterteam/components/entities/fit-text.directive.ts","../../../../packages/masterteam/components/entities/entity-date/entity-date.ts","../../../../packages/masterteam/components/entities/entity-date/entity-date.html","../../../../packages/masterteam/components/entities/entity-status/entity-status.ts","../../../../packages/masterteam/components/entities/entity-status/entity-status.html","../../../../packages/masterteam/components/entities/entity-icon/entity-icon.ts","../../../../packages/masterteam/components/entities/entity-icon/entity-icon.html","../../../../packages/masterteam/components/entities/entity-color/entity-color.ts","../../../../packages/masterteam/components/entities/entity-color/entity-color.html","../../../../packages/masterteam/components/entities/entity-user/entity-user.ts","../../../../packages/masterteam/components/entities/entity-user/entity-user.html","../../../../packages/masterteam/components/entities/percentage-color.utils.ts","../../../../packages/masterteam/components/entities/entity-percentage/entity-percentage.ts","../../../../packages/masterteam/components/entities/entity-percentage/entity-percentage.html","../../../../packages/masterteam/components/entities/entity-currency/entity-currency.ts","../../../../packages/masterteam/components/entities/entity-currency/entity-currency.html","../../../../packages/masterteam/components/entities/entity-checkbox/entity-checkbox.ts","../../../../packages/masterteam/components/entities/entity-checkbox/entity-checkbox.html","../../../../packages/masterteam/components/entities/entity-long-text/entity-long-text.ts","../../../../packages/masterteam/components/entities/entity-long-text/entity-long-text.html","../../../../packages/masterteam/components/entities/entity-lookup/entity-lookup.ts","../../../../packages/masterteam/components/entities/entity-lookup/entity-lookup.html","../../../../packages/masterteam/components/entities/entity-phase-gate/entity-phase-gate.ts","../../../../packages/masterteam/components/entities/entity-phase-gate/entity-phase-gate.html","../../../../packages/masterteam/components/entities/performance-score.utils.ts","../../../../packages/masterteam/components/entities/entity-performance-score/entity-performance-score.ts","../../../../packages/masterteam/components/entities/entity-performance-score/entity-performance-score.html","../../../../packages/masterteam/components/entities/entity-attachment/entity-attachment.ts","../../../../packages/masterteam/components/entities/entity-attachment/entity-attachment.html","../../../../packages/masterteam/components/entities/entity-location/entity-location.ts","../../../../packages/masterteam/components/entities/entity-location/entity-location.html","../../../../packages/masterteam/components/entities/entity-connection/entity-connection.ts","../../../../packages/masterteam/components/entities/entity-connection/entity-connection.html","../../../../packages/masterteam/components/entities/entity-schedule-item/entity-schedule-item.ts","../../../../packages/masterteam/components/entities/entity-schedule-item/entity-schedule-item.html","../../../../packages/masterteam/components/entities/entity-list-local.util.ts","../../../../packages/masterteam/components/entities/entity-list-rows.util.ts","../../../../packages/masterteam/components/entities/entity-leaf-details/entity-leaf-details.ts","../../../../packages/masterteam/components/entities/entity-leaf-details/entity-leaf-details.html","../../../../packages/masterteam/components/entities/entity-preview/entity-value-preview.ts","../../../../packages/masterteam/components/entities/entity-preview/entity-value-preview.html","../../../../packages/masterteam/components/entities/entity-list-preview/entity-list-drawer.ts","../../../../packages/masterteam/components/entities/entity-list-preview/entity-list-drawer.html","../../../../packages/masterteam/components/entities/entity-list-preview/entity-list-preview.ts","../../../../packages/masterteam/components/entities/entity-list-preview/entity-list-preview.html","../../../../packages/masterteam/components/entities/entity-lookup-module-check-list/entity-lookup-module-check-list.ts","../../../../packages/masterteam/components/entities/entity-lookup-module-check-list/entity-lookup-module-check-list.html","../../../../packages/masterteam/components/entities/connection-display.utils.ts","../../../../packages/masterteam/components/entities/entity-header.util.ts","../../../../packages/masterteam/components/entities/leaf-details-display.utils.ts","../../../../packages/masterteam/components/entities/calculated-value-history.ts","../../../../packages/masterteam/components/entities/entity-header/entity-header.ts","../../../../packages/masterteam/components/entities/entity-header/entity-header.html","../../../../packages/masterteam/components/entities/entity-preview/entity-preview-body.ts","../../../../packages/masterteam/components/entities/entity-preview/entity-preview-body.html","../../../../packages/masterteam/components/entities/comparison/comparison-value/comparison-value.ts","../../../../packages/masterteam/components/entities/comparison/comparison-value/comparison-value.html","../../../../packages/masterteam/components/entities/comparison/comparison-entity-list/comparison-entity-list.ts","../../../../packages/masterteam/components/entities/comparison/comparison-entity-list/comparison-entity-list.html","../../../../packages/masterteam/components/entities/entity-preview/entity-preview.ts","../../../../packages/masterteam/components/entities/entity-preview/entity-preview.html","../../../../packages/masterteam/components/entities/entities-preview/entities-preview.ts","../../../../packages/masterteam/components/entities/entities-preview/entities-preview.html","../../../../packages/masterteam/components/entities/entities-manage/entities-resize-base.ts","../../../../packages/masterteam/components/entities/entities-manage/entities-manage.ts","../../../../packages/masterteam/components/entities/entities-manage/entities-manage.html","../../../../packages/masterteam/components/entities/masterteam-components-entities.ts"],"sourcesContent":["import type { PropertyValueComparison } from './entity-comparison.model';\r\nimport type { EntityRuntimeContext } from './entity-runtime-context';\r\nimport type { EntityCalculationSource } from './calculation-explanation/calculation-explanation.model';\r\n\r\n/** A recalculation covering this value is running, or queued behind another. */\r\nexport type EntityCalculationStatus = 'running' | 'waiting' | 'delayed';\r\n\r\n/** How a calculated value moved between two reads of the same record. */\r\nexport interface EntityCalculationChange {\r\n  /** Signed difference; `null` for a value that has no numeric difference. */\r\n  delta: number | null;\r\n  /** The value's unit as the backend formats it, e.g. `SAR` or `%`. */\r\n  unit: string;\r\n  /** Whether the unit is written before the amount. */\r\n  unitLeads: boolean;\r\n  fractionDigits: number;\r\n  /** The value as it read before and after, in full. */\r\n  previous: string;\r\n  current: string;\r\n  /** While true a chip beside the value shows the change. Numbers only. */\r\n  recent: boolean;\r\n}\r\n\r\nexport type EntityViewType =\r\n  | 'Text'\r\n  | 'LongText'\r\n  | 'Date'\r\n  | 'DateTime'\r\n  /**\r\n   * Time-of-day. The value on the wire is still a full ISO instant (the\r\n   * backend stores and returns the same shape as `DateTime`); only the\r\n   * rendering and the picker are narrowed to the clock time.\r\n   */\r\n  | 'Time'\r\n  | 'Number'\r\n  | 'Percentage'\r\n  | 'Status'\r\n  | 'Currency'\r\n  | 'Checkbox'\r\n  | 'User'\r\n  | 'MultiUser'\r\n  | 'Lookup'\r\n  | 'LookupMultiSelect'\r\n  /**\r\n   * Calculated, read-only lookup resolved by the backend to the schema phase\r\n   * gate the record currently sits on. Never editable at runtime.\r\n   */\r\n  | 'PhaseGate'\r\n  /**\r\n   * Calculated, read-only KPI performance — a semicircle gauge (ported from\r\n   * SPlus v3's `app-performance-gauge`). The value is an\r\n   * {@link EntityPerformanceScoreValue}; never editable at runtime.\r\n   */\r\n  | 'PerformanceScore'\r\n  | 'Attachment'\r\n  | 'Location'\r\n  | 'LookupMatrix'\r\n  | 'LookupModuleCheckList'\r\n  | 'LeafDetails'\r\n  | 'Connection'\r\n  | 'ScheduleItemSelector'\r\n  /**\r\n   * A nested list of related rows. Read-only here: the editable runtime is\r\n   * `mt-entity-list-field`, which fetches its own rows; this view type is what\r\n   * arrives when an `EntityList` property is itself a *column* of that fetch —\r\n   * a calculated inline list the backend renders inline, such as the phase\r\n   * gate `phasegate_checklists` virtual property. The value carries its own\r\n   * rows, so nothing is fetched to display it.\r\n   */\r\n  | 'EntityList'\r\n  /**\r\n   * A stored icon reference. The value is a plain icon key (e.g.\r\n   * `custom.strategy`) — the backend's own system icon property (Name/Icon on\r\n   * a Template) reports this view type. Rendered as the actual glyph via\r\n   * `mt-icon`, not as the raw key string; `mt-icon` degrades to an empty glyph\r\n   * for an unknown key.\r\n   */\r\n  | 'Icon'\r\n  /**\r\n   * A stored color — a plain `#rrggbb` string, as `mt-color-picker-field`\r\n   * writes it. Rendered as a swatch next to the hex code, not as bare text.\r\n   */\r\n  | 'Color'\r\n  /**\r\n   * Layout marker, not a value. Rendered full-width and non-resizable; the\r\n   * preview layer (`groupEntitiesIntoSections`) turns each marker into a titled\r\n   * section box that owns every entity following it until the next marker.\r\n   */\r\n  | 'Section';\r\n\r\nexport type EntityLabelPosition = 'top' | 'bottom';\r\n\r\n/** Entity size – controls column span (1-24) inside a 24-column grid */\r\nexport type EntitySize =\r\n  | 1\r\n  | 2\r\n  | 3\r\n  | 4\r\n  | 5\r\n  | 6\r\n  | 7\r\n  | 8\r\n  | 9\r\n  | 10\r\n  | 11\r\n  | 12\r\n  | 13\r\n  | 14\r\n  | 15\r\n  | 16\r\n  | 17\r\n  | 18\r\n  | 19\r\n  | 20\r\n  | 21\r\n  | 22\r\n  | 23\r\n  | 24;\r\n\r\n/**\r\n * Entity row span – how many rows of the 24-column grid the entity occupies.\r\n * Lets a tall entity (e.g. a PerformanceScore gauge) sit beside a column of\r\n * stacked entities instead of leaving empty space next to it.\r\n */\r\nexport type EntityRowSpan = 1 | 2 | 3 | 4;\r\n\r\nexport const ENTITY_ROW_SPANS: readonly EntityRowSpan[] = [1, 2, 3, 4];\r\n\r\n// ── Per-type configuration interfaces ──\r\n\r\nexport interface EntityBaseConfig {\r\n  /** Column span of the entity card (1-24). Default: 8 */\r\n  size?: EntitySize;\r\n  /** Row span of the entity card (1-4). Default: 1 */\r\n  rowSpan?: EntityRowSpan;\r\n  /** Whether to show a dashed border around the entity card */\r\n  showBorder?: boolean;\r\n  /** Whether to hide the entity name label. Prefer hideLabel for new config. */\r\n  hideName?: boolean;\r\n  /** Whether to hide the entity label */\r\n  hideLabel?: boolean;\r\n  /** Controls whether the label is rendered above or below the value */\r\n  labelPosition?: EntityLabelPosition;\r\n  /** Legacy misspelled alias kept for compatibility */\r\n  labelPostion?: EntityLabelPosition;\r\n  /** Whether the entity content is aligned to the end (right in LTR) */\r\n  alignEnd?: boolean;\r\n  /**\r\n   * Custom localized label override. When present it replaces the catalog\r\n   * label; it also serves as the heading for `Section` markers.\r\n   */\r\n  label?: EntitySectionLabel;\r\n  /**\r\n   * Admin-authored explanatory note, localized. When present the entity grows a\r\n   * small info affordance at its top-end corner that reveals this text on hover.\r\n   *\r\n   * Plain text, deliberately. Every string inside a `configuration` payload is\r\n   * sanitized server-side with the PlainText profile, which strips HTML tags\r\n   * outright — rich markup authored here would come back as bare words. The\r\n   * renderer preserves the author's own line breaks instead.\r\n   */\r\n  info?: EntitySectionLabel;\r\n  /**\r\n   * Renders the entity as the card's header instead of a grid cell: a\r\n   * full-width band pinned above every other entity, showing the value\r\n   * centred with no label. Its presence is the switch — absent ⇒ an ordinary\r\n   * cell.\r\n   *\r\n   * Text view types only, and one per display area. The customization drawer\r\n   * enforces both; the renderers only honour the first Text entity carrying\r\n   * it, so a configuration written elsewhere cannot produce two headers.\r\n   */\r\n  header?: EntityHeaderConfig;\r\n}\r\n\r\n/** Colours of an entity rendered as a card header (`EntityBaseConfig.header`). */\r\nexport interface EntityHeaderConfig {\r\n  /** Band background, `#rrggbb`. Absent ⇒ a light tint of the primary colour. */\r\n  backgroundColor?: string | null;\r\n  /** Top border, `#rrggbb`. Absent ⇒ the primary colour. */\r\n  borderColor?: string | null;\r\n}\r\n\r\nexport interface EntityUserConfig extends EntityBaseConfig {\r\n  showDisplayName?: boolean;\r\n  showPhoneNumber?: boolean;\r\n  showEmail?: boolean;\r\n  /**\r\n   * Whether the avatar is rendered at all. When `false` neither the user's\r\n   * picture nor the generic fallback icon shows — only the name remains.\r\n   */\r\n  showAvatar?: boolean;\r\n  /** Maximum users shown before the MultiUser preview collapses behind +N. */\r\n  maxVisibleUsers?: number;\r\n}\r\n\r\n/**\r\n * One Progress/Percentage color rule. Bounds are inclusive and at least one of\r\n * `minValue`/`maxValue` must be present — a rule with neither matches nothing.\r\n */\r\nexport interface PercentageColorRule {\r\n  minValue?: number | null;\r\n  maxValue?: number | null;\r\n  color: string;\r\n}\r\n\r\n/**\r\n * Where a Percentage property's colour comes from.\r\n *\r\n * - `rules` — the value itself picks the colour out of `colorRules`.\r\n * - `property` — another property on the same record supplies it, so the bar\r\n *   follows that property's own colour (a Status's colour, a Lookup item's\r\n *   colour) rather than the percentage it is showing.\r\n *\r\n * An absent mode reads as `rules`: every configuration authored before this\r\n * existed is value-based.\r\n */\r\nexport type PercentageColorMode = 'rules' | 'property';\r\n\r\n/**\r\n * The property that supplies the colour in `property` mode.\r\n *\r\n * Both identifiers are stored on purpose. `propertyId` is what the backend\r\n * resolves against, and `propertyKey` is what a renderer holding an already\r\n * rendered record can match without a catalog lookup — rendered properties\r\n * carry their key, not the catalog id they came from.\r\n */\r\nexport interface PercentageColorPropertyRef {\r\n  /** Catalog id of the colour-bearing property. */\r\n  propertyId: number;\r\n  /** Its key, for matching against a rendered record. */\r\n  propertyKey?: string | null;\r\n  /**\r\n   * Its view type — `Status`, `Lookup`, `LookupMultiSelect` or `PhaseGate`.\r\n   * Deliberately a plain string: it arrives from stored JSON, and a view type\r\n   * this build does not know about must survive the round trip rather than be\r\n   * normalised away.\r\n   */\r\n  viewType?: string | null;\r\n}\r\n\r\nexport interface EntityPercentageConfig extends EntityBaseConfig {\r\n  /**\r\n   * The colour to paint the bar with. The backend resolves the configuration —\r\n   * the rules, or the source property in `property` mode — and ships the winner\r\n   * here on render/value/fetch responses, so this always wins over a\r\n   * client-side evaluation.\r\n   */\r\n  color?: string;\r\n  /** Which of the two colour strategies applies. Absent ⇒ `rules`. */\r\n  colorSource?: PercentageColorMode | null;\r\n  /** The colour-bearing property. `property` mode only. */\r\n  colorProperty?: PercentageColorPropertyRef | null;\r\n  /** Ordered rules — evaluated in order, first match wins. `rules` mode only. */\r\n  colorRules?: PercentageColorRule[] | null;\r\n  /**\r\n   * Fallback colour. In `rules` mode it applies when no rule matches; in\r\n   * `property` mode when the source property is empty or its value carries no\r\n   * colour of its own.\r\n   */\r\n  defaultColor?: string | null;\r\n}\r\n\r\n/**\r\n * How wide a `PerformanceScore` gauge may grow inside its cell. The gauge is\r\n * centred and shrinks with a narrower cell; this only caps it. Absent ⇒\r\n * `medium`.\r\n */\r\nexport type EntityPerformanceScoreChartSize =\r\n  | 'small'\r\n  | 'medium'\r\n  | 'large'\r\n  | 'full';\r\n\r\nexport interface EntityPerformanceScoreConfig extends EntityBaseConfig {\r\n  /** Set from the customization drawer. */\r\n  chartSize?: EntityPerformanceScoreChartSize;\r\n}\r\n\r\nexport interface LeafLevelSavedConfig {\r\n  /** Position order for this level entity in the preview grid */\r\n  order: number;\r\n  /** Column span (1-24), persisted from drag-resize */\r\n  size?: EntitySize;\r\n  /** Status keys the user has chosen to display */\r\n  selectedStatuses: string[];\r\n  /**\r\n   * Custom label for THIS tile, localized.\r\n   *\r\n   * Per-level rather than on the parent property because one LeafDetails\r\n   * property renders one tile per child level per projection — a single shared\r\n   * label would paint the same text on every one of them and leave the tiles\r\n   * indistinguishable. Same reasoning as `order` and `size`, which are already\r\n   * per-level. Empty → the child level's own name.\r\n   */\r\n  label?: EntitySectionLabel;\r\n}\r\n\r\n/**\r\n * Per-level display overrides for the *phase* projection of a LeafDetails\r\n * property — the sibling of {@link LeafLevelSavedConfig}. The two are kept\r\n * apart on purpose: one level can contribute a status item, a phase item, or\r\n * both, each with its own slot and width in the grid.\r\n *\r\n * Unlike `leafLevels`, an absent `leafPhases` map hides every phase item.\r\n * Phases are strictly opt-in so existing cards do not grow badges they were\r\n * never configured with.\r\n */\r\nexport interface LeafPhaseSavedConfig {\r\n  /** Position order for this level's phase entity in the preview grid */\r\n  order: number;\r\n  /** Column span (1-24), persisted from drag-resize */\r\n  size?: EntitySize;\r\n  /** Phase keys the user has chosen to display */\r\n  selectedPhases: string[];\r\n  /** Custom label for this phase tile, localized. See `LeafLevelSavedConfig.label`. */\r\n  label?: EntitySectionLabel;\r\n}\r\n\r\nexport interface EntityLeafDetailsConfig extends EntityBaseConfig {\r\n  /** Per-level display overrides for LeafDetails entities */\r\n  leafLevels?: Record<string, LeafLevelSavedConfig>;\r\n  /** Per-level phase-badge overrides for LeafDetails entities */\r\n  leafPhases?: Record<string, LeafPhaseSavedConfig>;\r\n}\r\n\r\n/**\r\n * Per-source-level display overrides for a Connection entity. Unlike\r\n * `LeafLevelSavedConfig` an absent entry does not hide the level — every source\r\n * level always renders as its own item and simply inherits the parent's\r\n * order/size until the user drags it.\r\n */\r\nexport interface ConnectionLevelSavedConfig {\r\n  /** Position order for this source-level item in the preview grid */\r\n  order?: number;\r\n  /** Column span (1-24), persisted from drag-resize */\r\n  size?: EntitySize;\r\n}\r\n\r\nexport interface EntityConnectionConfig extends EntityBaseConfig {\r\n  /** Per-source-level display overrides for Connection entities */\r\n  connectionLevels?: Record<string, ConnectionLevelSavedConfig>;\r\n}\r\n\r\n/**\r\n * One source level a Connection property can link to, as published on the\r\n * property catalog's `configuration.sourceLevels`. Its `name` supplies the\r\n * label of the split item that represents this level.\r\n */\r\nexport interface ConnectionSourceLevelConfig {\r\n  levelId: number;\r\n  levelKey?: string;\r\n  name?: EntitySectionLabel | string;\r\n  connectionId?: number;\r\n  [key: string]: unknown;\r\n}\r\n\r\n/** Catalog `configuration` shape of a `Connection` property. */\r\nexport interface ConnectionCatalogConfiguration {\r\n  sourceLevels?: ConnectionSourceLevelConfig[];\r\n  [key: string]: unknown;\r\n}\r\n\r\n/** One connected record inside a Connection value's `Sources` array. */\r\nexport interface EntityConnectionSourceValue {\r\n  sourceLevelId?: number;\r\n  SourceLevelId?: number;\r\n  sourceLevelDataId?: number;\r\n  SourceLevelDataId?: number;\r\n  display?: string;\r\n  Display?: string;\r\n  name?: string;\r\n  Name?: string;\r\n  [key: string]: unknown;\r\n}\r\n\r\n/** A localized label ({ en, ar }) — used by section headings and custom labels. */\r\nexport interface EntitySectionLabel {\r\n  en?: string;\r\n  ar?: string;\r\n}\r\n\r\n/** Configuration for a `Section` layout marker (`viewType: 'Section'`). */\r\nexport interface EntitySectionConfig extends EntityBaseConfig {\r\n  /** Section heading, localized. Empty/absent renders a header-less box. */\r\n  label?: EntitySectionLabel;\r\n}\r\n\r\nexport type EntityConfiguration =\r\n  | EntityBaseConfig\r\n  | EntityUserConfig\r\n  | EntityPercentageConfig\r\n  | EntityPerformanceScoreConfig\r\n  | EntityLeafDetailsConfig\r\n  | EntityConnectionConfig\r\n  | EntitySectionConfig;\r\n\r\n/** Value shape for a translatable Text/LongText property: `{ display, ar?, en? }`. */\r\nexport interface EntityTranslatableTextValue extends EntitySectionLabel {\r\n  display: string;\r\n}\r\n\r\nexport interface EntityStatusValue {\r\n  key: string;\r\n  display: string;\r\n  color: string;\r\n  description?: string;\r\n}\r\n\r\nexport interface EntityLookupValue {\r\n  key: string;\r\n  display: string;\r\n  color: string;\r\n  description?: string;\r\n}\r\n\r\nexport type EntityMultiLookupValue = EntityLookupValue[];\r\n\r\n/**\r\n * A `PhaseGate` value — the schema phase gate the record currently sits on.\r\n *\r\n * Calculated and read-only: the backend owns it, nothing in the runtime writes\r\n * it back. `key` is the stable phase-gate key; the schema phase-gate *id* rides\r\n * on the owning entity's `rawValue`, not here. `display` is resolved for the\r\n * request language, and `en`/`ar` carry the explicit per-language labels so the\r\n * renderer can follow a client-side language switch without a refetch.\r\n */\r\nexport interface EntityPhaseGateValue {\r\n  key: string;\r\n  display: string;\r\n  en?: string;\r\n  ar?: string;\r\n  description?: string;\r\n  /**\r\n   * Optional presentation metadata (hex). Absent → the renderer's\r\n   * `DEFAULT_PHASE_GATE_COLOR` neutral badge.\r\n   */\r\n  color?: string;\r\n}\r\n\r\n/**\r\n * One performance band of a `PerformanceScore` gauge — a status item with the\r\n * range of performance it covers. Bounds are percentages; a missing `from`\r\n * starts at the gauge minimum and a missing `to` runs to the gauge maximum.\r\n */\r\nexport interface EntityPerformanceScoreStatus {\r\n  key: string;\r\n  display: string;\r\n  color: string;\r\n  from?: number | null;\r\n  to?: number | null;\r\n}\r\n\r\n/**\r\n * A `PerformanceScore` value, calculated by the backend.\r\n *\r\n * - `performance` — the score, in percent. May exceed 100 or fall below 0; the\r\n *   gauge widens its scale to the outermost band, then clamps the marker.\r\n * - `status` — the band the score currently sits in. Absent → resolved here\r\n *   from `statuses` by range.\r\n * - `statuses` — every band, drawn as coloured arc segments. Absent/empty → a\r\n *   single arc painted in the status colour.\r\n */\r\nexport interface EntityPerformanceScoreValue {\r\n  performance: number | string | null;\r\n  status?: EntityPerformanceScoreStatus | null;\r\n  statuses?: EntityPerformanceScoreStatus[] | null;\r\n}\r\n\r\nexport interface EntityUserValue {\r\n  id?: string;\r\n  userName?: string;\r\n  name?: string;\r\n  displayName?: string;\r\n  photoUrl?: string;\r\n  phoneNumber?: string;\r\n  email?: string;\r\n  /**\r\n   * `false` when the user is no longer linked to the current application\r\n   * (e.g. removed/deleted) but is still referenced by historical records.\r\n   */\r\n  isLinkedToCurrentApplication?: boolean;\r\n}\r\n\r\nexport type EntityMultiUserValue = EntityUserValue[];\r\n\r\nexport interface LeafDetailsStatusSummary {\r\n  key: string;\r\n  display: string;\r\n  color: string | null;\r\n  /** Always 0 in preview/configuration context; populated from runtime fetch */\r\n  count: number;\r\n}\r\n\r\nexport interface LeafDetailsCatalogStatusValue {\r\n  key: string;\r\n  display: string;\r\n  description?: string | null;\r\n  color: string | null;\r\n  icon?: string | null;\r\n  order?: number;\r\n}\r\n\r\n/**\r\n * One phase bucket of a child level, as published on the catalog\r\n * `configuration` and counted at runtime. `id` is the schema phase-gate id and\r\n * is `null` on the backend's synthetic \"No current phase\" bucket — `key` is\r\n * what the saved configuration selects on, so it is the stable identifier here.\r\n */\r\nexport interface LeafDetailsCatalogPhaseValue {\r\n  id?: number | null;\r\n  key: string;\r\n  display: string;\r\n  color: string | null;\r\n  icon?: string | null;\r\n  order?: number;\r\n}\r\n\r\nexport interface LeafDetailsPhaseSummary {\r\n  id?: number | null;\r\n  key: string;\r\n  display: string;\r\n  color: string | null;\r\n  /** Always 0 in preview/configuration context; populated from runtime fetch */\r\n  count: number;\r\n}\r\n\r\nexport interface LeafDetailsCatalogLevelValue {\r\n  levelId: number;\r\n  levelName: string;\r\n  levelIcon: string;\r\n  statuses: LeafDetailsCatalogStatusValue[];\r\n  /** Absent for child levels the tenant has defined no phase gates on. */\r\n  phases?: LeafDetailsCatalogPhaseValue[] | null;\r\n}\r\n\r\n/** Which projection of a child level an expanded LeafDetails item renders. */\r\nexport type LeafDetailsBadgeKind = 'status' | 'phase';\r\n\r\nexport interface LeafDetailsEntityValue {\r\n  levelId: number;\r\n  levelName: string;\r\n  levelIcon: string;\r\n  statuses: LeafDetailsStatusSummary[];\r\n  phases?: LeafDetailsPhaseSummary[];\r\n  /**\r\n   * Set by `expandLeafDetailsEntity` on the split items. `'status'` (or absent,\r\n   * for values produced before phases existed) renders the status badges;\r\n   * `'phase'` renders the phase badges.\r\n   */\r\n  kind?: LeafDetailsBadgeKind;\r\n}\r\n\r\nexport type LeafDetailsEntityCollectionValue = LeafDetailsEntityValue[];\r\nexport type LeafDetailsCatalogConfiguration = LeafDetailsCatalogLevelValue[];\r\nexport type EntityPropertyConfiguration =\r\n  | Record<string, unknown>\r\n  | LeafDetailsCatalogConfiguration\r\n  | null;\r\n\r\nexport interface LeafDetailsRuntimeStatusDetails {\r\n  key: string;\r\n  display: string;\r\n  color: string | null;\r\n  description?: string | null;\r\n  icon?: string | null;\r\n  order?: number;\r\n}\r\n\r\nexport interface LeafDetailsRuntimeStatusCount {\r\n  details: LeafDetailsRuntimeStatusDetails;\r\n  count: number;\r\n}\r\n\r\nexport interface LeafDetailsRuntimePhaseDetails {\r\n  id?: number | null;\r\n  key: string;\r\n  display: string;\r\n  color: string | null;\r\n  icon?: string | null;\r\n  order?: number;\r\n}\r\n\r\nexport interface LeafDetailsRuntimePhaseCount {\r\n  details: LeafDetailsRuntimePhaseDetails;\r\n  count: number;\r\n}\r\n\r\nexport interface LeafDetailsRuntimeChildSchema {\r\n  levelId: number;\r\n  levelName: string;\r\n  levelIcon: string;\r\n  totalCount?: number;\r\n  statuses: LeafDetailsRuntimeStatusCount[];\r\n  /** Absent for child levels the tenant has defined no phase gates on. */\r\n  phases?: LeafDetailsRuntimePhaseCount[] | null;\r\n}\r\n\r\nexport interface LeafDetailsRuntimeValue {\r\n  totalCount?: number;\r\n  childSchemas: LeafDetailsRuntimeChildSchema[];\r\n}\r\n\r\nexport interface EntityAttachmentItemValue {\r\n  id?: string;\r\n  name?: string;\r\n  fileName?: string;\r\n  contentType?: string;\r\n  extension?: string;\r\n  size?: number;\r\n}\r\n\r\nexport type EntityAttachmentValue = Array<EntityAttachmentItemValue | string>;\r\n\r\nexport interface EntityLocationValue {\r\n  display_name?: string;\r\n  address?: string;\r\n  lat?: string | number;\r\n  lon?: string | number;\r\n  lng?: string | number;\r\n  [key: string]: unknown;\r\n}\r\n\r\nexport interface EntityConnectionValue {\r\n  /** Human-readable label of the connected record (read from `rawValue.display`). */\r\n  display?: string;\r\n  /** Per-source breakdown; the backend serializes it as `Sources`. */\r\n  sources?: EntityConnectionSourceValue[];\r\n  Sources?: EntityConnectionSourceValue[];\r\n  [key: string]: unknown;\r\n}\r\n\r\n/** A single property key/value captured for a checklist entry. */\r\nexport interface EntityLookupCheckListPropValue {\r\n  key: string;\r\n  /**\r\n   * Rendered value resolved by the backend, in the same shape a top-level\r\n   * property of the same `viewType` carries. Paired with the matching\r\n   * `EntityNestedPropertyMeta` to render it as a real typed entity.\r\n   */\r\n  value: unknown;\r\n}\r\n\r\n/** One checklist entry: a selected lookup item plus its captured property values. */\r\nexport interface EntityLookupCheckListItem {\r\n  lookupKey: string;\r\n  props: EntityLookupCheckListPropValue[];\r\n}\r\n\r\n/**\r\n * Rendered view model for a `LookupModuleCheckList` value.\r\n * The backend renderer wraps the checklist entries in `{ items: [...] }`.\r\n */\r\nexport interface EntityLookupCheckListValue {\r\n  items: EntityLookupCheckListItem[];\r\n}\r\n\r\nexport interface EntityScheduleItemValue {\r\n  id: number;\r\n  name: string;\r\n  levelDataId?: number;\r\n  parentId?: number | null;\r\n  status?: string | null;\r\n  plannedStart?: string | null;\r\n  plannedFinish?: string | null;\r\n  moduleKey?: string;\r\n  itemType?: string;\r\n}\r\n\r\n/** One cell of an `EntityList` row. Values are always sent as strings. */\r\nexport interface EntityListValueItem {\r\n  propertyKey: string;\r\n  rawValue?: string | null;\r\n}\r\n\r\n/** One row of an `EntityList` value. */\r\nexport interface EntityListRowValue {\r\n  rowId?: string;\r\n  entityId?: number;\r\n  values?: EntityListValueItem[];\r\n}\r\n\r\n/**\r\n * The stored `EntityList` payload, as the backend renders it. `rows` is the\r\n * only part this view type displays — `entityIds` and the operation-marker\r\n * arrays exist for the writable runtime, not for reading.\r\n */\r\nexport interface EntityListEntityValue {\r\n  entityIds?: number[];\r\n  rows?: EntityListRowValue[];\r\n}\r\n\r\n/** A `{ en, ar }` pair, as the backend's `Translatable` serializes. */\r\nexport interface EntityListTranslatable {\r\n  en?: string | null;\r\n  ar?: string | null;\r\n}\r\n\r\n/**\r\n * The source property definition a Local list captured when its schema was\r\n * published (`PropertyDefinitionReadDto`). Server-owned and response-only: the\r\n * backend never trusts one sent back, and pins it so saved values stay\r\n * readable after the source field or module changes or is deleted.\r\n */\r\nexport interface EntityListLocalFieldDefinition {\r\n  key: string;\r\n  name?: string | null;\r\n  nameEn?: string | null;\r\n  nameAr?: string | null;\r\n  viewType: string;\r\n  isRequired?: boolean;\r\n  isTranslatable?: boolean;\r\n  configuration?: Record<string, unknown> | string | null;\r\n}\r\n\r\n/** A field's share of a row, as the form builder sizes it: ¼, ½ or full. */\r\nexport type EntityListLocalFieldWidth = '25' | '50' | '100';\r\n\r\n/**\r\n * One field of a Local list's schema. `id` is the stable local identity cells\r\n * are keyed by — a UUID, not the source property id. `label` is an optional\r\n * local override of the source label, and `required` is local to the list.\r\n */\r\nexport interface EntityListLocalSchemaField {\r\n  id?: string;\r\n  sourceKey: string;\r\n  label?: EntityListTranslatable | null;\r\n  required?: boolean;\r\n  hidden?: boolean;\r\n  order?: number;\r\n  /**\r\n   * The field's size in the row dialog. Sent by the configuration screen but\r\n   * **not yet stored by the backend** (`LocalEntityListField` has no such\r\n   * member), so it is absent from what comes back and the dialog falls back\r\n   * to its default until the backend adds it.\r\n   */\r\n  width?: EntityListLocalFieldWidth | null;\r\n  definition?: EntityListLocalFieldDefinition | null;\r\n}\r\n\r\n/**\r\n * A published Local schema. `version` is a UUID that changes whenever the\r\n * field set does; every mutation names the version it was built against.\r\n */\r\nexport interface EntityListLocalSchema {\r\n  lineageId?: string;\r\n  version?: string;\r\n  fields: EntityListLocalSchemaField[];\r\n}\r\n\r\n/** One cell of a Local row. `value` is the rendered counterpart, read-only. */\r\nexport interface EntityListLocalCell {\r\n  fieldId: string;\r\n  rawValue: string | null;\r\n  value?: unknown;\r\n}\r\n\r\n/** One Local row. `rowId` is a client-generated UUID, not a record id. */\r\nexport interface EntityListLocalRow {\r\n  rowId: string;\r\n  order: number;\r\n  version: number;\r\n  cells: EntityListLocalCell[];\r\n}\r\n\r\n/**\r\n * A Local `EntityList` value (`storageMode: \"Local\"`): rows owned by the parent\r\n * record, stored inside it rather than as records of the source module.\r\n *\r\n * Arrives from `process-form-load` as the *projected* document — current\r\n * versions, rendered cells, and `schema` with hidden fields already removed —\r\n * and leaves as a *mutation* carrying only what changed, a fresh `mutationId`,\r\n * and no `schema`. See `.github/instructions/properties/EntityList.md`.\r\n */\r\nexport interface EntityListLocalDocument {\r\n  storageMode: 'Local';\r\n  formatVersion: number;\r\n  schemaVersion: string;\r\n  version: number;\r\n  mutationId?: string;\r\n  localRows: EntityListLocalRow[];\r\n  deletedRowIds?: string[];\r\n  /** Response-only: the schema the rows were projected against. */\r\n  schema?: EntityListLocalSchema | null;\r\n}\r\n\r\n/** Whether a stored or rendered `EntityList` value is a Local document. */\r\nexport function isEntityListLocalDocument(\r\n  value: unknown,\r\n): value is EntityListLocalDocument {\r\n  return (\r\n    !!value &&\r\n    typeof value === 'object' &&\r\n    !Array.isArray(value) &&\r\n    (value as { storageMode?: unknown }).storageMode === 'Local'\r\n  );\r\n}\r\n\r\n/** One source value of a selected record: stored scalar plus rendered value. */\r\nexport interface EntityListSelectionRecordValue {\r\n  propertyKey: string;\r\n  rawValue?: string | null;\r\n  value?: unknown;\r\n}\r\n\r\n/** A selected source record, with the configured read fields' values. */\r\nexport interface EntityListSelectionRecord {\r\n  entityId: number;\r\n  values: EntityListSelectionRecordValue[];\r\n}\r\n\r\n/**\r\n * A Selected `EntityList` value (`recordMode: \"Selected\"`): the source records\r\n * the user picked, by id. Selecting never creates, edits or deletes a source\r\n * record.\r\n *\r\n * Arrives from `process-form-load` as the projected document — `records`\r\n * rendered for display, `unavailableIds` for chosen records the user can no\r\n * longer see — and leaves as a *mutation* carrying only `recordMode`,\r\n * `version`, `mutationId` and the full replacement `entityIds`. See\r\n * `.github/instructions/properties/EntityList.md`.\r\n */\r\nexport interface EntityListSelectionDocument {\r\n  recordMode: 'Selected';\r\n  version: number;\r\n  mutationId?: string;\r\n  entityIds: number[];\r\n  /** Response-only: the selected records, rendered for display. */\r\n  records?: EntityListSelectionRecord[];\r\n  /** Response-only: server-captured values; never replayed as a write. */\r\n  snapshot?: unknown;\r\n  /** Response-only: chosen ids whose record is deleted or no longer visible. */\r\n  unavailableIds?: number[];\r\n  /**\r\n   * Response-only: the last saved values of chosen records the backend\r\n   * confirmed as deleted. Historical, never current; an id in\r\n   * `unavailableIds` without an entry here may still exist but be hidden.\r\n   */\r\n  unavailableRecords?: EntityListSelectionRecord[];\r\n}\r\n\r\n/** Whether a stored or rendered `EntityList` value is a Selected document. */\r\nexport function isEntityListSelectionDocument(\r\n  value: unknown,\r\n): value is EntityListSelectionDocument {\r\n  return (\r\n    !!value &&\r\n    typeof value === 'object' &&\r\n    !Array.isArray(value) &&\r\n    (value as { recordMode?: unknown }).recordMode === 'Selected'\r\n  );\r\n}\r\n\r\n/**\r\n * One field definition of an inline `EntityList`, from its property\r\n * configuration's `inlineFields`. This is the only description of the nested\r\n * columns: the value itself carries bare keys.\r\n */\r\nexport interface EntityListInlineFieldMeta {\r\n  key: string;\r\n  viewType?: string;\r\n  order?: number;\r\n  required?: boolean;\r\n  configuration?: EntityPropertyConfiguration;\r\n}\r\n\r\n/**\r\n * Catalog metadata for a property nested inside another property's value.\r\n * Mirrors the top-level catalog property shape, which the backend sends under\r\n * `catalog.nestedProperties` keyed by the owning property key. Only\r\n * `LookupModuleCheckList` values carry nested properties today.\r\n */\r\nexport interface EntityNestedPropertyMeta {\r\n  id?: number;\r\n  key: string;\r\n  normalizedKey?: string;\r\n  label: string;\r\n  viewType: EntityViewType;\r\n  configuration?: EntityPropertyConfiguration;\r\n  order?: number;\r\n}\r\n\r\nexport interface EntityData {\r\n  id?: number;\r\n  propertyId?: number;\r\n  key?: string;\r\n  normalizedKey?: string;\r\n  name?: string;\r\n  rawValue?: string;\r\n  /**\r\n   * The colour the backend resolved for *this value*, from the value cell's own\r\n   * `color` field.\r\n   *\r\n   * Distinct from `configuration.color`, which is a colour the configuration\r\n   * declares for every value alike. This one is per-record: the backend\r\n   * evaluates a Percentage property's colour rules — or, in `property` mode,\r\n   * the record's colour-bearing source property — and ships the winner here.\r\n   * It is therefore the most specific answer available and outranks anything\r\n   * derived from the configuration.\r\n   *\r\n   * Status and Lookup cells repeat the same colour inside `value`, which is\r\n   * where those renderers already read it; a Percentage's `value` is a\r\n   * formatted string with nowhere to hang a colour, which is why this exists.\r\n   */\r\n  color?: string;\r\n  order?: number;\r\n  /**\r\n   * Marks a value the backend calculates: `mt-entity-preview` shows the\r\n   * calculated-value icon beside its label. Set by the host that maps the\r\n   * catalog, so a surface that does not set it renders exactly as before.\r\n   */\r\n  calculated?: boolean;\r\n  /** Set while the value is being recalculated: the icon pulses. */\r\n  calculationStatus?: EntityCalculationStatus | null;\r\n  /** The last change to this calculated value since the record was opened. */\r\n  calculationChange?: EntityCalculationChange | null;\r\n  /**\r\n   * The record a calculated value was read from. When set, clicking the\r\n   * calculated-value icon shows how the saved value was calculated.\r\n   */\r\n  calculationSource?: EntityCalculationSource | null;\r\n  propertyConfiguration?: EntityPropertyConfiguration;\r\n  /**\r\n   * Catalog metadata for the properties captured inside `value`. The stored\r\n   * checklist value only carries property keys, so without this the nested\r\n   * props have no label and no view type to render with.\r\n   */\r\n  nestedProperties?: EntityNestedPropertyMeta[];\r\n  value:\r\n    | string\r\n    | EntityTranslatableTextValue\r\n    | EntityStatusValue\r\n    | EntityUserValue\r\n    | EntityMultiUserValue\r\n    | EntityLookupValue\r\n    | EntityMultiLookupValue\r\n    | EntityPhaseGateValue\r\n    | EntityPerformanceScoreValue\r\n    | EntityAttachmentValue\r\n    | EntityLocationValue\r\n    | EntityConnectionValue\r\n    | EntityScheduleItemValue[]\r\n    | EntityLookupCheckListValue\r\n    | EntityLookupCheckListItem[]\r\n    | LeafDetailsEntityValue\r\n    | LeafDetailsEntityCollectionValue\r\n    | LeafDetailsRuntimeValue\r\n    | EntityListEntityValue;\r\n  viewType: EntityViewType;\r\n  type?: string;\r\n  configuration?: EntityConfiguration;\r\n  /** Present on submitted ChangeRequest records — frozen old→new snapshot. */\r\n  comparison?: PropertyValueComparison;\r\n  /**\r\n   * The record's runtime ids, set by a host that renders the value outside\r\n   * any `EntityRuntimeContextStore` — a table cell. `EntityList` reads it to\r\n   * render its full list in the drawer, as a record preview does inline.\r\n   */\r\n  runtimeContext?: EntityRuntimeContext | null;\r\n}\r\n\r\n/** Emitted when an entity is resized via the drag handle */\r\nexport interface EntityResizeEvent {\r\n  entity: EntityData;\r\n  previousSize: EntitySize;\r\n  newSize: EntitySize;\r\n}\r\n","import type {\n  EntityData,\n  EntitySectionConfig,\n  EntitySectionLabel,\n} from './entity.model';\n\n/**\n * A section is persisted/transported as an ordinary display item whose\n * `propertyKey` carries this sentinel prefix instead of a real property key\n * (mirrors the LeafDetails synthetic-key convention). Both the customization\n * builder and the runtime renderer recognize it, so the constant lives here in\n * the shared entities layer rather than in either consumer.\n */\nexport const SECTION_KEY_PREFIX = '__section__::';\n\n/** True when a display item's key denotes a section marker. */\nexport function isSectionKey(key?: string | null): boolean {\n  return typeof key === 'string' && key.startsWith(SECTION_KEY_PREFIX);\n}\n\n/** Mints a unique section marker key. */\nexport function buildSectionKey(): string {\n  return `${SECTION_KEY_PREFIX}${crypto.randomUUID()}`;\n}\n\n/**\n * Resolves a localized label (`{ en, ar }`) for the given language, falling\n * back across locales. Returns '' when nothing is set.\n */\nexport function resolveLocalizedLabel(\n  label: EntitySectionLabel | null | undefined,\n  lang?: string,\n): string {\n  if (!label) return '';\n  const primary = lang === 'ar' ? label.ar : label.en;\n  return (primary || label.en || label.ar || '').trim();\n}\n\n/**\n * A run of entities that belong to the same section. `section` is the marker\n * entity (`viewType: 'Section'`) whose title heads the group, or `null` for the\n * leading run of entities that appear before the first marker (rendered bare,\n * with no box — so a card with no markers looks exactly like it did before\n * sections existed).\n */\nexport interface EntitySectionGroup {\n  section: EntityData | null;\n  entities: EntityData[];\n}\n\n/** True when the entity is a `Section` layout marker rather than a value. */\nexport function isEntitySection(\n  entity: EntityData | null | undefined,\n): entity is EntityData {\n  return entity?.viewType === 'Section';\n}\n\n/**\n * Splits a flat, order-sorted entity list into section groups. Membership is\n * purely positional: each entity belongs to whichever `Section` marker precedes\n * it. Pass the output of `buildDisplayEntities` (already sorted by `order`).\n *\n * Zero markers → a single `{ section: null }` group holding everything, so the\n * bare-grid rendering is unchanged. Empty leading/trailing runs are dropped.\n */\nexport function groupEntitiesIntoSections(\n  entities: EntityData[],\n): EntitySectionGroup[] {\n  const groups: EntitySectionGroup[] = [];\n  let current: EntitySectionGroup = { section: null, entities: [] };\n\n  const flush = (): void => {\n    if (current.section || current.entities.length > 0) {\n      groups.push(current);\n    }\n  };\n\n  for (const entity of entities) {\n    if (isEntitySection(entity)) {\n      flush();\n      current = { section: entity, entities: [] };\n    } else {\n      current.entities.push(entity);\n    }\n  }\n  flush();\n\n  return groups;\n}\n\n/**\n * Resolves a section marker's display label for the given language, falling\n * back across locales and finally to the entity's `name`.\n */\nexport function getEntitySectionTitle(\n  section: EntityData | null | undefined,\n  lang?: string,\n): string {\n  if (!section) return '';\n  const label = (section.configuration as EntitySectionConfig | undefined)\n    ?.label;\n  return resolveLocalizedLabel(label, lang) || (section.name ?? '');\n}\n","import {\r\n  EntityConfiguration,\r\n  EntityLabelPosition,\r\n  EntitySectionLabel,\r\n} from './entity.model';\r\nimport { resolveLocalizedLabel } from './entity-sections.util';\r\n\r\nexport const ENTITY_EMPTY_VALUE_PLACEHOLDER = '_';\r\n\r\n/**\r\n * The `grid-row` value for an entity's `configuration.rowSpan`, or `null` for\r\n * the default single row so the grid's normal auto-placement is untouched.\r\n */\r\nexport function resolveEntityGridRow(\r\n  configuration: EntityConfiguration | undefined,\r\n): string | null {\r\n  const rowSpan = configuration?.rowSpan ?? 1;\r\n  return rowSpan > 1 ? `span ${rowSpan}` : null;\r\n}\r\n\r\nexport function isValueMissing(value: unknown): boolean {\r\n  if (value === null || value === undefined) {\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  return false;\r\n}\r\n\r\n/**\r\n * Serializes a backend `raw` cell into the string `EntityData.rawValue` holds.\r\n *\r\n * Object raws — the Connection payload, the LeafDetails summary — must be\r\n * JSON-encoded: `String(obj)` yields \"[object Object]\" and silently destroys\r\n * the payload the display layer needs to expand them. Primitives keep plain\r\n * `String()` so dates/percentages/checkboxes are not wrapped in quotes.\r\n */\r\nexport function serializeEntityRawValue(raw: unknown): string | undefined {\r\n  if (raw === null || raw === undefined) {\r\n    return undefined;\r\n  }\r\n\r\n  if (typeof raw === 'object') {\r\n    try {\r\n      return JSON.stringify(raw);\r\n    } catch {\r\n      return undefined;\r\n    }\r\n  }\r\n\r\n  return String(raw);\r\n}\r\n\r\n/**\r\n * Reads the colour the backend resolved for a value cell.\r\n *\r\n * The cell carries it as a sibling of `raw`/`value` — `{ raw: \"22\", value:\r\n * \"22%\", color: \"#FF0000\" }` — because for a Percentage the value is a\r\n * formatted string with nowhere to hang a colour on. Status and Lookup cells\r\n * repeat it inside `value`, where those renderers already read it.\r\n *\r\n * Typed as `unknown` on purpose: every fetch-cell interface in the consuming\r\n * packages carries an index signature, so a mistyped or absent `color` is a\r\n * runtime possibility rather than a compile error.\r\n */\r\nexport function readEntityValueColor(color: unknown): string | undefined {\r\n  if (typeof color !== 'string') {\r\n    return undefined;\r\n  }\r\n\r\n  const trimmed = color.trim();\r\n  return trimmed || undefined;\r\n}\r\n\r\nexport function displayOrPlaceholder(value: unknown): string {\r\n  if (isValueMissing(value)) {\r\n    return ENTITY_EMPTY_VALUE_PLACEHOLDER;\r\n  }\r\n\r\n  return String(value);\r\n}\r\n\r\n/**\r\n * Text/LongText values are a plain string, except for translatable\r\n * properties, where the backend sends `{ display, ar?, en? }` instead.\r\n * Unwraps either shape to the string to render.\r\n */\r\nexport function extractDisplayText(value: unknown): string | null {\r\n  if (typeof value === 'string') {\r\n    return value;\r\n  }\r\n\r\n  if (\r\n    value &&\r\n    typeof value === 'object' &&\r\n    typeof (value as { display?: unknown }).display === 'string'\r\n  ) {\r\n    return (value as { display: string }).display;\r\n  }\r\n\r\n  return null;\r\n}\r\n\r\nexport function isEntityLabelHidden(\r\n  configuration?: EntityConfiguration | null,\r\n): boolean {\r\n  const config = configuration as\r\n    | {\r\n        hideLabel?: boolean;\r\n        hideName?: boolean;\r\n      }\r\n    | null\r\n    | undefined;\r\n\r\n  return config?.hideLabel ?? config?.hideName ?? false;\r\n}\r\n\r\nexport function isEntityAlignEnd(\r\n  configuration?: EntityConfiguration | null,\r\n): boolean {\r\n  const config = configuration as { alignEnd?: boolean } | null | undefined;\r\n  return config?.alignEnd ?? false;\r\n}\r\n\r\n/**\r\n * The admin-authored note attached to a property in the customization drawer\r\n * (`configuration.info`), resolved for the active language.\r\n *\r\n * Returns `''` when there is no note, which is what the renderer keys off to\r\n * decide whether the entity gets an info affordance at all. The drawer omits\r\n * the key entirely rather than writing an empty object, so \"absent\" and \"blank\"\r\n * collapse to the same answer here on purpose.\r\n */\r\nexport function resolveEntityInfo(\r\n  configuration?: EntityConfiguration | null,\r\n  lang?: string,\r\n): string {\r\n  const config = configuration as\r\n    | { info?: EntitySectionLabel }\r\n    | null\r\n    | undefined;\r\n\r\n  return resolveLocalizedLabel(config?.info, lang);\r\n}\r\n\r\n/**\r\n * The product default: label above value.\r\n *\r\n * It used to be `bottom`, which is why Portfolio and Program cards rendered\r\n * \"06/07/2026\" then \"Start Date\" while Project cards — whose properties had\r\n * been through the property-configuration drawer, and so carry an explicit\r\n * `labelPosition` — rendered the label first. Two orders inside one Explore\r\n * module, reachable by clicking a different item in the same sidebar\r\n * (finding M-13). Label-first reads better down a column of mixed field types,\r\n * so it is what every unconfigured property now gets.\r\n *\r\n * An explicit configuration still wins: an administrator who deliberately\r\n * chose value-above-label for a property keeps it.\r\n */\r\nexport function resolveEntityLabelPosition(\r\n  configuration?: EntityConfiguration | null,\r\n): EntityLabelPosition {\r\n  const config = configuration as\r\n    | {\r\n        labelPosition?: EntityLabelPosition;\r\n        labelPostion?: EntityLabelPosition;\r\n      }\r\n    | null\r\n    | undefined;\r\n\r\n  return config?.labelPosition ?? config?.labelPostion ?? 'top';\r\n}\r\n\r\n/**\r\n * Rewrites a localised numeric string into something `parseFloat` can read.\r\n *\r\n * `rawNumericValue` can fall back to the already-formatted display string, so\r\n * whatever `Intl.NumberFormat` produced has to survive a round trip. Under\r\n * `ar` that is harmless (Latin digits plus invisible direction marks), but\r\n * `ar-SA` renders Arabic-Indic digits and an Arabic decimal separator, which\r\n * parse to NaN — the bar would silently disappear rather than show a value.\r\n *\r\n * Handles Arabic-Indic (U+0660-0669) and Eastern Arabic-Indic (U+06F0-06F9)\r\n * digits, the Arabic decimal separator, thousands separators, and the\r\n * bidirectional marks Intl inserts around the percent sign.\r\n */\r\nexport function normalizeNumerals(input: string): string {\r\n  return input\r\n    .replace(/[‎‏؜]/g, '')\r\n    .replace(/[٠-٩]/g, (d) => String(d.charCodeAt(0) - 0x0660))\r\n    .replace(/[۰-۹]/g, (d) => String(d.charCodeAt(0) - 0x06f0))\r\n    .replace(/[٫]/g, '.')\r\n    .replace(/[٬  ]/g, '');\r\n}\r\n","import type { EntityData, EntityUserValue } from './entity.model';\r\n\r\ninterface StakeholderNameColumn {\r\n  key: string;\r\n  normalizedKey?: string;\r\n}\r\n\r\nconst INTERNAL_NAME_KEY = 'internal_username';\r\nconst EXTERNAL_NAME_KEY = 'external_username';\r\n\r\nfunction matchesKey(\r\n  field: { key?: string; normalizedKey?: string },\r\n  key: string,\r\n): boolean {\r\n  return field.normalizedKey === key || field.key === key;\r\n}\r\n\r\n/** Keep the name slot's identity/layout, and use the populated name's renderer. */\r\nfunction projectName(internal: EntityData, external: EntityData): EntityData {\r\n  const isEmptyUser =\r\n    internal.viewType === 'User' &&\r\n    internal.value != null &&\r\n    typeof internal.value === 'object' &&\r\n    !(internal.value as EntityUserValue).userName?.trim();\r\n  if (internal.value != null && internal.value !== '' && !isEmptyUser) {\r\n    return internal;\r\n  }\r\n  if (external.value == null || external.value === '') return internal;\r\n  return {\r\n    ...internal,\r\n    rawValue: external.rawValue,\r\n    value: external.value,\r\n    viewType: external.viewType,\r\n    type: external.type,\r\n    propertyConfiguration: external.propertyConfiguration,\r\n    nestedProperties: external.nestedProperties,\r\n    comparison: external.comparison,\r\n    color: external.color,\r\n  };\r\n}\r\n\r\n/** Stakeholder cards show the two mutually exclusive names in one name slot. */\r\nexport function mergeStakeholderNameEntities(\r\n  entities: EntityData[],\r\n): EntityData[] {\r\n  const internal = entities.find((entity) =>\r\n    matchesKey(entity, INTERNAL_NAME_KEY),\r\n  );\r\n  const external = entities.find((entity) =>\r\n    matchesKey(entity, EXTERNAL_NAME_KEY),\r\n  );\r\n  if (!internal || !external) return entities;\r\n\r\n  const name = projectName(internal, external);\r\n  return entities.flatMap((entity) =>\r\n    entity === external ? [] : [entity === internal ? name : entity],\r\n  );\r\n}\r\n\r\n/** Hide the duplicate only when both stakeholder name fields are displayed. */\r\nexport function mergeStakeholderNameColumns<T extends StakeholderNameColumn>(\r\n  columns: T[],\r\n): T[] {\r\n  if (!columns.some((column) => matchesKey(column, INTERNAL_NAME_KEY))) {\r\n    return columns;\r\n  }\r\n  if (!columns.some((column) => matchesKey(column, EXTERNAL_NAME_KEY))) {\r\n    return columns;\r\n  }\r\n  return columns.filter((column) => !matchesKey(column, EXTERNAL_NAME_KEY));\r\n}\r\n\r\n/** Presentation only: retain the original cells and row edit/submission maps. */\r\nexport function mergeStakeholderNameRows<T extends Record<string, unknown>>(\r\n  columns: StakeholderNameColumn[],\r\n  rows: T[],\r\n): T[] {\r\n  const internal = columns.find((column) =>\r\n    matchesKey(column, INTERNAL_NAME_KEY),\r\n  );\r\n  const external = columns.find((column) =>\r\n    matchesKey(column, EXTERNAL_NAME_KEY),\r\n  );\r\n  if (!internal || !external) return rows;\r\n\r\n  return rows.map((row) => {\r\n    const internalCell = row[internal.key] as EntityData | undefined;\r\n    const externalCell = row[external.key] as EntityData | undefined;\r\n    if (!internalCell || !externalCell) return row;\r\n    const name = projectName(internalCell, externalCell);\r\n    return name === internalCell ? row : { ...row, [internal.key]: name };\r\n  });\r\n}\r\n","import { Injectable, InjectionToken, Type, signal } from '@angular/core';\r\n\r\n/**\r\n * The runtime ids an entity renderer needs to fetch anything of its own.\r\n *\r\n * A rendered `EntityData` describes one *value*; it carries no idea of which\r\n * level or level-data row it was read from. Most view types never need one —\r\n * the value is the whole answer. `EntityList` is the exception: a module-backed\r\n * list's rows live in another module and are scoped by the owning level-data\r\n * row, so the renderer cannot resolve them from the value alone.\r\n *\r\n * Hosts that know these ids publish them through `EntityRuntimeContextStore`;\r\n * hosts that do not simply leave it unprovided and every renderer keeps its\r\n * value-only behaviour.\r\n */\r\nexport interface EntityRuntimeContext {\r\n  /** Owning level id — addresses the per-level configuration override. */\r\n  levelId?: number | string | null;\r\n  /** Owning level-data row — what related records are scoped to. */\r\n  levelDataId?: number | string | null;\r\n  /**\r\n   * The record that owns the list, for the reads addressed to it rather than\r\n   * to its level — the saved list's `entity-lists/comparison`. Set by a host\r\n   * that knows the row it renders (a table cell); a record preview leaves it.\r\n   */\r\n  ownerKind?: 'ModuleData' | 'LevelData' | null;\r\n  ownerId?: number | null;\r\n}\r\n\r\n/**\r\n * Publishes an `EntityRuntimeContext` to a subtree of entity renderers.\r\n *\r\n * Deliberately **not** `providedIn: 'root'`: an unprovided store is the signal\r\n * that the host has no runtime context, and every consumer injects it\r\n * `{ optional: true }`. Providing it on a component scopes it to that\r\n * component's view — which is also how a nested renderer shuts the context\r\n * off for its own children (see `EntityListField`, whose table cells must not\r\n * re-enter the fetching path).\r\n */\r\n@Injectable()\r\nexport class EntityRuntimeContextStore {\r\n  readonly context = signal<EntityRuntimeContext | null>(null);\r\n}\r\n\r\n/**\r\n * The component `mt-entity-list-preview` renders inline instead of its\r\n * count-and-drawer trigger, when a runtime context is available.\r\n *\r\n * Indirection rather than a direct import because the real renderer is\r\n * `mt-entity-list-field` (`@masterteam/components/business-fields`), which\r\n * builds on `mt-table` — and `table` already imports `entities`, so importing\r\n * it back here would make the two entry points circular. The provider lives\r\n * with the component: `provideEntityListTablePreview()`.\r\n *\r\n * The component is created with `NgComponentOutlet` and receives\r\n * `propertyId`, `runtimeContext`, `configuration`, `initialValue`, `readonly`\r\n * and `label` as inputs.\r\n */\r\nexport const ENTITY_LIST_TABLE_COMPONENT = new InjectionToken<Type<unknown>>(\r\n  'ENTITY_LIST_TABLE_COMPONENT',\r\n);\r\n","import { HttpClient, HttpHeaders } from '@angular/common/http';\r\nimport { Injectable, inject } from '@angular/core';\r\nimport { Observable, catchError, forkJoin, map, of, switchMap } from 'rxjs';\r\nimport type { EntityData } from '../entity.model';\r\nimport type {\r\n  CalculationExplanationResponse,\r\n  CalculationRecordRef,\r\n  EntityCalculationExplanationTarget,\r\n  EntityCalculationSource,\r\n} from './calculation-explanation.model';\r\n\r\n/**\r\n * Records named one by one when the owner's list did not have them: as many\r\n * as a summarized rollup lists, whose items can sit past the list's first\r\n * page in a schedule of up to 2,000.\r\n */\r\nconst SINGLE_READS = 25;\r\n/** A missing name only costs a label: never a toast. */\r\nconst SILENT = new HttpHeaders({ noMessage: 'true' });\r\n\r\ninterface FetchRecord {\r\n  id: number;\r\n  name: string | null;\r\n}\r\n\r\n/**\r\n * Reads the latest saved calculation of a value. The request never\r\n * recalculates anything; the response is marked `no-store`, so every open\r\n * asks again.\r\n */\r\n@Injectable({ providedIn: 'root' })\r\nexport class CalculationExplanationApi {\r\n  private readonly http = inject(HttpClient);\r\n\r\n  read(\r\n    source: EntityCalculationSource,\r\n    propertyKey: string,\r\n  ): Observable<CalculationExplanationResponse> {\r\n    return this.http.get<CalculationExplanationResponse>(\r\n      'properties/calculation-explanation',\r\n      {\r\n        params: {\r\n          contextKey: toCalculationContextKey(source.contextKey) ?? '',\r\n          recordId: source.recordId,\r\n          propertyKey,\r\n        },\r\n      },\r\n    );\r\n  }\r\n}\r\n\r\n/**\r\n * Names the records a calculation read (schedule items, financial rows) through\r\n * the normal runtime record reads, so a contributor reads as its title rather\r\n * than its id. Only names are taken; the numbers stay the captured ones.\r\n */\r\n@Injectable({ providedIn: 'root' })\r\nexport class CalculationRecordNames {\r\n  private readonly http = inject(HttpClient);\r\n\r\n  /**\r\n   * Names by {@link calculationRecordKey}. A record the reader may not see, or\r\n   * any failed read, is simply absent.\r\n   */\r\n  read(\r\n    owner: EntityCalculationSource,\r\n    refs: CalculationRecordRef[],\r\n  ): Observable<Record<string, string>> {\r\n    const byContext = new Map<string, Set<number>>();\r\n    for (const ref of refs) {\r\n      const context = toFetchContextKey(ref.contextKey);\r\n      if (!context || !(ref.recordId > 0)) continue;\r\n      const ids = byContext.get(context) ?? new Set<number>();\r\n      ids.add(ref.recordId);\r\n      byContext.set(context, ids);\r\n    }\r\n    if (!byContext.size) {\r\n      return of({});\r\n    }\r\n    // A level record's own rows (its schedule, its financial lines) are read\r\n    // in one list; a module record's are read one by one.\r\n    const ownerLevelData = /^level:\\d+$/i.test(owner.contextKey.trim())\r\n      ? owner.recordId\r\n      : null;\r\n    return forkJoin(\r\n      [...byContext].map(([context, ids]) =>\r\n        this.readContext(context, [...ids], ownerLevelData),\r\n      ),\r\n    ).pipe(map((parts) => Object.assign({}, ...parts)));\r\n  }\r\n\r\n  private readContext(\r\n    context: string,\r\n    ids: number[],\r\n    ownerLevelData: number | null,\r\n  ): Observable<Record<string, string>> {\r\n    const query = (propertyKeys: string[]) =>\r\n      this.http\r\n        .post<{ data?: { records?: FetchRecord[] } }>(\r\n          'fetch/query',\r\n          {\r\n            contextKey: context,\r\n            projection: 'Flat',\r\n            propertyKeys,\r\n            filters: [\r\n              {\r\n                key: 'levelDataId',\r\n                operator: 'Equals',\r\n                value: String(ownerLevelData),\r\n              },\r\n            ],\r\n            page: 1,\r\n            pageSize: 500,\r\n          },\r\n          { headers: SILENT },\r\n        )\r\n        .pipe(map((response) => response?.data?.records ?? []));\r\n    const listed: Observable<FetchRecord[]> =\r\n      ownerLevelData === null\r\n        ? of([])\r\n        : // Only the name column: every column is ~30x the payload. A module\r\n          // without a `name` property (Financial) rejects the key; its\r\n          // records still carry a name when no column is named.\r\n          query(['name']).pipe(\r\n            catchError(() => query([])),\r\n            catchError(() => of([])),\r\n          );\r\n    return listed.pipe(\r\n      switchMap((records) => {\r\n        const names: Record<string, string> = {};\r\n        for (const record of records) {\r\n          if (ids.includes(record.id) && record.name?.trim()) {\r\n            names[calculationRecordKey(context, record.id)] = record.name;\r\n          }\r\n        }\r\n        const missing = ids\r\n          .filter((id) => !names[calculationRecordKey(context, id)])\r\n          .slice(0, SINGLE_READS);\r\n        if (!missing.length) {\r\n          return of(names);\r\n        }\r\n        return forkJoin(\r\n          missing.map((id) =>\r\n            this.http\r\n              .get<{ data?: { record?: FetchRecord } }>(`fetch/records/${id}`, {\r\n                params: { contextKey: context, projection: 'Flat' },\r\n                headers: SILENT,\r\n              })\r\n              .pipe(\r\n                map((response) => response?.data?.record ?? null),\r\n                catchError(() => of(null)),\r\n              ),\r\n          ),\r\n        ).pipe(\r\n          map((single) => {\r\n            for (const record of single) {\r\n              if (record?.name?.trim()) {\r\n                names[calculationRecordKey(context, record.id)] = record.name;\r\n              }\r\n            }\r\n            return names;\r\n          }),\r\n        );\r\n      }),\r\n    );\r\n  }\r\n}\r\n\r\n/** `Level:1/Module:4` → `level:1/module:4`, the casing record reads use. */\r\nexport function toFetchContextKey(contextKey: string | null): string | null {\r\n  const key = toCalculationContextKey(contextKey ?? '');\r\n  return key ? key.toLowerCase() : null;\r\n}\r\n\r\n/** The key a record's name is stored under. */\r\nexport function calculationRecordKey(\r\n  contextKey: string | null,\r\n  recordId: number,\r\n): string {\r\n  return `${toFetchContextKey(contextKey) ?? ''}#${recordId}`;\r\n}\r\n\r\n/**\r\n * The context key in the casing the endpoint accepts. Fetch contexts are\r\n * written `level:12/module:5`, but this endpoint validates `Level:12/Module:5`\r\n * case-sensitively and answers anything else with a 400. Null for a context it\r\n * does not explain.\r\n */\r\nexport function toCalculationContextKey(contextKey: string): string | null {\r\n  const key = contextKey.trim();\r\n  const level = /^level:([1-9]\\d*)(?:\\/module:([1-9]\\d*))?$/i.exec(key);\r\n  if (level) {\r\n    return level[2]\r\n      ? `Level:${level[1]}/Module:${level[2]}`\r\n      : `Level:${level[1]}`;\r\n  }\r\n  const moduleOnly = /^module:([1-9]\\d*)$/i.exec(key);\r\n  return moduleOnly ? `Module:${moduleOnly[1]}` : null;\r\n}\r\n\r\n/**\r\n * What a value's calculated-value mark explains on click: any calculated value\r\n * (a formula, a status, a generated code, a date or an amount) whose host\r\n * named the record it was read from.\r\n */\r\nexport function toCalculationExplanationTarget(\r\n  entity: EntityData | null | undefined,\r\n  label?: string | null,\r\n): EntityCalculationExplanationTarget | null {\r\n  const source = entity?.calculationSource;\r\n  if (\r\n    !entity?.calculated ||\r\n    !source ||\r\n    !entity.key ||\r\n    !(source.recordId > 0) ||\r\n    !toCalculationContextKey(source.contextKey)\r\n  ) {\r\n    return null;\r\n  }\r\n  return {\r\n    source,\r\n    propertyKey: entity.key,\r\n    label: label || entity.name || entity.key,\r\n    displayedValue: entity.rawValue,\r\n    viewType: entity.viewType,\r\n    statusNames: statusNamesOf(entity.value),\r\n  };\r\n}\r\n\r\n/** The name of the status on screen, keyed by its status key. */\r\nfunction statusNamesOf(value: unknown): Record<string, string> | undefined {\r\n  if (!value || typeof value !== 'object') {\r\n    return undefined;\r\n  }\r\n  const { key, display } = value as { key?: unknown; display?: unknown };\r\n  return typeof key === 'string' && typeof display === 'string' && display\r\n    ? { [key]: display }\r\n    : undefined;\r\n}\r\n\r\n/**\r\n * Lets an explanation ask the host that rendered a value to read it again,\r\n * when the saved value no longer matches the one on screen. Provided by\r\n * `mt-client-instance-preview`; without it the explanation only says so.\r\n */\r\nexport abstract class EntityCalculationRefresher {\r\n  abstract refreshStaleCalculatedValue(): void;\r\n}\r\n","import { InjectionToken, Signal, signal } from '@angular/core';\nimport type {\n  CalculationExplanationDocument,\n  CalculationExplanationNode,\n  CalculationExplanationValue,\n  CalculationPropertyDisplay,\n  CalculationRecordRef,\n  CalculationStatusRuleExplanation,\n  ScheduleCalculationContributor,\n  ScheduleCalculationExplanation,\n  ScheduleCalculationSummary,\n} from './calculation-explanation.model';\n\n/**\n * The application's currency unit (`SAR`), shown after captured amounts. The\n * explanation never guesses a currency: without this token, or with an empty\n * unit, amounts are shown as plain numbers.\n */\nexport const MT_CALCULATION_CURRENCY = new InjectionToken<Signal<string>>(\n  'MT_CALCULATION_CURRENCY',\n  { providedIn: 'root', factory: () => signal('').asReadonly() },\n);\n\n/**\n * The names of a status property's statuses in a language, by status key, so\n * a status rule reads as its business name. Read inside a reactive context:\n * a host backed by signals updates the explanation when its statuses load.\n */\nexport type CalculationStatusNames = (\n  propertyKey: string,\n  lang: string,\n) => Record<string, string>;\n\nexport const MT_CALCULATION_STATUS_NAMES =\n  new InjectionToken<CalculationStatusNames>('MT_CALCULATION_STATUS_NAMES', {\n    providedIn: 'root',\n    factory: () => () => ({}),\n  });\n\nexport const CALCULATION_EXPLANATION_KEYS =\n  'components.entitiesPreview.calculationExplanation';\nconst K = CALCULATION_EXPLANATION_KEYS;\n\n/** What formatting needs from the host: language, currency, dates, text. */\nexport interface ExplanationFormatContext {\n  lang: string;\n  currency: string;\n  formatDate: (value: string, type: 'date' | 'dateTime' | 'time') => string;\n  translate: (key: string, params?: Record<string, unknown>) => string;\n}\n\n/** One piece of the readable equation. Rendered as plain text, never HTML. */\nexport type ExplanationSegment =\n  | { kind: 'text'; text: string }\n  | { kind: 'value'; text: string }\n  | { kind: 'term'; label: string; value: string | null }\n  | { kind: 'result'; text: string }\n  | { kind: 'muted'; text: string };\n\n/**\n * How an equation reads: `labels` is its shape (`Budget − Spent`), `values`\n * the captured values in that shape (`10,000 SAR − 125,454 SAR`), `inline`\n * both at once (`Budget (10,000 SAR)`), for status conditions.\n */\nexport type SegmentMode = 'inline' | 'labels' | 'values';\n\n/** Captured JSON shown as labelled data. */\nexport type ExplanationData =\n  | { kind: 'text'; text: string }\n  | { kind: 'list'; items: string[] }\n  | { kind: 'table'; columns: string[]; rows: string[][]; more: number }\n  | { kind: 'fields'; fields: { label: string; data: ExplanationData }[] };\n\n/**\n * Every key of the backend's text-key catalog\n * (`Pplus5.BE/Docs/Calculation-Explanation-Text-Keys.json`) this version\n * translates. A key outside it reads as a generic heading.\n */\nconst SERVER_TEXT_KEYS = new Set([\n  'calculation.fact.effectiveScheduleResults',\n  'calculation.fact.latestBaseline',\n  'calculation.fact.linkedScheduleLeaves',\n  'calculation.fact.matchingDescendants',\n  'calculation.fact.numericLeafValues',\n  'calculation.fact.orderedPhaseGates',\n  'calculation.fact.phaseGateConfigurationAndTime',\n  'calculation.fact.scheduleInputs',\n  'calculation.fact.schedulePolicyAndInputs',\n  'calculation.fact.selectedWorkingDays',\n  'calculation.fact.selectionPolicyAndTime',\n  'calculation.fact.unfilteredDescendants',\n  'calculation.method.completedActualFinish',\n  'calculation.method.descendantCount',\n  'calculation.method.earliestStart',\n  'calculation.method.latestBaseline',\n  'calculation.method.latestPlannedFinish',\n  'calculation.method.leafAverage',\n  'calculation.method.linkedScheduleProgress',\n  'calculation.method.phaseGatePosition',\n  'calculation.method.phaseGateStatus',\n  'calculation.method.phaseGateWeight',\n  'calculation.method.totalWorkingDays',\n  'calculation.method.weightedPhaseGateProgress',\n  'calculation.schedule.actual_finish',\n  'calculation.schedule.actual_start',\n  'calculation.schedule.baseline',\n  'calculation.schedule.duration',\n  'calculation.schedule.is_summary',\n  'calculation.schedule.manualStatus',\n  'calculation.schedule.order',\n  'calculation.schedule.planned_progress',\n  'calculation.schedule.retainedStatus',\n  'calculation.status.firstMatch',\n]);\n\n/**\n * Functions read as words, `%0` being an argument and `%*` all of them.\n * Any other function, or one called with another number of arguments, reads\n * as `NAME(arguments)`.\n */\nconst FUNCTION_PHRASES = new Set([\n  'SUM',\n  'SUM_IF',\n  'AVG',\n  'AVG_IF',\n  'COUNT',\n  'COUNT_IF',\n  'MIN',\n  'MAX',\n  'MEDIAN',\n  'STDDEV',\n  'WEIGHTED_AVG',\n  'ROUND',\n  'CEIL',\n  'FLOOR',\n  'ABS',\n  'CLAMP',\n  'ISNULL',\n  'NOT_ISNULL',\n  'NOT',\n  'IF',\n  'COALESCE',\n  'TODAY',\n  'DATE_DIFF',\n  'MONTH_DIFF',\n  'BUSINESS_DAYS',\n  'CONTAINS',\n  'IN',\n]);\n/** Joined between their arguments: `a and b and c`. */\nconst LOGICAL_FUNCTIONS: Record<string, string> = { AND: 'and', OR: 'or' };\n/** Yes/no checks: their result adds nothing beside a condition. */\nconst PREDICATES = new Set(['AND', 'OR', 'NOT', 'ISNULL', 'IN', 'CONTAINS']);\n\nconst NUMERIC_VIEW_TYPES = new Set(['Number', 'Currency', 'Percentage']);\nconst DATE_VIEW_TYPES: Record<string, 'date' | 'dateTime' | 'time'> = {\n  Date: 'date',\n  DateTime: 'dateTime',\n  Time: 'time',\n};\n/** Typed text a date never hides in. */\nconst TEXT_VIEW_TYPES = new Set(['Text', 'LongText', 'Lookup', 'Status']);\nconst ISO_DATE = /^\\d{4}-\\d{2}-\\d{2}(?:T00:00:00(?:\\.0+)?(?:Z|[+-]00:00)?)?$/;\nconst ISO_DATE_TIME = /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}/;\nconst EQUATION_KINDS = new Set([\n  'literal',\n  'input',\n  'semantic',\n  'table',\n  'binary',\n  'unary',\n  'function',\n  'conditional',\n  'array',\n]);\nconst OPERATORS: Record<string, string> = {\n  '+': '+',\n  '-': '−',\n  '*': '×',\n  '/': '÷',\n  '%': 'mod',\n  '==': '=',\n  '!=': '≠',\n  '<': '<',\n  '<=': '≤',\n  '>': '>',\n  '>=': '≥',\n};\nconst LOGICAL_OPERATORS: Record<string, string> = { '&&': 'and', '||': 'or' };\n/** How tightly each operator binds: brackets only where a reader needs them. */\nconst LOOSEST = 0;\nconst COMPARISON = 3;\nconst ARITHMETIC = 4;\nconst UNARY = 6;\nconst TIGHTEST = 9;\nconst PRECEDENCE: Record<string, number> = {\n  '||': 1,\n  '&&': 2,\n  '==': COMPARISON,\n  '!=': COMPARISON,\n  '<': COMPARISON,\n  '<=': COMPARISON,\n  '>': COMPARISON,\n  '>=': COMPARISON,\n  '+': ARITHMETIC,\n  '-': ARITHMETIC,\n  '*': 5,\n  '/': 5,\n  '%': 5,\n};\nconst NON_ASSOCIATIVE = new Set([\n  '-',\n  '/',\n  '%',\n  '==',\n  '!=',\n  '<',\n  '<=',\n  '>',\n  '>=',\n]);\nconst SEMANTIC_KEYS = new Set([\n  'actual_progress',\n  'planned_progress',\n  'baseline_progress',\n  'baseline_count',\n]);\nconst PROGRESS_KEYS = new Set([\n  'actual_progress',\n  'planned_progress',\n  'baseline_progress',\n]);\nconst CODE_BLOCK_TYPES = new Set([\n  'Source',\n  'StaticText',\n  'Counter',\n  'CurrentDatePart',\n]);\n/**\n * Notes about the whole rollup. Zero-weight and missing-input items are not\n * noted again: each such item's row already says why it reads as it does,\n * and a missing baseline has its own notice.\n */\nconst SCHEDULE_NOTES = new Set([\n  'noEligibleScheduleItems',\n  'allWeightsZeroUsingArithmeticMean',\n]);\nconst ITEM_TYPES = new Set(['Task', 'Milestone', 'Deliverable']);\n/** Field names of native facts with a business label, lower-cased. */\nconst FIELD_LABELS = new Set([\n  'asofutc',\n  'utcnow',\n  'iscurrent',\n  'iscompleted',\n  'weight',\n  'totallevelweight',\n  'allitemscompleted',\n  'baselineprogress',\n  'version',\n  'baselineversion',\n  'value',\n  'source',\n  'includemilestones',\n  'excludesamedaymilestones',\n  'leafonly',\n  'plannedstart',\n  'plannedfinish',\n  'actualstart',\n  'actualfinish',\n  'finish',\n  'workingdays',\n  'calendar',\n  'timezoneid',\n  'workdaystartminute',\n  'workdayendminute',\n  'holidays',\n  'order',\n  'selectedstatus',\n  'modulekey',\n  'progress',\n  'calculation',\n  'recordids',\n  'policy',\n  'nodes',\n  'dependencies',\n  'target',\n  'results',\n  'duration',\n  'issummary',\n]);\n/** Technical identifiers a reader has no use for. */\nconst HIDDEN_FIELDS = new Set([\n  'id',\n  'levelid',\n  'leveldataid',\n  'parentid',\n  'key',\n  'propertykey',\n  'schemaid',\n  'filtercondition',\n]);\nconst FIELD_VALUES = new Set(['latestBaseline', 'storedBaseline']);\nconst MINUTE_FIELDS = new Set(['workdaystartminute', 'workdayendminute']);\n/** List inputs show their values inline up to this many. */\nconst INLINE_VALUES = 3;\n/** Nested captured data rendered as fields up to this depth, then as text. */\nconst DATA_DEPTH = 3;\n/** Captured tables show this many rows, then a count of the rest. */\nconst DATA_ROWS = 20;\n\n// ── Values ─────────────────────────────────────────────────────────────────\n\n/** A number as captured: grouped, never rounded, with a real minus sign. */\nexport function formatExplanationNumber(value: number): string {\n  if (!Number.isFinite(value)) {\n    return String(value);\n  }\n  return new Intl.NumberFormat('en-US', { maximumFractionDigits: 20 })\n    .format(value)\n    .replace(/^-/, '−');\n}\n\n/** A captured value as plain text. Never formatted or rounded here. */\nexport function formatExplanationValue(\n  value: CalculationExplanationValue | undefined,\n): string {\n  if (value === null || value === undefined) {\n    return '—';\n  }\n  return typeof value === 'object' ? JSON.stringify(value) : String(value);\n}\n\n/**\n * A captured value the way its property shows values: grouped numbers, the\n * application currency, `%`, the configured date format, yes/no. An untyped\n * value (a function result) that is a date reads as one.\n */\nexport function formatTypedValue(\n  value: CalculationExplanationValue | undefined,\n  viewType: string | null | undefined,\n  ctx: ExplanationFormatContext,\n): string {\n  if (value === null || value === undefined || value === '') {\n    return '—';\n  }\n  if (Array.isArray(value)) {\n    return value\n      .map((item) => formatTypedValue(item, viewType, ctx))\n      .join(', ');\n  }\n  if (typeof value === 'object') {\n    return JSON.stringify(value);\n  }\n  if (typeof value === 'boolean') {\n    return ctx.translate(`${K}.${value ? 'yes' : 'no'}`);\n  }\n  const type = viewType ?? '';\n  if (typeof value === 'number') {\n    return formatTypedNumber(value, type, ctx);\n  }\n  if (NUMERIC_VIEW_TYPES.has(type) && isNumericText(value)) {\n    return formatTypedNumber(Number(value), type, ctx);\n  }\n  const dateType =\n    DATE_VIEW_TYPES[type] ??\n    (TEXT_VIEW_TYPES.has(type)\n      ? undefined\n      : ISO_DATE.test(value)\n        ? 'date'\n        : ISO_DATE_TIME.test(value)\n          ? 'dateTime'\n          : undefined);\n  if (dateType) {\n    return ctx.formatDate(value, dateType) || value;\n  }\n  if (type === 'Checkbox' && (value === 'true' || value === 'false')) {\n    return ctx.translate(`${K}.${value === 'true' ? 'yes' : 'no'}`);\n  }\n  return value;\n}\n\nfunction formatTypedNumber(\n  value: number,\n  viewType: string,\n  ctx: ExplanationFormatContext,\n): string {\n  const text = formatExplanationNumber(value);\n  if (viewType === 'Currency') {\n    return ctx.currency ? `${text} ${ctx.currency}` : text;\n  }\n  return viewType === 'Percentage' ? `${text}%` : text;\n}\n\nfunction isNumericText(value: string): boolean {\n  return value.trim() !== '' && Number.isFinite(Number(value));\n}\n\nfunction percent(value: number): string {\n  return `${formatExplanationNumber(value)}%`;\n}\n\n// ── Labels ─────────────────────────────────────────────────────────────────\n\n/** A property's current name in the active language. */\nexport function displayName(\n  display: CalculationPropertyDisplay | null | undefined,\n  lang: string,\n): string | null {\n  if (!display) {\n    return null;\n  }\n  const preferred = lang.startsWith('ar')\n    ? [display.nameAr, display.name, display.nameEn]\n    : [display.nameEn, display.name, display.nameAr];\n  return preferred.find((name) => !!name?.trim()) ?? null;\n}\n\n/** `totalLevelWeight` / `is_cancelled` → `Total level weight` / `Is cancelled`. */\nexport function humanizeKey(key: string): string {\n  const words = key\n    .replace(/([a-z0-9])([A-Z])/g, '$1 $2')\n    .replace(/[_.-]+/g, ' ')\n    .trim()\n    .toLowerCase();\n  return words ? words[0].toUpperCase() + words.slice(1) : key;\n}\n\n/**\n * A server-authored text key (`calculation.method.leafAverage`) in the active\n * language; null for a missing or unknown key.\n */\nexport function serverText(\n  key: string | null | undefined,\n  ctx: ExplanationFormatContext,\n): string | null {\n  return key && SERVER_TEXT_KEYS.has(key)\n    ? ctx.translate(`${K}.text.${key.slice('calculation.'.length)}`)\n    : null;\n}\n\n/**\n * What a document's calculation does, in words: its description key, or for\n * an older capture a generic description of its kind.\n */\nexport function describeDocument(\n  document: CalculationExplanationDocument,\n  ctx: ExplanationFormatContext,\n): string {\n  return (\n    serverText(document.descriptionKey, ctx) ??\n    (document.provider === 'status'\n      ? ctx.translate(`${K}.text.status.firstMatch`)\n      : document.provider === 'schedule'\n        ? ctx.translate(`${K}.generic.schedule`)\n        : ctx.translate(`${K}.generic.method`))\n  );\n}\n\n/** The column of a reference: `Current::project_budget` → `project_budget`. */\nfunction referenceColumn(reference: string | null): string | null {\n  if (!reference) {\n    return null;\n  }\n  const at = reference.lastIndexOf('::');\n  return at >= 0 ? reference.slice(at + 2) : reference;\n}\n\n/** The table of a reference: `Modules.Financial::amount` → `Modules.Financial`. */\nfunction referenceTable(reference: string | null): string | null {\n  if (!reference) {\n    return null;\n  }\n  const at = reference.indexOf('::');\n  return at >= 0 ? reference.slice(0, at) : null;\n}\n\nfunction semanticKey(reference: string | null): string | null {\n  const column = referenceColumn(reference);\n  return column && SEMANTIC_KEYS.has(column) ? column : null;\n}\n\n/**\n * A node's business label: the property's authorized name, a known schedule\n * value, or a generic label. Never a reference, key or formula text.\n */\nfunction nodeLabel(\n  node: CalculationExplanationNode,\n  ctx: ExplanationFormatContext,\n): string {\n  // A schedule rollup reads as what it rolls up: its column's display name\n  // is the property's own (`Baseline Progress = Baseline Progress`).\n  const semantic = semanticKey(node.reference);\n  if (node.kind === 'semantic' && semantic) {\n    return ctx.translate(`${K}.semantic.${semantic}`);\n  }\n  const named = displayName(node.display, ctx.lang);\n  if (named) {\n    return named;\n  }\n  if (semantic) {\n    return ctx.translate(`${K}.semantic.${semantic}`);\n  }\n  if (node.kind === 'semantic') {\n    return ctx.translate(`${K}.generic.scheduleValue`);\n  }\n  if (node.kind === 'table') {\n    return ctx.translate(`${K}.generic.records`);\n  }\n  return ctx.translate(`${K}.generic.value`);\n}\n\n/** How a node's value shows: its property's view type, or a progress `%`. */\nfunction nodeViewType(node: CalculationExplanationNode): string | null {\n  if (node.display?.viewType) {\n    return node.display.viewType;\n  }\n  const column = referenceColumn(node.reference);\n  return column && PROGRESS_KEYS.has(column) ? 'Percentage' : null;\n}\n\nfunction nodeValueText(\n  node: CalculationExplanationNode,\n  ctx: ExplanationFormatContext,\n): string {\n  if (node.state === 'notEvaluated') {\n    return ctx.translate(`${K}.notEvaluated`);\n  }\n  const value = node.value;\n  const viewType = nodeViewType(node);\n  const text = Array.isArray(value)\n    ? value.length <= INLINE_VALUES\n      ? value.map((item) => formatTypedValue(item, viewType, ctx)).join(', ')\n      : ctx.translate(`${K}.valueCount`, { count: value.length })\n    : formatTypedValue(value, viewType, ctx);\n  // A summarized rollup lists none of its rows: say how many it read\n  // (`1, from 259 rows`), so a small result over a large schedule reads right.\n  return node.rowCount && node.rowCount > 0\n    ? ctx.translate(`${K}.valueFromRows`, { value: text, count: node.rowCount })\n    : text;\n}\n\nfunction scheduleDetailOf(\n  document: CalculationExplanationDocument,\n  reference: string | null,\n): ScheduleCalculationExplanation | null {\n  return (\n    (reference &&\n      document.schedule?.find((detail) => detail.reference === reference)) ||\n    null\n  );\n}\n\n/** `Weighted average`: how a rollup combined its items (counts are in the panel). */\nfunction describeRollup(\n  detail: ScheduleCalculationExplanation,\n  ctx: ExplanationFormatContext,\n): string {\n  const aggregation = ['weightedAverage', 'arithmeticMean'].includes(\n    detail.aggregation,\n  )\n    ? detail.aggregation\n    : 'empty';\n  return ctx.translate(`${K}.schedule.aggregation.${aggregation}`);\n}\n\nfunction functionName(node: CalculationExplanationNode): string {\n  const name = (node.operation ?? '').trim().toUpperCase();\n  return name || (node.kind === 'conditional' ? 'IF' : node.kind);\n}\n\n// ── Equations ──────────────────────────────────────────────────────────────\n\n/** Whether the document's root reads as an equation. */\nexport function isEquationDocument(\n  document: CalculationExplanationDocument,\n): boolean {\n  const root = document.nodes?.find((node) => node.id === document.rootNodeId);\n  return !!root && EQUATION_KINDS.has(root.kind);\n}\n\n/**\n * The calculation as readable business wording: inputs by their property\n * names, operators as symbols, functions as words (`sum of Amount where …`).\n * `null` when the document is not an equation (a native method, a status\n * selection, a generated code), or, in `values` mode, when an input is a list\n * of values the line cannot show (the details list them by record).\n *\n * Nodes form a graph: the same input can be reached from several places, and\n * each place shows it in full. Only a node already on the current path (a\n * cycle, which a valid document never has) reads as `…`.\n */\nexport function buildExplanationSegments(\n  document: CalculationExplanationDocument,\n  ctx: ExplanationFormatContext,\n  mode: SegmentMode = 'inline',\n  startId: number = document.rootNodeId,\n): ExplanationSegment[] | null {\n  if (!isEquationDocument(document)) {\n    return null;\n  }\n  const byId = new Map((document.nodes ?? []).map((node) => [node.id, node]));\n  const start = byId.get(startId);\n  if (!start || !EQUATION_KINDS.has(start.kind)) {\n    return null;\n  }\n  const path = new Set<number>();\n  // Values mode: set when an input is a list, so the line can't be shown.\n  let listed = false;\n  const notEvaluated = (): ExplanationSegment[] => [\n    { kind: 'muted', text: ctx.translate(`${K}.notEvaluated`) },\n  ];\n\n  /**\n   * A node in a place that binds at `context`: it gets brackets only when it\n   * binds looser (`(a + b) × c`, `a and (b or c)`), never around a single\n   * term, so `Baseline − Actual ≤ 5` and `a and b and c` read bare.\n   */\n  const render = (id: number, context: number): ExplanationSegment[] => {\n    const node = byId.get(id);\n    if (!node || path.has(id)) {\n      return [{ kind: 'muted', text: '…' }];\n    }\n    path.add(id);\n    try {\n      const segments = renderNode(node);\n      // Inside a condition, a nested difference or product shows what it gave.\n      const shown =\n        mode === 'inline' &&\n        node.id !== startId &&\n        node.kind === 'binary' &&\n        (PRECEDENCE[node.operation ?? ''] ?? 0) >= ARITHMETIC &&\n        typeof node.value === 'number';\n      if (shown) {\n        segments.push({\n          kind: 'result',\n          text: formatTypedValue(node.value, null, ctx),\n        });\n      }\n      const wrap =\n        segments.length > 1 && (shown || precedenceOf(node) < context);\n      return wrap\n        ? [\n            { kind: 'text', text: '(' },\n            ...segments,\n            { kind: 'text', text: ')' },\n          ]\n        : segments;\n    } finally {\n      path.delete(id);\n    }\n  };\n\n  const precedenceOf = (node: CalculationExplanationNode): number => {\n    switch (node.kind) {\n      case 'binary':\n        return PRECEDENCE[node.operation ?? ''] ?? TIGHTEST;\n      case 'unary':\n        return node.operation === 'Not' ? COMPARISON : UNARY;\n      case 'conditional':\n        return LOOSEST;\n      case 'function': {\n        const name = functionName(node);\n        if (name in LOGICAL_FUNCTIONS) {\n          return name === 'OR' ? PRECEDENCE['||'] : PRECEDENCE['&&'];\n        }\n        if (name === 'TODAY' || !FUNCTION_PHRASES.has(name)) {\n          return TIGHTEST;\n        }\n        // `x is empty` reads as a comparison; `sum of x where …` needs\n        // brackets inside anything.\n        return PREDICATES.has(name) ? COMPARISON : LOOSEST;\n      }\n      default:\n        return TIGHTEST;\n    }\n  };\n\n  const renderNode = (\n    node: CalculationExplanationNode,\n  ): ExplanationSegment[] => {\n    const skipped = node.state === 'notEvaluated' && mode !== 'labels';\n    switch (node.kind) {\n      case 'literal':\n        return [{ kind: 'value', text: literalText(node, ctx) }];\n      case 'input':\n        if (mode === 'labels') {\n          return [{ kind: 'term', label: nodeLabel(node, ctx), value: null }];\n        }\n        if (mode === 'values') {\n          if (Array.isArray(node.value)) {\n            listed = true;\n            return [];\n          }\n          return skipped\n            ? notEvaluated()\n            : [{ kind: 'value', text: nodeValueText(node, ctx) }];\n        }\n        return [\n          {\n            kind: 'term',\n            label: nodeLabel(node, ctx),\n            value: nodeValueText(node, ctx),\n          },\n        ];\n      case 'semantic': {\n        if (mode === 'labels') {\n          return [{ kind: 'term', label: nodeLabel(node, ctx), value: null }];\n        }\n        if (skipped) {\n          return notEvaluated();\n        }\n        // A schedule rollup on its own reads as how it was aggregated; inside\n        // a larger formula, as its value.\n        const rollup = scheduleDetailOf(document, node.reference);\n        if (mode === 'values') {\n          return [\n            {\n              kind: 'value',\n              text:\n                rollup && node.id === startId\n                  ? describeRollup(rollup, ctx)\n                  : nodeValueText(node, ctx),\n            },\n          ];\n        }\n        return [\n          {\n            kind: 'term',\n            label: nodeLabel(node, ctx),\n            value: nodeValueText(node, ctx),\n          },\n        ];\n      }\n      case 'table': {\n        if (mode === 'values') {\n          listed = true;\n          return [];\n        }\n        const rows = Math.max(\n          0,\n          ...node.children.map(\n            (child) => byId.get(child)?.recordIds?.length ?? 0,\n          ),\n        );\n        return [\n          {\n            kind: 'term',\n            label: nodeLabel(node, ctx),\n            value:\n              mode === 'inline'\n                ? ctx.translate(`${K}.recordCount`, { count: rows })\n                : null,\n          },\n        ];\n      }\n      case 'binary': {\n        if (skipped) {\n          return notEvaluated();\n        }\n        const operation = node.operation ?? '';\n        const logical = LOGICAL_OPERATORS[operation];\n        const text = logical\n          ? ctx.translate(`${K}.op.${logical}`)\n          : (OPERATORS[operation] ?? operation);\n        const own = PRECEDENCE[operation] ?? TIGHTEST;\n        // `a − (b − c)`: the right side of a non-associative operator binds\n        // tighter than the operator itself.\n        const right = NON_ASSOCIATIVE.has(operation) ? own + 1 : own;\n        return [\n          ...render(node.children[0], own),\n          { kind: 'text', text },\n          ...render(node.children[1], right),\n        ];\n      }\n      case 'unary': {\n        if (skipped) {\n          return notEvaluated();\n        }\n        const child = byId.get(node.children[0]);\n        if (node.operation === 'Not') {\n          // `!ISNULL(x)` reads as `x is not empty`.\n          if (\n            child?.kind === 'function' &&\n            functionName(child) === 'ISNULL' &&\n            child.children.length === 1\n          ) {\n            return phrase('NOT_ISNULL', [render(child.children[0], LOOSEST)]);\n          }\n          return phrase('NOT', [render(node.children[0], COMPARISON + 1)]);\n        }\n        return [\n          { kind: 'text', text: node.operation === 'Negate' ? '−' : '+' },\n          ...render(node.children[0], UNARY),\n        ];\n      }\n      case 'function':\n      case 'conditional':\n        return renderFunction(node, skipped);\n      case 'array':\n        return [\n          { kind: 'text', text: '[' },\n          ...joined(node.children.map((child) => render(child, LOOSEST))),\n          { kind: 'text', text: ']' },\n        ];\n      default:\n        // A kind this version does not know: shown as labelled data.\n        return [\n          {\n            kind: 'term',\n            label: nodeLabel(node, ctx),\n            value: mode === 'labels' ? null : nodeValueText(node, ctx),\n          },\n        ];\n    }\n  };\n\n  const renderFunction = (\n    node: CalculationExplanationNode,\n    skipped: boolean,\n  ): ExplanationSegment[] => {\n    if (skipped) {\n      return notEvaluated();\n    }\n    const name = functionName(node);\n    const value = formatTypedValue(node.value, null, ctx);\n    if (name === 'TODAY' && node.children.length === 0) {\n      const label = ctx.translate(`${K}.fn.TODAY`);\n      return mode === 'values'\n        ? [{ kind: 'value', text: value }]\n        : [\n            {\n              kind: 'term',\n              label,\n              value: mode === 'inline' ? value : null,\n            },\n          ];\n    }\n    // In values mode a function over a list reads as its result: the list\n    // itself is in the details.\n    const before = listed;\n    listed = false;\n    const logical = LOGICAL_FUNCTIONS[name];\n    const own = precedenceOf(node);\n    const args = node.children.map((child) =>\n      render(child, logical ? own : LOOSEST),\n    );\n    const overList = listed;\n    listed = before;\n    if (mode === 'values' && overList) {\n      if (node.id === startId) {\n        listed = true;\n        return [];\n      }\n      return [{ kind: 'value', text: value }];\n    }\n    if (logical) {\n      const word = ctx.translate(`${K}.op.${logical}`);\n      return args.flatMap((arg, index) =>\n        index === 0 ? arg : [{ kind: 'text' as const, text: word }, ...arg],\n      );\n    }\n    const segments = phrase(name, args);\n    // Inside a condition, a nested value function shows what it gave.\n    if (\n      mode === 'inline' &&\n      node.id !== startId &&\n      !PREDICATES.has(name) &&\n      node.value !== undefined\n    ) {\n      segments.push({ kind: 'result', text: value });\n    }\n    return segments;\n  };\n\n  const phrase = (\n    name: string,\n    args: ExplanationSegment[][],\n  ): ExplanationSegment[] => {\n    const template = FUNCTION_PHRASES.has(name)\n      ? ctx.translate(`${K}.fn.${name}`)\n      : null;\n    return (template && fillPhrase(template, args)) || callForm(name, args);\n  };\n\n  const out = render(startId, LOOSEST);\n  return mode === 'values' && listed ? null : out;\n}\n\n/**\n * `%0` and `%*` filled with arguments; null when the count differs. Not\n * `{0}`: an ICU MessageFormat transpiler (the apps use one) fills braces\n * itself, with `undefined`.\n */\nfunction fillPhrase(\n  template: string,\n  args: ExplanationSegment[][],\n): ExplanationSegment[] | null {\n  const parts = template.split(/(%\\d|%\\*)/);\n  const rest = parts.includes('%*');\n  const positions = parts\n    .map((part) => /^%(\\d)$/.exec(part))\n    .filter((match): match is RegExpExecArray => !!match)\n    .map((match) => Number(match[1]));\n  const expected = positions.length ? Math.max(...positions) + 1 : 0;\n  if (rest ? args.length < expected + 1 : args.length !== expected) {\n    return null;\n  }\n  const out: ExplanationSegment[] = [];\n  for (const part of parts) {\n    const position = /^%(\\d)$/.exec(part);\n    if (position) {\n      out.push(...args[Number(position[1])]);\n    } else if (part === '%*') {\n      out.push(...joined(args.slice(expected)));\n    } else if (part.trim()) {\n      out.push({ kind: 'text', text: part.trim() });\n    }\n  }\n  return out;\n}\n\n/** `NAME(a, b)`: a function this version has no words for. */\nfunction callForm(\n  name: string,\n  args: ExplanationSegment[][],\n): ExplanationSegment[] {\n  return [\n    { kind: 'text', text: `${name}(` },\n    ...joined(args),\n    { kind: 'text', text: ')' },\n  ];\n}\n\nfunction joined(items: ExplanationSegment[][]): ExplanationSegment[] {\n  return items.flatMap((item, index) =>\n    index === 0 ? item : [{ kind: 'text' as const, text: ',' }, ...item],\n  );\n}\n\n/** A literal the way the formula wrote it: `\"Paid\"`, `No`, `1,000`, a date. */\nfunction literalText(\n  node: CalculationExplanationNode,\n  ctx: ExplanationFormatContext,\n): string {\n  const value =\n    node.value === undefined || node.value === null\n      ? literalOf(node)\n      : node.value;\n  if (typeof value === 'string') {\n    return ISO_DATE.test(value) || ISO_DATE_TIME.test(value)\n      ? formatTypedValue(value, null, ctx)\n      : `\"${value}\"`;\n  }\n  if (typeof value === 'number') {\n    return formatExplanationNumber(value);\n  }\n  if (typeof value === 'boolean') {\n    return formatTypedValue(value, null, ctx);\n  }\n  return formatExplanationValue(value);\n}\n\n/**\n * A literal on a branch that never ran has no captured value; it is still\n * the constant the formula wrote (`false`, `0`, `\"Paid\"`).\n */\nfunction literalOf(\n  node: CalculationExplanationNode,\n): CalculationExplanationValue {\n  if (node.kind !== 'literal' || !node.expression?.trim()) {\n    return node.value ?? null;\n  }\n  try {\n    const parsed = JSON.parse(node.expression) as unknown;\n    return parsed === null || typeof parsed !== 'object'\n      ? (parsed as CalculationExplanationValue)\n      : null;\n  } catch {\n    return null;\n  }\n}\n\n/** Capitalizes the first word, for an equation that starts a line. */\nexport function capitalizeSegments(\n  segments: ExplanationSegment[],\n): ExplanationSegment[] {\n  const [first, ...rest] = segments;\n  if (first?.kind !== 'text' || !first.text) {\n    return segments;\n  }\n  return [\n    { kind: 'text', text: first.text[0].toUpperCase() + first.text.slice(1) },\n    ...rest,\n  ];\n}\n\n/** One part of a condition and whether it held. */\nexport interface ExplanationCheckView {\n  segments: ExplanationSegment[];\n  /** The captured truth; null when it was never evaluated. */\n  met: boolean | null;\n  /** At least one of these must hold (an `or`). */\n  anyOf: ExplanationCheckView[] | null;\n}\n\n/**\n * A condition as a checklist: each part the rule requires on its own line\n * with whether it held, so a reader sees why a rule matched or which part\n * failed. Every truth is the captured one; nothing is evaluated here.\n *\n * `a and b and c` becomes three parts. `IF(guard, false, rest)` — the usual\n * \"skip when data is missing\" form — becomes `Unless guard` plus the parts of\n * `rest`. An `or` becomes one part whose options are listed. Null when the\n * document is not an equation.\n */\nexport function buildConditionChecks(\n  document: CalculationExplanationDocument,\n  ctx: ExplanationFormatContext,\n): ExplanationCheckView[] | null {\n  if (!isEquationDocument(document)) {\n    return null;\n  }\n  const byId = new Map((document.nodes ?? []).map((node) => [node.id, node]));\n  const truth = (node: CalculationExplanationNode): boolean | null =>\n    node.state === 'evaluated' && typeof node.value === 'boolean'\n      ? node.value\n      : null;\n  const is = (node: CalculationExplanationNode, logical: 'and' | 'or') =>\n    (node.kind === 'binary' &&\n      LOGICAL_OPERATORS[node.operation ?? ''] === logical) ||\n    (node.kind === 'function' &&\n      LOGICAL_FUNCTIONS[functionName(node)] === logical);\n  const isFalse = (node: CalculationExplanationNode) =>\n    node.kind === 'literal' && literalOf(node) === false;\n  const wording = (node: CalculationExplanationNode) =>\n    buildExplanationSegments(document, ctx, 'inline', node.id) ?? [];\n  const part = (node: CalculationExplanationNode): ExplanationCheckView => ({\n    segments: wording(node),\n    met: truth(node),\n    anyOf: null,\n  });\n  const children = (node: CalculationExplanationNode) =>\n    node.children\n      .map((id) => byId.get(id))\n      .filter((child): child is CalculationExplanationNode => !!child);\n\n  const visited = new Set<number>();\n  const parts = (node: CalculationExplanationNode): ExplanationCheckView[] => {\n    if (visited.has(node.id)) {\n      return [part(node)];\n    }\n    visited.add(node.id);\n    try {\n      if (is(node, 'and')) {\n        return children(node).flatMap(parts);\n      }\n      const name = node.kind === 'conditional' ? 'IF' : functionName(node);\n      const [guard, then, otherwise] = children(node);\n      if (\n        (node.kind === 'conditional' || node.kind === 'function') &&\n        name === 'IF' &&\n        node.children.length === 3 &&\n        guard &&\n        then &&\n        otherwise\n      ) {\n        if (isFalse(then)) {\n          const guardTruth = truth(guard);\n          const words = fillPhrase(ctx.translate(`${K}.check.unless`), [\n            wording(guard),\n          ]);\n          return [\n            {\n              segments: words ?? wording(guard),\n              met: guardTruth === null ? null : !guardTruth,\n              anyOf: null,\n            },\n            // A guard that held means the rest was never checked.\n            ...(guardTruth === true ? [] : parts(otherwise)),\n          ];\n        }\n        if (isFalse(otherwise)) {\n          return [\n            ...parts(guard),\n            ...(truth(guard) === false ? [] : parts(then)),\n          ];\n        }\n      }\n      if (is(node, 'or')) {\n        return [\n          {\n            segments: [],\n            met: truth(node),\n            anyOf: children(node).map(part),\n          },\n        ];\n      }\n      return [part(node)];\n    } finally {\n      visited.delete(node.id);\n    }\n  };\n  const root = byId.get(document.rootNodeId);\n  return root ? parts(root) : null;\n}\n\n/** A generated code as its parts: `PRJ + - + 2026 + - + 0042`. */\nexport function buildCodeSegments(\n  document: CalculationExplanationDocument,\n  ctx: ExplanationFormatContext,\n): ExplanationSegment[] {\n  const blocks = (document.nodes ?? []).filter(\n    (node) => node.kind === 'codeBlock',\n  );\n  return blocks.flatMap((node, index): ExplanationSegment[] => [\n    ...(index > 0 ? [{ kind: 'text' as const, text: '+' }] : []),\n    {\n      kind: 'value',\n      text: JSON.stringify(formatTypedValue(node.value, null, ctx)),\n    },\n  ]);\n}\n\n// ── Captured data ──────────────────────────────────────────────────────────\n\n/**\n * Captured JSON (native method facts) as labelled fields, lists or tables.\n * Field names read as business labels; record ids read as a count.\n */\nexport function toExplanationData(\n  value: CalculationExplanationValue | undefined,\n  ctx: ExplanationFormatContext,\n  depth = 0,\n  field = '',\n): ExplanationData {\n  if (field && MINUTE_FIELDS.has(field) && typeof value === 'number') {\n    return { kind: 'text', text: clock(value) };\n  }\n  if (Array.isArray(value) && field && isIdField(field)) {\n    return {\n      kind: 'text',\n      text: ctx.translate(`${K}.recordCount`, { count: value.length }),\n    };\n  }\n  if (value === null || value === undefined || typeof value !== 'object') {\n    return {\n      kind: 'text',\n      text:\n        typeof value === 'string' && FIELD_VALUES.has(value)\n          ? ctx.translate(`${K}.fieldValue.${value}`)\n          : formatTypedValue(value, null, ctx),\n    };\n  }\n  if (depth >= DATA_DEPTH) {\n    return {\n      kind: 'text',\n      text: Array.isArray(value)\n        ? ctx.translate(`${K}.valueCount`, { count: value.length })\n        : '…',\n    };\n  }\n  if (Array.isArray(value)) {\n    if (value.length === 0) {\n      return { kind: 'text', text: '—' };\n    }\n    if (value.every((item) => isPlainObject(item))) {\n      const records = value as Record<string, CalculationExplanationValue>[];\n      const columns = [\n        ...new Set(records.flatMap((row) => Object.keys(row))),\n      ].filter((column) => !HIDDEN_FIELDS.has(column.toLowerCase()));\n      return {\n        kind: 'table',\n        columns: columns.map((column) => fieldLabel(column, ctx)),\n        rows: records.slice(0, DATA_ROWS).map((row) =>\n          columns.map((column) => {\n            const cell = toExplanationData(\n              row[column],\n              ctx,\n              DATA_DEPTH - 1,\n              column.toLowerCase(),\n            );\n            return cell.kind === 'text' ? cell.text : '…';\n          }),\n        ),\n        more: Math.max(0, records.length - DATA_ROWS),\n      };\n    }\n    return {\n      kind: 'list',\n      items: value.map((item) => {\n        const cell = toExplanationData(item, ctx, DATA_DEPTH - 1);\n        return cell.kind === 'text' ? cell.text : '…';\n      }),\n    };\n  }\n  return {\n    kind: 'fields',\n    fields: Object.entries(value)\n      .filter(([key]) => !HIDDEN_FIELDS.has(key.toLowerCase()))\n      .map(([key, item]) => ({\n        label: fieldLabel(key, ctx),\n        data: toExplanationData(item, ctx, depth + 1, key.toLowerCase()),\n      })),\n  };\n}\n\nfunction isIdField(field: string): boolean {\n  return field === 'recordids' || field.endsWith('ids');\n}\n\nfunction fieldLabel(key: string, ctx: ExplanationFormatContext): string {\n  const normalized = key.toLowerCase();\n  return FIELD_LABELS.has(normalized)\n    ? ctx.translate(`${K}.field.${normalized}`)\n    : humanizeKey(key);\n}\n\nfunction isPlainObject(\n  value: CalculationExplanationValue,\n): value is Record<string, CalculationExplanationValue> {\n  return !!value && typeof value === 'object' && !Array.isArray(value);\n}\n\n// ── Details ────────────────────────────────────────────────────────────────\n\n/** A scalar input the calculation used. */\nexport interface ExplanationValueView {\n  label: string;\n  value: string;\n}\n\n/** List inputs read from the same rows, one row per record. */\nexport interface ExplanationRecordTableView {\n  columns: string[];\n  rows: {\n    /** The record, for its name; null when the context is unknown. */\n    ref: CalculationRecordRef | null;\n    cells: string[];\n  }[];\n}\n\n/** A nested function and what it gave. */\nexport interface ExplanationStepView {\n  segments: ExplanationSegment[];\n  result: string;\n}\n\nexport interface ExplanationFactView {\n  label: string;\n  data: ExplanationData;\n}\n\nexport interface ExplanationCodeBlockView {\n  type: string;\n  value: string;\n  /** The block's value before its transformations, when it differs. */\n  raw: string | null;\n}\n\nexport interface ExplanationStatusRuleView {\n  key: string;\n  name: string;\n  /** Its place in the order rules are checked, from 1. */\n  position: number;\n  verdict:\n    | 'selected'\n    | 'matched'\n    | 'notMatched'\n    | 'checked'\n    | 'failed'\n    | 'notEvaluated';\n  /** The condition in one line, when it has no checklist. */\n  segments: ExplanationSegment[] | null;\n  /** The condition as the parts it requires, each with whether it held. */\n  checks: ExplanationCheckView[] | null;\n}\n\nexport interface ExplanationContributorView {\n  ref: CalculationRecordRef;\n  type: string | null;\n  progress: string;\n  weight: string;\n  counted: boolean;\n  /** Why it was not counted, or how a missing value was treated. */\n  reason: string | null;\n  /** A planned item's dates and the working time elapsed of its total. */\n  planned: {\n    dates: string | null;\n    time: string | null;\n  } | null;\n}\n\nexport interface ExplanationScheduleView {\n  kind: 'actual' | 'planned' | 'baseline' | 'other';\n  /** The rollup is the whole formula: its title and result are the summary's. */\n  standalone: boolean;\n  title: string;\n  /** What this progress means, so actual, planned and baseline read apart. */\n  meaning: string | null;\n  result: string;\n  /** `Weighted average · Weighted by working days`. */\n  method: string;\n  /** Contributors actually counted. */\n  counted: string;\n  notes: string[];\n  missingBaseline: boolean;\n  weightLabel: string;\n  /** How many items are listed: `12`, or `25 of 265` for a summary. */\n  listed: string;\n  contributors: ExplanationContributorView[];\n  /** A large rollup's totals over every item; only some items are listed. */\n  summary: ExplanationScheduleSummaryView | null;\n}\n\nexport interface ExplanationScheduleSummaryView {\n  /** Which items are listed: `The 25 items with the most weight`. */\n  listedItems: string;\n  /**\n   * `Sum of progress × weight (16,340) ÷ Sum of weights (265)`; the result is\n   * the rollup's. Null when nothing was averaged.\n   */\n  totals: ExplanationSegment[] | null;\n  /** Items counted differently, only when there are any. */\n  counts: string[];\n  /** The items by kind, when there is more than one kind. */\n  groups: ExplanationScheduleGroupView[];\n}\n\nexport interface ExplanationScheduleGroupView {\n  type: string;\n  /** `240 of 240`: counted of all. */\n  counted: string;\n  /** Null for a simple average, where items carry no weight. */\n  weight: string | null;\n  /** The percentage points these items add to the result. */\n  share: string;\n}\n\nexport interface ExplanationDetailsView {\n  /** What a native method or schedule field does, in words. */\n  description: string | null;\n  values: ExplanationValueView[];\n  records: ExplanationRecordTableView[];\n  steps: ExplanationStepView[];\n  statusRules: ExplanationStatusRuleView[];\n  schedule: ExplanationScheduleView[];\n  codeBlocks: ExplanationCodeBlockView[];\n  facts: ExplanationFactView[];\n}\n\n/** Everything the details panel shows, read from the document as is. */\nexport function buildExplanationDetails(\n  document: CalculationExplanationDocument,\n  ctx: ExplanationFormatContext,\n  statusNames: Record<string, string> = {},\n): ExplanationDetailsView {\n  const equation = isEquationDocument(document);\n  const nodes = document.nodes ?? [];\n  const values: ExplanationValueView[] = [];\n  const steps: ExplanationStepView[] = [];\n  const facts: ExplanationFactView[] = [];\n  const codeBlocks: ExplanationCodeBlockView[] = [];\n  const seenValues = new Set<string>();\n  const byId = new Map(nodes.map((node) => [node.id, node]));\n\n  // A schedule rollup's own columns (`__central_progress`, …) are internal:\n  // the schedule section shows its contributors.\n  const rollupColumns = new Set<number>();\n  for (const node of nodes) {\n    if (node.kind === 'semantic') {\n      node.children.forEach((child) => rollupColumns.add(child));\n    }\n  }\n\n  for (const node of nodes) {\n    if (rollupColumns.has(node.id)) {\n      continue;\n    }\n    const root = node.id === document.rootNodeId;\n    switch (node.kind) {\n      case 'input':\n      case 'semantic': {\n        if (!equation) {\n          // A native method's observed facts.\n          facts.push({\n            label:\n              serverText(node.labelKey, ctx) ??\n              ctx.translate(`${K}.generic.fact`),\n            data: toExplanationData(node.value, ctx),\n          });\n          break;\n        }\n        if (Array.isArray(node.value) || root) break;\n        if (\n          node.kind === 'semantic' &&\n          scheduleDetailOf(document, node.reference)\n        ) {\n          break;\n        }\n        const item = {\n          label: nodeLabel(node, ctx),\n          value: nodeValueText(node, ctx),\n        };\n        const key = `${item.label}\\u0000${item.value}`;\n        if (!seenValues.has(key)) {\n          seenValues.add(key);\n          values.push(item);\n        }\n        break;\n      }\n      case 'function':\n      case 'conditional': {\n        const name = functionName(node);\n        if (\n          root ||\n          !equation ||\n          document.provider === 'codeBuilder' ||\n          PREDICATES.has(name) ||\n          name === 'TODAY' ||\n          node.state === 'notEvaluated'\n        ) {\n          break;\n        }\n        const segments = buildExplanationSegments(\n          document,\n          ctx,\n          'labels',\n          node.id,\n        );\n        if (segments?.length) {\n          steps.push({\n            segments: capitalizeSegments(segments),\n            result: formatTypedValue(node.value, null, ctx),\n          });\n        }\n        break;\n      }\n      case 'codeBlock': {\n        const raw = byId.get(node.children[0]);\n        const value = formatTypedValue(node.value, null, ctx);\n        const rawText =\n          raw && raw.value !== undefined\n            ? formatTypedValue(raw.value, null, ctx)\n            : null;\n        codeBlocks.push({\n          type: CODE_BLOCK_TYPES.has(node.operation ?? '')\n            ? ctx.translate(`${K}.codeBlock.${node.operation}`)\n            : ctx.translate(`${K}.generic.codePart`),\n          value,\n          raw: rawText !== null && rawText !== value ? rawText : null,\n        });\n        break;\n      }\n      default:\n        break;\n    }\n  }\n\n  return {\n    // A status's rules section says how rules are chosen.\n    description:\n      equation || document.statusRules?.length\n        ? null\n        : describeDocument(document, ctx),\n    values,\n    records: equation ? recordTables(document, rollupColumns, ctx) : [],\n    steps,\n    statusRules: toStatusRuleViews(document, ctx, statusNames),\n    schedule: (document.schedule ?? []).map((detail) =>\n      toScheduleView(\n        detail,\n        ctx,\n        // The rollup is the whole formula: the summary already names it.\n        byId.get(document.rootNodeId)?.reference === detail.reference,\n      ),\n    ),\n    codeBlocks,\n    facts,\n  };\n}\n\n/**\n * List inputs side by side by the rows they came from: `value[i]` belongs to\n * `recordIds[i]`, nulls and repeats included. Inputs whose ids don't line up\n * with their values are left out rather than guessed.\n */\nfunction recordTables(\n  document: CalculationExplanationDocument,\n  rollupColumns: Set<number>,\n  ctx: ExplanationFormatContext,\n): ExplanationRecordTableView[] {\n  const groups = new Map<\n    string,\n    { table: string; ids: number[]; columns: CalculationExplanationNode[] }\n  >();\n  for (const node of document.nodes ?? []) {\n    if (\n      node.kind !== 'input' ||\n      rollupColumns.has(node.id) ||\n      !Array.isArray(node.value) ||\n      !node.recordIds?.length ||\n      node.recordIds.length !== node.value.length\n    ) {\n      continue;\n    }\n    const table = referenceTable(node.reference) ?? '';\n    const key = `${table}|${node.recordIds.join(',')}`;\n    const group = groups.get(key) ?? {\n      table,\n      ids: node.recordIds,\n      columns: [],\n    };\n    if (!group.columns.some((column) => column.reference === node.reference)) {\n      group.columns.push(node);\n    }\n    groups.set(key, group);\n  }\n  return [...groups.values()].map((group) => ({\n    columns: group.columns.map((column) => nodeLabel(column, ctx)),\n    rows: group.ids.map((recordId, index) => {\n      // The source names the context of a row; its order is never used.\n      const source = (document.sources ?? []).find(\n        (item) =>\n          item.tablePath === group.table &&\n          !!item.contextKey &&\n          item.recordIds?.includes(recordId),\n      );\n      return {\n        ref: source?.contextKey\n          ? { contextKey: source.contextKey, recordId }\n          : null,\n        cells: group.columns.map((column) =>\n          formatTypedValue(\n            (column.value as CalculationExplanationValue[])[index],\n            nodeViewType(column),\n            ctx,\n          ),\n        ),\n      };\n    }),\n  }));\n}\n\n/** Whether the details have anything beyond the summary. */\nexport function hasExplanationDetails(view: ExplanationDetailsView): boolean {\n  return (\n    view.values.length > 0 ||\n    view.records.length > 0 ||\n    view.steps.length > 0 ||\n    view.statusRules.length > 0 ||\n    view.schedule.length > 0 ||\n    view.codeBlocks.length > 0 ||\n    view.facts.length > 0\n  );\n}\n\n/** Every record the details name, for one batch of name reads. */\nexport function detailRecordRefs(\n  view: ExplanationDetailsView,\n): CalculationRecordRef[] {\n  return [\n    ...view.records.flatMap((table) =>\n      table.rows\n        .map((row) => row.ref)\n        .filter((ref): ref is CalculationRecordRef => !!ref),\n    ),\n    ...view.schedule.flatMap((detail) =>\n      detail.contributors.map((row) => row.ref),\n    ),\n  ];\n}\n\n/**\n * The status a rule selects, by the name its property gives it. A status the\n * host has no name for reads as its key in words (`no_baseline` → `No\n * baseline`): a generic label would make every rule read the same.\n */\nexport function statusName(\n  key: string,\n  statusNames: Record<string, string>,\n): string {\n  return statusNames[key] || humanizeKey(key);\n}\n\n/** The rule that chose the status, if one did. */\nexport function selectedStatusRule(\n  document: CalculationExplanationDocument,\n): CalculationStatusRuleExplanation | null {\n  return document.statusRules?.find((rule) => rule.selected) ?? null;\n}\n\n/** Status rules in the order they are checked. */\nexport function orderedStatusRules(\n  document: CalculationExplanationDocument,\n): CalculationStatusRuleExplanation[] {\n  return (document.statusRules ?? []).slice().sort((a, b) => a.order - b.order);\n}\n\nfunction toStatusRuleViews(\n  document: CalculationExplanationDocument,\n  ctx: ExplanationFormatContext,\n  statusNames: Record<string, string>,\n): ExplanationStatusRuleView[] {\n  return orderedStatusRules(document).map((rule, index) => {\n    const result = rule.condition?.result;\n    const verdict: ExplanationStatusRuleView['verdict'] = rule.selected\n      ? 'selected'\n      : rule.state === 'failed'\n        ? 'failed'\n        : rule.state === 'notEvaluated'\n          ? 'notEvaluated'\n          : result === true\n            ? 'matched'\n            : result === false\n              ? 'notMatched'\n              : 'checked';\n    return {\n      key: rule.key,\n      name: statusName(rule.key, statusNames),\n      position: index + 1,\n      verdict,\n      // Each condition resolves its node ids within its own document.\n      segments:\n        rule.condition && rule.condition.status === 'available'\n          ? buildExplanationSegments(rule.condition, ctx, 'inline')\n          : null,\n      checks:\n        rule.condition && rule.condition.status === 'available'\n          ? buildConditionChecks(rule.condition, ctx)\n          : null,\n    };\n  });\n}\n\nfunction scheduleKind(reference: string): ExplanationScheduleView['kind'] {\n  const column = referenceColumn(reference);\n  return column === 'actual_progress'\n    ? 'actual'\n    : column === 'planned_progress'\n      ? 'planned'\n      : column === 'baseline_progress'\n        ? 'baseline'\n        : 'other';\n}\n\n/** Whether a rollup found no baseline at all, so its 0 is not a baseline. */\nexport function isMissingBaseline(\n  detail: ScheduleCalculationExplanation,\n): boolean {\n  return (detail.notes ?? []).includes('noBaselineProgressInputs');\n}\n\nfunction toScheduleView(\n  detail: ScheduleCalculationExplanation,\n  ctx: ExplanationFormatContext,\n  standalone = false,\n): ExplanationScheduleView {\n  const t = (key: string, params?: Record<string, unknown>) =>\n    ctx.translate(`${K}.schedule.${key}`, params);\n  const kind = scheduleKind(detail.reference);\n  const missingBaseline = isMissingBaseline(detail);\n  const contributors = detail.contributors ?? [];\n  // A summary lists only some items: its counts are the totals', never the\n  // list's length.\n  const summary = detail.summary ?? null;\n  const counted = summary\n    ? summary.includedContributors\n    : contributors.filter((row) => row.includedInAggregation).length;\n  const total = summary ? summary.totalContributors : contributors.length;\n\n  const aggregation = ['weightedAverage', 'arithmeticMean', 'empty'].includes(\n    detail.aggregation,\n  )\n    ? t(`aggregation.${detail.aggregation}`)\n    : null;\n  const weighting =\n    detail.weightMode === 'workingDays' ||\n    detail.weightMode === 'explicitWeight'\n      ? t(`weightMode.${detail.weightMode}`)\n      : null;\n\n  const semantic = semanticKey(detail.reference);\n\n  return {\n    kind,\n    standalone,\n    title: semantic\n      ? ctx.translate(`${K}.semantic.${semantic}`)\n      : ctx.translate(`${K}.generic.scheduleValue`),\n    meaning: kind === 'other' ? null : t(`meaning.${kind}`),\n    result: percent(detail.result),\n    // A standalone rollup's aggregation is already in the summary.\n    method: [standalone ? null : aggregation, weighting]\n      .filter((part) => !!part)\n      .join(' · '),\n    counted: t('counted', { counted, total }),\n    notes: (detail.notes ?? [])\n      .map((note) => (SCHEDULE_NOTES.has(note) ? t(`note.${note}`) : null))\n      .filter((note): note is string => !!note),\n    missingBaseline,\n    weightLabel:\n      detail.weightMode === 'workingDays' ? t('workingDays') : t('weight'),\n    listed: summary\n      ? t('listedOf', {\n          shown: summary.shownContributors,\n          total: summary.totalContributors,\n        })\n      : String(contributors.length),\n    contributors: contributors.map((row) =>\n      toContributorView(row, kind, missingBaseline, ctx),\n    ),\n    summary: summary\n      ? toScheduleSummaryView(detail, summary, kind, missingBaseline, ctx)\n      : null,\n  };\n}\n\n/** A total as a reader sees it: sums of decimals carry float noise. */\nfunction totalText(value: number): string {\n  return formatExplanationNumber(Math.round(value * 100) / 100);\n}\n\n/**\n * A large rollup's totals in words: `Sum of progress × weight ÷ Sum of\n * weights`, each with its value, then what was counted differently and the\n * share of each kind of item. The aggregate formula itself is never shown.\n */\nfunction toScheduleSummaryView(\n  detail: ScheduleCalculationExplanation,\n  summary: ScheduleCalculationSummary,\n  kind: ExplanationScheduleView['kind'],\n  missingBaseline: boolean,\n  ctx: ExplanationFormatContext,\n): ExplanationScheduleSummaryView {\n  const t = (key: string, params?: Record<string, unknown>) =>\n    ctx.translate(`${K}.schedule.${key}`, params);\n  const simple = detail.aggregation === 'arithmeticMean';\n  const weighted = detail.aggregation === 'weightedAverage';\n  // With a simple average the totals are the sum of progress and the number\n  // of items; weighted by working days, the weights are working days.\n  const terms = simple\n    ? ['progressSum', 'itemCount']\n    : detail.weightMode === 'workingDays'\n      ? ['workingDaysProgressSum', 'workingDaysSum']\n      : ['weightedProgressSum', 'weightSum'];\n\n  const counts: string[] = [];\n  if (summary.zeroWeightExcludedContributors > 0) {\n    counts.push(\n      t('summaryCount.zeroWeight', {\n        count: summary.zeroWeightExcludedContributors,\n      }),\n    );\n  }\n  if (summary.missingInputContributors > 0) {\n    counts.push(\n      t(\n        kind === 'baseline' || missingBaseline\n          ? 'summaryCount.missingBaseline'\n          : 'summaryCount.missingInput',\n        { count: summary.missingInputContributors },\n      ),\n    );\n  }\n\n  const groups = summary.byModule ?? [];\n  return {\n    listedItems: t('listedItems', { count: summary.shownContributors }),\n    totals:\n      (simple || weighted) && summary.weightTotal > 0\n        ? [\n            {\n              kind: 'term',\n              label: t(`totals.${terms[0]}`),\n              value: totalText(summary.weightedProgressTotal),\n            },\n            { kind: 'text', text: '÷' },\n            {\n              kind: 'term',\n              label: t(`totals.${terms[1]}`),\n              value: totalText(summary.weightTotal),\n            },\n          ]\n        : null,\n    counts,\n    // One kind of item only repeats the totals.\n    groups:\n      groups.length > 1\n        ? groups.map((group) => ({\n            type: ITEM_TYPES.has(group.moduleKey)\n              ? t(`itemType.${group.moduleKey}`)\n              : humanizeKey(group.moduleKey),\n            counted: t('listedOf', {\n              shown: group.includedContributors,\n              total: group.contributors,\n            }),\n            weight: simple ? null : totalText(group.weightTotal),\n            share: t('points', { value: totalText(group.resultContribution) }),\n          }))\n        : [],\n  };\n}\n\nfunction toContributorView(\n  row: ScheduleCalculationContributor,\n  kind: ExplanationScheduleView['kind'],\n  missingBaseline: boolean,\n  ctx: ExplanationFormatContext,\n): ExplanationContributorView {\n  const t = (key: string, params?: Record<string, unknown>) =>\n    ctx.translate(`${K}.schedule.${key}`, params);\n  const plan = row.plannedCalculation;\n  const start = plan?.plannedStart ?? row.plannedStart;\n  const finish = plan?.plannedFinish ?? row.plannedFinish;\n  const reason = !row.includedInAggregation\n    ? row.weight === 0\n      ? t('reason.zeroWeight')\n      : t('reason.notCounted')\n    : row.inputMissing\n      ? t(\n          kind === 'baseline' || missingBaseline\n            ? 'reason.missingBaseline'\n            : 'reason.missingInput',\n        )\n      : null;\n  return {\n    ref: { contextKey: row.contextKey ?? '', recordId: row.recordId },\n    type: ITEM_TYPES.has(row.moduleKey) ? t(`itemType.${row.moduleKey}`) : null,\n    progress:\n      row.inputMissing && (kind === 'baseline' || missingBaseline)\n        ? '—'\n        : percent(row.progress),\n    weight: formatExplanationNumber(row.weight),\n    counted: row.includedInAggregation,\n    reason,\n    planned: plan\n      ? {\n          dates:\n            start || finish\n              ? `${start ? ctx.formatDate(start, 'date') : '—'} – ${\n                  finish ? ctx.formatDate(finish, 'date') : '—'\n                }`\n              : null,\n          time:\n            plan.elapsedWorkingMinutes !== null &&\n            plan.totalWorkingMinutes !== null\n              ? t('workingHoursElapsed', {\n                  elapsed: formatExplanationNumber(\n                    Math.round((plan.elapsedWorkingMinutes / 60) * 100) / 100,\n                  ),\n                  total: formatExplanationNumber(\n                    Math.round((plan.totalWorkingMinutes / 60) * 100) / 100,\n                  ),\n                })\n              : null,\n        }\n      : null,\n  };\n}\n\n/** Minutes after midnight as `08:30`. */\nfunction clock(minutes: number): string {\n  const h = Math.floor(minutes / 60);\n  const m = minutes % 60;\n  return `${String(h).padStart(2, '0')}:${String(m).padStart(2, '0')}`;\n}\n","import type {\r\n  CalculationExplanationBasis,\r\n  CalculationExplanationDocument,\r\n  CalculationExplanationValue,\r\n  EntityCalculationExplanationTarget,\r\n} from './calculation-explanation.model';\r\nimport {\r\n  buildCodeSegments,\r\n  buildConditionChecks,\r\n  buildExplanationDetails,\r\n  buildExplanationSegments,\r\n  capitalizeSegments,\r\n  describeDocument,\r\n  formatTypedValue,\r\n  hasExplanationDetails,\r\n  isEquationDocument,\r\n  isMissingBaseline,\r\n  orderedStatusRules,\r\n  selectedStatusRule,\r\n  statusName,\r\n  type ExplanationCheckView,\r\n  type ExplanationDetailsView,\r\n  type ExplanationFormatContext,\r\n  type ExplanationSegment,\r\n} from './calculation-explanation-format';\r\n\r\n/**\r\n * An explanation the backend returned (`available`, or `summarized` for a\r\n * large schedule rollup), as the UI keeps it.\r\n */\r\nexport interface AvailableCalculationExplanation {\r\n  basis: CalculationExplanationBasis;\r\n  document: CalculationExplanationDocument;\r\n  definitionChanged: boolean;\r\n  /** The value on screen was older than the saved one and was re-read. */\r\n  refreshed: boolean;\r\n  viewType: string | undefined;\r\n}\r\n\r\n/** How the calculation reads in short, for the tooltip and the panel. */\r\nexport interface ExplanationSummaryView {\r\n  /** `Remaining = Budget − Spent`: the property, then the formula's shape. */\r\n  labels: ExplanationSegment[] | null;\r\n  /**\r\n   * `10,000 SAR − 125,454 SAR`: the captured values in that shape. Null when\r\n   * an input is a list of values; the panel lists them by record.\r\n   */\r\n  values: ExplanationSegment[] | null;\r\n  /** The calculation in words, when it is not a formula. */\r\n  description: string | null;\r\n  /** The status rule that set a status, by its place in the order. */\r\n  status: {\r\n    position: number;\r\n    total: number;\r\n    condition: ExplanationSegment[] | null;\r\n    /** The condition as the parts it required, each with whether it held. */\r\n    checks: ExplanationCheckView[] | null;\r\n  } | null;\r\n  noRuleMatched: boolean;\r\n  /** Records a list input read, when the values line can't show them. */\r\n  recordCount: number | null;\r\n}\r\n\r\nexport interface CalculationExplanationView {\r\n  basis: CalculationExplanationBasis;\r\n  calculatedAt: string;\r\n  result: string;\r\n  summary: ExplanationSummaryView;\r\n  definitionChanged: boolean;\r\n  refreshed: boolean;\r\n  /** A current calculation that differs from the value on the page. */\r\n  differs: { page: string; current: string } | null;\r\n  /** A baseline rollup found no baseline: its 0 is not an approved 0%. */\r\n  missingBaseline: boolean;\r\n  /**\r\n   * A summary of a large rollup: totals over every item, only some listed.\r\n   * `items` is how many items it covers, when the rollup says.\r\n   */\r\n  summarized: { items: number | null } | null;\r\n  details: ExplanationDetailsView;\r\n  hasDetails: boolean;\r\n}\r\n\r\n/** Everything both the tooltip and the details panel show. */\r\nexport function buildCalculationExplanationView(\r\n  explanation: AvailableCalculationExplanation,\r\n  target: EntityCalculationExplanationTarget,\r\n  ctx: ExplanationFormatContext,\r\n  statusNames: Record<string, string>,\r\n): CalculationExplanationView {\r\n  const { document, basis } = explanation;\r\n  const status = document.provider === 'status';\r\n  const result = status\r\n    ? statusName(String(document.result ?? ''), statusNames)\r\n    : formatTypedValue(document.result, explanation.viewType, ctx);\r\n  const summary = summarize(document, target, ctx);\r\n  const built = buildExplanationDetails(document, ctx, statusNames);\r\n  // The values line already shows every single value the formula used; the\r\n  // panel does not list them again.\r\n  const details = summary.values ? { ...built, values: [] } : built;\r\n  return {\r\n    basis,\r\n    calculatedAt: document.calculatedAt,\r\n    result,\r\n    summary,\r\n    definitionChanged: explanation.definitionChanged,\r\n    refreshed: explanation.refreshed,\r\n    // A current calculation is shown beside the value on the page, never in\r\n    // place of it: the page keeps what it read.\r\n    differs:\r\n      basis === 'currentCalculation' &&\r\n      !status &&\r\n      !isSameSavedValue(primitiveText(document.result), target.displayedValue)\r\n        ? {\r\n            page: formatTypedValue(\r\n              target.displayedValue ?? null,\r\n              explanation.viewType,\r\n              ctx,\r\n            ),\r\n            current: result,\r\n          }\r\n        : null,\r\n    missingBaseline: (document.schedule ?? []).some(isMissingBaseline),\r\n    summarized:\r\n      document.completeness === 'summary'\r\n        ? { items: summarizedItems(document) }\r\n        : null,\r\n    details,\r\n    hasDetails: hasExplanationDetails(details),\r\n  };\r\n}\r\n\r\nfunction summarize(\r\n  document: CalculationExplanationDocument,\r\n  target: EntityCalculationExplanationTarget,\r\n  ctx: ExplanationFormatContext,\r\n): ExplanationSummaryView {\r\n  const none: ExplanationSummaryView = {\r\n    labels: null,\r\n    values: null,\r\n    description: null,\r\n    status: null,\r\n    noRuleMatched: false,\r\n    recordCount: null,\r\n  };\r\n  if (document.provider === 'status' && document.statusRules?.length) {\r\n    const rules = orderedStatusRules(document);\r\n    const rule = selectedStatusRule(document);\r\n    return {\r\n      ...none,\r\n      status: rule\r\n        ? {\r\n            position: rules.indexOf(rule) + 1,\r\n            total: rules.length,\r\n            condition:\r\n              rule.condition?.status === 'available'\r\n                ? buildExplanationSegments(rule.condition, ctx, 'inline')\r\n                : null,\r\n            checks:\r\n              rule.condition?.status === 'available'\r\n                ? buildConditionChecks(rule.condition, ctx)\r\n                : null,\r\n          }\r\n        : null,\r\n      noRuleMatched: !rule,\r\n    };\r\n  }\r\n  if (document.provider === 'codeBuilder') {\r\n    const parts = buildCodeSegments(document, ctx);\r\n    if (parts.length) {\r\n      return { ...none, values: parts };\r\n    }\r\n  }\r\n  if (isEquationDocument(document)) {\r\n    const shape = buildExplanationSegments(document, ctx, 'labels');\r\n    if (shape?.length) {\r\n      const values = buildExplanationSegments(document, ctx, 'values');\r\n      return {\r\n        ...none,\r\n        labels: [\r\n          { kind: 'term', label: target.label, value: null },\r\n          { kind: 'text', text: '=' },\r\n          ...shape,\r\n        ],\r\n        values: values?.length ? capitalizeSegments(values) : null,\r\n        recordCount: values ? null : listedRecordCount(document),\r\n      };\r\n    }\r\n  }\r\n  // A native method, a schedule field or a manual status: the calculation\r\n  // in words, then its result.\r\n  return { ...none, description: describeDocument(document, ctx) };\r\n}\r\n\r\n/**\r\n * The items a summary covers, from the totals of its rollups (a status's are\r\n * in its rules). Rollups in one calculation read the same schedule, so the\r\n * largest count is the schedule's. Null when no rollup has totals, as with a\r\n * status that only counts baselines: its rules say how many rows they read.\r\n */\r\nfunction summarizedItems(\r\n  document: CalculationExplanationDocument,\r\n): number | null {\r\n  const rollups = [\r\n    ...(document.schedule ?? []),\r\n    ...(document.statusRules ?? []).flatMap(\r\n      (rule) => rule.condition?.schedule ?? [],\r\n    ),\r\n  ];\r\n  const counts = rollups\r\n    .map((detail) => detail.summary?.totalContributors ?? 0)\r\n    .filter((count) => count > 0);\r\n  return counts.length ? Math.max(...counts) : null;\r\n}\r\n\r\n/** Records the formula's list inputs read, counted once each. */\r\nfunction listedRecordCount(\r\n  document: CalculationExplanationDocument,\r\n): number | null {\r\n  const tables = new Map<string, Set<number>>();\r\n  for (const node of document.nodes ?? []) {\r\n    if (node.kind !== 'input' || !Array.isArray(node.value)) continue;\r\n    const table = (node.reference ?? '').split('::')[0];\r\n    const ids = tables.get(table) ?? new Set<number>();\r\n    (node.recordIds ?? []).forEach((id) => ids.add(id));\r\n    tables.set(table, ids);\r\n  }\r\n  const counts = [...tables.values()].map((ids) => ids.size);\r\n  return counts.length ? Math.max(...counts) : null;\r\n}\r\n\r\nfunction primitiveText(\r\n  value: CalculationExplanationValue | undefined,\r\n): string | null {\r\n  return value === null || value === undefined || typeof value === 'object'\r\n    ? null\r\n    : String(value);\r\n}\r\n\r\n/**\r\n * Whether the saved value is the one on screen. Both are the persisted string,\r\n * but a number may be written either way (`40` and `40.0`), so numbers compare\r\n * as numbers.\r\n */\r\nexport function isSameSavedValue(\r\n  saved: string | null | undefined,\r\n  displayed: string | undefined,\r\n): boolean {\r\n  const a = (saved ?? '').trim();\r\n  const b = (displayed ?? '').trim();\r\n  if (a === b) {\r\n    return true;\r\n  }\r\n  if (a === '' || b === '') {\r\n    return false;\r\n  }\r\n  const x = Number(a);\r\n  const y = Number(b);\r\n  return Number.isFinite(x) && Number.isFinite(y) && x === y;\r\n}\r\n","import { Signal } from '@angular/core';\r\nimport { toSignal } from '@angular/core/rxjs-interop';\r\nimport { TranslocoService } from '@jsverse/transloco';\r\n\r\n/**\r\n * One shared active-language signal per `TranslocoService`.\r\n *\r\n * `mt-entity-preview` renders once per property per record — a client-list card\r\n * grid mounts thousands of them — so a `toSignal(langChanges$)` inside each\r\n * instance would open thousands of subscriptions to the same Subject just to\r\n * read one global value. The language is global, so the signal is too: created\r\n * once, cached against the service, and shared by every entity that needs it.\r\n *\r\n * `manualCleanup` is deliberate. The cached signal outlives any single\r\n * component by design, and the service it hangs off is the root injector's —\r\n * tying its subscription to whichever entity happened to ask first would tear\r\n * it down the moment that entity scrolled out of view.\r\n */\r\nconst langSignals = new WeakMap<TranslocoService, Signal<string>>();\r\n\r\nexport function sharedActiveLang(transloco: TranslocoService): Signal<string> {\r\n  const cached = langSignals.get(transloco);\r\n  if (cached) {\r\n    return cached;\r\n  }\r\n\r\n  const lang = toSignal(transloco.langChanges$, {\r\n    initialValue: transloco.getActiveLang(),\r\n    manualCleanup: true,\r\n  });\r\n  langSignals.set(transloco, lang);\r\n  return lang;\r\n}\r\n","import { Signal, computed, inject } from '@angular/core';\r\nimport { TranslocoService } from '@jsverse/transloco';\r\nimport { MTDateFormatPipe } from '@masterteam/components';\r\nimport { sharedActiveLang } from '../active-lang';\r\nimport type { EntityCalculationExplanationTarget } from './calculation-explanation.model';\r\nimport {\r\n  MT_CALCULATION_CURRENCY,\r\n  MT_CALCULATION_STATUS_NAMES,\r\n  type ExplanationFormatContext,\r\n} from './calculation-explanation-format';\r\n\r\n/**\r\n * The formatting context of an explanation (language, currency, dates, text)\r\n * and the business names of the explained status property's statuses. Call\r\n * in an injection context of a component that provides `MTDateFormatPipe`.\r\n */\r\nexport function injectExplanationContext(\r\n  target: Signal<EntityCalculationExplanationTarget>,\r\n): {\r\n  context: Signal<ExplanationFormatContext>;\r\n  statusNames: Signal<Record<string, string>>;\r\n} {\r\n  const transloco = inject(TranslocoService);\r\n  const lang = sharedActiveLang(transloco);\r\n  const currency = inject(MT_CALCULATION_CURRENCY);\r\n  const namesOf = inject(MT_CALCULATION_STATUS_NAMES);\r\n  const datePipe = inject(MTDateFormatPipe);\r\n  return {\r\n    context: computed(() => ({\r\n      lang: lang(),\r\n      currency: currency(),\r\n      formatDate: (value, type) => datePipe.transform(value, type),\r\n      translate: (key, params) => transloco.translate(key, params),\r\n    })),\r\n    // The property's own names first; the value on screen fills a gap.\r\n    statusNames: computed(() => ({\r\n      ...(target().statusNames ?? {}),\r\n      ...namesOf(target().propertyKey, lang()),\r\n    })),\r\n  };\r\n}\r\n","import {\r\n  ChangeDetectionStrategy,\r\n  Component,\r\n  computed,\r\n  input,\r\n} from '@angular/core';\r\nimport type { ExplanationSegment } from './calculation-explanation-format';\r\n\r\n/** Pieces that hug their neighbour: `(a`, `a)`, `a,`, `f(a`. */\r\nconst OPENERS = /[([]$/;\r\nconst CLOSERS = /^[)\\],،]$/;\r\n\r\n/**\r\n * A readable equation: `Remaining = Budget − Spent`, or its values\r\n * `10,000 SAR − 125,454 SAR = −115,454 SAR`. It reads in the page's direction:\r\n * functions read as words (`sum of Amount where …`), and in Arabic those words\r\n * run right to left. Each term and value is isolated and kept whole, so a name\r\n * or an amount never breaks across lines or reorders with its neighbours.\r\n * Every piece is interpolated as text.\r\n */\r\n@Component({\r\n  selector: 'mt-calculation-explanation-equation',\r\n  changeDetection: ChangeDetectionStrategy.OnPush,\r\n  template: `\r\n    <div class=\"text-start break-words\">\r\n      @for (piece of pieces(); track $index) {\r\n        @switch (piece.segment.kind) {\r\n          @case ('term') {\r\n            <bdi class=\"inline-block max-w-full\"\r\n              ><span class=\"font-medium text-surface-900 dark:text-surface-0\">{{\r\n                piece.segment.label\r\n              }}</span>\r\n              @if (piece.segment.value !== null) {\r\n                <!-- The leading space lives inside the text node: Angular\r\n                     drops whitespace-only nodes between elements. -->\r\n                <span class=\"text-surface-500 dark:text-surface-400\">\r\n                  ({{ piece.segment.value }})</span\r\n                >\r\n              }\r\n            </bdi>\r\n          }\r\n          @case ('value') {\r\n            <bdi\r\n              class=\"inline-block max-w-full font-medium text-surface-800 tabular-nums dark:text-surface-100\"\r\n              >{{ piece.segment.text }}</bdi\r\n            >\r\n          }\r\n          @case ('result') {\r\n            <bdi\r\n              class=\"inline-block max-w-full text-surface-500 dark:text-surface-400\"\r\n              >→ {{ piece.segment.text }}</bdi\r\n            >\r\n          }\r\n          @case ('muted') {\r\n            <span class=\"text-surface-400 italic\">{{\r\n              piece.segment.text\r\n            }}</span>\r\n          }\r\n          @default {\r\n            <span class=\"text-surface-500 dark:text-surface-400\">{{\r\n              piece.segment.text\r\n            }}</span>\r\n          }\r\n        }\r\n        @if (piece.space) {\r\n          {{ ' ' }}\r\n        }\r\n      }\r\n      @if (result(); as value) {\r\n        <span class=\"text-surface-400\"> {{ resultOperator() }} </span>\r\n        <bdi\r\n          class=\"inline-block max-w-full font-semibold text-surface-900 tabular-nums dark:text-surface-0\"\r\n          >{{ value }}</bdi\r\n        >\r\n      }\r\n    </div>\r\n  `,\r\n})\r\nexport class CalculationExplanationEquation {\r\n  readonly segments = input.required<ExplanationSegment[]>();\r\n  /** Shown after the equation, behind `resultOperator`. */\r\n  readonly result = input<string | null>(null);\r\n  readonly resultOperator = input('=');\r\n\r\n  protected readonly pieces = computed(() => {\r\n    const segments = this.segments();\r\n    return segments.map((segment, index) => {\r\n      const next = segments[index + 1];\r\n      const text = segment.kind === 'text' ? segment.text : '';\r\n      const nextText = next?.kind === 'text' ? next.text : '';\r\n      return {\r\n        segment,\r\n        space: !!next && !OPENERS.test(text) && !CLOSERS.test(nextText),\r\n      };\r\n    });\r\n  });\r\n}\r\n","import { ChangeDetectionStrategy, Component, input } from '@angular/core';\r\nimport { NgTemplateOutlet } from '@angular/common';\r\nimport { TranslocoPipe } from '@jsverse/transloco';\r\nimport { CalculationExplanationEquation } from './calculation-explanation-equation';\r\nimport {\r\n  CALCULATION_EXPLANATION_KEYS,\r\n  type ExplanationCheckView,\r\n} from './calculation-explanation-format';\r\n\r\nconst MARKS: Record<\r\n  'met' | 'notMet' | 'notChecked',\r\n  { text: string; class: string }\r\n> = {\r\n  met: { text: '✓', class: 'bg-green-50 text-green-700' },\r\n  notMet: { text: '✗', class: 'bg-red-50 text-red-700' },\r\n  notChecked: {\r\n    text: '–',\r\n    class:\r\n      'bg-surface-100 text-surface-500 dark:bg-surface-800 dark:text-surface-400',\r\n  },\r\n};\r\n\r\n/**\r\n * A condition as a checklist: each part a rule requires on its own line,\r\n * marked met, not met, or not checked (a part evaluation never reached).\r\n * An `or` lists its options under \"At least one of\".\r\n */\r\n@Component({\r\n  selector: 'mt-calculation-explanation-checks',\r\n  changeDetection: ChangeDetectionStrategy.OnPush,\r\n  imports: [CalculationExplanationEquation, NgTemplateOutlet, TranslocoPipe],\r\n  template: `\r\n    <ng-template #list let-checks>\r\n      <ul class=\"flex flex-col gap-1\">\r\n        @for (check of checks; track $index) {\r\n          @let mark = markOf(check.met);\r\n          <li class=\"flex items-start gap-2\">\r\n            <span\r\n              class=\"mt-0.5 inline-flex size-4 shrink-0 items-center justify-center rounded-full text-[10px] leading-none font-bold\"\r\n              [class]=\"marks[mark].class\"\r\n              role=\"img\"\r\n              [attr.aria-label]=\"prefix + '.check.' + mark | transloco\"\r\n              >{{ marks[mark].text }}</span\r\n            >\r\n            <div class=\"flex min-w-0 flex-1 flex-col gap-1\">\r\n              @if (check.anyOf; as options) {\r\n                <span class=\"text-surface-600 dark:text-surface-300\">{{\r\n                  prefix + '.check.anyOf' | transloco\r\n                }}</span>\r\n                <ng-container\r\n                  [ngTemplateOutlet]=\"list\"\r\n                  [ngTemplateOutletContext]=\"{ $implicit: options }\"\r\n                />\r\n              } @else {\r\n                <mt-calculation-explanation-equation\r\n                  [segments]=\"check.segments\"\r\n                />\r\n              }\r\n            </div>\r\n          </li>\r\n        }\r\n      </ul>\r\n    </ng-template>\r\n    <ng-container\r\n      [ngTemplateOutlet]=\"list\"\r\n      [ngTemplateOutletContext]=\"{ $implicit: checks() }\"\r\n    />\r\n  `,\r\n})\r\nexport class CalculationExplanationChecks {\r\n  readonly checks = input.required<ExplanationCheckView[]>();\r\n\r\n  protected readonly prefix = CALCULATION_EXPLANATION_KEYS;\r\n  protected readonly marks = MARKS;\r\n\r\n  protected markOf(met: boolean | null): keyof typeof MARKS {\r\n    return met === null ? 'notChecked' : met ? 'met' : 'notMet';\r\n  }\r\n}\r\n","import { ChangeDetectionStrategy, Component, input } from '@angular/core';\r\nimport { TranslocoPipe } from '@jsverse/transloco';\r\nimport { CalculationExplanationChecks } from './calculation-explanation-checks';\r\nimport { CalculationExplanationEquation } from './calculation-explanation-equation';\r\nimport {\r\n  CALCULATION_EXPLANATION_KEYS,\r\n  type ExplanationSegment,\r\n} from './calculation-explanation-format';\r\nimport type { CalculationExplanationView } from './calculation-explanation-view';\r\n\r\n/**\r\n * The short form of an explanation: the result with its business reason\r\n * (`Remaining = Budget − Spent`, then `10,000 SAR − 125,454 SAR =\r\n * −115,454 SAR`), and the notices that change how to read it. Shown in the\r\n * tooltip and at the top of the details panel.\r\n */\r\n@Component({\r\n  selector: 'mt-calculation-explanation-summary',\r\n  changeDetection: ChangeDetectionStrategy.OnPush,\r\n  imports: [\r\n    CalculationExplanationChecks,\r\n    CalculationExplanationEquation,\r\n    TranslocoPipe,\r\n  ],\r\n  template: `\r\n    @let v = view();\r\n    <div class=\"flex flex-col gap-2\">\r\n      <div\r\n        class=\"flex flex-col gap-1.5 rounded-md border border-surface-200 bg-surface-50 px-3 py-2 text-surface-800 dark:border-surface-700 dark:bg-surface-800 dark:text-surface-100\"\r\n      >\r\n        @if (v.summary.status; as status) {\r\n          <bdi class=\"font-semibold text-surface-900 dark:text-surface-0\">{{\r\n            v.result\r\n          }}</bdi>\r\n          <span class=\"text-xs text-surface-500 dark:text-surface-400\">\r\n            {{\r\n              prefix + '.statusSelected'\r\n                | transloco: { position: status.position, total: status.total }\r\n            }}\r\n          </span>\r\n          @if (status.checks; as checks) {\r\n            <mt-calculation-explanation-checks\r\n              class=\"text-xs\"\r\n              [checks]=\"checks\"\r\n            />\r\n          } @else if (status.condition; as condition) {\r\n            <mt-calculation-explanation-equation\r\n              class=\"text-xs\"\r\n              [segments]=\"condition\"\r\n            />\r\n          }\r\n        } @else if (v.summary.noRuleMatched) {\r\n          <span>{{\r\n            prefix + '.noRuleMatched' | transloco: { status: v.result }\r\n          }}</span>\r\n        } @else {\r\n          @if (v.summary.labels; as labels) {\r\n            <mt-calculation-explanation-equation [segments]=\"labels\" />\r\n          }\r\n          @if (v.summary.description; as description) {\r\n            <p class=\"break-words\">{{ description }}</p>\r\n          }\r\n          @if (v.summary.values; as values) {\r\n            <mt-calculation-explanation-equation\r\n              [segments]=\"values\"\r\n              [result]=\"v.result\"\r\n            />\r\n          } @else {\r\n            <mt-calculation-explanation-equation\r\n              [segments]=\"empty\"\r\n              [result]=\"v.result\"\r\n            />\r\n          }\r\n          @if (v.summary.recordCount; as count) {\r\n            <span class=\"text-xs text-surface-500 dark:text-surface-400\">{{\r\n              prefix + '.recordsUsed' | transloco: { count }\r\n            }}</span>\r\n          }\r\n        }\r\n      </div>\r\n      <!-- Never read as the full list: the totals cover every item, the\r\n           details list only some. Only where those details are shown. -->\r\n      @if (summaryNotice() && v.summarized; as summarized) {\r\n        <div\r\n          class=\"rounded-md border border-primary-200 bg-primary-50 px-3 py-2 text-xs text-primary-700\"\r\n        >\r\n          @if (summarized.items; as count) {\r\n            {{ prefix + '.summarized' | transloco: { count } }}\r\n          } @else {\r\n            {{ prefix + '.summarizedGeneric' | transloco }}\r\n          }\r\n        </div>\r\n      }\r\n      @if (v.missingBaseline) {\r\n        <div\r\n          class=\"rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-700\"\r\n        >\r\n          {{ prefix + '.missingBaseline' | transloco }}\r\n        </div>\r\n      }\r\n      @if (v.differs; as differs) {\r\n        <div\r\n          class=\"rounded-md border border-primary-200 bg-primary-50 px-3 py-2 text-xs text-primary-700\"\r\n        >\r\n          {{ prefix + '.differsFromPage' | transloco: differs }}\r\n        </div>\r\n      }\r\n      @if (v.definitionChanged) {\r\n        <div\r\n          class=\"rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-700\"\r\n        >\r\n          {{ prefix + '.definitionChanged' | transloco }}\r\n        </div>\r\n      }\r\n      @if (v.refreshed) {\r\n        <div\r\n          class=\"rounded-md border border-primary-200 bg-primary-50 px-3 py-2 text-xs text-primary-700\"\r\n        >\r\n          {{ prefix + '.valueRefreshed' | transloco }}\r\n        </div>\r\n      }\r\n    </div>\r\n  `,\r\n})\r\nexport class CalculationExplanationSummary {\r\n  readonly view = input.required<CalculationExplanationView>();\r\n  /**\r\n   * Whether to say a summarized calculation is a summary. The details panel\r\n   * does, above the totals and the few items it lists; the tooltip does not.\r\n   */\r\n  readonly summaryNotice = input(false);\r\n\r\n  protected readonly prefix = CALCULATION_EXPLANATION_KEYS;\r\n  protected readonly empty: ExplanationSegment[] = [];\r\n}\r\n","import { ChangeDetectionStrategy, Component, input } from '@angular/core';\r\nimport { Icon } from '@masterteam/icons';\r\n\r\n/**\r\n * A part of the details panel the reader can fold: its title (and a count)\r\n * always shows, its content only when open. A native `<details>`, so it\r\n * works with the keyboard and screen readers without any state here; `open`\r\n * only sets how it starts.\r\n */\r\n@Component({\r\n  selector: 'mt-calculation-explanation-section',\r\n  changeDetection: ChangeDetectionStrategy.OnPush,\r\n  imports: [Icon],\r\n  template: `\r\n    <details\r\n      class=\"group rounded-md border border-surface-200 dark:border-surface-700\"\r\n      [open]=\"open()\"\r\n    >\r\n      <summary\r\n        class=\"flex cursor-pointer list-none items-center gap-2 rounded-md px-3 py-2 select-none hover:bg-surface-50 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary-500 dark:hover:bg-surface-800 [&::-webkit-details-marker]:hidden\"\r\n      >\r\n        <mt-icon\r\n          icon=\"arrow.chevron-right\"\r\n          size=\"xs\"\r\n          class=\"shrink-0 text-surface-500 transition-transform group-open:rotate-90 rtl:rotate-180 dark:text-surface-400\"\r\n        />\r\n        <span\r\n          class=\"min-w-0 flex-1 font-semibold text-surface-900 dark:text-surface-0\"\r\n          >{{ title() }}</span\r\n        >\r\n        @if (aside(); as text) {\r\n          <span\r\n            class=\"shrink-0 text-xs text-surface-500 tabular-nums dark:text-surface-400\"\r\n            >{{ text }}</span\r\n          >\r\n        }\r\n      </summary>\r\n      <div\r\n        class=\"flex flex-col gap-2 border-t border-surface-200 px-3 py-2 dark:border-surface-700\"\r\n      >\r\n        <ng-content />\r\n      </div>\r\n    </details>\r\n  `,\r\n})\r\nexport class CalculationExplanationSection {\r\n  readonly title = input.required<string>();\r\n  /** Shown at the end of the title row: a count or a result. */\r\n  readonly aside = input<string | null>(null);\r\n  /** Whether it starts open. */\r\n  readonly open = input(false);\r\n}\r\n","import { ChangeDetectionStrategy, Component, input } from '@angular/core';\r\nimport { NgTemplateOutlet } from '@angular/common';\r\nimport { TranslocoPipe } from '@jsverse/transloco';\r\nimport { Icon } from '@masterteam/icons';\r\nimport { CalculationExplanationChecks } from './calculation-explanation-checks';\r\nimport { CalculationExplanationEquation } from './calculation-explanation-equation';\r\nimport { CalculationExplanationSection } from './calculation-explanation-section';\r\nimport {\r\n  CALCULATION_EXPLANATION_KEYS,\r\n  type ExplanationDetailsView,\r\n} from './calculation-explanation-format';\r\nimport { calculationRecordKey } from './calculation-explanation.service';\r\nimport type { CalculationRecordRef } from './calculation-explanation.model';\r\n\r\n/** Lists up to this many rows start open; longer ones start folded. */\r\nconst OPEN_ROWS = 10;\r\n\r\n/**\r\n * The detailed part of an explanation, shown in its side panel below the\r\n * summary. Each part folds, so a long status or schedule reads as a short\r\n * list of titles first: records behind list inputs (by name), intermediate\r\n * results, status rules (one row each, opening to their checklist), schedule\r\n * rollups with their items (a large one in totals, with only its\r\n * highest-weight items listed), generated-code parts\r\n * and native facts. Everything is the backend's captured data in business\r\n * wording; nothing is recalculated here.\r\n */\r\n@Component({\r\n  selector: 'mt-calculation-explanation-details',\r\n  changeDetection: ChangeDetectionStrategy.OnPush,\r\n  imports: [\r\n    CalculationExplanationChecks,\r\n    CalculationExplanationEquation,\r\n    CalculationExplanationSection,\r\n    Icon,\r\n    NgTemplateOutlet,\r\n    TranslocoPipe,\r\n  ],\r\n  template: `\r\n    <!-- A record by its title, a placeholder while titles are read, or a\r\n         generic label; never its id. -->\r\n    <ng-template #recordName let-ref let-n=\"n\">\r\n      @if (recordNames() === null) {\r\n        <span\r\n          class=\"inline-block h-3 w-24 animate-pulse rounded-md bg-surface-100 align-middle dark:bg-surface-800\"\r\n          aria-busy=\"true\"\r\n        ></span>\r\n      } @else {\r\n        <bdi class=\"break-words\">{{ nameOf(ref, n) }}</bdi>\r\n      }\r\n    </ng-template>\r\n\r\n    <ng-template #dataTpl let-data>\r\n      @switch (data.kind) {\r\n        @case ('text') {\r\n          <bdi class=\"break-words\">{{ data.text }}</bdi>\r\n        }\r\n        @case ('list') {\r\n          <bdi class=\"break-words\">{{ data.items.join(', ') }}</bdi>\r\n        }\r\n        @case ('table') {\r\n          <div class=\"overflow-x-auto\">\r\n            <table class=\"w-full text-xs tabular-nums\">\r\n              <thead>\r\n                <tr class=\"text-surface-500 dark:text-surface-400\">\r\n                  @for (column of data.columns; track $index) {\r\n                    <th class=\"px-2 py-1 text-start font-medium\">\r\n                      {{ column }}\r\n                    </th>\r\n                  }\r\n                </tr>\r\n              </thead>\r\n              <tbody>\r\n                @for (row of data.rows; track $index) {\r\n                  <tr\r\n                    class=\"border-t border-surface-200 dark:border-surface-700\"\r\n                  >\r\n                    @for (cell of row; track $index) {\r\n                      <td class=\"px-2 py-1 align-top break-words\">\r\n                        <bdi>{{ cell }}</bdi>\r\n                      </td>\r\n                    }\r\n                  </tr>\r\n                }\r\n              </tbody>\r\n            </table>\r\n            @if (data.more > 0) {\r\n              <p class=\"mt-1 text-surface-500 dark:text-surface-400\">\r\n                {{ prefix + '.moreRows' | transloco: { count: data.more } }}\r\n              </p>\r\n            }\r\n          </div>\r\n        }\r\n        @case ('fields') {\r\n          <dl\r\n            class=\"grid grid-cols-[minmax(0,auto)_minmax(0,1fr)] gap-x-3 gap-y-1\"\r\n          >\r\n            @for (field of data.fields; track $index) {\r\n              <dt class=\"text-surface-500 dark:text-surface-400\">\r\n                {{ field.label }}\r\n              </dt>\r\n              <dd class=\"ms-0 min-w-0\">\r\n                <ng-container\r\n                  [ngTemplateOutlet]=\"dataTpl\"\r\n                  [ngTemplateOutletContext]=\"{ $implicit: field.data }\"\r\n                />\r\n              </dd>\r\n            }\r\n          </dl>\r\n        }\r\n      }\r\n    </ng-template>\r\n\r\n    @let view = details();\r\n    <div\r\n      class=\"flex flex-col gap-3 text-sm text-surface-700 dark:text-surface-200\"\r\n    >\r\n      @if (view.description) {\r\n        <p>{{ view.description }}</p>\r\n      }\r\n\r\n      @if (view.values.length) {\r\n        <mt-calculation-explanation-section\r\n          [title]=\"prefix + '.valuesUsed' | transloco\"\r\n          [aside]=\"'' + view.values.length\"\r\n          [open]=\"true\"\r\n        >\r\n          <dl class=\"grid grid-cols-[minmax(0,1fr)_auto] gap-x-4 gap-y-1\">\r\n            @for (item of view.values; track $index) {\r\n              <dt class=\"min-w-0 break-words\">\r\n                <bdi>{{ item.label }}</bdi>\r\n              </dt>\r\n              <dd class=\"ms-0 text-end font-medium tabular-nums\">\r\n                <bdi>{{ item.value }}</bdi>\r\n              </dd>\r\n            }\r\n          </dl>\r\n        </mt-calculation-explanation-section>\r\n      }\r\n\r\n      @for (table of view.records; track $index) {\r\n        <mt-calculation-explanation-section\r\n          [title]=\"prefix + '.contributingRecords' | transloco\"\r\n          [aside]=\"'' + table.rows.length\"\r\n          [open]=\"table.rows.length <= openRows\"\r\n        >\r\n          <div class=\"overflow-x-auto\">\r\n            <table class=\"w-full tabular-nums\">\r\n              <thead>\r\n                <tr class=\"text-xs text-surface-500 dark:text-surface-400\">\r\n                  <th class=\"py-1 pe-3 text-start font-medium\">\r\n                    {{ prefix + '.record' | transloco }}\r\n                  </th>\r\n                  @for (column of table.columns; track $index) {\r\n                    <th class=\"py-1 ps-3 text-end font-medium\">\r\n                      {{ column }}\r\n                    </th>\r\n                  }\r\n                </tr>\r\n              </thead>\r\n              <tbody>\r\n                @for (row of table.rows; track $index; let n = $index) {\r\n                  <tr\r\n                    class=\"border-t border-surface-200 dark:border-surface-700\"\r\n                  >\r\n                    <td class=\"py-1.5 pe-3 break-words\">\r\n                      <ng-container\r\n                        [ngTemplateOutlet]=\"recordName\"\r\n                        [ngTemplateOutletContext]=\"{ $implicit: row.ref, n }\"\r\n                      />\r\n                    </td>\r\n                    @for (cell of row.cells; track $index) {\r\n                      <td class=\"py-1.5 ps-3 text-end\">\r\n                        <bdi>{{ cell }}</bdi>\r\n                      </td>\r\n                    }\r\n                  </tr>\r\n                }\r\n              </tbody>\r\n            </table>\r\n          </div>\r\n        </mt-calculation-explanation-section>\r\n      }\r\n\r\n      @if (view.steps.length) {\r\n        <mt-calculation-explanation-section\r\n          [title]=\"prefix + '.steps' | transloco\"\r\n          [aside]=\"'' + view.steps.length\"\r\n        >\r\n          <ul class=\"flex flex-col gap-1.5\">\r\n            @for (step of view.steps; track $index) {\r\n              <li>\r\n                <mt-calculation-explanation-equation\r\n                  [segments]=\"step.segments\"\r\n                  [result]=\"step.result\"\r\n                />\r\n              </li>\r\n            }\r\n          </ul>\r\n        </mt-calculation-explanation-section>\r\n      }\r\n\r\n      @if (view.statusRules.length) {\r\n        <mt-calculation-explanation-section\r\n          [title]=\"prefix + '.statusRules' | transloco\"\r\n          [aside]=\"'' + view.statusRules.length\"\r\n          [open]=\"true\"\r\n        >\r\n          <!-- One row per rule, in the order they are checked; a row opens\r\n               to the parts its condition required. -->\r\n          <ol class=\"flex flex-col gap-1\">\r\n            @for (rule of view.statusRules; track rule.key) {\r\n              <li>\r\n                <details\r\n                  class=\"group/rule rounded-md\"\r\n                  [class]=\"\r\n                    rule.verdict === 'selected'\r\n                      ? 'bg-primary-50 dark:bg-primary-950'\r\n                      : ''\r\n                  \"\r\n                >\r\n                  <summary\r\n                    class=\"flex cursor-pointer list-none items-center gap-2 rounded-md px-2 py-1.5 select-none hover:bg-surface-50 focus-visible:outline-2 focus-visible:outline-primary-500 dark:hover:bg-surface-800 [&::-webkit-details-marker]:hidden\"\r\n                  >\r\n                    <mt-icon\r\n                      icon=\"arrow.chevron-right\"\r\n                      size=\"xs\"\r\n                      class=\"shrink-0 text-surface-400 transition-transform group-open/rule:rotate-90 rtl:rotate-180\"\r\n                    />\r\n                    <span\r\n                      class=\"shrink-0 text-xs text-surface-500 tabular-nums dark:text-surface-400\"\r\n                      >{{ rule.position }}.</span\r\n                    >\r\n                    <bdi class=\"min-w-0 flex-1 font-medium\">{{\r\n                      rule.name\r\n                    }}</bdi>\r\n                    <span\r\n                      class=\"shrink-0 rounded-md px-1.5 py-0.5 text-xs\"\r\n                      [class]=\"verdictClass[rule.verdict]\"\r\n                    >\r\n                      {{ prefix + '.verdict.' + rule.verdict | transloco }}\r\n                    </span>\r\n                  </summary>\r\n                  <div class=\"px-2 pt-1 pb-2 ps-8\">\r\n                    @if (rule.checks; as checks) {\r\n                      <mt-calculation-explanation-checks\r\n                        class=\"text-xs\"\r\n                        [checks]=\"checks\"\r\n                      />\r\n                    } @else if (rule.segments; as segments) {\r\n                      <mt-calculation-explanation-equation\r\n                        class=\"text-xs\"\r\n                        [segments]=\"segments\"\r\n                      />\r\n                    }\r\n                  </div>\r\n                </details>\r\n              </li>\r\n            }\r\n          </ol>\r\n        </mt-calculation-explanation-section>\r\n      }\r\n\r\n      @for (detail of view.schedule; track $index) {\r\n        <section class=\"flex flex-col gap-2\">\r\n          <!-- A rollup that is the whole formula already heads the summary. -->\r\n          @if (!detail.standalone) {\r\n            <div class=\"flex items-baseline justify-between gap-3\">\r\n              <h3 class=\"font-semibold text-surface-900 dark:text-surface-0\">\r\n                {{ detail.title }}\r\n              </h3>\r\n              <bdi class=\"font-semibold tabular-nums\">{{ detail.result }}</bdi>\r\n            </div>\r\n          }\r\n          @if (detail.meaning) {\r\n            <p class=\"text-surface-500 dark:text-surface-400\">\r\n              {{ detail.meaning }}\r\n            </p>\r\n          }\r\n          <p>\r\n            @if (detail.method) {\r\n              {{ detail.method }} ·\r\n            }\r\n            <span class=\"font-medium\">{{ detail.counted }}</span>\r\n          </p>\r\n          @for (note of detail.notes; track $index) {\r\n            <div\r\n              class=\"rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-amber-700\"\r\n            >\r\n              {{ note }}\r\n            </div>\r\n          }\r\n          <!-- A large rollup: totals over every item, since only some are\r\n               listed below. -->\r\n          @if (detail.summary; as summary) {\r\n            <mt-calculation-explanation-section\r\n              [title]=\"scheduleKeys + '.totals.title' | transloco\"\r\n              [open]=\"true\"\r\n            >\r\n              @if (summary.totals; as totals) {\r\n                <mt-calculation-explanation-equation\r\n                  [segments]=\"totals\"\r\n                  [result]=\"detail.result\"\r\n                />\r\n              }\r\n              @for (count of summary.counts; track $index) {\r\n                <p class=\"text-xs text-surface-500 dark:text-surface-400\">\r\n                  {{ count }}\r\n                </p>\r\n              }\r\n              @if (summary.groups.length) {\r\n                <div class=\"overflow-x-auto\">\r\n                  <table class=\"w-full tabular-nums\">\r\n                    <thead>\r\n                      <tr\r\n                        class=\"text-xs text-surface-500 dark:text-surface-400\"\r\n                      >\r\n                        <th class=\"py-1 pe-3 text-start font-medium\">\r\n                          {{ scheduleKeys + '.type' | transloco }}\r\n                        </th>\r\n                        <th class=\"px-3 py-1 text-end font-medium\">\r\n                          {{ scheduleKeys + '.included' | transloco }}\r\n                        </th>\r\n                        @if (summary.groups[0].weight !== null) {\r\n                          <th class=\"px-3 py-1 text-end font-medium\">\r\n                            {{ detail.weightLabel }}\r\n                          </th>\r\n                        }\r\n                        <th class=\"py-1 ps-3 text-end font-medium\">\r\n                          {{ scheduleKeys + '.share' | transloco }}\r\n                        </th>\r\n                      </tr>\r\n                    </thead>\r\n                    <tbody>\r\n                      @for (group of summary.groups; track $index) {\r\n                        <tr\r\n                          class=\"border-t border-surface-200 dark:border-surface-700\"\r\n                        >\r\n                          <td class=\"py-1.5 pe-3\">\r\n                            <bdi>{{ group.type }}</bdi>\r\n                          </td>\r\n                          <td class=\"px-3 py-1.5 text-end\">\r\n                            <bdi>{{ group.counted }}</bdi>\r\n                          </td>\r\n                          @if (group.weight !== null) {\r\n                            <td class=\"px-3 py-1.5 text-end\">\r\n                              <bdi>{{ group.weight }}</bdi>\r\n                            </td>\r\n                          }\r\n                          <td class=\"py-1.5 ps-3 text-end\">\r\n                            <bdi>{{ group.share }}</bdi>\r\n                          </td>\r\n                        </tr>\r\n                      }\r\n                    </tbody>\r\n                  </table>\r\n                </div>\r\n              }\r\n            </mt-calculation-explanation-section>\r\n          }\r\n          @if (detail.contributors.length) {\r\n            <mt-calculation-explanation-section\r\n              [title]=\"scheduleKeys + '.items' | transloco\"\r\n              [aside]=\"detail.listed\"\r\n              [open]=\"detail.contributors.length <= openRows\"\r\n            >\r\n              @if (detail.summary; as summary) {\r\n                <p class=\"text-xs text-surface-500 dark:text-surface-400\">\r\n                  {{ summary.listedItems }}\r\n                </p>\r\n              }\r\n              <div class=\"overflow-x-auto\">\r\n                <table class=\"w-full tabular-nums\">\r\n                  <thead>\r\n                    <tr class=\"text-xs text-surface-500 dark:text-surface-400\">\r\n                      <th class=\"py-1 pe-3 text-start font-medium\">\r\n                        {{ scheduleKeys + '.item' | transloco }}\r\n                      </th>\r\n                      <th class=\"px-3 py-1 text-end font-medium\">\r\n                        {{\r\n                          scheduleKeys +\r\n                            (detail.kind === 'planned'\r\n                              ? '.expected'\r\n                              : '.progress') | transloco\r\n                        }}\r\n                      </th>\r\n                      <th class=\"px-3 py-1 text-end font-medium\">\r\n                        {{ detail.weightLabel }}\r\n                      </th>\r\n                      <th class=\"py-1 ps-3 text-start font-medium\">\r\n                        {{ scheduleKeys + '.included' | transloco }}\r\n                      </th>\r\n                    </tr>\r\n                  </thead>\r\n                  <tbody>\r\n                    @for (\r\n                      row of detail.contributors;\r\n                      track $index;\r\n                      let n = $index\r\n                    ) {\r\n                      <tr\r\n                        class=\"border-t border-surface-200 align-top dark:border-surface-700\"\r\n                      >\r\n                        <td class=\"py-1.5 pe-3\">\r\n                          <div class=\"flex flex-col gap-0.5\">\r\n                            <ng-container\r\n                              [ngTemplateOutlet]=\"recordName\"\r\n                              [ngTemplateOutletContext]=\"{\r\n                                $implicit: row.ref,\r\n                                n,\r\n                              }\"\r\n                            />\r\n                            @if (row.type || row.planned) {\r\n                              <span\r\n                                class=\"text-xs text-surface-500 dark:text-surface-400\"\r\n                              >\r\n                                {{ row.type }}\r\n                                @if (row.planned; as planned) {\r\n                                  @if (row.type) {\r\n                                    ·\r\n                                  }\r\n                                  <bdi>{{ planned.dates }}</bdi>\r\n                                }\r\n                              </span>\r\n                            }\r\n                          </div>\r\n                        </td>\r\n                        <td class=\"px-3 py-1.5 text-end\">\r\n                          <bdi>{{ row.progress }}</bdi>\r\n                          @if (row.planned?.time; as time) {\r\n                            <div\r\n                              class=\"text-xs text-surface-500 dark:text-surface-400\"\r\n                            >\r\n                              <bdi>{{ time }}</bdi>\r\n                            </div>\r\n                          }\r\n                        </td>\r\n                        <td class=\"px-3 py-1.5 text-end\">\r\n                          <bdi>{{ row.weight }}</bdi>\r\n                        </td>\r\n                        <td class=\"py-1.5 ps-3\">\r\n                          @if (row.counted && !row.reason) {\r\n                            <mt-icon\r\n                              icon=\"general.check\"\r\n                              size=\"xs\"\r\n                              class=\"text-green-700\"\r\n                              [attr.aria-label]=\"prefix + '.yes' | transloco\"\r\n                            />\r\n                          } @else {\r\n                            <span\r\n                              class=\"text-xs\"\r\n                              [class]=\"\r\n                                row.counted\r\n                                  ? 'text-surface-600 dark:text-surface-300'\r\n                                  : 'text-surface-500 dark:text-surface-400'\r\n                              \"\r\n                              >{{ row.reason }}</span\r\n                            >\r\n                          }\r\n                        </td>\r\n                      </tr>\r\n                    }\r\n                  </tbody>\r\n                </table>\r\n              </div>\r\n            </mt-calculation-explanation-section>\r\n          }\r\n        </section>\r\n      }\r\n\r\n      @if (view.codeBlocks.length) {\r\n        <mt-calculation-explanation-section\r\n          [title]=\"prefix + '.codeBlocks' | transloco\"\r\n          [aside]=\"'' + view.codeBlocks.length\"\r\n          [open]=\"true\"\r\n        >\r\n          <ol class=\"flex flex-col gap-1\">\r\n            @for (block of view.codeBlocks; track $index) {\r\n              <li class=\"flex items-baseline justify-between gap-3\">\r\n                <span class=\"text-surface-500 dark:text-surface-400\">{{\r\n                  block.type\r\n                }}</span>\r\n                <span class=\"flex flex-col items-end\">\r\n                  <bdi class=\"font-medium\">{{ block.value }}</bdi>\r\n                  @if (block.raw !== null) {\r\n                    <span\r\n                      class=\"text-xs text-surface-500 dark:text-surface-400\"\r\n                    >\r\n                      {{\r\n                        prefix + '.codeBlockBefore'\r\n                          | transloco: { value: block.raw }\r\n                      }}\r\n                    </span>\r\n                  }\r\n                </span>\r\n              </li>\r\n            }\r\n          </ol>\r\n        </mt-calculation-explanation-section>\r\n      }\r\n\r\n      @for (fact of view.facts; track $index) {\r\n        <mt-calculation-explanation-section\r\n          [title]=\"fact.label\"\r\n          [open]=\"view.facts.length === 1\"\r\n        >\r\n          <ng-container\r\n            [ngTemplateOutlet]=\"dataTpl\"\r\n            [ngTemplateOutletContext]=\"{ $implicit: fact.data }\"\r\n          />\r\n        </mt-calculation-explanation-section>\r\n      }\r\n    </div>\r\n  `,\r\n})\r\nexport class CalculationExplanationDetails {\r\n  readonly details = input.required<ExplanationDetailsView>();\r\n  /** Record titles by `calculationRecordKey`; `null` while they are read. */\r\n  readonly recordNames = input<Record<string, string> | null>({});\r\n  /** Generic labels for records without a readable title, by position. */\r\n  readonly fallbackLabel = input<(position: number) => string>((position) =>\r\n    String(position),\r\n  );\r\n\r\n  protected readonly prefix = CALCULATION_EXPLANATION_KEYS;\r\n  protected readonly scheduleKeys = `${CALCULATION_EXPLANATION_KEYS}.schedule`;\r\n  protected readonly openRows = OPEN_ROWS;\r\n  protected readonly verdictClass: Record<string, string> = {\r\n    selected: 'bg-primary-100 text-primary-700',\r\n    matched: 'bg-green-50 text-green-700',\r\n    notMatched: 'bg-surface-100 text-surface-600',\r\n    checked: 'bg-surface-100 text-surface-600',\r\n    failed: 'bg-red-50 text-red-700',\r\n    notEvaluated: 'bg-surface-100 text-surface-400',\r\n  };\r\n\r\n  /** A record by its title; never by its id. */\r\n  protected nameOf(ref: CalculationRecordRef | null, index: number): string {\r\n    const name = ref\r\n      ? this.recordNames()?.[calculationRecordKey(ref.contextKey, ref.recordId)]\r\n      : undefined;\r\n    return name || this.fallbackLabel()(index + 1);\r\n  }\r\n}\r\n","import {\r\n  ChangeDetectionStrategy,\r\n  Component,\r\n  DestroyRef,\r\n  OnInit,\r\n  computed,\r\n  inject,\r\n  input,\r\n  signal,\r\n} from '@angular/core';\r\nimport { TranslocoPipe, TranslocoService } from '@jsverse/transloco';\r\nimport { MTDateFormatPipe } from '@masterteam/components';\r\nimport type { EntityCalculationExplanationTarget } from './calculation-explanation.model';\r\nimport { CalculationRecordNames } from './calculation-explanation.service';\r\nimport {\r\n  CALCULATION_EXPLANATION_KEYS,\r\n  detailRecordRefs,\r\n} from './calculation-explanation-format';\r\nimport {\r\n  buildCalculationExplanationView,\r\n  type AvailableCalculationExplanation,\r\n} from './calculation-explanation-view';\r\nimport { injectExplanationContext } from './calculation-explanation-context';\r\nimport { CalculationExplanationSummary } from './calculation-explanation-summary';\r\nimport { CalculationExplanationDetails } from './calculation-explanation-details';\r\n\r\n/**\r\n * The full explanation of a calculated value, in a wide side panel opened from\r\n * its tooltip: the result and reason, then the values, contributing records by\r\n * name, status rules, schedule rollups and their calendar.\r\n *\r\n * Created through `ModalService`, so it is built with the root injector and\r\n * its inputs arrive through `inputValues`: it takes the explanation the\r\n * tooltip already read and only reads the names of the records it shows.\r\n */\r\n@Component({\r\n  selector: 'mt-calculation-explanation-panel',\r\n  changeDetection: ChangeDetectionStrategy.OnPush,\r\n  imports: [\r\n    TranslocoPipe,\r\n    MTDateFormatPipe,\r\n    CalculationExplanationSummary,\r\n    CalculationExplanationDetails,\r\n  ],\r\n  providers: [MTDateFormatPipe],\r\n  // `h-full` lets the drawer's content area scroll this panel; see\r\n  // `EntityListDrawer`. The drawer pads only its header (`px-5`): content\r\n  // that owns its scroll pads itself to line up with it.\r\n  host: { class: 'block h-full' },\r\n  template: `\r\n    @let v = view();\r\n    <div class=\"flex h-full flex-col gap-4 overflow-y-auto p-5 text-sm\">\r\n      <!-- One line: when, and on what basis only when it is not the saved\r\n           value (the drawer's title already names the value). -->\r\n      <span class=\"text-xs text-surface-500 dark:text-surface-400\">\r\n        @if (v.basis === 'currentCalculation') {\r\n          {{ prefix + '.currentTitle' | transloco }} ·\r\n          {{ prefix + '.currentCalculatedAt' | transloco }}\r\n        } @else {\r\n          {{ prefix + '.calculatedAt' | transloco }}\r\n        }\r\n        <bdi class=\"tabular-nums\">{{\r\n          v.calculatedAt | mtDateFormat: 'dateTime'\r\n        }}</bdi>\r\n      </span>\r\n      <mt-calculation-explanation-summary [view]=\"v\" [summaryNotice]=\"true\" />\r\n      <mt-calculation-explanation-details\r\n        [details]=\"v.details\"\r\n        [recordNames]=\"recordNames()\"\r\n        [fallbackLabel]=\"fallbackLabel\"\r\n      />\r\n    </div>\r\n  `,\r\n})\r\nexport class CalculationExplanationPanel implements OnInit {\r\n  readonly target = input.required<EntityCalculationExplanationTarget>();\r\n  readonly explanation = input.required<AvailableCalculationExplanation>();\r\n\r\n  private readonly names = inject(CalculationRecordNames);\r\n  private readonly transloco = inject(TranslocoService);\r\n  private readonly destroyRef = inject(DestroyRef);\r\n  private readonly explanationContext = injectExplanationContext(this.target);\r\n\r\n  protected readonly prefix = CALCULATION_EXPLANATION_KEYS;\r\n  /** Record titles, `null` while they are being read. */\r\n  protected readonly recordNames = signal<Record<string, string> | null>(null);\r\n  protected readonly view = computed(() =>\r\n    buildCalculationExplanationView(\r\n      this.explanation(),\r\n      this.target(),\r\n      this.explanationContext.context(),\r\n      this.explanationContext.statusNames(),\r\n    ),\r\n  );\r\n  protected readonly fallbackLabel = (position: number): string =>\r\n    this.transloco.translate(`${CALCULATION_EXPLANATION_KEYS}.recordFallback`, {\r\n      n: position,\r\n    });\r\n\r\n  // Names only: the explanation itself is never read again here.\r\n  ngOnInit(): void {\r\n    const refs = detailRecordRefs(this.view().details);\r\n    if (!refs.length) {\r\n      this.recordNames.set({});\r\n      return;\r\n    }\r\n    const subscription = this.names\r\n      .read(this.target().source, refs)\r\n      .subscribe((names) => this.recordNames.set(names));\r\n    this.destroyRef.onDestroy(() => subscription.unsubscribe());\r\n  }\r\n}\r\n","import {\r\n  ChangeDetectionStrategy,\r\n  Component,\r\n  DestroyRef,\r\n  OnInit,\r\n  computed,\r\n  inject,\r\n  input,\r\n  output,\r\n  signal,\r\n} from '@angular/core';\r\nimport { TranslocoPipe } from '@jsverse/transloco';\r\nimport { MTDateFormatPipe } from '@masterteam/components';\r\nimport { ModalService } from '@masterteam/components/modal';\r\nimport { Subscription } from 'rxjs';\r\nimport {\r\n  CalculationExplanationApi,\r\n  EntityCalculationRefresher,\r\n} from './calculation-explanation.service';\r\nimport type {\r\n  CalculationExplanationBasis,\r\n  CalculationExplanationResponse,\r\n  EntityCalculationExplanationTarget,\r\n} from './calculation-explanation.model';\r\nimport { CALCULATION_EXPLANATION_KEYS } from './calculation-explanation-format';\r\nimport {\r\n  buildCalculationExplanationView,\r\n  isSameSavedValue,\r\n  type AvailableCalculationExplanation,\r\n} from './calculation-explanation-view';\r\nimport { injectExplanationContext } from './calculation-explanation-context';\r\nimport { CalculationExplanationSummary } from './calculation-explanation-summary';\r\nimport { CalculationExplanationPanel } from './calculation-explanation-panel';\r\n\r\nconst KEY_PREFIX = CALCULATION_EXPLANATION_KEYS;\r\n\r\n/** Unavailable outcomes with their own message; anything else is generic. */\r\nconst UNAVAILABLE_KEYS: Record<string, string> = {\r\n  notCaptured: `${KEY_PREFIX}.notCaptured`,\r\n  unsupported: `${KEY_PREFIX}.unsupported`,\r\n  limitExceeded: `${KEY_PREFIX}.limitExceeded`,\r\n  restricted: `${KEY_PREFIX}.restricted`,\r\n  valueChanged: `${KEY_PREFIX}.valueChanged`,\r\n  notCalculated: `${KEY_PREFIX}.notCalculated`,\r\n};\r\n\r\nconst PROVIDERS = new Set([\r\n  'formula',\r\n  'status',\r\n  'nativeMethod',\r\n  'codeBuilder',\r\n  'schedule',\r\n]);\r\nconst BASES = new Set<string>(['savedCalculation', 'currentCalculation']);\r\n/**\r\n * Outcomes that carry an explanation. `summarized` is a large schedule\r\n * rollup: its document says it is a summary (`completeness`), and the view\r\n * labels it as one.\r\n */\r\nconst EXPLAINED = new Set<string>(['available', 'summarized']);\r\n\r\ntype ExplanationState =\r\n  | { kind: 'loading' }\r\n  | { kind: 'failed' }\r\n  | { kind: 'unavailable'; messageKey: string }\r\n  | ({ kind: 'available' } & AvailableCalculationExplanation);\r\n\r\n/**\r\n * How a calculated value was calculated, in short: the result with its\r\n * business reason (`Remaining = Budget − Spent`, then the values), when it was\r\n * calculated, and a way into the full details panel. Fetched each time it\r\n * opens; reading it never recalculates anything, and nothing here is\r\n * recalculated either.\r\n */\r\n@Component({\r\n  selector: 'mt-entity-calculation-explanation',\r\n  changeDetection: ChangeDetectionStrategy.OnPush,\r\n  imports: [TranslocoPipe, MTDateFormatPipe, CalculationExplanationSummary],\r\n  providers: [MTDateFormatPipe],\r\n  // A box, so its host can follow its size (the popover re-aligns on it).\r\n  host: { class: 'block' },\r\n  template: `\r\n    <!-- pb-1: the calculation time's text box is a pixel taller than its\r\n         line; without room for it the box showed a scrollbar for 1px. -->\r\n    <div\r\n      class=\"flex max-h-[70vh] w-80 max-w-[calc(100vw-2rem)] flex-col gap-3 overflow-y-auto pb-1 text-sm\"\r\n    >\r\n      <div class=\"flex min-w-0 flex-col gap-0.5\">\r\n        <span\r\n          class=\"truncate font-semibold text-surface-900 dark:text-surface-0\"\r\n        >\r\n          {{ target().label }}\r\n        </span>\r\n        <span class=\"text-xs text-surface-500 dark:text-surface-400\">\r\n          {{\r\n            prefix +\r\n              (available()?.basis === 'currentCalculation'\r\n                ? '.currentTitle'\r\n                : '.title') | transloco\r\n          }}\r\n        </span>\r\n      </div>\r\n\r\n      @switch (state().kind) {\r\n        @case ('loading') {\r\n          <div class=\"flex flex-col gap-2\" aria-busy=\"true\">\r\n            <div\r\n              class=\"h-10 animate-pulse rounded-md bg-surface-100 dark:bg-surface-800\"\r\n            ></div>\r\n            <div\r\n              class=\"h-3 w-1/2 animate-pulse rounded-md bg-surface-100 dark:bg-surface-800\"\r\n            ></div>\r\n          </div>\r\n        }\r\n        @case ('available') {\r\n          @if (view(); as v) {\r\n            <!-- No summary notice here: the details say what a summary\r\n                 lists; the tooltip stays short. -->\r\n            <mt-calculation-explanation-summary [view]=\"v\" />\r\n            <div\r\n              class=\"flex flex-wrap items-center justify-between gap-x-3 gap-y-1\"\r\n            >\r\n              <span class=\"text-xs text-surface-500 dark:text-surface-400\">\r\n                {{\r\n                  prefix +\r\n                    (v.basis === 'currentCalculation'\r\n                      ? '.currentCalculatedAt'\r\n                      : '.calculatedAt') | transloco\r\n                }}\r\n                <bdi class=\"tabular-nums\">{{\r\n                  v.calculatedAt | mtDateFormat: 'dateTime'\r\n                }}</bdi>\r\n              </span>\r\n              @if (v.hasDetails) {\r\n                <!-- ms-auto: at the end of the card even when it wraps under\r\n                     the calculation time. -->\r\n                <button\r\n                  type=\"button\"\r\n                  class=\"ms-auto cursor-pointer rounded-md text-xs font-medium text-primary-700 hover:underline focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary-500 dark:text-primary-300\"\r\n                  aria-haspopup=\"dialog\"\r\n                  (click)=\"openDetails()\"\r\n                >\r\n                  {{ prefix + '.showDetails' | transloco }}\r\n                </button>\r\n              }\r\n            </div>\r\n          }\r\n        }\r\n        @case ('unavailable') {\r\n          @if (unavailableKey(); as messageKey) {\r\n            <div\r\n              class=\"rounded-md border border-surface-200 bg-surface-50 px-3 py-2 text-surface-600 dark:border-surface-700 dark:bg-surface-800 dark:text-surface-300\"\r\n            >\r\n              {{ messageKey | transloco }}\r\n            </div>\r\n          }\r\n        }\r\n        @case ('failed') {\r\n          <div\r\n            class=\"rounded-md border border-red-200 bg-red-50 px-3 py-2 text-red-700\"\r\n          >\r\n            {{ prefix + '.loadFailed' | transloco }}\r\n          </div>\r\n        }\r\n      }\r\n    </div>\r\n  `,\r\n})\r\nexport class EntityCalculationExplanation implements OnInit {\r\n  private readonly api = inject(CalculationExplanationApi);\r\n  private readonly modal = inject(ModalService);\r\n  private readonly refresher = inject(EntityCalculationRefresher, {\r\n    optional: true,\r\n  });\r\n\r\n  readonly target = input.required<EntityCalculationExplanationTarget>();\r\n  /** The details panel opened; the host closes the tooltip under it. */\r\n  readonly detailsOpened = output<void>();\r\n\r\n  private readonly explanationContext = injectExplanationContext(this.target);\r\n\r\n  protected readonly prefix = KEY_PREFIX;\r\n  protected readonly state = signal<ExplanationState>({ kind: 'loading' });\r\n  protected readonly available = computed(() => {\r\n    const state = this.state();\r\n    return state.kind === 'available' ? state : null;\r\n  });\r\n  protected readonly unavailableKey = computed(() => {\r\n    const state = this.state();\r\n    return state.kind === 'unavailable' ? state.messageKey : null;\r\n  });\r\n\r\n  protected readonly view = computed(() => {\r\n    const state = this.available();\r\n    return state\r\n      ? buildCalculationExplanationView(\r\n          state,\r\n          this.target(),\r\n          this.explanationContext.context(),\r\n          this.explanationContext.statusNames(),\r\n        )\r\n      : null;\r\n  });\r\n\r\n  private request?: Subscription;\r\n\r\n  constructor() {\r\n    inject(DestroyRef).onDestroy(() => this.request?.unsubscribe());\r\n  }\r\n\r\n  // Created when the popover opens and destroyed when it closes: one read per\r\n  // open, never re-read when the value it explains is refreshed underneath.\r\n  ngOnInit(): void {\r\n    this.load(false);\r\n  }\r\n\r\n  protected openDetails(): void {\r\n    const state = this.available();\r\n    if (!state) {\r\n      return;\r\n    }\r\n    const { kind: _kind, ...explanation } = state;\r\n    this.modal.openModal(CalculationExplanationPanel, 'drawer', {\r\n      header: this.target().label,\r\n      position: 'end',\r\n      // Contributor tables need the width a tooltip does not have.\r\n      styleClass: '!w-[48rem] max-w-[96vw]',\r\n      dismissableMask: true,\r\n      inputValues: {\r\n        target: this.target(),\r\n        explanation,\r\n      },\r\n    });\r\n    this.detailsOpened.emit();\r\n  }\r\n\r\n  private load(retried: boolean): void {\r\n    const target = this.target();\r\n    this.request?.unsubscribe();\r\n    this.request = this.api.read(target.source, target.propertyKey).subscribe({\r\n      next: (response) => this.apply(response, retried),\r\n      error: () => this.state.set({ kind: 'failed' }),\r\n    });\r\n  }\r\n\r\n  private apply(response: CalculationExplanationResponse, retried: boolean) {\r\n    // The value was saved again while the explanation was read: show the new\r\n    // value (a read, never a recalculation), then explain that one.\r\n    if (response.status === 'valueChanged' && !retried) {\r\n      this.refresher?.refreshStaleCalculatedValue();\r\n      this.load(true);\r\n      return;\r\n    }\r\n\r\n    const explanation = response.explanation;\r\n    const basis = response.basis ?? 'savedCalculation';\r\n    if (\r\n      !EXPLAINED.has(response.status) ||\r\n      !explanation ||\r\n      explanation.schemaVersion !== 1 ||\r\n      !PROVIDERS.has(explanation.provider) ||\r\n      !BASES.has(basis)\r\n    ) {\r\n      this.state.set({\r\n        kind: 'unavailable',\r\n        messageKey:\r\n          UNAVAILABLE_KEYS[response.status] ?? `${KEY_PREFIX}.unavailable`,\r\n      });\r\n      return;\r\n    }\r\n\r\n    // Only a saved calculation names the persisted value; a newer one than\r\n    // the value on screen means the screen is behind.\r\n    const stale =\r\n      basis === 'savedCalculation' &&\r\n      !isSameSavedValue(response.savedValue, this.target().displayedValue);\r\n    if (stale) {\r\n      this.refresher?.refreshStaleCalculatedValue();\r\n    }\r\n    this.state.set({\r\n      kind: 'available',\r\n      basis: basis as CalculationExplanationBasis,\r\n      document: explanation,\r\n      definitionChanged: response.definitionChanged,\r\n      refreshed: stale && !!this.refresher,\r\n      viewType: response.display?.viewType ?? this.target().viewType,\r\n    });\r\n  }\r\n}\r\n","import {\r\n  ChangeDetectionStrategy,\r\n  Component,\r\n  ElementRef,\r\n  computed,\r\n  effect,\r\n  input,\r\n  signal,\r\n  viewChild,\r\n} from '@angular/core';\r\nimport { NgTemplateOutlet } from '@angular/common';\r\nimport { TranslocoPipe } from '@jsverse/transloco';\r\nimport { Tooltip } from '@masterteam/components/tooltip';\r\nimport { Popover } from 'primeng/popover';\r\nimport {\r\n  EntityCalculationChange,\r\n  EntityCalculationStatus,\r\n} from '../entity.model';\r\nimport type { EntityCalculationExplanationTarget } from '../calculation-explanation/calculation-explanation.model';\r\nimport { EntityCalculationExplanation } from '../calculation-explanation/entity-calculation-explanation';\r\n\r\nconst TOOLTIP_KEYS: Record<EntityCalculationStatus | 'idle', string> = {\r\n  idle: 'components.entitiesPreview.calculatedValue',\r\n  running: 'components.entitiesPreview.calculatingValue',\r\n  waiting: 'components.entitiesPreview.waitingToCalculate',\r\n  delayed: 'components.entitiesPreview.calculationDelayed',\r\n};\r\nconst CHANGED_TOOLTIP_KEY = 'components.entitiesPreview.calculatedValueChanged';\r\nconst EXPLAIN_TOOLTIP_KEY = 'components.entitiesPreview.explainCalculation';\r\n\r\n/** The calculated-value mark. Drawn, so it sits centred at any size. */\r\n@Component({\r\n  selector: 'mt-entity-calculated-glyph',\r\n  changeDetection: ChangeDetectionStrategy.OnPush,\r\n  template: `\r\n    <svg\r\n      viewBox=\"0 0 16 16\"\r\n      width=\"100%\"\r\n      height=\"100%\"\r\n      fill=\"none\"\r\n      stroke=\"currentColor\"\r\n      stroke-width=\"1.5\"\r\n      stroke-linecap=\"round\"\r\n      stroke-linejoin=\"round\"\r\n      aria-hidden=\"true\"\r\n    >\r\n      <path\r\n        d=\"M10.1 4.7c-.35-.42-.85-.62-1.38-.56-.87.1-1.4.76-1.57 1.66L6.1 11.3\"\r\n      />\r\n      <path d=\"M5.5 7.5h3.9\" />\r\n    </svg>\r\n  `,\r\n  host: {\r\n    class: 'block size-full',\r\n  },\r\n})\r\nexport class EntityCalculatedGlyph {}\r\n\r\n/**\r\n * Marks a property value the backend calculates. Rendered beside its label; it\r\n * pulses while a recalculation that covers the value is in progress, and stays\r\n * lit without pulsing once that is taking longer than expected.\r\n *\r\n * Given an `explanation` target it is a button: clicking it shows how the saved\r\n * value was calculated.\r\n */\r\n@Component({\r\n  selector: 'mt-entity-calculated-indicator',\r\n  changeDetection: ChangeDetectionStrategy.OnPush,\r\n  imports: [\r\n    EntityCalculatedGlyph,\r\n    EntityCalculationExplanation,\r\n    NgTemplateOutlet,\r\n    Popover,\r\n    Tooltip,\r\n    TranslocoPipe,\r\n  ],\r\n  template: `\r\n    <ng-template #mark>\r\n      @if (pulsing()) {\r\n        <span\r\n          class=\"absolute inset-0 animate-ping rounded-full bg-primary-700 opacity-60 motion-reduce:animate-none\"\r\n          aria-hidden=\"true\"\r\n        ></span>\r\n      }\r\n      <mt-entity-calculated-glyph class=\"relative\" />\r\n    </ng-template>\r\n\r\n    @if (explanation(); as target) {\r\n      <button\r\n        type=\"button\"\r\n        class=\"relative inline-flex size-4 cursor-pointer items-center justify-center rounded-full select-none focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary-500\"\r\n        [class]=\"\r\n          status()\r\n            ? 'bg-primary-700 text-white'\r\n            : 'bg-surface-100 text-surface-500 hover:bg-primary-100 hover:text-primary-700 dark:bg-surface-800 dark:text-surface-300'\r\n        \"\r\n        [attr.aria-label]=\"tooltipKey() | transloco: tooltipParams()\"\r\n        aria-haspopup=\"dialog\"\r\n        [mtTooltip]=\"tooltipKey() | transloco: tooltipParams()\"\r\n        tooltipPosition=\"top\"\r\n        (click)=\"toggle($event)\"\r\n      >\r\n        <ng-container [ngTemplateOutlet]=\"mark\" />\r\n      </button>\r\n      <!-- Projected content is created with this view even while the popover\r\n           is closed, so the explanation is gated on the open state: it reads\r\n           its value when opened, not when the page loads. -->\r\n      <p-popover\r\n        appendTo=\"body\"\r\n        (onShow)=\"opened.set(true)\"\r\n        (onHide)=\"opened.set(false)\"\r\n      >\r\n        @if (opened()) {\r\n          <mt-entity-calculation-explanation\r\n            [target]=\"target\"\r\n            (detailsOpened)=\"popover()?.hide()\"\r\n          />\r\n        }\r\n      </p-popover>\r\n    } @else {\r\n      <span\r\n        class=\"relative inline-flex size-4 cursor-help items-center justify-center rounded-full select-none\"\r\n        [class]=\"\r\n          status()\r\n            ? 'bg-primary-700 text-white'\r\n            : 'bg-surface-100 text-surface-500 dark:bg-surface-800 dark:text-surface-300'\r\n        \"\r\n        role=\"img\"\r\n        [attr.aria-label]=\"tooltipKey() | transloco: tooltipParams()\"\r\n        [mtTooltip]=\"tooltipKey() | transloco: tooltipParams()\"\r\n        tooltipPosition=\"top\"\r\n      >\r\n        <ng-container [ngTemplateOutlet]=\"mark\" />\r\n      </span>\r\n    }\r\n  `,\r\n  host: {\r\n    class: 'inline-flex shrink-0',\r\n  },\r\n})\r\nexport class EntityCalculatedIndicator {\r\n  /** Set while the value is being recalculated. */\r\n  readonly status = input<EntityCalculationStatus | null | undefined>(null);\r\n  /** The value's last change, described in the tooltip when it is not busy. */\r\n  readonly change = input<EntityCalculationChange | null | undefined>(null);\r\n  /** The value to explain on click. Without it the mark only has a tooltip. */\r\n  readonly explanation = input<EntityCalculationExplanationTarget | null>(null);\r\n\r\n  protected readonly popover = viewChild(Popover);\r\n  protected readonly opened = signal(false);\r\n  private readonly explanationElement = viewChild(\r\n    EntityCalculationExplanation,\r\n    { read: ElementRef },\r\n  );\r\n\r\n  constructor() {\r\n    // PrimeNG places the popover once, when it opens, measuring it before the\r\n    // explanation inside has rendered or loaded. Too narrow then, it is never\r\n    // flipped back from the edge, and in a right-to-left page it ran off the\r\n    // screen. It is placed again whenever the explanation changes size.\r\n    effect((onCleanup) => {\r\n      const element = this.explanationElement()?.nativeElement as\r\n        | HTMLElement\r\n        | undefined;\r\n      if (!element || typeof ResizeObserver === 'undefined') {\r\n        return;\r\n      }\r\n      const observer = new ResizeObserver(() => this.popover()?.align());\r\n      observer.observe(element);\r\n      onCleanup(() => observer.disconnect());\r\n    });\r\n  }\r\n\r\n  protected readonly pulsing = computed(\r\n    () => !!this.status() && this.status() !== 'delayed',\r\n  );\r\n\r\n  protected readonly tooltipKey = computed(() => {\r\n    const status = this.status();\r\n    if (status) {\r\n      return TOOLTIP_KEYS[status];\r\n    }\r\n    if (this.change()) {\r\n      return CHANGED_TOOLTIP_KEY;\r\n    }\r\n    return this.explanation() ? EXPLAIN_TOOLTIP_KEY : TOOLTIP_KEYS.idle;\r\n  });\r\n\r\n  protected readonly tooltipParams = computed(() => {\r\n    const change = this.change();\r\n    return change\r\n      ? { previous: change.previous, current: change.current }\r\n      : undefined;\r\n  });\r\n\r\n  protected toggle(event: MouseEvent): void {\r\n    // The mark sits inside cards and headers that may act on a click.\r\n    event.stopPropagation();\r\n    this.popover()?.toggle(event);\r\n  }\r\n}\r\n","import { normalizeNumerals } from './entity-display.utils';\n\n/**\n * The largest amount still rendered in full.\n *\n * The reviewer measured exactly where the line falls: `100,000 SAR` fits a card\n * slot, `1,000,000 SAR` does not and loses its currency to the ellipsis. So the\n * comparison below is inclusive — anything ABOVE this compacts, and everything\n * a tenant sees today at or under it is untouched.\n */\nexport const CURRENCY_COMPACT_THRESHOLD = 100_000;\n\n/**\n * The numeric amount inside a formatted currency string.\n *\n * Strips the currency token, the grouping separators and the bidirectional\n * marks `Intl` leaves around them, and normalises Arabic-Indic digits so an\n * `ar-SA` payload parses like an `en` one. `null` when there is no number.\n */\nexport function parseCurrencyAmount(\n  raw: string | null | undefined,\n): number | null {\n  if (typeof raw !== 'string') {\n    return null;\n  }\n\n  const numeric = normalizeNumerals(raw).replace(/[^0-9.+-]/g, '');\n  if (!numeric || !/\\d/.test(numeric)) {\n    return null;\n  }\n\n  const parsed = Number.parseFloat(numeric);\n  return Number.isFinite(parsed) ? parsed : null;\n}\n\n/**\n * Whatever is left of a formatted amount once the number is removed — `SAR`,\n * `ر.س`, `$`. Read from the payload rather than configured, so a tenant's own\n * currency survives untouched.\n */\nexport function currencyUnitOf(formatted: string): string {\n  return normalizeNumerals(formatted)\n    .replace(/[0-9.,+-]/g, '')\n    .trim();\n}\n\n/**\n * A large currency amount shortened so it fits a card slot, with the unit kept.\n *\n * A budget of a million or more used to render as `1,000,000 …`: the digits\n * survived the ellipsis and the currency did not, so the largest and most\n * consequential figures in the product were the only ones whose unit could not\n * be read (finding H-06). Compact notation keeps the whole thing inside the\n * slot — `SAR 1M` instead of `1,000,000 SAR` — and callers put the exact figure\n * in a tooltip, which is where a precise number belongs on a summary card.\n *\n * Returns `formatted` unchanged whenever the value already fits, is not a\n * number, or the runtime has no compact notation — so no tenant sees an\n * existing number change shape for no reason.\n */\nexport function compactCurrencyDisplay(\n  formatted: string,\n  rawValue: string | null | undefined,\n  locale: string,\n  threshold: number = CURRENCY_COMPACT_THRESHOLD,\n): string {\n  const amount = parseCurrencyAmount(rawValue ?? formatted);\n  if (amount === null || Math.abs(amount) <= threshold) {\n    return formatted;\n  }\n\n  let compact: string;\n  try {\n    compact = new Intl.NumberFormat(locale, {\n      notation: 'compact',\n      maximumFractionDigits: 1,\n    }).format(amount);\n  } catch {\n    return formatted;\n  }\n\n  const unit = currencyUnitOf(formatted);\n  if (!unit) {\n    return compact;\n  }\n\n  // Keep the payload's own unit placement — `SAR 1,000` and `1,000 SAR` are\n  // both in use, and flipping one to the other reads as a different currency.\n  return formatted.trimStart().startsWith(unit)\n    ? `${unit} ${compact}`\n    : `${compact} ${unit}`;\n}\n","import {\r\n  CURRENCY_COMPACT_THRESHOLD,\r\n  currencyUnitOf,\r\n  parseCurrencyAmount,\r\n} from './currency-display.utils';\r\nimport { normalizeNumerals } from './entity-display.utils';\r\nimport type {\r\n  EntityCalculationChange,\r\n  EntityData,\r\n  EntityViewType,\r\n} from './entity.model';\r\n\r\nconst NUMERIC_VIEW_TYPES: readonly EntityViewType[] = [\r\n  'Number',\r\n  'Currency',\r\n  'Percentage',\r\n];\r\nconst EMPTY_VALUE_TEXT = '—';\r\nconst MAX_FRACTION_DIGITS = 2;\r\n\r\n/** What a value reads as: the formatted string, or the object's own label. */\r\nfunction valueText(value: unknown): string {\r\n  if (value === null || value === undefined) {\r\n    return '';\r\n  }\r\n  if (typeof value === 'string') {\r\n    return value;\r\n  }\r\n  if (typeof value === 'number' || typeof value === 'boolean') {\r\n    return String(value);\r\n  }\r\n  if (Array.isArray(value)) {\r\n    return value.map(valueText).filter(Boolean).join(', ');\r\n  }\r\n  if (typeof value === 'object') {\r\n    const { display, displayName, name } = value as Record<string, unknown>;\r\n    return valueText(display ?? displayName ?? name);\r\n  }\r\n  return '';\r\n}\r\n\r\nfunction roundTo(value: number, digits: number): number {\r\n  const factor = 10 ** digits;\r\n  return Math.round(value * factor) / factor;\r\n}\r\n\r\n/** Decimals the value is displayed with, so the difference reads the same way. */\r\nfunction displayedFractionDigits(text: string): number {\r\n  const decimals = /[.٫](\\d+)/.exec(normalizeNumerals(text))?.[1]?.length ?? 0;\r\n  return Math.min(decimals, MAX_FRACTION_DIGITS);\r\n}\r\n\r\n/** An amount with its unit where the backend writes it, e.g. `SAR 5` or `5%`. */\r\nfunction withUnit(amount: string, unit: string, unitLeads: boolean): string {\r\n  if (!unit) {\r\n    return amount;\r\n  }\r\n  if (unit === '%') {\r\n    return `${amount}%`;\r\n  }\r\n  return unitLeads ? `${unit} ${amount}` : `${amount} ${unit}`;\r\n}\r\n\r\n/**\r\n * How a calculated value moved between two reads of the same record, or `null`\r\n * when it did not. Numeric view types get a signed difference; anything else\r\n * only records what it read before and after. `locale` formats the exact\r\n * values used when the displayed ones round to the same text.\r\n */\r\nexport function describeCalculationChange(\r\n  previous: EntityData,\r\n  current: EntityData,\r\n  locale = 'en',\r\n): EntityCalculationChange | null {\r\n  if (previous.rawValue === current.rawValue) {\r\n    return null;\r\n  }\r\n\r\n  const previousText = valueText(previous.value);\r\n  const currentText = valueText(current.value);\r\n  const texts = {\r\n    previous: previousText || EMPTY_VALUE_TEXT,\r\n    current: currentText || EMPTY_VALUE_TEXT,\r\n    recent: true,\r\n  };\r\n\r\n  const before = parseCurrencyAmount(previous.rawValue);\r\n  const after = parseCurrencyAmount(current.rawValue);\r\n  if (\r\n    NUMERIC_VIEW_TYPES.includes(current.viewType as EntityViewType) &&\r\n    before !== null &&\r\n    after !== null\r\n  ) {\r\n    const delta = after - before;\r\n    if (roundTo(delta, MAX_FRACTION_DIGITS) === 0) {\r\n      return null;\r\n    }\r\n\r\n    const digits = displayedFractionDigits(currentText);\r\n    const unit = currencyUnitOf(currentText);\r\n    const unitLeads =\r\n      !!unit && currentText.replace(/^[\\s+-]+/, '').startsWith(unit);\r\n    // \"Was 2.7%, now 2.7%\" says nothing: show the exact values instead.\r\n    const exact = (amount: number) =>\r\n      withUnit(\r\n        new Intl.NumberFormat(locale, {\r\n          maximumFractionDigits: MAX_FRACTION_DIGITS,\r\n        }).format(amount),\r\n        unit,\r\n        unitLeads,\r\n      );\r\n    return {\r\n      ...texts,\r\n      ...(previousText === currentText && {\r\n        previous: exact(before),\r\n        current: exact(after),\r\n      }),\r\n      delta,\r\n      unit,\r\n      unitLeads,\r\n      // A move too small for the displayed decimals still has to show a number.\r\n      fractionDigits:\r\n        roundTo(delta, digits) === 0 ? MAX_FRACTION_DIGITS : digits,\r\n    };\r\n  }\r\n\r\n  if (previousText === currentText) {\r\n    return null;\r\n  }\r\n  // No number to show beside the value: only the icon's tooltip describes it.\r\n  return {\r\n    ...texts,\r\n    recent: false,\r\n    delta: null,\r\n    unit: '',\r\n    unitLeads: false,\r\n    fractionDigits: 0,\r\n  };\r\n}\r\n\r\n/** The signed difference as the chip shows it, e.g. `+500K SAR` or `+0.1%`. */\r\nexport function formatCalculationDelta(\r\n  change: EntityCalculationChange,\r\n  locale: string,\r\n): string | null {\r\n  if (change.delta === null) {\r\n    return null;\r\n  }\r\n\r\n  const magnitude = Math.abs(change.delta);\r\n  const amount = new Intl.NumberFormat(\r\n    locale,\r\n    magnitude > CURRENCY_COMPACT_THRESHOLD\r\n      ? { notation: 'compact', maximumFractionDigits: 1 }\r\n      : { maximumFractionDigits: change.fractionDigits },\r\n  ).format(magnitude);\r\n  const sign = change.delta > 0 ? '+' : '-';\r\n  return sign + withUnit(amount, change.unit, change.unitLeads);\r\n}\r\n","import {\r\n  ChangeDetectionStrategy,\r\n  Component,\r\n  computed,\r\n  inject,\r\n  input,\r\n} from '@angular/core';\r\nimport { TranslocoPipe, TranslocoService } from '@jsverse/transloco';\r\nimport { Tooltip } from '@masterteam/components/tooltip';\r\nimport { sharedActiveLang } from '../active-lang';\r\nimport { formatCalculationDelta } from '../calculation-change.utils';\r\nimport { EntityCalculationChange } from '../entity.model';\r\n\r\n/**\r\n * Says how a calculated number just moved: the signed difference, with the\r\n * exact values in its tooltip.\r\n */\r\n@Component({\r\n  selector: 'mt-entity-calculation-change',\r\n  changeDetection: ChangeDetectionStrategy.OnPush,\r\n  imports: [Tooltip, TranslocoPipe],\r\n  template: `\r\n    @let description =\r\n      'components.entitiesPreview.calculationChangeDetail'\r\n        | transloco: { previous: change().previous, current: change().current };\r\n    <span\r\n      class=\"inline-flex cursor-help items-center rounded-md bg-surface-100 px-1.5 text-xs leading-5 font-semibold whitespace-nowrap text-surface-700 tabular-nums dark:bg-surface-800 dark:text-surface-200\"\r\n      role=\"img\"\r\n      dir=\"ltr\"\r\n      [attr.aria-label]=\"description\"\r\n      [mtTooltip]=\"description\"\r\n      tooltipPosition=\"top\"\r\n    >\r\n      {{ delta() }}\r\n    </span>\r\n  `,\r\n  host: {\r\n    class: 'inline-flex shrink-0',\r\n  },\r\n})\r\nexport class EntityCalculationChangeChip {\r\n  private readonly activeLang = sharedActiveLang(inject(TranslocoService));\r\n\r\n  readonly change = input.required<EntityCalculationChange>();\r\n\r\n  protected readonly delta = computed(() =>\r\n    formatCalculationDelta(this.change(), this.activeLang()),\r\n  );\r\n}\r\n","import { InjectionToken, Signal } from '@angular/core';\r\nimport { EntityData } from '../entity.model';\r\n\r\n/**\r\n * The entity of the enclosing `mt-entity-preview`. `mt-entity-field` only\r\n * receives a label, so this lets it read entity-level flags without every view\r\n * type passing them through its own template.\r\n */\r\nexport const ENTITY_PREVIEW_DATA = new InjectionToken<Signal<EntityData>>(\r\n  'ENTITY_PREVIEW_DATA',\r\n);\r\n","import {\r\n  ChangeDetectionStrategy,\r\n  Component,\r\n  computed,\r\n  inject,\r\n  input,\r\n} from '@angular/core';\r\nimport { TruncateTooltip } from '@masterteam/components/tooltip';\r\nimport { Icon } from '@masterteam/icons';\r\nimport { EntityCalculatedIndicator } from '../entity-calculated-indicator/entity-calculated-indicator';\r\nimport { EntityCalculationChangeChip } from '../entity-calculation-change/entity-calculation-change';\r\nimport {\r\n  isEntityAlignEnd,\r\n  isEntityLabelHidden,\r\n  resolveEntityLabelPosition,\r\n} from '../entity-display.utils';\r\nimport { ENTITY_PREVIEW_DATA } from '../entity-preview/entity-preview-context';\r\nimport { EntityConfiguration } from '../entity.model';\r\nimport { toCalculationExplanationTarget } from '../calculation-explanation/calculation-explanation.service';\r\n\r\ntype EntityFieldGap = 'compact' | 'normal' | 'relaxed';\r\n\r\n@Component({\r\n  selector: 'mt-entity-field',\r\n  changeDetection: ChangeDetectionStrategy.OnPush,\r\n  imports: [\r\n    TruncateTooltip,\r\n    Icon,\r\n    EntityCalculatedIndicator,\r\n    EntityCalculationChangeChip,\r\n  ],\r\n  template: `\r\n    <div [class]=\"containerClass()\">\r\n      <div [class]=\"contentContainerClass()\">\r\n        <ng-content />\r\n        @if (recentChange(); as change) {\r\n          <mt-entity-calculation-change [change]=\"change\" />\r\n        }\r\n      </div>\r\n      @if (!hideLabel()) {\r\n        <div [class]=\"labelContainerClass()\">\r\n          @if (labelIconName(); as iconName) {\r\n            <mt-icon [icon]=\"iconName\" size=\"xs\" class=\"shrink-0\" />\r\n          }\r\n          <span\r\n            class=\"block min-w-0 truncate\"\r\n            mtTruncateTooltip\r\n            tooltipPosition=\"top\"\r\n          >\r\n            {{ label() }}\r\n          </span>\r\n          @if (calculated()) {\r\n            <mt-entity-calculated-indicator\r\n              [status]=\"calculationStatus()\"\r\n              [change]=\"calculationChange()\"\r\n              [explanation]=\"calculationExplanation()\"\r\n            />\r\n          }\r\n        </div>\r\n      }\r\n    </div>\r\n  `,\r\n  host: {\r\n    class: 'block min-w-0 w-full',\r\n  },\r\n})\r\nexport class EntityField {\r\n  private readonly previewData = inject(ENTITY_PREVIEW_DATA, {\r\n    optional: true,\r\n  });\r\n\r\n  readonly calculated = computed(\r\n    () => this.previewData?.().calculated === true,\r\n  );\r\n\r\n  readonly calculationStatus = computed(\r\n    () => this.previewData?.().calculationStatus,\r\n  );\r\n\r\n  readonly calculationChange = computed(\r\n    () => this.previewData?.().calculationChange,\r\n  );\r\n\r\n  /** What the calculated-value mark explains on click, if anything. */\r\n  readonly calculationExplanation = computed(() =>\r\n    toCalculationExplanationTarget(this.previewData?.(), this.label()),\r\n  );\r\n\r\n  readonly recentChange = computed(() => {\r\n    const change = this.calculationChange();\r\n    return change?.recent ? change : null;\r\n  });\r\n\r\n  readonly label = input<string>('');\r\n  readonly labelIconName = input<string | null>(null);\r\n  readonly configuration = input<EntityConfiguration | null | undefined>();\r\n  readonly gap = input<EntityFieldGap>('compact');\r\n\r\n  readonly hideLabel = computed(() =>\r\n    isEntityLabelHidden(this.configuration()),\r\n  );\r\n\r\n  readonly labelPosition = computed(() =>\r\n    resolveEntityLabelPosition(this.configuration()),\r\n  );\r\n\r\n  readonly labelContainerClass = computed(() => {\r\n    const justifyClass = isEntityAlignEnd(this.configuration())\r\n      ? 'justify-end'\r\n      : '';\r\n\r\n    return `flex min-w-0 max-w-full items-center gap-1 text-sm text-gray-500 ${justifyClass}`.trimEnd();\r\n  });\r\n\r\n  readonly contentContainerClass = computed(() => {\r\n    const alignClass = isEntityAlignEnd(this.configuration())\r\n      ? 'self-end'\r\n      : 'self-stretch';\r\n\r\n    // Only while a chip shows, so every other field keeps its exact layout.\r\n    // A chip that does not fit beside the value goes below it rather than\r\n    // truncating the value (a narrow card column).\r\n    const chipClass = this.recentChange()\r\n      ? 'flex flex-wrap items-center gap-x-1.5 gap-y-0.5 '\r\n      : '';\r\n\r\n    return `${chipClass}min-w-0 max-w-full ${alignClass}`;\r\n  });\r\n\r\n  readonly containerClass = computed(() => {\r\n    const gapClass =\r\n      this.gap() === 'relaxed'\r\n        ? 'gap-2'\r\n        : this.gap() === 'normal'\r\n          ? 'gap-1'\r\n          : 'gap-0.5';\r\n\r\n    const directionClass =\r\n      this.labelPosition() === 'top' ? 'flex-col-reverse' : 'flex-col';\r\n\r\n    const alignClass = isEntityAlignEnd(this.configuration())\r\n      ? 'items-end'\r\n      : '';\r\n\r\n    return `flex min-w-0 ${directionClass} ${gapClass} ${alignClass}`.trimEnd();\r\n  });\r\n}\r\n","import {\r\n  ChangeDetectionStrategy,\r\n  Component,\r\n  computed,\r\n  input,\r\n} from '@angular/core';\r\nimport { NgTemplateOutlet } from '@angular/common';\r\nimport { TruncateTooltip } from '@masterteam/components/tooltip';\r\nimport {\r\n  displayOrPlaceholder,\r\n  extractDisplayText,\r\n  isEntityLabelHidden,\r\n  isEntityAlignEnd,\r\n} from '../entity-display.utils';\r\nimport { EntityField } from '../entity-field/entity-field';\r\nimport { EntityData } from '../entity.model';\r\n\r\n@Component({\r\n  selector: 'mt-entity-text',\r\n  changeDetection: ChangeDetectionStrategy.OnPush,\r\n  standalone: true,\r\n  imports: [EntityField, TruncateTooltip, NgTemplateOutlet],\r\n  templateUrl: './entity-text.html',\r\n})\r\nexport class EntityText {\r\n  /** Full entity data object */\r\n  readonly data = input<EntityData>();\r\n\r\n  /** Individual inputs (used when data is not provided) */\r\n  readonly name = input<string>();\r\n  readonly value = input<string>();\r\n\r\n  readonly displayName = computed(() => this.data()?.name ?? this.name() ?? '');\r\n  /**\r\n   * Renders without the field wrapper, which only carries the label, unless\r\n   * the wrapper has a chip to show beside the value: how a calculated value\r\n   * just changed. The wrapper hides the label itself.\r\n   */\r\n  protected readonly bare = computed(\r\n    () =>\r\n      isEntityLabelHidden(this.data()?.configuration) &&\r\n      !this.data()?.calculationChange?.recent,\r\n  );\r\n  protected readonly alignEnd = computed(() =>\r\n    isEntityAlignEnd(this.data()?.configuration),\r\n  );\r\n  readonly displayValue = computed(() => {\r\n    const d = this.data();\r\n    if (d) {\r\n      return displayOrPlaceholder(extractDisplayText(d.value));\r\n    }\r\n    return displayOrPlaceholder(this.value());\r\n  });\r\n\r\n  // Most table values are plain text. Avoid an HTML parser/sanitizer round-trip\r\n  // per cell while preserving the existing sanitized markup/entity contract.\r\n  protected readonly hasMarkup = computed(() =>\r\n    /[<&]/.test(this.displayValue()),\r\n  );\r\n}\r\n","@if (bare()) {\r\n  <ng-container [ngTemplateOutlet]=\"content\" />\r\n} @else {\r\n  <mt-entity-field\r\n    [label]=\"displayName()\"\r\n    [configuration]=\"data()?.configuration\"\r\n  >\r\n    <ng-container [ngTemplateOutlet]=\"content\" />\r\n  </mt-entity-field>\r\n}\r\n<ng-template #content>\r\n  <!--\r\n    Two lines before the ellipsis, not one. Portfolio and project names were\r\n    being cut mid-word on the Explore board (\"Smart City Infrastructure Po…\"),\r\n    which makes similarly-titled records indistinguishable without opening each\r\n    one (finding H-06). `line-clamp-2` still ellipsises what genuinely does not\r\n    fit, and `mtTruncateTooltip` reads `scrollHeight > clientHeight`, so the\r\n    tooltip keeps working for the clamped case exactly as it did for the\r\n    single-line one.\r\n  -->\r\n  <div\r\n    class=\"min-w-0 max-w-full line-clamp-2 break-words text-sm font-semibold\"\r\n    [class.text-end]=\"alignEnd()\"\r\n    mtTruncateTooltip\r\n    tooltipPosition=\"top\"\r\n  >\r\n    @if (hasMarkup()) {\r\n      <span [innerHTML]=\"displayValue()\"></span>\r\n    } @else {\r\n      {{ displayValue() }}\r\n    }\r\n  </div>\r\n</ng-template>\r\n","import {\n  afterNextRender,\n  DestroyRef,\n  Directive,\n  ElementRef,\n  inject,\n  input,\n} from '@angular/core';\n\n/** Smallest size the text may shrink to before ellipsis takes over, in px. */\nconst MIN_FONT_PX = 11;\n/** Each pass down the ramp. Small enough to look deliberate, not stepped. */\nconst STEP_PX = 0.5;\n\n/**\n * Shrinks an atomic value a little rather than letting it truncate.\n *\n * A date and an amount are single indivisible facts: `2026/08/16` cut to\n * `2026/08…` has lost the day, and `100,000 SAR` cut to `100,000 …` has lost\n * the currency — which is the one part a reader cannot infer. Prose survives an\n * ellipsis; these do not, so they get one lever before it.\n *\n * Why measure instead of thresholding. The first pass at this capped currency\n * by magnitude — compact anything above 100,000 — with the threshold read off\n * one measured card slot. But slot width is a property of the card layout, not\n * of the number: the three-across boxes on an Explore card are far narrower\n * than the slot that was measured, so `100,000 SAR` and `50,000 SAR` sat under\n * the threshold and truncated anyway. No constant can know the width it has.\n * This asks the element.\n *\n * The element keeps its `truncate`, so anything still too long at the floor\n * ellipsizes exactly as before — with the tooltip callers already attach\n * carrying the full value. Shrinking is a nudge, never the whole answer.\n */\n@Directive({\n  selector: '[mtFitText]',\n  standalone: true,\n})\nexport class FitText {\n  /** Set false to leave a particular instance alone. */\n  readonly mtFitText = input(true, {\n    transform: (value: unknown) => value !== false && value !== 'false',\n  });\n\n  private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n  private readonly destroyRef = inject(DestroyRef);\n  private basePx = 0;\n  private frame = 0;\n  private resizeObserver?: ResizeObserver;\n  private mutationObserver?: MutationObserver;\n\n  constructor() {\n    afterNextRender(() => {\n      const el = this.host.nativeElement;\n      this.basePx = parseFloat(getComputedStyle(el).fontSize) || 0;\n      if (!this.basePx) {\n        return;\n      }\n\n      if (typeof ResizeObserver !== 'undefined') {\n        this.resizeObserver = new ResizeObserver(() => this.schedule());\n        this.resizeObserver.observe(el);\n      }\n      // The value itself changes without the box changing size — a re-fetch,\n      // a locale switch, an edit committed in place.\n      this.mutationObserver = new MutationObserver(() => this.schedule());\n      this.mutationObserver.observe(el, {\n        characterData: true,\n        childList: true,\n        subtree: true,\n      });\n\n      this.schedule();\n    });\n\n    this.destroyRef.onDestroy(() => {\n      this.resizeObserver?.disconnect();\n      this.mutationObserver?.disconnect();\n      if (this.frame) {\n        cancelAnimationFrame(this.frame);\n      }\n    });\n  }\n\n  private schedule(): void {\n    if (this.frame) {\n      cancelAnimationFrame(this.frame);\n    }\n    this.frame = requestAnimationFrame(() => {\n      this.frame = 0;\n      this.fit();\n    });\n  }\n\n  private fit(): void {\n    const el = this.host.nativeElement;\n    if (!this.mtFitText() || !this.basePx) {\n      el.style.removeProperty('font-size');\n      return;\n    }\n\n    // Always measure from the base size: the box may have grown back, and a\n    // value that once needed shrinking should return to full size when it fits.\n    el.style.fontSize = `${this.basePx}px`;\n    if (el.clientWidth === 0) {\n      return;\n    }\n\n    let size = this.basePx;\n    while (el.scrollWidth > el.clientWidth && size > MIN_FONT_PX) {\n      size = Math.max(MIN_FONT_PX, size - STEP_PX);\n      el.style.fontSize = `${size}px`;\n    }\n\n    if (size === this.basePx) {\n      el.style.removeProperty('font-size');\n    }\n  }\n}\n","import {\n  ChangeDetectionStrategy,\n  Component,\n  computed,\n  input,\n} from '@angular/core';\nimport {\n  MTDateFormatPipe,\n  type MTDateFormatType,\n} from '@masterteam/components';\nimport { TruncateTooltip } from '@masterteam/components/tooltip';\nimport { EntityField } from '../entity-field/entity-field';\nimport { EntityData } from '../entity.model';\nimport { FitText } from '../fit-text.directive';\n\n@Component({\n  selector: 'mt-entity-date',\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  standalone: true,\n  imports: [EntityField, TruncateTooltip, MTDateFormatPipe, FitText],\n  templateUrl: './entity-date.html',\n})\nexport class EntityDate {\n  /** Full entity data object */\n  readonly data = input<EntityData>();\n\n  /** Individual inputs (used when data is not provided) */\n  readonly name = input<string>();\n  readonly value = input<unknown>();\n  readonly viewType = input<'Date' | 'DateTime' | 'Time'>('Date');\n\n  readonly displayName = computed(() => this.data()?.name ?? this.name() ?? '');\n  /**\n   * `Time` carries a wall-clock value (`HH:mm:ss`) with no date and no zone, so\n   * `mtDateFormat` renders it as stored instead of shifting it into the\n   * viewer's timezone the way its `DateTime` sibling is shifted.\n   */\n  readonly resolvedViewType = computed<MTDateFormatType>(() => {\n    switch (this.data()?.viewType ?? this.viewType()) {\n      case 'DateTime':\n        return 'dateTime';\n      case 'Time':\n        return 'time';\n      default:\n        return 'date';\n    }\n  });\n  readonly displayValue = computed(\n    () => this.data()?.rawValue ?? this.data()?.value ?? this.value(),\n  );\n}\n","<mt-entity-field\r\n  [label]=\"displayName()\"\r\n  [configuration]=\"data()?.configuration\"\r\n>\r\n  <span\r\n    class=\"block min-w-0 truncate text-sm font-semibold tabular-nums whitespace-nowrap\"\r\n    mtFitText\r\n    mtTruncateTooltip\r\n    tooltipPosition=\"top\"\r\n  >\r\n    @if (displayValue()) {\r\n      {{ displayValue() | mtDateFormat: resolvedViewType() }}\r\n    } @else {\r\n      -\r\n    }\r\n  </span>\r\n</mt-entity-field>\r\n","import {\n  ChangeDetectionStrategy,\n  Component,\n  computed,\n  input,\n} from '@angular/core';\nimport {\n  displayOrPlaceholder,\n  ENTITY_EMPTY_VALUE_PLACEHOLDER,\n} from '../entity-display.utils';\nimport { EntityField } from '../entity-field/entity-field';\nimport { EntityData, EntityStatusValue } from '../entity.model';\n\n@Component({\n  selector: 'mt-entity-status',\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  standalone: true,\n  imports: [EntityField],\n  templateUrl: './entity-status.html',\n})\nexport class EntityStatus {\n  /** Full entity data object */\n  readonly data = input<EntityData>();\n\n  /** Individual inputs (used when data is not provided) */\n  readonly name = input<string>();\n  readonly value = input<EntityStatusValue>();\n\n  readonly displayName = computed(() => this.data()?.name ?? this.name() ?? '');\n\n  readonly statusValue = computed<EntityStatusValue | null>(() => {\n    const d = this.data();\n    if (d && typeof d.value === 'object' && d.value !== null) {\n      return d.value as EntityStatusValue;\n    }\n    return this.value() ?? null;\n  });\n\n  readonly badgeStyle = computed(() => {\n    const status = this.statusValue();\n    if (!status?.color) return {};\n    return {\n      color: status.color,\n      backgroundColor: this.hexToRgba(status.color, 0.12),\n    };\n  });\n\n  readonly emptyLabel = ENTITY_EMPTY_VALUE_PLACEHOLDER;\n\n  readonly statusLabel = computed(() =>\n    displayOrPlaceholder(this.statusValue()?.display),\n  );\n\n  private hexToRgba(hex: string, alpha: number): string {\n    const r = parseInt(hex.slice(1, 3), 16);\n    const g = parseInt(hex.slice(3, 5), 16);\n    const b = parseInt(hex.slice(5, 7), 16);\n    return `rgba(${r}, ${g}, ${b}, ${alpha})`;\n  }\n}\n","<mt-entity-field\r\n  [label]=\"displayName()\"\r\n  [configuration]=\"data()?.configuration\"\r\n  gap=\"normal\"\r\n>\r\n  @if (statusValue(); as status) {\r\n    <span\r\n      class=\"inline-flex items-center px-3 py-2 rounded-md text-xs font-semibold w-fit\"\r\n      [style]=\"badgeStyle()\"\r\n    >\r\n      {{ statusLabel() }}\r\n    </span>\r\n  } @else {\r\n    <span\r\n      class=\"inline-flex items-center px-3 py-2 rounded-md text-xs font-semibold w-fit text-gray-500 bg-gray-100\"\r\n    >\r\n      {{ emptyLabel }}\r\n    </span>\r\n  }\r\n</mt-entity-field>\r\n","import {\n  ChangeDetectionStrategy,\n  Component,\n  computed,\n  input,\n} from '@angular/core';\nimport { Icon, MTIcon } from '@masterteam/icons';\nimport {\n  ENTITY_EMPTY_VALUE_PLACEHOLDER,\n  extractDisplayText,\n} from '../entity-display.utils';\nimport { EntityField } from '../entity-field/entity-field';\nimport { EntityData } from '../entity.model';\n\n/**\n * Renders an `Icon` view-type value — a stored icon key such as\n * `custom.strategy` — as the actual glyph via `mt-icon`, rather than printing\n * the raw key as text (which is what the plain-text fallback used to do before\n * `Icon` was a distinct view type).\n */\n@Component({\n  selector: 'mt-entity-icon',\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  standalone: true,\n  imports: [EntityField, Icon],\n  templateUrl: './entity-icon.html',\n})\nexport class EntityIcon {\n  /** Full entity data object */\n  readonly data = input<EntityData>();\n\n  /** Individual inputs (used when data is not provided) */\n  readonly name = input<string>();\n  readonly value = input<string>();\n\n  readonly displayName = computed(() => this.data()?.name ?? this.name() ?? '');\n\n  readonly emptyLabel = ENTITY_EMPTY_VALUE_PLACEHOLDER;\n\n  readonly iconName = computed<MTIcon | null>(() => {\n    const d = this.data();\n    const raw = d ? extractDisplayText(d.value) : (this.value() ?? null);\n    return raw ? (raw as MTIcon) : null;\n  });\n}\n","<mt-entity-field\r\n  [label]=\"displayName()\"\r\n  [configuration]=\"data()?.configuration\"\r\n  gap=\"normal\"\r\n>\r\n  @if (iconName(); as icon) {\r\n    <mt-icon [icon]=\"icon\" class=\"text-2xl\" />\r\n  } @else {\r\n    <span class=\"text-sm text-gray-500\">{{ emptyLabel }}</span>\r\n  }\r\n</mt-entity-field>\r\n","import {\r\n  ChangeDetectionStrategy,\r\n  Component,\r\n  computed,\r\n  input,\r\n} from '@angular/core';\r\nimport {\r\n  ENTITY_EMPTY_VALUE_PLACEHOLDER,\r\n  extractDisplayText,\r\n} from '../entity-display.utils';\r\nimport { EntityField } from '../entity-field/entity-field';\r\nimport { EntityData } from '../entity.model';\r\n\r\n/**\r\n * Renders a `Color` view-type value — a stored `#rrggbb` string — as a swatch\r\n * next to its hex code, rather than printing the code alone.\r\n */\r\n@Component({\r\n  selector: 'mt-entity-color',\r\n  changeDetection: ChangeDetectionStrategy.OnPush,\r\n  standalone: true,\r\n  imports: [EntityField],\r\n  templateUrl: './entity-color.html',\r\n})\r\nexport class EntityColor {\r\n  /** Full entity data object */\r\n  readonly data = input<EntityData>();\r\n\r\n  /** Individual inputs (used when data is not provided) */\r\n  readonly name = input<string>();\r\n  readonly value = input<string>();\r\n\r\n  readonly displayName = computed(() => this.data()?.name ?? this.name() ?? '');\r\n\r\n  readonly emptyLabel = ENTITY_EMPTY_VALUE_PLACEHOLDER;\r\n\r\n  readonly color = computed<string | null>(() => {\r\n    const d = this.data();\r\n    const raw = d ? extractDisplayText(d.value) : (this.value() ?? null);\r\n    return raw?.trim() || null;\r\n  });\r\n}\r\n","<mt-entity-field\r\n  [label]=\"displayName()\"\r\n  [configuration]=\"data()?.configuration\"\r\n>\r\n  @if (color(); as color) {\r\n    <div class=\"flex min-w-0 items-center gap-2\">\r\n      <span\r\n        class=\"size-5 shrink-0 rounded-md border border-surface\"\r\n        [style.background-color]=\"color\"\r\n      ></span>\r\n      <span class=\"truncate text-sm font-semibold\" dir=\"ltr\">{{ color }}</span>\r\n    </div>\r\n  } @else {\r\n    <span class=\"text-sm text-gray-500\">{{ emptyLabel }}</span>\r\n  }\r\n</mt-entity-field>\r\n","import {\n  ChangeDetectionStrategy,\n  Component,\n  computed,\n  effect,\n  input,\n  signal,\n  untracked,\n} from '@angular/core';\nimport { HttpContext } from '@angular/common/http';\nimport { TranslocoPipe } from '@jsverse/transloco';\nimport { Avatar } from '@masterteam/components/avatar';\nimport { Tooltip, TruncateTooltip } from '@masterteam/components/tooltip';\nimport { Icon } from '@masterteam/icons';\nimport { EntityData, EntityUserConfig, EntityUserValue } from '../entity.model';\nimport { SecureImagePipe } from '@masterteam/components/upload-field';\nimport { displayOrPlaceholder } from '../entity-display.utils';\nimport { EntityField } from '../entity-field/entity-field';\nimport { REQUEST_CONTEXT } from '@masterteam/components';\n\n@Component({\n  selector: 'mt-entity-user',\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  standalone: true,\n  imports: [\n    Avatar,\n    Tooltip,\n    TruncateTooltip,\n    Icon,\n    SecureImagePipe,\n    EntityField,\n    TranslocoPipe,\n  ],\n  templateUrl: './entity-user.html',\n})\nexport class EntityUser {\n  readonly httpContext = new HttpContext().set(REQUEST_CONTEXT, {\n    useBaseUrl: true,\n  });\n\n  /** Full entity data object */\n  readonly data = input<EntityData>();\n  readonly expanded = signal(false);\n\n  readonly displayName = computed(() => this.data()?.name ?? '');\n  readonly isMultiUser = computed(() => this.data()?.viewType === 'MultiUser');\n\n  /** Resolved user objects from either a User or MultiUser entity value. */\n  readonly users = computed<EntityUserValue[]>(() => {\n    const val = this.data()?.value;\n    const values = Array.isArray(val) ? val : [val];\n    return values.filter(isEntityUserValue);\n  });\n\n  readonly maxVisibleUsers = computed(() => {\n    const configured = Number(this.config().maxVisibleUsers);\n    return Number.isInteger(configured) && configured > 0 ? configured : 5;\n  });\n\n  readonly visibleUsers = computed(() => {\n    const users = this.users();\n    if (!this.isMultiUser() || this.expanded()) {\n      return users;\n    }\n\n    return users.slice(0, this.maxVisibleUsers());\n  });\n\n  readonly hiddenUserCount = computed(\n    () => this.users().length - this.visibleUsers().length,\n  );\n\n  /** First user retained for the existing single-user computed API. */\n  private readonly userValue = computed(() => this.users()[0] ?? null);\n\n  userNameFor(user: EntityUserValue): string {\n    return displayOrPlaceholder(user.displayName ?? null);\n  }\n\n  userPhotoFor(user: EntityUserValue): string {\n    return user.photoUrl ?? '';\n  }\n\n  labelTextFor(user: EntityUserValue): string {\n    return user.name ?? '';\n  }\n\n  isUnlinkedUser(user: EntityUserValue): boolean {\n    return user.isLinkedToCurrentApplication === false && !!user.userName;\n  }\n\n  phoneNumberFor(user: EntityUserValue): string {\n    return user.phoneNumber ?? '';\n  }\n\n  emailFor(user: EntityUserValue): string {\n    return user.email ?? '';\n  }\n\n  hasContactInfoFor(user: EntityUserValue): boolean {\n    return (\n      (this.showPhoneNumber() && !!this.phoneNumberFor(user)) ||\n      (this.showEmail() && !!this.emailFor(user))\n    );\n  }\n\n  readonly emptyUserName = computed(() => displayOrPlaceholder(null));\n\n  readonly rawUserName = computed(() => this.userValue()?.displayName ?? null);\n\n  readonly userName = computed(() => displayOrPlaceholder(this.rawUserName()));\n\n  readonly userPhoto = computed(() => this.userValue()?.photoUrl ?? '');\n\n  readonly labelText = computed(() => this.userValue()?.name ?? '');\n\n  /**\n   * `true` when the referenced user is no longer linked to the application.\n   * Drives the inline info badge/tooltip next to the display name.\n   */\n  readonly isUnlinked = computed(\n    () =>\n      this.userValue()?.isLinkedToCurrentApplication === false &&\n      this.userValue()?.userName,\n  );\n\n  // ── Configuration-driven visibility ──\n\n  private readonly config = computed(\n    () => (this.data()?.configuration as EntityUserConfig) ?? {},\n  );\n\n  readonly showDisplayName = computed(\n    () => this.config().showDisplayName ?? true,\n  );\n\n  readonly showPhoneNumber = computed(\n    () => this.config().showPhoneNumber ?? false,\n  );\n\n  readonly showEmail = computed(() => this.config().showEmail ?? false);\n\n  /** When off the avatar is dropped entirely, leaving the name on its own. */\n  readonly showAvatar = computed(() => this.config().showAvatar ?? true);\n\n  readonly phoneNumber = computed(() => this.userValue()?.phoneNumber ?? '');\n\n  readonly email = computed(() => this.userValue()?.email ?? '');\n\n  readonly hasContactInfo = computed(\n    () =>\n      (this.showPhoneNumber() && !!this.phoneNumber()) ||\n      (this.showEmail() && !!this.email()),\n  );\n\n  constructor() {\n    effect(() => {\n      void this.data()?.value;\n      untracked(() => this.expanded.set(false));\n    });\n  }\n\n  showAllUsers(): void {\n    this.expanded.set(true);\n  }\n}\n\nfunction isEntityUserValue(value: unknown): value is EntityUserValue {\n  if (!value || typeof value !== 'object' || Array.isArray(value)) {\n    return false;\n  }\n\n  return 'displayName' in value;\n}\n","<mt-entity-field\r\n  [label]=\"displayName()\"\r\n  [configuration]=\"data()?.configuration\"\r\n  gap=\"normal\"\r\n>\r\n  @if (isMultiUser()) {\r\n    <div\r\n      class=\"flex min-w-0 flex-wrap items-center gap-2\"\r\n      data-testid=\"multi-user-list\"\r\n    >\r\n      @for (user of visibleUsers(); track user.id ?? $index) {\r\n        <div\r\n          class=\"inline-flex min-w-0 max-w-full items-center gap-1.5 rounded-full border border-surface-200 bg-surface-50 py-1 pe-2\"\r\n          [class.ps-1]=\"showAvatar()\"\r\n          [class.ps-2]=\"!showAvatar()\"\r\n        >\r\n          @if (showAvatar()) {\r\n            <mt-avatar\r\n              [image]=\"\r\n                userPhotoFor(user)\r\n                  ? (userPhotoFor(user)\r\n                    | secureImage: true : httpContext : 'avatar/')\r\n                  : ''\r\n              \"\r\n              [icon]=\"'user.user-01'\"\r\n              styleClass=\"w-7! h-7! text-white! text-sm! bg-primary-500!\"\r\n            ></mt-avatar>\r\n          }\r\n\r\n          @if (showDisplayName()) {\r\n            <span\r\n              class=\"max-w-36 truncate text-xs text-gray-700\"\r\n              mtTruncateTooltip\r\n              tooltipPosition=\"top\"\r\n              >{{ userNameFor(user) }}</span\r\n            >\r\n          }\r\n\r\n          @if (isUnlinkedUser(user)) {\r\n            <mt-icon\r\n              icon=\"general.info-circle\"\r\n              class=\"shrink-0 text-xs text-amber-500\"\r\n              [mtTooltip]=\"'components.userReference.notLinked' | transloco\"\r\n              tooltipPosition=\"top\"\r\n            />\r\n          }\r\n\r\n          @if (showPhoneNumber() && phoneNumberFor(user)) {\r\n            <a\r\n              [href]=\"'tel:' + phoneNumberFor(user)\"\r\n              [attr.aria-label]=\"phoneNumberFor(user)\"\r\n              [mtTooltip]=\"phoneNumberFor(user)\"\r\n              tooltipPosition=\"top\"\r\n              class=\"inline-flex shrink-0\"\r\n            >\r\n              <mt-icon icon=\"communication.phone\" size=\"xs\" />\r\n            </a>\r\n          }\r\n\r\n          @if (showEmail() && emailFor(user)) {\r\n            <a\r\n              [href]=\"'mailto:' + emailFor(user)\"\r\n              [attr.aria-label]=\"emailFor(user)\"\r\n              [mtTooltip]=\"emailFor(user)\"\r\n              tooltipPosition=\"top\"\r\n              class=\"inline-flex shrink-0\"\r\n            >\r\n              <mt-icon icon=\"communication.mail-01\" size=\"xs\" />\r\n            </a>\r\n          }\r\n        </div>\r\n      } @empty {\r\n        <span class=\"text-sm text-gray-700\">{{ emptyUserName() }}</span>\r\n      }\r\n\r\n      @if (hiddenUserCount() > 0) {\r\n        <button\r\n          type=\"button\"\r\n          class=\"inline-flex h-8 min-w-8 shrink-0 cursor-pointer items-center justify-center rounded-full border border-primary-200 bg-primary-50 px-2 text-xs font-semibold text-primary-700 transition-colors hover:bg-primary-100 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-500\"\r\n          data-testid=\"show-all-users\"\r\n          [attr.aria-label]=\"\r\n            'components.userReference.showMore'\r\n              | transloco: { count: hiddenUserCount() }\r\n          \"\r\n          [mtTooltip]=\"\r\n            'components.userReference.showMore'\r\n              | transloco: { count: hiddenUserCount() }\r\n          \"\r\n          tooltipPosition=\"top\"\r\n          (click)=\"showAllUsers()\"\r\n        >\r\n          +{{ hiddenUserCount() }}\r\n        </button>\r\n      }\r\n    </div>\r\n  } @else {\r\n    @if (users()[0]; as user) {\r\n      <div class=\"flex min-w-0 items-center gap-2\">\r\n        @if (showAvatar()) {\r\n          <mt-avatar\r\n            [image]=\"\r\n              userPhotoFor(user)\r\n                ? (userPhotoFor(user)\r\n                  | secureImage: true : httpContext : 'avatar/')\r\n                : ''\r\n            \"\r\n            [icon]=\"'user.user-01'\"\r\n            styleClass=\"w-10! h-10! text-white! text-xxl! bg-primary-500!\"\r\n          ></mt-avatar>\r\n        }\r\n\r\n        @if (showDisplayName()) {\r\n          <div class=\"flex min-w-0 flex-1 flex-col\">\r\n            <div class=\"flex min-w-0 items-center gap-1\">\r\n              <span\r\n                class=\"truncate text-sm text-gray-700\"\r\n                mtTruncateTooltip\r\n                tooltipPosition=\"top\"\r\n                >{{ userNameFor(user) }}</span\r\n              >\r\n              @if (isUnlinkedUser(user)) {\r\n                <mt-icon\r\n                  icon=\"general.info-circle\"\r\n                  class=\"shrink-0 text-sm text-amber-500\"\r\n                  [mtTooltip]=\"'components.userReference.notLinked' | transloco\"\r\n                  tooltipPosition=\"top\"\r\n                />\r\n              }\r\n            </div>\r\n            @if (labelTextFor(user)) {\r\n              <span class=\"truncate text-xs text-gray-500\">{{\r\n                labelTextFor(user)\r\n              }}</span>\r\n            }\r\n          </div>\r\n        }\r\n\r\n        @if (hasContactInfoFor(user)) {\r\n          <div class=\"ms-auto flex shrink-0 items-center gap-1.5\">\r\n            @if (showPhoneNumber() && phoneNumberFor(user)) {\r\n              <a\r\n                [href]=\"'tel:' + phoneNumberFor(user)\"\r\n                [attr.aria-label]=\"phoneNumberFor(user)\"\r\n                [mtTooltip]=\"phoneNumberFor(user)\"\r\n                tooltipPosition=\"top\"\r\n                class=\"inline-flex\"\r\n              >\r\n                <mt-avatar\r\n                  icon=\"communication.phone\"\r\n                  badgeSeverity=\"secondary\"\r\n                  styleClass=\"bg-surface-100! text-surface-600! h-7! w-7! text-sm! font-semibold!\"\r\n                />\r\n              </a>\r\n            }\r\n            @if (showEmail() && emailFor(user)) {\r\n              <a\r\n                [href]=\"'mailto:' + emailFor(user)\"\r\n                [attr.aria-label]=\"emailFor(user)\"\r\n                [mtTooltip]=\"emailFor(user)\"\r\n                tooltipPosition=\"top\"\r\n                class=\"inline-flex\"\r\n              >\r\n                <mt-avatar\r\n                  styleClass=\"bg-surface-100! text-surface-600! h-7! w-7! text-sm! font-semibold!\"\r\n                  icon=\"communication.mail-01\"\r\n                  badgeSeverity=\"secondary\"\r\n                />\r\n              </a>\r\n            }\r\n          </div>\r\n        }\r\n      </div>\r\n    } @else {\r\n      <div class=\"flex min-w-0 items-center gap-2\">\r\n        @if (showAvatar()) {\r\n          <mt-avatar\r\n            [icon]=\"'user.user-01'\"\r\n            styleClass=\"w-10! h-10! text-white! text-xxl! bg-primary-500!\"\r\n          ></mt-avatar>\r\n        }\r\n        @if (showDisplayName()) {\r\n          <span class=\"truncate text-sm text-gray-700\">{{\r\n            emptyUserName()\r\n          }}</span>\r\n        }\r\n      </div>\r\n    }\r\n  }\r\n</mt-entity-field>\r\n","import { PercentageColorRule } from './entity.model';\r\n\r\n/**\r\n * Anything that can supply a percentage colour: an ordered rule set plus the\r\n * fallback used when no rule matches.\r\n */\r\nexport interface PercentageColorSource {\r\n  colorRules?: PercentageColorRule[] | null;\r\n  defaultColor?: string | null;\r\n}\r\n\r\n/** A finite number, or null for anything that cannot be compared numerically. */\r\nfunction toFiniteNumber(value: unknown): number | null {\r\n  if (value === null || value === undefined || value === '') {\r\n    return null;\r\n  }\r\n\r\n  const parsed =\r\n    typeof value === 'number'\r\n      ? value\r\n      : Number(String(value).replace(/%/g, '').trim());\r\n\r\n  return Number.isFinite(parsed) ? parsed : null;\r\n}\r\n\r\n/**\r\n * Whether `value` falls inside a rule's band. Both bounds are inclusive, an\r\n * absent bound is open-ended, and a rule carrying neither bound is malformed —\r\n * it never matches rather than swallowing every value.\r\n */\r\nexport function matchesPercentageColorRule(\r\n  value: number,\r\n  rule?: PercentageColorRule | null,\r\n): boolean {\r\n  if (!rule) {\r\n    return false;\r\n  }\r\n\r\n  const min = toFiniteNumber(rule.minValue);\r\n  const max = toFiniteNumber(rule.maxValue);\r\n\r\n  if (min === null && max === null) {\r\n    return false;\r\n  }\r\n\r\n  if (min !== null && value < min) {\r\n    return false;\r\n  }\r\n\r\n  return max === null || value <= max;\r\n}\r\n\r\n/**\r\n * The colour for a percentage value: rules in their configured order, first\r\n * match wins, `defaultColor` when nothing matches.\r\n *\r\n * The backend owns this evaluation and ships the winner as `color` on\r\n * render/value/fetch responses, so callers must prefer that resolved colour.\r\n * This exists for the surfaces that hold a raw rule set and no resolved colour\r\n * — the property-form preview, and catalog reads that never went through a\r\n * value response.\r\n */\r\nexport function resolvePercentageColor(\r\n  value: unknown,\r\n  source?: PercentageColorSource | null,\r\n): string | null {\r\n  const fallback = source?.defaultColor?.trim() || null;\r\n  const numericValue = toFiniteNumber(value);\r\n  const rules = source?.colorRules;\r\n\r\n  if (numericValue === null || !Array.isArray(rules)) {\r\n    return fallback;\r\n  }\r\n\r\n  const match = rules.find((rule) =>\r\n    matchesPercentageColorRule(numericValue, rule),\r\n  );\r\n\r\n  return match?.color?.trim() || fallback;\r\n}\r\n","import {\r\n  ChangeDetectionStrategy,\r\n  Component,\r\n  computed,\r\n  inject,\r\n  input,\r\n} from '@angular/core';\r\nimport { TranslocoService } from '@jsverse/transloco';\r\nimport { Progress } from '@masterteam/components/progress';\r\nimport { EntityCalculatedIndicator } from '../entity-calculated-indicator/entity-calculated-indicator';\r\nimport { EntityCalculationChangeChip } from '../entity-calculation-change/entity-calculation-change';\r\nimport { toCalculationExplanationTarget } from '../calculation-explanation/calculation-explanation.service';\r\nimport {\r\n  displayOrPlaceholder,\r\n  isEntityLabelHidden,\r\n  isValueMissing,\r\n  normalizeNumerals,\r\n  readEntityValueColor,\r\n} from '../entity-display.utils';\r\nimport { EntityData, EntityPercentageConfig } from '../entity.model';\r\nimport { resolvePercentageColor } from '../percentage-color.utils';\r\n\r\n@Component({\r\n  selector: 'mt-entity-percentage',\r\n  changeDetection: ChangeDetectionStrategy.OnPush,\r\n  standalone: true,\r\n  imports: [Progress, EntityCalculatedIndicator, EntityCalculationChangeChip],\r\n  templateUrl: './entity-percentage.html',\r\n})\r\nexport class EntityPercentage {\r\n  private readonly transloco = inject(TranslocoService);\r\n  /** Active locale, so number formatting follows the UI language. */\r\n  private readonly locale = computed(\r\n    () => this.transloco.getActiveLang() || 'en',\r\n  );\r\n  /** Full entity data object */\r\n  readonly data = input<EntityData>();\r\n\r\n  /** Individual inputs (used when data is not provided) */\r\n  readonly name = input<string>();\r\n  readonly value = input<string>();\r\n  readonly rawValue = input<string>();\r\n\r\n  readonly displayName = computed(() => this.data()?.name ?? this.name() ?? '');\r\n  /** What the calculated-value mark explains on click, if anything. */\r\n  readonly calculationExplanation = computed(() =>\r\n    toCalculationExplanationTarget(this.data(), this.displayName()),\r\n  );\r\n\r\n  readonly displayValue = computed(() => {\r\n    const d = this.data();\r\n    const raw = d\r\n      ? typeof d.value === 'string'\r\n        ? d.value\r\n        : null\r\n      : this.value();\r\n    return displayOrPlaceholder(this.formatPercentageDisplay(raw));\r\n  });\r\n\r\n  private readonly rawNumericValue = computed(\r\n    () =>\r\n      this.data()?.rawValue ??\r\n      this.rawValue() ??\r\n      this.value() ??\r\n      this.displayValue(),\r\n  );\r\n\r\n  readonly hasNumericValue = computed(() => {\r\n    return this.parseNumericValue(this.rawNumericValue()) !== null;\r\n  });\r\n\r\n  readonly numericValue = computed(() => {\r\n    const num = this.parseNumericValue(this.rawNumericValue());\r\n    return num === null ? 0 : Math.min(num, 100);\r\n  });\r\n\r\n  readonly maxValue = computed(() => {\r\n    const num = this.parseNumericValue(this.rawNumericValue());\r\n    if (num === null) return 100;\r\n    return num > 100 ? Math.ceil(num) : 100;\r\n  });\r\n\r\n  // ── Configuration-driven visibility ──\r\n\r\n  readonly hideName = computed(() =>\r\n    isEntityLabelHidden(this.data()?.configuration),\r\n  );\r\n\r\n  /**\r\n   * The bar colour. The backend evaluates the property's colour rules and\r\n   * returns the winner as `color` on render/value/fetch responses, so a\r\n   * resolved colour always wins — the rules are only evaluated here for\r\n   * configurations that arrive without one (a catalog read, or the\r\n   * property-form preview).\r\n   *\r\n   * The value's own `color` is checked first and is not the same thing as\r\n   * `configuration.color`: it is resolved per record, so it is the only one\r\n   * that can carry a band colour for *this* value, or the colour a\r\n   * `colorSource: 'property'` configuration took from a sibling property on\r\n   * this record. A configuration-level colour applies to every value alike and\r\n   * cannot answer either question.\r\n   */\r\n  readonly progressColor = computed(() => {\r\n    const d = this.data();\r\n    const direct = d?.configuration as EntityPercentageConfig | undefined;\r\n    const fromProperty = d?.propertyConfiguration as\r\n      | EntityPercentageConfig\r\n      | undefined;\r\n\r\n    const perValue = readEntityValueColor(d?.color);\r\n    if (perValue) {\r\n      return perValue;\r\n    }\r\n\r\n    const resolved = direct?.color?.trim() || fromProperty?.color?.trim();\r\n    if (resolved) {\r\n      return resolved;\r\n    }\r\n\r\n    const raw = this.rawNumericValue();\r\n    return (\r\n      resolvePercentageColor(raw, direct) ??\r\n      resolvePercentageColor(raw, fromProperty) ??\r\n      'primary'\r\n    );\r\n  });\r\n\r\n  /**\r\n   * Renders a percentage for the active locale.\r\n   *\r\n   * This used to echo the backend's string and only append `%` when that string\r\n   * already carried one — so in Arabic, where the API returns a bare `\"25\"`,\r\n   * the symbol vanished and a progress value rendered as an unlabelled `25`.\r\n   * Next to a bar that could be a percentage, a count or a score (finding\r\n   * H-08).\r\n   *\r\n   * Formatting from the NUMBER through `Intl.NumberFormat` makes the symbol,\r\n   * the decimal separator and the digit shapes follow the locale instead of the\r\n   * payload. `maximumFractionDigits: 1` preserves the precision the old code\r\n   * kept; `style: 'percent'` expects a fraction, hence the /100.\r\n   *\r\n   * Non-numeric values pass through untouched — a status string or an em dash\r\n   * must not be mangled into `NaN%`.\r\n   */\r\n  private formatPercentageDisplay(\r\n    raw: string | null | undefined,\r\n  ): string | null | undefined {\r\n    if (isValueMissing(raw)) {\r\n      return raw;\r\n    }\r\n\r\n    const num = this.parseNumericValue(raw);\r\n    if (num === null) {\r\n      return raw;\r\n    }\r\n\r\n    try {\r\n      return new Intl.NumberFormat(this.locale(), {\r\n        style: 'percent',\r\n        maximumFractionDigits: 1,\r\n      }).format(num / 100);\r\n    } catch {\r\n      // An unknown locale tag must not cost the user their number.\r\n      return `${Number(num.toFixed(1))}%`;\r\n    }\r\n  }\r\n\r\n  private parseNumericValue(raw: unknown): number | null {\r\n    if (isValueMissing(raw)) {\r\n      return null;\r\n    }\r\n\r\n    const normalizedRawValue = normalizeNumerals(String(raw))\r\n      .replace(/[%٪]/g, '')\r\n      .trim();\r\n    if (!normalizedRawValue) {\r\n      return null;\r\n    }\r\n\r\n    const numericValue = Number.parseFloat(normalizedRawValue);\r\n    return Number.isNaN(numericValue) ? null : numericValue;\r\n  }\r\n}\r\n","<div class=\"flex flex-col gap-1\">\r\n  <div class=\"flex items-center justify-between\">\r\n    @if (!hideName()) {\r\n      <span class=\"inline-flex min-w-0 items-center gap-1\">\r\n        <span class=\"text-xs font-semibold\">{{ displayName() }}</span>\r\n        @if (data()?.calculated) {\r\n          <mt-entity-calculated-indicator\r\n            [status]=\"data()?.calculationStatus\"\r\n            [change]=\"data()?.calculationChange\"\r\n            [explanation]=\"calculationExplanation()\"\r\n          />\r\n        }\r\n      </span>\r\n    }\r\n    <span class=\"inline-flex items-center gap-1.5\" [class.ms-auto]=\"hideName()\">\r\n      @if (data()?.calculationChange; as change) {\r\n        @if (change.recent) {\r\n          <mt-entity-calculation-change [change]=\"change\" />\r\n        }\r\n      }\r\n      <span class=\"text-xs font-bold\">{{ displayValue() }}</span>\r\n    </span>\r\n  </div>\r\n  @if (hasNumericValue()) {\r\n    <mt-progress\r\n      [value]=\"numericValue()\"\r\n      [showLabel]=\"false\"\r\n      [height]=\"9\"\r\n      [maxValue]=\"maxValue()\"\r\n      [color]=\"progressColor()\"\r\n    >\r\n    </mt-progress>\r\n  } @else {\r\n    <div class=\"h-[9px] rounded-full bg-gray-200\"></div>\r\n  }\r\n</div>\r\n","import {\n  ChangeDetectionStrategy,\n  Component,\n  computed,\n  inject,\n  input,\n} from '@angular/core';\nimport { TranslocoService } from '@jsverse/transloco';\nimport { Tooltip } from '@masterteam/components/tooltip';\nimport { compactCurrencyDisplay } from '../currency-display.utils';\nimport { displayOrPlaceholder } from '../entity-display.utils';\nimport { EntityField } from '../entity-field/entity-field';\nimport { EntityData } from '../entity.model';\nimport { FitText } from '../fit-text.directive';\n\n@Component({\n  selector: 'mt-entity-currency',\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  standalone: true,\n  imports: [EntityField, Tooltip, FitText],\n  templateUrl: './entity-currency.html',\n})\nexport class EntityCurrency {\n  private readonly transloco = inject(TranslocoService);\n  /** Active locale, so number formatting follows the UI language. */\n  private readonly locale = computed(\n    () => this.transloco.getActiveLang() || 'en',\n  );\n\n  /** Full entity data object */\n  readonly data = input<EntityData>();\n\n  /** Individual inputs (used when data is not provided) */\n  readonly name = input<string>();\n  readonly value = input<string>();\n\n  readonly displayName = computed(() => this.data()?.name ?? this.name() ?? '');\n\n  /** The backend's fully grouped string — always the tooltip, never truncated. */\n  readonly fullValue = computed(() => {\n    const d = this.data();\n    if (d) {\n      return displayOrPlaceholder(typeof d.value === 'string' ? d.value : null);\n    }\n    return displayOrPlaceholder(this.value());\n  });\n\n  /**\n   * What the cell renders: the backend's string, or a compact form of it when\n   * the amount is large enough that the currency token would be truncated away.\n   * See {@link compactCurrencyDisplay} (finding H-06).\n   */\n  readonly displayValue = computed(() =>\n    compactCurrencyDisplay(\n      this.fullValue(),\n      this.data()?.rawValue,\n      this.locale(),\n    ),\n  );\n}\n","<mt-entity-field\r\n  [label]=\"displayName()\"\r\n  [configuration]=\"data()?.configuration\"\r\n>\r\n  <span\r\n    class=\"block min-w-0 truncate text-sm font-semibold tabular-nums whitespace-nowrap\"\r\n    mtFitText\r\n    [mtTooltip]=\"fullValue()\"\r\n    tooltipPosition=\"top\"\r\n  >\r\n    {{ displayValue() }}\r\n  </span>\r\n</mt-entity-field>\r\n","import {\r\n  ChangeDetectionStrategy,\r\n  Component,\r\n  computed,\r\n  input,\r\n} from '@angular/core';\r\nimport { EntityCalculatedIndicator } from '../entity-calculated-indicator/entity-calculated-indicator';\r\nimport { EntityCalculationChangeChip } from '../entity-calculation-change/entity-calculation-change';\r\nimport { toCalculationExplanationTarget } from '../calculation-explanation/calculation-explanation.service';\r\nimport {\r\n  ENTITY_EMPTY_VALUE_PLACEHOLDER,\r\n  isEntityLabelHidden,\r\n} from '../entity-display.utils';\r\nimport { EntityData } from '../entity.model';\r\nimport { coerceCheckboxValue } from '@masterteam/components';\r\n\r\n@Component({\r\n  selector: 'mt-entity-checkbox',\r\n  changeDetection: ChangeDetectionStrategy.OnPush,\r\n  standalone: true,\r\n  imports: [EntityCalculatedIndicator, EntityCalculationChangeChip],\r\n  templateUrl: './entity-checkbox.html',\r\n})\r\nexport class EntityCheckbox {\r\n  /** Full entity data object */\r\n  readonly data = input<EntityData>();\r\n\r\n  /** Individual inputs (used when data is not provided) */\r\n  readonly name = input<string>();\r\n  readonly value = input<string>();\r\n  readonly rawValue = input<string>();\r\n\r\n  readonly displayName = computed(() => this.data()?.name ?? this.name() ?? '');\r\n  /** What the calculated-value mark explains on click, if anything. */\r\n  readonly calculationExplanation = computed(() =>\r\n    toCalculationExplanationTarget(this.data(), this.displayName()),\r\n  );\r\n  readonly emptyLabel = ENTITY_EMPTY_VALUE_PLACEHOLDER;\r\n\r\n  readonly hideName = computed(() =>\r\n    isEntityLabelHidden(this.data()?.configuration),\r\n  );\r\n\r\n  // Reads `rawValue` first (the value as stored) and falls back to the\r\n  // rendered `value`. Both arrive as text — `coerceCheckboxValue` owns the\r\n  // single definition of which strings count as checked, shared with the\r\n  // editable form so a record cannot preview one way and edit another.\r\n  readonly checkboxState = computed<boolean | null>(() => {\r\n    const raw = coerceCheckboxValue(this.data()?.rawValue ?? this.rawValue());\r\n    if (raw !== null) return raw;\r\n\r\n    return coerceCheckboxValue(this.data()?.value ?? this.value());\r\n  });\r\n}\r\n","<div class=\"flex items-center gap-2\">\r\n  @if (checkboxState() === true) {\r\n    <svg class=\"w-5 h-5 text-green-500\" viewBox=\"0 0 20 20\" fill=\"currentColor\">\r\n      <path\r\n        fill-rule=\"evenodd\"\r\n        d=\"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z\"\r\n        clip-rule=\"evenodd\"\r\n      />\r\n    </svg>\r\n  } @else if (checkboxState() === false) {\r\n    <svg class=\"w-5 h-5 text-gray-300\" viewBox=\"0 0 20 20\" fill=\"currentColor\">\r\n      <path\r\n        fill-rule=\"evenodd\"\r\n        d=\"M10 18a8 8 0 100-16 8 8 0 000 16zm-1-5.414l-2.293-2.293a1 1 0 011.414-1.414L10 11.172l3.879-3.879a1 1 0 111.414 1.414L10 13.414l-.707-.707-.293-.293z\"\r\n        clip-rule=\"evenodd\"\r\n      />\r\n    </svg>\r\n  } @else {\r\n    <span\r\n      class=\"inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-gray-100 px-1 text-[10px] font-semibold text-gray-500\"\r\n    >\r\n      {{ emptyLabel }}\r\n    </span>\r\n  }\r\n  @if (!hideName()) {\r\n    <span class=\"text-sm font-semibold\">{{ displayName() }}</span>\r\n    @if (data()?.calculated) {\r\n      <mt-entity-calculated-indicator\r\n        [status]=\"data()?.calculationStatus\"\r\n        [change]=\"data()?.calculationChange\"\r\n        [explanation]=\"calculationExplanation()\"\r\n      />\r\n      @if (data()?.calculationChange; as change) {\r\n        @if (change.recent) {\r\n          <mt-entity-calculation-change [change]=\"change\" />\r\n        }\r\n      }\r\n    }\r\n  }\r\n</div>\r\n","import {\n  ChangeDetectionStrategy,\n  Component,\n  computed,\n  input,\n} from '@angular/core';\nimport {\n  ENTITY_EMPTY_VALUE_PLACEHOLDER,\n  extractDisplayText,\n  isValueMissing,\n} from '../entity-display.utils';\nimport { EntityField } from '../entity-field/entity-field';\nimport { EntityData } from '../entity.model';\n\n@Component({\n  selector: 'mt-entity-long-text',\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  standalone: true,\n  imports: [EntityField],\n  templateUrl: './entity-long-text.html',\n})\nexport class EntityLongText {\n  /** Full entity data object */\n  readonly data = input<EntityData>();\n\n  /** Individual inputs (used when data is not provided) */\n  readonly name = input<string>();\n  readonly value = input<string>();\n\n  readonly displayName = computed(() => this.data()?.name ?? this.name() ?? '');\n\n  readonly displayValue = computed(() => {\n    const d = this.data();\n    const raw = d ? extractDisplayText(d.value) : this.value();\n\n    if (isValueMissing(raw)) {\n      return ENTITY_EMPTY_VALUE_PLACEHOLDER;\n    }\n\n    return raw as string;\n  });\n}\n","<mt-entity-field\r\n  [label]=\"displayName()\"\r\n  [configuration]=\"data()?.configuration\"\r\n>\r\n  <div\r\n    class=\"text-sm font-semibold break-words\"\r\n    [innerHTML]=\"displayValue()\"\r\n  ></div>\r\n</mt-entity-field>\r\n","import {\n  ChangeDetectionStrategy,\n  Component,\n  computed,\n  input,\n} from '@angular/core';\nimport {\n  displayOrPlaceholder,\n  ENTITY_EMPTY_VALUE_PLACEHOLDER,\n} from '../entity-display.utils';\nimport { EntityField } from '../entity-field/entity-field';\nimport {\n  EntityData,\n  EntityLookupValue,\n  EntityMultiLookupValue,\n} from '../entity.model';\n\n@Component({\n  selector: 'mt-entity-lookup',\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  standalone: true,\n  imports: [EntityField],\n  templateUrl: './entity-lookup.html',\n})\nexport class EntityLookup {\n  /** Full entity data object */\n  readonly data = input<EntityData>();\n\n  /** Individual inputs (used when data is not provided) */\n  readonly name = input<string>();\n  readonly value = input<EntityLookupValue | EntityMultiLookupValue>();\n\n  readonly displayName = computed(() => this.data()?.name ?? this.name() ?? '');\n\n  readonly lookupValues = computed<EntityMultiLookupValue>(() => {\n    const value = this.data()?.value ?? this.value();\n    if (Array.isArray(value)) {\n      return value as EntityMultiLookupValue;\n    }\n\n    if (typeof value === 'object' && value !== null) {\n      return [value as EntityLookupValue];\n    }\n\n    return [];\n  });\n\n  lookupBadgeStyle(lookup: EntityLookupValue): Record<string, string> {\n    if (!lookup?.color) return {};\n    return {\n      color: lookup.color,\n      backgroundColor: this.hexToRgba(lookup.color, 0.12),\n    };\n  }\n\n  readonly emptyLabel = ENTITY_EMPTY_VALUE_PLACEHOLDER;\n\n  lookupLabel(lookup: EntityLookupValue): string {\n    return displayOrPlaceholder(lookup.display);\n  }\n\n  private hexToRgba(hex: string, alpha: number): string {\n    const r = parseInt(hex.slice(1, 3), 16);\n    const g = parseInt(hex.slice(3, 5), 16);\n    const b = parseInt(hex.slice(5, 7), 16);\n    return `rgba(${r}, ${g}, ${b}, ${alpha})`;\n  }\n}\n","<mt-entity-field\r\n  [label]=\"displayName()\"\r\n  [configuration]=\"data()?.configuration\"\r\n  gap=\"normal\"\r\n>\r\n  @if (lookupValues().length) {\r\n    <div class=\"flex flex-wrap gap-2\" data-testid=\"lookup-values\">\r\n      @for (lookup of lookupValues(); track lookup.key) {\r\n        <span\r\n          class=\"inline-flex w-fit items-center rounded-md px-3 py-2 text-xs font-semibold\"\r\n          data-testid=\"lookup-value\"\r\n          [style]=\"lookupBadgeStyle(lookup)\"\r\n        >\r\n          {{ lookupLabel(lookup) }}\r\n        </span>\r\n      }\r\n    </div>\r\n  } @else {\r\n    <span\r\n      class=\"inline-flex items-center px-3 py-2 rounded-md text-xs font-semibold w-fit text-gray-500 bg-gray-100\"\r\n    >\r\n      {{ emptyLabel }}\r\n    </span>\r\n  }\r\n</mt-entity-field>\r\n","import {\n  ChangeDetectionStrategy,\n  Component,\n  computed,\n  inject,\n  input,\n} from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { TranslocoService } from '@jsverse/transloco';\nimport {\n  displayOrPlaceholder,\n  ENTITY_EMPTY_VALUE_PLACEHOLDER,\n} from '../entity-display.utils';\nimport { resolveLocalizedLabel } from '../entity-sections.util';\nimport { EntityField } from '../entity-field/entity-field';\nimport { EntityData, EntityPhaseGateValue } from '../entity.model';\n\n/** `#RGB` / `#RRGGBB`. Anything else is used as-is for the text color only. */\nconst HEX_COLOR_PATTERN = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;\n\n/**\n * Badge color used when the phase gate carries no `color`. `color` is optional\n * presentation metadata, so a phase gate without one must still read as a\n * badge rather than as bare text — this is the same neutral slate the table\n * falls back to for uncategorized status chips.\n */\nexport const DEFAULT_PHASE_GATE_COLOR = '#475569';\n\n/**\n * Preview renderer for `PhaseGate` properties — a calculated, read-only lookup\n * pointing at the schema phase gate the record currently sits on. It renders\n * exactly like {@link EntityLookup} (colored badge) but resolves its label\n * per-language.\n *\n * Label resolution, in order:\n * 1. `value.ar` / `value.en` for the active language — the backend sends both\n *    so a client-side language switch re-renders without a refetch, which is\n *    why they win over the already-resolved `display`.\n * 2. `value.display`, then the other locale.\n * 3. The flat display, for payloads that send the value as a bare string\n *    (comparison snapshots build their sides that way).\n * 4. `rawValue` — the schema phase-gate id — as a last resort.\n */\n@Component({\n  selector: 'mt-entity-phase-gate',\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  standalone: true,\n  imports: [EntityField],\n  templateUrl: './entity-phase-gate.html',\n})\nexport class EntityPhaseGate {\n  private readonly transloco = inject(TranslocoService);\n\n  /** Full entity data object */\n  readonly data = input<EntityData>();\n\n  /** Individual inputs (used when data is not provided) */\n  readonly name = input<string>();\n  readonly value = input<EntityPhaseGateValue>();\n\n  private readonly activeLang = toSignal(this.transloco.langChanges$, {\n    initialValue: this.transloco.getActiveLang(),\n  });\n\n  readonly displayName = computed(() => this.data()?.name ?? this.name() ?? '');\n\n  readonly phaseGateValue = computed<EntityPhaseGateValue | null>(() => {\n    const value = this.data()?.value;\n    if (value && typeof value === 'object' && !Array.isArray(value)) {\n      return value as EntityPhaseGateValue;\n    }\n    return this.value() ?? null;\n  });\n\n  /** Resolved label, or `null` when nothing at all is available. */\n  private readonly resolvedLabel = computed<string | null>(() => {\n    const phaseGate = this.phaseGateValue();\n    if (phaseGate) {\n      const localized = resolveLocalizedLabel(phaseGate, this.activeLang());\n      const label = localized || phaseGate.display?.trim();\n      if (label) return label;\n    }\n\n    return this.flatDisplay() ?? this.rawId();\n  });\n\n  readonly hasValue = computed(() => this.resolvedLabel() !== null);\n\n  readonly phaseGateLabel = computed(() =>\n    displayOrPlaceholder(this.resolvedLabel()),\n  );\n\n  readonly badgeStyle = computed(() => {\n    const color =\n      this.phaseGateValue()?.color?.trim() || DEFAULT_PHASE_GATE_COLOR;\n    if (!HEX_COLOR_PATTERN.test(color)) return { color };\n    return {\n      color,\n      backgroundColor: this.hexToRgba(color, 0.12),\n    };\n  });\n\n  readonly emptyLabel = ENTITY_EMPTY_VALUE_PLACEHOLDER;\n\n  /** The value flattened to a plain display string by the sender. */\n  private flatDisplay(): string | null {\n    const value = this.data()?.value;\n    return typeof value === 'string' && value.trim() ? value.trim() : null;\n  }\n\n  /** The schema phase-gate id. */\n  private rawId(): string | null {\n    const rawValue = this.data()?.rawValue;\n    return typeof rawValue === 'string' && rawValue.trim()\n      ? rawValue.trim()\n      : null;\n  }\n\n  private hexToRgba(hex: string, alpha: number): string {\n    const expanded =\n      hex.length === 4\n        ? `#${hex[1]}${hex[1]}${hex[2]}${hex[2]}${hex[3]}${hex[3]}`\n        : hex;\n    const r = parseInt(expanded.slice(1, 3), 16);\n    const g = parseInt(expanded.slice(3, 5), 16);\n    const b = parseInt(expanded.slice(5, 7), 16);\n    return `rgba(${r}, ${g}, ${b}, ${alpha})`;\n  }\n}\n","<mt-entity-field\r\n  [label]=\"displayName()\"\r\n  [configuration]=\"data()?.configuration\"\r\n  gap=\"normal\"\r\n>\r\n  @if (hasValue()) {\r\n    <span\r\n      class=\"inline-flex items-center px-3 py-2 rounded-md text-xs font-semibold w-fit\"\r\n      [style]=\"badgeStyle()\"\r\n    >\r\n      {{ phaseGateLabel() }}\r\n    </span>\r\n  } @else {\r\n    <span\r\n      class=\"inline-flex items-center px-3 py-2 rounded-md text-xs font-semibold w-fit text-gray-500 bg-gray-100\"\r\n    >\r\n      {{ emptyLabel }}\r\n    </span>\r\n  }\r\n</mt-entity-field>\r\n","/**\r\n * Shared reading of a `PerformanceScore` value. The gauge draws from it and the\r\n * table resolver filters by it, so a card's pill and the filter it sets can\r\n * never disagree about which status a record is in.\r\n */\r\n\r\nimport { isValueMissing, normalizeNumerals } from './entity-display.utils';\r\nimport {\r\n  EntityPerformanceScoreChartSize,\r\n  EntityPerformanceScoreStatus,\r\n  EntityPerformanceScoreValue,\r\n} from './entity.model';\r\n\r\n/** Every `chartSize`, smallest first — the order the drawer offers them in. */\r\nexport const PERFORMANCE_SCORE_CHART_SIZES: readonly EntityPerformanceScoreChartSize[] =\r\n  ['small', 'medium', 'large', 'full'];\r\n\r\n/** The cap applied when a display configuration carries no `chartSize`. */\r\nexport const DEFAULT_PERFORMANCE_SCORE_CHART_SIZE: EntityPerformanceScoreChartSize =\r\n  'medium';\r\n\r\n/** The score as a number, or `null` when there is no measurement. */\r\nexport function parsePerformanceScore(raw: unknown): number | null {\r\n  if (typeof raw === 'number') return Number.isFinite(raw) ? raw : null;\r\n  if (isValueMissing(raw)) return null;\r\n  const parsed = Number.parseFloat(\r\n    normalizeNumerals(String(raw)).replace(/[%٪]/g, '').trim(),\r\n  );\r\n  return Number.isNaN(parsed) ? null : parsed;\r\n}\r\n\r\n/** Bands with at least one bound, ordered along the arc. */\r\nexport function getPerformanceScoreBands(\r\n  value: EntityPerformanceScoreValue | null | undefined,\r\n): EntityPerformanceScoreStatus[] {\r\n  return (value?.statuses ?? [])\r\n    .filter((status) => status.from != null || status.to != null)\r\n    .sort((a, b) => (a.from ?? -Infinity) - (b.from ?? -Infinity));\r\n}\r\n\r\n/**\r\n * The backend's status, else the band whose range holds the score. A missing\r\n * bound is open-ended here — unlike on the arc, where it stops at the scale —\r\n * so a 120% score still lands in a `from: 95` band.\r\n */\r\nexport function resolvePerformanceScoreStatus(\r\n  value: EntityPerformanceScoreValue | null | undefined,\r\n): EntityPerformanceScoreStatus | null {\r\n  if (value?.status) return value.status;\r\n\r\n  const performance = parsePerformanceScore(value?.performance);\r\n  if (performance === null) return null;\r\n\r\n  const bands = getPerformanceScoreBands(value);\r\n  return (\r\n    bands.find((band, index) => {\r\n      const from = band.from ?? -Infinity;\r\n      const to = band.to ?? Infinity;\r\n      const isLast = index === bands.length - 1;\r\n      return (\r\n        performance >= from && (isLast ? performance <= to : performance < to)\r\n      );\r\n    }) ?? null\r\n  );\r\n}\r\n","import {\r\n  ChangeDetectionStrategy,\r\n  Component,\r\n  computed,\r\n  inject,\r\n  input,\r\n} from '@angular/core';\r\nimport { TranslocoPipe, TranslocoService } from '@jsverse/transloco';\r\nimport { sharedActiveLang } from '../active-lang';\r\nimport { ENTITY_EMPTY_VALUE_PLACEHOLDER } from '../entity-display.utils';\r\nimport {\r\n  EntityData,\r\n  EntityPerformanceScoreChartSize,\r\n  EntityPerformanceScoreConfig,\r\n  EntityPerformanceScoreStatus,\r\n  EntityPerformanceScoreValue,\r\n} from '../entity.model';\r\nimport {\r\n  DEFAULT_PERFORMANCE_SCORE_CHART_SIZE,\r\n  getPerformanceScoreBands,\r\n  parsePerformanceScore,\r\n  resolvePerformanceScoreStatus,\r\n} from '../performance-score.utils';\r\n\r\n/** Arc geometry, in viewBox units: a semicircle centred on (50, 100). */\r\nconst ARC_RADIUS = 50;\r\nconst ARC_CENTER_X = 50;\r\nconst ARC_CENTER_Y = 100;\r\n/** Radius band labels sit on — just outside the 6-unit stroke. */\r\nconst LABEL_RADIUS = 59;\r\n/**\r\n * How far each band is pulled back from an interior boundary, as a fraction of\r\n * the arc. Round caps add half the stroke (3 units) past each end, so without\r\n * this neighbouring bands would overlap instead of showing a gap.\r\n */\r\nconst BAND_INSET = 4.5 / (Math.PI * ARC_RADIUS);\r\n/** Shortest band still drawn, so a very narrow range renders as a dot. */\r\nconst MIN_BAND_SPAN = 0.001;\r\n/**\r\n * What the gauge always occupies, labels aside: the stroke (±3) and the marker\r\n * (r 5 + half its 3-unit stroke) at either end of the arc.\r\n */\r\nconst GAUGE_EXTENT = 6.5;\r\n/**\r\n * Generous advances of 7-unit bold label glyphs, to size the viewBox. The box\r\n * is fitted tightly, so an underestimate clips the label at its cell's edge —\r\n * err wide: the percent sign in particular is far wider than a digit.\r\n */\r\nconst LABEL_DIGIT_WIDTH = 4.6;\r\nconst LABEL_PERCENT_WIDTH = 7.2;\r\nconst LABEL_SEPARATOR_WIDTH = 2.4;\r\nconst LABEL_HALF_HEIGHT = 4;\r\n\r\n/** Width cap per `chartSize`. */\r\nconst CHART_MAX_WIDTH: Record<EntityPerformanceScoreChartSize, string> = {\r\n  small: '11rem',\r\n  medium: '15rem',\r\n  large: '20rem',\r\n  full: '100%',\r\n};\r\n\r\nconst FALLBACK_COLOR = 'var(--p-primary-color)';\r\nconst EMPTY_COLOR = 'var(--p-surface-300)';\r\n\r\ninterface GaugeBand {\r\n  key: string;\r\n  path: string;\r\n  color: string;\r\n  opacity: number;\r\n}\r\n\r\ninterface GaugeLabel {\r\n  key: string;\r\n  text: string;\r\n  x: number;\r\n  y: number;\r\n  anchor: 'start' | 'middle' | 'end';\r\n}\r\n\r\n/**\r\n * Preview renderer for `PerformanceScore` properties — a KPI's performance as a\r\n * semicircle gauge, ported from SPlus v3's `app-performance-gauge`.\r\n *\r\n * Each status band is an arc segment; the band the score sits in is drawn at\r\n * full strength and the rest are faded. The marker rides the arc at the score,\r\n * the score itself sits in the middle, and the current status is a pill below.\r\n *\r\n * Geometry is computed, not measured: the SVG has a fixed `viewBox` and\r\n * `width: 100%` (capped by `configuration.chartSize`, centred), so it scales with its grid\r\n * cell without a `ResizeObserver` — a card grid mounts one of these per record.\r\n */\r\n@Component({\r\n  selector: 'mt-entity-performance-score',\r\n  changeDetection: ChangeDetectionStrategy.OnPush,\r\n  standalone: true,\r\n  imports: [TranslocoPipe],\r\n  templateUrl: './entity-performance-score.html',\r\n})\r\nexport class EntityPerformanceScore {\r\n  private readonly activeLang = sharedActiveLang(inject(TranslocoService));\r\n\r\n  /** Full entity data object */\r\n  readonly data = input<EntityData>();\r\n\r\n  /** Individual inputs (used when data is not provided) */\r\n  readonly name = input<string>();\r\n  readonly value = input<EntityPerformanceScoreValue>();\r\n\r\n  readonly displayName = computed(() => this.data()?.name ?? this.name() ?? '');\r\n\r\n  /** The display configuration's `chartSize`, as a CSS `max-width`. */\r\n  readonly chartMaxWidth = computed(() => {\r\n    const size = (\r\n      this.data()?.configuration as EntityPerformanceScoreConfig | undefined\r\n    )?.chartSize;\r\n    return (\r\n      CHART_MAX_WIDTH[size ?? DEFAULT_PERFORMANCE_SCORE_CHART_SIZE] ??\r\n      CHART_MAX_WIDTH[DEFAULT_PERFORMANCE_SCORE_CHART_SIZE]\r\n    );\r\n  });\r\n\r\n  readonly scoreValue = computed<EntityPerformanceScoreValue | null>(() => {\r\n    const value = this.data()?.value;\r\n    if (value && typeof value === 'object' && !Array.isArray(value)) {\r\n      return value as EntityPerformanceScoreValue;\r\n    }\r\n    return this.value() ?? null;\r\n  });\r\n\r\n  readonly performance = computed(() =>\r\n    parsePerformanceScore(this.scoreValue()?.performance),\r\n  );\r\n\r\n  readonly hasPerformance = computed(() => this.performance() !== null);\r\n\r\n  /** Bands with at least one bound, ordered along the arc. */\r\n  private readonly statuses = computed<EntityPerformanceScoreStatus[]>(() =>\r\n    getPerformanceScoreBands(this.scoreValue()),\r\n  );\r\n\r\n  /** 0–100, widened to the outermost band bound. */\r\n  private readonly scale = computed(() => {\r\n    let min = 0;\r\n    let max = 100;\r\n    for (const status of this.statuses()) {\r\n      if (status.from != null && status.from < min) min = status.from;\r\n      if (status.to != null && status.to > max) max = status.to;\r\n    }\r\n    return { min, max };\r\n  });\r\n\r\n  /** See {@link resolvePerformanceScoreStatus}; the table filters by it too. */\r\n  readonly status = computed<EntityPerformanceScoreStatus | null>(() =>\r\n    resolvePerformanceScoreStatus(this.scoreValue()),\r\n  );\r\n\r\n  readonly accentColor = computed(() => {\r\n    if (!this.hasPerformance()) return EMPTY_COLOR;\r\n    return this.status()?.color?.trim() || FALLBACK_COLOR;\r\n  });\r\n\r\n  readonly bands = computed<GaugeBand[]>(() => {\r\n    const statuses = this.statuses();\r\n    if (!statuses.length) {\r\n      return [\r\n        {\r\n          key: 'full',\r\n          path: this.arcPath(0, 1),\r\n          color: this.accentColor(),\r\n          opacity: 1,\r\n        },\r\n      ];\r\n    }\r\n\r\n    const activeKey = this.status()?.key;\r\n    const { min, max } = this.scale();\r\n    return statuses.map((status, index) => {\r\n      const start = this.toFraction(status.from ?? min);\r\n      const end = this.toFraction(status.to ?? max);\r\n      const insetStart = index > 0 ? start + BAND_INSET : start;\r\n      const insetEnd = index < statuses.length - 1 ? end - BAND_INSET : end;\r\n      return {\r\n        key: status.key,\r\n        path: this.arcPath(\r\n          insetStart,\r\n          Math.max(insetEnd, insetStart + MIN_BAND_SPAN),\r\n        ),\r\n        color: status.color?.trim() || FALLBACK_COLOR,\r\n        opacity: status.key === activeKey ? 1 : 0.2,\r\n      };\r\n    });\r\n  });\r\n\r\n  /** A label at every band start except the gauge minimum. */\r\n  readonly labels = computed<GaugeLabel[]>(() => {\r\n    const { min } = this.scale();\r\n    return this.statuses()\r\n      .filter((status) => status.from != null && status.from > min)\r\n      .map((status) => {\r\n        const angle = this.toAngle(this.toFraction(status.from as number));\r\n        const cos = Math.cos(angle);\r\n        return {\r\n          key: status.key,\r\n          text: this.formatPercent(status.from as number),\r\n          x: ARC_CENTER_X + LABEL_RADIUS * cos,\r\n          y: ARC_CENTER_Y - LABEL_RADIUS * Math.sin(angle),\r\n          anchor: cos > 0.25 ? 'start' : cos < -0.25 ? 'end' : 'middle',\r\n        };\r\n      });\r\n  });\r\n\r\n  /**\r\n   * The drawn extent — arc, marker and band labels — in viewBox units. Fitted\r\n   * tightly on every side: a label that overhangs one end of the arc is not\r\n   * mirrored as empty space on the other, which used to leave the gauge with a\r\n   * visibly wider gap on one side of its cell.\r\n   */\r\n  private readonly frame = computed(() => {\r\n    let minX = ARC_CENTER_X - ARC_RADIUS - GAUGE_EXTENT;\r\n    let maxX = ARC_CENTER_X + ARC_RADIUS + GAUGE_EXTENT;\r\n    let minY = ARC_CENTER_Y - ARC_RADIUS - GAUGE_EXTENT;\r\n    const maxY = ARC_CENTER_Y + GAUGE_EXTENT;\r\n\r\n    for (const label of this.labels()) {\r\n      const width = estimateLabelWidth(label.text);\r\n      const left =\r\n        label.anchor === 'start'\r\n          ? label.x\r\n          : label.anchor === 'end'\r\n            ? label.x - width\r\n            : label.x - width / 2;\r\n      minX = Math.min(minX, left);\r\n      maxX = Math.max(maxX, left + width);\r\n      minY = Math.min(minY, label.y - LABEL_HALF_HEIGHT);\r\n    }\r\n\r\n    return { minX, minY, width: maxX - minX, height: maxY - minY };\r\n  });\r\n\r\n  readonly viewBox = computed(() => {\r\n    const { minX, minY, width, height } = this.frame();\r\n    return `${minX} ${minY} ${width} ${height}`;\r\n  });\r\n\r\n  /**\r\n   * Horizontal padding (percent of the gauge width) that centres the status\r\n   * pill under the arc's centre rather than under the SVG's, which drifts off\r\n   * it whenever a band label overhangs only one end of the arc.\r\n   */\r\n  readonly pillInset = computed(() => {\r\n    const { minX, width } = this.frame();\r\n    const offset = (2 * (ARC_CENTER_X - minX)) / width - 1;\r\n    return {\r\n      left: Math.max(offset, 0) * 100,\r\n      right: Math.max(-offset, 0) * 100,\r\n    };\r\n  });\r\n\r\n  readonly marker = computed(() => {\r\n    const performance = this.performance();\r\n    if (performance === null) return null;\r\n    return this.pointAt(this.toFraction(performance), ARC_RADIUS);\r\n  });\r\n\r\n  readonly performanceLabel = computed(() => {\r\n    const performance = this.performance();\r\n    return performance === null\r\n      ? ENTITY_EMPTY_VALUE_PLACEHOLDER\r\n      : this.formatPercent(performance);\r\n  });\r\n\r\n  readonly statusLabel = computed(() => this.status()?.display?.trim() || '');\r\n\r\n  /** Same tinted badge as `mt-entity-status`, so both read as one status. */\r\n  readonly statusPillStyle = computed(() => {\r\n    const color = this.status()?.color?.trim() || FALLBACK_COLOR;\r\n    return {\r\n      color,\r\n      backgroundColor: `color-mix(in srgb, ${color} 12%, transparent)`,\r\n    };\r\n  });\r\n\r\n  /** Score → position along the arc, clamped to its ends. */\r\n  private toFraction(value: number): number {\r\n    const { min, max } = this.scale();\r\n    return Math.min(Math.max((value - min) / (max - min), 0), 1);\r\n  }\r\n\r\n  /** Arc fraction → angle; 0 is the left end, 1 the right. */\r\n  private toAngle(fraction: number): number {\r\n    return Math.PI * (1 - fraction);\r\n  }\r\n\r\n  private pointAt(fraction: number, radius: number): { x: number; y: number } {\r\n    const angle = this.toAngle(fraction);\r\n    return {\r\n      x: ARC_CENTER_X + radius * Math.cos(angle),\r\n      y: ARC_CENTER_Y - radius * Math.sin(angle),\r\n    };\r\n  }\r\n\r\n  private arcPath(from: number, to: number): string {\r\n    const start = this.pointAt(from, ARC_RADIUS);\r\n    const end = this.pointAt(to, ARC_RADIUS);\r\n    return `M ${start.x} ${start.y} A ${ARC_RADIUS} ${ARC_RADIUS} 0 0 1 ${end.x} ${end.y}`;\r\n  }\r\n\r\n  /** Same locale-aware formatting as `mt-entity-percentage`. */\r\n  private formatPercent(value: number): string {\r\n    try {\r\n      return new Intl.NumberFormat(this.activeLang() || 'en', {\r\n        style: 'percent',\r\n        maximumFractionDigits: 1,\r\n      }).format(value / 100);\r\n    } catch {\r\n      return `${Number(value.toFixed(1))}%`;\r\n    }\r\n  }\r\n}\r\n\r\n/** Estimated rendered width of a band label, in viewBox units. */\r\nfunction estimateLabelWidth(text: string): number {\r\n  let width = 0;\r\n  for (const char of text) {\r\n    if (char === '%' || char === '٪') width += LABEL_PERCENT_WIDTH;\r\n    else if ('.,٫٬'.includes(char)) width += LABEL_SEPARATOR_WIDTH;\r\n    else width += LABEL_DIGIT_WIDTH;\r\n  }\r\n  return width;\r\n}\r\n","<!--\r\n  No property label above the gauge: the gauge carries its own caption\r\n  (\"Performance Score\"), and the label repeated it. The property name is kept\r\n  as the SVG's accessible name instead.\r\n-->\r\n<div class=\"flex w-full flex-col items-center\">\r\n  <!-- Capped by `chartSize`; the pill row shares this width so its inset lines up -->\r\n  <div class=\"w-full\" [style.max-width]=\"chartMaxWidth()\">\r\n    <!--\r\n      `direction=\"ltr\"` pins the band labels' text-anchor to the arc's own\r\n      left/right — under an RTL host `start`/`end` would otherwise flip and push\r\n      the labels into the arc. The gauge itself runs left to right in both\r\n      languages, as it does in SPlus.\r\n    -->\r\n    <svg\r\n      class=\"block h-auto w-full overflow-visible\"\r\n      [attr.viewBox]=\"viewBox()\"\r\n      direction=\"ltr\"\r\n      role=\"img\"\r\n      [attr.aria-label]=\"displayName() + ' ' + performanceLabel()\"\r\n    >\r\n      @for (band of bands(); track band.key) {\r\n        <path\r\n          [attr.d]=\"band.path\"\r\n          fill=\"none\"\r\n          stroke-width=\"6\"\r\n          stroke-linecap=\"round\"\r\n          [style.stroke]=\"band.color\"\r\n          [style.opacity]=\"band.opacity\"\r\n        />\r\n      }\r\n      @for (label of labels(); track label.key) {\r\n        <text\r\n          [attr.x]=\"label.x\"\r\n          [attr.y]=\"label.y\"\r\n          [attr.text-anchor]=\"label.anchor\"\r\n          dominant-baseline=\"middle\"\r\n          font-size=\"7\"\r\n          font-weight=\"700\"\r\n          fill=\"currentColor\"\r\n        >\r\n          {{ label.text }}\r\n        </text>\r\n      }\r\n      @if (marker(); as point) {\r\n        <circle\r\n          [attr.cx]=\"point.x\"\r\n          [attr.cy]=\"point.y\"\r\n          r=\"5\"\r\n          fill=\"#ffffff\"\r\n          stroke-width=\"3\"\r\n          [style.stroke]=\"accentColor()\"\r\n          style=\"filter: drop-shadow(1px 1px 1px rgba(0, 0, 0, 0.1))\"\r\n        />\r\n      }\r\n      <text\r\n        x=\"50\"\r\n        y=\"87\"\r\n        text-anchor=\"middle\"\r\n        font-size=\"16\"\r\n        font-weight=\"700\"\r\n        [style.fill]=\"accentColor()\"\r\n      >\r\n        {{ performanceLabel() }}\r\n      </text>\r\n      <text\r\n        x=\"50\"\r\n        y=\"99\"\r\n        text-anchor=\"middle\"\r\n        font-size=\"6.5\"\r\n        fill=\"currentColor\"\r\n        class=\"text-gray-600\"\r\n      >\r\n        {{ \"components.performanceScore.label\" | transloco }}\r\n      </text>\r\n    </svg>\r\n\r\n    @if (statusLabel()) {\r\n      <div\r\n        class=\"flex justify-center\"\r\n        [style.padding-left.%]=\"pillInset().left\"\r\n        [style.padding-right.%]=\"pillInset().right\"\r\n      >\r\n        <span\r\n          class=\"inline-block max-w-full truncate rounded-md px-3 py-2 text-xs font-semibold\"\r\n          [style]=\"statusPillStyle()\"\r\n        >\r\n          {{ statusLabel() }}\r\n        </span>\r\n      </div>\r\n    }\r\n  </div>\r\n</div>\r\n","import { HttpClient, HttpContext } from '@angular/common/http';\nimport {\n  ChangeDetectionStrategy,\n  Component,\n  computed,\n  effect,\n  inject,\n  input,\n  signal,\n} from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { TranslocoService } from '@jsverse/transloco';\nimport { Button } from '@masterteam/components/button';\nimport { UploadField } from '@masterteam/components/upload-field';\nimport { MTIcon } from '@masterteam/icons';\nimport {\n  EMPTY,\n  catchError,\n  finalize,\n  forkJoin,\n  map,\n  of,\n  switchMap,\n  take,\n} from 'rxjs';\n\nimport {\n  EntityAttachmentItemValue,\n  EntityAttachmentValue,\n  EntityData,\n} from '../entity.model';\nimport { EntityField } from '../entity-field/entity-field';\n\ninterface AttachmentMetadataResponse {\n  data: EntityAttachmentItemValue;\n}\n\ntype AttachmentReference = EntityAttachmentItemValue | string;\n\n@Component({\n  selector: 'mt-entity-attachment',\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  standalone: true,\n  imports: [FormsModule, UploadField, Button, EntityField],\n  templateUrl: './entity-attachment.html',\n})\nexport class EntityAttachment {\n  readonly data = input<EntityData>();\n  readonly name = input<string>();\n  readonly shape = input<'default' | 'compact'>('default');\n  readonly value = input<\n    EntityAttachmentValue | EntityAttachmentItemValue | string | null\n  >();\n  readonly endPoint = input<string>('uploader');\n  readonly context = input<HttpContext | undefined>(undefined);\n\n  private readonly httpClient = inject(HttpClient);\n  private readonly transloco = inject(TranslocoService);\n\n  readonly displayName = computed(() => this.data()?.name ?? this.name() ?? '');\n  readonly loading = signal(false);\n  readonly attachments = signal<EntityAttachmentItemValue[]>([]);\n  /** Key of the compact chip currently hovered, so it can reveal the download affordance. */\n  readonly hoveredAttachmentKey = signal<string | null>(null);\n  readonly attachmentReferences = computed(() =>\n    this.normalizeAttachmentValue(this.data()?.value ?? this.value()),\n  );\n  readonly uploadValue = computed(() => {\n    const references = this.attachmentReferences().map((reference) => {\n      if (typeof reference === 'string') {\n        return reference.trim();\n      }\n\n      if (reference.fileName) {\n        return reference;\n      }\n\n      return reference.id?.trim() || reference;\n    });\n\n    if (!references.length) {\n      return null;\n    }\n\n    return references.length === 1 ? references[0] : references;\n  });\n  readonly hasAttachments = computed(() =>\n    this.shape() === 'compact'\n      ? this.attachments().length > 0\n      : this.uploadValue() != null,\n  );\n  readonly isMultiple = computed(() => this.attachmentReferences().length > 1);\n  readonly acceptTypes = computed(() =>\n    this.normalizeAcceptTypes(\n      (this.data()?.configuration as Record<string, unknown> | undefined)?.[\n        'AcceptTypes'\n      ],\n    ),\n  );\n\n  protected readonly empty = '-';\n\n  constructor() {\n    effect((onCleanup) => {\n      if (this.shape() !== 'compact') {\n        this.loading.set(false);\n        this.attachments.set([]);\n        return;\n      }\n\n      const references = this.attachmentReferences();\n\n      if (!references.length) {\n        this.loading.set(false);\n        this.attachments.set([]);\n        return;\n      }\n\n      const shouldFetchMetadata = references.some((reference) =>\n        this.requiresMetadataRequest(reference),\n      );\n\n      if (!shouldFetchMetadata) {\n        this.attachments.set(\n          references.filter(this.isAttachmentItemValue).map((reference) => ({\n            ...reference,\n            name:\n              reference.name ??\n              reference.fileName ??\n              reference.id ??\n              reference.name,\n            extension: this.resolveExtension(reference),\n          })),\n        );\n        this.loading.set(false);\n        return;\n      }\n\n      this.loading.set(true);\n\n      const sub = forkJoin(\n        references.map((reference) => this.resolveAttachment$(reference)),\n      )\n        .pipe(finalize(() => this.loading.set(false)))\n        .subscribe((attachments) => {\n          this.attachments.set(\n            attachments.filter(\n              (attachment): attachment is EntityAttachmentItemValue =>\n                attachment != null,\n            ),\n          );\n        });\n\n      onCleanup(() => sub.unsubscribe());\n    });\n  }\n\n  attachmentTrackBy(\n    index: number,\n    attachment: EntityAttachmentItemValue,\n  ): string {\n    return (\n      attachment.id ?? attachment.fileName ?? attachment.name ?? String(index)\n    );\n  }\n\n  attachmentTooltip(attachment: EntityAttachmentItemValue): string {\n    const name =\n      attachment.name ??\n      attachment.fileName ??\n      attachment.id ??\n      this.transloco.translate('components.entitiesPreview.attachment');\n\n    return this.transloco.translate(\n      'components.entitiesPreview.downloadAttachment',\n      { name },\n    );\n  }\n\n  /**\n   * Compact chips are clickable downloads but only show a file-type glyph,\n   * which doesn't read as actionable. Swap to a download icon while hovered\n   * so the action is obvious.\n   */\n  attachmentActionIcon(\n    index: number,\n    attachment: EntityAttachmentItemValue,\n  ): MTIcon {\n    return this.hoveredAttachmentKey() ===\n      this.attachmentTrackBy(index, attachment)\n      ? 'general.download-01'\n      : this.attachmentIcon(attachment);\n  }\n\n  attachmentIcon(attachment: EntityAttachmentItemValue): MTIcon {\n    const extension = this.resolveExtension(attachment);\n    const contentType = attachment.contentType?.toLowerCase() ?? '';\n\n    if (contentType.startsWith('image/')) {\n      return 'image.image-03';\n    }\n\n    switch (extension) {\n      case '.pdf':\n        return 'file.file-06';\n      case '.doc':\n      case '.docx':\n      case '.txt':\n      case '.rtf':\n        return 'file.file-04';\n      case '.xls':\n      case '.xlsx':\n      case '.csv':\n        return 'file.file-03';\n      case '.ppt':\n      case '.pptx':\n        return 'file.file-05';\n      default:\n        return 'file.clipboard-attachment';\n    }\n  }\n\n  onCompactAttachmentClick(\n    event: MouseEvent,\n    attachment: EntityAttachmentItemValue,\n  ): void {\n    event.stopPropagation();\n    this.downloadAttachment(attachment);\n  }\n\n  downloadAttachment(attachment: EntityAttachmentItemValue): void {\n    const resolvedAttachment$ = this.requiresMetadataRequest(attachment)\n      ? this.resolveAttachment$(attachment)\n      : of(this.normalizeAttachmentItem(attachment));\n\n    resolvedAttachment$\n      .pipe(\n        take(1),\n        switchMap((resolvedAttachment) => {\n          if (!resolvedAttachment?.fileName) {\n            return EMPTY;\n          }\n\n          return this.httpClient\n            .get(`${this.endPoint()}/${resolvedAttachment.fileName}`, {\n              responseType: 'blob',\n              context: this.context(),\n            })\n            .pipe(\n              take(1),\n              map((blob) => ({\n                attachment: resolvedAttachment,\n                blob,\n              })),\n            );\n        }),\n      )\n      .subscribe(({ attachment, blob }) => {\n        const downloadBlob = new Blob([blob], {\n          type:\n            attachment.contentType || blob.type || 'application/octet-stream',\n        });\n        const objectUrl = window.URL.createObjectURL(downloadBlob);\n        const anchor = document.createElement('a');\n\n        anchor.href = objectUrl;\n        anchor.download =\n          attachment.name ??\n          attachment.fileName ??\n          attachment.id ??\n          'attachment';\n        anchor.click();\n\n        window.URL.revokeObjectURL(objectUrl);\n      });\n  }\n\n  private resolveAttachment$(reference: AttachmentReference) {\n    const normalizedAttachment = this.normalizeAttachmentItem(reference);\n\n    if (!this.requiresMetadataRequest(reference)) {\n      return of(normalizedAttachment);\n    }\n\n    const attachmentId =\n      typeof reference === 'string' ? reference.trim() : reference.id?.trim();\n\n    if (!attachmentId) {\n      return of(normalizedAttachment);\n    }\n\n    return this.httpClient\n      .get<AttachmentMetadataResponse>(\n        `${this.endPoint()}/${attachmentId}/metaData`,\n        {\n          context: this.context(),\n        },\n      )\n      .pipe(\n        take(1),\n        map((response) => this.normalizeAttachmentItem(response.data)),\n        catchError(() => of(normalizedAttachment)),\n      );\n  }\n\n  private normalizeAttachmentValue(value: unknown): AttachmentReference[] {\n    if (value === null || value === undefined) {\n      return [];\n    }\n\n    if (Array.isArray(value)) {\n      return value.flatMap((item) => this.normalizeAttachmentValue(item));\n    }\n\n    if (typeof value === 'string') {\n      const trimmedValue = value.trim();\n\n      if (!trimmedValue || trimmedValue === '[]') {\n        return [];\n      }\n\n      if (\n        (trimmedValue.startsWith('[') && trimmedValue.endsWith(']')) ||\n        (trimmedValue.startsWith('{') && trimmedValue.endsWith('}'))\n      ) {\n        try {\n          return this.normalizeAttachmentValue(JSON.parse(trimmedValue));\n        } catch {\n          return [trimmedValue];\n        }\n      }\n\n      return [trimmedValue];\n    }\n\n    if (typeof value === 'object') {\n      const envelope = value as {\n        value?: unknown;\n        attachments?: unknown;\n        id?: unknown;\n        fileName?: unknown;\n        name?: unknown;\n      };\n\n      // Backend attachment envelope:\n      //   { value: <id | id[]>, attachments: [{ value: <id>, name, fileName }] }\n      // The stored items don't carry the storage key (their `fileName` is the\n      // display name), only the upload id, so resolve every attachment by its\n      // id through the metadata endpoint — the same contract\n      // `mt-upload-field` uses.\n      if (Array.isArray(envelope.attachments)) {\n        return envelope.attachments.flatMap((item) =>\n          this.normalizeAttachmentValue(item),\n        );\n      }\n\n      // A single backend attachment item carries its upload id under `value`.\n      if (\n        typeof envelope.value === 'string' &&\n        envelope.id === undefined &&\n        (envelope.fileName !== undefined || envelope.name !== undefined)\n      ) {\n        return this.normalizeAttachmentValue(envelope.value);\n      }\n\n      // Envelope with no resolved attachments yet — unwrap the inner id(s).\n      if (\n        'value' in envelope &&\n        envelope.id === undefined &&\n        envelope.fileName === undefined &&\n        envelope.name === undefined\n      ) {\n        return this.normalizeAttachmentValue(envelope.value);\n      }\n\n      return [value as EntityAttachmentItemValue];\n    }\n\n    return [];\n  }\n\n  private normalizeAttachmentItem(\n    value: AttachmentReference | null | undefined,\n  ): EntityAttachmentItemValue | null {\n    if (!value) {\n      return null;\n    }\n\n    if (typeof value === 'string') {\n      const trimmedValue = value.trim();\n\n      return trimmedValue\n        ? {\n            id: trimmedValue,\n            name: trimmedValue,\n          }\n        : null;\n    }\n\n    const normalizedAttachment: EntityAttachmentItemValue = {\n      ...value,\n      name: value.name ?? value.fileName ?? value.id ?? '',\n      extension: this.resolveExtension(value),\n    };\n\n    return normalizedAttachment.name ||\n      normalizedAttachment.fileName ||\n      normalizedAttachment.id\n      ? normalizedAttachment\n      : null;\n  }\n\n  private requiresMetadataRequest(reference: AttachmentReference): boolean {\n    if (typeof reference === 'string') {\n      return reference.trim().length > 0;\n    }\n\n    return !!reference.id?.trim() && !reference.fileName;\n  }\n\n  private isAttachmentItemValue(\n    reference: AttachmentReference,\n  ): reference is EntityAttachmentItemValue {\n    return typeof reference === 'object' && reference != null;\n  }\n\n  private resolveExtension(\n    value: EntityAttachmentItemValue,\n  ): string | undefined {\n    const explicitExtension = value.extension?.trim();\n\n    if (explicitExtension) {\n      return explicitExtension.startsWith('.')\n        ? explicitExtension.toLowerCase()\n        : `.${explicitExtension.toLowerCase()}`;\n    }\n\n    const fileName = value.fileName ?? value.name;\n    if (!fileName || !fileName.includes('.')) {\n      return undefined;\n    }\n\n    return `.${fileName.split('.').pop()!.toLowerCase()}`;\n  }\n\n  private normalizeAcceptTypes(value: unknown): string | undefined {\n    if (Array.isArray(value)) {\n      const acceptTypes = value\n        .map((item) => (typeof item === 'string' ? item.trim() : ''))\n        .filter(Boolean);\n\n      return acceptTypes.length ? acceptTypes.join(',') : undefined;\n    }\n\n    if (typeof value === 'string') {\n      const acceptTypes = value.trim();\n      return acceptTypes || undefined;\n    }\n\n    return undefined;\n  }\n}\n","<mt-entity-field\r\n  [label]=\"displayName()\"\r\n  [configuration]=\"data()?.configuration\"\r\n  gap=\"relaxed\"\r\n>\r\n  @if (hasAttachments()) {\r\n    @if (shape() === \"compact\") {\r\n      <div class=\"flex flex-wrap items-center gap-2\">\r\n        @for (\r\n          attachment of attachments();\r\n          track attachmentTrackBy($index, attachment)\r\n        ) {\r\n          <mt-button\r\n            iconPos=\"top\"\r\n            size=\"small\"\r\n            severity=\"secondary\"\r\n            variant=\"outlined\"\r\n            [icon]=\"attachmentActionIcon($index, attachment)\"\r\n            [tooltip]=\"attachmentTooltip(attachment)\"\r\n            styleClass=\"h-9! w-9! rounded-lg! transition-all duration-200 hover:scale-105 hover:border-primary-500! hover:text-primary-600! hover:bg-primary-50!\"\r\n            (onClick)=\"onCompactAttachmentClick($event, attachment)\"\r\n            (mouseenter)=\"\r\n              hoveredAttachmentKey.set(attachmentTrackBy($index, attachment))\r\n            \"\r\n            (mouseleave)=\"hoveredAttachmentKey.set(null)\"\r\n            (onFocus)=\"\r\n              hoveredAttachmentKey.set(attachmentTrackBy($index, attachment))\r\n            \"\r\n            (onBlur)=\"hoveredAttachmentKey.set(null)\"\r\n          />\r\n        }\r\n      </div>\r\n    } @else {\r\n      <mt-upload-field\r\n        class=\"w-full\"\r\n        [ngModel]=\"uploadValue()\"\r\n        [ngModelOptions]=\"{ standalone: true }\"\r\n        [shape]=\"'card'\"\r\n        [multiple]=\"isMultiple()\"\r\n        [readonly]=\"true\"\r\n        [endPoint]=\"endPoint()\"\r\n        [accept]=\"acceptTypes()\"\r\n        [context]=\"context()\"\r\n      />\r\n    }\r\n  } @else {\r\n    <span class=\"text-sm font-semibold\">{{ empty }}</span>\r\n  }\r\n</mt-entity-field>\r\n","import {\n  ChangeDetectionStrategy,\n  Component,\n  computed,\n  input,\n} from '@angular/core';\nimport { TruncateTooltip } from '@masterteam/components/tooltip';\nimport { Icon } from '@masterteam/icons';\nimport { displayOrPlaceholder } from '../entity-display.utils';\nimport { EntityField } from '../entity-field/entity-field';\nimport { EntityData, EntityLocationValue } from '../entity.model';\n\n@Component({\n  selector: 'mt-entity-location',\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  imports: [EntityField, Icon, TruncateTooltip],\n  templateUrl: './entity-location.html',\n})\nexport class EntityLocation {\n  readonly data = input<EntityData>();\n\n  readonly displayName = computed(() => this.data()?.name ?? '');\n  readonly location = computed(() =>\n    normalizeEntityLocation(this.data()?.value),\n  );\n  readonly displayValue = computed(() =>\n    displayOrPlaceholder(\n      this.location()?.display_name ?? this.location()?.address ?? null,\n    ),\n  );\n  readonly coordinates = computed(() => {\n    const location = this.location();\n    const lat = location?.lat;\n    const lon = location?.lon ?? location?.lng;\n    if (lat === undefined || lon === undefined || lat === '' || lon === '') {\n      return '';\n    }\n    return `${lat}, ${lon}`;\n  });\n  readonly mapsUrl = computed(() => {\n    const location = this.location();\n    const lat = location?.lat;\n    const lon = location?.lon ?? location?.lng;\n    if (lat === undefined || lon === undefined || lat === '' || lon === '') {\n      return '';\n    }\n    return `https://www.google.com/maps/?q=${encodeURIComponent(`${lat},${lon}`)}`;\n  });\n}\n\nfunction normalizeEntityLocation(\n  value: EntityData['value'] | undefined,\n): EntityLocationValue | null {\n  if (value === null || value === undefined || value === '') {\n    return null;\n  }\n\n  if (typeof value === 'string') {\n    const trimmed = value.trim();\n    if (!trimmed) return null;\n\n    try {\n      return normalizeEntityLocation(\n        JSON.parse(trimmed) as EntityData['value'],\n      );\n    } catch {\n      return {\n        display_name: trimmed,\n        address: trimmed,\n      };\n    }\n  }\n\n  if (typeof value !== 'object' || Array.isArray(value)) {\n    return {\n      display_name: String(value),\n      address: String(value),\n    };\n  }\n\n  const source = value as Record<string, unknown>;\n  const displayName =\n    readString(source['display_name']) ??\n    readString(source['displayName']) ??\n    readString(source['address']) ??\n    readString(source['name']);\n  const lon = source['lon'] ?? source['lng'];\n\n  return {\n    ...source,\n    ...(displayName ? { display_name: displayName, address: displayName } : {}),\n    ...(lon !== undefined ? { lon: lon as string | number } : {}),\n  };\n}\n\nfunction readString(value: unknown): string | undefined {\n  return typeof value === 'string' && value.trim() ? value.trim() : undefined;\n}\n","<mt-entity-field\r\n  [label]=\"displayName()\"\r\n  [labelIconName]=\"'map.marker-pin-01'\"\r\n  [configuration]=\"data()?.configuration\"\r\n  gap=\"normal\"\r\n>\r\n  @if (mapsUrl()) {\r\n    <a\r\n      [href]=\"mapsUrl()\"\r\n      target=\"_blank\"\r\n      rel=\"noopener noreferrer\"\r\n      class=\"flex min-w-0 max-w-full items-center gap-1.5 text-sm font-semibold text-primary-600 hover:text-primary-700\"\r\n      mtTruncateTooltip\r\n      tooltipPosition=\"top\"\r\n    >\r\n      <mt-icon icon=\"map.marker-pin-01\" size=\"sm\" class=\"shrink-0\" />\r\n      <span class=\"min-w-0 truncate\">{{ displayValue() }}</span>\r\n    </a>\r\n  } @else {\r\n    <div\r\n      class=\"min-w-0 max-w-full truncate text-sm font-semibold\"\r\n      mtTruncateTooltip\r\n      tooltipPosition=\"top\"\r\n    >\r\n      {{ displayValue() }}\r\n    </div>\r\n  }\r\n\r\n  @if (coordinates()) {\r\n    <div class=\"min-w-0 truncate text-xs text-gray-500\">\r\n      {{ coordinates() }}\r\n    </div>\r\n  }\r\n</mt-entity-field>\r\n","import {\n  ChangeDetectionStrategy,\n  Component,\n  computed,\n  input,\n} from '@angular/core';\nimport { TruncateTooltip } from '@masterteam/components/tooltip';\nimport { displayOrPlaceholder } from '../entity-display.utils';\nimport { EntityField } from '../entity-field/entity-field';\nimport { EntityConnectionValue, EntityData } from '../entity.model';\n\n@Component({\n  selector: 'mt-entity-connection',\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  standalone: true,\n  imports: [EntityField, TruncateTooltip],\n  templateUrl: './entity-connection.html',\n})\nexport class EntityConnection {\n  /** Full entity data object */\n  readonly data = input<EntityData>();\n\n  /** Individual inputs (used when data is not provided) */\n  readonly name = input<string>();\n  readonly value = input<EntityConnectionValue | string>();\n\n  readonly displayName = computed(() => this.data()?.name ?? this.name() ?? '');\n\n  /** The connection display lives on `rawValue.display`; fall back to `value`. */\n  readonly connection = computed<EntityConnectionValue | null>(() => {\n    const d = this.data();\n    return (\n      normalizeEntityConnection(d?.value ?? d?.rawValue) ??\n      normalizeEntityConnection(this.value())\n    );\n  });\n\n  readonly displayValue = computed(() =>\n    displayOrPlaceholder(this.connection()?.display),\n  );\n}\n\nfunction normalizeEntityConnection(\n  value: unknown,\n): EntityConnectionValue | null {\n  if (value === null || value === undefined || value === '') {\n    return null;\n  }\n\n  if (typeof value === 'string') {\n    const trimmed = value.trim();\n    if (!trimmed) return null;\n\n    try {\n      return normalizeEntityConnection(JSON.parse(trimmed));\n    } catch {\n      return { display: trimmed };\n    }\n  }\n\n  if (typeof value !== 'object' || Array.isArray(value)) {\n    return { display: String(value) };\n  }\n\n  const source = value as Record<string, unknown>;\n  // Parsed payload uses `display`; the serialized JSON value uses `Display`.\n  const display =\n    typeof source['display'] === 'string'\n      ? (source['display'] as string)\n      : typeof source['Display'] === 'string'\n        ? (source['Display'] as string)\n        : undefined;\n\n  return { ...source, ...(display !== undefined ? { display } : {}) };\n}\n","<mt-entity-field\n  [label]=\"displayName()\"\n  [configuration]=\"data()?.configuration\"\n>\n  <div\n    class=\"min-w-0 max-w-full truncate text-sm font-semibold\"\n    mtTruncateTooltip\n    tooltipPosition=\"top\"\n  >\n    {{ displayValue() }}\n  </div>\n</mt-entity-field>\n","import {\n  ChangeDetectionStrategy,\n  Component,\n  computed,\n  input,\n} from '@angular/core';\nimport { Chip } from '@masterteam/components/chip';\nimport { ENTITY_EMPTY_VALUE_PLACEHOLDER } from '../entity-display.utils';\nimport { EntityField } from '../entity-field/entity-field';\nimport { EntityData, EntityScheduleItemValue } from '../entity.model';\n\n/**\n * Preview renderer for `ScheduleItemSelector` properties.\n *\n * The value is the array of resolved schedule items returned by runtime\n * rendering (`{ id, name, status, ... }`); each one is shown as a chip.\n */\n@Component({\n  selector: 'mt-entity-schedule-item',\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  standalone: true,\n  imports: [EntityField, Chip],\n  templateUrl: './entity-schedule-item.html',\n})\nexport class EntityScheduleItem {\n  /** Full entity data object */\n  readonly data = input<EntityData>();\n\n  readonly displayName = computed(() => this.data()?.name ?? '');\n\n  readonly items = computed<EntityScheduleItemValue[]>(() => {\n    const value = this.data()?.value;\n    if (!Array.isArray(value)) return [];\n    return (value as unknown[]).filter(\n      (item): item is EntityScheduleItemValue =>\n        !!item && typeof item === 'object' && 'name' in item,\n    );\n  });\n\n  readonly emptyLabel = ENTITY_EMPTY_VALUE_PLACEHOLDER;\n}\n","<mt-entity-field\n  [label]=\"displayName()\"\n  [configuration]=\"data()?.configuration\"\n  gap=\"normal\"\n>\n  @if (items().length) {\n    <div class=\"flex flex-wrap items-center gap-2\">\n      @for (item of items(); track item.id) {\n        <mt-chip [label]=\"item.name\" size=\"small\" />\n      }\n    </div>\n  } @else {\n    <span\n      class=\"inline-flex items-center px-3 py-2 rounded-md text-xs font-semibold w-fit text-gray-500 bg-gray-100\"\n    >\n      {{ emptyLabel }}\n    </span>\n  }\n</mt-entity-field>\n","import {\r\n  EntityListLocalCell,\r\n  EntityListLocalRow,\r\n  EntityListLocalSchema,\r\n  EntityListLocalSchemaField,\r\n  EntityListTranslatable,\r\n} from './entity.model';\r\n\r\n/**\r\n * Pure helpers shared by everything that reads a Local `EntityList`\r\n * (`storageMode: \"Local\"`) — the runtime field that edits it and the preview\r\n * that only renders it. See `.github/instructions/properties/EntityList.md`.\r\n */\r\n\r\n/**\r\n * The schema's fields a row is rendered with, in order.\r\n *\r\n * A removed field stays in the stored schema as `hidden` so its values survive\r\n * and come back if it is re-added. The projected schema of a loaded value has\r\n * already dropped them, but the configuration's copy — what a create form falls\r\n * back to — has not.\r\n */\r\nexport function visibleLocalSchemaFields(\r\n  schema: EntityListLocalSchema | null | undefined,\r\n): EntityListLocalSchemaField[] {\r\n  const fields = Array.isArray(schema?.fields) ? schema.fields : [];\r\n  return fields\r\n    .filter((field) => !!field && !field.hidden && !!field.id)\r\n    .slice()\r\n    .sort((a, b) => (a.order ?? 0) - (b.order ?? 0));\r\n}\r\n\r\nfunction pickTranslatable(\r\n  value: EntityListTranslatable | null | undefined,\r\n  lang: string,\r\n): string {\r\n  if (!value) return '';\r\n  const own = lang === 'ar' ? value.ar : value.en;\r\n  const other = lang === 'ar' ? value.en : value.ar;\r\n  return (own ?? '').trim() || (other ?? '').trim();\r\n}\r\n\r\n/**\r\n * The label a field renders under: its local override, then the source label\r\n * captured when it was published, then its key. The publisher writes an\r\n * override into the captured definition as well, so either path shows it.\r\n */\r\nexport function resolveLocalFieldLabel(\r\n  field: EntityListLocalSchemaField,\r\n  lang = 'en',\r\n): string {\r\n  const definition = field.definition;\r\n  return (\r\n    pickTranslatable(field.label, lang) ||\r\n    pickTranslatable(\r\n      { en: definition?.nameEn, ar: definition?.nameAr },\r\n      lang,\r\n    ) ||\r\n    (definition?.name ?? '').trim() ||\r\n    field.sourceKey\r\n  );\r\n}\r\n\r\n/** The source view type the field captured; `Text` when none was. */\r\nexport function resolveLocalFieldViewType(\r\n  field: EntityListLocalSchemaField,\r\n): string {\r\n  return field.definition?.viewType || 'Text';\r\n}\r\n\r\n/**\r\n * The captured source configuration (lookup id, percentage colour rules …).\r\n * `PropertyDefinitionReadDto.configuration` is typed `object?`, so the backend\r\n * writes whatever the source held — an object, or its JSON text.\r\n */\r\nexport function resolveLocalFieldConfiguration(\r\n  field: EntityListLocalSchemaField,\r\n): Record<string, unknown> | null {\r\n  const configuration = field.definition?.configuration;\r\n  if (!configuration) return null;\r\n  if (typeof configuration !== 'string') return configuration;\r\n  try {\r\n    const parsed: unknown = JSON.parse(configuration);\r\n    return parsed && typeof parsed === 'object' && !Array.isArray(parsed)\r\n      ? (parsed as Record<string, unknown>)\r\n      : null;\r\n  } catch {\r\n    return null;\r\n  }\r\n}\r\n\r\n/** A row's cells keyed by field id. */\r\nexport function localCellsByFieldId(\r\n  row: EntityListLocalRow,\r\n): Map<string, EntityListLocalCell> {\r\n  const map = new Map<string, EntityListLocalCell>();\r\n  for (const cell of Array.isArray(row?.cells) ? row.cells : []) {\r\n    if (cell?.fieldId) map.set(cell.fieldId, cell);\r\n  }\r\n  return map;\r\n}\r\n\r\n/** Rows in their stored order. */\r\nexport function sortLocalRows(\r\n  rows: readonly EntityListLocalRow[] | null | undefined,\r\n): EntityListLocalRow[] {\r\n  return (Array.isArray(rows) ? rows : [])\r\n    .filter((row) => !!row?.rowId)\r\n    .slice()\r\n    .sort((a, b) => (a.order ?? 0) - (b.order ?? 0));\r\n}\r\n","import {\r\n  EntityConfiguration,\r\n  EntityData,\r\n  EntityListEntityValue,\r\n  EntityListInlineFieldMeta,\r\n  EntityListLocalDocument,\r\n  EntityListLocalSchema,\r\n  EntityListRowValue,\r\n  EntityListSelectionDocument,\r\n  EntityPropertyConfiguration,\r\n  EntityViewType,\r\n  isEntityListLocalDocument,\r\n  isEntityListSelectionDocument,\r\n} from './entity.model';\r\nimport {\r\n  localCellsByFieldId,\r\n  resolveLocalFieldConfiguration,\r\n  resolveLocalFieldLabel,\r\n  resolveLocalFieldViewType,\r\n  sortLocalRows,\r\n  visibleLocalSchemaFields,\r\n} from './entity-list-local.util';\r\n\r\n/** One rendered row of an `EntityList` value: a title plus the rest. */\r\nexport interface EntityListRenderedRow {\r\n  id: string;\r\n  /** First field by order — the row's own name. */\r\n  title: EntityData | null;\r\n  /** Everything else, already stripped of machine companions. */\r\n  fields: EntityData[];\r\n}\r\n\r\n/**\r\n * Nested fields render as small labelled pairs. The row is the unit of\r\n * meaning, so labels sit above their values and stay muted.\r\n */\r\nconst NESTED_FIELD_CONFIG: EntityConfiguration = {\r\n  labelPosition: 'top',\r\n  hideLabel: false,\r\n};\r\n\r\n/**\r\n * A badge already says what it is: \"Status\" stacked above a green \"Completed\"\r\n * pill is one wasted line per row. Applies only to the folded `_key`/`_color`\r\n * status, whose display text is its own label.\r\n */\r\nconst BADGE_FIELD_CONFIG: EntityConfiguration = {\r\n  hideLabel: true,\r\n};\r\n\r\n/** The title renders bare — the row itself is the label. */\r\nconst TITLE_FIELD_CONFIG: EntityConfiguration = {\r\n  hideLabel: true,\r\n};\r\n\r\n/**\r\n * Suffixes that mark a field as the *machine companion* of another field\r\n * present in the same list — `status_key` and `status_color` describe\r\n * `status`, they are not values of their own. Folded into a single `Status`\r\n * entity so the trio renders as one coloured badge, which is what the backend\r\n * emits them for.\r\n */\r\nconst COMPANION_SUFFIXES = ['key', 'color'] as const;\r\n\r\nfunction normalizeViewType(viewType: string | undefined): EntityViewType {\r\n  return (viewType ?? 'Text') as EntityViewType;\r\n}\r\n\r\n/**\r\n * Identifier fields are plumbing, not content: a row that reads\r\n * \"Schema Phase Gate Item Id: 5\" tells the reader nothing. Only `Number`\r\n * fields are dropped, so a genuine text field ending in `_id` still renders.\r\n */\r\nfunction isIdentifierField(meta: EntityListInlineFieldMeta): boolean {\r\n  return (\r\n    normalizeViewType(meta.viewType) === 'Number' &&\r\n    meta.key.toLowerCase().endsWith('_id')\r\n  );\r\n}\r\n\r\n/**\r\n * Derive a readable label from a raw field key. Inline `EntityList` fields\r\n * carry no label of their own — the configuration defines them as bare keys —\r\n * so this strips separators and title-cases what is left.\r\n */\r\nexport function humanizeEntityListKey(key: string): string {\r\n  const words = key\r\n    .replace(/[_-]+/g, ' ')\r\n    .replace(/([a-z0-9])([A-Z])/g, '$1 $2')\r\n    .trim();\r\n  if (!words) return key;\r\n  return words.charAt(0).toUpperCase() + words.slice(1);\r\n}\r\n\r\n/**\r\n * The value arrives parsed when the host hands over the rendered cell, and as\r\n * JSON when it comes through `rawValue` — the table serializes object cells on\r\n * the way in.\r\n */\r\nfunction coerceValue(\r\n  data: EntityData,\r\n):\r\n  | EntityListEntityValue\r\n  | EntityListLocalDocument\r\n  | EntityListSelectionDocument\r\n  | null {\r\n  const value = data.value;\r\n  if (value && typeof value === 'object' && !Array.isArray(value)) {\r\n    return value as EntityListEntityValue;\r\n  }\r\n\r\n  const raw = typeof value === 'string' && value ? value : data.rawValue;\r\n  if (typeof raw !== 'string' || !raw.trim()) return null;\r\n\r\n  try {\r\n    const parsed: unknown = JSON.parse(raw);\r\n    return parsed && typeof parsed === 'object' && !Array.isArray(parsed)\r\n      ? (parsed as EntityListEntityValue)\r\n      : null;\r\n  } catch {\r\n    return null;\r\n  }\r\n}\r\n\r\n/**\r\n * The inline field catalog. `propertyConfiguration` is the untouched catalog\r\n * entry; `configuration` is read as well because the table merges its own\r\n * display flags into that object when it builds a cell.\r\n */\r\nfunction readInlineFields(data: EntityData): EntityListInlineFieldMeta[] {\r\n  const sources: EntityPropertyConfiguration[] = [\r\n    data.propertyConfiguration ?? null,\r\n    (data.configuration ?? null) as EntityPropertyConfiguration,\r\n  ];\r\n\r\n  for (const source of sources) {\r\n    if (!source || Array.isArray(source)) continue;\r\n    const fields = (source as Record<string, unknown>)['inlineFields'];\r\n    if (Array.isArray(fields) && fields.length > 0) {\r\n      return fields as EntityListInlineFieldMeta[];\r\n    }\r\n  }\r\n\r\n  return [];\r\n}\r\n\r\n/**\r\n * The field this one is a machine companion of, when that field is present in\r\n * the same list. `status_color` returns `status`; a standalone `color` field\r\n * with no `color` sibling returns null and renders normally.\r\n */\r\nfunction companionTargetOf(\r\n  field: EntityListInlineFieldMeta,\r\n  present: Set<string>,\r\n): string | null {\r\n  for (const suffix of COMPANION_SUFFIXES) {\r\n    if (!field.key.endsWith(`_${suffix}`)) continue;\r\n    const target = field.key.slice(0, -(suffix.length + 1));\r\n    if (target && present.has(target)) return target;\r\n  }\r\n  return null;\r\n}\r\n\r\n/** Field definitions in render order, machine companions already removed. */\r\nfunction visibleFields(\r\n  data: EntityData,\r\n  allowed: readonly string[],\r\n): EntityListInlineFieldMeta[] {\r\n  const declared = [...readInlineFields(data)].sort(\r\n    (a, b) => (a.order ?? 0) - (b.order ?? 0),\r\n  );\r\n  const present = new Set(declared.map((field) => field.key));\r\n  const visible = declared.filter(\r\n    (field) => !isIdentifierField(field) && !companionTargetOf(field, present),\r\n  );\r\n\r\n  if (allowed.length === 0) return visible;\r\n\r\n  const byKey = new Map(visible.map((field) => [field.key, field]));\r\n  return allowed\r\n    .map((key) => byKey.get(key))\r\n    .filter((field): field is EntityListInlineFieldMeta => !!field);\r\n}\r\n\r\nfunction valuesByKey(row: EntityListRowValue): Map<string, string | null> {\r\n  const map = new Map<string, string | null>();\r\n  for (const item of row.values ?? []) {\r\n    if (item?.propertyKey) map.set(item.propertyKey, item.rawValue ?? null);\r\n  }\r\n  return map;\r\n}\r\n\r\n/**\r\n * Builds the entity for one nested field. A field with a `_key`/`_color`\r\n * companion becomes a `Status`, so the trio renders as one coloured badge\r\n * instead of three separate cells.\r\n */\r\nfunction toNestedEntity(\r\n  field: EntityListInlineFieldMeta,\r\n  values: Map<string, string | null>,\r\n): EntityData | null {\r\n  const raw = values.get(field.key) ?? null;\r\n  const color = values.get(`${field.key}_color`);\r\n  const statusKey = values.get(`${field.key}_key`);\r\n\r\n  const base = {\r\n    key: field.key,\r\n    name: humanizeEntityListKey(field.key),\r\n    propertyConfiguration: field.configuration,\r\n    configuration: NESTED_FIELD_CONFIG,\r\n    order: field.order,\r\n  };\r\n\r\n  if (color !== undefined || statusKey !== undefined) {\r\n    // No display text means no badge to show — an empty status is empty.\r\n    if (!raw) return null;\r\n    return {\r\n      ...base,\r\n      configuration: BADGE_FIELD_CONFIG,\r\n      rawValue: raw,\r\n      viewType: 'Status',\r\n      value: { key: statusKey ?? raw, display: raw, color: color ?? '' },\r\n    };\r\n  }\r\n\r\n  return {\r\n    ...base,\r\n    rawValue: raw ?? undefined,\r\n    viewType: normalizeViewType(field.viewType),\r\n    value: raw ?? '',\r\n  };\r\n}\r\n\r\n/**\r\n * Turns an `EntityList` entity into rendered rows.\r\n *\r\n * Nothing is fetched: the value already carries `rows[]`, and the property\r\n * configuration's `inlineFields` is the only description of the nested columns\r\n * — the rows themselves carry bare keys. Shared by the trigger\r\n * (`mt-entity-list-preview`, which needs the count and the titles) and the\r\n * drawer that renders them in full.\r\n *\r\n * `allowed` narrows to those keys, in that order; empty renders every field\r\n * that survives the companion and identifier rules.\r\n */\r\nexport function buildEntityListRows(\r\n  data: EntityData,\r\n  allowed: readonly string[] = [],\r\n  lang = 'en',\r\n): EntityListRenderedRow[] {\r\n  const value = coerceValue(data);\r\n  if (isEntityListLocalDocument(value)) {\r\n    return buildLocalRows(value, data, allowed, lang);\r\n  }\r\n  if (isEntityListSelectionDocument(value)) {\r\n    return buildSelectionRows(value, data, allowed);\r\n  }\r\n\r\n  const fields = visibleFields(data, allowed);\r\n  const rows = value?.rows;\r\n  if (!Array.isArray(rows)) return [];\r\n\r\n  return rows\r\n    .filter((row) => !!row)\r\n    .map((row, index) => {\r\n      const values = valuesByKey(row);\r\n      const rendered = fields\r\n        .map((field) => toNestedEntity(field, values))\r\n        .filter((entity): entity is EntityData => !!entity);\r\n\r\n      // The title is the first field that actually rendered, not the first\r\n      // that was declared: a leading field can drop out (an empty status\r\n      // renders nothing), and the survivor promoted into the title slot must\r\n      // lose its label there rather than keep the one it was built with.\r\n      const [first, ...rest] = rendered;\r\n\r\n      return {\r\n        id: String(row.rowId ?? row.entityId ?? index),\r\n        title: first ? { ...first, configuration: TITLE_FIELD_CONFIG } : null,\r\n        fields: rest,\r\n      };\r\n    });\r\n}\r\n\r\n/**\r\n * Rows of a Local list (`storageMode: \"Local\"`).\r\n *\r\n * The projected document `process-form-load` returns carries its own\r\n * `schema`, and it wins: pending and approved evidence is pinned to the schema\r\n * it was submitted against, which the property configuration's *active* one\r\n * may no longer be. The fetch endpoints project against the active schema;\r\n * an older backend returned the stored document there (`schema: null`), for\r\n * which the configuration's `localSchema` is the fallback.\r\n * Cells are keyed by the field's local id and carry the backend-rendered\r\n * `value` beside `rawValue` where one was rendered; otherwise the raw value\r\n * shows.\r\n *\r\n * `allowed` narrows by source key, the one identity the host can know.\r\n */\r\nfunction buildLocalRows(\r\n  document: EntityListLocalDocument,\r\n  data: EntityData,\r\n  allowed: readonly string[],\r\n  lang: string,\r\n): EntityListRenderedRow[] {\r\n  const declared = visibleLocalSchemaFields(\r\n    document.schema ?? readConfiguredLocalSchema(data),\r\n  );\r\n  const bySourceKey = new Map(\r\n    declared.map((field) => [field.sourceKey, field]),\r\n  );\r\n  const fields =\r\n    allowed.length === 0\r\n      ? declared\r\n      : allowed\r\n          .map((key) => bySourceKey.get(key))\r\n          .filter((field): field is (typeof declared)[number] => !!field);\r\n\r\n  return sortLocalRows(document.localRows).map((row) => {\r\n    const cells = localCellsByFieldId(row);\r\n    const rendered = fields.map<EntityData>((field) => {\r\n      const cell = cells.get(field.id as string);\r\n      const rawValue = cell?.rawValue ?? undefined;\r\n      return {\r\n        key: field.sourceKey,\r\n        name: resolveLocalFieldLabel(field, lang),\r\n        viewType: normalizeViewType(resolveLocalFieldViewType(field)),\r\n        value: (cell?.value ?? rawValue ?? '') as EntityData['value'],\r\n        rawValue,\r\n        propertyConfiguration:\r\n          resolveLocalFieldConfiguration(field) ?? undefined,\r\n        configuration: NESTED_FIELD_CONFIG,\r\n        order: field.order,\r\n      };\r\n    });\r\n\r\n    // The title names the row, and it renders without its label. The first\r\n    // field of a Local list is whatever the field manager put first — often a\r\n    // progress bar or a date, which as a bare headline reads as the row's\r\n    // name. So the title is the first filled text field; everything else keeps\r\n    // its label, in schema order. A row with no text to name it has no title.\r\n    const titleIndex = rendered.findIndex(isRowNameField);\r\n    const title = titleIndex >= 0 ? rendered[titleIndex] : null;\r\n\r\n    return {\r\n      id: row.rowId,\r\n      title: title ? { ...title, configuration: TITLE_FIELD_CONFIG } : null,\r\n      fields: rendered.filter((_, index) => index !== titleIndex),\r\n    };\r\n  });\r\n}\r\n\r\n/**\r\n * Rows of a Selected list (`recordMode: \"Selected\"`): one per selected record\r\n * the value carries values for, in selection order.\r\n *\r\n * Here there is no metadata request, so nothing names the fields or their\r\n * view types: labels come from the keys and each value renders as its display\r\n * text. A record whose values the backend withheld (`unavailableIds`) has\r\n * nothing to show and is left out.\r\n *\r\n * `allowed` narrows by field key; otherwise the configured `readFields`\r\n * order, then the order the values arrived in.\r\n */\r\nfunction buildSelectionRows(\r\n  document: EntityListSelectionDocument,\r\n  data: EntityData,\r\n  allowed: readonly string[],\r\n): EntityListRenderedRow[] {\r\n  const records = new Map(\r\n    (document.records ?? []).map((record) => [record.entityId, record]),\r\n  );\r\n  const ids = document.entityIds?.length\r\n    ? document.entityIds\r\n    : [...records.keys()];\r\n  const configured = readConfiguredReadFields(data);\r\n\r\n  return ids.flatMap((id) => {\r\n    const record = records.get(id);\r\n    if (!record) return [];\r\n    const values = new Map(\r\n      (record.values ?? []).map((item) => [item.propertyKey, item]),\r\n    );\r\n    const keys = allowed.length\r\n      ? allowed\r\n      : configured.length\r\n        ? configured\r\n        : [...values.keys()];\r\n    const rendered = keys\r\n      .map((key) => values.get(key))\r\n      .filter((item) => !!item)\r\n      .map<EntityData>((item, index) => ({\r\n        key: item.propertyKey,\r\n        name: humanizeEntityListKey(item.propertyKey),\r\n        ...selectionCell(item.value, item.rawValue),\r\n        rawValue: item.rawValue ?? undefined,\r\n        configuration: NESTED_FIELD_CONFIG,\r\n        order: index,\r\n      }));\r\n    const [first, ...rest] = rendered;\r\n\r\n    return [\r\n      {\r\n        id: String(record.entityId),\r\n        title: first ? { ...first, configuration: TITLE_FIELD_CONFIG } : null,\r\n        fields: rest,\r\n      },\r\n    ];\r\n  });\r\n}\r\n\r\n/** The configured displayed fields of a Selected list, if any. */\r\nfunction readConfiguredReadFields(data: EntityData): string[] {\r\n  for (const source of [data.propertyConfiguration, data.configuration]) {\r\n    if (!source || Array.isArray(source)) continue;\r\n    const fields = (source as Record<string, unknown>)['readFields'];\r\n    if (Array.isArray(fields) && fields.length) {\r\n      return fields.filter(\r\n        (key): key is string => typeof key === 'string' && !!key,\r\n      );\r\n    }\r\n  }\r\n  return [];\r\n}\r\n\r\n/** An ISO date or date-time, as the backend renders a Date / DateTime value. */\r\nconst ISO_DATE =\r\n  /^\\d{4}-\\d{2}-\\d{2}(T\\d{2}:\\d{2}(:\\d{2}(\\.\\d+)?)?(Z|[+-]\\d{2}:?\\d{2})?)?$/;\r\n\r\n/**\r\n * How one Selected cell renders without field metadata — a table cell has\r\n * none to ask for. The rendered value's own shape decides: an ISO date is a\r\n * `Date` (printed `2026/09/20`, not `2026-09-20T00:00:00.0000000Z`), a user\r\n * object a `User`, and everything else its display text.\r\n */\r\nfunction selectionCell(\r\n  value: unknown,\r\n  rawValue: string | null | undefined,\r\n): Pick<EntityData, 'viewType' | 'value'> {\r\n  if (typeof value === 'string' && ISO_DATE.test(value.trim())) {\r\n    return { viewType: 'Date', value: value.trim() };\r\n  }\r\n  if (\r\n    value &&\r\n    typeof value === 'object' &&\r\n    !Array.isArray(value) &&\r\n    typeof (value as Record<string, unknown>)['displayName'] === 'string'\r\n  ) {\r\n    return { viewType: 'User', value: value as EntityData['value'] };\r\n  }\r\n  return { viewType: 'Text', value: selectionDisplayText(value, rawValue) };\r\n}\r\n\r\n/**\r\n * A rendered source value as text: a scalar as is, a user or a lookup by its\r\n * display name, a list joined. Falls back to the stored scalar.\r\n */\r\nfunction selectionDisplayText(\r\n  value: unknown,\r\n  rawValue: string | null | undefined,\r\n): string {\r\n  if (value == null || value === '') return rawValue ?? '';\r\n  if (Array.isArray(value)) {\r\n    return value\r\n      .map((entry) => selectionDisplayText(entry, null))\r\n      .filter((text) => !!text)\r\n      .join(', ');\r\n  }\r\n  if (typeof value !== 'object') return String(value);\r\n\r\n  const record = value as Record<string, unknown>;\r\n  for (const key of ['display', 'displayName', 'name']) {\r\n    const text = record[key];\r\n    if (typeof text === 'string' && text.trim()) return text.trim();\r\n  }\r\n  return rawValue ?? '';\r\n}\r\n\r\n/** A text field with a value — something that can name a row. */\r\nfunction isRowNameField(entity: EntityData): boolean {\r\n  if (entity.viewType !== 'Text' && entity.viewType !== 'LongText') {\r\n    return false;\r\n  }\r\n  const value = entity.value;\r\n  return typeof value === 'string' ? value.trim().length > 0 : value != null;\r\n}\r\n\r\n/** The active Local schema from the property configuration, if any. */\r\nfunction readConfiguredLocalSchema(\r\n  data: EntityData,\r\n): EntityListLocalSchema | null {\r\n  for (const source of [data.propertyConfiguration, data.configuration]) {\r\n    if (!source || Array.isArray(source)) continue;\r\n    const schema = (source as Record<string, unknown>)['localSchema'];\r\n    if (schema && typeof schema === 'object') {\r\n      return schema as EntityListLocalSchema;\r\n    }\r\n  }\r\n  return null;\r\n}\r\n\r\n/**\r\n * The row's title as plain text. A title that folded into a `Status` carries\r\n * an object, not a string — reading only the string case would silently drop\r\n * every row from the tooltip whenever the leading field is a status.\r\n */\r\nfunction titleTextOf(row: EntityListRenderedRow): string {\r\n  const value = row.title?.value;\r\n  if (typeof value === 'string') return value.trim();\r\n  if (value && typeof value === 'object' && 'display' in value) {\r\n    const display = (value as { display?: unknown }).display;\r\n    return typeof display === 'string' ? display.trim() : '';\r\n  }\r\n  return '';\r\n}\r\n\r\n/**\r\n * Plain-text summary of the rows, for the trigger's tooltip. Caps the list so\r\n * a forty-item checklist does not become a forty-line tooltip.\r\n */\r\nexport function summarizeEntityListRows(\r\n  rows: readonly EntityListRenderedRow[],\r\n  limit: number,\r\n): { names: string[]; remaining: number } {\r\n  const names = rows.map(titleTextOf).filter((name) => name.length > 0);\r\n\r\n  return {\r\n    names: names.slice(0, limit),\r\n    remaining: Math.max(0, names.length - limit),\r\n  };\r\n}\r\n","import {\r\n  ChangeDetectionStrategy,\r\n  Component,\r\n  computed,\r\n  inject,\r\n  input,\r\n} from '@angular/core';\r\nimport { TooltipModule } from 'primeng/tooltip';\r\nimport { TranslocoService } from '@jsverse/transloco';\r\nimport { readableTextOn } from '@masterteam/components';\r\nimport {\r\n  EntityData,\r\n  EntityLeafDetailsConfig,\r\n  LeafDetailsEntityValue,\r\n  LeafDetailsStatusSummary,\r\n  LeafLevelSavedConfig,\r\n  LeafPhaseSavedConfig,\r\n} from '../entity.model';\r\nimport { EntityField } from '../entity-field/entity-field';\r\nimport { resolveLocalizedLabel } from '../entity-sections.util';\r\nimport { sharedActiveLang } from '../active-lang';\r\n\r\n/** Neutral grey for a status the catalog left without a colour. */\r\nconst DEFAULT_STATUS_COLOR = '#9CA3AF';\r\n\r\n@Component({\r\n  selector: 'mt-entity-leaf-details',\r\n  standalone: true,\r\n  changeDetection: ChangeDetectionStrategy.OnPush,\r\n  imports: [EntityField, TooltipModule],\r\n  templateUrl: './entity-leaf-details.html',\r\n})\r\nexport class EntityLeafDetails {\r\n  private readonly transloco = inject(TranslocoService);\r\n\r\n  readonly data = input.required<EntityData>();\r\n\r\n  /**\r\n   * Re-resolves the \"Phases\" qualifier when the user switches language. The\r\n   * shared signal keeps this to one subscription for the whole grid — a cards\r\n   * board mounts thousands of these.\r\n   */\r\n  private readonly activeLang = sharedActiveLang(this.transloco);\r\n\r\n  readonly leafValue = computed<LeafDetailsEntityValue | null>(() => {\r\n    const v = this.data().value;\r\n    if (v && typeof v === 'object' && !Array.isArray(v) && 'levelId' in v) {\r\n      return v as LeafDetailsEntityValue;\r\n    }\r\n    return null;\r\n  });\r\n\r\n  /** True when this item paints the level's phase badges instead of statuses. */\r\n  readonly isPhaseItem = computed(() => this.leafValue()?.kind === 'phase');\r\n\r\n  /**\r\n   * This tile's own saved overrides — the `leafLevels` / `leafPhases` entry for\r\n   * its child level. The two maps are kept apart because one level can render\r\n   * both projections, each with its own slot, width and now label.\r\n   */\r\n  private readonly tileConfig = computed<\r\n    LeafLevelSavedConfig | LeafPhaseSavedConfig | undefined\r\n  >(() => {\r\n    const levelId = this.leafValue()?.levelId;\r\n    if (levelId == null) return undefined;\r\n    const config = this.data().configuration as\r\n      | EntityLeafDetailsConfig\r\n      | undefined;\r\n    const map = this.isPhaseItem() ? config?.leafPhases : config?.leafLevels;\r\n    return map?.[String(levelId)];\r\n  });\r\n\r\n  /**\r\n   * The badges to paint. Phases and statuses carry the same `{ key, display,\r\n   * color, count }` shape, so one template drives both — only which projection\r\n   * of the level is read differs.\r\n   */\r\n  readonly badges = computed<LeafDetailsStatusSummary[]>(() => {\r\n    const leaf = this.leafValue();\r\n    if (!leaf) return [];\r\n    return this.isPhaseItem() ? (leaf.phases ?? []) : leaf.statuses;\r\n  });\r\n\r\n  /**\r\n   * Label shown below the badges: \"Level Name (total)\", with a \"— Phases\"\r\n   * qualifier on an unnamed phase item so a level configured with both\r\n   * projections does not render two identically-labelled tiles.\r\n   *\r\n   * The custom label is read off the tile's OWN per-level entry, not from\r\n   * `data().name` and not from the parent property's `configuration.label`.\r\n   *\r\n   * Not `name`, because for this view type it does not survive the trip: both\r\n   * hosts resolve a label into `name` up front (`toEntityData` in\r\n   * client-instance-preview, `openDrawer` in the customization builder), and\r\n   * then `expandLeafDetailsEntity` rewrites `name` to the child level's own\r\n   * name when it splits the property into one tile per level.\r\n   *\r\n   * Not the parent's label, because one property becomes many tiles — one per\r\n   * child level, and again per projection. A label held on the parent paints\r\n   * the same text on every one of them, which is what makes a card show\r\n   * \"Delivery Portfolio (7)\" three times over. `order` and `size` were already\r\n   * per-level for exactly this reason; the label follows them.\r\n   *\r\n   * A custom label owns the whole name. The \"— Phases\" qualifier is only the\r\n   * *default* disambiguator for a level that renders both projections — once an\r\n   * author names the phase tile themselves, appending it would force a suffix\r\n   * onto text they wrote, and \"Delivery Stages — Phases\" is not something they\r\n   * can spell their way out of. So the qualifier applies to the fallback name\r\n   * only; the author is trusted to have distinguished the tile.\r\n   *\r\n   * `(total)` is the one thing always appended — the count is the point of the\r\n   * tile, and it is live data, not part of anyone's label.\r\n   */\r\n  readonly labelWithTotal = computed(() => {\r\n    const leaf = this.leafValue();\r\n    const lang = this.activeLang();\r\n    const custom = resolveLocalizedLabel(this.tileConfig()?.label, lang);\r\n    const fallback = this.data().name || leaf?.levelName || '';\r\n    const qualified =\r\n      this.isPhaseItem() && fallback\r\n        ? `${fallback} — ${this.transloco.translate('components.entitiesPreview.leafPhases', {}, lang)}`\r\n        : fallback;\r\n    const name = custom || qualified;\r\n    if (!leaf) return name;\r\n    const total = this.badges().reduce((sum, badge) => sum + badge.count, 0);\r\n    return `${name} (${total})`;\r\n  });\r\n\r\n  readonly labelIcon = computed(() => this.leafValue()?.levelIcon ?? null);\r\n\r\n  statusColor(color: string | null): string {\r\n    return color ?? DEFAULT_STATUS_COLOR;\r\n  }\r\n\r\n  /**\r\n   * Foreground for the count, chosen against the badge colour instead of always\r\n   * white — a light catalog colour measured 2.59:1 with white on it, the lowest\r\n   * contrast in the product (findings M-04, H-03).\r\n   */\r\n  statusTextColor(color: string | null): string {\r\n    return readableTextOn(this.statusColor(color));\r\n  }\r\n}\r\n","<mt-entity-field\r\n  [label]=\"labelWithTotal()\"\r\n  [labelIconName]=\"labelIcon()\"\r\n  [configuration]=\"data().configuration\"\r\n  gap=\"normal\"\r\n>\r\n  @if (leafValue()) {\r\n    <div class=\"flex flex-wrap gap-1.5\">\r\n      @for (badge of badges(); track badge.key) {\r\n        <!--\r\n          The badge is a count, and the colour is the only thing saying WHICH\r\n          count — so the status/phase name has to be reachable without hovering,\r\n          and the number has to be legible on whatever hex the tenant's catalog\r\n          carries. The tooltip names it for a pointer, the aria-label names it\r\n          for a screen reader, and the foreground is chosen against the badge\r\n          colour rather than hardcoded white (findings M-04, H-03).\r\n        -->\r\n        <div\r\n          class=\"flex h-7 min-w-7 items-center justify-center rounded-lg px-1.5 text-xs font-bold tabular-nums\"\r\n          role=\"img\"\r\n          [style.background-color]=\"statusColor(badge.color)\"\r\n          [style.color]=\"statusTextColor(badge.color)\"\r\n          [attr.aria-label]=\"badge.display + ': ' + badge.count\"\r\n          [pTooltip]=\"badge.display\"\r\n          tooltipPosition=\"top\"\r\n        >\r\n          {{ badge.count }}\r\n        </div>\r\n      }\r\n      @if (badges().length === 0) {\r\n        <span class=\"text-sm text-muted-color\">—</span>\r\n      }\r\n    </div>\r\n  }\r\n</mt-entity-field>\r\n","import {\r\n  ChangeDetectionStrategy,\r\n  Component,\r\n  computed,\r\n  input,\r\n} from '@angular/core';\r\nimport { EntityData, EntityViewType } from '../entity.model';\r\nimport { EntityText } from '../entity-text/entity-text';\r\nimport { EntityLongText } from '../entity-long-text/entity-long-text';\r\nimport { EntityDate } from '../entity-date/entity-date';\r\nimport { EntityUser } from '../entity-user/entity-user';\r\nimport { EntityPercentage } from '../entity-percentage/entity-percentage';\r\nimport { EntityCurrency } from '../entity-currency/entity-currency';\r\nimport { EntityCheckbox } from '../entity-checkbox/entity-checkbox';\r\nimport { EntityLookup } from '../entity-lookup/entity-lookup';\r\nimport { EntityPhaseGate } from '../entity-phase-gate/entity-phase-gate';\r\nimport { EntityPerformanceScore } from '../entity-performance-score/entity-performance-score';\r\nimport { EntityAttachment } from '../entity-attachment/entity-attachment';\r\nimport { EntityStatus } from '../entity-status/entity-status';\r\nimport { EntityIcon } from '../entity-icon/entity-icon';\r\nimport { EntityColor } from '../entity-color/entity-color';\r\nimport { EntityLeafDetails } from '../entity-leaf-details/entity-leaf-details';\r\nimport { EntityLocation } from '../entity-location/entity-location';\r\nimport { EntityConnection } from '../entity-connection/entity-connection';\r\nimport { EntityScheduleItem } from '../entity-schedule-item/entity-schedule-item';\r\n\r\n/**\r\n * Renders an entity value by view type.\r\n *\r\n * `LookupModuleCheckList` is deliberately not handled here: that component\r\n * renders each of its nested properties *through* this one, so routing it back\r\n * through here would make the two files import each other. `EntityPreviewBody`\r\n * owns that case and delegates every other view type to this component.\r\n */\r\n@Component({\r\n  selector: 'mt-entity-value-preview',\r\n  standalone: true,\r\n  changeDetection: ChangeDetectionStrategy.OnPush,\r\n  imports: [\r\n    EntityText,\r\n    EntityLongText,\r\n    EntityDate,\r\n    EntityUser,\r\n    EntityPercentage,\r\n    EntityCurrency,\r\n    EntityCheckbox,\r\n    EntityLookup,\r\n    EntityPhaseGate,\r\n    EntityPerformanceScore,\r\n    EntityAttachment,\r\n    EntityStatus,\r\n    EntityIcon,\r\n    EntityColor,\r\n    EntityLeafDetails,\r\n    EntityLocation,\r\n    EntityConnection,\r\n    EntityScheduleItem,\r\n  ],\r\n  templateUrl: './entity-value-preview.html',\r\n  host: {\r\n    class: 'block min-w-0 w-full',\r\n  },\r\n})\r\nexport class EntityValuePreview {\r\n  readonly data = input.required<EntityData>();\r\n  readonly attachmentShape = input<'default' | 'compact'>('default');\r\n\r\n  /** Lookup variants share the same colored-badge renderer. */\r\n  readonly previewType = computed<EntityViewType>(() => {\r\n    const viewType = this.data().viewType;\r\n    return viewType === 'LookupMatrix' || viewType === 'LookupMultiSelect'\r\n      ? 'Lookup'\r\n      : viewType;\r\n  });\r\n}\r\n","@switch (previewType()) {\r\n  @case (\"Text\") {\r\n    <mt-entity-text [data]=\"data()\" />\r\n  }\r\n  @case (\"LongText\") {\r\n    <mt-entity-long-text [data]=\"data()\" />\r\n  }\r\n  @case (\"Date\") {\r\n    <mt-entity-date [data]=\"data()\" />\r\n  }\r\n  @case (\"DateTime\") {\r\n    <mt-entity-date [data]=\"data()\" [viewType]=\"'DateTime'\" />\r\n  }\r\n  @case (\"Time\") {\r\n    <mt-entity-date [data]=\"data()\" [viewType]=\"'Time'\" />\r\n  }\r\n  @case (\"User\") {\r\n    <mt-entity-user [data]=\"data()\" />\r\n  }\r\n  @case (\"MultiUser\") {\r\n    <mt-entity-user [data]=\"data()\" />\r\n  }\r\n  @case (\"Percentage\") {\r\n    <mt-entity-percentage [data]=\"data()\" />\r\n  }\r\n  @case (\"Currency\") {\r\n    <mt-entity-currency [data]=\"data()\" />\r\n  }\r\n  @case (\"Number\") {\r\n    <mt-entity-text [data]=\"data()\" />\r\n  }\r\n  @case (\"Checkbox\") {\r\n    <mt-entity-checkbox [data]=\"data()\" />\r\n  }\r\n  @case (\"Lookup\") {\r\n    <mt-entity-lookup [data]=\"data()\" />\r\n  }\r\n  @case (\"Status\") {\r\n    <mt-entity-status [data]=\"data()\" />\r\n  }\r\n  @case (\"Icon\") {\r\n    <mt-entity-icon [data]=\"data()\" />\r\n  }\r\n  @case (\"Color\") {\r\n    <mt-entity-color [data]=\"data()\" />\r\n  }\r\n  @case (\"PhaseGate\") {\r\n    <mt-entity-phase-gate [data]=\"data()\" />\r\n  }\r\n  @case (\"PerformanceScore\") {\r\n    <mt-entity-performance-score [data]=\"data()\" />\r\n  }\r\n  @case (\"Attachment\") {\r\n    <mt-entity-attachment [data]=\"data()\" [shape]=\"attachmentShape()\" />\r\n  }\r\n  @case (\"Location\") {\r\n    <mt-entity-location [data]=\"data()\" />\r\n  }\r\n  @case (\"Connection\") {\r\n    <mt-entity-connection [data]=\"data()\" />\r\n  }\r\n  @case (\"ScheduleItemSelector\") {\r\n    <mt-entity-schedule-item [data]=\"data()\" />\r\n  }\r\n  @case (\"LeafDetails\") {\r\n    <mt-entity-leaf-details [data]=\"data()\" />\r\n  }\r\n  @default {\r\n    <mt-entity-text [data]=\"data()\" />\r\n  }\r\n}\r\n","import {\r\n  ChangeDetectionStrategy,\r\n  Component,\r\n  Type,\r\n  computed,\r\n  inject,\r\n  input,\r\n} from '@angular/core';\r\nimport { NgComponentOutlet } from '@angular/common';\r\nimport { TranslocoService } from '@jsverse/transloco';\r\nimport { sharedActiveLang } from '../active-lang';\r\nimport { EntityValuePreview } from '../entity-preview/entity-value-preview';\r\nimport { EntityData } from '../entity.model';\r\nimport {\r\n  buildEntityListRows,\r\n  EntityListRenderedRow,\r\n} from '../entity-list-rows.util';\r\n\r\n/**\r\n * What `NgComponentOutlet` needs to render an `EntityList` table: the\r\n * read-only `mt-entity-list-field` (`ENTITY_LIST_TABLE_COMPONENT`) and its\r\n * inputs.\r\n */\r\nexport interface EntityListTableHost {\r\n  component: Type<unknown>;\r\n  inputs: Record<string, unknown>;\r\n}\r\n\r\n/**\r\n * The full nested `EntityList`, rendered in a drawer opened by\r\n * `mt-entity-list-preview`.\r\n *\r\n * It lives in a drawer rather than in the cell because the cell is a table\r\n * column: even three lines per row set the height of every row in the table,\r\n * and a checklist of fifteen made the grid unreadable. The drawer has the\r\n * width and height this content actually needs.\r\n *\r\n * With a `table` it renders the list the way a record preview does — the\r\n * read-only `mt-entity-list-field`, with its columns, typed cells and access\r\n * notices — for a table cell whose host knew the record's runtime ids.\r\n * Otherwise it renders the rows the value itself carries.\r\n *\r\n * Created through `ModalService`, so its inputs arrive via `inputValues` and\r\n * it is built with the **root** injector — nothing route-provided is visible\r\n * here, which is why it takes the already-resolved entity and table rather\r\n * than looking anything up.\r\n */\r\n@Component({\r\n  selector: 'mt-entity-list-drawer',\r\n  standalone: true,\r\n  changeDetection: ChangeDetectionStrategy.OnPush,\r\n  imports: [EntityValuePreview, NgComponentOutlet],\r\n  templateUrl: './entity-list-drawer.html',\r\n  // `h-full` is load-bearing. `.p-drawer-content` is a definite height, but\r\n  // this host sits between it and the content, so without a height of its own\r\n  // the host grows to fit the rows and the content's `h-full` resolves against\r\n  // *that* — the list then runs past the bottom of the drawer with nothing to\r\n  // scroll. Verified with a twenty-row list.\r\n  host: { class: 'block h-full' },\r\n})\r\nexport class EntityListDrawer {\r\n  readonly data = input.required<EntityData>();\r\n\r\n  /** Ordered allowlist of nested field keys; empty renders all of them. */\r\n  readonly fields = input<string[]>([]);\r\n\r\n  /** The list's table, when the opener could build one; see above. */\r\n  readonly table = input<EntityListTableHost | null>(null);\r\n\r\n  /** A Local list's labels are `{ en, ar }` pairs; see `sharedActiveLang`. */\r\n  private readonly activeLang = sharedActiveLang(inject(TranslocoService));\r\n\r\n  readonly rows = computed<EntityListRenderedRow[]>(() =>\r\n    buildEntityListRows(this.data(), this.fields(), this.activeLang()),\r\n  );\r\n}\r\n","<!--\r\n  Owns its scroll rather than taking the shared `mt-modal-content` shell: that\r\n  class reserves 60px for a footer, and this drawer is read-only and has none,\r\n  so it would leave a dead strip at the bottom. `h-full` chains off the host's,\r\n  which chains off `.p-drawer-content` — the one definite height here.\r\n-->\r\n<div class=\"flex h-full flex-col gap-2 overflow-auto p-5\">\r\n  @if (table(); as host) {\r\n    <!--\r\n      The list as a record preview renders it: the read-only\r\n      `mt-entity-list-field`, through the component the opener handed over —\r\n      it cannot be imported here without a circular entry point.\r\n    -->\r\n    <ng-container\r\n      *ngComponentOutlet=\"host.component; inputs: host.inputs\"\r\n    ></ng-container>\r\n  } @else {\r\n    @for (row of rows(); track row.id) {\r\n      <div\r\n        class=\"rounded-md border border-surface-200 bg-surface-50 px-3 py-2.5\"\r\n      >\r\n        @if (row.title; as title) {\r\n          <div class=\"min-w-0 text-sm font-medium text-color\">\r\n            <mt-entity-value-preview [data]=\"title\" attachmentShape=\"compact\" />\r\n          </div>\r\n        }\r\n\r\n        @if (row.fields.length) {\r\n          <!--\r\n            The drawer has room the cell did not, so fields get a real grid with\r\n            their labels instead of being crushed onto one wrapping line.\r\n            `auto-fill` adapts to the drawer's actual width without a container\r\n            query, and the `min()` floor keeps a narrow drawer from being forced\r\n            wider than the viewport.\r\n          -->\r\n          <div\r\n            class=\"mt-2 grid gap-x-4 gap-y-3 [grid-template-columns:repeat(auto-fill,minmax(min(9rem,100%),1fr))]\"\r\n          >\r\n            @for (field of row.fields; track field.key) {\r\n              <div class=\"min-w-0 overflow-hidden\">\r\n                <mt-entity-value-preview\r\n                  [data]=\"field\"\r\n                  attachmentShape=\"compact\"\r\n                />\r\n              </div>\r\n            }\r\n          </div>\r\n        }\r\n      </div>\r\n    }\r\n  }\r\n</div>\r\n","import {\r\n  ChangeDetectionStrategy,\r\n  Component,\r\n  computed,\r\n  inject,\r\n  input,\r\n} from '@angular/core';\r\nimport { NgComponentOutlet } from '@angular/common';\r\nimport { TranslocoService } from '@jsverse/transloco';\r\nimport { Button } from '@masterteam/components/button';\r\nimport { ModalService } from '@masterteam/components/modal';\r\nimport { sharedActiveLang } from '../active-lang';\r\nimport { displayOrPlaceholder } from '../entity-display.utils';\r\nimport { EntityField } from '../entity-field/entity-field';\r\nimport {\r\n  EntityData,\r\n  EntityPropertyConfiguration,\r\n  isEntityListLocalDocument,\r\n  isEntityListSelectionDocument,\r\n} from '../entity.model';\r\nimport {\r\n  ENTITY_LIST_TABLE_COMPONENT,\r\n  EntityRuntimeContext,\r\n  EntityRuntimeContextStore,\r\n} from '../entity-runtime-context';\r\nimport {\r\n  buildEntityListRows,\r\n  EntityListRenderedRow,\r\n  summarizeEntityListRows,\r\n} from '../entity-list-rows.util';\r\nimport { EntityListDrawer, EntityListTableHost } from './entity-list-drawer';\r\n\r\n/** Rows named in the tooltip before it collapses into \"+N more\". */\r\nconst TOOLTIP_ROW_LIMIT = 6;\r\n\r\n/**\r\n * Read-only renderer for an `EntityList` value. It has two shapes, and which\r\n * one applies is decided by what the host gave it — never by the value.\r\n *\r\n * **Inline table.** When the host published an `EntityRuntimeContext` and the\r\n * property is module-backed, the rows are the target module's own records and\r\n * live behind `Properties/{id}/entitylist/table-metadata` + `fetch/query`.\r\n * Nothing in the value describes them — a `Realtime` list's value is literally\r\n * `null` — so the whole table is fetched, by handing the work to the read-only\r\n * `mt-entity-list-field` through `ENTITY_LIST_TABLE_COMPONENT`. That component\r\n * already owns the metadata call, the authorization boundary (`403` is a\r\n * notice, not an error) and the column projection; duplicating it here would\r\n * be a second implementation of the same contract. This is the shape a card\r\n * preview gets.\r\n *\r\n * **Count + drawer.** Otherwise the value carries its own `rows[]` and the\r\n * property configuration's `inlineFields` is the only description of the\r\n * columns — a calculated inline list, phase gate checklists being the case\r\n * this was written for. Those render inside a *table cell* (`mt-table` builds\r\n * its entity cells through `mt-entity-preview`), where inline rows would own\r\n * the height of every row in the grid: three lines per checklist item, times\r\n * however many the phase gate has. The rows go in a drawer instead, and the\r\n * tooltip names them so \"which ones are these?\" is answered without opening\r\n * anything. A table cell publishes no runtime context, so it keeps this shape.\r\n *\r\n * There is no writable path in either case.\r\n */\r\n@Component({\r\n  selector: 'mt-entity-list-preview',\r\n  standalone: true,\r\n  changeDetection: ChangeDetectionStrategy.OnPush,\r\n  imports: [EntityField, Button, NgComponentOutlet],\r\n  templateUrl: './entity-list-preview.html',\r\n})\r\nexport class EntityListPreview {\r\n  readonly data = input.required<EntityData>();\r\n\r\n  /**\r\n   * Restricts rendering to these nested field keys, in this order. Left empty,\r\n   * every field in `inlineFields` renders — what the generic table path wants;\r\n   * a host that knows the list narrows it here. Forwarded to the drawer.\r\n   *\r\n   * Applies to the drawer shape only: an inline table's columns come from the\r\n   * backend's own projection, which already reflects the configured read\r\n   * fields for this level.\r\n   */\r\n  readonly fields = input<string[]>([]);\r\n\r\n  private readonly modal = inject(ModalService);\r\n  private readonly transloco = inject(TranslocoService);\r\n\r\n  /**\r\n   * Both optional, and both have to be present for the inline table: the\r\n   * component says the host *can* render one, the context says it knows which\r\n   * level-data row to scope the rows to. A host that provides neither — every\r\n   * `mt-table` cell — keeps the drawer.\r\n   */\r\n  private readonly tableComponent = inject(ENTITY_LIST_TABLE_COMPONENT, {\r\n    optional: true,\r\n  });\r\n  private readonly runtimeContextStore = inject(EntityRuntimeContextStore, {\r\n    optional: true,\r\n  });\r\n\r\n  /**\r\n   * Read inside every computed that translates. `transloco.translate()` is a\r\n   * one-shot read with no signal of its own, so without this dependency the\r\n   * tooltip and the accessible name keep whatever language they were first\r\n   * built in — both apps switch language at runtime. Shared rather than a\r\n   * per-instance subscription: this renders once per cell per row.\r\n   */\r\n  private readonly activeLang = sharedActiveLang(this.transloco);\r\n\r\n  readonly label = computed<string>(() => this.data().name ?? '');\r\n\r\n  readonly rows = computed<EntityListRenderedRow[]>(() =>\r\n    buildEntityListRows(this.data(), this.fields(), this.activeLang()),\r\n  );\r\n\r\n  readonly count = computed<number>(() => this.rows().length);\r\n\r\n  readonly hasRows = computed<boolean>(() => this.count() > 0);\r\n\r\n  /**\r\n   * Whether the list's rows are records of another module rather than values\r\n   * held inside this one.\r\n   *\r\n   * Mirrors the backend's own `ResolveSourceType`: an explicit `sourceType`\r\n   * wins, and a configuration written before that field existed is module-\r\n   * backed exactly when it names a module. Read from the stored configuration\r\n   * because it is the only description available before the metadata request —\r\n   * the effective, level-overridden one comes back from that endpoint, and the\r\n   * table component gates on it again.\r\n   */\r\n  private readonly moduleBacked = computed<boolean>(() => {\r\n    const configuration = this.propertyConfiguration();\r\n    if (!configuration) return false;\r\n\r\n    const sourceType = configuration['sourceType'];\r\n    if (typeof sourceType === 'string' && sourceType.trim()) {\r\n      return sourceType.trim().toLowerCase() === 'module';\r\n    }\r\n    return Number(configuration['moduleId'] ?? 0) > 0;\r\n  });\r\n\r\n  /**\r\n   * The inline table's component and inputs, or null when this instance\r\n   * renders the drawer trigger instead.\r\n   *\r\n   * A `computed` rather than a template expression on purpose: the object is\r\n   * re-created only when its inputs actually change, and `NgComponentOutlet`\r\n   * re-applies inputs on identity change — a fresh object per change-detection\r\n   * pass would re-write every input on every tick.\r\n   */\r\n  protected readonly tableHost = computed<EntityListTableHost | null>(() =>\r\n    this.buildTableHost(this.runtimeContextStore?.context() ?? null),\r\n  );\r\n\r\n  /**\r\n   * The same table, for the drawer of a table cell. A cell publishes no\r\n   * runtime context — an inline table would set the height of every row — but\r\n   * a host that knows the record's ids puts them on the value\r\n   * (`EntityData.runtimeContext`), and the drawer then shows the list exactly\r\n   * as a record preview does, instead of the value-only rows.\r\n   */\r\n  private readonly drawerTable = computed<EntityListTableHost | null>(() =>\r\n    this.tableHost() ? null : this.buildTableHost(this.data().runtimeContext),\r\n  );\r\n\r\n  private buildTableHost(\r\n    context: EntityRuntimeContext | null | undefined,\r\n  ): EntityListTableHost | null {\r\n    const component = this.tableComponent;\r\n    if (!component || !this.moduleBacked()) return null;\r\n    if (!context || !(Number(context.levelId) > 0)) return null;\r\n\r\n    const data = this.data();\r\n    const propertyId = Number(data.propertyId ?? 0);\r\n    if (!(propertyId > 0)) return null;\r\n\r\n    return {\r\n      component,\r\n      inputs: {\r\n        propertyId,\r\n        runtimeContext: context,\r\n        configuration: this.propertyConfiguration(),\r\n        // Rendered outside a form, so there is no `ControlValueAccessor` to\r\n        // write through. A Write-only list has no readable records and its\r\n        // stored rows are the only thing it can show.\r\n        initialValue: data.value ?? data.rawValue ?? null,\r\n        readonly: true,\r\n        // `mt-entity-field` already renders the property's label above the\r\n        // table; the field would repeat it.\r\n        label: '',\r\n      },\r\n    };\r\n  }\r\n\r\n  /**\r\n   * Whether the value itself holds the list's rows — a Local or Selected\r\n   * document. A Related list's value is membership and evidence only; its\r\n   * rows are read by the table, so its cell does not claim a count.\r\n   */\r\n  private readonly valueHoldsRows = computed<boolean>(() => {\r\n    const value = this.data().value;\r\n    return (\r\n      isEntityListLocalDocument(value) || isEntityListSelectionDocument(value)\r\n    );\r\n  });\r\n\r\n  /** The trigger shows when there are rows to count, or a table to open. */\r\n  protected readonly showTrigger = computed<boolean>(\r\n    () => this.hasRows() || !!this.drawerTable(),\r\n  );\r\n\r\n  /**\r\n   * The trigger's label: the row count when the value holds the rows, else\r\n   * \"View\" — a Related list's saved membership is not what its table shows,\r\n   * so it is not presented as a count.\r\n   */\r\n  protected readonly triggerLabel = computed<string>(() => {\r\n    this.activeLang();\r\n    return this.valueHoldsRows() || !this.drawerTable()\r\n      ? this.count().toString()\r\n      : this.viewLabel();\r\n  });\r\n\r\n  /**\r\n   * An empty list reads as the standard empty value, not as a sentence — this\r\n   * sits in a table cell, where a \"no related items\" line would be louder than\r\n   * the rows it stands in for.\r\n   */\r\n  readonly emptyLabel = displayOrPlaceholder(null);\r\n\r\n  /**\r\n   * The button's accessible name. Set explicitly because `mt-button` resolves\r\n   * it as `ariaLabel → label → tooltip`, and the label here is the bare count\r\n   * — a screen reader would otherwise announce the button as \"2\".\r\n   */\r\n  readonly ariaLabel = computed<string>(() => {\r\n    this.activeLang();\r\n    const label = this.triggerLabel();\r\n    return label === this.viewLabel()\r\n      ? label\r\n      : `${this.viewLabel()} (${label})`;\r\n  });\r\n\r\n  /**\r\n   * Names the rows, so the cell answers \"which ones?\" on hover. Falls back to\r\n   * the button's own wording when no row has a title to show.\r\n   */\r\n  readonly tooltip = computed<string>(() => {\r\n    this.activeLang();\r\n    const { names, remaining } = summarizeEntityListRows(\r\n      this.rows(),\r\n      TOOLTIP_ROW_LIMIT,\r\n    );\r\n    if (names.length === 0) return this.viewLabel();\r\n\r\n    const more =\r\n      remaining > 0\r\n        ? [\r\n            this.transloco.translate('components.entityListPreview.more', {\r\n              count: remaining,\r\n            }),\r\n          ]\r\n        : [];\r\n    return [...names, ...more].join(' · ');\r\n  });\r\n\r\n  /**\r\n   * The untouched catalog configuration. `configuration` is read as a fallback\r\n   * because the table merges its own display flags into that object when it\r\n   * builds a cell, and a `LeafDetails` catalog entry is an array — neither is\r\n   * an `EntityList` configuration, so both are rejected here.\r\n   */\r\n  private readonly propertyConfiguration = computed<Record<\r\n    string,\r\n    unknown\r\n  > | null>(() => {\r\n    const data = this.data();\r\n    const sources: (EntityPropertyConfiguration | undefined)[] = [\r\n      data.propertyConfiguration,\r\n      data.configuration as EntityPropertyConfiguration,\r\n    ];\r\n\r\n    for (const source of sources) {\r\n      if (!source || Array.isArray(source)) continue;\r\n      return source as Record<string, unknown>;\r\n    }\r\n    return null;\r\n  });\r\n\r\n  private viewLabel(): string {\r\n    return this.transloco.translate('components.entityListPreview.view');\r\n  }\r\n\r\n  protected openDrawer(): void {\r\n    const table = this.drawerTable();\r\n    this.modal.openModal(EntityListDrawer, 'drawer', {\r\n      header: this.label() || undefined,\r\n      position: 'end',\r\n      // A table needs the width a stack of rows does not.\r\n      styleClass: table ? '!w-[60rem] max-w-[96vw]' : '!w-[34rem] max-w-[96vw]',\r\n      dismissableMask: true,\r\n      inputValues: {\r\n        data: this.data(),\r\n        fields: this.fields(),\r\n        table,\r\n      },\r\n    });\r\n  }\r\n}\r\n","<mt-entity-field\r\n  [label]=\"label()\"\r\n  [configuration]=\"data().configuration\"\r\n  gap=\"normal\"\r\n>\r\n  @if (tableHost(); as host) {\r\n    <!--\r\n      The related records, rendered in full by the read-only\r\n      `mt-entity-list-field`. It owns the metadata request, the access notices\r\n      and the column projection — see `ENTITY_LIST_TABLE_COMPONENT` for why it\r\n      arrives through an outlet rather than an import.\r\n    -->\r\n    <ng-container\r\n      *ngComponentOutlet=\"host.component; inputs: host.inputs\"\r\n    ></ng-container>\r\n  } @else if (showTrigger()) {\r\n    <!--\r\n      The count carries the information; the button carries the affordance.\r\n      `mt-button` owns the tooltip and the accessible name, so the trigger is\r\n      one element rather than a button wrapped in a tooltip host. A Related\r\n      list opened as a table says \"View\" instead of a count; see\r\n      `triggerLabel`.\r\n\r\n      `w-fit`: the `mt-button` host is a block-level grid, so in a cell it\r\n      spans the full width and so does the `p-button` the tooltip anchors to —\r\n      the tooltip centred over the cell, not over the button.\r\n    -->\r\n    <mt-button\r\n      class=\"w-fit\"\r\n      icon=\"general.eye\"\r\n      [label]=\"triggerLabel()\"\r\n      [tooltip]=\"tooltip()\"\r\n      [ariaLabel]=\"ariaLabel()\"\r\n      variant=\"text\"\r\n      size=\"small\"\r\n      styleClass=\"!px-2 !py-1 !gap-1\"\r\n      (onClick)=\"openDrawer()\"\r\n    />\r\n  } @else {\r\n    <span\r\n      class=\"inline-flex w-fit items-center rounded-md bg-surface-100 px-3 py-2 text-xs font-semibold text-muted-color\"\r\n    >\r\n      {{ emptyLabel }}\r\n    </span>\r\n  }\r\n</mt-entity-field>\r\n","import {\n  ChangeDetectionStrategy,\n  Component,\n  computed,\n  input,\n} from '@angular/core';\nimport { displayOrPlaceholder } from '../entity-display.utils';\nimport { EntityField } from '../entity-field/entity-field';\nimport { EntityValuePreview } from '../entity-preview/entity-value-preview';\nimport {\n  EntityConfiguration,\n  EntityData,\n  EntityLookupCheckListItem,\n  EntityLookupCheckListValue,\n  EntityNestedPropertyMeta,\n} from '../entity.model';\n\ninterface RenderedItem {\n  lookupKey: string;\n  /** Humanized lookup key for display. */\n  lookupLabel: string;\n  /** One entity per captured property, rendered by its catalog view type. */\n  props: EntityData[];\n}\n\n/**\n * Nested props render inside the entry card's own grid, so they take the label\n * treatment and leave sizing to the grid.\n */\nconst NESTED_PROP_CONFIG: EntityConfiguration = {\n  labelPosition: 'top',\n  hideLabel: false,\n};\n\n/**\n * Derive a readable label from a raw lookup key. The stored checklist value\n * only carries the key of the selected lookup item (e.g. `Open_test`) and the\n * response resolves no display for it, so this strips separators and\n * title-cases the key.\n */\nfunction humanizeKey(key: string): string {\n  const words = key\n    .replace(/[_-]+/g, ' ')\n    .replace(/([a-z0-9])([A-Z])/g, '$1 $2')\n    .trim();\n  if (!words) return key;\n  return words.charAt(0).toUpperCase() + words.slice(1);\n}\n\n@Component({\n  selector: 'mt-entity-lookup-module-check-list',\n  standalone: true,\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  imports: [EntityField, EntityValuePreview],\n  templateUrl: './entity-lookup-module-check-list.html',\n})\nexport class EntityLookupModuleCheckList {\n  readonly data = input.required<EntityData>();\n\n  /**\n   * Catalog metadata for the captured properties, keyed by property key. The\n   * stored value carries keys only — this is what gives each nested prop its\n   * label and view type.\n   */\n  private readonly metaByKey = computed(() => {\n    const map = new Map<string, EntityNestedPropertyMeta>();\n    for (const meta of this.data().nestedProperties ?? []) {\n      map.set(meta.key, meta);\n    }\n    return map;\n  });\n\n  /**\n   * Normalizes the stored value into a flat list of checklist entries.\n   * Accepts both the rendered view model (`{ items: [...] }`) and the raw\n   * stored array (`[{ lookupKey, props }]`); returns `[]` for anything else.\n   */\n  readonly items = computed<RenderedItem[]>(() => {\n    const raw = this.data().value;\n    const entries = this.extractEntries(raw);\n\n    return entries\n      .filter((entry) => entry && typeof entry === 'object')\n      .map((entry) => {\n        const record = entry as unknown as Record<string, unknown>;\n        const props = record['props'] ?? record['Props'];\n        const lookupKey = this.resolveLookupKey(entry);\n        return {\n          lookupKey,\n          lookupLabel: humanizeKey(lookupKey),\n          props: (Array.isArray(props) ? props : []).map((prop) =>\n            this.toNestedEntity(prop),\n          ),\n        };\n      });\n  });\n\n  readonly hasItems = computed(() => this.items().length > 0);\n\n  readonly emptyLabel = displayOrPlaceholder(null);\n\n  /**\n   * Builds the entity for one captured property. Without catalog metadata the\n   * key is all there is to show it with, so it degrades to a humanized label\n   * and plain text.\n   */\n  private toNestedEntity(prop: unknown): EntityData {\n    const propRecord = (prop ?? {}) as Record<string, unknown>;\n    const key = String(propRecord['key'] ?? propRecord['Key'] ?? '');\n    const meta = this.metaByKey().get(key);\n    const value = propRecord['value'] ?? propRecord['Value'] ?? null;\n\n    return {\n      propertyId: meta?.id,\n      key,\n      normalizedKey: meta?.normalizedKey,\n      name: meta?.label ?? humanizeKey(key),\n      value: (value ?? '') as EntityData['value'],\n      viewType: meta?.viewType ?? 'Text',\n      propertyConfiguration: meta?.configuration,\n      configuration: NESTED_PROP_CONFIG,\n      order: meta?.order,\n    };\n  }\n\n  private extractEntries(raw: unknown): EntityLookupCheckListItem[] {\n    if (Array.isArray(raw)) {\n      return raw as EntityLookupCheckListItem[];\n    }\n\n    const wrapped = (raw as EntityLookupCheckListValue | null)?.items;\n    if (Array.isArray(wrapped)) {\n      return wrapped;\n    }\n\n    if (typeof raw === 'string' && raw.trim()) {\n      try {\n        return this.extractEntries(JSON.parse(raw));\n      } catch {\n        return [];\n      }\n    }\n\n    return [];\n  }\n\n  private resolveLookupKey(entry: EntityLookupCheckListItem): string {\n    const record = entry as unknown as Record<string, unknown>;\n    const key = entry.lookupKey ?? record['Lookupkey'] ?? record['lookupkey'];\n    return typeof key === 'string' ? key : '';\n  }\n}\n","<mt-entity-field\r\n  [label]=\"data().name ?? ''\"\r\n  [configuration]=\"data()?.configuration\"\r\n  gap=\"normal\"\r\n>\r\n  @if (hasItems()) {\r\n    <div class=\"flex flex-col gap-2\">\r\n      @for (item of items(); track $index) {\r\n        <div\r\n          class=\"rounded-lg border border-surface-200 bg-surface-50 px-3 py-2\"\r\n        >\r\n          <span\r\n            class=\"inline-flex w-fit items-center rounded-md bg-primary-50 px-2 py-1 text-xs font-semibold text-primary-700\"\r\n          >\r\n            {{ item.lookupLabel || emptyLabel }}\r\n          </span>\r\n          @if (item.props.length) {\r\n            <div class=\"mt-2 grid grid-cols-1 gap-x-4 gap-y-3 sm:grid-cols-2\">\r\n              @for (prop of item.props; track prop.key) {\r\n                <div class=\"min-w-0 overflow-hidden\">\r\n                  <mt-entity-value-preview\r\n                    [data]=\"prop\"\r\n                    attachmentShape=\"compact\"\r\n                  />\r\n                </div>\r\n              }\r\n            </div>\r\n          }\r\n        </div>\r\n      }\r\n    </div>\r\n  } @else {\r\n    <span\r\n      class=\"inline-flex w-fit items-center rounded-md bg-gray-100 px-3 py-2 text-xs font-semibold text-gray-500\"\r\n    >\r\n      {{ emptyLabel }}\r\n    </span>\r\n  }\r\n</mt-entity-field>\r\n","import type {\n  ConnectionCatalogConfiguration,\n  ConnectionSourceLevelConfig,\n  EntityConnectionConfig,\n  EntityConnectionSourceValue,\n  EntityData,\n} from './entity.model';\n\n/**\n * Separator for the synthetic keys of the per-source-level items a Connection\n * property expands into. Mirrors `LEAF_DETAILS_KEY_SEPARATOR`: the persisted\n * display configuration is still keyed by the real property key, and the split\n * items only exist in the rendered/managed entity list.\n */\nexport const CONNECTION_KEY_SEPARATOR = '::connlevel::';\n\nexport function isConnectionSyntheticKey(key?: string | null): boolean {\n  return key?.includes(CONNECTION_KEY_SEPARATOR) ?? false;\n}\n\nexport function buildConnectionKey(\n  propertyKey: string,\n  levelId: number | string,\n): string {\n  return `${propertyKey}${CONNECTION_KEY_SEPARATOR}${levelId}`;\n}\n\n/** Splits a synthetic key back into the owning property key and its level id. */\nexport function splitConnectionKey(key: string): {\n  propertyKey: string;\n  levelId: string;\n} {\n  const [propertyKey, levelId] = key.split(CONNECTION_KEY_SEPARATOR);\n  return { propertyKey, levelId };\n}\n\nfunction isConnectionSourceLevel(\n  value: unknown,\n): value is ConnectionSourceLevelConfig {\n  return (\n    !!value &&\n    typeof value === 'object' &&\n    !Array.isArray(value) &&\n    'levelId' in value &&\n    typeof value.levelId === 'number' &&\n    Number.isFinite(value.levelId)\n  );\n}\n\n/**\n * Reads the `sourceLevels` published on a Connection property's catalog\n * configuration. These define the split — one item per source level — and carry\n * the level name used as each item's label.\n */\nexport function normalizeConnectionSourceLevels(\n  configuration: unknown,\n): ConnectionSourceLevelConfig[] {\n  if (typeof configuration === 'string' && configuration.trim().length > 0) {\n    try {\n      return normalizeConnectionSourceLevels(JSON.parse(configuration));\n    } catch {\n      return [];\n    }\n  }\n\n  if (!configuration || typeof configuration !== 'object') return [];\n\n  const sourceLevels = (configuration as ConnectionCatalogConfiguration)\n    .sourceLevels;\n\n  return Array.isArray(sourceLevels)\n    ? sourceLevels.filter(isConnectionSourceLevel)\n    : [];\n}\n\n/** Picks the source level's localized name for the active document language. */\nexport function resolveConnectionLevelName(\n  level: ConnectionSourceLevelConfig,\n): string {\n  const name = level.name;\n  if (typeof name === 'string') return name.trim();\n  if (!name || typeof name !== 'object') return '';\n\n  const lang =\n    typeof document !== 'undefined'\n      ? document.documentElement.lang || 'en'\n      : 'en';\n  const primary = lang === 'ar' ? name.ar : name.en;\n\n  return (primary || name.en || name.ar || '').trim();\n}\n\nfunction readSources(value: unknown): EntityConnectionSourceValue[] {\n  if (typeof value === 'string' && value.trim().length > 0) {\n    try {\n      return readSources(JSON.parse(value));\n    } catch {\n      return [];\n    }\n  }\n\n  if (!value || typeof value !== 'object' || Array.isArray(value)) return [];\n\n  const source = value as Record<string, unknown>;\n  // The payload is serialized PascalCase; parsed values use camelCase.\n  const sources = source['sources'] ?? source['Sources'];\n\n  return Array.isArray(sources)\n    ? (sources.filter(\n        (item) => !!item && typeof item === 'object' && !Array.isArray(item),\n      ) as EntityConnectionSourceValue[])\n    : [];\n}\n\nfunction sourceLevelIdOf(source: EntityConnectionSourceValue): number | null {\n  const id = source.sourceLevelId ?? source.SourceLevelId;\n  return typeof id === 'number' && Number.isFinite(id) ? id : null;\n}\n\nfunction sourceDisplayOf(source: EntityConnectionSourceValue): string {\n  const display =\n    source.display ?? source.Display ?? source.name ?? source.Name;\n  return typeof display === 'string' ? display.trim() : '';\n}\n\n/**\n * Groups a Connection value's connected records by their source level. A level\n * that allows many-to-many can hold several records, so the displays are joined\n * into the single value shown for that level's item.\n */\nfunction groupDisplaysByLevel(entity: EntityData): Map<number, string[]> {\n  const sources = [\n    ...readSources(entity.value),\n    ...readSources(entity.rawValue),\n  ];\n  const grouped = new Map<number, string[]>();\n\n  for (const source of sources) {\n    const levelId = sourceLevelIdOf(source);\n    if (levelId === null) continue;\n    const display = sourceDisplayOf(source);\n    if (!display) continue;\n    const existing = grouped.get(levelId);\n    if (existing) {\n      if (!existing.includes(display)) existing.push(display);\n    } else {\n      grouped.set(levelId, [display]);\n    }\n  }\n\n  return grouped;\n}\n\n/**\n * Splits a Connection entity into one item per source level, so a card shows\n * each connected level under its own name instead of a single comma-joined\n * value under the generic \"Connection\" label.\n *\n * Falls back to the original entity when the catalog publishes no source\n * levels — without them there is nothing to label the split items with.\n */\nexport function expandConnectionEntity(entity: EntityData): EntityData[] {\n  if (entity.viewType !== 'Connection') {\n    return [entity];\n  }\n\n  // Already expanded (e.g. re-running over a managed list).\n  if (isConnectionSyntheticKey(entity.key)) {\n    return [entity];\n  }\n\n  const levels = normalizeConnectionSourceLevels(entity.propertyConfiguration);\n  if (levels.length === 0) {\n    return [entity];\n  }\n\n  const configuration = entity.configuration as\n    | EntityConnectionConfig\n    | undefined;\n  const displaysByLevel = groupDisplaysByLevel(entity);\n\n  return levels.map((level) => {\n    const levelConfig =\n      configuration?.connectionLevels?.[String(level.levelId)];\n    const display = (displaysByLevel.get(level.levelId) ?? []).join(', ');\n\n    return {\n      ...entity,\n      key: entity.key\n        ? buildConnectionKey(entity.key, level.levelId)\n        : entity.key,\n      name: resolveConnectionLevelName(level) || entity.name,\n      value: { display },\n      rawValue: display,\n      order: levelConfig?.order ?? entity.order,\n      configuration: {\n        ...configuration,\n        size: levelConfig?.size ?? configuration?.size,\n      },\n    } satisfies EntityData;\n  });\n}\n","import { getLightColor } from '@masterteam/components';\r\nimport type { EntityData, EntityHeaderConfig } from './entity.model';\r\n\r\n/**\r\n * View types that can be rendered as a card header.\r\n *\r\n * Text only, deliberately: the header is one centred line naming the record,\r\n * and no other view type reads as that — a date, a status chip or a progress\r\n * bar stretched across the top of a card is decoration, not a title.\r\n */\r\nexport const ENTITY_HEADER_VIEW_TYPES: ReadonlySet<string> = new Set(['Text']);\r\n\r\n/** True when a property of this view type may be set as the card header. */\r\nexport function canEntityBeHeader(\r\n  viewType: string | null | undefined,\r\n): boolean {\r\n  return ENTITY_HEADER_VIEW_TYPES.has(viewType ?? '');\r\n}\r\n\r\n/**\r\n * The entity's header settings, or `null` when it renders as an ordinary cell.\r\n * A `header` saved on a view type that cannot be one is ignored rather than\r\n * honoured, so the renderers and the builder agree on what is a header.\r\n */\r\nexport function resolveEntityHeader(\r\n  entity: EntityData | null | undefined,\r\n): EntityHeaderConfig | null {\r\n  if (!entity || !canEntityBeHeader(entity.viewType)) return null;\r\n  const header = entity.configuration?.header;\r\n  return header && typeof header === 'object' ? header : null;\r\n}\r\n\r\n/** True when the entity renders as the card header. */\r\nexport function isEntityHeader(entity: EntityData | null | undefined): boolean {\r\n  return resolveEntityHeader(entity) !== null;\r\n}\r\n\r\n/**\r\n * Moves the first header entity to the front of an order-sorted list.\r\n *\r\n * The header is drawn above the card whatever its saved `order`, so it is\r\n * pinned here — in the one ordering every renderer and the builder share —\r\n * rather than in each of them. That keeps the builder's drag indexes, its\r\n * section-insert index and the runtime card all agreeing on the same list.\r\n *\r\n * Only the first is moved: a second entity flagged as a header (the drawer\r\n * allows one per area, but a configuration can be written elsewhere) stays an\r\n * ordinary cell where it is.\r\n */\r\nexport function pinEntityHeaderFirst(entities: EntityData[]): EntityData[] {\r\n  const index = entities.findIndex(isEntityHeader);\r\n  if (index <= 0) return entities;\r\n  const pinned = [...entities];\r\n  const [header] = pinned.splice(index, 1);\r\n  pinned.unshift(header);\r\n  return pinned;\r\n}\r\n\r\n/**\r\n * The colours a header with none picked is painted in, as `#rrggbb` — the\r\n * values `entity-header.css` produces: the theme's primary as the top border\r\n * and a 10% primary tint over white as the background. For showing an author\r\n * the defaults (the customization drawer's colour fields), not for saving\r\n * them: a stored hex would stop following the tenant's primary colour.\r\n *\r\n * `null` when the primary colour cannot be resolved in this document.\r\n */\r\nexport function readEntityHeaderDefaults(\r\n  doc: Document,\r\n): Required<EntityHeaderConfig> | null {\r\n  const primary = readPrimaryHex(doc);\r\n  if (!primary) return null;\r\n  return { backgroundColor: getLightColor(primary), borderColor: primary };\r\n}\r\n\r\n/**\r\n * `--p-primary-color` resolved to `#rrggbb`. Read through a probe's computed\r\n * `color` rather than the custom property itself, because the property holds\r\n * whatever the preset wrote (often a `var()` chain), while a computed colour\r\n * is always `rgb(...)`.\r\n */\r\nfunction readPrimaryHex(doc: Document): string | null {\r\n  const view = doc.defaultView;\r\n  if (!view || !doc.body) return null;\r\n  const probe = doc.createElement('span');\r\n  probe.style.display = 'none';\r\n  probe.style.color = 'var(--p-primary-color)';\r\n  doc.body.appendChild(probe);\r\n  const color = view.getComputedStyle(probe).color;\r\n  probe.remove();\r\n\r\n  const channels = color.match(/^rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)/);\r\n  if (!channels) return null;\r\n  return `#${channels\r\n    .slice(1, 4)\r\n    .map((channel) => Number(channel).toString(16).padStart(2, '0'))\r\n    .join('')}`;\r\n}\r\n","import { expandConnectionEntity } from './connection-display.utils';\r\nimport { pinEntityHeaderFirst } from './entity-header.util';\r\nimport type {\r\n  EntityData,\r\n  EntityLeafDetailsConfig,\r\n  LeafDetailsCatalogConfiguration,\r\n  LeafDetailsCatalogLevelValue,\r\n  LeafDetailsCatalogPhaseValue,\r\n  LeafDetailsCatalogStatusValue,\r\n  LeafDetailsEntityCollectionValue,\r\n  LeafDetailsEntityValue,\r\n  LeafDetailsPhaseSummary,\r\n  LeafDetailsRuntimeChildSchema,\r\n  LeafDetailsRuntimePhaseCount,\r\n  LeafDetailsRuntimeStatusCount,\r\n  LeafDetailsRuntimeStatusDetails,\r\n  LeafDetailsRuntimeValue,\r\n  LeafDetailsStatusSummary,\r\n} from './entity.model';\r\n\r\nexport const LEAF_DETAILS_KEY_SEPARATOR = '::leaflevel::';\r\n\r\n/**\r\n * The phase projection of the same child level. One level can contribute both\r\n * a status item and a phase item to the same area, so they need distinct keys\r\n * — the key is what each item's persisted order/size is looked up by.\r\n */\r\nexport const LEAF_PHASES_KEY_SEPARATOR = '::leafphase::';\r\n\r\nfunction isLeafDetailsStatusSummary(\r\n  value: unknown,\r\n): value is LeafDetailsStatusSummary {\r\n  return (\r\n    !!value &&\r\n    typeof value === 'object' &&\r\n    'key' in value &&\r\n    'display' in value &&\r\n    'count' in value\r\n  );\r\n}\r\n\r\nfunction isLeafDetailsCatalogStatusValue(\r\n  value: unknown,\r\n): value is LeafDetailsCatalogStatusValue {\r\n  return (\r\n    !!value && typeof value === 'object' && 'key' in value && 'display' in value\r\n  );\r\n}\r\n\r\nfunction isLeafDetailsCatalogLevelValue(\r\n  value: unknown,\r\n): value is LeafDetailsCatalogLevelValue {\r\n  return (\r\n    !!value &&\r\n    typeof value === 'object' &&\r\n    'levelId' in value &&\r\n    'levelName' in value &&\r\n    'levelIcon' in value &&\r\n    'statuses' in value &&\r\n    Array.isArray(value.statuses) &&\r\n    value.statuses.every(isLeafDetailsCatalogStatusValue)\r\n  );\r\n}\r\n\r\nfunction isLeafDetailsRuntimeStatusDetails(\r\n  value: unknown,\r\n): value is LeafDetailsRuntimeStatusDetails {\r\n  return (\r\n    !!value && typeof value === 'object' && 'key' in value && 'display' in value\r\n  );\r\n}\r\n\r\nfunction isLeafDetailsRuntimeStatusCount(\r\n  value: unknown,\r\n): value is LeafDetailsRuntimeStatusCount {\r\n  return (\r\n    !!value &&\r\n    typeof value === 'object' &&\r\n    'details' in value &&\r\n    isLeafDetailsRuntimeStatusDetails(value.details) &&\r\n    'count' in value\r\n  );\r\n}\r\n\r\nfunction isLeafDetailsRuntimePhaseCount(\r\n  value: unknown,\r\n): value is LeafDetailsRuntimePhaseCount {\r\n  return (\r\n    !!value &&\r\n    typeof value === 'object' &&\r\n    'details' in value &&\r\n    isLeafDetailsRuntimeStatusDetails(value.details) &&\r\n    'count' in value\r\n  );\r\n}\r\n\r\n/**\r\n * Phases are optional on both the catalog configuration and the runtime value —\r\n * the backend omits the field entirely for child levels with no phase gates —\r\n * so anything that is not a well-formed array reads as \"no phases\".\r\n */\r\nfunction readRuntimePhases(value: unknown): LeafDetailsRuntimePhaseCount[] {\r\n  return Array.isArray(value) && value.every(isLeafDetailsRuntimePhaseCount)\r\n    ? value\r\n    : [];\r\n}\r\n\r\nfunction readCatalogPhases(value: unknown): LeafDetailsCatalogPhaseValue[] {\r\n  return Array.isArray(value) && value.every(isLeafDetailsCatalogStatusValue)\r\n    ? (value as LeafDetailsCatalogPhaseValue[])\r\n    : [];\r\n}\r\n\r\nfunction isLeafDetailsRuntimeChildSchema(\r\n  value: unknown,\r\n): value is LeafDetailsRuntimeChildSchema {\r\n  return (\r\n    !!value &&\r\n    typeof value === 'object' &&\r\n    'levelId' in value &&\r\n    'levelName' in value &&\r\n    'levelIcon' in value &&\r\n    'statuses' in value &&\r\n    Array.isArray(value.statuses) &&\r\n    value.statuses.every(isLeafDetailsRuntimeStatusCount)\r\n  );\r\n}\r\n\r\nexport function isLeafDetailsValue(\r\n  value: unknown,\r\n): value is LeafDetailsEntityValue {\r\n  return (\r\n    !!value &&\r\n    typeof value === 'object' &&\r\n    !Array.isArray(value) &&\r\n    'levelId' in value &&\r\n    'statuses' in value &&\r\n    Array.isArray(value.statuses) &&\r\n    value.statuses.every(isLeafDetailsStatusSummary)\r\n  );\r\n}\r\n\r\nexport function isLeafDetailsCollectionValue(\r\n  value: unknown,\r\n): value is LeafDetailsEntityCollectionValue {\r\n  return Array.isArray(value) && value.every(isLeafDetailsValue);\r\n}\r\n\r\nexport function isLeafDetailsCatalogConfiguration(\r\n  value: unknown,\r\n): value is LeafDetailsCatalogConfiguration {\r\n  return Array.isArray(value) && value.every(isLeafDetailsCatalogLevelValue);\r\n}\r\n\r\nexport function isLeafDetailsRuntimeValue(\r\n  value: unknown,\r\n): value is LeafDetailsRuntimeValue {\r\n  return (\r\n    !!value &&\r\n    typeof value === 'object' &&\r\n    !Array.isArray(value) &&\r\n    'childSchemas' in value &&\r\n    Array.isArray(value.childSchemas) &&\r\n    value.childSchemas.every(isLeafDetailsRuntimeChildSchema)\r\n  );\r\n}\r\n\r\nexport function isLeafDetailsSyntheticKey(key?: string | null): boolean {\r\n  return key?.includes(LEAF_DETAILS_KEY_SEPARATOR) ?? false;\r\n}\r\n\r\n/** True for the key of an expanded *phase* item of a LeafDetails property. */\r\nexport function isLeafPhasesSyntheticKey(key?: string | null): boolean {\r\n  return key?.includes(LEAF_PHASES_KEY_SEPARATOR) ?? false;\r\n}\r\n\r\n/** True for either projection's expanded key. */\r\nexport function isLeafSyntheticKey(key?: string | null): boolean {\r\n  return isLeafDetailsSyntheticKey(key) || isLeafPhasesSyntheticKey(key);\r\n}\r\n\r\n/** Splits either projection's expanded key back into property key + level id. */\r\nexport function splitLeafKey(key: string): {\r\n  propertyKey: string;\r\n  levelId: string;\r\n  kind: 'status' | 'phase';\r\n} {\r\n  if (isLeafPhasesSyntheticKey(key)) {\r\n    const [propertyKey, levelId] = key.split(LEAF_PHASES_KEY_SEPARATOR);\r\n    return { propertyKey, levelId, kind: 'phase' };\r\n  }\r\n  const [propertyKey, levelId] = key.split(LEAF_DETAILS_KEY_SEPARATOR);\r\n  return { propertyKey, levelId, kind: 'status' };\r\n}\r\n\r\nfunction toLeafDetailsStatusSummary(\r\n  status: LeafDetailsRuntimeStatusCount,\r\n): LeafDetailsStatusSummary {\r\n  return {\r\n    key: status.details.key,\r\n    display: status.details.display,\r\n    color: status.details.color ?? null,\r\n    count: status.count,\r\n  };\r\n}\r\n\r\nfunction toLeafDetailsPhaseSummary(\r\n  phase: LeafDetailsRuntimePhaseCount,\r\n): LeafDetailsPhaseSummary {\r\n  return {\r\n    id: phase.details.id ?? null,\r\n    key: phase.details.key,\r\n    display: phase.details.display,\r\n    color: phase.details.color || null,\r\n    count: phase.count,\r\n  };\r\n}\r\n\r\nfunction normalizeLeafDetailsCollection(\r\n  value: unknown,\r\n): LeafDetailsEntityCollectionValue {\r\n  if (isLeafDetailsCollectionValue(value)) {\r\n    return value;\r\n  }\r\n\r\n  if (isLeafDetailsValue(value)) {\r\n    return [value];\r\n  }\r\n\r\n  if (isLeafDetailsRuntimeValue(value)) {\r\n    return value.childSchemas.map((schema) => ({\r\n      levelId: schema.levelId,\r\n      levelName: schema.levelName,\r\n      levelIcon: schema.levelIcon,\r\n      statuses: schema.statuses.map(toLeafDetailsStatusSummary),\r\n      phases: readRuntimePhases(schema.phases).map(toLeafDetailsPhaseSummary),\r\n    }));\r\n  }\r\n\r\n  if (typeof value === 'string' && value.trim().length > 0) {\r\n    try {\r\n      return normalizeLeafDetailsCollection(JSON.parse(value));\r\n    } catch {\r\n      return [];\r\n    }\r\n  }\r\n\r\n  return [];\r\n}\r\n\r\nfunction normalizeLeafDetailsCatalogConfiguration(\r\n  value: unknown,\r\n): LeafDetailsEntityCollectionValue {\r\n  if (isLeafDetailsCatalogConfiguration(value)) {\r\n    return value.map((level) => ({\r\n      levelId: level.levelId,\r\n      levelName: level.levelName,\r\n      levelIcon: level.levelIcon,\r\n      statuses: level.statuses.map((status) => ({\r\n        key: status.key,\r\n        display: status.display,\r\n        color: status.color ?? null,\r\n        count: 0,\r\n      })),\r\n      phases: readCatalogPhases(level.phases).map((phase) => ({\r\n        id: phase.id ?? null,\r\n        key: phase.key,\r\n        display: phase.display,\r\n        color: phase.color || null,\r\n        count: 0,\r\n      })),\r\n    }));\r\n  }\r\n\r\n  if (typeof value === 'string' && value.trim().length > 0) {\r\n    try {\r\n      return normalizeLeafDetailsCatalogConfiguration(JSON.parse(value));\r\n    } catch {\r\n      return [];\r\n    }\r\n  }\r\n\r\n  return [];\r\n}\r\n\r\nexport function expandLeafDetailsEntity(entity: EntityData): EntityData[] {\r\n  if (entity.viewType !== 'LeafDetails') {\r\n    return [entity];\r\n  }\r\n\r\n  if (isLeafSyntheticKey(entity.key) && isLeafDetailsValue(entity.value)) {\r\n    return [entity];\r\n  }\r\n\r\n  const configuration = entity.configuration as\r\n    | EntityLeafDetailsConfig\r\n    | undefined;\r\n  const levels = normalizeLeafDetailsCollection(entity.value);\r\n  const fallbackLevels = levels.length\r\n    ? levels\r\n    : normalizeLeafDetailsCollection(entity.rawValue);\r\n  const resolvedLevels = fallbackLevels.length\r\n    ? fallbackLevels\r\n    : normalizeLeafDetailsCatalogConfiguration(entity.propertyConfiguration);\r\n\r\n  if (resolvedLevels.length === 0) {\r\n    return [entity];\r\n  }\r\n\r\n  const statusItems = resolvedLevels.flatMap((level) => {\r\n    const levelConfig = configuration?.leafLevels?.[String(level.levelId)];\r\n    if (configuration?.leafLevels && !levelConfig) {\r\n      return [];\r\n    }\r\n\r\n    const selectedStatuses = levelConfig?.selectedStatuses?.length\r\n      ? new Set(levelConfig.selectedStatuses)\r\n      : null;\r\n\r\n    return [\r\n      {\r\n        ...entity,\r\n        key: entity.key\r\n          ? `${entity.key}${LEAF_DETAILS_KEY_SEPARATOR}${level.levelId}`\r\n          : entity.key,\r\n        name: level.levelName,\r\n        value: {\r\n          ...level,\r\n          kind: 'status',\r\n          statuses: selectedStatuses\r\n            ? level.statuses.filter((status) =>\r\n                selectedStatuses.has(status.key),\r\n              )\r\n            : level.statuses,\r\n        },\r\n        order: levelConfig?.order ?? entity.order,\r\n        configuration: {\r\n          ...configuration,\r\n          size: levelConfig?.size ?? configuration?.size,\r\n        },\r\n      } satisfies EntityData,\r\n    ];\r\n  });\r\n\r\n  /**\r\n   * Phases are opt-in: only levels with an explicit `leafPhases` entry produce\r\n   * a phase item. An absent map means \"no phase badges\", never \"all of them\" —\r\n   * the opposite of `leafLevels`, whose absence predates the per-level config\r\n   * and has to keep meaning \"show every level\".\r\n   */\r\n  const phaseItems = resolvedLevels.flatMap((level) => {\r\n    const phaseConfig = configuration?.leafPhases?.[String(level.levelId)];\r\n    if (!phaseConfig) {\r\n      return [];\r\n    }\r\n\r\n    const phases = level.phases ?? [];\r\n    const selectedPhases = phaseConfig.selectedPhases?.length\r\n      ? new Set(phaseConfig.selectedPhases)\r\n      : null;\r\n\r\n    return [\r\n      {\r\n        ...entity,\r\n        key: entity.key\r\n          ? `${entity.key}${LEAF_PHASES_KEY_SEPARATOR}${level.levelId}`\r\n          : entity.key,\r\n        name: level.levelName,\r\n        value: {\r\n          ...level,\r\n          kind: 'phase',\r\n          phases: selectedPhases\r\n            ? phases.filter((phase) => selectedPhases.has(phase.key))\r\n            : phases,\r\n        },\r\n        order: phaseConfig.order ?? entity.order,\r\n        configuration: {\r\n          ...configuration,\r\n          size: phaseConfig.size ?? configuration?.size,\r\n        },\r\n      } satisfies EntityData,\r\n    ];\r\n  });\r\n\r\n  const expanded = [...statusItems, ...phaseItems];\r\n  return expanded.length > 0 ? expanded : [entity];\r\n}\r\n\r\n/**\r\n * Expands the entity types that render as several items — LeafDetails levels\r\n * and Connection source levels — then orders the flattened list, with the card\r\n * header (if any) pinned first. Shared by the customization builder canvas and\r\n * the runtime preview so both agree on what a configured area actually\r\n * contains.\r\n */\r\nexport function buildDisplayEntities(entities: EntityData[]): EntityData[] {\r\n  return pinEntityHeaderFirst(\r\n    entities\r\n      .flatMap((entity) => expandLeafDetailsEntity(entity))\r\n      .flatMap((entity) => expandConnectionEntity(entity))\r\n      .sort((a, b) => (a.order ?? 0) - (b.order ?? 0)),\r\n  );\r\n}\r\n","import { Injectable, signal } from '@angular/core';\r\nimport { describeCalculationChange } from './calculation-change.utils';\r\nimport type { EntityCalculationChange, EntityData } from './entity.model';\r\n\r\n/** How long the chip beside a value that just changed stays visible. */\r\nexport const CALCULATION_CHANGE_CHIP_MS = 30_000;\r\n\r\n/** The catalog fields that decide whether a property counts as calculated. */\r\nexport interface CalculatedPropertyMeta {\r\n  viewType?: string | null;\r\n  isCalculated?: boolean | null;\r\n  calculationMethod?: string | null;\r\n}\r\n\r\n/**\r\n * Whether a surface marks this property as calculated. `isCalculated` alone is\r\n * too broad: the backend also sets it, with no calculation method, on system\r\n * columns such as `created_at`, `id` and `team_members`. A status has no method\r\n * but is recalculated. An auto code is generated rather than recalculated, but\r\n * the backend explains it like any calculated value, so it is marked too.\r\n */\r\nexport function isCalculatedProperty(\r\n  meta: CalculatedPropertyMeta | null | undefined,\r\n): boolean {\r\n  if (!meta) {\r\n    return false;\r\n  }\r\n  if (meta.viewType === 'Status') {\r\n    return true;\r\n  }\r\n  return meta.isCalculated === true && !!meta.calculationMethod;\r\n}\r\n\r\nconst EMPTY_CHANGES: ReadonlyMap<string, EntityCalculationChange> = new Map();\r\n\r\nconst historyKey = (\r\n  scope: string,\r\n  recordId: string | number,\r\n  propertyKey: string,\r\n) => `${scope}|${recordId}|${propertyKey}`;\r\n\r\n/**\r\n * Remembers the calculated values each surface last showed, for the whole\r\n * session, so a value that moved while the surface was closed still says so\r\n * when it opens again: the card of a project edited from its workspace, or a\r\n * preview opened a second time.\r\n *\r\n * A scope names a kind of surface, such as `preview:level:12` or\r\n * `list:level:12`. Each compares only with itself: two endpoints may not agree\r\n * at the same moment, and comparing across them would invent changes.\r\n */\r\n@Injectable({ providedIn: 'root' })\r\nexport class CalculatedValueHistory {\r\n  private readonly seen = new Map<string, EntityData>();\r\n  private readonly timers = new Map<string, ReturnType<typeof setTimeout>>();\r\n  private readonly changes = signal(EMPTY_CHANGES);\r\n\r\n  /**\r\n   * Records the calculated values a surface just read. Those that moved since\r\n   * the scope last read them get a change, shown as recent for\r\n   * {@link CALCULATION_CHANGE_CHIP_MS}.\r\n   */\r\n  observe(\r\n    scope: string,\r\n    recordId: string | number,\r\n    entities: readonly EntityData[],\r\n    locale: string,\r\n  ): void {\r\n    let next: Map<string, EntityCalculationChange> | null = null;\r\n    for (const entity of entities) {\r\n      if (!entity.calculated || !entity.key) {\r\n        continue;\r\n      }\r\n      const key = historyKey(scope, recordId, entity.key);\r\n      const previous = this.seen.get(key);\r\n      this.seen.set(key, entity);\r\n      const change =\r\n        previous && describeCalculationChange(previous, entity, locale);\r\n      if (!change) {\r\n        continue;\r\n      }\r\n      next ??= new Map(this.changes());\r\n      next.set(key, change);\r\n      this.expireLater(key);\r\n    }\r\n    if (next) {\r\n      this.changes.set(next);\r\n    }\r\n  }\r\n\r\n  /** The last change of one value, if the scope saw it move. Reactive. */\r\n  changeOf(\r\n    scope: string,\r\n    recordId: string | number,\r\n    propertyKey: string,\r\n  ): EntityCalculationChange | null {\r\n    return this.changes().get(historyKey(scope, recordId, propertyKey)) ?? null;\r\n  }\r\n\r\n  /**\r\n   * The entities with the last change of each calculated value attached.\r\n   * Returns the same array when nothing changed, so inputs stay stable.\r\n   * Reactive.\r\n   */\r\n  apply<T extends EntityData>(\r\n    scope: string,\r\n    recordId: string | number,\r\n    entities: T[],\r\n  ): T[] {\r\n    if (this.changes().size === 0) {\r\n      return entities;\r\n    }\r\n    let result: T[] | null = null;\r\n    for (let index = 0; index < entities.length; index++) {\r\n      const entity = entities[index];\r\n      const change =\r\n        entity.calculated && entity.key\r\n          ? this.changeOf(scope, recordId, entity.key)\r\n          : null;\r\n      if (change && entity.calculationChange !== change) {\r\n        result ??= [...entities];\r\n        result[index] = { ...entity, calculationChange: change };\r\n      }\r\n    }\r\n    return result ?? entities;\r\n  }\r\n\r\n  private expireLater(key: string): void {\r\n    clearTimeout(this.timers.get(key));\r\n    this.timers.set(\r\n      key,\r\n      setTimeout(() => {\r\n        this.timers.delete(key);\r\n        const change = this.changes().get(key);\r\n        if (change?.recent) {\r\n          this.changes.set(\r\n            new Map(this.changes()).set(key, { ...change, recent: false }),\r\n          );\r\n        }\r\n      }, CALCULATION_CHANGE_CHIP_MS),\r\n    );\r\n  }\r\n}\r\n","import {\r\n  ChangeDetectionStrategy,\r\n  Component,\r\n  computed,\r\n  input,\r\n} from '@angular/core';\r\nimport { readableTextOn } from '@masterteam/components';\r\nimport { TruncateTooltip } from '@masterteam/components/tooltip';\r\nimport {\r\n  displayOrPlaceholder,\r\n  extractDisplayText,\r\n} from '../entity-display.utils';\r\nimport { resolveEntityHeader } from '../entity-header.util';\r\nimport { EntityData } from '../entity.model';\r\n\r\n/**\r\n * A Text entity configured as the card header (`configuration.header`): a\r\n * full-width band with a coloured top border and the value centred, no label.\r\n *\r\n * The band covers its host's padding so it sits flush against the card's top\r\n * and side edges. A padded host declares how much padding there is through\r\n * three custom properties — see `entity-header.css`. Without them the band\r\n * stays inside the content box with ordinary rounded corners.\r\n */\r\n@Component({\r\n  selector: 'mt-entity-header',\r\n  changeDetection: ChangeDetectionStrategy.OnPush,\r\n  standalone: true,\r\n  imports: [TruncateTooltip],\r\n  templateUrl: './entity-header.html',\r\n  styleUrl: './entity-header.css',\r\n  host: { class: 'block' },\r\n})\r\nexport class EntityHeader {\r\n  readonly data = input.required<EntityData>();\r\n\r\n  private readonly header = computed(\r\n    () => resolveEntityHeader(this.data()) ?? {},\r\n  );\r\n\r\n  /** `null` leaves the stylesheet's primary tint in place. */\r\n  readonly backgroundColor = computed(\r\n    () => this.header().backgroundColor || null,\r\n  );\r\n\r\n  /** `null` leaves the stylesheet's primary border in place. */\r\n  readonly borderColor = computed(() => this.header().borderColor || null);\r\n\r\n  /**\r\n   * A chosen background can be any colour at all, so the ink is picked to read\r\n   * on it. The default tint is translucent over the card, so it keeps the\r\n   * theme's own text colour — which is what flips correctly in dark mode.\r\n   */\r\n  readonly textColor = computed(() => {\r\n    const background = this.backgroundColor();\r\n    return background ? readableTextOn(background) : null;\r\n  });\r\n\r\n  readonly displayValue = computed(() =>\r\n    displayOrPlaceholder(extractDisplayText(this.data().value)),\r\n  );\r\n}\r\n","<!--\r\n  `px-10` is symmetric on purpose: the value is centred, and the card's corner\r\n  controls (status indicators, the actions menu) sit over the band's end side,\r\n  so both sides reserve the same room and the text stays truly centred.\r\n-->\r\n<div\r\n  class=\"mt-entity-header-band flex min-h-12 items-center justify-center px-10 py-3.5 text-center\"\r\n  [style.background-color]=\"backgroundColor()\"\r\n  [style.border-top-color]=\"borderColor()\"\r\n  [style.color]=\"textColor()\"\r\n>\r\n  <div\r\n    class=\"min-w-0 max-w-full line-clamp-2 break-words text-base font-bold\"\r\n    dir=\"auto\"\r\n    mtTruncateTooltip\r\n    tooltipPosition=\"top\"\r\n    [innerHTML]=\"displayValue()\"\r\n  ></div>\r\n</div>\r\n","import { ChangeDetectionStrategy, Component, input } from '@angular/core';\r\nimport { EntityData } from '../entity.model';\r\nimport { EntityListPreview } from '../entity-list-preview/entity-list-preview';\r\nimport { EntityLookupModuleCheckList } from '../entity-lookup-module-check-list/entity-lookup-module-check-list';\r\nimport { EntityValuePreview } from './entity-value-preview';\r\n\r\n/**\r\n * Owns the view types that render their own nested properties *through*\r\n * `EntityValuePreview`. Routing them from inside that component instead would\r\n * make the two files import each other, so they branch here and everything\r\n * else is delegated.\r\n */\r\n@Component({\r\n  selector: 'mt-entity-preview-body',\r\n  standalone: true,\r\n  changeDetection: ChangeDetectionStrategy.OnPush,\r\n  imports: [EntityListPreview, EntityLookupModuleCheckList, EntityValuePreview],\r\n  templateUrl: './entity-preview-body.html',\r\n  host: {\r\n    class: 'w-full',\r\n  },\r\n})\r\nexport class EntityPreviewBody {\r\n  readonly data = input.required<EntityData>();\r\n  readonly attachmentShape = input<'default' | 'compact'>('default');\r\n}\r\n","@if (data().viewType === \"LookupModuleCheckList\") {\r\n  <mt-entity-lookup-module-check-list [data]=\"data()\" />\r\n} @else if (data().viewType === \"EntityList\") {\r\n  <mt-entity-list-preview [data]=\"data()\" />\r\n} @else {\r\n  <mt-entity-value-preview\r\n    [data]=\"data()\"\r\n    [attachmentShape]=\"attachmentShape()\"\r\n  />\r\n}\r\n","import {\n  ChangeDetectionStrategy,\n  Component,\n  computed,\n  input,\n} from '@angular/core';\nimport { EntityData } from '../../entity.model';\nimport {\n  ComparisonValueSide,\n  ValueComparison,\n} from '../../entity-comparison.model';\nimport { EntityPreviewBody } from '../../entity-preview/entity-preview-body';\n\n@Component({\n  selector: 'mt-comparison-value',\n  standalone: true,\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  imports: [EntityPreviewBody],\n  templateUrl: './comparison-value.html',\n  host: {\n    class: 'block w-full',\n  },\n})\nexport class ComparisonValue {\n  readonly data = input.required<EntityData>();\n\n  readonly comparison = computed<ValueComparison | null>(() => {\n    const c = this.data().comparison;\n    return c?.kind === 'Value' ? c : null;\n  });\n\n  readonly oldEntity = computed<EntityData | null>(() =>\n    this.buildSide(this.comparison()?.oldValue),\n  );\n\n  readonly newEntity = computed<EntityData | null>(() =>\n    this.buildSide(this.comparison()?.newValue),\n  );\n\n  private buildSide(side: ComparisonValueSide | undefined): EntityData | null {\n    if (!side) return null;\n    const base = this.data();\n    return {\n      ...base,\n      rawValue:\n        side.raw === null || side.raw === undefined\n          ? undefined\n          : String(side.raw),\n      value: (side.display ?? side.value ?? '') as EntityData['value'],\n      comparison: undefined,\n    };\n  }\n}\n","@if (comparison(); as cmp) {\r\n  <div class=\"flex w-full min-w-0 items-stretch gap-3\">\r\n    <div\r\n      class=\"flex min-w-0 flex-1 flex-col gap-1 rounded-md border border-surface-200 bg-surface-50 px-3 py-2\"\r\n    >\r\n      <span class=\"text-xs font-medium uppercase tracking-wide text-muted-color\"\r\n        >Before</span\r\n      >\r\n      @if (oldEntity(); as old) {\r\n        <mt-entity-preview-body [data]=\"old\" />\r\n      } @else {\r\n        <span class=\"text-sm text-muted-color\">_</span>\r\n      }\r\n    </div>\r\n    <div class=\"flex shrink-0 items-center text-muted-color\" aria-hidden=\"true\">\r\n      &rarr;\r\n    </div>\r\n    <div\r\n      class=\"flex min-w-0 flex-1 flex-col gap-1 rounded-md border border-primary-200 bg-primary-50 px-3 py-2\"\r\n    >\r\n      <span class=\"text-xs font-medium uppercase tracking-wide text-primary-600\"\r\n        >After</span\r\n      >\r\n      @if (newEntity(); as next) {\r\n        <mt-entity-preview-body [data]=\"next\" />\r\n      } @else {\r\n        <span class=\"text-sm text-muted-color\">_</span>\r\n      }\r\n    </div>\r\n  </div>\r\n}\r\n","import {\n  ChangeDetectionStrategy,\n  Component,\n  computed,\n  inject,\n  input,\n} from '@angular/core';\nimport { TranslocoService } from '@jsverse/transloco';\nimport { EntityData } from '../../entity.model';\nimport {\n  EntityComparisonOperation,\n  EntityListComparison,\n  EntityListComparisonRow,\n} from '../../entity-comparison.model';\nimport { displayOrPlaceholder } from '../../entity-display.utils';\n\ninterface OperationBadge {\n  label: string;\n  classes: string;\n}\n\nconst OPERATION_BADGE_KEYS: Record<\n  EntityComparisonOperation,\n  { key: string; classes: string }\n> = {\n  CreateRecord: {\n    key: 'components.comparisonEntities.added',\n    classes:\n      'bg-emerald-50 text-emerald-700 ring-1 ring-inset ring-emerald-200',\n  },\n  UpdateRecord: {\n    key: 'components.comparisonEntities.updated',\n    classes: 'bg-amber-50 text-amber-700 ring-1 ring-inset ring-amber-200',\n  },\n  DeleteRecord: {\n    key: 'components.comparisonEntities.removed',\n    classes: 'bg-rose-50 text-rose-700 ring-1 ring-inset ring-rose-200',\n  },\n};\n\n@Component({\n  selector: 'mt-comparison-entity-list',\n  standalone: true,\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  imports: [],\n  templateUrl: './comparison-entity-list.html',\n  host: {\n    class: 'block w-full',\n  },\n})\nexport class ComparisonEntityList {\n  private readonly transloco = inject(TranslocoService);\n  readonly data = input.required<EntityData>();\n\n  readonly comparison = computed<EntityListComparison | null>(() => {\n    const c = this.data().comparison;\n    return c?.kind === 'EntityList' ? c : null;\n  });\n\n  readonly rows = computed<EntityListComparisonRow[]>(\n    () => this.comparison()?.rows ?? [],\n  );\n\n  readonly targetModuleKey = computed<string>(\n    () => this.comparison()?.targetModuleKey ?? '',\n  );\n\n  readonly label = computed<string>(() => this.data().name ?? '');\n\n  badgeFor(op: EntityComparisonOperation): OperationBadge {\n    const config = OPERATION_BADGE_KEYS[op];\n    return {\n      label: this.transloco.translate(config.key),\n      classes: config.classes,\n    };\n  }\n\n  displayField(value: unknown, display?: string | null): string {\n    if (display && display.trim().length > 0) return display;\n    return displayOrPlaceholder(value);\n  }\n\n  rowId(_i: number, row: EntityListComparisonRow): number | string {\n    return row.entityId ?? _i;\n  }\n\n  oldField(\n    row: EntityListComparisonRow,\n    propertyKey: string,\n  ): { value: unknown; display?: string | null } | undefined {\n    return row.oldValues.find((v) => v.propertyKey === propertyKey);\n  }\n}\n","@if (comparison(); as cmp) {\r\n  <div class=\"flex w-full min-w-0 flex-col gap-2\">\r\n    @if (label()) {\r\n      <div class=\"flex items-baseline justify-between\">\r\n        <span class=\"text-sm font-medium text-color\">{{ label() }}</span>\r\n        @if (targetModuleKey()) {\r\n          <span class=\"text-xs text-muted-color\">{{ targetModuleKey() }}</span>\r\n        }\r\n      </div>\r\n    }\r\n    @if (rows().length === 0) {\r\n      <div class=\"text-sm text-muted-color\">_</div>\r\n    } @else {\r\n      <ul class=\"flex flex-col gap-2\">\r\n        @for (row of rows(); track rowId($index, row)) {\r\n          <li\r\n            class=\"flex flex-col gap-2 rounded-md border border-surface-200 bg-surface-50 px-3 py-2\"\r\n          >\r\n            <div class=\"flex items-center justify-between gap-2\">\r\n              <span\r\n                class=\"inline-flex items-center rounded px-2 py-0.5 text-xs font-medium\"\r\n                [class]=\"badgeFor(row.operation).classes\"\r\n              >\r\n                {{ badgeFor(row.operation).label }}\r\n              </span>\r\n              <span class=\"text-xs text-muted-color\">#{{ row.entityId }}</span>\r\n            </div>\r\n\r\n            @switch (row.operation) {\r\n              @case (\"CreateRecord\") {\r\n                <dl class=\"grid grid-cols-1 gap-1 sm:grid-cols-2\">\r\n                  @for (f of row.newValues; track f.propertyKey) {\r\n                    <div class=\"flex min-w-0 flex-col\">\r\n                      <dt class=\"text-xs text-muted-color\">{{ f.label }}</dt>\r\n                      <dd class=\"truncate text-sm text-color\">\r\n                        {{ displayField(f.value, f.display) }}\r\n                      </dd>\r\n                    </div>\r\n                  }\r\n                </dl>\r\n              }\r\n              @case (\"DeleteRecord\") {\r\n                <dl class=\"grid grid-cols-1 gap-1 sm:grid-cols-2\">\r\n                  @for (f of row.oldValues; track f.propertyKey) {\r\n                    <div class=\"flex min-w-0 flex-col\">\r\n                      <dt class=\"text-xs text-muted-color\">{{ f.label }}</dt>\r\n                      <dd class=\"truncate text-sm text-color line-through\">\r\n                        {{ displayField(f.value, f.display) }}\r\n                      </dd>\r\n                    </div>\r\n                  }\r\n                </dl>\r\n              }\r\n              @default {\r\n                <dl class=\"flex flex-col gap-1\">\r\n                  @for (f of row.newValues; track f.propertyKey) {\r\n                    <div class=\"flex min-w-0 flex-col\">\r\n                      <dt class=\"text-xs text-muted-color\">{{ f.label }}</dt>\r\n                      <dd class=\"flex min-w-0 flex-wrap items-center gap-2\">\r\n                        <span\r\n                          class=\"max-w-[40%] truncate text-sm text-muted-color line-through\"\r\n                        >\r\n                          {{\r\n                            displayField(\r\n                              $any(oldField(row, f.propertyKey))?.value,\r\n                              $any(oldField(row, f.propertyKey))?.display\r\n                            )\r\n                          }}\r\n                        </span>\r\n                        <span class=\"text-muted-color\" aria-hidden=\"true\"\r\n                          >&rarr;</span\r\n                        >\r\n                        <span class=\"max-w-[40%] truncate text-sm text-color\">\r\n                          {{ displayField(f.value, f.display) }}\r\n                        </span>\r\n                      </dd>\r\n                    </div>\r\n                  }\r\n                </dl>\r\n              }\r\n            }\r\n          </li>\r\n        }\r\n      </ul>\r\n    }\r\n  </div>\r\n}\r\n","import {\r\n  ChangeDetectionStrategy,\r\n  Component,\r\n  ViewEncapsulation,\r\n  computed,\r\n  inject,\r\n  input,\r\n} from '@angular/core';\r\nimport { TranslocoService } from '@jsverse/transloco';\r\nimport { Tooltip } from '@masterteam/components/tooltip';\r\nimport { Icon } from '@masterteam/icons';\r\nimport { EntityData } from '../entity.model';\r\nimport { sharedActiveLang } from '../active-lang';\r\nimport { resolveEntityInfo } from '../entity-display.utils';\r\nimport { EntityPreviewBody } from './entity-preview-body';\r\nimport { ComparisonValue } from '../comparison/comparison-value/comparison-value';\r\nimport { ComparisonEntityList } from '../comparison/comparison-entity-list/comparison-entity-list';\r\nimport { ENTITY_PREVIEW_DATA } from './entity-preview-context';\r\n\r\n@Component({\r\n  selector: 'mt-entity-preview',\r\n  standalone: true,\r\n  changeDetection: ChangeDetectionStrategy.OnPush,\r\n  imports: [\r\n    EntityPreviewBody,\r\n    ComparisonValue,\r\n    ComparisonEntityList,\r\n    Tooltip,\r\n    Icon,\r\n  ],\r\n  providers: [\r\n    {\r\n      provide: ENTITY_PREVIEW_DATA,\r\n      useFactory: () => inject(EntityPreview).data,\r\n    },\r\n  ],\r\n  templateUrl: './entity-preview.html',\r\n  styleUrl: './entity-preview.css',\r\n  // The tooltip is appended to the body by PrimeNG, so its style rule has to\r\n  // be global. See entity-preview.css.\r\n  encapsulation: ViewEncapsulation.None,\r\n  host: {\r\n    class: 'w-full',\r\n    // Both only apply when there is a note, so an entity without one keeps\r\n    // exactly the box it had before this feature existed.\r\n    '[class.relative]': 'infoText()',\r\n    '[class.pe-4]': 'infoText()',\r\n  },\r\n})\r\nexport class EntityPreview {\r\n  private readonly transloco = inject(TranslocoService);\r\n\r\n  readonly data = input.required<EntityData>();\r\n  readonly attachmentShape = input<'default' | 'compact'>('default');\r\n\r\n  private readonly activeLang = sharedActiveLang(this.transloco);\r\n\r\n  /**\r\n   * The admin-authored note for the active language, or `''` when the property\r\n   * has none. Resolved here rather than in each `entity-*` component because\r\n   * this is the one wrapper every view type and every call site passes through\r\n   * — the card grid, the customization builder preview, and the standalone\r\n   * `mt-entity-preview` usages in the app.\r\n   */\r\n  readonly infoText = computed(() =>\r\n    resolveEntityInfo(this.data().configuration, this.activeLang()),\r\n  );\r\n\r\n  readonly comparisonKind = computed<'Value' | 'EntityList' | null>(() => {\r\n    const c = this.data().comparison;\r\n    if (!c) return null;\r\n    if (c.kind === 'Value') return 'Value';\r\n    if (c.kind === 'EntityList') return 'EntityList';\r\n    return null;\r\n  });\r\n}\r\n","@if (infoText(); as info) {\r\n  <!--\r\n    The note affordance. Absolutely positioned so it stays out of the value's\r\n    own layout — each viewType renders its own markup and there is no shared\r\n    slot to put this in — while the host reserves the corner with `pe-4`, so a\r\n    long value truncates before it can run underneath the icon.\r\n  -->\r\n  <!--\r\n    Sized with `text-sm`, not a `size` input: `mt-icon` has none, and its host\r\n    is `width: 1em` — so font-size is what actually scales the glyph.\r\n  -->\r\n  <mt-icon\r\n    icon=\"general.info-circle\"\r\n    class=\"absolute top-0 end-0 z-10 cursor-help text-sm text-surface-400 transition-colors hover:text-primary-600\"\r\n    [mtTooltip]=\"info\"\r\n    tooltipPosition=\"top\"\r\n    tooltipStyleClass=\"mt-entity-info-tooltip\"\r\n    [attr.aria-label]=\"info\"\r\n  />\r\n}\r\n\r\n@switch (comparisonKind()) {\r\n  @case (\"Value\") {\r\n    <mt-comparison-value [data]=\"data()\" />\r\n  }\r\n  @case (\"EntityList\") {\r\n    <mt-comparison-entity-list [data]=\"data()\" />\r\n  }\r\n  @default {\r\n    <mt-entity-preview-body\r\n      [data]=\"data()\"\r\n      [attachmentShape]=\"attachmentShape()\"\r\n    />\r\n  }\r\n}\r\n","import {\r\n  ChangeDetectionStrategy,\r\n  Component,\r\n  computed,\r\n  inject,\r\n  input,\r\n  output,\r\n} from '@angular/core';\r\nimport { NgTemplateOutlet } from '@angular/common';\r\nimport { toSignal } from '@angular/core/rxjs-interop';\r\nimport { TranslocoService } from '@jsverse/transloco';\r\nimport { EntityData, EntitySize } from '../entity.model';\r\nimport { buildDisplayEntities } from '../leaf-details-display.utils';\r\nimport { resolveEntityGridRow } from '../entity-display.utils';\r\nimport {\r\n  getEntitySectionTitle,\r\n  groupEntitiesIntoSections,\r\n} from '../entity-sections.util';\r\nimport { isEntityHeader } from '../entity-header.util';\r\nimport { EntityHeader } from '../entity-header/entity-header';\r\nimport { EntityPreview } from '../entity-preview/entity-preview';\r\n\r\nexport interface EntityClickEvent {\r\n  entity: EntityData;\r\n  key: string;\r\n  source: MouseEvent;\r\n}\r\n\r\nconst EMPTY_KEY_SET: ReadonlySet<string> = new Set();\r\n\r\n/** Classes every entity slot carries, before its per-slot modifiers. */\r\nconst SLOT_BASE_CLASS =\r\n  'min-w-0 overflow-hidden flex items-center rounded transition-colors';\r\n\r\n/** Opt-in dashed frame (`configuration.showBorder`). */\r\nconst SLOT_BORDER_CLASS = 'border p-3 border-dashed border-gray-200 rounded-lg';\r\n\r\n/**\r\n * One entity's fully-resolved render inputs.\r\n *\r\n * Precomputing these is what keeps large grids cheap. The template used to call\r\n * `isClickable` / `isActive` / `getColSpan` roughly eight times per entity on\r\n * *every* change detection pass; in a client-list card grid (60 cards of ~50\r\n * entities) that was tens of thousands of calls per tick. A slot is now rebuilt\r\n * only when the entity list, the clickable/active key sets, or the tooltip\r\n * strings actually change.\r\n */\r\ninterface EntitySlot {\r\n  entity: EntityData;\r\n  trackKey: string;\r\n  containerClass: string;\r\n  colSpan: string;\r\n  /** `span N` for a multi-row entity; `null` keeps the default single row. */\r\n  gridRow: string | null;\r\n  clickable: boolean;\r\n  rowClickIgnore: 'true' | null;\r\n  title: string | null;\r\n}\r\n\r\n/** A section box (or the leading bare run) with its slots already resolved. */\r\ninterface EntitySlotGroup {\r\n  trackKey: string;\r\n  boxed: boolean;\r\n  title: string;\r\n  slots: EntitySlot[];\r\n}\r\n\r\n@Component({\r\n  selector: 'mt-entities-preview',\r\n  changeDetection: ChangeDetectionStrategy.OnPush,\r\n  standalone: true,\r\n  imports: [EntityPreview, EntityHeader, NgTemplateOutlet],\r\n  templateUrl: './entities-preview.html',\r\n  styleUrls: ['./entities-preview.css'],\r\n  host: {\r\n    class: 'block min-w-0 w-full',\r\n    '[class.mt-entities-stack-narrow]': 'stackOnNarrow()',\r\n  },\r\n})\r\nexport class EntitiesPreview {\r\n  private readonly transloco = inject(TranslocoService);\r\n  /** Array of entity data to display */\r\n  readonly entities = input.required<EntityData[]>();\r\n  readonly attachmentShape = input<'default' | 'compact'>('default');\r\n\r\n  /**\r\n   * Soft \"stack every field full-width when the host is narrower than the\r\n   * 24-column grid reads well\" behavior (the ≤400px container-query fallback,\r\n   * default on). Set to `false` in wide-enough card layouts — e.g. client-list\r\n   * cards (~350px) — so the per-entity `size` configuration is honored instead\r\n   * of forcing every item to full width. A hard ≤280px stack always applies\r\n   * regardless, so the 24-column gap floor can never overflow the host (#1081).\r\n   */\r\n  readonly stackOnNarrow = input(true);\r\n\r\n  /**\r\n   * Set of entity keys that should appear interactive (cursor pointer,\r\n   * clicks emit). Pass `new Set([...])` from a computed signal in the host\r\n   * for reactive enabling — when the host's set changes, Angular re-renders\r\n   * via its normal change detection, no manual subscriptions required.\r\n   *\r\n   * Pass a *stable* reference: a host method that mints a fresh `Set` on every\r\n   * call re-writes this input on every change detection pass and defeats the\r\n   * slot memoization below.\r\n   */\r\n  readonly clickableKeys = input<ReadonlySet<string>>(EMPTY_KEY_SET);\r\n\r\n  /**\r\n   * Set of entity keys that should render with the \"active\" treatment\r\n   * (e.g. currently the filter source). Same reactive pattern — and the same\r\n   * stable-reference requirement — as `clickableKeys`.\r\n   */\r\n  readonly activeKeys = input<ReadonlySet<string>>(EMPTY_KEY_SET);\r\n\r\n  /** Tooltip text shown on hover when an entity is clickable but not active. */\r\n  readonly clickableTooltip = input<string>(\r\n    this.transloco.translate('components.entitiesPreview.filterByThis'),\r\n  );\r\n\r\n  /** Tooltip text shown on hover when an entity is the current active filter. */\r\n  readonly activeTooltip = input<string>(\r\n    this.transloco.translate('components.entitiesPreview.clearFilter'),\r\n  );\r\n\r\n  /**\r\n   * Emits when an individual entity slot is clicked. Only fires when the\r\n   * entity's key is present in `clickableKeys`.\r\n   */\r\n  readonly entityClick = output<EntityClickEvent>();\r\n\r\n  /**\r\n   * The active language as a signal. Section headings are resolved per-language\r\n   * in a `computed`, so under `OnPush` a plain `getActiveLang()` read would\r\n   * freeze them at whatever language was active on first render.\r\n   */\r\n  private readonly activeLang = toSignal(this.transloco.langChanges$, {\r\n    initialValue: this.transloco.getActiveLang(),\r\n  });\r\n\r\n  /** Entities expanded and sorted by order */\r\n  readonly displayEntities = computed(() =>\r\n    buildDisplayEntities(this.entities()),\r\n  );\r\n\r\n  /**\r\n   * The entity drawn as the card header, or `null`. `buildDisplayEntities`\r\n   * pins it first, so only the head of the list needs checking.\r\n   */\r\n  readonly header = computed(() => {\r\n    const [first] = this.displayEntities();\r\n    return isEntityHeader(first) ? first : null;\r\n  });\r\n\r\n  /**\r\n   * The display entities, minus the header, split into section groups. With\r\n   * no `Section` markers this is a single `{ section: null }` group, so the\r\n   * bare grid renders exactly as before.\r\n   */\r\n  readonly sectionGroups = computed(() => {\r\n    const entities = this.displayEntities();\r\n    return groupEntitiesIntoSections(\r\n      this.header() ? entities.slice(1) : entities,\r\n    );\r\n  });\r\n\r\n  /**\r\n   * The render model the template iterates. Split from `sectionGroups` on\r\n   * purpose: grouping only re-runs when the entities themselves change, while\r\n   * this cheap mapping re-runs when the key sets or tooltips change.\r\n   */\r\n  protected readonly slotGroups = computed<EntitySlotGroup[]>(() => {\r\n    const clickableKeys = this.clickableKeys();\r\n    const activeKeys = this.activeKeys();\r\n    const clickableTooltip = this.clickableTooltip();\r\n    const activeTooltip = this.activeTooltip();\r\n    const lang = this.activeLang();\r\n\r\n    return this.sectionGroups().map((group, groupIndex) => ({\r\n      trackKey: group.section?.key ?? `__group__${groupIndex}`,\r\n      boxed: !!group.section,\r\n      title: getEntitySectionTitle(group.section, lang),\r\n      slots: group.entities.map((entity, entityIndex) => {\r\n        const key = resolveEntityKey(entity);\r\n        const clickable = key.length > 0 && clickableKeys.has(key);\r\n        const active = clickable && activeKeys.has(key);\r\n\r\n        return {\r\n          entity,\r\n          trackKey: entity.key ?? String(entity.order ?? entityIndex),\r\n          containerClass: buildSlotClass(entity, clickable, active),\r\n          colSpan: `span ${(entity.configuration?.size ?? 8) as EntitySize}`,\r\n          gridRow: resolveEntityGridRow(entity.configuration),\r\n          clickable,\r\n          rowClickIgnore: clickable ? ('true' as const) : null,\r\n          title: clickable ? (active ? activeTooltip : clickableTooltip) : null,\r\n        };\r\n      }),\r\n    }));\r\n  });\r\n\r\n  protected onSlotClick(source: MouseEvent, slot: EntitySlot): void {\r\n    if (!slot.clickable) return;\r\n    source.stopPropagation();\r\n    this.entityClick.emit({\r\n      entity: slot.entity,\r\n      key: resolveEntityKey(slot.entity),\r\n      source,\r\n    });\r\n  }\r\n}\r\n\r\n/** Stable key resolution shared with the host — must agree on order. */\r\nfunction resolveEntityKey(entity: EntityData): string {\r\n  return entity.key || entity.normalizedKey || entity.name || '';\r\n}\r\n\r\nfunction buildSlotClass(\r\n  entity: EntityData,\r\n  clickable: boolean,\r\n  active: boolean,\r\n): string {\r\n  let result = SLOT_BASE_CLASS;\r\n  if (entity.configuration?.showBorder) result += ` ${SLOT_BORDER_CLASS}`;\r\n  if (clickable) {\r\n    result += active ? ' mt-entity-filter-active' : ' mt-entity-filterable';\r\n  }\r\n  return result;\r\n}\r\n","<div class=\"flex flex-col gap-4\">\r\n  @if (header(); as headerEntity) {\r\n    <mt-entity-header [data]=\"headerEntity\" />\r\n  }\r\n  @for (group of slotGroups(); track group.trackKey) {\r\n    @if (group.boxed) {\r\n      <!-- Titled section box (matches the client-form section view) -->\r\n      <div\r\n        class=\"flex flex-col gap-0 overflow-hidden rounded-md border border-surface-200 bg-surface-0\"\r\n      >\r\n        @if (group.title) {\r\n          <h3\r\n            class=\"m-0 border-b border-surface-200 bg-surface-50 px-4 py-3 text-lg font-semibold text-color\"\r\n            dir=\"auto\"\r\n          >\r\n            {{ group.title }}\r\n          </h3>\r\n        }\r\n        <div class=\"p-4\">\r\n          <ng-container\r\n            [ngTemplateOutlet]=\"entityGrid\"\r\n            [ngTemplateOutletContext]=\"{ $implicit: group.slots }\"\r\n          />\r\n        </div>\r\n      </div>\r\n    } @else {\r\n      <ng-container\r\n        [ngTemplateOutlet]=\"entityGrid\"\r\n        [ngTemplateOutletContext]=\"{ $implicit: group.slots }\"\r\n      />\r\n    }\r\n  }\r\n</div>\r\n\r\n<!--\r\n  Every binding here reads a value the component already resolved into the slot\r\n  (see `EntitiesPreview.slotGroups`). Keep it that way: this template runs once\r\n  per entity per change detection pass, and a card grid renders thousands of\r\n  them, so a method call or a fresh object literal in this block is measurably\r\n  expensive.\r\n-->\r\n<ng-template #entityGrid let-slots>\r\n  <div class=\"mt-entities-grid grid grid-cols-24 gap-x-3 gap-y-5\">\r\n    @for (slot of slots; track slot.trackKey) {\r\n      <div\r\n        [class]=\"slot.containerClass\"\r\n        [attr.data-row-click-ignore]=\"slot.rowClickIgnore\"\r\n        [attr.title]=\"slot.title\"\r\n        [style.grid-column]=\"slot.colSpan\"\r\n        [style.grid-row]=\"slot.gridRow\"\r\n        (click)=\"onSlotClick($event, slot)\"\r\n      >\r\n        <mt-entity-preview\r\n          [data]=\"slot.entity\"\r\n          [attachmentShape]=\"attachmentShape()\"\r\n        />\r\n      </div>\r\n    }\r\n  </div>\r\n</ng-template>\r\n","import {\n  Directive,\n  ElementRef,\n  inject,\n  NgZone,\n  output,\n  signal,\n} from '@angular/core';\nimport { DOCUMENT } from '@angular/common';\nimport { EntityData, EntityResizeEvent, EntitySize } from '../entity.model';\n\n/**\n * Base class that encapsulates all entity resize-via-drag logic.\n *\n * Extend this directive in any component that needs column-resize behaviour\n * on a 24-column CSS grid.  The subclass must:\n *   - Provide a `model.required<EntityData[]>()` (or equivalent) for the\n *     entity list so `updateEntitySize()` can be called after resize.\n *   - Contain a `.grid` element (or override `getGridElement()`).\n *\n * Resize flow:\n *   1. `onResizeStart(event, entity)` — called from a mousedown on the handle\n *   2. mousemove  → snaps to nearest column, updates `resizePreviewSize`\n *   3. mouseup    → emits `entityResized` with previous & new size\n */\n@Directive()\nexport abstract class EntitiesResizeBase {\n  protected readonly elRef = inject(ElementRef);\n  protected readonly zone = inject(NgZone);\n  protected readonly doc = inject(DOCUMENT);\n\n  /** Emits when an entity is resized via the drag handle */\n  readonly entityResized = output<EntityResizeEvent>();\n\n  // ── Resize state ──\n\n  /** The entity currently being resized (null when idle) */\n  readonly resizingEntity = signal<EntityData | null>(null);\n\n  /** Live preview size while dragging */\n  readonly resizePreviewSize = signal<EntitySize | null>(null);\n\n  /** Bound listeners kept for cleanup */\n  private _onMouseMove: ((e: MouseEvent) => void) | null = null;\n  private _onMouseUp: ((e: MouseEvent) => void) | null = null;\n\n  // ── Public API ──\n\n  /**\n   * Returns the grid element used to compute column widths.\n   * Override if the grid selector differs.\n   */\n  protected getGridElement(): HTMLElement | null {\n    return this.elRef.nativeElement.querySelector('.grid');\n  }\n\n  /**\n   * Returns the grid-column span string for a given entity.\n   * While resizing the active entity, returns the preview size.\n   */\n  getResizeColSpan(entity: EntityData): string {\n    if (this.resizingEntity() === entity && this.resizePreviewSize() !== null) {\n      return `span ${this.resizePreviewSize()}`;\n    }\n    const size: EntitySize = entity.configuration?.size ?? 8;\n    return `span ${size}`;\n  }\n\n  /** Starts a resize operation from the right-edge handle */\n  onResizeStart(event: MouseEvent, entity: EntityData): void {\n    // Prevent the drag-drop from starting\n    event.preventDefault();\n    event.stopPropagation();\n\n    const gridEl = this.getGridElement();\n    if (!gridEl) return;\n\n    const gridRect = gridEl.getBoundingClientRect();\n    const gridWidth = gridRect.width;\n    const columnWidth = gridWidth / 24;\n\n    const previousSize: EntitySize = entity.configuration?.size ?? 8;\n\n    // Left edge of the entity cell\n    const cellEl = (event.target as HTMLElement).closest(\n      '.entity-cell',\n    ) as HTMLElement | null;\n    if (!cellEl) return;\n    const cellRect = cellEl.getBoundingClientRect();\n    const isRtl =\n      this.doc.documentElement.getAttribute('dir') === 'rtl' ||\n      getComputedStyle(this.doc.documentElement).direction === 'rtl';\n\n    this.resizingEntity.set(entity);\n    this.resizePreviewSize.set(previousSize);\n\n    // Run mouse listeners outside Angular zone for performance\n    this.zone.runOutsideAngular(() => {\n      this._onMouseMove = (e: MouseEvent) => {\n        // In RTL the logical end is the left edge; dragging left widens the cell\n        const rawWidth = isRtl\n          ? cellRect.right - e.clientX\n          : e.clientX - cellRect.left;\n        // Snap to nearest full column (min 1, max 12)\n        let cols = Math.round(rawWidth / columnWidth);\n        cols = Math.max(1, Math.min(24, cols)) as EntitySize;\n        const current = this.resizePreviewSize();\n        if (current !== cols) {\n          this.zone.run(() => this.resizePreviewSize.set(cols as EntitySize));\n        }\n      };\n\n      this._onMouseUp = () => {\n        this._cleanupListeners();\n\n        const newSize = this.resizePreviewSize() as EntitySize;\n        this.resizingEntity.set(null);\n        this.resizePreviewSize.set(null);\n\n        if (newSize !== previousSize) {\n          this.zone.run(() => {\n            this.onResizeComplete(entity, previousSize, newSize);\n          });\n        }\n      };\n\n      this.doc.addEventListener('mousemove', this._onMouseMove);\n      this.doc.addEventListener('mouseup', this._onMouseUp, { once: true });\n    });\n  }\n\n  /**\n   * Called when a resize operation completes with a changed size.\n   * Subclasses should update the entity list and emit events here.\n   */\n  protected abstract onResizeComplete(\n    entity: EntityData,\n    previousSize: EntitySize,\n    newSize: EntitySize,\n  ): void;\n\n  /** Removes global mouse listeners */\n  private _cleanupListeners(): void {\n    if (this._onMouseMove) {\n      this.doc.removeEventListener('mousemove', this._onMouseMove);\n      this._onMouseMove = null;\n    }\n    if (this._onMouseUp) {\n      this.doc.removeEventListener('mouseup', this._onMouseUp);\n      this._onMouseUp = null;\n    }\n  }\n}\n","import { Component, computed, model, output } from '@angular/core';\r\nimport {\r\n  CdkDrag,\r\n  CdkDragDrop,\r\n  CdkDragPlaceholder,\r\n  CdkDropList,\r\n} from '@angular/cdk/drag-drop';\r\nimport { Icon } from '@masterteam/icons';\r\nimport { EntityData, EntitySize } from '../entity.model';\r\nimport {\r\n  buildDisplayEntities,\r\n  isLeafSyntheticKey,\r\n} from '../leaf-details-display.utils';\r\nimport { isConnectionSyntheticKey } from '../connection-display.utils';\r\nimport { isEntitySection } from '../entity-sections.util';\r\nimport { isEntityHeader } from '../entity-header.util';\r\nimport { resolveEntityGridRow } from '../entity-display.utils';\r\nimport { EntityHeader } from '../entity-header/entity-header';\r\nimport { EntityPreview } from '../entity-preview/entity-preview';\r\nimport { EntitiesResizeBase } from './entities-resize-base';\r\n\r\n@Component({\r\n  selector: 'mt-entities-manage',\r\n  standalone: true,\r\n  imports: [\r\n    EntityPreview,\r\n    EntityHeader,\r\n    Icon,\r\n    CdkDrag,\r\n    CdkDropList,\r\n    CdkDragPlaceholder,\r\n  ],\r\n  templateUrl: './entities-manage.html',\r\n  styleUrl: './entities-manage.scss',\r\n})\r\nexport class EntitiesManage extends EntitiesResizeBase {\r\n  /** Array of entity data – supports two-way binding to keep order in sync */\r\n  readonly entities = model.required<EntityData[]>();\r\n\r\n  /** Emits the reordered entities array after each drag-drop */\r\n  readonly entitiesReordered = output<EntityData[]>();\r\n\r\n  /** Emits when an entity cell is clicked (for opening edit drawer) */\r\n  readonly entityClicked = output<EntityData>();\r\n\r\n  /**\r\n   * Emits when an item dragged from a *different* connected list (e.g. a sidebar\r\n   * \"add section\" tool) is dropped onto this grid. `index` is the target slot;\r\n   * `data` is the dropped `cdkDragData`. The host decides what to insert.\r\n   */\r\n  readonly externalItemDropped = output<{ index: number; data: unknown }>();\r\n\r\n  /** Entities expanded and sorted by their configured order */\r\n  readonly displayEntities = computed(() =>\r\n    buildDisplayEntities(this.entities()),\r\n  );\r\n\r\n  /**\r\n   * The card header, or `null`. `buildDisplayEntities` pins it first, which is\r\n   * also where it renders — so it stays in the drop list's data and every drag\r\n   * index the host receives still lines up with the host's own entity list.\r\n   */\r\n  readonly header = computed(() => {\r\n    const [first] = this.displayEntities();\r\n    return isEntityHeader(first) ? first : null;\r\n  });\r\n\r\n  /**\r\n   * Keeps every drop below the header. The header is drawn above the card\r\n   * whatever its order, so an item dropped in front of it would land somewhere\r\n   * other than where the user let go of it.\r\n   */\r\n  readonly sortPredicate = (index: number): boolean =>\r\n    index >= (this.header() ? 1 : 0);\r\n\r\n  /** Returns the grid-column span for a given entity size (1-24) */\r\n  getColSpan(entity: EntityData): string {\r\n    if (isEntitySection(entity) || this.isHeader(entity)) return 'span 24';\r\n    return this.getResizeColSpan(entity);\r\n  }\r\n\r\n  /** Returns the grid-row span (`null` = single row) for a given entity */\r\n  getRowSpan(entity: EntityData): string | null {\r\n    const { configuration } = entity;\r\n    return isEntitySection(entity) || this.isHeader(entity)\r\n      ? null\r\n      : resolveEntityGridRow(configuration);\r\n  }\r\n\r\n  /** True when the entity is a full-width `Section` layout marker. */\r\n  isSection(entity: EntityData): boolean {\r\n    return isEntitySection(entity);\r\n  }\r\n\r\n  /** True when the entity is the pinned card header. */\r\n  isHeader(entity: EntityData): boolean {\r\n    return entity === this.header();\r\n  }\r\n\r\n  /** Handle drag-drop reorder */\r\n  onDrop(event: CdkDragDrop<EntityData[]>): void {\r\n    // Item dragged in from another connected list — let the host handle it.\r\n    if (event.previousContainer !== event.container) {\r\n      this.externalItemDropped.emit({\r\n        index: event.currentIndex,\r\n        data: event.item.data,\r\n      });\r\n      return;\r\n    }\r\n\r\n    if (event.previousIndex === event.currentIndex) return;\r\n\r\n    const items = [...this.displayEntities()];\r\n    const [moved] = items.splice(event.previousIndex, 1);\r\n    items.splice(event.currentIndex, 0, moved);\r\n\r\n    // Reassign order based on new positions\r\n    const reordered = items.map((item, index) => ({\r\n      ...item,\r\n      order: index + 1,\r\n    }));\r\n\r\n    // Update the model (two-way binding)\r\n    this.entities.set(reordered);\r\n\r\n    // Emit the reordered list\r\n    this.entitiesReordered.emit(reordered);\r\n  }\r\n\r\n  // ── Resize completion (from EntitiesResizeBase) ──\r\n\r\n  protected override onResizeComplete(\r\n    entity: EntityData,\r\n    previousSize: EntitySize,\r\n    newSize: EntitySize,\r\n  ): void {\r\n    const currentEntities = this.entities();\r\n    const sourceEntities = currentEntities.some((e) => e === entity)\r\n      ? currentEntities\r\n      : this.displayEntities();\r\n    // Expanded items (LeafDetails levels / Connection source levels) are rebuilt\r\n    // on every render, so identity no longer matches — fall back to the key.\r\n    const isExpandedItem =\r\n      isLeafSyntheticKey(entity.key) || isConnectionSyntheticKey(entity.key);\r\n    const updated = sourceEntities.map((e) =>\r\n      e === entity || (isExpandedItem && e.key === entity.key)\r\n        ? {\r\n            ...e,\r\n            configuration: {\r\n              ...e.configuration,\r\n              size: newSize,\r\n            },\r\n          }\r\n        : e,\r\n    );\r\n    this.entities.set(updated);\r\n\r\n    this.entityResized.emit({\r\n      entity: {\r\n        ...entity,\r\n        configuration: { ...entity.configuration, size: newSize },\r\n      },\r\n      previousSize,\r\n      newSize,\r\n    });\r\n  }\r\n}\r\n","<div\r\n  cdkDropList\r\n  cdkDropListOrientation=\"mixed\"\r\n  [cdkDropListData]=\"displayEntities()\"\r\n  [cdkDropListSortPredicate]=\"sortPredicate\"\r\n  (cdkDropListDropped)=\"onDrop($event)\"\r\n  class=\"grid grid-cols-24 gap-x-4 gap-y-6\"\r\n>\r\n  @for (\r\n    entity of displayEntities();\r\n    track entity.key ?? entity.order ?? $index\r\n  ) {\r\n    @if (isHeader(entity)) {\r\n      <!--\r\n        Card header: pinned above everything, so it is neither draggable nor\r\n        resizable. It stays a drag item (disabled) only so the drop list's\r\n        indexes keep matching `displayEntities()`.\r\n      -->\r\n      <div\r\n        cdkDrag\r\n        [cdkDragData]=\"entity\"\r\n        [cdkDragDisabled]=\"true\"\r\n        class=\"entity-cell header-row min-w-0 cursor-pointer transition-opacity hover:opacity-85\"\r\n        [style.grid-column]=\"getColSpan(entity)\"\r\n        (click)=\"entityClicked.emit(entity)\"\r\n      >\r\n        <mt-entity-header [data]=\"entity\" />\r\n      </div>\r\n    } @else if (isSection(entity)) {\r\n      <!-- Section marker: full-width, non-resizable header row -->\r\n      <div\r\n        cdkDrag\r\n        [cdkDragData]=\"entity\"\r\n        class=\"entity-cell section-row group relative min-w-0 flex items-center gap-2 px-4 py-2.5 cursor-grab active:cursor-grabbing rounded-md border border-surface-200 bg-surface-50 transition-colors hover:bg-emphasis\"\r\n        [class.resizing]=\"resizingEntity() === entity\"\r\n        [style.grid-column]=\"getColSpan(entity)\"\r\n        (click)=\"entityClicked.emit(entity)\"\r\n      >\r\n        <div\r\n          *cdkDragPlaceholder\r\n          class=\"h-full min-h-11 bg-black/10 rounded-md\"\r\n          [style.grid-column]=\"getColSpan(entity)\"\r\n        ></div>\r\n\r\n        <span\r\n          class=\"flex-1 min-w-0 truncate text-base font-semibold\"\r\n          dir=\"auto\"\r\n        >\r\n          {{ entity.name }}\r\n        </span>\r\n        <mt-icon\r\n          icon=\"editor.pencil-01\"\r\n          class=\"shrink-0 opacity-0 transition-opacity group-hover:opacity-60\"\r\n        />\r\n      </div>\r\n    } @else {\r\n      <div\r\n        cdkDrag\r\n        [cdkDragData]=\"entity\"\r\n        class=\"entity-cell group relative min-w-0 flex items-center p-3 cursor-grab active:cursor-grabbing rounded-lg transition-colors bg-surface-100/60\"\r\n        [class.border]=\"entity.configuration?.showBorder\"\r\n        [class.border-dashed]=\"entity.configuration?.showBorder\"\r\n        [class.border-gray-300]=\"entity.configuration?.showBorder\"\r\n        [class.resizing]=\"resizingEntity() === entity\"\r\n        [style.grid-column]=\"getColSpan(entity)\"\r\n        [style.grid-row]=\"getRowSpan(entity)\"\r\n      >\r\n        <!-- Drag placeholder -->\r\n        <div\r\n          *cdkDragPlaceholder\r\n          class=\"h-full min-h-12 bg-black/10 rounded-xl\"\r\n          [style.grid-column]=\"getColSpan(entity)\"\r\n          [style.grid-row]=\"getRowSpan(entity)\"\r\n        ></div>\r\n\r\n        <mt-entity-preview\r\n          [data]=\"entity\"\r\n          class=\"flex-1 min-w-0 cursor-pointer\"\r\n          (click)=\"entityClicked.emit(entity)\"\r\n        />\r\n\r\n        <!-- Resize handle (right edge) -->\r\n        <div\r\n          class=\"resize-handle\"\r\n          (mousedown)=\"onResizeStart($event, entity)\"\r\n          (click)=\"$event.stopPropagation()\"\r\n        >\r\n          <div class=\"resize-handle-bar\"></div>\r\n        </div>\r\n      </div>\r\n    }\r\n  }\r\n</div>\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["NUMERIC_VIEW_TYPES","ISO_DATE","humanizeKey","i1"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA8HO,MAAM,gBAAgB,GAA6B,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AAopBrE;AACM,SAAU,yBAAyB,CACvC,KAAc,EAAA;IAEd,QACE,CAAC,CAAC,KAAK;QACP,OAAO,KAAK,KAAK,QAAQ;AACzB,QAAA,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;AACpB,QAAA,KAAmC,CAAC,WAAW,KAAK,OAAO;AAEhE;AA6CA;AACM,SAAU,6BAA6B,CAC3C,KAAc,EAAA;IAEd,QACE,CAAC,CAAC,KAAK;QACP,OAAO,KAAK,KAAK,QAAQ;AACzB,QAAA,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;AACpB,QAAA,KAAkC,CAAC,UAAU,KAAK,UAAU;AAEjE;;AC70BA;;;;;;AAMG;AACI,MAAM,kBAAkB,GAAG;AAElC;AACM,SAAU,YAAY,CAAC,GAAmB,EAAA;IAC9C,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,UAAU,CAAC,kBAAkB,CAAC;AACtE;AAEA;SACgB,eAAe,GAAA;IA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