@nivaro/react 0.3.91 → 0.3.93

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,12 +3,12 @@ import { useQueryClient as fg, useQuery as $t, useQueries as ui, useMutation as
3
3
  import { Loader2 as Ir, ArrowLeft as mg, Check as pr, Copy as ks, Wand2 as pg, BookOpen as hg, Lock as Cf, PencilLine as gg, Clipboard as yg, Waypoints as _g, PictureInPicture2 as bg, FileDown as Rf, MessageSquarePlus as vg, Wrench as wg, Eye as kg, MoveRight as xg, Trash2 as Sg, LifeBuoy as Ng, Save as Of, ChevronDown as fi, AlertTriangle as $g, ChevronLeft as Ff, ChevronRight as jf, AlertCircle as pm, X as Cg } from "lucide-react";
4
4
  import { useContext as Rg, useState as P, useEffect as z, useMemo as A, useCallback as ce, useRef as $, useId as Og, Fragment as Nl } from "react";
5
5
  import { createPortal as Fg } from "react-dom";
6
- import { toast as _e } from "sonner";
6
+ import { toast as ge } from "sonner";
7
7
  import { useNivaroClient as jg, useApiFetchConfig as Ag, ItemEditAuthContext as qg, useItemNavigation as Tg, useRecordSurface as Af, useNavigation as Ig, ReimportHandlerContext as Eg, RelationPathDataContext as Pg, ParentDraftContext as Lg, GridFlushContext as Mg, StaleFieldReportContext as Kg } from "../context.js";
8
8
  import { useSlowReason as Dg } from "../hooks/useSlowReason.js";
9
9
  import { formatApiPayload as Bg } from "../lib/api-payload.js";
10
10
  import { get as se, post as ln, del as mr, patch as mi, put as zg } from "../lib/commands.js";
11
- import { prefillSignature as Wg, loadDraft as Qg, draftHasContent as $l, draftMatchesPrefill as Vg, deleteDraft as vs, draftCreatedAs as Hg, draftFilledBack as Ug, markDraftCreated as Jg, draftKey as Gg, keepDraftSavedAt as Yg, lineBasesForDraft as Zg, saveDraft as Xg, draftPersistDecision as ey } from "../lib/draft-store.js";
11
+ import { prefillSignature as Wg, loadDraft as Qg, draftHasContent as $l, draftMatchesPrefill as Vg, deleteDraft as vs, draftCreatedAs as Hg, draftFilledBack as Ug, markDraftCreated as Gg, draftKey as Jg, keepDraftSavedAt as Yg, lineBasesForDraft as Zg, saveDraft as Xg, draftPersistDecision as ey } from "../lib/draft-store.js";
12
12
  import { editLockLockedFields as ty } from "../lib/edit-lock-fields.js";
13
13
  import { entryConfigOf as ny } from "../lib/entry-config.js";
14
14
  import { describeError as ry, copyErrorDetails as sy } from "../lib/error-message.js";
@@ -34,134 +34,135 @@ import { reimportAllowed as Qy } from "../lib/reimport-visibility.js";
34
34
  import { userErrorMessage as Fl, reportCodeError as Vy } from "../lib/safe-error.js";
35
35
  import { formSkeletonFromLayout as Hy } from "../lib/skeleton-shapes.js";
36
36
  import { stagedRowLabel as pi } from "../lib/staged-row-labels.js";
37
- import { normalizeSummaryModeRules as Pf, summaryRulesNeedRole as Uy, summaryRulesNeedState as Jy, summaryRulesNeedRecord as Gy, summaryResolveSignature as Yy, sameSummaryRecord as Zy, holdSummaryReresolve as Xy, resolveSummaryMode as e_ } from "../lib/summary-mode.js";
38
- import { requestMoveState as t_ } from "../lib/move-state.js";
39
- import { useUnsavedWork as n_, isReloadingForUpdate as r_ } from "../lib/unsaved-work.js";
40
- import { titleCase as be, choiceLabel as Ql, cn as De, formatDateTime as xi, formatDate as s_, toLocalDateString as gm } from "../lib/utils.js";
37
+ import { normalizeSummaryModeRules as Pf, summaryRulesNeedRole as Uy, summaryRulesNeedState as Gy, summaryRulesNeedRecord as Jy, summaryResolveSignature as Yy, sameSummaryRecord as Zy, holdSummaryReresolve as Xy, resolveSummaryMode as e_ } from "../lib/summary-mode.js";
38
+ import { formReadyToSave as t_, FORM_NOT_READY_MESSAGE as n_ } from "../lib/form-ready.js";
39
+ import { requestMoveState as r_ } from "../lib/move-state.js";
40
+ import { useUnsavedWork as s_, isReloadingForUpdate as i_ } from "../lib/unsaved-work.js";
41
+ import { titleCase as be, choiceLabel as Ql, cn as De, formatDateTime as xi, formatDate as o_, toLocalDateString as gm } from "../lib/utils.js";
41
42
  import { applyValidationRule as ym } from "../lib/validation-rules.js";
42
- import { matchesVisibleWhen as i_ } from "../lib/visible-when.js";
43
- import { FieldSourcesContext as o_ } from "./ConfigReadBack.js";
44
- import { CopyAsButton as a_ } from "./CopyAsButton.js";
45
- import { useHuddleFollowSurface as l_ } from "./chat/huddle/huddle-follow-bus.js";
46
- import { FormWhatsNew as d_ } from "./FormWhatsNew.js";
47
- import { showFormVideosButton as c_ } from "./help-videos/viewer/format.js";
48
- import { HelpVideoButton as u_ } from "./help-videos/viewer/HelpVideoButton.js";
49
- import { DocumentAutofillButton as f_ } from "./import/DocumentAutofillButton.js";
50
- import { evaluateImportLineRules as jl, RULE_SET_KEY as m_ } from "./import/evaluateLineRules.js";
51
- import { ImportColumnChips as p_ } from "./import/ImportColumnChips.js";
43
+ import { matchesVisibleWhen as a_ } from "../lib/visible-when.js";
44
+ import { FieldSourcesContext as l_ } from "./ConfigReadBack.js";
45
+ import { CopyAsButton as d_ } from "./CopyAsButton.js";
46
+ import { useHuddleFollowSurface as c_ } from "./chat/huddle/huddle-follow-bus.js";
47
+ import { FormWhatsNew as u_ } from "./FormWhatsNew.js";
48
+ import { showFormVideosButton as f_ } from "./help-videos/viewer/format.js";
49
+ import { HelpVideoButton as m_ } from "./help-videos/viewer/HelpVideoButton.js";
50
+ import { DocumentAutofillButton as p_ } from "./import/DocumentAutofillButton.js";
51
+ import { evaluateImportLineRules as jl, RULE_SET_KEY as h_ } from "./import/evaluateLineRules.js";
52
+ import { ImportColumnChips as g_ } from "./import/ImportColumnChips.js";
52
53
  import { ImportFromFileButton as Lf } from "./import/ImportFromFileButton.js";
53
54
  import { ImportIssuesPanel as Mf } from "./import/ImportIssuesPanel.js";
54
- import { diffReimportLines as h_, reimportRestoredDeletes as g_, reimportPendingNotice as y_, reimportMatchKey as Kf } from "./import/reimportDiff.js";
55
- import { AddendumO2MContext as __, AddendumViewContext as b_, AddendumFieldContext as v_ } from "./item-edit/AddendumFieldContext.js";
56
- import { useAutoIdPreview as w_ } from "./item-edit/AutoIdPreviewField.js";
57
- import { changeReasonChallenge as Al, ChangeReasonDialog as k_ } from "./item-edit/ChangeReasonDialog.js";
58
- import { ChangesTray as x_ } from "./item-edit/ChangesTray.js";
59
- import { CloneDialog as S_ } from "./item-edit/CloneDialog.js";
60
- import { settleTouchedAfterSave as N_, useCascadeClearNotices as $_, CascadeClearNoticeContext as C_, notePersonLinkEdit as R_ } from "./item-edit/cascade-clear-notice.js";
61
- import { columnLengthError as O_ } from "./item-edit/column-length.js";
62
- import { configUpdateReaction as F_ } from "./item-edit/config-update.js";
63
- import { DraftRecoveryBanner as j_ } from "./item-edit/DraftRecoveryBanner.js";
64
- import { copiedLineLabel as A_, rehearsalBody as q_, copiedValueChanges as T_ } from "./item-edit/duplicate-rehearsal.js";
65
- import { ExtLayoutSlot as I_ } from "./item-edit/ExtLayoutSlot.js";
66
- import { FieldAffordancesContext as E_ } from "./item-edit/FieldAffordances.js";
67
- import { useFieldCommentsApi as P_ } from "./item-edit/FieldComments.js";
55
+ import { diffReimportLines as y_, reimportRestoredDeletes as __, reimportPendingNotice as b_, reimportMatchKey as Kf } from "./import/reimportDiff.js";
56
+ import { AddendumO2MContext as v_, AddendumViewContext as w_, AddendumFieldContext as k_ } from "./item-edit/AddendumFieldContext.js";
57
+ import { useAutoIdPreview as x_ } from "./item-edit/AutoIdPreviewField.js";
58
+ import { changeReasonChallenge as Al, ChangeReasonDialog as S_ } from "./item-edit/ChangeReasonDialog.js";
59
+ import { ChangesTray as N_ } from "./item-edit/ChangesTray.js";
60
+ import { CloneDialog as $_ } from "./item-edit/CloneDialog.js";
61
+ import { settleTouchedAfterSave as C_, useCascadeClearNotices as R_, CascadeClearNoticeContext as O_, notePersonLinkEdit as F_ } from "./item-edit/cascade-clear-notice.js";
62
+ import { columnLengthError as j_ } from "./item-edit/column-length.js";
63
+ import { configUpdateReaction as A_ } from "./item-edit/config-update.js";
64
+ import { DraftRecoveryBanner as q_ } from "./item-edit/DraftRecoveryBanner.js";
65
+ import { copiedLineLabel as T_, rehearsalBody as I_, copiedValueChanges as E_ } from "./item-edit/duplicate-rehearsal.js";
66
+ import { ExtLayoutSlot as P_ } from "./item-edit/ExtLayoutSlot.js";
67
+ import { FieldAffordancesContext as L_ } from "./item-edit/FieldAffordances.js";
68
+ import { useFieldCommentsApi as M_ } from "./item-edit/FieldComments.js";
68
69
  import { FieldRow as ws } from "./item-edit/FieldRow.js";
69
- import { buildTourSteps as L_, useFormTourSeen as M_, sectionKeysOnScreen as K_, FormTourButton as D_, FormTour as B_ } from "./item-edit/FormTour.js";
70
- import { FieldCommentsContext as z_ } from "./item-edit/field-comments-context.js";
71
- import { fieldSourcesFor as W_ } from "./item-edit/field-sources.js";
72
- import { formDensityOf as Q_, useFormDensityCss as V_ } from "./item-edit/form-density.js";
73
- import { FoldArea as H_, RowGroupCell as U_, rowMemberField as J_ } from "./item-edit/form-structure-ui.js";
74
- import { StripFieldValue as G_, GroupSection as Y_, InlineDisplay as ql } from "./item-edit/GroupSection.js";
75
- import { useHeaderBand as Z_, HeaderTiles as X_ } from "./item-edit/HeaderBand.js";
76
- import { HeaderFreshness as e0 } from "./item-edit/HeaderFreshness.js";
77
- import { HeaderRollupExplainer as t0 } from "./item-edit/HeaderRollupExplainer.js";
78
- import { HeaderSummaryChip as n0 } from "./item-edit/HeaderSummaryChip.js";
79
- import { HeaderTools as r0, HeaderToolGroup as s0, HeaderMenu as i0 } from "./item-edit/HeaderTools.js";
80
- import { HighlightedCode as o0 } from "./item-edit/HighlightedCode.js";
81
- import { staleDraftConflicts as a0, restoredDraftCollisions as l0, clientMidairError as d0, conflictsNeedingPerson as Df, saveIsEcho as c0, resolveHeaderCollision as u0 } from "./item-edit/header-midair.js";
82
- import { useHeaderPathPreview as f0 } from "./item-edit/header-path-preview.js";
83
- import { parseJson as Un, getCascadeFilters as Bf, SYSTEM_FIELDS as tn, isSentinelKey as Tr, applyDisplayTemplate as Tl, useContainerWidth as m0, resolveColSpan as Il } from "./item-edit/helpers.js";
84
- import { evalClientFormula as p0 } from "./item-edit/InlineTableField.js";
85
- import { LayoutContentBlock as h0, SectionIntro as g0 } from "./item-edit/LayoutContentBlock.js";
86
- import { deferredSections as y0 } from "./item-edit/lazy-sections.js";
87
- import { restoredLineConflicts as _0, mergeEditOf as El } from "./item-edit/line-merge.js";
88
- import { rowBaseBookFor as Pl, fetchLatestRevisions as Mo, noteLineReads as b0, lineLabelOf as Ko, withRowBaseRevision as zf, lineConflictKey as v0, resolveLineCollision as w0 } from "./item-edit/line-midair.js";
89
- import { ruleValueFor as _m, NUMBER_FIELD_TYPES as k0, checkNumberEntry as x0 } from "./item-edit/line-qty.js";
90
- import { liveRecordWrite as S0 } from "./item-edit/live-record-marks.js";
91
- import { parseRollupSources as Wf, parseRollupParentFilter as N0, matchesRollupFilter as $0, computeLiveRollup as C0, isDerivedForRecord as Ll } from "./item-edit/live-rollups.js";
92
- import { useLockWhy as R0, refineLockReasons as O0, HiddenByRulesNote as F0 } from "./item-edit/lock-why.js";
93
- import { m2aWriteMeta as j0, resolveM2MRelatedCollection as bm } from "./item-edit/M2MCombobox.js";
94
- import { M2MStagingContext as A0 } from "./item-edit/M2MStagingContext.js";
95
- import { useM2MStaging as mS } from "./item-edit/M2MStagingContext.js";
96
- import { MidairCollisionDialog as q0, LineCollisionDialog as T0 } from "./item-edit/MidairCollisionDialog.js";
97
- import { invalidateM2MFor as Qf, editedRowIds as I0 } from "./item-edit/m2m-invalidate.js";
98
- import { newFieldError as E0, unsavedBeforeMove as P0, moveBlockedAfterSave as L0 } from "./item-edit/move-guard.js";
99
- import { O2MStagingContext as M0, LiveRowsContext as K0, StagedRelationsContext as D0 } from "./item-edit/O2MStagingContext.js";
100
- import { makePersonalDefaultChecks as B0 } from "./item-edit/personal-default-checks.js";
101
- import { placementBehaviourNeeds as z0, usePlacementTextContext as W0, fieldIsRecommended as Q0, placementFieldText as Ml, fieldCounterError as V0, confirmChangeFields as H0, missingRecommended as U0, isDisplayFormulaRow as J0 } from "./item-edit/placement-behaviour.js";
102
- import { QueueReturnChip as G0 } from "./item-edit/QueueReturnChip.js";
103
- import { endQuickCreateFollows as Y0 } from "./item-edit/QuickCreateButton.js";
104
- import { QuickPicker as Z0 } from "./item-edit/QuickPicker.js";
105
- import { RawEditSheet as X0 } from "./item-edit/RawEditSheet.js";
106
- import { RecordChatActions as eb } from "./item-edit/RecordChatActions.js";
107
- import { PickerExclusionToggle as tb, ScheduleChangeButton as nb } from "./item-edit/RecordGrantTools.js";
108
- import { useRecordHeaderActions as rb, RecordHeaderActionButtons as sb, RecordHeaderActionDialog as ib } from "./item-edit/RecordHeaderActions.js";
109
- import { invalidateRecordInsights as ob, invalidateRecordNotes as ab, RecordInsightsButton as lb } from "./item-edit/RecordInsights.js";
110
- import { RecordAccessLostPanel as db, RecordLiveSync as cb } from "./item-edit/RecordLiveSync.js";
111
- import { useRecordOutboxEntry as ub, RecordOutboxBanner as fb } from "./item-edit/RecordOutbox.js";
112
- import { RecordRecapStrip as mb } from "./item-edit/RecordRecapStrip.js";
113
- import { RecordSubscribeButton as pb } from "./item-edit/RecordSubscribeButton.js";
114
- import { RuleHiddenNotes as hb } from "./item-edit/RuleHiddenNotes.js";
115
- import { isNarrowRecordWidth as gb } from "./item-edit/rail-width.js";
116
- import { rememberRecordLookups as yb, recordLookupsFor as Vf } from "./item-edit/record-lookups.js";
117
- import { useStableFieldAffordances as _b } from "./item-edit/render-stability.js";
118
- import { ruleHiddenGroups as bb, groupHasReadableField as vb } from "./item-edit/rule-hidden.js";
119
- import { saveLeftWorkStaged as wb, saveClosingMessage as kb, SAVE_OUTCOME_TOAST_ID as xb } from "./item-edit/save-outcome.js";
120
- import { refusedFieldOf as Sb } from "./item-edit/save-refusal.js";
121
- import { foldStagedLinks as Hf, foldStagedRows as Nb } from "./item-edit/staged-links.js";
122
- import { staleBannerMode as $b, touchedEditsDiffer as Cb } from "./item-edit/stale-banner.js";
123
- import { useFormUsageBeacon as Rb } from "./item-edit/useFormUsageBeacon.js";
124
- import { linksBeyond as Uf, usePersonalDefaults as Ob, sameDefaultValue as Fb, PersonalDefaultsContext as jb } from "./item-edit/usePersonalDefaults.js";
125
- import { ValidationSummary as Ab } from "./item-edit/ValidationSummary.js";
126
- import { useViewAsRole as qb, ViewAsRoleBar as Tb } from "./item-edit/ViewAsRole.js";
127
- import { choiceLabelsFrom as Ib } from "./layout-editor/overview/describe-conditions.js";
128
- import { LegalHoldBanner as Eb } from "./panels/LegalHoldBanner.js";
129
- import { useRecordIntegrity as Pb, RecordIntegrityBanner as Lb } from "./panels/RecordIntegrityBanner.js";
130
- import { SlaBreachBanner as Mb } from "./panels/SlaBreachBanner.js";
131
- import { RecordGraphSheet as Kb } from "./RecordGraph.js";
132
- import { RecordReadView as Db } from "./RecordReadView.js";
133
- import { SuggestFormChange as Bb } from "./support/SuggestFormChange.js";
134
- import { SupportRequestDialog as zb } from "./support/SupportRequestDialog.js";
135
- import { EntryStrip as Wb } from "./item-edit/entry/EntryStrip.js";
136
- import { useEntryKeyboard as Qb } from "./item-edit/entry/useEntryKeyboard.js";
137
- import { useEntryMode as Vb } from "./item-edit/entry/useEntryMode.js";
138
- import { FindInRecordButton as Jf } from "./item-edit/FindInRecord.js";
139
- import { RecordViewersChip as Hb } from "./item-edit/RecordViewersChip.js";
140
- import { StepsBar as Gf } from "./item-edit/StepsBar.js";
141
- import { SummaryPanel as Ub, M2OSummaryValue as vm } from "./item-edit/SummaryPanel.js";
142
- import { designWrap as Jb, DesignDropBody as Yf, DesignDropZone as Zf } from "./layout-editor/DesignNode.js";
143
- import { DesignCanvas as Gb } from "./layout-editor/design-canvas.js";
144
- import { revealGroupKey as Yb, useLayoutDesign as Zb } from "./layout-editor/design-context.js";
145
- import { GridGuides as Xb } from "./layout-editor/grid-guides.js";
146
- import { readDesignSummaryCollapsed as Xf, DESIGN_SUMMARY_MIN_CANVAS as ev, writeDesignSummaryCollapsed as tv } from "./layout-editor/summary-pref.js";
147
- import { RecordEventPathSheet as nv } from "./panels/IntegrationActivitySection.js";
148
- import { MoveToStatePanel as rv } from "./panels/MoveToStatePanel.js";
149
- import { FormSkeleton as sv } from "./Skeletons.js";
70
+ import { buildTourSteps as K_, useFormTourSeen as D_, sectionKeysOnScreen as B_, FormTourButton as z_, FormTour as W_ } from "./item-edit/FormTour.js";
71
+ import { FieldCommentsContext as Q_ } from "./item-edit/field-comments-context.js";
72
+ import { fieldSourcesFor as V_ } from "./item-edit/field-sources.js";
73
+ import { formDensityOf as H_, useFormDensityCss as U_ } from "./item-edit/form-density.js";
74
+ import { FoldArea as G_, RowGroupCell as J_, rowMemberField as Y_ } from "./item-edit/form-structure-ui.js";
75
+ import { StripFieldValue as Z_, GroupSection as X_, InlineDisplay as ql } from "./item-edit/GroupSection.js";
76
+ import { useHeaderBand as e0, HeaderTiles as t0 } from "./item-edit/HeaderBand.js";
77
+ import { HeaderFreshness as n0 } from "./item-edit/HeaderFreshness.js";
78
+ import { HeaderRollupExplainer as r0 } from "./item-edit/HeaderRollupExplainer.js";
79
+ import { HeaderSummaryChip as s0 } from "./item-edit/HeaderSummaryChip.js";
80
+ import { HeaderTools as i0, HeaderToolGroup as o0, HeaderMenu as a0 } from "./item-edit/HeaderTools.js";
81
+ import { HighlightedCode as l0 } from "./item-edit/HighlightedCode.js";
82
+ import { staleDraftConflicts as d0, restoredDraftCollisions as c0, clientMidairError as u0, conflictsNeedingPerson as Df, saveIsEcho as f0, resolveHeaderCollision as m0 } from "./item-edit/header-midair.js";
83
+ import { useHeaderPathPreview as p0 } from "./item-edit/header-path-preview.js";
84
+ import { parseJson as Un, getCascadeFilters as Bf, SYSTEM_FIELDS as tn, isSentinelKey as Tr, applyDisplayTemplate as Tl, useContainerWidth as h0, resolveColSpan as Il } from "./item-edit/helpers.js";
85
+ import { evalClientFormula as g0 } from "./item-edit/InlineTableField.js";
86
+ import { LayoutContentBlock as y0, SectionIntro as _0 } from "./item-edit/LayoutContentBlock.js";
87
+ import { deferredSections as b0 } from "./item-edit/lazy-sections.js";
88
+ import { restoredLineConflicts as v0, mergeEditOf as El } from "./item-edit/line-merge.js";
89
+ import { rowBaseBookFor as Pl, fetchLatestRevisions as Mo, noteLineReads as w0, lineLabelOf as Ko, withRowBaseRevision as zf, lineConflictKey as k0, resolveLineCollision as x0 } from "./item-edit/line-midair.js";
90
+ import { ruleValueFor as _m, NUMBER_FIELD_TYPES as S0, checkNumberEntry as N0 } from "./item-edit/line-qty.js";
91
+ import { liveRecordWrite as $0 } from "./item-edit/live-record-marks.js";
92
+ import { parseRollupSources as Wf, parseRollupParentFilter as C0, matchesRollupFilter as R0, computeLiveRollup as O0, isDerivedForRecord as Ll } from "./item-edit/live-rollups.js";
93
+ import { useLockWhy as F0, refineLockReasons as j0, HiddenByRulesNote as A0 } from "./item-edit/lock-why.js";
94
+ import { m2aWriteMeta as q0, resolveM2MRelatedCollection as bm } from "./item-edit/M2MCombobox.js";
95
+ import { M2MStagingContext as T0 } from "./item-edit/M2MStagingContext.js";
96
+ import { useM2MStaging as gS } from "./item-edit/M2MStagingContext.js";
97
+ import { MidairCollisionDialog as I0, LineCollisionDialog as E0 } from "./item-edit/MidairCollisionDialog.js";
98
+ import { invalidateM2MFor as Qf, editedRowIds as P0 } from "./item-edit/m2m-invalidate.js";
99
+ import { newFieldError as L0, unsavedBeforeMove as M0, moveBlockedAfterSave as K0 } from "./item-edit/move-guard.js";
100
+ import { O2MStagingContext as D0, LiveRowsContext as B0, StagedRelationsContext as z0 } from "./item-edit/O2MStagingContext.js";
101
+ import { makePersonalDefaultChecks as W0 } from "./item-edit/personal-default-checks.js";
102
+ import { placementBehaviourNeeds as Q0, usePlacementTextContext as V0, fieldIsRecommended as H0, placementFieldText as Ml, fieldCounterError as U0, confirmChangeFields as G0, missingRecommended as J0, isDisplayFormulaRow as Y0 } from "./item-edit/placement-behaviour.js";
103
+ import { QueueReturnChip as Z0 } from "./item-edit/QueueReturnChip.js";
104
+ import { endQuickCreateFollows as X0 } from "./item-edit/QuickCreateButton.js";
105
+ import { QuickPicker as eb } from "./item-edit/QuickPicker.js";
106
+ import { RawEditSheet as tb } from "./item-edit/RawEditSheet.js";
107
+ import { RecordChatActions as nb } from "./item-edit/RecordChatActions.js";
108
+ import { PickerExclusionToggle as rb, ScheduleChangeButton as sb } from "./item-edit/RecordGrantTools.js";
109
+ import { useRecordHeaderActions as ib, RecordHeaderActionButtons as ob, RecordHeaderActionDialog as ab } from "./item-edit/RecordHeaderActions.js";
110
+ import { invalidateRecordInsights as lb, invalidateRecordNotes as db, RecordInsightsButton as cb } from "./item-edit/RecordInsights.js";
111
+ import { RecordAccessLostPanel as ub, RecordLiveSync as fb } from "./item-edit/RecordLiveSync.js";
112
+ import { useRecordOutboxEntry as mb, RecordOutboxBanner as pb } from "./item-edit/RecordOutbox.js";
113
+ import { RecordRecapStrip as hb } from "./item-edit/RecordRecapStrip.js";
114
+ import { RecordSubscribeButton as gb } from "./item-edit/RecordSubscribeButton.js";
115
+ import { RuleHiddenNotes as yb } from "./item-edit/RuleHiddenNotes.js";
116
+ import { isNarrowRecordWidth as _b } from "./item-edit/rail-width.js";
117
+ import { rememberRecordLookups as bb, recordLookupsFor as Vf } from "./item-edit/record-lookups.js";
118
+ import { useStableFieldAffordances as vb } from "./item-edit/render-stability.js";
119
+ import { ruleHiddenGroups as wb, groupHasReadableField as kb } from "./item-edit/rule-hidden.js";
120
+ import { saveLeftWorkStaged as xb, saveClosingMessage as Sb, SAVE_OUTCOME_TOAST_ID as Nb } from "./item-edit/save-outcome.js";
121
+ import { refusedFieldOf as $b } from "./item-edit/save-refusal.js";
122
+ import { foldStagedLinks as Hf, foldStagedRows as Cb } from "./item-edit/staged-links.js";
123
+ import { staleBannerMode as Rb, touchedEditsDiffer as Ob } from "./item-edit/stale-banner.js";
124
+ import { useFormUsageBeacon as Fb } from "./item-edit/useFormUsageBeacon.js";
125
+ import { linksBeyond as Uf, usePersonalDefaults as jb, sameDefaultValue as Ab, PersonalDefaultsContext as qb } from "./item-edit/usePersonalDefaults.js";
126
+ import { ValidationSummary as Tb } from "./item-edit/ValidationSummary.js";
127
+ import { useViewAsRole as Ib, ViewAsRoleBar as Eb } from "./item-edit/ViewAsRole.js";
128
+ import { choiceLabelsFrom as Pb } from "./layout-editor/overview/describe-conditions.js";
129
+ import { LegalHoldBanner as Lb } from "./panels/LegalHoldBanner.js";
130
+ import { useRecordIntegrity as Mb, RecordIntegrityBanner as Kb } from "./panels/RecordIntegrityBanner.js";
131
+ import { SlaBreachBanner as Db } from "./panels/SlaBreachBanner.js";
132
+ import { RecordGraphSheet as Bb } from "./RecordGraph.js";
133
+ import { RecordReadView as zb } from "./RecordReadView.js";
134
+ import { SuggestFormChange as Wb } from "./support/SuggestFormChange.js";
135
+ import { SupportRequestDialog as Qb } from "./support/SupportRequestDialog.js";
136
+ import { EntryStrip as Vb } from "./item-edit/entry/EntryStrip.js";
137
+ import { useEntryKeyboard as Hb } from "./item-edit/entry/useEntryKeyboard.js";
138
+ import { useEntryMode as Ub } from "./item-edit/entry/useEntryMode.js";
139
+ import { FindInRecordButton as Gf } from "./item-edit/FindInRecord.js";
140
+ import { RecordViewersChip as Gb } from "./item-edit/RecordViewersChip.js";
141
+ import { StepsBar as Jf } from "./item-edit/StepsBar.js";
142
+ import { SummaryPanel as Jb, M2OSummaryValue as vm } from "./item-edit/SummaryPanel.js";
143
+ import { designWrap as Yb, DesignDropBody as Yf, DesignDropZone as Zf } from "./layout-editor/DesignNode.js";
144
+ import { DesignCanvas as Zb } from "./layout-editor/design-canvas.js";
145
+ import { revealGroupKey as Xb, useLayoutDesign as ev } from "./layout-editor/design-context.js";
146
+ import { GridGuides as tv } from "./layout-editor/grid-guides.js";
147
+ import { readDesignSummaryCollapsed as Xf, DESIGN_SUMMARY_MIN_CANVAS as nv, writeDesignSummaryCollapsed as rv } from "./layout-editor/summary-pref.js";
148
+ import { RecordEventPathSheet as sv } from "./panels/IntegrationActivitySection.js";
149
+ import { MoveToStatePanel as iv } from "./panels/MoveToStatePanel.js";
150
+ import { FormSkeleton as ov } from "./Skeletons.js";
150
151
  import { SlowNoticeView as em } from "./SlowNotice.js";
151
- import { TipLayer as iv } from "./TipLayer.js";
152
+ import { TipLayer as av } from "./TipLayer.js";
152
153
  import { Button as en } from "./ui/button.js";
153
154
  import { Dialog as yi, DialogContent as _i, DialogHeader as bi, DialogTitle as vi, DialogBody as wi, DialogFooter as Vo } from "./ui/dialog.js";
154
155
  import { Popover as wm, PopoverTrigger as km, PopoverContent as xm } from "./ui/popover.js";
155
156
  import { Skeleton as hi } from "./ui/skeleton.js";
156
157
  import { WidgetSlot as Do } from "./WidgetSlot.js";
157
- import { useItemLock as ov, LockHolderButton as av, ItemLockBanner as lv } from "./panels/ItemLockBanner.js";
158
- import { isAccessRefusal as tm, deniedToastAction as dv, WhyDeniedButton as cv } from "./panels/AccessInsights.js";
159
- import { AccessDeniedPanel as uv } from "./panels/AccessDeniedPanel.js";
160
- import { RevisionsPanel as fv } from "./panels/RevisionsPanel.js";
161
- import { ItemActionButtons as mv } from "./panels/ItemActionButtons.js";
162
- import { CustomActionButtons as pv } from "./panels/CustomActionButtons.js";
158
+ import { useItemLock as lv, LockHolderButton as dv, ItemLockBanner as cv } from "./panels/ItemLockBanner.js";
159
+ import { isAccessRefusal as tm, deniedToastAction as uv, WhyDeniedButton as fv } from "./panels/AccessInsights.js";
160
+ import { AccessDeniedPanel as mv } from "./panels/AccessDeniedPanel.js";
161
+ import { RevisionsPanel as pv } from "./panels/RevisionsPanel.js";
162
+ import { ItemActionButtons as hv } from "./panels/ItemActionButtons.js";
163
+ import { CustomActionButtons as gv } from "./panels/CustomActionButtons.js";
163
164
  import { PipelineTransitionButtons as nm, PipelinePanel as Bo } from "./panels/PipelinePanel.js";
164
- import { OwnersInlineCompact as hv, OwnersInline as gv } from "./item-edit/UserChip.js";
165
+ import { OwnersInlineCompact as yv, OwnersInline as _v } from "./item-edit/UserChip.js";
165
166
  import { ExternalRequestsChip as rm } from "./panels/ExternalRequestsChip.js";
166
167
  import { CommentPanel as zo } from "./panels/CommentPanel.js";
167
168
  import { TaskPanel as Wo } from "./panels/TaskPanel.js";
@@ -169,9 +170,9 @@ import { AddendumPanel as Qo } from "./panels/AddendumPanel.js";
169
170
  import { ReferencedByPanel as Kl } from "./panels/ReferencedByPanel.js";
170
171
  import { RelatedRecordsPanel as Dl } from "./panels/RelatedRecordsPanel.js";
171
172
  import { WorkflowPanel as Bl } from "./panels/WorkflowPanel.js";
172
- import { OwnersSlot as yv } from "./panels/OwnersSlot.js";
173
+ import { OwnersSlot as bv } from "./panels/OwnersSlot.js";
173
174
  let zl = !1;
174
- const _v = "border-r flex w-6 shrink-0 items-start justify-center pt-3 bg-slate-100 text-slate-500 hover:bg-slate-200/70 hover:text-slate-700 transition-colors dark:bg-white/[0.04] dark:hover:bg-white/[0.08] dark:hover:text-slate-300";
175
+ const vv = "border-r flex w-6 shrink-0 items-start justify-center pt-3 bg-slate-100 text-slate-500 hover:bg-slate-200/70 hover:text-slate-700 transition-colors dark:bg-white/[0.04] dark:hover:bg-white/[0.08] dark:hover:text-slate-300";
175
176
  function sm(i, k, N) {
176
177
  if (/[\p{L}\p{N}]/u.test(i)) return i.trim();
177
178
  for (const q of ["name", "title", "label"]) {
@@ -199,22 +200,22 @@ function om(i) {
199
200
  } : {}
200
201
  }));
201
202
  }
202
- function bv(i) {
203
+ function wv(i) {
203
204
  const k = i.attach_file_field;
204
205
  return typeof k == "string" && k ? k : null;
205
206
  }
206
207
  function gi({ children: i }) {
207
- const k = $(null), N = m0(k), q = Zb();
208
+ const k = $(null), N = h0(k), q = ev();
208
209
  return /* @__PURE__ */ _("div", { ref: k, className: De(q && "relative", "grid grid-cols-12 gap-4 items-start"), children: [
209
- /* @__PURE__ */ a(Xb, {}),
210
+ /* @__PURE__ */ a(tv, {}),
210
211
  i(N)
211
212
  ] });
212
213
  }
213
214
  const am = "nvr-form-validation";
214
- function vv({ status: i }) {
215
+ function kv({ status: i }) {
215
216
  return i === "running" ? /* @__PURE__ */ a(Ir, { className: "h-4 w-4 animate-spin text-nvr-cyan shrink-0" }) : i === "done" ? /* @__PURE__ */ a(pr, { className: "h-4 w-4 text-green-500 shrink-0" }) : i === "error" ? /* @__PURE__ */ a(pm, { className: "h-4 w-4 text-red-500 shrink-0" }) : /* @__PURE__ */ a("div", { className: "h-4 w-4 rounded-full border-2 border-slate-200 dark:border-slate-600 shrink-0" });
216
217
  }
217
- function wv({
218
+ function xv({
218
219
  open: i,
219
220
  steps: k,
220
221
  onClose: N,
@@ -259,7 +260,7 @@ function wv({
259
260
  ] })
260
261
  ] }),
261
262
  /* @__PURE__ */ a(wi, { children: /* @__PURE__ */ a("div", { className: "space-y-2", children: k.map((W) => {
262
- const Jn = W.progress && W.progress.total > 0 ? Math.round(W.progress.done / W.progress.total * 100) : null;
263
+ const Gn = W.progress && W.progress.total > 0 ? Math.round(W.progress.done / W.progress.total * 100) : null;
263
264
  return /* @__PURE__ */ a(
264
265
  "div",
265
266
  {
@@ -271,7 +272,7 @@ function wv({
271
272
  W.status === "pending" && "border-slate-100 bg-slate-50/60 dark:border-border dark:bg-muted/30"
272
273
  ),
273
274
  children: /* @__PURE__ */ _("div", { className: "flex items-start gap-2.5", children: [
274
- /* @__PURE__ */ a("div", { className: "mt-0.5 shrink-0", children: /* @__PURE__ */ a(vv, { status: W.status }) }),
275
+ /* @__PURE__ */ a("div", { className: "mt-0.5 shrink-0", children: /* @__PURE__ */ a(kv, { status: W.status }) }),
275
276
  /* @__PURE__ */ _("div", { className: "flex-1 min-w-0", children: [
276
277
  /* @__PURE__ */ _("div", { className: "flex items-center justify-between gap-2", children: [
277
278
  /* @__PURE__ */ a(
@@ -300,7 +301,7 @@ function wv({
300
301
  W.denied && q && /* @__PURE__ */ _(Ct, { children: [
301
302
  " ",
302
303
  /* @__PURE__ */ a(
303
- cv,
304
+ fv,
304
305
  {
305
306
  collection: q.collection,
306
307
  itemId: q.itemId,
@@ -316,7 +317,7 @@ function wv({
316
317
  type: "button",
317
318
  onClick: () => {
318
319
  sy(W.details, { action: W.label }).then(
319
- (Gn) => Gn ? _e.success("Details copied") : _e.error("Could not copy the details")
320
+ (Jn) => Jn ? ge.success("Details copied") : ge.error("Could not copy the details")
320
321
  );
321
322
  },
322
323
  className: "mt-1 inline-flex items-center gap-1 text-[10.5px] text-slate-500 hover:text-slate-700 dark:text-slate-400 dark:hover:text-slate-200",
@@ -326,11 +327,11 @@ function wv({
326
327
  ]
327
328
  }
328
329
  ),
329
- W.status === "running" && Jn !== null && /* @__PURE__ */ a("div", { className: "mt-1.5 h-1 rounded-full bg-slate-200 overflow-hidden", children: /* @__PURE__ */ a(
330
+ W.status === "running" && Gn !== null && /* @__PURE__ */ a("div", { className: "mt-1.5 h-1 rounded-full bg-slate-200 overflow-hidden", children: /* @__PURE__ */ a(
330
331
  "div",
331
332
  {
332
333
  className: "h-full rounded-full bg-nvr-cyan transition-all duration-200",
333
- style: { width: `${Jn}%` }
334
+ style: { width: `${Gn}%` }
334
335
  }
335
336
  ) })
336
337
  ] })
@@ -354,7 +355,7 @@ function wv({
354
355
  }
355
356
  );
356
357
  }
357
- function kv(i, k) {
358
+ function Sv(i, k) {
358
359
  if (i == null || i === "") return "—";
359
360
  if (typeof i == "boolean") return i ? "Yes" : "No";
360
361
  const N = Number(i);
@@ -374,7 +375,7 @@ function kv(i, k) {
374
375
  );
375
376
  if (k === "date")
376
377
  try {
377
- return s_(i) || gm(i);
378
+ return o_(i) || gm(i);
378
379
  } catch {
379
380
  return String(i);
380
381
  }
@@ -409,7 +410,7 @@ function ki({
409
410
  const F = typeof i == "object" ? JSON.stringify(i) : String(i);
410
411
  return /* @__PURE__ */ a(Ct, { children: F.length > 60 ? `${F.slice(0, 60)}…` : F });
411
412
  }
412
- function xv({
413
+ function Nv({
413
414
  open: i,
414
415
  onClose: k,
415
416
  collection: N,
@@ -423,16 +424,16 @@ function xv({
423
424
  pendingDeleteCount: W
424
425
  }) {
425
426
  if (!i) return null;
426
- const Jn = (H) => {
427
+ const Gn = (H) => {
427
428
  var ue;
428
429
  return ((ue = q.find(
429
430
  (qt) => qt.many_collection === N && qt.many_field === H && !qt.junction_field
430
431
  )) == null ? void 0 : ue.one_collection) ?? null;
431
- }, Gn = (H, ue) => (ue == null ? void 0 : ue.label) || be(H.replace(/_/g, " ")), Er = new Map((F ?? []).map((H) => [H.field, H])), hr = [];
432
+ }, Jn = (H, ue) => (ue == null ? void 0 : ue.label) || be(H.replace(/_/g, " ")), Er = new Map((F ?? []).map((H) => [H.field, H])), hr = [];
432
433
  for (const H of F ?? [])
433
434
  tt(L[H.field], ne[H.field]) || L[H.field] !== void 0 && hr.push({
434
435
  key: H.field,
435
- label: Gn(H.field, H),
436
+ label: Jn(H.field, H),
436
437
  from: ne[H.field],
437
438
  to: L[H.field]
438
439
  });
@@ -444,10 +445,10 @@ function xv({
444
445
  return ue ? ((qt = q.find((Yn) => Yn.many_collection === ue.many_collection && Yn.id !== ue.id)) == null ? void 0 : qt.one_collection) ?? null : null;
445
446
  }, Pr = [...le.entries()].filter(([, H]) => H.length > 0).map(([H, ue]) => ({
446
447
  key: H,
447
- label: Gn(H, Er.get(H)),
448
+ label: Jn(H, Er.get(H)),
448
449
  ids: ue,
449
450
  target: xs(H)
450
- })), Si = [...Pe.entries()].filter(([, H]) => H.size > 0).map(([H, ue]) => ({ key: H, label: Gn(H, Er.get(H)), count: ue.size })), Lr = Pr.reduce((H, ue) => H + ue.ids.length, 0), Ni = Si.reduce((H, ue) => H + ue.count, 0), Mr = 5;
451
+ })), Si = [...Pe.entries()].filter(([, H]) => H.size > 0).map(([H, ue]) => ({ key: H, label: Jn(H, Er.get(H)), count: ue.size })), Lr = Pr.reduce((H, ue) => H + ue.ids.length, 0), Ni = Si.reduce((H, ue) => H + ue.count, 0), Mr = 5;
451
452
  return /* @__PURE__ */ _(
452
453
  "div",
453
454
  {
@@ -469,7 +470,7 @@ function xv({
469
470
  ] }),
470
471
  hr.length === 0 && Lr === 0 && Ni === 0 && Ne === 0 && W === 0 ? /* @__PURE__ */ a("p", { className: "text-[11.5px] text-slate-400", children: "Nothing differs from the saved record — this flag may be stale. Saving is a no-op; reloading clears it." }) : /* @__PURE__ */ _("div", { className: "max-h-[300px] space-y-1.5 overflow-y-auto", children: [
471
472
  hr.map((H) => {
472
- const ue = Er.get(H.key) ?? null, qt = Jn(H.key);
473
+ const ue = Er.get(H.key) ?? null, qt = Gn(H.key);
473
474
  return /* @__PURE__ */ _("div", { className: "text-[11.5px]", children: [
474
475
  /* @__PURE__ */ a("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: H.label }),
475
476
  /* @__PURE__ */ _("p", { className: "break-words text-slate-500 dark:text-slate-400", children: [
@@ -519,7 +520,7 @@ function xv({
519
520
  function tt(i, k) {
520
521
  return i === k || i == null && k == null ? !0 : i == null || k == null ? !1 : typeof i == "string" && typeof k == "number" || typeof i == "number" && typeof k == "string" ? String(i) === String(k) : JSON.stringify(i) === JSON.stringify(k);
521
522
  }
522
- function Sv(i, k) {
523
+ function $v(i, k) {
523
524
  if (!k) return i;
524
525
  const N = { ...i };
525
526
  for (const [q, F] of Object.entries(k))
@@ -540,7 +541,7 @@ function dm(i, k) {
540
541
  }
541
542
  return N ?? i;
542
543
  }
543
- function Nv(i, k, N, q) {
544
+ function Cv(i, k, N, q) {
544
545
  return new Set(i.filter((F) => k.has(F) && !tt(N[F], q[F])));
545
546
  }
546
547
  function Vl(i) {
@@ -553,7 +554,7 @@ function Vl(i) {
553
554
  })() : k;
554
555
  return !!N && typeof N == "object" && !!N.no_duplicate;
555
556
  }
556
- const $v = /* @__PURE__ */ new Set([
557
+ const Rv = /* @__PURE__ */ new Set([
557
558
  "id",
558
559
  "user_created",
559
560
  "date_created",
@@ -565,30 +566,30 @@ const $v = /* @__PURE__ */ new Set([
565
566
  "changed",
566
567
  "creator"
567
568
  ]);
568
- function Cv(i, k, N) {
569
+ function Ov(i, k, N) {
569
570
  const q = new Set(
570
571
  (N ?? []).filter((L) => L.readonly || Vl(L)).map((L) => L.field)
571
572
  ), F = {};
572
573
  for (const [L, ne] of Object.entries(i))
573
- $v.has(L) || L === k || q.has(L) || ne === null || typeof ne == "object" || (F[L] = ne);
574
+ Rv.has(L) || L === k || q.has(L) || ne === null || typeof ne == "object" || (F[L] = ne);
574
575
  return F;
575
576
  }
576
- function Rv(i, k) {
577
+ function Fv(i, k) {
577
578
  const N = i === "" ? null : i, q = k === "" ? null : k;
578
579
  if (tt(N, q)) return !0;
579
580
  const F = (le) => typeof le == "number" ? le : typeof le == "string" && /^\s*-?\d+(\.\d+)?\s*$/.test(le) ? Number(le) : Number.NaN, L = F(N), ne = F(q);
580
581
  return Number.isFinite(L) && Number.isFinite(ne) && L === ne;
581
582
  }
582
- function Ov(i, k) {
583
- return Object.keys(i).some((N) => !N.startsWith("__") && !Rv(i[N], k[N]));
583
+ function jv(i, k) {
584
+ return Object.keys(i).some((N) => !N.startsWith("__") && !Fv(i[N], k[N]));
584
585
  }
585
- function Fv(i, k, N, q) {
586
+ function Av(i, k, N, q) {
586
587
  return i.some((F) => k.has(F) && !tt(N[F], q[F]));
587
588
  }
588
- function jv(i, k, N, q) {
589
+ function qv(i, k, N, q) {
589
590
  return i[0] !== "o2m-rows" || String(i[3]) !== String(k) || i.length === 5 && i[4] === "" || !Array.isArray(q) || !Array.isArray(N) ? !1 : i.length === 4 ? q.length !== N.length : q.length > N.length;
590
591
  }
591
- function Av(i, k, N) {
592
+ function Tv(i, k, N) {
592
593
  const q = {};
593
594
  for (const F of i) {
594
595
  const L = F.validation_rules;
@@ -618,37 +619,37 @@ function Av(i, k, N) {
618
619
  return q;
619
620
  }
620
621
  const cm = "Add at least one line";
621
- function qv(i, k, N) {
622
+ function Iv(i, k, N) {
622
623
  if (i) return !1;
623
624
  const q = k.filter(
624
625
  (F) => !F.hidden && !tn.has(F.field) && !Tr(F.field) && F.layout_assigned !== !1
625
626
  );
626
627
  return q.length > 0 && q.every((F) => N(F.field));
627
628
  }
628
- function Tv(i, k) {
629
+ function Ev(i, k) {
629
630
  var q;
630
631
  return `${((q = k.find((F) => F.field === i.field)) == null ? void 0 : q.label) || be(i.field)} — ${i.message}`;
631
632
  }
632
- function Iv(i, k, N, q) {
633
+ function Pv(i, k, N, q) {
633
634
  if (N || q(k)) return !0;
634
635
  const F = typeof i.field == "string" ? i.field : "";
635
636
  return !!F && (i.type === "gte_field" || i.type === "lte_field" || i.type === "required_if") && q(F);
636
637
  }
637
- function Ev(i) {
638
+ function Lv(i) {
638
639
  var q;
639
640
  const k = i == null ? void 0 : i.response, N = (k == null ? void 0 : k.code) ?? ((q = k == null ? void 0 : k.data) == null ? void 0 : q.code);
640
641
  return typeof N == "string" ? N : null;
641
642
  }
642
- function Pv(i, k) {
643
+ function Mv(i, k) {
643
644
  return Object.keys(k).filter(
644
645
  (N) => !N.startsWith("__") && Object.hasOwn(i, N) && i[N] !== void 0 && !tt(i[N], k[N])
645
646
  );
646
647
  }
647
- function Lv(i, k) {
648
+ function Kv(i, k) {
648
649
  return i != null && i.user_id ? !!k && String(i.user_id).toUpperCase() === String(k).toUpperCase() ? "You, in another tab" : i.user_name ?? null : null;
649
650
  }
650
651
  const Wl = "Not an available option — pick another or clear it";
651
- function Mv(i, k) {
652
+ function Dv(i, k) {
652
653
  return !k || Object.keys(k).length === 0 ? i : { ...i, ...k };
653
654
  }
654
655
  class um extends Error {
@@ -671,7 +672,7 @@ function Hl(i, k, N) {
671
672
  stagingKey: F.one_field ?? `${F.many_collection}.${L}`
672
673
  } : null;
673
674
  }
674
- function Kv(i, k, N) {
675
+ function Bv(i, k, N) {
675
676
  const q = [];
676
677
  for (const [F, L] of Object.entries(i)) {
677
678
  if (F === "__links" || L == null || L === "" || !(k ?? []).some(
@@ -688,7 +689,7 @@ function Kv(i, k, N) {
688
689
  }
689
690
  return q;
690
691
  }
691
- function Dv(i, k, N, q) {
692
+ function zv(i, k, N, q) {
692
693
  const F = {};
693
694
  for (const [L, ne] of k) {
694
695
  const le = i.find((W) => W.field === L);
@@ -711,39 +712,39 @@ function fm(i, k) {
711
712
  const N = new Set(k.map(String));
712
713
  return i.filter((q) => N.has(String(q)));
713
714
  }
714
- function Bv(i, k) {
715
+ function Wv(i, k) {
715
716
  if (!(i == null || i === ""))
716
717
  return k.find((N) => String(N) === String(i));
717
718
  }
718
719
  function Nm(i) {
719
720
  return i == null ? "" : String(i);
720
721
  }
721
- function zv(i, k, N, q) {
722
+ function Qv(i, k, N, q) {
722
723
  const F = i.get(k);
723
724
  return !F || F.trigger !== N || q == null || q === "" ? !1 : F.value === Nm(q);
724
725
  }
725
- function Wv(i, k) {
726
+ function Vv(i, k) {
726
727
  const N = String(k).toLowerCase();
727
728
  return i.some((q) => String(q).toLowerCase() === N) ? i : [...i, k];
728
729
  }
729
- function Qv(i, k) {
730
+ function Hv(i, k) {
730
731
  const N = new Set((k ?? []).map(String));
731
732
  return i.filter((q) => !N.has(String(q)));
732
733
  }
733
- function Vv(i, k, N, q, F, L) {
734
+ function Uv(i, k, N, q, F, L) {
734
735
  return i && !k ? { known: !1, ids: [] } : {
735
736
  known: !0,
736
737
  ids: Sm(N, q, F, L)
737
738
  };
738
739
  }
739
- function Hv(i, k) {
740
+ function Gv(i, k) {
740
741
  var q;
741
742
  const N = {};
742
743
  for (const [F, L] of Object.entries(i))
743
744
  (q = k[F]) != null && q.known && (N[F] = L);
744
745
  return N;
745
746
  }
746
- function Uv(i, k) {
747
+ function Jv(i, k) {
747
748
  const N = {}, q = {};
748
749
  if (!i) return { scalar: N, alias: q };
749
750
  const F = k ?? /* @__PURE__ */ new Set();
@@ -751,7 +752,7 @@ function Uv(i, k) {
751
752
  F.has(L) ? q[L] = Array.isArray(ne) ? ne : ne != null ? [ne] : [] : N[L] = ne;
752
753
  return { scalar: N, alias: q };
753
754
  }
754
- function Jv({
755
+ function Yv({
755
756
  collection: i,
756
757
  itemId: k,
757
758
  origin: N,
@@ -796,7 +797,7 @@ function Jv({
796
797
  {
797
798
  "data-provenance-payload": W.kind,
798
799
  className: "max-h-64 overflow-auto whitespace-pre-wrap break-words rounded-md border border-slate-200 bg-slate-50 p-2 font-mono text-[10.5px] leading-snug text-slate-700 dark:border-border dark:bg-[#0f172a] dark:text-slate-200",
799
- children: /* @__PURE__ */ a(o0, { kind: W.kind, text: W.text })
800
+ children: /* @__PURE__ */ a(l0, { kind: W.kind, text: W.text })
800
801
  }
801
802
  )
802
803
  ] }, W.title)),
@@ -806,9 +807,9 @@ function Jv({
806
807
  type: "button",
807
808
  onClick: () => {
808
809
  var W;
809
- (W = navigator.clipboard) == null || W.writeText(Pe.sections.map((Jn) => Jn.text).join(`
810
+ (W = navigator.clipboard) == null || W.writeText(Pe.sections.map((Gn) => Gn.text).join(`
810
811
 
811
- `)).then(() => _e.success("Payload copied"));
812
+ `)).then(() => ge.success("Payload copied"));
812
813
  },
813
814
  className: "text-[11px] text-slate-500 hover:underline",
814
815
  children: "Copy payload"
@@ -828,7 +829,7 @@ function Jv({
828
829
  ] })
829
830
  ] }),
830
831
  ne && /* @__PURE__ */ a(
831
- nv,
832
+ sv,
832
833
  {
833
834
  target: {
834
835
  source: "core:inbound",
@@ -841,21 +842,21 @@ function Jv({
841
842
  )
842
843
  ] });
843
844
  }
844
- function Gv(i) {
845
+ function Zv(i) {
845
846
  const k = hm();
846
847
  return i.map((N) => xy(N, k));
847
848
  }
848
- function Yv({
849
+ function Xv({
849
850
  affordances: i,
850
851
  personalDefaults: k,
851
852
  sources: N,
852
853
  fieldComments: q,
853
854
  children: F
854
855
  }) {
855
- return /* @__PURE__ */ a(E_.Provider, { value: i, children: /* @__PURE__ */ a(jb.Provider, { value: k, children: /* @__PURE__ */ a(o_.Provider, { value: N ?? null, children: /* @__PURE__ */ a(z_.Provider, { value: q, children: F }) }) }) });
856
+ return /* @__PURE__ */ a(L_.Provider, { value: i, children: /* @__PURE__ */ a(qb.Provider, { value: k, children: /* @__PURE__ */ a(l_.Provider, { value: N ?? null, children: /* @__PURE__ */ a(Q_.Provider, { value: q, children: F }) }) }) });
856
857
  }
857
- function cS(i) {
858
- return i.design ? /* @__PURE__ */ a(Gb, { design: i.design.context, onRefusedWrite: i.design.onRefusedWrite, children: /* @__PURE__ */ a(mm, { ...i }) }) : /* @__PURE__ */ a(mm, { ...i });
858
+ function mS(i) {
859
+ return i.design ? /* @__PURE__ */ a(Zb, { design: i.design.context, onRefusedWrite: i.design.onRefusedWrite, children: /* @__PURE__ */ a(mm, { ...i }) }) : /* @__PURE__ */ a(mm, { ...i });
859
860
  }
860
861
  function mm({
861
862
  collection: i,
@@ -869,8 +870,8 @@ function mm({
869
870
  showHeader: Pe = !0,
870
871
  headerExtra: Ne,
871
872
  focusField: W,
872
- showItemActions: Jn = !1,
873
- showGrantedTools: Gn = !1,
873
+ showItemActions: Gn = !1,
874
+ showGrantedTools: Jn = !1,
874
875
  moreMenuItems: Er,
875
876
  onViewModeChange: hr,
876
877
  onDirtyChange: xs,
@@ -884,7 +885,7 @@ function mm({
884
885
  showWorkflow: qt = !0,
885
886
  showComments: Yn = !0,
886
887
  showTasks: Ul = !0,
887
- showLockBanner: Jl = !0,
888
+ showLockBanner: Gl = !0,
888
889
  className: Ss,
889
890
  headerClassName: $m,
890
891
  renderField: gr,
@@ -900,10 +901,10 @@ function mm({
900
901
  initialRows: Zn,
901
902
  rehearseCopiedLines: Am = !1,
902
903
  design: Dt,
903
- layoutEditing: Gl = !1
904
+ layoutEditing: Jl = !1
904
905
  }) {
905
- var Vu, Hu, Uu, Ju, Gu, Yu, Zu, Xu, ef, tf, nf, rf, sf, of, af, lf, df, cf, uf, ff, mf, pf, hf, gf, yf, _f, bf, vf, wf;
906
- const I = Dt != null, Be = (Dt == null ? void 0 : Dt.context) ?? null, Uo = Be != null, $n = !!(Be != null && Be.showHidden), R = jg(), $i = jy(), Dn = Ag(), { isAdmin: Rt, userId: Le } = Rg(qg), rt = qb(i, Rt), Yl = Tg(), [qm, Zl] = P(!1), Bn = ((Hu = (Vu = rt.preview) == null ? void 0 : Vu.layout) == null ? void 0 : Hu.slug) ?? N, X = fg(), Tm = ((Uu = Dt == null ? void 0 : Dt.record) == null ? void 0 : Uu.id) != null ? String(Dt.record.id) : void 0, Jo = k ?? (I ? Tm : void 0), p = Jo ?? "new", m = !Jo || Jo === "new", [Xn] = P(Sy), { data: Im } = $t({
906
+ var Vu, Hu, Uu, Gu, Ju, Yu, Zu, Xu, ef, tf, nf, rf, sf, of, af, lf, df, cf, uf, ff, mf, pf, hf, gf, yf, _f, bf, vf, wf;
907
+ const I = Dt != null, Be = (Dt == null ? void 0 : Dt.context) ?? null, Uo = Be != null, $n = !!(Be != null && Be.showHidden), R = jg(), $i = jy(), Dn = Ag(), { isAdmin: Rt, userId: Le } = Rg(qg), rt = Ib(i, Rt), Yl = Tg(), [qm, Zl] = P(!1), Bn = ((Hu = (Vu = rt.preview) == null ? void 0 : Vu.layout) == null ? void 0 : Hu.slug) ?? N, X = fg(), Tm = ((Uu = Dt == null ? void 0 : Dt.record) == null ? void 0 : Uu.id) != null ? String(Dt.record.id) : void 0, Go = k ?? (I ? Tm : void 0), p = Go ?? "new", m = !Go || Go === "new", [Xn] = P(Sy), { data: Im } = $t({
907
908
  // Desktop keeps the key the host's own /active read shares (admin ItemEdit).
908
909
  queryKey: [
909
910
  "active-layout",
@@ -921,10 +922,10 @@ function mm({
921
922
  ).then((e) => e.data).catch(() => null),
922
923
  staleTime: 6e4,
923
924
  enabled: !I
924
- }), w = I ? Dt.layout : Im, Bt = ((Ju = w == null ? void 0 : w.layout) == null ? void 0 : Ju.id) ?? null, [Xl, ed] = P(() => /* @__PURE__ */ new Set());
925
+ }), w = I ? Dt.layout : Im, Bt = ((Gu = w == null ? void 0 : w.layout) == null ? void 0 : Gu.id) ?? null, [Xl, ed] = P(() => /* @__PURE__ */ new Set());
925
926
  z(() => ed(/* @__PURE__ */ new Set()), [i, p, Bt]);
926
927
  const Ns = A(
927
- () => y0(w, Xl, { design: I }),
928
+ () => b0(w, Xl, { design: I }),
928
929
  [w, Xl, I]
929
930
  ), Em = ce((e) => {
930
931
  ed((t) => t.has(e) ? t : /* @__PURE__ */ new Set([...t, e]));
@@ -937,7 +938,7 @@ function mm({
937
938
  enabled: !m && !I
938
939
  }), Kr = I ? Dt.layout.assignments : null, {
939
940
  data: Ci,
940
- isLoading: Zv,
941
+ isLoading: ew,
941
942
  isFetched: Ri
942
943
  } = $t({
943
944
  queryKey: Kr ? ["layout-editor", "field-config", i, Kr] : ["field-config", i, Bt],
@@ -953,7 +954,7 @@ function mm({
953
954
  // A draft edit re-asks; the canvas keeps the last answer meanwhile.
954
955
  placeholderData: Kr ? (e) => e : void 0,
955
956
  // Layout text in the reader's language (#2665); the canvas edits the text as written.
956
- select: Kr ? void 0 : Gv,
957
+ select: Kr ? void 0 : Zv,
957
958
  // Wait for the layout either way, not just when a slug pins one. Without
958
959
  // this the field config fetched immediately with layoutId = null — the
959
960
  // LAYOUT-LESS default field set — painted that, then refetched under a new
@@ -962,15 +963,15 @@ function mm({
962
963
  // always settles, so this cannot hang; undefined is strictly "still
963
964
  // asking".
964
965
  enabled: w !== void 0
965
- }), Go = Be == null ? void 0 : Be.ghost, j = A(() => !Go || !m || !Ci ? Ci : Ci.map((e) => {
966
- const t = Go(e.field);
966
+ }), Jo = Be == null ? void 0 : Be.ghost, j = A(() => !Jo || !m || !Ci ? Ci : Ci.map((e) => {
967
+ const t = Jo(e.field);
967
968
  return t ? { ...e, placeholder: t } : e;
968
- }), [Go, m, Ci]), td = A(() => z0(j ?? []), [j]), Dr = W0(), { data: D = [], isFetched: yr } = $t({
969
+ }), [Jo, m, Ci]), td = A(() => Q0(j ?? []), [j]), Dr = V0(), { data: D = [], isFetched: yr } = $t({
969
970
  queryKey: ["relations", i],
970
971
  queryFn: () => R.request(se(`/data-model/relations/for/${i}`)).then((e) => e.data ?? []),
971
972
  staleTime: 6e4
972
973
  }), Pm = A(
973
- () => W_(j ?? [], D, i),
974
+ () => V_(j ?? [], D, i),
974
975
  [j, D, i]
975
976
  ), { data: Br = [], isFetched: nd } = $t({
976
977
  queryKey: ["field-rules", i],
@@ -1013,7 +1014,7 @@ function mm({
1013
1014
  const r = await n.blob(), s = URL.createObjectURL(r), o = document.createElement("a");
1014
1015
  o.href = s, o.download = `${i}-${p}.pdf`, o.click(), URL.revokeObjectURL(s);
1015
1016
  } catch {
1016
- _e.error("Failed to generate PDF");
1017
+ ge.error("Failed to generate PDF");
1017
1018
  } finally {
1018
1019
  sd(null);
1019
1020
  }
@@ -1076,12 +1077,12 @@ function mm({
1076
1077
  z(() => {
1077
1078
  const e = pd.current;
1078
1079
  if (pd.current = nt, fd) return;
1079
- const t = E0(e, nt);
1080
+ const t = L0(e, nt);
1080
1081
  if (!t) return;
1081
1082
  const n = (j ?? []).find((r) => r.field === t.field);
1082
1083
  Um(`${(n == null ? void 0 : n.label) || be(t.field)}: ${t.message}`);
1083
1084
  }, [nt]);
1084
- const [hd, Wr] = P(null), [Jm, gd] = P(!1), [Gm, Pi] = P(!1), [Ym, yd] = P(!1), _t = $(null), [Me, Qr] = P(null);
1085
+ const [hd, Wr] = P(null), [Gm, gd] = P(!1), [Jm, Pi] = P(!1), [Ym, yd] = P(!1), _t = $(null), [Me, Qr] = P(null);
1085
1086
  z(() => {
1086
1087
  if (!Me || Me.current !== void 0 || m || p == null) return;
1087
1088
  let e = !0;
@@ -1122,7 +1123,7 @@ function mm({
1122
1123
  o.result.then((l) => l.get(t) ?? null)
1123
1124
  );
1124
1125
  }, z(
1125
- () => m || p == null || I ? void 0 : b0(X, R, String(p)),
1126
+ () => m || p == null || I ? void 0 : w0(X, R, String(p)),
1126
1127
  [X, R, p, m, I]
1127
1128
  );
1128
1129
  const vd = async (e, t) => {
@@ -1133,7 +1134,7 @@ function mm({
1133
1134
  () => /* @__PURE__ */ new Map()
1134
1135
  )).get(t) ?? null;
1135
1136
  return o != null && ht.current.set(n, Promise.resolve(o)), o;
1136
- }, gn = ub(i, m ? null : p), Rn = $(null), Di = $(/* @__PURE__ */ new Set()), wd = $({}), Bi = ce(() => {
1137
+ }, gn = mb(i, m ? null : p), Rn = $(null), Di = $(/* @__PURE__ */ new Set()), wd = $({}), Bi = ce(() => {
1137
1138
  var e;
1138
1139
  (e = Rn.current) == null || e.call(Rn), Rn.current = null, Di.current = /* @__PURE__ */ new Set();
1139
1140
  }, []);
@@ -1142,7 +1143,7 @@ function mm({
1142
1143
  }, [R, Le, X]), z(() => Bi, [i, p]);
1143
1144
  const [Ue, On] = P(!1), [Zm, kd] = P(!1), [js, Hr] = P({}), ca = $(0), zi = $(null), [bt, ua] = P(!1), Wi = (e) => ua(e), Qi = $(hr);
1144
1145
  Qi.current = hr;
1145
- const xd = ((Gu = $s == null ? void 0 : $s.layout) == null ? void 0 : Gu.id) != null ? Number($s.layout.id) : null;
1146
+ const xd = ((Ju = $s == null ? void 0 : $s.layout) == null ? void 0 : Ju.id) != null ? Number($s.layout.id) : null;
1146
1147
  z(() => {
1147
1148
  var e;
1148
1149
  (e = Qi.current) == null || e.call(Qi, {
@@ -1153,14 +1154,14 @@ function mm({
1153
1154
  const vr = A(
1154
1155
  () => x != null && x.read_mode_toggle ? Pf(x.summary_mode_rules) : null,
1155
1156
  [x == null ? void 0 : x.read_mode_toggle, x == null ? void 0 : x.summary_mode_rules]
1156
- ), [Xm, ep] = P(null), fa = `${i}|${String(p)}`, Ur = I || m || x !== void 0 && (!vr || Xm === fa), vt = Gg(i, p, Le), Sd = A(
1157
+ ), [Xm, ep] = P(null), fa = `${i}|${String(p)}`, Ur = I || m || x !== void 0 && (!vr || Xm === fa), vt = Jg(i, p, Le), Sd = A(
1157
1158
  () => m && (Kt || Kn || Zn) ? Wg({
1158
1159
  v: Kt ?? null,
1159
1160
  l: Kn ?? null,
1160
1161
  r: Zn ?? null
1161
1162
  }) : null,
1162
1163
  [m, Kt, Kn, Zn]
1163
- ), [nn, Jr] = P({ state: I ? "none" : "checking" }), Nd = $(nn);
1164
+ ), [nn, Gr] = P({ state: I ? "none" : "checking" }), Nd = $(nn);
1164
1165
  Nd.current = nn;
1165
1166
  const [tp, np] = P(!1), [As, rp] = P(null), wr = $(!1), [ma, $d] = P(!1);
1166
1167
  z(() => {
@@ -1174,11 +1175,11 @@ function mm({
1174
1175
  z(() => {
1175
1176
  const e = (t) => {
1176
1177
  var s;
1177
- const n = (s = t.detail) == null ? void 0 : s.collection, r = F_(n, i, Uo, Gl);
1178
+ const n = (s = t.detail) == null ? void 0 : s.collection, r = A_(n, i, Uo, Jl);
1178
1179
  r !== "ignore" && (X.invalidateQueries({ queryKey: ["field-config"] }), X.invalidateQueries({ queryKey: ["active-layout"] }), X.invalidateQueries({ queryKey: ["collection-meta"] }), r === "banner" && ip(!0));
1179
1180
  };
1180
1181
  return window.addEventListener("nvr:config-update", e), () => window.removeEventListener("nvr:config-update", e);
1181
- }, [X, i, Uo, Gl]);
1182
+ }, [X, i, Uo, Jl]);
1182
1183
  const [Vi, op] = P(!1), [ap, Cd] = P(!1);
1183
1184
  z(() => {
1184
1185
  if (!Ue) {
@@ -1190,7 +1191,7 @@ function mm({
1190
1191
  }, [Ue]);
1191
1192
  const [qs, lp] = P({}), pa = $(/* @__PURE__ */ new Set()), Tt = $(/* @__PURE__ */ new Set()), Hi = $(
1192
1193
  () => /* @__PURE__ */ new Map()
1193
- ), Gr = $(/* @__PURE__ */ new Map()), Rd = $(() => {
1194
+ ), Jr = $(/* @__PURE__ */ new Map()), Rd = $(() => {
1194
1195
  }), Ui = $(() => {
1195
1196
  }), Ot = $(0), Ts = ce((e) => {
1196
1197
  if (e.length !== 0) {
@@ -1201,7 +1202,7 @@ function mm({
1201
1202
  return n;
1202
1203
  });
1203
1204
  }
1204
- }, []), Od = $(null), { headerDense: ha, headerFolded: dp, headerRows: cp, headerTilesRef: up } = Z_(), Fd = ce((e) => {
1205
+ }, []), Od = $(null), { headerDense: ha, headerFolded: dp, headerRows: cp, headerTilesRef: up } = e0(), Fd = ce((e) => {
1205
1206
  const t = e.target, n = t.scrollTop;
1206
1207
  op((r) => {
1207
1208
  var l;
@@ -1231,12 +1232,12 @@ function mm({
1231
1232
  refetchOnReconnect: !1
1232
1233
  }), ga = $(null);
1233
1234
  ga.current = (Yr == null ? void 0 : Yr.latest) ?? null;
1234
- const [fp, tr] = P(!1), [mp, Ji] = P([]);
1235
+ const [fp, tr] = P(!1), [mp, Gi] = P([]);
1235
1236
  z(() => {
1236
1237
  (Me || Vr) && tr(!1);
1237
1238
  }, [Me, Vr]);
1238
1239
  function ve(e, t) {
1239
- Ji(
1240
+ Gi(
1240
1241
  (n) => n.map((r) => {
1241
1242
  if (r.id !== e) return r;
1242
1243
  const s = typeof t == "function" ? t(r) : t;
@@ -1244,7 +1245,7 @@ function mm({
1244
1245
  })
1245
1246
  );
1246
1247
  }
1247
- const $e = $({}), Gi = $(/* @__PURE__ */ new Set()), [Is, nr] = P(null), [Zr, jd] = P([]), ya = $(""), Yi = ce((e) => {
1248
+ const $e = $({}), Ji = $(/* @__PURE__ */ new Set()), [Is, nr] = P(null), [Zr, jd] = P([]), ya = $(""), Yi = ce((e) => {
1248
1249
  ya.current = e;
1249
1250
  }, []), Zi = ce((e) => {
1250
1251
  jd((t) => [...t, e]);
@@ -1315,7 +1316,7 @@ function mm({
1315
1316
  [je, ze, We]
1316
1317
  ), [qd, Xr] = P([]), Td = $(!1), va = $(!1), wa = $({}), [Ye, es] = P(/* @__PURE__ */ new Map()), [at, Ps] = P(/* @__PURE__ */ new Map()), xr = $(
1317
1318
  null
1318
- ), Ls = $(/* @__PURE__ */ new Map()), rn = $(0), Ms = $(/* @__PURE__ */ new Map()), Fn = $(/* @__PURE__ */ new Map()), ts = $(/* @__PURE__ */ new Map()), ka = (e) => R_(
1319
+ ), Ls = $(/* @__PURE__ */ new Map()), rn = $(0), Ms = $(/* @__PURE__ */ new Map()), Fn = $(/* @__PURE__ */ new Map()), ts = $(/* @__PURE__ */ new Map()), ka = (e) => F_(
1319
1320
  {
1320
1321
  touched: qe.current,
1321
1322
  seq: br.current,
@@ -1323,7 +1324,7 @@ function mm({
1323
1324
  },
1324
1325
  e,
1325
1326
  { crossFill: rn.current, notPerson: Ot.current }
1326
- ), xe = A(
1327
+ ), Se = A(
1327
1328
  () => ({
1328
1329
  getStagedLinks: (e) => Ye.get(e) ?? [],
1329
1330
  getStagedUnlinks: (e) => at.get(e) ?? /* @__PURE__ */ new Set(),
@@ -1331,13 +1332,13 @@ function mm({
1331
1332
  stageLink: (e, t) => {
1332
1333
  var n, r;
1333
1334
  if (es((s) => {
1334
- const o = s.get(e) ?? [], l = Wv(o, t);
1335
+ const o = s.get(e) ?? [], l = Vv(o, t);
1335
1336
  if (l === o) return s;
1336
1337
  const c = new Map(s);
1337
1338
  return c.set(e, l), c;
1338
1339
  }), rn.current === 0) {
1339
1340
  const s = Ls.current.get(e);
1340
- s && (Ot.current === 0 && (ka(s), Fn.current.delete(s), Tt.current.delete(s), Gr.current.delete(e), Ui.current(s)), (n = xr.current) == null || n.call(xr, s, t), (r = wt.current) == null || r.call(wt, s, t));
1341
+ s && (Ot.current === 0 && (ka(s), Fn.current.delete(s), Tt.current.delete(s), Jr.current.delete(e), Ui.current(s)), (n = xr.current) == null || n.call(xr, s, t), (r = wt.current) == null || r.call(wt, s, t));
1341
1342
  }
1342
1343
  },
1343
1344
  stageUnlink: (e, t) => {
@@ -1358,7 +1359,7 @@ function mm({
1358
1359
  ), r;
1359
1360
  }), rn.current === 0 && Ot.current === 0) {
1360
1361
  const n = Ls.current.get(e);
1361
- n && (ka(n), Fn.current.delete(n), Tt.current.delete(n), Gr.current.delete(e), Ui.current(n));
1362
+ n && (ka(n), Fn.current.delete(n), Tt.current.delete(n), Jr.current.delete(e), Ui.current(n));
1362
1363
  }
1363
1364
  },
1364
1365
  unstageUnlink: (e, t) => Ps((n) => {
@@ -1433,7 +1434,7 @@ function mm({
1433
1434
  const l = o.one_field ?? `${o.many_collection}.${o.junction_field}`;
1434
1435
  Ot.current += 1;
1435
1436
  try {
1436
- for (const c of s) xe.stageLink(l, c);
1437
+ for (const c of s) Se.stageLink(l, c);
1437
1438
  } finally {
1438
1439
  Ot.current -= 1;
1439
1440
  }
@@ -1446,7 +1447,7 @@ function mm({
1446
1447
  }
1447
1448
  Xr(t);
1448
1449
  },
1449
- [i, D, dn, xe, j, R]
1450
+ [i, D, dn, Se, j, R]
1450
1451
  ), Ks = $(null), [hp, gp] = P(!1), yp = ce(
1451
1452
  async (e) => {
1452
1453
  Ks.current = {
@@ -1521,7 +1522,7 @@ function mm({
1521
1522
  }
1522
1523
  let l;
1523
1524
  try {
1524
- l = e.lines.length > 0 && (r != null && r.many_collection) && r.many_field ? h_(s, o, {
1525
+ l = e.lines.length > 0 && (r != null && r.many_collection) && r.many_field ? y_(s, o, {
1525
1526
  lines: n.lines,
1526
1527
  match_by: n.match_by
1527
1528
  }) : { creates: [], updates: [], deletes: [], matchedUnchanged: 0 };
@@ -1568,7 +1569,7 @@ function mm({
1568
1569
  });
1569
1570
  }
1570
1571
  }
1571
- const c = r != null && r.many_collection && r.many_field ? `${r.many_collection}.${r.many_field}` : null, d = c ? We.get(c) ?? /* @__PURE__ */ new Set() : null, g = d && n.lines !== "append" ? g_(s, o, n.match_by, d) : [], u = y_({
1572
+ const c = r != null && r.many_collection && r.many_field ? `${r.many_collection}.${r.many_field}` : null, d = c ? We.get(c) ?? /* @__PURE__ */ new Set() : null, g = d && n.lines !== "append" ? __(s, o, n.match_by, d) : [], u = b_({
1572
1573
  headerDirty: Ue,
1573
1574
  pendingRows: [...je.values()].reduce((f, h) => f + h.length, 0),
1574
1575
  pendingEdits: [...ze.values()].reduce((f, h) => f + h.size, 0),
@@ -1592,7 +1593,7 @@ function mm({
1592
1593
  async (e, t, n, r, s = []) => {
1593
1594
  const o = n.reimport;
1594
1595
  if (!o) return;
1595
- const l = bv(n), c = [...t.issues];
1596
+ const l = wv(n), c = [...t.issues];
1596
1597
  if (o.header_fields !== "skip") {
1597
1598
  const u = {};
1598
1599
  for (const [f, h] of Object.entries(t.values))
@@ -1611,7 +1612,7 @@ function mm({
1611
1612
  if (d != null && d.many_collection && d.many_field) {
1612
1613
  const u = d.many_collection, f = d.many_field;
1613
1614
  let h = e.creates;
1614
- const v = h.some((y) => m_ in y) || e.rulesEvaluated;
1615
+ const v = h.some((y) => h_ in y) || e.rulesEvaluated;
1615
1616
  if (h.length > 0 && !v) {
1616
1617
  const y = (j ?? []).find((oe) => oe.field === t.line_target_field), T = y == null ? void 0 : y.options, Q = typeof T == "string" ? (() => {
1617
1618
  try {
@@ -1622,9 +1623,9 @@ function mm({
1622
1623
  })() : T ?? {}, Y = Array.isArray(Q.row_rules) ? Q.row_rules : [];
1623
1624
  if (Y.length > 0) {
1624
1625
  const oe = { ...U.current }, C = {};
1625
- for (const G of Q.parent_context_fields ?? []) C[G] = oe[G] ?? null;
1626
- for (const G of Y) {
1627
- const K = G.trigger_field;
1626
+ for (const J of Q.parent_context_fields ?? []) C[J] = oe[J] ?? null;
1627
+ for (const J of Y) {
1628
+ const K = J.trigger_field;
1628
1629
  if (typeof K == "string" && K.startsWith("$parent.")) {
1629
1630
  const E = K.slice(8);
1630
1631
  E in C || (C[E] = oe[E] ?? null);
@@ -1663,11 +1664,11 @@ function mm({
1663
1664
  if (oe)
1664
1665
  for (const [C, Z] of Object.entries(Y)) {
1665
1666
  if (!C.startsWith("__o2m_")) continue;
1666
- const G = C.slice(6), K = Q.get(G) ?? [];
1667
+ const J = C.slice(6), K = Q.get(J) ?? [];
1667
1668
  K.push({
1668
1669
  id: oe,
1669
1670
  members: Array.isArray(Z) ? Z : []
1670
- }), Q.set(G, K);
1671
+ }), Q.set(J, K);
1671
1672
  }
1672
1673
  }
1673
1674
  for (const [Y, oe] of Q) {
@@ -1682,13 +1683,13 @@ function mm({
1682
1683
  });
1683
1684
  continue;
1684
1685
  }
1685
- const Z = C.many_collection, G = C.many_field, K = oe.map((B) => B.id);
1686
+ const Z = C.many_collection, J = C.many_field, K = oe.map((B) => B.id);
1686
1687
  let E = [];
1687
1688
  try {
1688
1689
  E = await R.request(
1689
1690
  se(`/items/${Z}`, {
1690
- filter: JSON.stringify({ [G]: { _in: K } }),
1691
- fields: `id,${G}`,
1691
+ filter: JSON.stringify({ [J]: { _in: K } }),
1692
+ fields: `id,${J}`,
1692
1693
  limit: 2e3
1693
1694
  })
1694
1695
  ).then((B) => B.data ?? []);
@@ -1702,7 +1703,7 @@ function mm({
1702
1703
  }
1703
1704
  const V = /* @__PURE__ */ new Map();
1704
1705
  for (const B of E) {
1705
- const re = String(B[G]), fe = V.get(re) ?? [];
1706
+ const re = String(B[J]), fe = V.get(re) ?? [];
1706
1707
  fe.push(String(B.id)), V.set(re, fe);
1707
1708
  }
1708
1709
  for (const B of oe)
@@ -1738,7 +1739,7 @@ function mm({
1738
1739
  limit: 2e3
1739
1740
  })
1740
1741
  ).then((v) => v.data ?? []);
1741
- for (const v of h) xe.stageUnlink(f, v.id);
1742
+ for (const v of h) Se.stageUnlink(f, v.id);
1742
1743
  } catch {
1743
1744
  c.push({
1744
1745
  severity: "error",
@@ -1748,7 +1749,7 @@ function mm({
1748
1749
  }
1749
1750
  Ot.current += 1;
1750
1751
  try {
1751
- xe.stageLink(f, t.file_id);
1752
+ Se.stageLink(f, t.file_id);
1752
1753
  } finally {
1753
1754
  Ot.current -= 1;
1754
1755
  }
@@ -1777,7 +1778,7 @@ function mm({
1777
1778
  Ot.current += 1;
1778
1779
  try {
1779
1780
  for (const y of f)
1780
- S.has(String(y)) || xe.stageLink(v, y);
1781
+ S.has(String(y)) || Se.stageLink(v, y);
1781
1782
  } finally {
1782
1783
  Ot.current -= 1;
1783
1784
  }
@@ -1794,7 +1795,7 @@ function mm({
1794
1795
  message: `Re-import: ${e.updates.length} updates · ${e.creates.length} new · ${e.deletes.length} deletes · ${e.matchedUnchanged} unchanged`
1795
1796
  }), Xr(c);
1796
1797
  },
1797
- [i, D, dn, xe, R, p, j]
1798
+ [i, D, dn, Se, R, p, j]
1798
1799
  ), xa = $(!1), [Sa, Pd] = P(null);
1799
1800
  z(() => {
1800
1801
  if (!m || !Kt && !Kn && !Zn || xa.current)
@@ -1832,12 +1833,12 @@ function mm({
1832
1833
  if (!de) return;
1833
1834
  const e = $e.current, t = Object.keys(e).length === 0, n = Date.now() - ca.current < 8e3;
1834
1835
  if (!t && !n) {
1835
- const r = Pv(e, de), s = Nv(r, qe.current, U.current, e), o = (d) => s.has(d), l = S0(i, String(p)), c = l ? l.fields ? r.filter((d) => {
1836
+ const r = Mv(e, de), s = Cv(r, qe.current, U.current, e), o = (d) => s.has(d), l = $0(i, String(p)), c = l ? l.fields ? r.filter((d) => {
1836
1837
  var g;
1837
1838
  return (g = l.fields) == null ? void 0 : g.includes(d);
1838
1839
  }) : r : [];
1839
1840
  if (r.length > 0) {
1840
- const d = zi.current, g = Lv(d, Le), u = (/* @__PURE__ */ new Date()).toISOString();
1841
+ const d = zi.current, g = Kv(d, Le), u = (/* @__PURE__ */ new Date()).toISOString();
1841
1842
  Hr((h) => {
1842
1843
  const v = { ...h };
1843
1844
  for (const S of r) {
@@ -1845,7 +1846,7 @@ function mm({
1845
1846
  !y && !c.includes(S) || (v[S] = y ? { was: e[S], by: g, at: u, theirs: de[S], conflict: !0 } : { was: e[S], by: g, at: u });
1846
1847
  }
1847
1848
  return v;
1848
- }), Fv(r, s, U.current, de) || X.invalidateQueries({ queryKey: ["collision-base", i, p] });
1849
+ }), Av(r, s, U.current, de) || X.invalidateQueries({ queryKey: ["collision-base", i, p] });
1849
1850
  for (const h of r) o(h) || qe.current.delete(h);
1850
1851
  if ([...qe.current].some(
1851
1852
  (h) => !tt(U.current[h], de[h])
@@ -1869,7 +1870,7 @@ function mm({
1869
1870
  const u = r + s + o;
1870
1871
  return u && g.push(`${u} line${u === 1 ? "" : "s"}`), l + c && g.push(`${l + c} link${l + c === 1 ? "" : "s"}`), { fields: t, rows: r, edits: s, deletes: o, links: l, unlinks: c, total: d, text: g.join(", ") };
1871
1872
  }, [M, je, ze, We, Ye, at]), Wt = Ue || cn.total > 0, Na = $(async () => !1);
1872
- n_(Wt, "Unsaved record changes", () => Na.current()), z(() => {
1873
+ s_(Wt, "Unsaved record changes", () => Na.current()), z(() => {
1873
1874
  xs == null || xs(Wt, cn), window.dispatchEvent(
1874
1875
  new CustomEvent("nvr:form-unsaved", {
1875
1876
  detail: { collection: i, item: m ? "new" : String(p), ...cn }
@@ -1878,7 +1879,7 @@ function mm({
1878
1879
  }, [Wt, cn]), z(() => {
1879
1880
  if (!Wt) return;
1880
1881
  const e = (t) => {
1881
- r_() || (t.preventDefault(), t.returnValue = cn.text ? `You have unsaved changes: ${cn.text}.` : "You have unsaved changes.");
1882
+ i_() || (t.preventDefault(), t.returnValue = cn.text ? `You have unsaved changes: ${cn.text}.` : "You have unsaved changes.");
1882
1883
  };
1883
1884
  return window.addEventListener("beforeunload", e), () => window.removeEventListener("beforeunload", e);
1884
1885
  }, [Wt, cn.text]);
@@ -1902,7 +1903,7 @@ function mm({
1902
1903
  // IS the person's starting point: an older draft offered over it
1903
1904
  // would mix an abandoned form into the import (army11 f1).
1904
1905
  m && Mt) {
1905
- Jr({ state: "none" });
1906
+ Gr({ state: "none" });
1906
1907
  return;
1907
1908
  }
1908
1909
  const l = $e.current, c = {};
@@ -1910,11 +1911,11 @@ function mm({
1910
1911
  tt(f, l[u]) || (c[u] = f);
1911
1912
  const d = { ...o, fields: c };
1912
1913
  if (!$l(d)) {
1913
- vs(vt), Jr({ state: "none" });
1914
+ vs(vt), Gr({ state: "none" });
1914
1915
  return;
1915
1916
  }
1916
1917
  const g = m ? Hg(vt, o.saved_at) : null;
1917
- Jr({ state: "offer", draft: d, createdId: g ? g.id : null });
1918
+ Gr({ state: "offer", draft: d, createdId: g ? g.id : null });
1918
1919
  }), () => {
1919
1920
  e = !0;
1920
1921
  };
@@ -2012,7 +2013,7 @@ function mm({
2012
2013
  if (e.state !== "offer") return;
2013
2014
  const t = e.draft;
2014
2015
  ea.current = t;
2015
- const n = a0({
2016
+ const n = d0({
2016
2017
  fields: t.fields,
2017
2018
  base: t.base,
2018
2019
  current: $e.current
@@ -2030,7 +2031,7 @@ function mm({
2030
2031
  conflict: !0
2031
2032
  };
2032
2033
  return l;
2033
- }), _e.warning(
2034
+ }), ge.warning(
2034
2035
  n.length === 1 ? "Someone saved a field your draft also changed — Save will ask which value wins" : `Someone saved ${n.length} fields your draft also changed — Save will ask which value wins`,
2035
2036
  { duration: 1e4 }
2036
2037
  )), typeof t.base_revision == "number" && t.base_revision > 0 && (Cn.current = t.base_revision, Os.current = !0);
@@ -2056,15 +2057,15 @@ function mm({
2056
2057
  }
2057
2058
  Object.keys(t.pending_deletes ?? {}).length && no(
2058
2059
  new Map(Object.entries(t.pending_deletes).map(([o, l]) => [o, new Set(l)]))
2059
- ), Object.keys(t.m2m_links ?? {}).length && es(new Map(Object.entries(t.m2m_links))), Object.keys(t.m2m_unlinks ?? {}).length && Ps(new Map(Object.entries(t.m2m_unlinks).map(([o, l]) => [o, new Set(l)]))), On(!0), np(!0), Jr({ state: "none" });
2060
+ ), Object.keys(t.m2m_links ?? {}).length && es(new Map(Object.entries(t.m2m_links))), Object.keys(t.m2m_unlinks ?? {}).length && Ps(new Map(Object.entries(t.m2m_unlinks).map(([o, l]) => [o, new Set(l)]))), On(!0), np(!0), Gr({ state: "none" });
2060
2061
  for (const [o, l] of Object.entries(t.fields))
2061
2062
  l == null || l === "" || io.current(o, l);
2062
2063
  }, []), vp = ce(() => {
2063
2064
  vs(vt), Le && R.request(mr(`/drafts/${i}/${m ? "new" : String(p)}`)).catch(() => {
2064
- }), Jr({ state: "none" });
2065
+ }), Gr({ state: "none" });
2065
2066
  }, [vt, Le, R, i, m, p]);
2066
2067
  z(() => {
2067
- nn.state !== "offer" || nn.createdId != null || !Ue || qe.current.size === 0 || (Jr({ state: "none" }), _e("Your newer changes replace the older draft"));
2068
+ nn.state !== "offer" || nn.createdId != null || !Ue || qe.current.size === 0 || (Gr({ state: "none" }), ge("Your newer changes replace the older draft"));
2068
2069
  }, [nn, Ue]), z(() => {
2069
2070
  var r;
2070
2071
  if (!m || w === void 0 || va.current) return;
@@ -2087,7 +2088,7 @@ function mm({
2087
2088
  const c = l.one_field ?? `${l.many_collection}.${l.junction_field}`;
2088
2089
  Ot.current += 1;
2089
2090
  try {
2090
- for (const d of o) xe.stageLink(c, d);
2091
+ for (const d of o) Se.stageLink(c, d);
2091
2092
  } finally {
2092
2093
  Ot.current -= 1;
2093
2094
  }
@@ -2096,25 +2097,25 @@ function mm({
2096
2097
  }
2097
2098
  t[s] = o;
2098
2099
  }
2099
- const n = Sv(U.current, t);
2100
+ const n = $v(U.current, t);
2100
2101
  U.current = n, pt(n);
2101
- }, [m, w, D, yr, i, xe]);
2102
+ }, [m, w, D, yr, i, Se]);
2102
2103
  const Kd = $(!1);
2103
2104
  z(() => {
2104
2105
  if (!m || !Kt || Kd.current || !yr) return;
2105
2106
  Kd.current = !0;
2106
- const e = Kv(Kt, D, i);
2107
+ const e = Bv(Kt, D, i);
2107
2108
  if (e.length === 0) return;
2108
2109
  Ot.current += 1;
2109
2110
  try {
2110
2111
  for (const { stagingKey: r, ids: s } of e)
2111
- for (const o of s) xe.stageLink(r, o);
2112
+ for (const o of s) Se.stageLink(r, o);
2112
2113
  } finally {
2113
2114
  Ot.current -= 1;
2114
2115
  }
2115
2116
  const t = new Set(e.map((r) => r.field)), n = (r) => Object.fromEntries(Object.entries(r).filter(([s]) => !t.has(s)));
2116
2117
  U.current = n(U.current), pt((r) => n(r));
2117
- }, [m, Kt, D, yr, i, xe]);
2118
+ }, [m, Kt, D, yr, i, Se]);
2118
2119
  const $a = A(
2119
2120
  () => (j ?? []).filter(
2120
2121
  (e) => e.interface === "relation-path" && e.field.includes(".") && !Ns.fields.has(e.field)
@@ -2171,7 +2172,7 @@ function mm({
2171
2172
  const e = {};
2172
2173
  return [...ie.entries()].forEach(([t, n], r) => {
2173
2174
  const s = Dd[r];
2174
- e[t] = Vv(
2175
+ e[t] = Uv(
2175
2176
  !!p && !m,
2176
2177
  (s == null ? void 0 : s.isSuccess) ?? !1,
2177
2178
  s == null ? void 0 : s.data,
@@ -2227,24 +2228,24 @@ function mm({
2227
2228
  n.manyCollection,
2228
2229
  n.manyField,
2229
2230
  p
2230
- ]) ?? [], o = xe.getStagedUnlinks(r), l = (xe.getStagedLinks(r) ?? []).map(String), c = new Set(t.map(String)), d = new Map(s.map((u) => [String(u[n.junctionField]), u])), g = /* @__PURE__ */ new Set([
2231
+ ]) ?? [], o = Se.getStagedUnlinks(r), l = (Se.getStagedLinks(r) ?? []).map(String), c = new Set(t.map(String)), d = new Map(s.map((u) => [String(u[n.junctionField]), u])), g = /* @__PURE__ */ new Set([
2231
2232
  ...s.filter((u) => !o.has(u.id)).map((u) => String(u[n.junctionField])),
2232
2233
  ...l
2233
2234
  ]);
2234
2235
  for (const u of c) {
2235
2236
  if (g.has(u)) continue;
2236
2237
  const f = d.get(u);
2237
- f && o.has(f.id) ? xe.unstageUnlink(r, f.id) : xe.stageLink(r, u);
2238
+ f && o.has(f.id) ? Se.unstageUnlink(r, f.id) : Se.stageLink(r, u);
2238
2239
  }
2239
2240
  for (const u of g) {
2240
2241
  if (c.has(u)) continue;
2241
2242
  const f = d.get(u);
2242
- f && !o.has(f.id) ? xe.stageUnlink(r, f.id) : l.includes(u) && xe.unstageLink(r, u);
2243
+ f && !o.has(f.id) ? Se.stageUnlink(r, f.id) : l.includes(u) && Se.unstageLink(r, u);
2243
2244
  }
2244
2245
  qe.current.add(e), On(!0);
2245
2246
  },
2246
- [D, i, p, X, xe]
2247
- ), Jd = A(() => {
2247
+ [D, i, p, X, Se]
2248
+ ), Gd = A(() => {
2248
2249
  const e = { ...M };
2249
2250
  for (const [t, n] of Object.entries(Qe))
2250
2251
  n != null && n.known && n.ids.length > 0 && (e[t] = n.ids);
@@ -2256,7 +2257,7 @@ function mm({
2256
2257
  rn.current += 1;
2257
2258
  try {
2258
2259
  for (const n of t) {
2259
- for (const r of n.ids) xe.unstageLink(n.stagingKey, r);
2260
+ for (const r of n.ids) Se.unstageLink(n.stagingKey, r);
2260
2261
  Fn.current.get(n.parent) === e && Fn.current.delete(n.parent);
2261
2262
  }
2262
2263
  } finally {
@@ -2264,7 +2265,7 @@ function mm({
2264
2265
  }
2265
2266
  return Ms.current.delete(e), t.map((n) => ({ parent: n.parent, ids: n.ids.map(String) }));
2266
2267
  },
2267
- [xe]
2268
+ [Se]
2268
2269
  ), oo = ce(
2269
2270
  (e, t, n, r) => {
2270
2271
  if (r.length === 0) return;
@@ -2272,7 +2273,7 @@ function mm({
2272
2273
  s.push({ parent: t, stagingKey: n, ids: r }), Ms.current.set(e, s), Fn.current.set(t, e);
2273
2274
  },
2274
2275
  []
2275
- ), Gd = ce(
2276
+ ), Jd = ce(
2276
2277
  (e, t, n = 0, r, s) => {
2277
2278
  if (t == null || t === "" || n > 3) return;
2278
2279
  const o = s ?? e;
@@ -2322,7 +2323,7 @@ function mm({
2322
2323
  continue;
2323
2324
  }
2324
2325
  const Z = String(oe.filter_column);
2325
- let G = [];
2326
+ let J = [];
2326
2327
  if (Z.includes(".")) {
2327
2328
  const [E, V] = [
2328
2329
  Z.slice(0, Z.indexOf(".")),
@@ -2335,7 +2336,7 @@ function mm({
2335
2336
  (fe) => fe.one_collection === h && fe.one_field === E
2336
2337
  );
2337
2338
  if (!(B != null && B.many_collection) || !B.many_field) continue;
2338
- G = (await R.request(
2339
+ J = (await R.request(
2339
2340
  se(`/items/${B.many_collection}`, {
2340
2341
  filter: JSON.stringify({ [B.many_field]: { _eq: t } }),
2341
2342
  limit: 200,
@@ -2352,7 +2353,7 @@ function mm({
2352
2353
  (B) => B.one_collection === h && B.one_field === Z && !B.junction_field
2353
2354
  );
2354
2355
  if (V != null && V.many_collection && V.many_field)
2355
- G = (await R.request(
2356
+ J = (await R.request(
2356
2357
  se(`/items/${V.many_collection}`, {
2357
2358
  filter: JSON.stringify({ [V.many_field]: { _eq: t } }),
2358
2359
  limit: 50,
@@ -2360,7 +2361,7 @@ function mm({
2360
2361
  })
2361
2362
  ).then((re) => re.data ?? []).catch(() => [])).map((re) => String(re.id)).filter((re) => re !== "null");
2362
2363
  else if (E != null && E.many_collection && E.many_field)
2363
- G = (await R.request(
2364
+ J = (await R.request(
2364
2365
  se(`/items/${E.many_collection}`, {
2365
2366
  filter: JSON.stringify({ [E.many_field]: { _eq: t } }),
2366
2367
  limit: 200,
@@ -2371,10 +2372,10 @@ function mm({
2371
2372
  const B = await $i(h, String(t), [Z]).catch(
2372
2373
  () => null
2373
2374
  ), re = B == null ? void 0 : B[Z];
2374
- re != null && re !== "" && (G = [String(re)]);
2375
+ re != null && re !== "" && (J = [String(re)]);
2375
2376
  }
2376
2377
  }
2377
- if (G = [...new Set(G)], G.length === 0) continue;
2378
+ if (J = [...new Set(J)], J.length === 0) continue;
2378
2379
  const K = oe.parent_field;
2379
2380
  if (ie.has(K)) {
2380
2381
  const E = ie.get(K), V = new Set(l(K));
@@ -2382,26 +2383,26 @@ function mm({
2382
2383
  const B = (j ?? []).find((Re) => Re.field === K), re = (S = Un(
2383
2384
  (B == null ? void 0 : B.options) ?? null
2384
2385
  )) == null ? void 0 : S.max_values;
2385
- if (re != null && G.length > re) {
2386
- const Re = fm((y = Bd.current.get(o)) == null ? void 0 : y[K], G);
2386
+ if (re != null && J.length > re) {
2387
+ const Re = fm((y = Bd.current.get(o)) == null ? void 0 : y[K], J);
2387
2388
  if (Re.length === 0 || Re.length > re) continue;
2388
- G = Re;
2389
+ J = Re;
2389
2390
  }
2390
2391
  const fe = [];
2391
2392
  rn.current += 1;
2392
2393
  try {
2393
- for (const Re of G)
2394
- V.has(Re) || (xe.stageLink(E.stagingKey, Re), fe.push(Re));
2394
+ for (const Re of J)
2395
+ V.has(Re) || (Se.stageLink(E.stagingKey, Re), fe.push(Re));
2395
2396
  } finally {
2396
2397
  rn.current -= 1;
2397
2398
  }
2398
2399
  oo(o, K, E.stagingKey, fe);
2399
- for (const Re of G)
2400
+ for (const Re of J)
2400
2401
  (T = wt.current) == null || T.call(wt, K, Re, n + 1, c, o);
2401
- } else if (G.length === 1) {
2402
+ } else if (J.length === 1) {
2402
2403
  const E = U.current[K];
2403
2404
  if (E != null && E !== "") continue;
2404
- const V = G[0];
2405
+ const V = J[0];
2405
2406
  U.current = { ...U.current, [K]: V }, pt((B) => ({ ...B, [K]: V })), Ts([K]), Tt.current.has(o) ? Tt.current.add(K) : On(!0), (Q = xr.current) == null || Q.call(xr, K, V, 1), Fn.current.set(K, o), ts.current.set(K, { source: o, value: V }), (Y = wt.current) == null || Y.call(wt, K, V, n + 1, c, o);
2406
2407
  }
2407
2408
  } catch {
@@ -2413,14 +2414,14 @@ function mm({
2413
2414
  D,
2414
2415
  i,
2415
2416
  ie,
2416
- xe,
2417
+ Se,
2417
2418
  R,
2418
2419
  is,
2419
2420
  oo,
2420
2421
  Ts
2421
2422
  ]
2422
- ), wt = $(Gd);
2423
- wt.current = Gd;
2423
+ ), wt = $(Jd);
2424
+ wt.current = Jd;
2424
2425
  const jn = ce(
2425
2426
  (e, t, n = 0, r = !1) => {
2426
2427
  if (!(t == null || t === "") && !(n > 2))
@@ -2444,7 +2445,7 @@ function mm({
2444
2445
  )
2445
2446
  ].filter(Boolean), h = Object.keys(u).some((v) => ie.has(v));
2446
2447
  f.length === 0 && !h || $i(l.source_collection, t, f).catch(() => $i(l.source_collection, t, ["id"])).then(async (v) => {
2447
- var G, K;
2448
+ var J, K;
2448
2449
  const S = v;
2449
2450
  if (!S) return;
2450
2451
  const y = {}, T = Object.entries(u), Q = T.some(
@@ -2488,7 +2489,7 @@ function mm({
2488
2489
  rn.current += 1;
2489
2490
  try {
2490
2491
  for (const Zt of B)
2491
- fe.has(String(Zt)) || (xe.stageLink(re.stagingKey, Zt), ot.push(String(Zt)));
2492
+ fe.has(String(Zt)) || (Se.stageLink(re.stagingKey, Zt), ot.push(String(Zt)));
2492
2493
  } finally {
2493
2494
  rn.current -= 1;
2494
2495
  }
@@ -2507,7 +2508,7 @@ function mm({
2507
2508
  const Re = await C(fe);
2508
2509
  if (Re.length === 1) y[E] = Re[0];
2509
2510
  else {
2510
- const fn = Bv(d[E], Re);
2511
+ const fn = Wv(d[E], Re);
2511
2512
  fn !== void 0 && (y[E] = fn);
2512
2513
  }
2513
2514
  }
@@ -2522,7 +2523,7 @@ function mm({
2522
2523
  if (re = S[fe], re != null && re !== "") break;
2523
2524
  if (re == null || re === "") {
2524
2525
  const fe = U.current[E];
2525
- if (!(fe == null || fe === "") && ((G = ts.current.get(E)) == null ? void 0 : G.source) !== e) continue;
2526
+ if (!(fe == null || fe === "") && ((J = ts.current.get(E)) == null ? void 0 : J.source) !== e) continue;
2526
2527
  }
2527
2528
  y[E] = re ?? null;
2528
2529
  }
@@ -2549,7 +2550,7 @@ function mm({
2549
2550
  j,
2550
2551
  R,
2551
2552
  ie,
2552
- xe,
2553
+ Se,
2553
2554
  is,
2554
2555
  oo
2555
2556
  ]
@@ -2564,38 +2565,38 @@ function mm({
2564
2565
  const Zd = ce(
2565
2566
  (e, t, n = !1) => {
2566
2567
  var c, d;
2567
- const { scalar: r, alias: s } = Uv(
2568
+ const { scalar: r, alias: s } = Jv(
2568
2569
  e,
2569
2570
  new Set(ie.keys())
2570
2571
  ), o = {};
2571
2572
  for (const [g, u] of Object.entries(r))
2572
2573
  t !== void 0 && (br.current.get(g) ?? 0) > t || (o[g] = u, t !== void 0 && br.current.set(g, t));
2573
- const l = Hv(s, Qe);
2574
+ const l = Gv(s, Qe);
2574
2575
  for (const [g, u] of Object.entries(l)) {
2575
2576
  const f = ie.get(g);
2576
2577
  if (!f) continue;
2577
- const h = Qv(u, (c = sr.current[g]) == null ? void 0 : c.ids);
2578
+ const h = Hv(u, (c = sr.current[g]) == null ? void 0 : c.ids);
2578
2579
  if (n && h.length > 0) {
2579
2580
  const v = (((d = sr.current[g]) == null ? void 0 : d.ids) ?? []).map(String), S = Hi.current(/* @__PURE__ */ new Map([[f.stagingKey, v]])).get(f.stagingKey);
2580
2581
  v.every((T) => S == null ? void 0 : S.has(T)) && Tt.current.add(g);
2581
- const y = Gr.current.get(f.stagingKey) ?? /* @__PURE__ */ new Set();
2582
+ const y = Jr.current.get(f.stagingKey) ?? /* @__PURE__ */ new Set();
2582
2583
  for (const T of h) y.add(String(T));
2583
- Gr.current.set(f.stagingKey, y);
2584
+ Jr.current.set(f.stagingKey, y);
2584
2585
  }
2585
2586
  Ot.current += 1;
2586
2587
  try {
2587
- for (const v of h) xe.stageLink(f.stagingKey, v);
2588
+ for (const v of h) Se.stageLink(f.stagingKey, v);
2588
2589
  } finally {
2589
2590
  Ot.current -= 1;
2590
2591
  }
2591
2592
  }
2592
2593
  if (Object.keys(o).length > 0) {
2593
- const g = Mv(U.current, o);
2594
+ const g = Dv(U.current, o);
2594
2595
  if (U.current = g, pt(g), Ts(Object.keys(o)), n) for (const u of Object.keys(o)) Tt.current.add(u);
2595
2596
  for (const [u, f] of Object.entries(o)) jn(u, f);
2596
2597
  }
2597
2598
  },
2598
- [ie, Qe, xe, jn]
2599
+ [ie, Qe, Se, jn]
2599
2600
  ), ao = $({});
2600
2601
  z(() => {
2601
2602
  const e = ao.current;
@@ -2603,7 +2604,7 @@ function mm({
2603
2604
  for (const t of Object.values(e)) clearTimeout(t);
2604
2605
  };
2605
2606
  }, []);
2606
- const Xd = $(/* @__PURE__ */ new Map()), Sp = (e, t, n) => zv(Xd.current, e, t, n), Ws = ce(
2607
+ const Xd = $(/* @__PURE__ */ new Map()), Sp = (e, t, n) => Qv(Xd.current, e, t, n), Ws = ce(
2607
2608
  (e, t, n) => {
2608
2609
  if (I) return;
2609
2610
  const r = lm(Br, e);
@@ -2700,13 +2701,13 @@ function mm({
2700
2701
  d.parent_field === e && d.clear_on_parent_change && (n[l.field] = null);
2701
2702
  } catch {
2702
2703
  }
2703
- U.current = n, pt(n), Tt.current.delete(e), Ui.current(e), On(m ? !0 : Ov(n, $e.current));
2704
+ U.current = n, pt(n), Tt.current.delete(e), Ui.current(e), On(m ? !0 : jv(n, $e.current));
2704
2705
  const r = t == null || t === "";
2705
- r || Gi.current.add(e), hn((l) => {
2706
+ r || Ji.current.add(e), hn((l) => {
2706
2707
  const c = { ...l }, d = (j ?? []).find((g) => g.field === e);
2707
- return d != null && d.required && r && Gi.current.has(e) ? c[e] = "This field is required" : delete c[e], c;
2708
+ return d != null && d.required && r && Ji.current.has(e) ? c[e] = "This field is required" : delete c[e], c;
2708
2709
  });
2709
- const s = Av(j ?? [], n, e);
2710
+ const s = Tv(j ?? [], n, e);
2710
2711
  Object.keys(s).length > 0 && hn((l) => {
2711
2712
  const c = { ...l };
2712
2713
  for (const [d, g] of Object.entries(s))
@@ -2765,7 +2766,7 @@ function mm({
2765
2766
  },
2766
2767
  [ja, ie]
2767
2768
  ), sc = A(
2768
- () => B0({
2769
+ () => W0({
2769
2770
  client: R,
2770
2771
  collection: i,
2771
2772
  fields: j ?? [],
@@ -2805,9 +2806,9 @@ function mm({
2805
2806
  const s = (u) => Array.isArray(u) ? u : Cl(u) ? [] : [u], o = s(t), l = new Set(o.map(String)), c = s(n).map(String).filter((u) => !l.has(u)), d = (lo.current.get(e) ?? ((g = sr.current[e]) == null ? void 0 : g.ids) ?? []).map(String);
2806
2807
  rn.current += 1;
2807
2808
  try {
2808
- for (const u of c) xe.unstageLink(r.stagingKey, u);
2809
+ for (const u of c) Se.unstageLink(r.stagingKey, u);
2809
2810
  for (const u of o)
2810
- d.includes(String(u)) || xe.stageLink(r.stagingKey, u);
2811
+ d.includes(String(u)) || Se.stageLink(r.stagingKey, u);
2811
2812
  } finally {
2812
2813
  rn.current -= 1;
2813
2814
  }
@@ -2815,8 +2816,8 @@ function mm({
2815
2816
  .../* @__PURE__ */ new Set([...d.filter((u) => !c.includes(u)), ...l])
2816
2817
  ]);
2817
2818
  },
2818
- [ie, xe]
2819
- ), co = Ob({
2819
+ [ie, Se]
2820
+ ), co = jb({
2820
2821
  collection: i,
2821
2822
  isNew: m,
2822
2823
  layoutAllows: (e) => nc.has(e),
@@ -2840,7 +2841,7 @@ function mm({
2840
2841
  },
2841
2842
  readValue: Fa,
2842
2843
  canFill: (e) => !qe.current.has(e) && !rc(e),
2843
- replaceable: (e, t) => Object.hasOwn(wa.current, e) && !rc(e) && Fb(t, wa.current[e]),
2844
+ replaceable: (e, t) => Object.hasOwn(wa.current, e) && !rc(e) && Ab(t, wa.current[e]),
2844
2845
  fieldLabel: (e) => {
2845
2846
  const t = (j ?? []).find((n) => n.field === e);
2846
2847
  return (t == null ? void 0 : t.label) || be(e);
@@ -2872,7 +2873,7 @@ function mm({
2872
2873
  }
2873
2874
  for (const [r, s] of Ms.current)
2874
2875
  if (Tt.current.has(r)) for (const o of s) n(o.stagingKey, o.ids);
2875
- for (const [r, s] of Gr.current) {
2876
+ for (const [r, s] of Jr.current) {
2876
2877
  const o = new Set((e.get(r) ?? []).map(String));
2877
2878
  n(
2878
2879
  r,
@@ -2881,7 +2882,7 @@ function mm({
2881
2882
  }
2882
2883
  return t;
2883
2884
  }, z(() => {
2884
- Tt.current.clear(), Gr.current.clear();
2885
+ Tt.current.clear(), Jr.current.clear();
2885
2886
  }, [i, p, m]);
2886
2887
  const [Aa, Rp] = P({}), Ft = A(
2887
2888
  () => D.filter(
@@ -2919,7 +2920,7 @@ function mm({
2919
2920
  const n = t.query.queryKey;
2920
2921
  if (n[0] !== "o2m-rows" || !e.has(`${String(n[1])}\0${String(n[2])}`)) return;
2921
2922
  const r = ["o2m-rows", n[1], n[2], p, ""];
2922
- jv(n, p, X.getQueryData(r), t.action.data) && X.invalidateQueries({ queryKey: r, exact: !0 });
2923
+ qv(n, p, X.getQueryData(r), t.action.data) && X.invalidateQueries({ queryKey: r, exact: !0 });
2923
2924
  });
2924
2925
  }, [X, p, m, Ft]);
2925
2926
  const qn = A(
@@ -2956,11 +2957,11 @@ function mm({
2956
2957
  }, [M]);
2957
2958
  const Sr = ce(
2958
2959
  (e, t) => {
2959
- Rp((n) => n[e] === t ? n : { ...n, [e]: t }), t > 0 && Gi.current.add(e), hn((n) => {
2960
+ Rp((n) => n[e] === t ? n : { ...n, [e]: t }), t > 0 && Ji.current.add(e), hn((n) => {
2960
2961
  const r = (j ?? []).find((o) => o.field === e);
2961
2962
  if (!(r != null && r.required)) return n;
2962
2963
  const s = { ...n };
2963
- return t === 0 ? Gi.current.has(e) && (s[e] = "This field is required") : delete s[e], s;
2964
+ return t === 0 ? Ji.current.has(e) && (s[e] = "This field is required") : delete s[e], s;
2964
2965
  });
2965
2966
  },
2966
2967
  [j]
@@ -2986,12 +2987,12 @@ function mm({
2986
2987
  const e = oc.current;
2987
2988
  oc.current = gt;
2988
2989
  const t = Wt || Es.size > 0;
2989
- e || !gt || !t || m || I || p == null || Ry(i, String(p)) || _e.warning(Oy(gt), {
2990
+ e || !gt || !t || m || I || p == null || Ry(i, String(p)) || ge.warning(Oy(gt), {
2990
2991
  id: Fy(i, String(p)),
2991
2992
  duration: 3e4
2992
2993
  });
2993
2994
  }, [gt, Wt, Es.size, m, I, i, p]);
2994
- const Qs = !I && Jl && !m && !ud && !!(x != null && x.item_locking_enabled) && Ur && !bt && (!gt || Nr), Fp = Af().active, {
2995
+ const Qs = !I && Gl && !m && !ud && !!(x != null && x.item_locking_enabled) && Ur && !bt && (!gt || Nr), Fp = Af().active, {
2995
2996
  lockHolder: Tn,
2996
2997
  acquired: Ea,
2997
2998
  isReadOnly: ac,
@@ -3011,7 +3012,7 @@ function mm({
3011
3012
  released: Pa,
3012
3013
  relock: dc,
3013
3014
  claim: zp
3014
- } = ov(i, m ? void 0 : p, Qs, {
3015
+ } = lv(i, m ? void 0 : p, Qs, {
3015
3016
  lazy: !0,
3016
3017
  active: Si && Fp,
3017
3018
  // a10-4: a clean form (saved, or edits undone) lets the lock go. A line
@@ -3036,12 +3037,12 @@ function mm({
3036
3037
  var e;
3037
3038
  Wt && ((e = An.current) == null || e.call(An));
3038
3039
  }, [Wt, Qs]);
3039
- const lt = (w == null ? void 0 : w.assignments) ?? [], La = lt.some((e) => e.lock_conditions), os = !!(x != null && x.addendums_enabled) && !m, fo = !m && Uy(vr), mo = !m && Jy(vr), cc = () => R.request(se("/users/me")).then((e) => e.data ?? null), Ma = La || os || fo || td.role, { data: Oe, isError: uc } = $t({
3040
+ const lt = (w == null ? void 0 : w.assignments) ?? [], La = lt.some((e) => e.lock_conditions), os = !!(x != null && x.addendums_enabled) && !m, fo = !m && Uy(vr), mo = !m && Gy(vr), cc = () => R.request(se("/users/me")).then((e) => e.data ?? null), Ma = La || os || fo || td.role, { data: Oe, isError: uc } = $t({
3040
3041
  queryKey: ["current-user-me"],
3041
3042
  queryFn: cc,
3042
3043
  staleTime: 5 * 6e4,
3043
3044
  enabled: Ma
3044
- }), po = R0(i, m ? null : p, {
3045
+ }), po = F0(i, m ? null : p, {
3045
3046
  enabled: !Be && zt,
3046
3047
  eager: Rt
3047
3048
  }), ho = (Dt == null ? void 0 : Dt.stateKey) ?? null, fc = () => R.request(se(`/pipelines/instance/${i}/${p}`)).then(
@@ -3054,7 +3055,7 @@ function mm({
3054
3055
  enabled: Ka && !m && zt && !ho
3055
3056
  }), hc = w !== void 0;
3056
3057
  z(() => {
3057
- !hc || Be || yb(i, { role: Ma, state: Ka });
3058
+ !hc || Be || bb(i, { role: Ma, state: Ka });
3058
3059
  }, [hc, Be, i, Ma, Ka]), z(() => {
3059
3060
  if (m || Be) return;
3060
3061
  const e = Vf(i);
@@ -3251,14 +3252,14 @@ function mm({
3251
3252
  t.rows.map((l) => {
3252
3253
  const c = { ...l };
3253
3254
  for (const d of s) {
3254
- const g = p0(String(d.computed_formula), c);
3255
+ const g = g0(String(d.computed_formula), c);
3255
3256
  g !== null && (c[d.field] = g);
3256
3257
  }
3257
3258
  return c;
3258
3259
  })
3259
3260
  );
3260
3261
  }), e;
3261
- }, [cs, za]), [Sc, Up] = P(() => /* @__PURE__ */ new Set()), Nc = $(() => !1), Jp = ce((e, t) => {
3262
+ }, [cs, za]), [Sc, Up] = P(() => /* @__PURE__ */ new Set()), Nc = $(() => !1), Gp = ce((e, t) => {
3262
3263
  if (Up((n) => {
3263
3264
  if (n.has(e) === t) return n;
3264
3265
  const r = new Set(n);
@@ -3287,25 +3288,25 @@ function mm({
3287
3288
  const e = /* @__PURE__ */ new Map();
3288
3289
  for (const t of j ?? []) {
3289
3290
  if (t.computed_type !== "rollup" || !t.computed_formula) continue;
3290
- const n = N0(t.computed_formula);
3291
- if (n && !$0(M, n)) continue;
3291
+ const n = C0(t.computed_formula);
3292
+ if (n && !R0(M, n)) continue;
3292
3293
  const r = new Map(ls);
3293
3294
  for (const [o, l] of xc)
3294
3295
  (!r.has(o) || kc.has(o)) && r.set(o, l);
3295
- const s = C0(Wf(t.computed_formula), r);
3296
+ const s = O0(Wf(t.computed_formula), r);
3296
3297
  s !== null && e.set(t.field, s);
3297
3298
  }
3298
3299
  return e;
3299
3300
  }, [j, ls, xc, kc, M]), Wn = A(
3300
3301
  () => as ? { ...M, ...as } : M,
3301
3302
  [M, as]
3302
- ), Je = He !== "original", It = Je ? "nivaro_addendums" : i, Ut = Je ? He : p, Gp = A(
3303
- () => Je ? de ?? null : de ? { ...de, ...M } : M,
3304
- [Je, de, M]
3305
- ), Yp = rb(
3303
+ ), Ge = He !== "original", It = Ge ? "nivaro_addendums" : i, Ut = Ge ? He : p, Jp = A(
3304
+ () => Ge ? de ?? null : de ? { ...de, ...M } : M,
3305
+ [Ge, de, M]
3306
+ ), Yp = ib(
3306
3307
  i,
3307
3308
  m || I ? null : String(p),
3308
- Gp,
3309
+ Jp,
3309
3310
  { fieldsLocked: !!gt && !Nr, valuesPending: !de }
3310
3311
  ), [Zp, Rc] = P(null), ir = Ht.find((e) => e.id === He), Wa = !!ir && (["approved", "reverted"].includes(ir.status) || !Object.values(ir.data ?? {}).some((e) => Array.isArray(e) && e.length > 0)), { data: Qa } = $t({
3311
3312
  queryKey: ["addendum-lines", He],
@@ -3340,7 +3341,7 @@ function mm({
3340
3341
  (e) => !e.hidden && !e.field.startsWith("__") && !e.field.includes(".") && !D.some((t) => t.one_collection === i && t.one_field === e.field)
3341
3342
  ).map((e) => e.field).slice(0, 40),
3342
3343
  [j, D, i]
3343
- ), Se = A(() => {
3344
+ ), xe = A(() => {
3344
3345
  if (!j) return [];
3345
3346
  if (Bn && w === void 0) return [];
3346
3347
  const e = [...j].sort((s, o) => (s.sort ?? 0) - (o.sort ?? 0)), t = /* @__PURE__ */ new Set(), n = e.filter((s) => t.has(s.field) ? !1 : (t.add(s.field), !0)), r = rt.active ? n.filter((s) => !rt.hidden.has(s.field)) : n;
@@ -3458,18 +3459,18 @@ function mm({
3458
3459
  for (const n of e)
3459
3460
  !n.group_key || Tr(n.field) || (t[n.group_key] || (t[n.group_key] = []), t[n.group_key].find((r) => r.field === n.field) || t[n.group_key].push(n));
3460
3461
  return t;
3461
- }, [j]), Jt = A(
3462
- () => Se.filter(
3462
+ }, [j]), Gt = A(
3463
+ () => xe.filter(
3463
3464
  (e) => !e.group_key && !e.hidden && !tn.has(e.field) && !Tr(e.field) && (Bt === null || e.layout_assigned !== !1)
3464
3465
  ),
3465
- [Se, Bt]
3466
+ [xe, Bt]
3466
3467
  );
3467
3468
  A(
3468
- () => Se.filter((e) => tn.has(e.field) || e.readonly),
3469
- [Se]
3469
+ () => xe.filter((e) => tn.has(e.field) || e.readonly),
3470
+ [xe]
3470
3471
  );
3471
3472
  const wo = A(() => Ce.filter((e) => e.type === "container"), [Ce]), Cr = ce(
3472
- (e) => i_(e.visible_when, M),
3473
+ (e) => a_(e.visible_when, M),
3473
3474
  [M]
3474
3475
  ), [Hs, Ac] = P(() => /* @__PURE__ */ new Set());
3475
3476
  z(() => {
@@ -3495,21 +3496,21 @@ function mm({
3495
3496
  ), qc = A(
3496
3497
  () => Ce.filter((e) => e.type === "tab").sort((e, t) => e.sort - t.sort),
3497
3498
  [Ce]
3498
- ), Gt = A(
3499
+ ), Jt = A(
3499
3500
  () => Ce.filter((e) => e.type === "section" || e.type === "metadata"),
3500
3501
  [Ce]
3501
3502
  ), Tc = wo.length > 0, kt = jt.length > 0, ee = w == null ? void 0 : w.layout, Or = ee ? !!ee.ai_enabled : !0, Ha = A(() => {
3502
3503
  if ($n) return [];
3503
3504
  const e = j ?? [];
3504
- return bb({
3505
+ return wb({
3505
3506
  groups: Ce.filter((t) => t.type === "tab" && !t.container_id),
3506
3507
  values: M,
3507
3508
  fields: e,
3508
- choices: Ib(e),
3509
+ choices: Pb(e),
3509
3510
  quiet: Ny(
3510
3511
  ee == null ? void 0 : ee.conditions
3511
3512
  ),
3512
- readable: (t) => vb(
3513
+ readable: (t) => kb(
3513
3514
  (Te[t] ?? []).map((n) => n.field),
3514
3515
  na,
3515
3516
  m || !!Be
@@ -3525,9 +3526,9 @@ function mm({
3525
3526
  na,
3526
3527
  m,
3527
3528
  Be
3528
- ]), Fr = A(() => ny(ee), [ee]), Ic = Q_(Fr);
3529
- V_(Ic === "compact");
3530
- const Qn = Vb({
3529
+ ]), Fr = A(() => ny(ee), [ee]), Ic = H_(Fr);
3530
+ U_(Ic === "compact");
3531
+ const Qn = Ub({
3531
3532
  collection: i,
3532
3533
  layoutId: (ee == null ? void 0 : ee.id) ?? null,
3533
3534
  userId: Le,
@@ -3540,22 +3541,22 @@ function mm({
3540
3541
  z(() => {
3541
3542
  if (!I || !vn || !In || Ec.current) return;
3542
3543
  const e = In.clientWidth;
3543
- e && (Ec.current = !0, Xf(Le) === null && e - 256 < ev && us(!0));
3544
+ e && (Ec.current = !0, Xf(Le) === null && e - 256 < nv && us(!0));
3544
3545
  }, [I, vn, In, Le]);
3545
- const [Js, dh] = P(!1), Gs = $(null);
3546
+ const [Gs, dh] = P(!1), Js = $(null);
3546
3547
  z(() => {
3547
3548
  if (I || !vn || !In || typeof ResizeObserver > "u") return;
3548
3549
  const e = () => {
3549
3550
  const n = In.clientWidth;
3550
- n && dh(gb(n));
3551
+ n && dh(_b(n));
3551
3552
  };
3552
3553
  e();
3553
3554
  const t = new ResizeObserver(e);
3554
3555
  return t.observe(In), () => t.disconnect();
3555
3556
  }, [I, vn, In]), z(() => {
3556
- Js ? (Gs.current === null && (Gs.current = wn), us(!0)) : Gs.current !== null && (us(Gs.current), Gs.current = null);
3557
- }, [Js]);
3558
- const [Ja, Pc] = P(null);
3557
+ Gs ? (Js.current === null && (Js.current = wn), us(!0)) : Js.current !== null && (us(Js.current), Js.current = null);
3558
+ }, [Gs]);
3559
+ const [Ga, Pc] = P(null);
3559
3560
  z(() => {
3560
3561
  if (!I || !vn || !In) {
3561
3562
  Pc(null);
@@ -3570,18 +3571,18 @@ function mm({
3570
3571
  const r = new ResizeObserver(n);
3571
3572
  return r.observe(t), () => r.disconnect();
3572
3573
  }, [I, vn, In]);
3573
- const [ch, Lc] = P(null), [Mc, Kc] = P(/* @__PURE__ */ new Set()), [uh, fh] = P(() => /* @__PURE__ */ new Set()), Ga = $(!1);
3574
+ const [ch, Lc] = P(null), [Mc, Kc] = P(/* @__PURE__ */ new Set()), [uh, fh] = P(() => /* @__PURE__ */ new Set()), Ja = $(!1);
3574
3575
  z(() => {
3575
3576
  if (!ko) {
3576
- Ga.current = !1;
3577
+ Ja.current = !1;
3577
3578
  return;
3578
3579
  }
3579
- if (ko && !Ga.current) {
3580
- Ga.current = !0;
3581
- const e = Gt.find((t) => !t.is_collapsed) ?? Gt[0];
3580
+ if (ko && !Ja.current) {
3581
+ Ja.current = !0;
3582
+ const e = Jt.find((t) => !t.is_collapsed) ?? Jt[0];
3582
3583
  e && Lc(e.id);
3583
3584
  }
3584
- }, [ko, Gt]);
3585
+ }, [ko, Jt]);
3585
3586
  const Dc = $(null), xo = (e) => {
3586
3587
  const t = document.querySelector(`[data-field="${e}"]`);
3587
3588
  t && (t.scrollIntoView({ behavior: "smooth", block: "center" }), t.style.transition = "box-shadow 0.15s ease", t.style.boxShadow = "0 0 0 2px rgb(var(--nvr-cyan-rgb, 0 206 255)), 0 0 0 5px rgb(var(--nvr-cyan-rgb, 0 206 255) / 0.25)", t.style.borderRadius = "12px", setTimeout(() => {
@@ -3591,10 +3592,10 @@ function mm({
3591
3592
  }, 1200));
3592
3593
  }, Bc = A(() => {
3593
3594
  const e = wy(w == null ? void 0 : w.layout, Rt);
3594
- return Gn && !I ? e : { schedule: !1, disablePickers: !1 };
3595
- }, [w == null ? void 0 : w.layout, Rt, Gn, I]), mh = A(
3596
- () => Se.filter((e) => !e.hidden && e.type !== "alias").map((e) => ({ field: e.field, label: e.label })),
3597
- [Se]
3595
+ return Jn && !I ? e : { schedule: !1, disablePickers: !1 };
3596
+ }, [w == null ? void 0 : w.layout, Rt, Jn, I]), mh = A(
3597
+ () => xe.filter((e) => !e.hidden && e.type !== "alias").map((e) => ({ field: e.field, label: e.label })),
3598
+ [xe]
3598
3599
  ), zc = A(() => {
3599
3600
  const e = new Map(
3600
3601
  D.filter((n) => n.many_collection === i && !n.junction_field && n.many_field).map((n) => [n.many_field, n.one_collection])
@@ -3605,7 +3606,7 @@ function mm({
3605
3606
  const r = n.one_field ?? n.many_collection;
3606
3607
  t.has(r) || t.set(r, { target: n.many_collection, fk: n.many_field });
3607
3608
  }
3608
- return Se.filter((n) => !n.hidden && !n.field.startsWith("__")).map((n) => {
3609
+ return xe.filter((n) => !n.hidden && !n.field.startsWith("__")).map((n) => {
3609
3610
  var g;
3610
3611
  const r = n.label || be(n.field), s = ie.get(n.field);
3611
3612
  if (s) {
@@ -3655,7 +3656,7 @@ function mm({
3655
3656
  return { field: n.field, label: r, group: null, value: d };
3656
3657
  });
3657
3658
  }, [
3658
- Se,
3659
+ xe,
3659
3660
  M,
3660
3661
  D,
3661
3662
  i,
@@ -3729,7 +3730,7 @@ function mm({
3729
3730
  return "";
3730
3731
  }
3731
3732
  }, r = [];
3732
- for (const c of Se) {
3733
+ for (const c of xe) {
3733
3734
  if (c.hidden || c.field.startsWith("__") || c.field === "id") continue;
3734
3735
  const d = c.label ?? be(c.field), g = ie.get(c.field);
3735
3736
  if (g) {
@@ -3784,8 +3785,8 @@ ${window.location.href}
3784
3785
  ${r.join(`
3785
3786
  `)}`;
3786
3787
  await navigator.clipboard.writeText(o).then(
3787
- () => _e.success("Summary copied"),
3788
- () => _e.error("Could not copy")
3788
+ () => ge.success("Summary copied"),
3789
+ () => ge.error("Could not copy")
3789
3790
  );
3790
3791
  }, Vc = $(!1);
3791
3792
  z(() => {
@@ -3801,7 +3802,7 @@ ${r.join(`
3801
3802
  fs.current(e);
3802
3803
  } catch {
3803
3804
  }
3804
- }, []), Za = P_({
3805
+ }, []), Za = M_({
3805
3806
  collection: i,
3806
3807
  itemId: p,
3807
3808
  // After the record answered (army 10: the comments read 404'd for a missing record).
@@ -3907,7 +3908,7 @@ ${r.join(`
3907
3908
  };
3908
3909
  return window.addEventListener("nvr:record-focus", e), () => window.removeEventListener("nvr:record-focus", e);
3909
3910
  }, [i, p, m]);
3910
- const [el, Jc] = P(() => /* @__PURE__ */ new Map()), [_h, bh] = P(
3911
+ const [el, Gc] = P(() => /* @__PURE__ */ new Map()), [_h, bh] = P(
3911
3912
  () => /* @__PURE__ */ new Map()
3912
3913
  ), vh = (e, t) => {
3913
3914
  var n;
@@ -3916,11 +3917,11 @@ ${r.join(`
3916
3917
  var n;
3917
3918
  return ((n = _h.get(e.id)) == null ? void 0 : n.has(t)) ?? !1;
3918
3919
  }, Ar = (e, t) => {
3919
- Jc((n) => new Map(n).set(e.id, t)), bh((n) => {
3920
+ Gc((n) => new Map(n).set(e.id, t)), bh((n) => {
3920
3921
  const r = n.get(e.id) ?? /* @__PURE__ */ new Set();
3921
3922
  return r.has(t) ? n : new Map(n).set(e.id, /* @__PURE__ */ new Set([...r, t]));
3922
3923
  });
3923
- }, [Ze, Gc] = P(() => {
3924
+ }, [Ze, Jc] = P(() => {
3924
3925
  var e;
3925
3926
  try {
3926
3927
  return localStorage.getItem(`nvr_tab_${i}`) ?? ((e = jt[0]) == null ? void 0 : e.key) ?? "__general__";
@@ -3951,7 +3952,7 @@ ${r.join(`
3951
3952
  return n == null || n.observe(e), () => n == null ? void 0 : n.disconnect();
3952
3953
  }, [Ze]);
3953
3954
  const At = (e) => {
3954
- if (Gc(e), Zc((t) => {
3955
+ if (Jc(e), Zc((t) => {
3955
3956
  if (t.has(e)) return t;
3956
3957
  const n = new Set(t);
3957
3958
  return n.add(e), n;
@@ -3970,13 +3971,13 @@ ${r.join(`
3970
3971
  }
3971
3972
  nl();
3972
3973
  };
3973
- l_({
3974
+ c_({
3974
3975
  collection: i,
3975
3976
  itemId: m || I || !Pr ? null : String(p),
3976
3977
  step: kt ? Ze : null,
3977
3978
  setStep: At
3978
3979
  });
3979
- const No = Rb({
3980
+ const No = Fb({
3980
3981
  enabled: !I,
3981
3982
  layoutId: Bt != null ? Number(Bt) : null,
3982
3983
  collection: i,
@@ -3990,10 +3991,10 @@ ${r.join(`
3990
3991
  const we = A(() => {
3991
3992
  if (!kt) return [];
3992
3993
  const e = [];
3993
- (un ? Jt.length > 0 : Gt.length > 0) && e.push({ key: "__general__", label: "General" });
3994
+ (un ? Gt.length > 0 : Jt.length > 0) && e.push({ key: "__general__", label: "General" });
3994
3995
  for (const t of jt) e.push({ key: t.key, label: t.label });
3995
3996
  return e;
3996
- }, [kt, Gt, jt, un, Jt]), tu = (e) => {
3997
+ }, [kt, Jt, jt, un, Gt]), tu = (e) => {
3997
3998
  if (e === null || e === "__ungrouped__") {
3998
3999
  un && we.some((n) => n.key === "__general__") && At("__general__");
3999
4000
  return;
@@ -4008,7 +4009,7 @@ ${r.join(`
4008
4009
  nu.current = tu;
4009
4010
  const Ys = (Be == null ? void 0 : Be.reveal) ?? null;
4010
4011
  z(() => {
4011
- Ys && nu.current(Yb(Ys.target));
4012
+ Ys && nu.current(Xb(Ys.target));
4012
4013
  }, [Ys == null ? void 0 : Ys.seq]);
4013
4014
  const rl = I && !!((Zu = Be == null ? void 0 : Be.fold) != null && Zu.open), Zs = A(() => {
4014
4015
  const e = /* @__PURE__ */ new Map();
@@ -4019,9 +4020,9 @@ ${r.join(`
4019
4020
  ];
4020
4021
  for (const s of r)
4021
4022
  for (const o of Te[s] ?? []) e.has(o.field) || e.set(o.field, t++);
4022
- for (const s of Se) e.has(s.field) || e.set(s.field, t++);
4023
+ for (const s of xe) e.has(s.field) || e.set(s.field, t++);
4023
4024
  return e;
4024
- }, [Se, Te, kt, we]), kh = (e, t) => (Zs.get(e) ?? 1e9) - (Zs.get(t) ?? 1e9), ru = A(() => {
4025
+ }, [xe, Te, kt, we]), kh = (e, t) => (Zs.get(e) ?? 1e9) - (Zs.get(t) ?? 1e9), ru = A(() => {
4025
4026
  const e = Object.keys(nt);
4026
4027
  if (e.length === 0) return [];
4027
4028
  const t = (n) => {
@@ -4034,7 +4035,7 @@ ${r.join(`
4034
4035
  return s ? s.type === "tab" ? s.label ?? null : kt && we.some((l) => l.key === "__general__") ? "General" : s.label ?? null : null;
4035
4036
  };
4036
4037
  return e.sort((n, r) => (Zs.get(n) ?? 1e9) - (Zs.get(r) ?? 1e9)).map((n) => {
4037
- const r = Se.find((c) => c.field === n), s = nt[n], o = t(n);
4038
+ const r = xe.find((c) => c.field === n), s = nt[n], o = t(n);
4038
4039
  return {
4039
4040
  field: n,
4040
4041
  label: (s === cm && o && o !== "General" ? o : null) ?? ((r == null ? void 0 : r.label) || be(n)),
@@ -4042,12 +4043,12 @@ ${r.join(`
4042
4043
  location: o
4043
4044
  };
4044
4045
  });
4045
- }, [nt, Se, Te, Ce, kt, we, Zs]), su = $(!1);
4046
+ }, [nt, xe, Te, Ce, kt, we, Zs]), su = $(!1);
4046
4047
  z(() => {
4047
4048
  if (!(su.current || !kt))
4048
4049
  try {
4049
4050
  const e = new URL(window.location.href).searchParams.get("step");
4050
- e && we.some((t) => t.key === e) && (su.current = !0, Gc(e), Zc((t) => /* @__PURE__ */ new Set([...t, e])));
4051
+ e && we.some((t) => t.key === e) && (su.current = !0, Jc(e), Zc((t) => /* @__PURE__ */ new Set([...t, e])));
4051
4052
  } catch {
4052
4053
  }
4053
4054
  }, [kt, we]), z(() => {
@@ -4084,7 +4085,7 @@ ${r.join(`
4084
4085
  const o = el.get(r.id) ?? ((n = s[0]) == null ? void 0 : n.key), l = s.find((d) => d.key === o);
4085
4086
  if (!t(l)) continue;
4086
4087
  const c = s.find((d) => !t(d));
4087
- c && c.key !== o && Jc((d) => new Map(d).set(r.id, c.key));
4088
+ c && c.key !== o && Gc((d) => new Map(d).set(r.id, c.key));
4088
4089
  }
4089
4090
  }, [m, un, de, we, jt, Ze, Ce, el]);
4090
4091
  const xh = A(() => {
@@ -4097,7 +4098,7 @@ ${r.join(`
4097
4098
  const e = /* @__PURE__ */ new Set();
4098
4099
  for (const t of we) {
4099
4100
  if (m && !Yc.has(t.key)) continue;
4100
- (t.key === "__general__" ? un ? Jt : [...Jt, ...Gt.flatMap((s) => Te[s.key] ?? [])] : Te[t.key] ?? []).filter((s) => s.required && !s.hidden).every((s) => {
4101
+ (t.key === "__general__" ? un ? Gt : [...Gt, ...Jt.flatMap((s) => Te[s.key] ?? [])] : Te[t.key] ?? []).filter((s) => s.required && !s.hidden).every((s) => {
4101
4102
  if (ie.has(s.field)) {
4102
4103
  const l = Qe[s.field];
4103
4104
  return !l || l.ids.length > 0;
@@ -4113,8 +4114,8 @@ ${r.join(`
4113
4114
  return e;
4114
4115
  }, [
4115
4116
  we,
4116
- Jt,
4117
4117
  Gt,
4118
+ Jt,
4118
4119
  Te,
4119
4120
  M,
4120
4121
  m,
@@ -4127,7 +4128,7 @@ ${r.join(`
4127
4128
  ]);
4128
4129
  function Nh() {
4129
4130
  if (rh) {
4130
- const t = Ze === "__general__" ? un ? Jt : [...Jt, ...Gt.flatMap((r) => Te[r.key] ?? [])] : Te[Ze] ?? [], n = {};
4131
+ const t = Ze === "__general__" ? un ? Gt : [...Gt, ...Jt.flatMap((r) => Te[r.key] ?? [])] : Te[Ze] ?? [], n = {};
4131
4132
  for (const r of t)
4132
4133
  if (r.required && !r.hidden) {
4133
4134
  const s = M[r.field];
@@ -4182,9 +4183,9 @@ ${r.join(`
4182
4183
  }
4183
4184
  );
4184
4185
  if (!o.ok) throw new Error(await o.text());
4185
- e != null && e.silent || _e.success("PDF generated and attached"), e != null && e.addendumId ? X.invalidateQueries({ queryKey: ["m2m-items"] }) : Qf(X, [t]), X.invalidateQueries({ queryKey: ["items", i, p] }), e != null && e.addendumId && X.invalidateQueries({ queryKey: ["addendums", i, p] });
4186
+ e != null && e.silent || ge.success("PDF generated and attached"), e != null && e.addendumId ? X.invalidateQueries({ queryKey: ["m2m-items"] }) : Qf(X, [t]), X.invalidateQueries({ queryKey: ["items", i, p] }), e != null && e.addendumId && X.invalidateQueries({ queryKey: ["addendums", i, p] });
4186
4187
  } catch {
4187
- e != null && e.silent ? console.warn("[pdf] automatic regeneration failed") : _e.error("Failed to generate and attach PDF");
4188
+ e != null && e.silent ? console.warn("[pdf] automatic regeneration failed") : ge.error("Failed to generate and attach PDF");
4188
4189
  } finally {
4189
4190
  ad(!1);
4190
4191
  }
@@ -4204,7 +4205,7 @@ ${r.join(`
4204
4205
  filenameTemplate: t.filename_template ?? null
4205
4206
  });
4206
4207
  }, ps = (ut == null ? void 0 : ut.group_key) ?? null, ti = !!(ps && Ce.some((e) => e.key === ps)), Rh = () => /* @__PURE__ */ a(
4207
- yv,
4208
+ bv,
4208
4209
  {
4209
4210
  collection: It,
4210
4211
  item: Ut,
@@ -4261,12 +4262,12 @@ ${r.join(`
4261
4262
  return r;
4262
4263
  }
4263
4264
  return null;
4264
- }, [xt, j]), il = w_({
4265
+ }, [xt, j]), il = x_({
4265
4266
  collection: i,
4266
4267
  field: ud ? null : ni,
4267
4268
  draft: M,
4268
4269
  itemId: p,
4269
- staging: xe
4270
+ staging: Se
4270
4271
  }), Oo = A(() => {
4271
4272
  if (!xt) return [];
4272
4273
  const e = de ?? M;
@@ -4285,7 +4286,7 @@ ${r.join(`
4285
4286
  // The stale-record banner rides this read — one indexed row a minute without a live
4286
4287
  // socket, paused while the tab is hidden (react-query default).
4287
4288
  refetchInterval: Oh
4288
- }), [Fh, ri] = P(!1), [jh, lu] = P(!1), [Ah, du] = P(!1), [qh, Th] = P(null), [si, cu] = P(""), [uu, fu] = P(!1), [mu, pu] = P(!1), hu = Pb(
4289
+ }), [Fh, ri] = P(!1), [jh, lu] = P(!1), [Ah, du] = P(!1), [qh, Th] = P(null), [si, cu] = P(""), [uu, fu] = P(!1), [mu, pu] = P(!1), hu = Mb(
4289
4290
  i,
4290
4291
  String(p ?? ""),
4291
4292
  // Waits for the record itself: the check of a record that turns out not
@@ -4299,7 +4300,7 @@ ${r.join(`
4299
4300
  if (u.hidden || u.readonly || Ll(u, M) || u.layout_assigned === !1 || e && !e.has(u.field) || u.field.startsWith("__") || u.field.includes(".")) return !1;
4300
4301
  const f = u.options;
4301
4302
  return !(f && typeof f == "object" && f.auto_id);
4302
- }), n = t.filter((u) => u.required), r = t.filter((u) => Q0(u));
4303
+ }), n = t.filter((u) => u.required), r = t.filter((u) => H0(u));
4303
4304
  if (n.length === 0 && r.length === 0) return null;
4304
4305
  const s = (u) => {
4305
4306
  var v;
@@ -4356,9 +4357,9 @@ ${r.join(`
4356
4357
  var t;
4357
4358
  const e = (t = zi.current) == null ? void 0 : t.timestamp;
4358
4359
  e && (hs.current = e), Fo(null);
4359
- }, []), ii = al ? $b({
4360
+ }, []), ii = al ? Rb({
4360
4361
  dirty: Wt,
4361
- editsDiffer: Cb(qe.current, M, de, tt)
4362
+ editsDiffer: Ob(qe.current, M, de, tt)
4362
4363
  }) : null;
4363
4364
  z(() => {
4364
4365
  ii === "auto-refresh" && gu();
@@ -4438,7 +4439,7 @@ ${r.join(`
4438
4439
  },
4439
4440
  ...e
4440
4441
  ];
4441
- }, [w, j, ue, m]), vu = f0({
4442
+ }, [w, j, ue, m]), vu = p0({
4442
4443
  collection: i,
4443
4444
  relations: D,
4444
4445
  paths: ll.filter((e) => e.field.includes(".")).map((e) => e.field),
@@ -4451,14 +4452,14 @@ ${r.join(`
4451
4452
  }, [Ro, Ho]);
4452
4453
  const oi = A(() => {
4453
4454
  const e = (n) => !(n && (n.is_visible === 0 || n.is_visible === !1)), t = [
4454
- ...Gt.map((n) => ({ item: n, sort: n.sort, tie: 0 })),
4455
+ ...Jt.map((n) => ({ item: n, sort: n.sort, tie: 0 })),
4455
4456
  // Container groups sit alongside section groups in the order
4456
4457
  ...wo.map((n) => ({ item: n, sort: n.sort, tie: 0 })),
4457
4458
  {
4458
4459
  item: "__ungrouped__",
4459
4460
  sort: (() => {
4460
- const n = (w == null ? void 0 : w.ungrouped_sort) ?? Gt.length;
4461
- if (sl.size > 0 && Jt.some((r) => sl.has(r.field))) {
4461
+ const n = (w == null ? void 0 : w.ungrouped_sort) ?? Jt.length;
4462
+ if (sl.size > 0 && Gt.some((r) => sl.has(r.field))) {
4462
4463
  const r = [
4463
4464
  ue && Ie ? Ie.sort : null,
4464
4465
  jr && ct ? ct.sort : null,
@@ -4478,7 +4479,7 @@ ${r.join(`
4478
4479
  If(n.field) && e(n) && t.push({ item: n.field, sort: n.sort, tie: 8 });
4479
4480
  return t.sort((n, r) => n.sort - r.sort || n.tie - r.tie).map((n) => n.item);
4480
4481
  }, [
4481
- Gt,
4482
+ Jt,
4482
4483
  wo,
4483
4484
  w,
4484
4485
  Ie,
@@ -4495,13 +4496,15 @@ ${r.join(`
4495
4496
  m,
4496
4497
  sl,
4497
4498
  x == null ? void 0 : x.addendums_enabled,
4498
- Jt,
4499
+ Gt,
4499
4500
  ps,
4500
4501
  lt
4501
4502
  ]);
4502
4503
  function wu() {
4504
+ if (!t_(xe))
4505
+ return ge.info(n_), !1;
4503
4506
  const e = {}, t = (n) => !tt(M[n], $e.current[n]);
4504
- for (const n of Se)
4507
+ for (const n of xe)
4505
4508
  if (!(n.hidden || n.readonly || tn.has(n.field) || Tr(n.field)) && n.layout_assigned !== !1) {
4506
4509
  if (n.required) {
4507
4510
  if (n.field in Aa)
@@ -4529,7 +4532,7 @@ ${r.join(`
4529
4532
  })() : n.validation_rules;
4530
4533
  if (Array.isArray(r))
4531
4534
  for (const s of r) {
4532
- if (!s || s.soft || !Iv(s, n.field, m, t)) continue;
4535
+ if (!s || s.soft || !Pv(s, n.field, m, t)) continue;
4533
4536
  const o = ym(
4534
4537
  s,
4535
4538
  _m(n.type, M[n.field]),
@@ -4543,15 +4546,15 @@ ${r.join(`
4543
4546
  }
4544
4547
  }
4545
4548
  if (!e[n.field]) {
4546
- const r = V0(n, M[n.field], n.label ?? be(n.field));
4549
+ const r = U0(n, M[n.field], n.label ?? be(n.field));
4547
4550
  r && (e[n.field] = r);
4548
4551
  }
4549
4552
  if (!e[n.field] && (m || t(n.field))) {
4550
- const r = O_(n, M[n.field], n.label ?? be(n.field));
4553
+ const r = j_(n, M[n.field], n.label ?? be(n.field));
4551
4554
  r && (e[n.field] = r);
4552
4555
  }
4553
- if (!e[n.field] && k0.has(n.type) && (m || !tt(M[n.field], $e.current[n.field]))) {
4554
- const r = x0(M[n.field], {
4556
+ if (!e[n.field] && S0.has(n.type) && (m || !tt(M[n.field], $e.current[n.field]))) {
4557
+ const r = N0(M[n.field], {
4555
4558
  type: n.type,
4556
4559
  label: n.label || be(n.field)
4557
4560
  });
@@ -4566,13 +4569,13 @@ ${r.join(`
4566
4569
  No.markRefused(e), hn(e), md(!0);
4567
4570
  const n = Object.keys(e).sort(kh), r = n.length;
4568
4571
  if (r === 1) {
4569
- const o = Se.find((c) => c.field === n[0]), l = (o == null ? void 0 : o.label) || be(n[0]);
4570
- _e.error(
4572
+ const o = xe.find((c) => c.field === n[0]), l = (o == null ? void 0 : o.label) || be(n[0]);
4573
+ ge.error(
4571
4574
  e[n[0]] === "This field is required" ? `${l} is required` : e[n[0]],
4572
4575
  { id: am }
4573
4576
  );
4574
4577
  } else
4575
- _e.error(`Can’t save yet — ${r} fields need attention`, { id: am });
4578
+ ge.error(`Can’t save yet — ${r} fields need attention`, { id: am });
4576
4579
  const s = n[0];
4577
4580
  return s && setTimeout(() => Wc(s), 150), !1;
4578
4581
  }
@@ -4598,7 +4601,7 @@ ${r.join(`
4598
4601
  if (_t.current) return null;
4599
4602
  const e = [];
4600
4603
  if (!m) {
4601
- const r = Se.filter(
4604
+ const r = xe.filter(
4602
4605
  (s) => !tn.has(s.field) && !s.readonly && s.field in M && !tt(M[s.field], $e.current[s.field])
4603
4606
  ).map((s) => s.field);
4604
4607
  r.length && e.push({ collection: i, changedFields: r });
@@ -4679,13 +4682,13 @@ ${r.join(`
4679
4682
  dl.current = () => jo();
4680
4683
  const Mh = A(
4681
4684
  () => new Set(
4682
- Se.filter(
4685
+ xe.filter(
4683
4686
  (e) => e.required && !e.hidden && !e.readonly && !tn.has(e.field) && !Tr(e.field) && e.layout_assigned !== !1
4684
4687
  ).map((e) => e.field)
4685
4688
  ),
4686
- [Se]
4689
+ [xe]
4687
4690
  );
4688
- Qb({
4691
+ Hb({
4689
4692
  collection: i,
4690
4693
  config: Fr,
4691
4694
  enabled: !I && !bt && !er,
@@ -4701,22 +4704,22 @@ ${r.join(`
4701
4704
  function ku() {
4702
4705
  if (m || _t.current) return null;
4703
4706
  const e = new Set(
4704
- Se.filter(
4707
+ xe.filter(
4705
4708
  (n) => !tn.has(n.field) && n.field in M && !tt(M[n.field], $e.current[n.field])
4706
4709
  ).map((n) => n.field)
4707
4710
  );
4708
4711
  if (!e.size) return null;
4709
- const t = H0(Se, e, go);
4712
+ const t = G0(xe, e, go);
4710
4713
  return t.length ? { fields_changed: t, reasons: [], allow_free_text: !0, confirm: !0 } : null;
4711
4714
  }
4712
4715
  function cl() {
4713
- const e = U0(
4714
- Se,
4716
+ const e = J0(
4717
+ xe,
4715
4718
  M,
4716
4719
  (t) => Nt.size === 0 || Nt.has(t.field),
4717
4720
  (t) => Ml(t, yo).label || be(t.field)
4718
4721
  );
4719
- e.length && _e.warning(
4722
+ e.length && ge.warning(
4720
4723
  e.length === 1 ? `${e[0]} is recommended and still empty` : `${e.length} recommended fields are still empty`,
4721
4724
  {
4722
4725
  description: `${e.slice(0, 6).join(", ")}${e.length > 6 ? "…" : ""} — saved anyway; fill ${e.length === 1 ? "it" : "them"} in when you can.`
@@ -4726,7 +4729,7 @@ ${r.join(`
4726
4729
  function jo() {
4727
4730
  if (!er) {
4728
4731
  if (Vt && !m) {
4729
- _e.info(
4732
+ ge.info(
4730
4733
  gt ?? `${(Tn == null ? void 0 : Tn.locked_by_name) ?? "Someone else"} is editing this record — nothing was saved`
4731
4734
  );
4732
4735
  return;
@@ -4774,7 +4777,7 @@ ${r.join(`
4774
4777
  se("/revisions", { collection: l, item: d, limit: "50" })
4775
4778
  ).then((T) => T.data ?? []).catch(() => null);
4776
4779
  if (!f) continue;
4777
- const h = _0(g, u, f);
4780
+ const h = v0(g, u, f);
4778
4781
  if (!h || h.conflicts.length === 0) continue;
4779
4782
  const v = Ko(
4780
4783
  Ki(l, c),
@@ -4794,7 +4797,7 @@ ${r.join(`
4794
4797
  await xu(y, l, d, g), y.current || (y.current = h.current), n.push(y);
4795
4798
  }
4796
4799
  }
4797
- n.length !== 0 && (_e.warning(
4800
+ n.length !== 0 && (ge.warning(
4798
4801
  n.length === 1 ? `Someone saved ${n[0].label} after your draft — pick which value wins` : `Someone saved ${n.length} lines after your draft — pick which values win`,
4799
4802
  { duration: 1e4 }
4800
4803
  ), da(!0), Mi((r) => r ?? n));
@@ -4812,23 +4815,23 @@ ${r.join(`
4812
4815
  (d) => d.one_collection === i && d.many_collection === o && d.many_field === l && !d.junction_field
4813
4816
  );
4814
4817
  return (c == null ? void 0 : c.one_field) ?? null;
4815
- }, { body: n, aliases: r } = q_(U.current, e, t);
4818
+ }, { body: n, aliases: r } = I_(U.current, e, t);
4816
4819
  if (Object.keys(r).length === 0) return [];
4817
4820
  try {
4818
4821
  const s = await R.request(ln(`/items/${i}?dry_run=1`, n));
4819
- return T_(e, s == null ? void 0 : s.nested, r);
4822
+ return E_(e, s == null ? void 0 : s.nested, r);
4820
4823
  } catch {
4821
4824
  return [];
4822
4825
  }
4823
4826
  }
4824
4827
  async function Bh() {
4825
4828
  if (m && Am && Zn && !ul.current) {
4826
- Ji([{ id: "rehearse", label: "Checking the copied lines", status: "running" }]), tr(!0);
4829
+ Gi([{ id: "rehearse", label: "Checking the copied lines", status: "running" }]), tr(!0);
4827
4830
  let r = [];
4828
4831
  try {
4829
4832
  r = await Dh();
4830
4833
  } finally {
4831
- tr(!1), Ji([]);
4834
+ tr(!1), Gi([]);
4832
4835
  }
4833
4836
  if (r.length > 0)
4834
4837
  return Ao(r), !1;
@@ -4863,7 +4866,7 @@ ${r.join(`
4863
4866
  }
4864
4867
  let n = null, r = !1;
4865
4868
  const s = m ? "" : `?parent_collection=${encodeURIComponent(i)}&parent_id=${encodeURIComponent(String(p))}`, o = (b) => {
4866
- const O = [...ie.values()].find((J) => J.stagingKey === b);
4869
+ const O = [...ie.values()].find((G) => G.stagingKey === b);
4867
4870
  if (O)
4868
4871
  return X.getQueryData([
4869
4872
  "m2m-items",
@@ -4879,32 +4882,32 @@ ${r.join(`
4879
4882
  payload: {},
4880
4883
  isNew: m,
4881
4884
  committed: o
4882
- }), c = [...Ye.entries()].filter(([b]) => !l.has(b)), d = [...at.entries()].filter(([b]) => !l.has(b)), g = c.some(([, b]) => b.length > 0) || d.some(([, b]) => b.size > 0), u = {}, f = m ? Nb({
4885
+ }), c = [...Ye.entries()].filter(([b]) => !l.has(b)), d = [...at.entries()].filter(([b]) => !l.has(b)), g = c.some(([, b]) => b.length > 0) || d.some(([, b]) => b.size > 0), u = {}, f = m ? Cb({
4883
4886
  collection: i,
4884
4887
  relations: D,
4885
4888
  rows: je,
4886
4889
  payload: u,
4887
4890
  skip: new Set(
4888
4891
  [...je.entries()].filter(([b, O]) => {
4889
- const J = jc.get(b);
4890
- if (!(J != null && J.length)) return !1;
4892
+ const G = jc.get(b);
4893
+ if (!(G != null && G.length)) return !1;
4891
4894
  const me = /* @__PURE__ */ new Set();
4892
4895
  return O.some((te) => {
4893
- const ge = J.map((ye) => String(te[ye] ?? "")).join("\0");
4894
- return me.has(ge) ? !0 : (me.add(ge), !1);
4896
+ const ye = G.map((_e) => String(te[_e] ?? "")).join("\0");
4897
+ return me.has(ye) ? !0 : (me.add(ye), !1);
4895
4898
  });
4896
4899
  }).map(([b]) => b)
4897
4900
  )
4898
- }) : /* @__PURE__ */ new Set(), h = [...je.entries()].filter(([b, O]) => O.length > 0 && !f.has(b)).map(([b]) => b), v = [...ze.entries()].filter(([, b]) => b.size > 0).map(([b]) => b), S = [...We.entries()].filter(([, b]) => b.size > 0).map(([b]) => b), y = U.current, T = m ? Se.filter(
4901
+ }) : /* @__PURE__ */ new Set(), h = [...je.entries()].filter(([b, O]) => O.length > 0 && !f.has(b)).map(([b]) => b), v = [...ze.entries()].filter(([, b]) => b.size > 0).map(([b]) => b), S = [...We.entries()].filter(([, b]) => b.size > 0).map(([b]) => b), y = U.current, T = m ? xe.filter(
4899
4902
  (b) => !tn.has(b.field) && !b.readonly && b.field in y
4900
- ).length : Se.filter((b) => tn.has(b.field) || b.readonly || !(b.field in y) ? !1 : !tt(y[b.field], $e.current[b.field])).length, Q = m ? `${T} field${T !== 1 ? "s" : ""} set` : T === 0 ? "No field changes" : `${T} field${T !== 1 ? "s" : ""} changed`;
4903
+ ).length : xe.filter((b) => tn.has(b.field) || b.readonly || !(b.field in y) ? !1 : !tt(y[b.field], $e.current[b.field])).length, Q = m ? `${T} field${T !== 1 ? "s" : ""} set` : T === 0 ? "No field changes" : `${T} field${T !== 1 ? "s" : ""} changed`;
4901
4904
  let Y = 0, oe = 0;
4902
4905
  for (const [, b] of c) Y += b.length;
4903
4906
  for (const [, b] of d) oe += b.size;
4904
4907
  const C = [
4905
4908
  Y > 0 ? `+${Y} linked` : "",
4906
4909
  oe > 0 ? `-${oe} unlinked` : ""
4907
- ].filter(Boolean).join(" · "), Z = [...ia.current.entries()], G = [
4910
+ ].filter(Boolean).join(" · "), Z = [...ia.current.entries()], J = [
4908
4911
  ...Z.length > 0 ? [
4909
4912
  {
4910
4913
  id: "flush",
@@ -4928,8 +4931,8 @@ ${r.join(`
4928
4931
  }
4929
4932
  ] : [],
4930
4933
  ...h.map((b) => {
4931
- var J;
4932
- const O = ((J = je.get(b)) == null ? void 0 : J.length) ?? 0;
4934
+ var G;
4935
+ const O = ((G = je.get(b)) == null ? void 0 : G.length) ?? 0;
4933
4936
  return {
4934
4937
  id: `o2m:new:${b}`,
4935
4938
  label: `Add ${be(b.split(".")[0])}`,
@@ -4939,8 +4942,8 @@ ${r.join(`
4939
4942
  };
4940
4943
  }),
4941
4944
  ...v.map((b) => {
4942
- var J;
4943
- const O = ((J = ze.get(b)) == null ? void 0 : J.size) ?? 0;
4945
+ var G;
4946
+ const O = ((G = ze.get(b)) == null ? void 0 : G.size) ?? 0;
4944
4947
  return {
4945
4948
  id: `o2m:edit:${b}`,
4946
4949
  label: `Update ${be(b.split(".")[0])}`,
@@ -4950,8 +4953,8 @@ ${r.join(`
4950
4953
  };
4951
4954
  }),
4952
4955
  ...S.map((b) => {
4953
- var J;
4954
- const O = ((J = We.get(b)) == null ? void 0 : J.size) ?? 0;
4956
+ var G;
4957
+ const O = ((G = We.get(b)) == null ? void 0 : G.size) ?? 0;
4955
4958
  return {
4956
4959
  id: `o2m:del:${b}`,
4957
4960
  label: `Remove from ${be(b.split(".")[0])}`,
@@ -4970,7 +4973,7 @@ ${r.join(`
4970
4973
  }
4971
4974
  ] : []
4972
4975
  ];
4973
- if (Ji(G), Fe.current.onlyMain = G.length === 1, to.current = /* @__PURE__ */ new Map(), tr(!0), Z.length > 0) {
4976
+ if (Gi(J), Fe.current.onlyMain = J.length === 1, to.current = /* @__PURE__ */ new Map(), tr(!0), Z.length > 0) {
4974
4977
  ve("flush", { status: "running" });
4975
4978
  try {
4976
4979
  for (const [, b] of Z) await b();
@@ -4981,17 +4984,17 @@ ${r.join(`
4981
4984
  }
4982
4985
  ve("main", { status: "running" });
4983
4986
  const K = {}, E = $e.current, V = U.current;
4984
- for (const b of Se) {
4987
+ for (const b of xe) {
4985
4988
  if (tn.has(b.field) || b.readonly || !(b.field in V)) continue;
4986
- const O = V[b.field], J = E[b.field];
4987
- (m || !tt(O, J)) && (K[b.field] = O);
4989
+ const O = V[b.field], G = E[b.field];
4990
+ (m || !tt(O, G)) && (K[b.field] = O);
4988
4991
  }
4989
4992
  if (m) {
4990
4993
  const b = (kf = w == null ? void 0 : w.layout) == null ? void 0 : kf.default_values;
4991
4994
  for (const O of Object.keys(b ?? {})) {
4992
4995
  if (O in K || !(O in V) || O.startsWith("__") || O.includes(".") || tn.has(O)) continue;
4993
- const J = V[O];
4994
- J === void 0 || Array.isArray(J) || (j ?? []).some((me) => me.field === O) && (K[O] = J);
4996
+ const G = V[O];
4997
+ G === void 0 || Array.isArray(G) || (j ?? []).some((me) => me.field === O) && (K[O] = G);
4995
4998
  }
4996
4999
  }
4997
5000
  if (Object.assign(K, u), Hf({
@@ -5020,28 +5023,28 @@ ${r.join(`
5020
5023
  if (t(b), O == null) throw new um();
5021
5024
  B = String(O);
5022
5025
  } else if (Object.keys(K).some((b) => !b.startsWith("_"))) {
5023
- const b = l0({
5026
+ const b = c0({
5024
5027
  payload: K,
5025
5028
  guard: Rs.current,
5026
5029
  current: $e.current
5027
5030
  });
5028
5031
  if (b.length > 0)
5029
- throw r = !0, d0(
5032
+ throw r = !0, u0(
5030
5033
  b,
5031
5034
  Cn.current ?? ga.current
5032
5035
  );
5033
5036
  let O = null;
5034
5037
  try {
5035
5038
  O = await R.request(mi(`/items/${i}/${p}`, K));
5036
- } catch (J) {
5037
- const me = Ol(J);
5039
+ } catch (G) {
5040
+ const me = Ol(G);
5038
5041
  if (!me || me.latest <= 0 || Df({
5039
5042
  conflicts: me.conflicts,
5040
5043
  payload: K,
5041
5044
  decided: zr.current
5042
5045
  }).length > 0)
5043
- throw J;
5044
- Cn.current = me.latest, Os.current = !1, c0({ conflicts: me.conflicts, payload: K }) || (O = await R.request(
5046
+ throw G;
5047
+ Cn.current = me.latest, Os.current = !1, f0({ conflicts: me.conflicts, payload: K }) || (O = await R.request(
5045
5048
  mi(`/items/${i}/${p}`, {
5046
5049
  ...K,
5047
5050
  _base_revision: me.latest
@@ -5058,18 +5061,18 @@ ${r.join(`
5058
5061
  const O = Al(b);
5059
5062
  if (O)
5060
5063
  throw ve("main", { status: "error", error: "Waiting for a change reason" }), Wr(O), b;
5061
- const J = Ol(b);
5062
- if (J) {
5064
+ const G = Ol(b);
5065
+ if (G) {
5063
5066
  ve("main", { status: "error", error: "Someone else changed this record" });
5064
5067
  const ae = Df({
5065
- conflicts: J.conflicts,
5068
+ conflicts: G.conflicts,
5066
5069
  payload: K,
5067
5070
  decided: zr.current
5068
- }), Ge = ae.length > 0 ? ae : J.conflicts, pe = {};
5069
- for (const Ee of Ge) pe[Ee.field] = K[Ee.field];
5071
+ }), Je = ae.length > 0 ? ae : G.conflicts, pe = {};
5072
+ for (const Ee of Je) pe[Ee.field] = K[Ee.field];
5070
5073
  throw Qr({
5071
- conflicts: Ge,
5072
- latest: J.latest,
5074
+ conflicts: Je,
5075
+ latest: G.latest,
5073
5076
  mine: pe,
5074
5077
  edit: El(K),
5075
5078
  ...r ? { clientFound: !0 } : {}
@@ -5078,7 +5081,7 @@ ${r.join(`
5078
5081
  if (!m && Ty(b) && Object.keys(K).some((ae) => !ae.startsWith("_"))) {
5079
5082
  const ae = {};
5080
5083
  for (const pe of Object.keys(K)) ae[pe] = E[pe] ?? null;
5081
- const Ge = await Iy({
5084
+ const Je = await Iy({
5082
5085
  collection: i,
5083
5086
  item: p,
5084
5087
  payload: K,
@@ -5086,32 +5089,32 @@ ${r.join(`
5086
5089
  baseRevision: typeof K._base_revision == "number" ? K._base_revision : null,
5087
5090
  changeReason: _t.current
5088
5091
  });
5089
- if (Ge) {
5092
+ if (Je) {
5090
5093
  const pe = !Rn.current;
5091
5094
  pe && (Rn.current = Ef(i, p));
5092
- for (const Ee of Object.keys(Ge.payload)) Di.current.add(Ee);
5095
+ for (const Ee of Object.keys(Je.payload)) Di.current.add(Ee);
5093
5096
  throw ve("main", {
5094
5097
  status: "error",
5095
5098
  error: "No connection — will save when you are back online"
5096
- }), tr(!1), pe && _e.info("Will save when you are back online"), b;
5099
+ }), tr(!1), pe && ge.info("Will save when you are back online"), b;
5097
5100
  }
5098
5101
  }
5099
- const me = e(b), te = ry(b), ge = new Set(Se.map((ae) => ae.field)), ye = Sb(b, ge);
5102
+ const me = e(b), te = ry(b), ye = new Set(xe.map((ae) => ae.field)), _e = $b(b, ye);
5100
5103
  if (ve("main", {
5101
5104
  status: "error",
5102
5105
  // a01-8: a refused line reads "Line 1: …" with the grid's name, never
5103
5106
  // the internal path "workflow_lines[0]: …".
5104
- error: ye && /[A-Za-z0-9_]+\[[^\]]*\]:/.test(me) ? Tv(ye, Se) : me,
5107
+ error: _e && /[A-Za-z0-9_]+\[[^\]]*\]:/.test(me) ? Ev(_e, xe) : me,
5105
5108
  hint: te.hint,
5106
5109
  details: te,
5107
5110
  denied: tm(b)
5108
- }), ye)
5109
- No.markRefused({ [ye.field]: ye.message }), hn({ [ye.field]: ye.message }), setTimeout(() => En(ye.field), 150);
5111
+ }), _e)
5112
+ No.markRefused({ [_e.field]: _e.message }), hn({ [_e.field]: _e.message }), setTimeout(() => En(_e.field), 150);
5110
5113
  else {
5111
- const ae = (te.fields ?? []).filter((Ge) => ge.has(Ge));
5114
+ const ae = (te.fields ?? []).filter((Je) => ye.has(Je));
5112
5115
  if (ae.length > 0) {
5113
- const Ge = Object.fromEntries(ae.map((pe) => [pe, me]));
5114
- No.markRefused(Ge), hn(Ge), setTimeout(() => En(ae[0]), 150);
5116
+ const Je = Object.fromEntries(ae.map((pe) => [pe, me]));
5117
+ No.markRefused(Je), hn(Je), setTimeout(() => En(ae[0]), 150);
5115
5118
  }
5116
5119
  }
5117
5120
  throw b;
@@ -5123,47 +5126,47 @@ ${r.join(`
5123
5126
  );
5124
5127
  if (O) {
5125
5128
  const te = O.junction_field ?? ((me = D.find(
5126
- (ge) => ge.many_collection === O.many_collection && ge.id !== O.id
5129
+ (ye) => ye.many_collection === O.many_collection && ye.id !== O.id
5127
5130
  )) == null ? void 0 : me.many_field) ?? null;
5128
5131
  return te ? { ...O, junction_field: te } : null;
5129
5132
  }
5130
- const J = b.split(".");
5131
- if (J.length === 2) {
5132
- const [te, ge] = J, ye = D.find((ae) => ae.many_collection === te);
5133
- return ye ? { ...ye, junction_field: ge } : null;
5133
+ const G = b.split(".");
5134
+ if (G.length === 2) {
5135
+ const [te, ye] = G, _e = D.find((ae) => ae.many_collection === te);
5136
+ return _e ? { ..._e, junction_field: ye } : null;
5134
5137
  }
5135
5138
  return null;
5136
5139
  };
5137
5140
  if (g) {
5138
5141
  ve("m2m", { status: "running" });
5139
5142
  try {
5140
- const b = [], O = (te) => (ge) => {
5141
- b.push(`${te}: ${e(ge)}`);
5142
- }, J = [];
5143
- for (const [te, ge] of d) {
5144
- if (!ge.size) continue;
5145
- const ye = re(te);
5146
- if (ye)
5147
- for (const ae of ge)
5148
- J.push(
5149
- R.request(mr(`/items/${ye.many_collection}/${ae}`)).catch(O("A link could not be removed"))
5143
+ const b = [], O = (te) => (ye) => {
5144
+ b.push(`${te}: ${e(ye)}`);
5145
+ }, G = [];
5146
+ for (const [te, ye] of d) {
5147
+ if (!ye.size) continue;
5148
+ const _e = re(te);
5149
+ if (_e)
5150
+ for (const ae of ye)
5151
+ G.push(
5152
+ R.request(mr(`/items/${_e.many_collection}/${ae}`)).catch(O("A link could not be removed"))
5150
5153
  );
5151
5154
  }
5152
- await Promise.all(J);
5155
+ await Promise.all(G);
5153
5156
  const me = [];
5154
- for (const [te, ge] of c) {
5155
- if (!ge.length) continue;
5156
- const ye = re(te);
5157
- if (!ye) continue;
5157
+ for (const [te, ye] of c) {
5158
+ if (!ye.length) continue;
5159
+ const _e = re(te);
5160
+ if (!_e) continue;
5158
5161
  const ae = D.find(
5159
- (Ee) => Ee.many_collection === ye.many_collection && Ee.many_field === ye.junction_field && Ee.id !== ye.id
5160
- ), Ge = j0(ae), pe = Ge ? { [Ge.field]: Ge.value } : {};
5161
- for (const Ee of ge)
5162
+ (Ee) => Ee.many_collection === _e.many_collection && Ee.many_field === _e.junction_field && Ee.id !== _e.id
5163
+ ), Je = q0(ae), pe = Je ? { [Je.field]: Je.value } : {};
5164
+ for (const Ee of ye)
5162
5165
  me.push(
5163
5166
  R.request(
5164
- ln(`/items/${ye.many_collection}`, {
5165
- [ye.many_field]: B,
5166
- [ye.junction_field]: Ee,
5167
+ ln(`/items/${_e.many_collection}`, {
5168
+ [_e.many_field]: B,
5169
+ [_e.junction_field]: Ee,
5167
5170
  ...pe
5168
5171
  })
5169
5172
  ).catch(O("A link could not be added"))
@@ -5184,59 +5187,59 @@ ${r.join(`
5184
5187
  const fn = to.current;
5185
5188
  oa.current.clear();
5186
5189
  for (const b of v) {
5187
- const O = b.slice(0, b.indexOf(".")), J = [];
5190
+ const O = b.slice(0, b.indexOf(".")), G = [];
5188
5191
  for (const te of (ze.get(b) ?? /* @__PURE__ */ new Map()).keys()) {
5189
5192
  if (te === "new" || te.startsWith("pending:")) continue;
5190
- const ge = await ht.current.get(`${O}:${te}`);
5191
- typeof ge == "number" && ge > 0 || J.push(te);
5193
+ const ye = await ht.current.get(`${O}:${te}`);
5194
+ typeof ye == "number" && ye > 0 || G.push(te);
5192
5195
  }
5193
- if (J.length === 0) continue;
5194
- const me = await Mo(R, O, J).catch(
5196
+ if (G.length === 0) continue;
5197
+ const me = await Mo(R, O, G).catch(
5195
5198
  () => /* @__PURE__ */ new Map()
5196
5199
  );
5197
- for (const te of J)
5200
+ for (const te of G)
5198
5201
  me.has(te) && (ht.current.set(`${O}:${te}`, Promise.resolve(me.get(te) ?? null)), me.get(te) == null && oa.current.add(`${O}:${te}`));
5199
5202
  }
5200
5203
  const ot = /* @__PURE__ */ new Set();
5201
5204
  for (const b of v) {
5202
5205
  const [O] = b.split(".");
5203
- for (const [J, me] of ze.get(b) ?? /* @__PURE__ */ new Map()) {
5206
+ for (const [G, me] of ze.get(b) ?? /* @__PURE__ */ new Map()) {
5204
5207
  if (!me.__flush_early || Object.keys(me).some((ae) => ae.startsWith("__nested_ops_"))) continue;
5205
5208
  const te = Object.fromEntries(
5206
5209
  Object.entries(me).filter(([ae]) => !ae.startsWith("__"))
5207
5210
  );
5208
5211
  if (Object.keys(te).length === 0) continue;
5209
5212
  _t.current && !te._change_reason && (te._change_reason = _t.current);
5210
- const ge = await vd(O, J);
5211
- await R.request(mi(`/items/${O}/${J}${s}`, zf(te, ge))).then(() => !0).catch(() => !1) && (ot.add(`${b}:${J}`), ht.current.delete(`${O}:${J}`), Pl(R, O).forget(J));
5213
+ const ye = await vd(O, G);
5214
+ await R.request(mi(`/items/${O}/${G}${s}`, zf(te, ye))).then(() => !0).catch(() => !1) && (ot.add(`${b}:${G}`), ht.current.delete(`${O}:${G}`), Pl(R, O).forget(G));
5212
5215
  }
5213
5216
  }
5214
5217
  for (const b of h) {
5215
- const O = `o2m:new:${b}`, [J, me] = b.split("."), te = je.get(b) ?? [], ge = jc.get(b);
5216
- if (ge != null && ge.length) {
5217
- const pe = (Ke) => ge.map((mn) => String(Ke[mn] ?? "")).join("\0"), Ee = /* @__PURE__ */ new Set();
5218
+ const O = `o2m:new:${b}`, [G, me] = b.split("."), te = je.get(b) ?? [], ye = jc.get(b);
5219
+ if (ye != null && ye.length) {
5220
+ const pe = (Ke) => ye.map((mn) => String(Ke[mn] ?? "")).join("\0"), Ee = /* @__PURE__ */ new Set();
5218
5221
  if (te.some((Ke) => {
5219
5222
  const mn = pe(Ke);
5220
5223
  return Ee.has(mn) ? !0 : (Ee.add(mn), !1);
5221
5224
  })) {
5222
5225
  ve(O, {
5223
5226
  status: "error",
5224
- error: `Duplicate ${ge.join(" + ")} values in new rows`
5227
+ error: `Duplicate ${ye.join(" + ")} values in new rows`
5225
5228
  });
5226
5229
  continue;
5227
5230
  }
5228
5231
  }
5229
5232
  ve(O, { status: "running", progress: { done: 0, total: te.length } });
5230
- const ye = (pe, Ee) => {
5233
+ const _e = (pe, Ee) => {
5231
5234
  const yt = pe.line_number ?? pe.sort ?? null, Ke = ["item_description", "description", "name", "title", "label"].map((pn) => pe[pn]).find((pn) => typeof pn == "string" && pn.trim() !== ""), mn = `line ${yt != null && yt !== "" ? String(yt) : Ee + 1}`;
5232
5235
  return Ke ? `${mn} · ${Ke.length > 40 ? `${Ke.slice(0, 40)}…` : Ke}` : mn;
5233
- }, ae = [], Ge = [];
5236
+ }, ae = [], Je = [];
5234
5237
  try {
5235
5238
  let pe = 0;
5236
5239
  for (let yt = 0; yt < te.length; yt++) {
5237
5240
  const Ke = te[yt];
5238
5241
  ve(O, {
5239
- detail: `Saving ${ye(Ke, yt)} (${yt + 1} of ${te.length})`
5242
+ detail: `Saving ${_e(Ke, yt)} (${yt + 1} of ${te.length})`
5240
5243
  }), await (async () => {
5241
5244
  var ur;
5242
5245
  const mn = Object.entries(Ke).filter(([et]) => et.startsWith("__o2m_")), pn = Object.fromEntries(
@@ -5245,7 +5248,7 @@ ${r.join(`
5245
5248
  let mt = null;
5246
5249
  try {
5247
5250
  mt = await R.request(
5248
- ln(`/items/${J}${s}`, {
5251
+ ln(`/items/${G}${s}`, {
5249
5252
  ...pn,
5250
5253
  [me]: B,
5251
5254
  // The record's change reason covers the lines it stages
@@ -5256,9 +5259,9 @@ ${r.join(`
5256
5259
  } catch (et) {
5257
5260
  const Ae = Al(et);
5258
5261
  Ae ? (n = Ae, ae.push({
5259
- label: ye(Ke, yt),
5262
+ label: _e(Ke, yt),
5260
5263
  error: "Waiting for a change reason"
5261
- })) : ae.push({ label: ye(Ke, yt), error: e(et) }), Ge.push(Ke);
5264
+ })) : ae.push({ label: _e(Ke, yt), error: e(et) }), Je.push(Ke);
5262
5265
  return;
5263
5266
  }
5264
5267
  const Xt = (ur = mt == null ? void 0 : mt.data) == null ? void 0 : ur.id;
@@ -5270,7 +5273,7 @@ ${r.join(`
5270
5273
  });
5271
5274
  for (const [et, Ae] of mn) {
5272
5275
  const Sn = et.slice(6), on = D.find(
5273
- (fr) => fr.one_collection === J && fr.one_field === Sn
5276
+ (fr) => fr.one_collection === G && fr.one_field === Sn
5274
5277
  ), Nn = Array.isArray(Ae) ? Ae : [];
5275
5278
  if (Xt == null || !(on != null && on.many_collection) || !on.many_field) {
5276
5279
  pe += Nn.length;
@@ -5290,7 +5293,7 @@ ${r.join(`
5290
5293
  }
5291
5294
  })();
5292
5295
  }
5293
- Ge.length > 0 && fn.set(b, Ge);
5296
+ Je.length > 0 && fn.set(b, Je);
5294
5297
  const Ee = [];
5295
5298
  if (ae.length > 0) {
5296
5299
  const yt = te.length - ae.length;
@@ -5311,12 +5314,12 @@ ${r.join(`
5311
5314
  }
5312
5315
  const Xe = new Map(ze), Hn = [];
5313
5316
  for (const b of v) {
5314
- const O = `o2m:edit:${b}`, [J, me] = b.split("."), te = Ki(J, me), ge = ze.get(b) ?? /* @__PURE__ */ new Map();
5315
- ve(O, { status: "running", progress: { done: 0, total: ge.size } });
5316
- let ye = !1, ae = 0;
5317
- const Ge = /* @__PURE__ */ new Map();
5317
+ const O = `o2m:edit:${b}`, [G, me] = b.split("."), te = Ki(G, me), ye = ze.get(b) ?? /* @__PURE__ */ new Map();
5318
+ ve(O, { status: "running", progress: { done: 0, total: ye.size } });
5319
+ let _e = !1, ae = 0;
5320
+ const Je = /* @__PURE__ */ new Map();
5318
5321
  await Promise.all(
5319
- [...ge.entries()].map(async ([pe, Ee]) => {
5322
+ [...ye.entries()].map(async ([pe, Ee]) => {
5320
5323
  const yt = Object.entries(Ee).filter(
5321
5324
  ([mt]) => mt.startsWith("__nested_ops_")
5322
5325
  ), Ke = Object.fromEntries(
@@ -5327,13 +5330,13 @@ ${r.join(`
5327
5330
  let mn = !1;
5328
5331
  if (Object.keys(Ke).length > 0 && !ot.has(`${b}:${pe}`)) {
5329
5332
  _t.current && !Ke._change_reason && (Ke._change_reason = _t.current);
5330
- const mt = await vd(J, pe);
5333
+ const mt = await vd(G, pe);
5331
5334
  await R.request(
5332
- mi(`/items/${J}/${pe}${s}`, zf(Ke, mt))
5335
+ mi(`/items/${G}/${pe}${s}`, zf(Ke, mt))
5333
5336
  ).then(() => {
5334
- ht.current.delete(`${J}:${pe}`), Pl(R, J).forget(pe);
5337
+ ht.current.delete(`${G}:${pe}`), Pl(R, G).forget(pe);
5335
5338
  }).catch(async (Xt) => {
5336
- ye = !0, mn = !0;
5339
+ _e = !0, mn = !0;
5337
5340
  const ur = Al(Xt), et = ur ? null : Ol(Xt);
5338
5341
  if (ur)
5339
5342
  n = ur, ve(O, { status: "error", error: "Waiting for a change reason" });
@@ -5342,7 +5345,7 @@ ${r.join(`
5342
5345
  te,
5343
5346
  pe,
5344
5347
  null,
5345
- (Nn) => pi(J, String(Nn.id))
5348
+ (Nn) => pi(G, String(Nn.id))
5346
5349
  ), Sn = {};
5347
5350
  for (const Nn of et.conflicts) Sn[Nn.field] = Ke[Nn.field];
5348
5351
  const on = {
@@ -5353,12 +5356,12 @@ ${r.join(`
5353
5356
  latest: et.latest,
5354
5357
  mine: Sn
5355
5358
  };
5356
- await xu(on, J, pe, Ke), Hn.push(on), ve(O, {
5359
+ await xu(on, G, pe, Ke), Hn.push(on), ve(O, {
5357
5360
  status: "error",
5358
5361
  error: `${Ae} was changed by someone else — pick which value wins`
5359
5362
  });
5360
5363
  } else {
5361
- const Ae = `${Ko(te, pe, null, (Sn) => pi(J, String(Sn.id)))}: ${e(Xt)}`;
5364
+ const Ae = `${Ko(te, pe, null, (Sn) => pi(G, String(Sn.id)))}: ${e(Xt)}`;
5362
5365
  Fe.current.childFailed = !0, Fe.current.childErrors = [
5363
5366
  ...Fe.current.childErrors ?? [],
5364
5367
  Ae
@@ -5367,10 +5370,10 @@ ${r.join(`
5367
5370
  });
5368
5371
  }
5369
5372
  if (mn) {
5370
- Ge.set(pe, Ee), ve(O, (mt) => {
5373
+ Je.set(pe, Ee), ve(O, (mt) => {
5371
5374
  var Xt;
5372
5375
  return {
5373
- progress: { done: (((Xt = mt.progress) == null ? void 0 : Xt.done) ?? 0) + 1, total: ge.size }
5376
+ progress: { done: (((Xt = mt.progress) == null ? void 0 : Xt.done) ?? 0) + 1, total: ye.size }
5374
5377
  };
5375
5378
  });
5376
5379
  return;
@@ -5378,7 +5381,7 @@ ${r.join(`
5378
5381
  const pn = {};
5379
5382
  for (const [mt, Xt] of yt) {
5380
5383
  const ur = mt.slice(13), et = D.find(
5381
- (an) => an.one_collection === J && an.one_field === ur
5384
+ (an) => an.one_collection === G && an.one_field === ur
5382
5385
  ), Ae = Xt, Sn = Ae.collection ?? (et == null ? void 0 : et.many_collection) ?? null, on = Ae.collection ? null : (et == null ? void 0 : et.many_field) ?? null;
5383
5386
  if (!Sn || !Ae.collection && !on) {
5384
5387
  ae += Ae.created.length + Ae.updated.length + Ae.deleted.length, pn[mt] = Ae;
@@ -5415,14 +5418,14 @@ ${r.join(`
5415
5418
  ...Ae.collection ? { collection: Ae.collection } : {}
5416
5419
  });
5417
5420
  }
5418
- Object.keys(pn).length > 0 && Ge.set(pe, pn), ve(O, (mt) => {
5421
+ Object.keys(pn).length > 0 && Je.set(pe, pn), ve(O, (mt) => {
5419
5422
  var Xt;
5420
5423
  return {
5421
- progress: { done: (((Xt = mt.progress) == null ? void 0 : Xt.done) ?? 0) + 1, total: ge.size }
5424
+ progress: { done: (((Xt = mt.progress) == null ? void 0 : Xt.done) ?? 0) + 1, total: ye.size }
5422
5425
  };
5423
5426
  });
5424
5427
  })
5425
- ), Ge.size > 0 ? Xe.set(b, Ge) : Xe.delete(b), !ye && ae === 0 ? ve(O, { status: "done" }) : ye || (Fe.current.childFailed = !0, ve(O, {
5428
+ ), Je.size > 0 ? Xe.set(b, Je) : Xe.delete(b), !_e && ae === 0 ? ve(O, { status: "done" }) : _e || (Fe.current.childFailed = !0, ve(O, {
5426
5429
  status: "error",
5427
5430
  error: `${ae} nested row${ae !== 1 ? "s" : ""} failed`
5428
5431
  }));
@@ -5430,22 +5433,22 @@ ${r.join(`
5430
5433
  kr(Xe), n && (Wr(n), Fe.current.reasonWaiting = !0), Hn.length > 0 && (Fe.current.lineConflicts = Hn.length, Mi(Hn));
5431
5434
  const Zt = new Map(We);
5432
5435
  for (const b of S) {
5433
- const O = `o2m:del:${b}`, [J] = b.split("."), me = We.get(b) ?? /* @__PURE__ */ new Set();
5436
+ const O = `o2m:del:${b}`, [G] = b.split("."), me = We.get(b) ?? /* @__PURE__ */ new Set();
5434
5437
  ve(O, { status: "running", progress: { done: 0, total: me.size } });
5435
5438
  let te = !1;
5436
5439
  await Promise.all(
5437
- [...me].map(async (ge) => {
5438
- await R.request(mr(`/items/${J}/${ge}${s}`)).catch((ye) => {
5440
+ [...me].map(async (ye) => {
5441
+ await R.request(mr(`/items/${G}/${ye}${s}`)).catch((_e) => {
5439
5442
  te = !0;
5440
- const ae = `${Ko(Ki(J, b.split(".")[1]), ge)} not removed: ${e(ye)}`;
5443
+ const ae = `${Ko(Ki(G, b.split(".")[1]), ye)} not removed: ${e(_e)}`;
5441
5444
  Fe.current.childFailed = !0, Fe.current.childErrors = [
5442
5445
  ...Fe.current.childErrors ?? [],
5443
5446
  ae
5444
5447
  ], ve(O, { status: "error", error: ae });
5445
- }), ve(O, (ye) => {
5448
+ }), ve(O, (_e) => {
5446
5449
  var ae;
5447
5450
  return {
5448
- progress: { done: (((ae = ye.progress) == null ? void 0 : ae.done) ?? 0) + 1, total: me.size }
5451
+ progress: { done: (((ae = _e.progress) == null ? void 0 : ae.done) ?? 0) + 1, total: me.size }
5449
5452
  };
5450
5453
  });
5451
5454
  })
@@ -5466,17 +5469,17 @@ ${r.join(`
5466
5469
  due_date: O.due_date || void 0,
5467
5470
  priority: O.priority || void 0
5468
5471
  })
5469
- ).catch((J) => {
5470
- b.push(`“${O.title}”: ${e(J)}`);
5471
- }), ve("tasks", (J) => {
5472
+ ).catch((G) => {
5473
+ b.push(`“${O.title}”: ${e(G)}`);
5474
+ }), ve("tasks", (G) => {
5472
5475
  var me;
5473
5476
  return {
5474
- progress: { done: (((me = J.progress) == null ? void 0 : me.done) ?? 0) + 1, total: yn.length }
5477
+ progress: { done: (((me = G.progress) == null ? void 0 : me.done) ?? 0) + 1, total: yn.length }
5475
5478
  };
5476
5479
  });
5477
5480
  if (b.length) {
5478
5481
  const O = `${b.length} task${b.length !== 1 ? "s" : ""} not created — ${b.join("; ")}`;
5479
- ve("tasks", { status: "error", error: O }), _e.error(O);
5482
+ ve("tasks", { status: "error", error: O }), ge.error(O);
5480
5483
  } else ve("tasks", { status: "done" });
5481
5484
  Wy(X, i, B);
5482
5485
  }
@@ -5484,7 +5487,7 @@ ${r.join(`
5484
5487
  },
5485
5488
  onSuccess: (e) => {
5486
5489
  var c;
5487
- if (m && (Jg(vt, e ? String(e) : ""), zh()), m && !e) {
5490
+ if (m && (Gg(vt, e ? String(e) : ""), zh()), m && !e) {
5488
5491
  On(!1), es(/* @__PURE__ */ new Map()), Ps(/* @__PURE__ */ new Map()), rr(/* @__PURE__ */ new Map()), tr(!1), zm({ reason: ((c = Fe.current.hidden) == null ? void 0 : c.reason) ?? null });
5489
5492
  return;
5490
5493
  }
@@ -5534,8 +5537,8 @@ ${r.join(`
5534
5537
  qy(i, e, d), Bi(), zy(Le, "saved", i, e);
5535
5538
  }
5536
5539
  X.invalidateQueries({ queryKey: ["collision-base", i] });
5537
- const t = !m && wb(Fe.current);
5538
- Ai.current = t, t || On(!1), m || N_(qe.current, { leftWorkStaged: t }), !m && !t && vs(vt), es(/* @__PURE__ */ new Map()), Ps(/* @__PURE__ */ new Map()), jd([]), ya.current = "", _a([]);
5540
+ const t = !m && xb(Fe.current);
5541
+ Ai.current = t, t || On(!1), m || C_(qe.current, { leftWorkStaged: t }), !m && !t && vs(vt), es(/* @__PURE__ */ new Map()), Ps(/* @__PURE__ */ new Map()), jd([]), ya.current = "", _a([]);
5539
5542
  const n = /* @__PURE__ */ new Set([
5540
5543
  ...je.keys(),
5541
5544
  ...ze.keys(),
@@ -5547,7 +5550,7 @@ ${r.join(`
5547
5550
  }
5548
5551
  rr(new Map(to.current));
5549
5552
  const r = ds.current.size > 0;
5550
- if (ds.current.clear(), Ba(/* @__PURE__ */ new Map()), X.invalidateQueries({ queryKey: ["item", i] }), r ? X.invalidateQueries({ queryKey: ["m2m-items"] }) : Qf(X, [e, ...I0(ze)]), ob(X, i, String(e)), X.invalidateQueries({ queryKey: ["last-touch", i, String(e)] }), X.invalidateQueries({ queryKey: ["field-lineage", i, String(e)] }), X.invalidateQueries({ queryKey: ["child-summary", i, String(e)] }), ab(X, i, String(e)), $o && Pn && lr({ itemId: String(e), silent: !0 }), m && Ks.current) {
5553
+ if (ds.current.clear(), Ba(/* @__PURE__ */ new Map()), X.invalidateQueries({ queryKey: ["item", i] }), r ? X.invalidateQueries({ queryKey: ["m2m-items"] }) : Qf(X, [e, ...P0(ze)]), lb(X, i, String(e)), X.invalidateQueries({ queryKey: ["last-touch", i, String(e)] }), X.invalidateQueries({ queryKey: ["field-lineage", i, String(e)] }), X.invalidateQueries({ queryKey: ["child-summary", i, String(e)] }), db(X, i, String(e)), $o && Pn && lr({ itemId: String(e), silent: !0 }), m && Ks.current) {
5551
5554
  const d = Ks.current;
5552
5555
  Ks.current = null;
5553
5556
  const g = {};
@@ -5557,12 +5560,12 @@ ${r.join(`
5557
5560
  ).catch(() => {
5558
5561
  });
5559
5562
  }
5560
- const s = Fe.current, o = (x == null ? void 0 : x.singular) || be(i), l = kb(s, { isNew: m, noun: o });
5563
+ const s = Fe.current, o = (x == null ? void 0 : x.singular) || be(i), l = Sb(s, { isNew: m, noun: o });
5561
5564
  if (l) {
5562
- const d = l.kind === "error" ? _e.error : l.kind === "warning" ? _e.warning : l.kind === "success" ? _e.success : _e, g = { id: xb };
5565
+ const d = l.kind === "error" ? ge.error : l.kind === "warning" ? ge.warning : l.kind === "success" ? ge.success : ge, g = { id: Nb };
5563
5566
  l.duration ? d(l.text, { ...g, duration: l.duration }) : d(l.text, g);
5564
5567
  }
5565
- s.linkProblems.length > 0 && _e.error(
5568
+ s.linkProblems.length > 0 && ge.error(
5566
5569
  `${m ? `The new ${o.toLowerCase()} was created` : "Saved"}, but some parts did not save: ${[
5567
5570
  ...new Set(s.linkProblems)
5568
5571
  ].join(" · ")}`,
@@ -5575,12 +5578,12 @@ ${r.join(`
5575
5578
  Li.current = !1;
5576
5579
  },
5577
5580
  onError: (e) => {
5578
- m && (rs.current = !1), Ev(e) === "EDIT_LOCKED" && X.invalidateQueries({ queryKey: ["pipeline-instance-lock", i, p] });
5581
+ m && (rs.current = !1), Lv(e) === "EDIT_LOCKED" && X.invalidateQueries({ queryKey: ["pipeline-instance-lock", i, p] });
5579
5582
  }
5580
5583
  }), qo = $(null), gs = (ee == null ? void 0 : ee.id) != null ? Number(ee.id) : null, Vn = Fr.tour === !0 && !I && gs != null, ai = A(
5581
- () => Vn ? L_(Ce, Te) : /* @__PURE__ */ new Map(),
5584
+ () => Vn ? K_(Ce, Te) : /* @__PURE__ */ new Map(),
5582
5585
  [Vn, Ce, Te]
5583
- ), ys = M_({
5586
+ ), ys = D_({
5584
5587
  layoutId: Vn ? gs : null,
5585
5588
  userId: Le,
5586
5589
  enabled: Vn
@@ -5588,7 +5591,7 @@ ${r.join(`
5588
5591
  z(() => {
5589
5592
  if (!Vn || ys.seen || !ys.known || Nu.current === gs) return;
5590
5593
  const e = window.setTimeout(() => {
5591
- document.querySelector('[role="dialog"][data-state="open"]') || K_(qo.current).some((t) => ai.has(t)) && (Nu.current = gs, fl(!0));
5594
+ document.querySelector('[role="dialog"][data-state="open"]') || B_(qo.current).some((t) => ai.has(t)) && (Nu.current = gs, fl(!0));
5592
5595
  }, 800);
5593
5596
  return () => window.clearTimeout(e);
5594
5597
  }, [Vn, ys.seen, ys.known, gs, ai]);
@@ -5607,19 +5610,19 @@ ${r.join(`
5607
5610
  const o = s.key.slice(0, s.key.indexOf(".")), l = s.key.slice(s.key.indexOf(".") + 1), c = new Map(n.get(s.key) ?? []), d = c.get(s.rowId);
5608
5611
  if (X.invalidateQueries({ queryKey: ["o2m-rows", o, l, String(p)] }), !d) continue;
5609
5612
  const g = new Set(
5610
- s.conflicts.filter((f) => e.has(v0(s, f.field))).map((f) => f.field)
5611
- ), u = w0(d, g);
5613
+ s.conflicts.filter((f) => e.has(k0(s, f.field))).map((f) => f.field)
5614
+ ), u = x0(d, g);
5612
5615
  u ? (c.set(s.rowId, u), ht.current.set(`${o}:${s.rowId}`, Promise.resolve(s.latest || null)), r++) : (c.delete(s.rowId), ht.current.delete(`${o}:${s.rowId}`)), c.size > 0 ? n.set(s.key, c) : n.delete(s.key);
5613
5616
  }
5614
5617
  if (kr(n), r > 0 && Cs.current && !_t.current && (_t.current = Cs.current), Cs.current = null, la) {
5615
- da(!1), _e.success(
5618
+ da(!1), ge.success(
5616
5619
  r > 0 ? "Your draft now holds your picks — press Save when you are ready" : "Kept the newer values"
5617
5620
  );
5618
5621
  return;
5619
5622
  }
5620
- r > 0 ? Vh((s) => s + 1) : _e.success("Kept the newer values");
5621
- }, Uh = Af(), [To, li] = P(null), Cu = Wt && Uh.active && !I && !St.isPending, Jh = Ig().navigate;
5622
- $y(Cu, (e) => li({ go: e }), qo, Jh);
5623
+ r > 0 ? Vh((s) => s + 1) : ge.success("Kept the newer values");
5624
+ }, Uh = Af(), [To, li] = P(null), Cu = Wt && Uh.active && !I && !St.isPending, Gh = Ig().navigate;
5625
+ $y(Cu, (e) => li({ go: e }), qo, Gh);
5623
5626
  const Ru = L ? () => {
5624
5627
  Cu ? li({ go: L }) : L();
5625
5628
  } : void 0, Ou = $(() => {
@@ -5679,9 +5682,9 @@ ${r.join(`
5679
5682
  const e = `${gn.id}@${gn.updated_at}`;
5680
5683
  Fu.current !== e && (Fu.current = e, ml());
5681
5684
  }, [gn, de, Me, ml]);
5682
- const Gh = A(() => Dy(), []), Yh = () => {
5685
+ const Jh = A(() => Dy(), []), Yh = () => {
5683
5686
  const e = Yl.urlFor({ collection: i, itemId: String(p), layoutSlug: N });
5684
- By(e, i, String(p)) || _e.error("Your browser blocked the window — allow pop-ups for this site and try again");
5687
+ By(e, i, String(p)) || ge.error("Your browser blocked the window — allow pop-ups for this site and try again");
5685
5688
  }, Zh = ce(() => {
5686
5689
  My(i, p), Bi();
5687
5690
  }, [i, p, Bi]), _s = async () => {
@@ -5690,17 +5693,17 @@ ${r.join(`
5690
5693
  (n) => n().catch(() => ({ ok: !1, committed: !1 }))
5691
5694
  )
5692
5695
  ), t = e.find((n) => !n.ok);
5693
- return t ? (_e.error(`${t.label ?? "A line"} has a problem — nothing was moved`, {
5696
+ return t ? (ge.error(`${t.label ?? "A line"} has a problem — nothing was moved`, {
5694
5697
  description: "Fix the line (the reason is under the field) or cancel its edit, then try again."
5695
5698
  }), !1) : (e.some((n) => n.committed) && await Xh(), ju.current());
5696
5699
  }, ju = $(async () => !1);
5697
5700
  ju.current = async () => {
5698
5701
  if (Vr || Me)
5699
- return _e.warning("Choose Theirs or Mine first — nothing was moved", {
5702
+ return ge.warning("Choose Theirs or Mine first — nothing was moved", {
5700
5703
  description: "Someone else saved this record after you opened it."
5701
5704
  }), !1;
5702
5705
  if (!wu()) return !1;
5703
- if (!P0({ isDirty: Ue, staged: cn })) return !0;
5706
+ if (!M0({ isDirty: Ue, staged: cn })) return !0;
5704
5707
  const e = ku();
5705
5708
  if (e)
5706
5709
  return Wr(e), !1;
@@ -5710,11 +5713,11 @@ ${r.join(`
5710
5713
  } catch {
5711
5714
  return !1;
5712
5715
  }
5713
- return L0({
5716
+ return K0({
5714
5717
  childRefused: Ai.current,
5715
5718
  lineConflicts: Fe.current.lineConflicts,
5716
5719
  reasonWaiting: Fe.current.reasonWaiting
5717
- }) ? (Fe.current.lineConflicts && _e.warning("Choose Theirs or Mine first — nothing was moved", {
5720
+ }) ? (Fe.current.lineConflicts && ge.warning("Choose Theirs or Mine first — nothing was moved", {
5718
5721
  description: "A line you changed was also changed by someone else."
5719
5722
  }), !1) : (X.invalidateQueries({ queryKey: ["approval-brief", i, String(p)] }), !0);
5720
5723
  };
@@ -5730,12 +5733,12 @@ ${r.join(`
5730
5733
  }), pl = $f({
5731
5734
  mutationFn: () => R.request(mr(`/items/${i}/${p}`)),
5732
5735
  onSuccess: () => {
5733
- _e.success("Record deleted"), X.invalidateQueries({ queryKey: ["item", i] }), le == null || le();
5736
+ ge.success("Record deleted"), X.invalidateQueries({ queryKey: ["item", i] }), le == null || le();
5734
5737
  },
5735
- onError: (e) => _e.error(Fl(e, "Failed to delete"), {
5738
+ onError: (e) => ge.error(Fl(e, "Failed to delete"), {
5736
5739
  ...iy(e, { action: "Delete record" }),
5737
5740
  ...tm(e) && p ? {
5738
- action: dv(R, {
5741
+ action: uv(R, {
5739
5742
  collection: i,
5740
5743
  itemId: String(p),
5741
5744
  action: "delete"
@@ -5827,7 +5830,7 @@ ${r.join(`
5827
5830
  ft[s] = `${(Tn == null ? void 0 : Tn.locked_by_name) ?? "Someone else"} is editing this record — read-only until the lock is released`;
5828
5831
  continue;
5829
5832
  }
5830
- if (Je) {
5833
+ if (Ge) {
5831
5834
  ft[s] = "Viewing an addendum — switch to the current record to edit";
5832
5835
  continue;
5833
5836
  }
@@ -5840,9 +5843,9 @@ ${r.join(`
5840
5843
  r.computed_type === "rollup" ? ft[s] = "Calculated from related rows — change the rows, not this total" : r.computed_type === "write" ? ft[s] = r.computed_formula ? `Calculated: ${r.computed_formula}` : "Calculated on save from other fields" : r.interface === "relation-path" ? ft[s] = "Value from a related record — edit it there" : (o == null ? void 0 : o.readonly) === !0 ? ft[s] = "Read-only on this layout" : tn.has(s) ? ft[s] = "Set by the system" : ft[s] = "Read-only field";
5841
5844
  }
5842
5845
  }
5843
- const tg = O0(ft, po.data), gl = qv(
5846
+ const tg = j0(ft, po.data), gl = Iv(
5844
5847
  m,
5845
- Se,
5848
+ xe,
5846
5849
  (e) => !!ft[e] || Pt.has(e)
5847
5850
  ), Iu = {};
5848
5851
  for (const e of lt) {
@@ -5963,7 +5966,7 @@ ${r.join(`
5963
5966
  const r = ng(e);
5964
5967
  return r ? { collection: r, id: n } : void 0;
5965
5968
  })(),
5966
- onRevert: () => xe.unstageLink(e, n)
5969
+ onRevert: () => Se.unstageLink(e, n)
5967
5970
  });
5968
5971
  for (const [e, t] of at)
5969
5972
  for (const n of t)
@@ -5972,13 +5975,13 @@ ${r.join(`
5972
5975
  kind: "unlink",
5973
5976
  label: yl(e),
5974
5977
  detail: `− junction #${String(n)}`,
5975
- onRevert: () => xe.unstageUnlink(e, n)
5978
+ onRevert: () => Se.unstageUnlink(e, n)
5976
5979
  });
5977
5980
  const Eu = $(null);
5978
5981
  z(() => {
5979
5982
  var d, g, u;
5980
5983
  const e = fa;
5981
- if (m || !vr || I || fo && Oe === void 0 && !uc || mo && ke === void 0 && !pc || Gy(vr) && de === void 0 && !zn) return;
5984
+ if (m || !vr || I || fo && Oe === void 0 && !uc || mo && ke === void 0 && !pc || Jy(vr) && de === void 0 && !zn) return;
5982
5985
  const t = ((d = ke == null ? void 0 : ke.instance) == null ? void 0 : d.current_state) ?? null, n = ((u = (g = ke == null ? void 0 : ke.states) == null ? void 0 : g.find((f) => f.id === t)) == null ? void 0 : u.key) ?? null, r = Oe != null && Oe.role ? String(Oe.role) : null, s = Yy(
5983
5986
  e,
5984
5987
  mo ? n : null,
@@ -6051,17 +6054,17 @@ ${r.join(`
6051
6054
  fromAutofill: hp,
6052
6055
  glossaryHelp: Fr.glossary !== !1,
6053
6056
  placementText: yo
6054
- }, sg = _b(rg), ig = $_({
6057
+ }, sg = vb(rg), ig = R_({
6055
6058
  labelOf: (e) => {
6056
6059
  const t = (j ?? []).find((n) => n.field === e);
6057
6060
  return t && Ml(t, yo).label || (t == null ? void 0 : t.label) || be(e);
6058
6061
  },
6059
6062
  editSeq: (e) => br.current.get(e) ?? (qe.current.has(e) ? 0 : -1)
6060
6063
  }), Eo = Og();
6061
- z(() => () => Y0(Eo), [Eo]);
6064
+ z(() => () => X0(Eo), [Eo]);
6062
6065
  const og = A(
6063
6066
  () => ({
6064
- draft: Jd,
6067
+ draft: Gd,
6065
6068
  collection: i,
6066
6069
  dirtyFields: qe.current,
6067
6070
  fieldLabels: zs,
@@ -6070,14 +6073,14 @@ ${r.join(`
6070
6073
  isNew: m
6071
6074
  }),
6072
6075
  [
6073
- Jd,
6076
+ Gd,
6074
6077
  i,
6075
6078
  zs,
6076
6079
  Ca,
6077
6080
  Eo,
6078
6081
  m
6079
6082
  ]
6080
- ), Lt = (e, t, n) => Jb(Be, e, t, n), bl = (e, t, n) => Lt(e, t, n), qr = (e, t) => {
6083
+ ), Lt = (e, t, n) => Yb(Be, e, t, n), bl = (e, t, n) => Lt(e, t, n), qr = (e, t) => {
6081
6084
  var n;
6082
6085
  return {
6083
6086
  kind: "slot",
@@ -6086,7 +6089,7 @@ ${r.join(`
6086
6089
  };
6087
6090
  }, dr = (e, t = !0) => $n && (e.hidden || !t), Po = (e, t) => e ? /* @__PURE__ */ a("div", { "data-design-hidden": "", className: "opacity-40", children: t }) : t, vl = (e) => ({
6088
6091
  // A display formula is a `__calc_<n>__` placement — the editor's slot kind (#2712).
6089
- kind: J0(e) ? "slot" : "field",
6092
+ kind: Y0(e) ? "slot" : "field",
6090
6093
  field: e.field,
6091
6094
  group_key: e.group_key ?? null
6092
6095
  }), wl = (e, t, n) => {
@@ -6120,8 +6123,8 @@ ${r.join(`
6120
6123
  hideActionsExpanded: !!ou.hide_actions_expanded,
6121
6124
  onBeforeTransition: _s,
6122
6125
  asRole: rt.roleId,
6123
- addendumPending: !Je && Oi > 0 && !!(x != null && x.addendums_enabled),
6124
- addendumView: Je
6126
+ addendumPending: !Ge && Oi > 0 && !!(x != null && x.addendums_enabled),
6127
+ addendumView: Ge
6125
6128
  },
6126
6129
  "__pipeline__"
6127
6130
  );
@@ -6217,7 +6220,7 @@ ${r.join(`
6217
6220
  const s = If(e);
6218
6221
  if (s)
6219
6222
  return /* @__PURE__ */ a(
6220
- I_,
6223
+ P_,
6221
6224
  {
6222
6225
  slotKey: s,
6223
6226
  collection: i,
@@ -6266,9 +6269,9 @@ ${r.join(`
6266
6269
  return null;
6267
6270
  }
6268
6271
  function Pu() {
6269
- const e = $n ? Se.filter(
6272
+ const e = $n ? xe.filter(
6270
6273
  (t) => !t.group_key && !tn.has(t.field) && !Tr(t.field) && (Bt === null || t.layout_assigned !== !1)
6271
- ) : Jt.filter((t) => !t.hidden);
6274
+ ) : Gt.filter((t) => !t.hidden);
6272
6275
  return e.length === 0 ? null : Lt(
6273
6276
  { kind: "group", key: "__ungrouped__" },
6274
6277
  /* @__PURE__ */ a(
@@ -6363,12 +6366,12 @@ ${r.join(`
6363
6366
  const Y = T.filter((C) => C.required && !C.hidden);
6364
6367
  (Y.length === 0 || Y.every((C) => {
6365
6368
  if (ie.has(C.field)) {
6366
- const G = Qe[C.field];
6367
- return !G || G.ids.length > 0;
6369
+ const J = Qe[C.field];
6370
+ return !J || J.ids.length > 0;
6368
6371
  }
6369
6372
  if (qn.has(C.field)) {
6370
- const G = Qt[C.field];
6371
- return G === void 0 || G > 0;
6373
+ const J = Qt[C.field];
6374
+ return J === void 0 || J > 0;
6372
6375
  }
6373
6376
  const Z = M[C.field];
6374
6377
  return Z != null && Z !== "";
@@ -6376,7 +6379,7 @@ ${r.join(`
6376
6379
  }
6377
6380
  return /* @__PURE__ */ _("div", { className: "nvr-section-enter rounded-xl border border-slate-200 bg-white", children: [
6378
6381
  t !== void 0 && t !== ((v = n[0]) == null ? void 0 : v.key) ? /* @__PURE__ */ a("div", { className: "border-b border-slate-100 px-4 pt-3 pb-2", children: xl(t, (o == null ? void 0 : o.label) ?? t) }) : r ? /* @__PURE__ */ a(
6379
- Gf,
6382
+ Jf,
6380
6383
  {
6381
6384
  steps: n.map((y) => ({ key: y.key, label: y.label })),
6382
6385
  active: s,
@@ -6410,12 +6413,12 @@ ${r.join(`
6410
6413
  )
6411
6414
  ) }),
6412
6415
  /* @__PURE__ */ _("div", { className: "px-5 py-5", children: [
6413
- o && /* @__PURE__ */ a(g0, { group: o, className: "mb-4" }),
6416
+ o && /* @__PURE__ */ a(_0, { group: o, className: "mb-4" }),
6414
6417
  I && o && /* @__PURE__ */ a(Yf, { groupKey: o.key }),
6415
6418
  (() => {
6416
6419
  const y = (Q, Y) => {
6417
6420
  var fn;
6418
- const oe = Ln == null ? void 0 : Ln[Q.field], C = oe == null ? void 0 : oe.entries, Z = (oe == null ? void 0 : oe.separator) ?? null, G = M[Q.field], K = G != null && G !== "", E = C != null && C.length && K ? ((fn = D.find(
6421
+ const oe = Ln == null ? void 0 : Ln[Q.field], C = oe == null ? void 0 : oe.entries, Z = (oe == null ? void 0 : oe.separator) ?? null, J = M[Q.field], K = J != null && J !== "", E = C != null && C.length && K ? ((fn = D.find(
6419
6422
  (ot) => ot.many_collection === i && ot.many_field === Q.field && !ot.junction_field
6420
6423
  )) == null ? void 0 : fn.one_collection) ?? null : null, V = (l == null ? void 0 : l.enabled) && Q.field === l.primary_field, B = (() => {
6421
6424
  const ot = M[(l == null ? void 0 : l.primary_field) ?? ""];
@@ -6531,7 +6534,7 @@ ${r.join(`
6531
6534
  ql,
6532
6535
  {
6533
6536
  relCollection: E,
6534
- relId: G,
6537
+ relId: J,
6535
6538
  entries: C,
6536
6539
  separator: Z
6537
6540
  }
@@ -6652,7 +6655,7 @@ ${r.join(`
6652
6655
  if (typeof e == "string" && e !== "__ungrouped__") return kl(e);
6653
6656
  const t = e;
6654
6657
  if (t.type === "container") return Lu(t);
6655
- if (t.type === "content") return /* @__PURE__ */ a(h0, { group: t }, t.key);
6658
+ if (t.type === "content") return /* @__PURE__ */ a(y0, { group: t }, t.key);
6656
6659
  if (t.type === "metadata" && m) return null;
6657
6660
  const n = (() => {
6658
6661
  try {
@@ -6678,7 +6681,7 @@ ${r.join(`
6678
6681
  return null;
6679
6682
  const u = ko && t.type !== "tab";
6680
6683
  return /* @__PURE__ */ a(
6681
- Y_,
6684
+ X_,
6682
6685
  {
6683
6686
  group: t,
6684
6687
  fields: l,
@@ -6744,8 +6747,8 @@ ${r.join(`
6744
6747
  collection: It,
6745
6748
  item: Ut,
6746
6749
  onBeforeTransition: _s,
6747
- addendumPending: !Je && Oi > 0 && !!(x != null && x.addendums_enabled),
6748
- addendumView: Je
6750
+ addendumPending: !Ge && Oi > 0 && !!(x != null && x.addendums_enabled),
6751
+ addendumView: Ge
6749
6752
  }
6750
6753
  ),
6751
6754
  !ct && jr && /* @__PURE__ */ a(
@@ -6799,7 +6802,7 @@ ${r.join(`
6799
6802
  }
6800
6803
  function Ku(e, t, n, r) {
6801
6804
  return /* @__PURE__ */ a(
6802
- U_,
6805
+ J_,
6803
6806
  {
6804
6807
  row: e,
6805
6808
  members: t,
@@ -6812,7 +6815,7 @@ ${r.join(`
6812
6815
  /* @__PURE__ */ a(
6813
6816
  ws,
6814
6817
  {
6815
- field: J_(s),
6818
+ field: Y_(s),
6816
6819
  draft: Wn,
6817
6820
  onChange: _n,
6818
6821
  relations: D,
@@ -6837,7 +6840,7 @@ ${r.join(`
6837
6840
  }
6838
6841
  function Du(e, t, n) {
6839
6842
  return t.folded.length === 0 ? null : /* @__PURE__ */ a(
6840
- H_,
6843
+ G_,
6841
6844
  {
6842
6845
  count: t.folded.length,
6843
6846
  open: uh.has(e),
@@ -6852,7 +6855,7 @@ ${r.join(`
6852
6855
  );
6853
6856
  }
6854
6857
  function Lo(e, t = !1) {
6855
- const n = (e === "__general__" ? t ? Jt : [...Jt, ...Gt.flatMap((d) => Te[d.key] ?? [])] : Te[e] ?? []).filter((d) => $n || !d.hidden), r = ti && ps === e && ue, s = ei && ms === e && !m, o = Xs.filter((d) => (d.group_key ?? null) === e), l = Mu(
6858
+ const n = (e === "__general__" ? t ? Gt : [...Gt, ...Jt.flatMap((d) => Te[d.key] ?? [])] : Te[e] ?? []).filter((d) => $n || !d.hidden), r = ti && ps === e && ue, s = ei && ms === e && !m, o = Xs.filter((d) => (d.group_key ?? null) === e), l = Mu(
6856
6859
  e === "__general__" ? void 0 : Ce.find((d) => d.key === e),
6857
6860
  n
6858
6861
  ), c = l.units.map(
@@ -6893,7 +6896,7 @@ ${r.join(`
6893
6896
  return Lt(
6894
6897
  qr("__owners__", g.slot.group_key ?? null),
6895
6898
  /* @__PURE__ */ a("div", { style: { gridColumn: `span ${C}` }, children: /* @__PURE__ */ a(
6896
- gv,
6899
+ _v,
6897
6900
  {
6898
6901
  collection: i,
6899
6902
  itemId: p,
@@ -6905,7 +6908,7 @@ ${r.join(`
6905
6908
  }
6906
6909
  if (g._t === "pdf") {
6907
6910
  if (!Bt) return null;
6908
- const C = g.slot.col_span ?? 12, Z = ((Y = g.slot.label_override) == null ? void 0 : Y.trim()) || "Generate PDF", G = !Pn;
6911
+ const C = g.slot.col_span ?? 12, Z = ((Y = g.slot.label_override) == null ? void 0 : Y.trim()) || "Generate PDF", J = !Pn;
6909
6912
  return Lt(
6910
6913
  qr("__pdf__", g.slot.group_key ?? null),
6911
6914
  /* @__PURE__ */ a("div", { style: { gridColumn: `span ${C}` }, children: /* @__PURE__ */ _(
@@ -6913,8 +6916,8 @@ ${r.join(`
6913
6916
  {
6914
6917
  type: "button",
6915
6918
  onClick: () => void lr(),
6916
- disabled: _r || G,
6917
- title: G ? "Configure PDF field in Data Model → Layouts" : void 0,
6919
+ disabled: _r || J,
6920
+ title: J ? "Configure PDF field in Data Model → Layouts" : void 0,
6918
6921
  className: "inline-flex items-center gap-1.5 rounded-md border border-nvr-cyan/40 bg-nvr-cyan/10 px-3 py-1.5 text-[12px] font-medium text-nvr-navy hover:bg-nvr-cyan/20 disabled:cursor-not-allowed disabled:opacity-40 dark:text-nvr-cyan",
6919
6922
  children: [
6920
6923
  /* @__PURE__ */ _(
@@ -7024,7 +7027,7 @@ ${r.join(`
7024
7027
  n && At(n.key);
7025
7028
  }
7026
7029
  }, Bu = (e) => Ha.length > 0 ? /* @__PURE__ */ a(
7027
- hb,
7030
+ yb,
7028
7031
  {
7029
7032
  items: Ha,
7030
7033
  revealed: Us,
@@ -7035,11 +7038,11 @@ ${r.join(`
7035
7038
  function cg() {
7036
7039
  var t;
7037
7040
  const e = [
7038
- ...Gt.length > 0 ? [{ key: "__general__", label: "General" }] : [],
7041
+ ...Jt.length > 0 ? [{ key: "__general__", label: "General" }] : [],
7039
7042
  ...jt.map((n) => ({ key: n.key, label: n.label }))
7040
7043
  ];
7041
7044
  return /* @__PURE__ */ _("div", { "data-section-stack": "", className: "space-y-4", children: [
7042
- Jt.length > 0 && Pu(),
7045
+ Gt.length > 0 && Pu(),
7043
7046
  /* @__PURE__ */ _(
7044
7047
  "div",
7045
7048
  {
@@ -7048,7 +7051,7 @@ ${r.join(`
7048
7051
  children: [
7049
7052
  e.map((n) => {
7050
7053
  const r = Object.keys(nt).some((o) => {
7051
- const l = Se.find((c) => c.field === o);
7054
+ const l = xe.find((c) => c.field === o);
7052
7055
  return (l == null ? void 0 : l.group_key) === n.key || !(l != null && l.group_key) && n.key === "__general__";
7053
7056
  }), s = /* @__PURE__ */ _(
7054
7057
  "button",
@@ -7095,8 +7098,8 @@ ${r.join(`
7095
7098
  collection: It,
7096
7099
  item: Ut,
7097
7100
  onBeforeTransition: _s,
7098
- addendumPending: !Je && Oi > 0 && !!(x != null && x.addendums_enabled),
7099
- addendumView: Je
7101
+ addendumPending: !Ge && Oi > 0 && !!(x != null && x.addendums_enabled),
7102
+ addendumView: Ge
7100
7103
  }
7101
7104
  ),
7102
7105
  !ct && jr && /* @__PURE__ */ a(
@@ -7208,7 +7211,7 @@ ${r.join(`
7208
7211
  return wl(d, u ?? g);
7209
7212
  }),
7210
7213
  /* @__PURE__ */ a(
7211
- Gf,
7214
+ Jf,
7212
7215
  {
7213
7216
  steps: we,
7214
7217
  hiddenSteps: Rr,
@@ -7237,8 +7240,8 @@ ${r.join(`
7237
7240
  item: Ut,
7238
7241
  defaultExpanded: !1,
7239
7242
  onBeforeTransition: _s,
7240
- addendumPending: !Je && Oi > 0 && !!(x != null && x.addendums_enabled),
7241
- addendumView: Je
7243
+ addendumPending: !Ge && Oi > 0 && !!(x != null && x.addendums_enabled),
7244
+ addendumView: Ge
7242
7245
  }
7243
7246
  ),
7244
7247
  !ct && jr && /* @__PURE__ */ a(
@@ -7342,10 +7345,10 @@ ${r.join(`
7342
7345
  ) });
7343
7346
  }
7344
7347
  if ((er == null ? void 0 : er.kind) === "access")
7345
- return /* @__PURE__ */ a("div", { className: De("nvr-fade-in flex flex-1 min-h-0 flex-col overflow-y-auto", Ss), children: /* @__PURE__ */ a(db, { onBack: L ?? (() => window.history.back()) }) });
7348
+ return /* @__PURE__ */ a("div", { className: De("nvr-fade-in flex flex-1 min-h-0 flex-col overflow-y-auto", Ss), children: /* @__PURE__ */ a(ub, { onBack: L ?? (() => window.history.back()) }) });
7346
7349
  if (ra && !de)
7347
7350
  return /* @__PURE__ */ a("div", { className: De("nvr-fade-in flex flex-1 min-h-0 flex-col overflow-y-auto", Ss), children: /* @__PURE__ */ a(
7348
- uv,
7351
+ mv,
7349
7352
  {
7350
7353
  collection: i,
7351
7354
  itemId: String(p),
@@ -7358,7 +7361,7 @@ ${r.join(`
7358
7361
  Pe && /* @__PURE__ */ a("div", { className: "shrink-0 border-b border-slate-200 px-6 py-4 flex items-center gap-3 dark:border-border", children: /* @__PURE__ */ a(hi, { className: "h-6 w-40" }) }),
7359
7362
  cd ? /* @__PURE__ */ _("div", { className: "relative flex-1 min-h-0 overflow-hidden p-6", children: [
7360
7363
  /* @__PURE__ */ a("p", { className: "sr-only", role: "status", children: "Loading record…" }),
7361
- /* @__PURE__ */ a(sv, { plan: cd }),
7364
+ /* @__PURE__ */ a(ov, { plan: cd }),
7362
7365
  Ti.slow && /* @__PURE__ */ a("div", { className: "pointer-events-none absolute inset-x-0 top-3 flex justify-center px-4", children: /* @__PURE__ */ a(em, { reason: Ti, variant: "pill" }) })
7363
7366
  ] }) : /* @__PURE__ */ _("div", { className: "flex flex-1 flex-col items-center justify-center gap-3 p-6", children: [
7364
7367
  /* @__PURE__ */ a("span", { className: "relative flex h-10 w-10 items-center justify-center", children: /* @__PURE__ */ a("span", { className: "absolute inset-0 animate-spin rounded-full border-2 border-slate-200 border-t-nvr-cyan motion-reduce:animate-none dark:border-border dark:border-t-nvr-cyan" }) }),
@@ -7375,15 +7378,15 @@ ${r.join(`
7375
7378
  Eg.Provider,
7376
7379
  {
7377
7380
  value: m || Vt ? null : Ed,
7378
- children: /* @__PURE__ */ a(Pg.Provider, { value: wp, children: /* @__PURE__ */ a(__.Provider, { value: Xp, children: /* @__PURE__ */ a(b_.Provider, { value: He, children: /* @__PURE__ */ a(v_.Provider, { value: Wp, children: /* @__PURE__ */ a(Lg.Provider, { value: og, children: /* @__PURE__ */ a(Mg.Provider, { value: m ? null : Wm, children: /* @__PURE__ */ a(Kg.Provider, { value: Jp, children: /* @__PURE__ */ a(C_.Provider, { value: ig, children: /* @__PURE__ */ a(M0.Provider, { value: dn, children: /* @__PURE__ */ a(K0.Provider, { value: Qp, children: /* @__PURE__ */ a(D0.Provider, { value: Vp, children: /* @__PURE__ */ a(A0.Provider, { value: xe, children: /* @__PURE__ */ _(
7379
- Yv,
7381
+ children: /* @__PURE__ */ a(Pg.Provider, { value: wp, children: /* @__PURE__ */ a(v_.Provider, { value: Xp, children: /* @__PURE__ */ a(w_.Provider, { value: He, children: /* @__PURE__ */ a(k_.Provider, { value: Wp, children: /* @__PURE__ */ a(Lg.Provider, { value: og, children: /* @__PURE__ */ a(Mg.Provider, { value: m ? null : Wm, children: /* @__PURE__ */ a(Kg.Provider, { value: Gp, children: /* @__PURE__ */ a(O_.Provider, { value: ig, children: /* @__PURE__ */ a(D0.Provider, { value: dn, children: /* @__PURE__ */ a(B0.Provider, { value: Qp, children: /* @__PURE__ */ a(z0.Provider, { value: Vp, children: /* @__PURE__ */ a(T0.Provider, { value: Se, children: /* @__PURE__ */ _(
7382
+ Xv,
7380
7383
  {
7381
7384
  affordances: sg,
7382
7385
  personalDefaults: co.context,
7383
7386
  sources: Pm,
7384
7387
  fieldComments: Za,
7385
7388
  children: [
7386
- /* @__PURE__ */ a(iv, {}),
7389
+ /* @__PURE__ */ a(av, {}),
7387
7390
  /* @__PURE__ */ a("p", { className: "sr-only", "aria-live": "polite", "data-live-field-error": !0, children: Hm }),
7388
7391
  /* @__PURE__ */ a(
7389
7392
  yi,
@@ -7430,7 +7433,7 @@ ${r.join(`
7430
7433
  }
7431
7434
  ),
7432
7435
  /* @__PURE__ */ a(
7433
- wv,
7436
+ xv,
7434
7437
  {
7435
7438
  open: fp,
7436
7439
  steps: mp,
@@ -7451,7 +7454,7 @@ ${r.join(`
7451
7454
  /* @__PURE__ */ a("p", { className: "text-[13px] text-slate-600 dark:text-slate-300", children: "These values were copied from the original record, but the new record will store them differently — a rule or your access sets them." }),
7452
7455
  /* @__PURE__ */ a("ul", { className: "mt-3 space-y-1.5 text-[12.5px]", children: (Su ?? []).map((e) => {
7453
7456
  var r;
7454
- const t = ((r = je.get(e.key)) == null ? void 0 : r[e.index]) ?? {}, n = A_(t, e.index);
7457
+ const t = ((r = je.get(e.key)) == null ? void 0 : r[e.index]) ?? {}, n = T_(t, e.index);
7455
7458
  return /* @__PURE__ */ _(
7456
7459
  "li",
7457
7460
  {
@@ -7544,7 +7547,7 @@ ${r.join(`
7544
7547
  }
7545
7548
  ),
7546
7549
  st && /* @__PURE__ */ a(
7547
- p_,
7550
+ g_,
7548
7551
  {
7549
7552
  diff: st.diff,
7550
7553
  fields: j ?? []
@@ -7693,7 +7696,7 @@ ${r.join(`
7693
7696
  }
7694
7697
  ),
7695
7698
  (Yt == null ? void 0 : Yt.api) && /* @__PURE__ */ a(
7696
- Jv,
7699
+ Yv,
7697
7700
  {
7698
7701
  collection: i,
7699
7702
  itemId: String(p),
@@ -7704,7 +7707,7 @@ ${r.join(`
7704
7707
  }
7705
7708
  ),
7706
7709
  Rt && !m && p && !I && /* @__PURE__ */ a(
7707
- Hb,
7710
+ Gb,
7708
7711
  {
7709
7712
  collection: i,
7710
7713
  itemId: String(p)
@@ -7771,7 +7774,7 @@ ${r.join(`
7771
7774
  ),
7772
7775
  /* @__PURE__ */ _("div", { className: "ml-auto flex items-center gap-1.5 [&_button]:whitespace-nowrap", children: [
7773
7776
  Ne,
7774
- /* @__PURE__ */ _(r0, { children: [
7777
+ /* @__PURE__ */ _(i0, { children: [
7775
7778
  m && /* @__PURE__ */ a(
7776
7779
  Lf,
7777
7780
  {
@@ -7780,7 +7783,7 @@ ${r.join(`
7780
7783
  }
7781
7784
  ),
7782
7785
  m && !Vt && /* @__PURE__ */ a(
7783
- f_,
7786
+ p_,
7784
7787
  {
7785
7788
  collection: i,
7786
7789
  onApply: yp,
@@ -7818,7 +7821,7 @@ ${r.join(`
7818
7821
  className: "w-[440px] max-w-[calc(100vw-24px)] p-3",
7819
7822
  "data-quick-picker-modal": !0,
7820
7823
  children: /* @__PURE__ */ a(
7821
- Z0,
7824
+ eb,
7822
7825
  {
7823
7826
  collection: i,
7824
7827
  itemId: p,
@@ -7900,9 +7903,9 @@ ${r.join(`
7900
7903
  ]
7901
7904
  }
7902
7905
  ) : null,
7903
- !m && p ? /* @__PURE__ */ _(s0, { children: [
7906
+ !m && p ? /* @__PURE__ */ _(o0, { children: [
7904
7907
  Qs && !Tn && (Ea || Pa) && /* @__PURE__ */ a(
7905
- av,
7908
+ dv,
7906
7909
  {
7907
7910
  note: Mp,
7908
7911
  onSave: Kp,
@@ -7914,18 +7917,18 @@ ${r.join(`
7914
7917
  }
7915
7918
  ),
7916
7919
  /* @__PURE__ */ a(
7917
- Jf,
7920
+ Gf,
7918
7921
  {
7919
7922
  compact: !0,
7920
7923
  fields: zc,
7921
7924
  onJump: En
7922
7925
  }
7923
7926
  ),
7924
- c_(
7927
+ f_(
7925
7928
  p,
7926
7929
  Rm
7927
7930
  ) && /* @__PURE__ */ a(
7928
- u_,
7931
+ m_,
7929
7932
  {
7930
7933
  compact: !0,
7931
7934
  collection: i,
@@ -7956,7 +7959,7 @@ ${r.join(`
7956
7959
  children: /* @__PURE__ */ a(_g, { className: "h-4 w-4" })
7957
7960
  }
7958
7961
  ),
7959
- !Gh && /* @__PURE__ */ a(
7962
+ !Jh && /* @__PURE__ */ a(
7960
7963
  "button",
7961
7964
  {
7962
7965
  type: "button",
@@ -7969,7 +7972,7 @@ ${r.join(`
7969
7972
  }
7970
7973
  ),
7971
7974
  Rt && ((uf = x == null ? void 0 : x.browser_config) == null ? void 0 : uf.copy_as) !== !1 && /* @__PURE__ */ a(
7972
- a_,
7975
+ d_,
7973
7976
  {
7974
7977
  compact: !0,
7975
7978
  collection: i,
@@ -7978,7 +7981,7 @@ ${r.join(`
7978
7981
  }
7979
7982
  ),
7980
7983
  /* @__PURE__ */ a(
7981
- pb,
7984
+ gb,
7982
7985
  {
7983
7986
  compact: !0,
7984
7987
  collection: i,
@@ -7986,7 +7989,7 @@ ${r.join(`
7986
7989
  }
7987
7990
  ),
7988
7991
  /* @__PURE__ */ a(
7989
- lb,
7992
+ cb,
7990
7993
  {
7991
7994
  compact: !0,
7992
7995
  collection: i,
@@ -7994,7 +7997,7 @@ ${r.join(`
7994
7997
  }
7995
7998
  ),
7996
7999
  /* @__PURE__ */ a(
7997
- eb,
8000
+ nb,
7998
8001
  {
7999
8002
  compact: !0,
8000
8003
  collection: i,
@@ -8002,7 +8005,7 @@ ${r.join(`
8002
8005
  }
8003
8006
  ),
8004
8007
  ih && /* @__PURE__ */ a(
8005
- fv,
8008
+ pv,
8006
8009
  {
8007
8010
  compact: !0,
8008
8011
  collection: i,
@@ -8013,13 +8016,13 @@ ${r.join(`
8013
8016
  }
8014
8017
  )
8015
8018
  ] }) : /* @__PURE__ */ a(
8016
- Jf,
8019
+ Gf,
8017
8020
  {
8018
8021
  fields: zc,
8019
8022
  onJump: En
8020
8023
  }
8021
8024
  ),
8022
- !m && p && /* @__PURE__ */ _(i0, { children: [
8025
+ !m && p && /* @__PURE__ */ _(a0, { children: [
8023
8026
  /* @__PURE__ */ a(
8024
8027
  Lf,
8025
8028
  {
@@ -8070,7 +8073,7 @@ ${r.join(`
8070
8073
  3e4
8071
8074
  );
8072
8075
  } catch {
8073
- _e.error("Dossier export failed");
8076
+ ge.error("Dossier export failed");
8074
8077
  }
8075
8078
  },
8076
8079
  className: "inline-flex h-9 items-center gap-1.5 rounded-md border border-input bg-background px-3 text-sm font-medium shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground",
@@ -8081,7 +8084,7 @@ ${r.join(`
8081
8084
  }
8082
8085
  ),
8083
8086
  Bc.disablePickers && /* @__PURE__ */ a(
8084
- tb,
8087
+ rb,
8085
8088
  {
8086
8089
  collection: i,
8087
8090
  itemId: String(p),
@@ -8089,7 +8092,7 @@ ${r.join(`
8089
8092
  }
8090
8093
  ),
8091
8094
  Bc.schedule && /* @__PURE__ */ a(
8092
- nb,
8095
+ sb,
8093
8096
  {
8094
8097
  collection: i,
8095
8098
  itemId: String(p),
@@ -8233,7 +8236,7 @@ ${r.join(`
8233
8236
  staleTime: 6e4
8234
8237
  }).catch(() => null)
8235
8238
  ]), T = (S.data ?? []).map(
8236
- (Q) => Cv(
8239
+ (Q) => Ov(
8237
8240
  Q,
8238
8241
  h.many_field,
8239
8242
  y
@@ -8383,25 +8386,25 @@ ${r.join(`
8383
8386
  size: "sm",
8384
8387
  "data-nvr-menu-close": !0,
8385
8388
  onClick: () => {
8386
- t_({
8389
+ r_({
8387
8390
  // The viewed addendum's own pipeline,
8388
8391
  // else the record's.
8389
8392
  collection: It,
8390
8393
  item: String(Ut)
8391
8394
  }) || Pi(!0);
8392
8395
  },
8393
- title: Je ? "Put the addendum you are viewing straight into a chosen state of its pipeline, with a reason. No transition steps run (admin)" : "Put this record straight into a chosen pipeline state, with a reason. No transition steps run (admin)",
8396
+ title: Ge ? "Put the addendum you are viewing straight into a chosen state of its pipeline, with a reason. No transition steps run (admin)" : "Put this record straight into a chosen pipeline state, with a reason. No transition steps run (admin)",
8394
8397
  className: "gap-1.5",
8395
8398
  "data-move-to-state-menu": !0,
8396
8399
  children: [
8397
8400
  /* @__PURE__ */ a(xg, { className: "h-3.5 w-3.5" }),
8398
- Je ? "Move addendum to state…" : "Move to state…"
8401
+ Ge ? "Move addendum to state…" : "Move to state…"
8399
8402
  ]
8400
8403
  }
8401
8404
  ),
8402
8405
  oh && // lint-traps-ok: self-triggered; HeaderTools ignores clicks inside dialogs it opened
8403
8406
  /* @__PURE__ */ a(
8404
- S_,
8407
+ $_,
8405
8408
  {
8406
8409
  collection: i,
8407
8410
  itemId: p,
@@ -8544,14 +8547,14 @@ ${r.join(`
8544
8547
  const o = M[r.field];
8545
8548
  o == null || o === "" || typeof o != "object" && (t[r.field] = o);
8546
8549
  }
8547
- const n = Dv(
8550
+ const n = zv(
8548
8551
  j ?? [],
8549
8552
  ie,
8550
8553
  Qe,
8551
8554
  D
8552
8555
  );
8553
8556
  if (n && (t.__links = n), Object.keys(t).length === 0) {
8554
- _e.error(
8557
+ ge.error(
8555
8558
  "Nothing to save — no plain field values on this record"
8556
8559
  );
8557
8560
  return;
@@ -8565,11 +8568,11 @@ ${r.join(`
8565
8568
  data: t,
8566
8569
  is_shared: uu
8567
8570
  })
8568
- ), _e.success(
8571
+ ), ge.success(
8569
8572
  `Template "${si.trim()}" saved`
8570
8573
  ), ri(!1);
8571
8574
  } catch {
8572
- _e.error("Failed to save template");
8575
+ ge.error("Failed to save template");
8573
8576
  } finally {
8574
8577
  pu(!1);
8575
8578
  }
@@ -8587,7 +8590,7 @@ ${r.join(`
8587
8590
  )
8588
8591
  ] }),
8589
8592
  !m && /* @__PURE__ */ a(
8590
- sb,
8593
+ ob,
8591
8594
  {
8592
8595
  actions: Yp,
8593
8596
  onPick: Rc
@@ -8607,15 +8610,15 @@ ${r.join(`
8607
8610
  ]
8608
8611
  }
8609
8612
  ),
8610
- Jn && !m && /* @__PURE__ */ a(
8611
- mv,
8613
+ Gn && !m && /* @__PURE__ */ a(
8614
+ hv,
8612
8615
  {
8613
8616
  collection: i,
8614
8617
  itemId: String(p)
8615
8618
  }
8616
8619
  ),
8617
8620
  !m && p && /* @__PURE__ */ a(
8618
- pv,
8621
+ gv,
8619
8622
  {
8620
8623
  collection: i,
8621
8624
  itemId: String(p),
@@ -8623,7 +8626,7 @@ ${r.join(`
8623
8626
  }
8624
8627
  ),
8625
8628
  !!((pf = w == null ? void 0 : w.layout) != null && pf.changes_tray) && !bt && /* @__PURE__ */ a(
8626
- x_,
8629
+ N_,
8627
8630
  {
8628
8631
  items: Mn,
8629
8632
  saving: St.isPending,
@@ -8653,7 +8656,7 @@ ${r.join(`
8653
8656
  }
8654
8657
  ),
8655
8658
  /* @__PURE__ */ a(
8656
- xv,
8659
+ Nv,
8657
8660
  {
8658
8661
  open: Zm && Ue,
8659
8662
  onClose: () => kd(!1),
@@ -8707,7 +8710,7 @@ ${r.join(`
8707
8710
  onClick: () => Zo((e) => !e),
8708
8711
  className: De(
8709
8712
  "flex h-9 items-center gap-1.5 rounded-md border px-3 text-[12px] font-medium transition-colors",
8710
- Je ? "border-amber-300 bg-amber-50 text-amber-700 hover:bg-amber-100 dark:border-amber-500/40 dark:bg-amber-500/10 dark:text-amber-400" : "border-slate-200 bg-white text-slate-600 hover:bg-slate-50 dark:border-border dark:bg-card dark:text-slate-300"
8713
+ Ge ? "border-amber-300 bg-amber-50 text-amber-700 hover:bg-amber-100 dark:border-amber-500/40 dark:bg-amber-500/10 dark:text-amber-400" : "border-slate-200 bg-white text-slate-600 hover:bg-slate-50 dark:border-border dark:bg-card dark:text-slate-300"
8711
8714
  ),
8712
8715
  title: "Choose which version the form and actions apply to",
8713
8716
  children: [
@@ -8716,11 +8719,11 @@ ${r.join(`
8716
8719
  {
8717
8720
  className: De(
8718
8721
  "h-1.5 w-1.5 shrink-0 rounded-full",
8719
- Je ? "bg-amber-400" : "bg-slate-400"
8722
+ Ge ? "bg-amber-400" : "bg-slate-400"
8720
8723
  )
8721
8724
  }
8722
8725
  ),
8723
- /* @__PURE__ */ a("span", { className: "max-w-[160px] truncate", children: Je ? ((hf = Ht.find(
8726
+ /* @__PURE__ */ a("span", { className: "max-w-[160px] truncate", children: Ge ? ((hf = Ht.find(
8724
8727
  (e) => e.id === He
8725
8728
  )) == null ? void 0 : hf.title) ?? "Addendum" : "Viewing: Current record" }),
8726
8729
  /* @__PURE__ */ a(fi, { className: "h-3 w-3 opacity-60" })
@@ -8789,7 +8792,7 @@ ${r.join(`
8789
8792
  })
8790
8793
  ] })
8791
8794
  ] }),
8792
- !m && ue && (!un || Je) && /* @__PURE__ */ a(
8795
+ !m && ue && (!un || Ge) && /* @__PURE__ */ a(
8793
8796
  nm,
8794
8797
  {
8795
8798
  wrap: !1,
@@ -8804,7 +8807,7 @@ ${r.join(`
8804
8807
  }
8805
8808
  ),
8806
8809
  !m && p && /* @__PURE__ */ a(
8807
- ib,
8810
+ ab,
8808
8811
  {
8809
8812
  action: Zp,
8810
8813
  collection: i,
@@ -8813,13 +8816,13 @@ ${r.join(`
8813
8816
  }
8814
8817
  ),
8815
8818
  Me && /* @__PURE__ */ a(
8816
- q0,
8819
+ I0,
8817
8820
  {
8818
8821
  collision: Me,
8819
8822
  merge: {
8820
8823
  edit: Me.edit,
8821
8824
  current: Me.current,
8822
- derived: Se.filter(
8825
+ derived: xe.filter(
8823
8826
  (e) => e.computed_type === "write" && typeof e.computed_formula == "string" && !!e.computed_formula.trim()
8824
8827
  ).map((e) => ({
8825
8828
  field: e.field,
@@ -8829,16 +8832,16 @@ ${r.join(`
8829
8832
  var t;
8830
8833
  return D.some(
8831
8834
  (n) => n.many_collection === i && n.many_field === e
8832
- ) || !!((t = Se.find((n) => n.field === e)) != null && t.hidden);
8835
+ ) || !!((t = xe.find((n) => n.field === e)) != null && t.hidden);
8833
8836
  }
8834
8837
  },
8835
8838
  fieldLabel: (e) => {
8836
- const t = Se.find((n) => n.field === e);
8839
+ const t = xe.find((n) => n.field === e);
8837
8840
  return (t == null ? void 0 : t.label) || be(e);
8838
8841
  },
8839
8842
  onCancel: () => Qr(null),
8840
8843
  onResolve: (e) => {
8841
- const t = u0({
8844
+ const t = m0({
8842
8845
  draft: U.current,
8843
8846
  initial: $e.current,
8844
8847
  conflicts: Me.conflicts,
@@ -8859,7 +8862,7 @@ ${r.join(`
8859
8862
  }
8860
8863
  ),
8861
8864
  Vr && /* @__PURE__ */ a(
8862
- T0,
8865
+ E0,
8863
8866
  {
8864
8867
  lines: Vr,
8865
8868
  hideField: Kh,
@@ -8872,11 +8875,11 @@ ${r.join(`
8872
8875
  }
8873
8876
  ),
8874
8877
  /* @__PURE__ */ a(
8875
- k_,
8878
+ S_,
8876
8879
  {
8877
8880
  challenge: hd,
8878
8881
  fieldLabel: (e) => {
8879
- const t = Se.find((n) => n.field === e);
8882
+ const t = xe.find((n) => n.field === e);
8880
8883
  return t && Ml(t, yo).label || be(e);
8881
8884
  },
8882
8885
  onCancel: () => Wr(null),
@@ -8886,18 +8889,18 @@ ${r.join(`
8886
8889
  }
8887
8890
  ),
8888
8891
  !m && p && /* @__PURE__ */ a(
8889
- zb,
8892
+ Qb,
8890
8893
  {
8891
8894
  open: jh,
8892
8895
  onOpenChange: lu,
8893
8896
  collection: i,
8894
8897
  item: String(p),
8895
8898
  recordLabel: cr ? String(cr) : null,
8896
- onCreated: (e) => _e.success(`Request #${e.id} sent to the administrators`)
8899
+ onCreated: (e) => ge.success(`Request #${e.id} sent to the administrators`)
8897
8900
  }
8898
8901
  ),
8899
8902
  !Rt && !m && p && /* @__PURE__ */ a(
8900
- Bb,
8903
+ Wb,
8901
8904
  {
8902
8905
  open: Ah,
8903
8906
  onOpenChange: du,
@@ -8912,13 +8915,13 @@ ${r.join(`
8912
8915
  field: e.field,
8913
8916
  label: e.label || be(e.field.replace(/_/g, " "))
8914
8917
  })),
8915
- onSent: (e) => _e.success(
8918
+ onSent: (e) => ge.success(
8916
8919
  `Suggestion #${e.id} sent — follow it under My requests`
8917
8920
  )
8918
8921
  }
8919
8922
  ),
8920
8923
  !m && p && /* @__PURE__ */ a(
8921
- Kb,
8924
+ Bb,
8922
8925
  {
8923
8926
  collection: i,
8924
8927
  itemId: String(p),
@@ -8927,11 +8930,11 @@ ${r.join(`
8927
8930
  }
8928
8931
  ),
8929
8932
  Rt && !m && p && /* @__PURE__ */ a(
8930
- X0,
8933
+ tb,
8931
8934
  {
8932
8935
  collection: i,
8933
8936
  itemId: String(p),
8934
- open: Jm,
8937
+ open: Gm,
8935
8938
  onClose: () => gd(!1),
8936
8939
  onSaved: () => {
8937
8940
  X.invalidateQueries({
@@ -8940,15 +8943,15 @@ ${r.join(`
8940
8943
  }
8941
8944
  }
8942
8945
  ),
8943
- Rt && !m && p && Gm && /* @__PURE__ */ a(
8946
+ Rt && !m && p && Jm && /* @__PURE__ */ a(
8944
8947
  yi,
8945
8948
  {
8946
8949
  open: !0,
8947
8950
  onOpenChange: (e) => !e && Pi(!1),
8948
8951
  children: /* @__PURE__ */ _(_i, { className: "max-w-lg", children: [
8949
- /* @__PURE__ */ a(bi, { children: /* @__PURE__ */ a(vi, { className: "text-[15px]", children: Je ? "Move addendum to state" : "Move to state" }) }),
8952
+ /* @__PURE__ */ a(bi, { children: /* @__PURE__ */ a(vi, { className: "text-[15px]", children: Ge ? "Move addendum to state" : "Move to state" }) }),
8950
8953
  /* @__PURE__ */ a(wi, { children: /* @__PURE__ */ a(
8951
- rv,
8954
+ iv,
8952
8955
  {
8953
8956
  collection: It,
8954
8957
  item: String(Ut),
@@ -8967,17 +8970,17 @@ ${r.join(`
8967
8970
  }
8968
8971
  ),
8969
8972
  (Fr.badge || !I && Qn.switchable || Vn && ai.size > 0) && /* @__PURE__ */ a(
8970
- Wb,
8973
+ Vb,
8971
8974
  {
8972
8975
  badge: Fr.badge,
8973
8976
  mode: !I && Qn.switchable ? Qn.mode : null,
8974
8977
  auto: Qn.auto,
8975
8978
  onMode: Qn.set,
8976
- tour: Vn && ai.size > 0 ? /* @__PURE__ */ a(D_, { onClick: () => fl(!0) }) : void 0
8979
+ tour: Vn && ai.size > 0 ? /* @__PURE__ */ a(z_, { onClick: () => fl(!0) }) : void 0
8977
8980
  }
8978
8981
  ),
8979
8982
  Wh && Vn && /* @__PURE__ */ a(
8980
- B_,
8983
+ W_,
8981
8984
  {
8982
8985
  rootRef: qo,
8983
8986
  steps: ai,
@@ -9022,9 +9025,9 @@ ${r.join(`
9022
9025
  const r = (C, Z) => {
9023
9026
  var E;
9024
9027
  if (!C) return;
9025
- const G = C.cloneNode(!0);
9026
- G.querySelectorAll("[data-copy-skip], button").forEach((V) => V.remove());
9027
- const K = ((E = G.textContent) == null ? void 0 : E.trim()) ?? "";
9028
+ const J = C.cloneNode(!0);
9029
+ J.querySelectorAll("[data-copy-skip], button").forEach((V) => V.remove());
9030
+ const K = ((E = J.textContent) == null ? void 0 : E.trim()) ?? "";
9028
9031
  K && (navigator.clipboard.writeText(K).catch(() => {
9029
9032
  }), nr(Z), setTimeout(
9030
9033
  () => nr(
@@ -9036,7 +9039,7 @@ ${r.join(`
9036
9039
  if (n.type === "summary") {
9037
9040
  const C = n.data;
9038
9041
  return /* @__PURE__ */ a(
9039
- n0,
9042
+ s0,
9040
9043
  {
9041
9044
  collection: i,
9042
9045
  itemId: p,
@@ -9044,7 +9047,7 @@ ${r.join(`
9044
9047
  config: C.config,
9045
9048
  onOpen: (Z) => {
9046
9049
  En(C.field);
9047
- const G = {
9050
+ const J = {
9048
9051
  collection: Z.childCollection,
9049
9052
  field: Z.fkField,
9050
9053
  rowId: Z.rowId
@@ -9055,7 +9058,7 @@ ${r.join(`
9055
9058
  new CustomEvent(
9056
9059
  "nvr:grid-open-row",
9057
9060
  {
9058
- detail: G
9061
+ detail: J
9059
9062
  }
9060
9063
  )
9061
9064
  ),
@@ -9086,9 +9089,9 @@ ${r.join(`
9086
9089
  label: C.label ?? void 0,
9087
9090
  compact: !0,
9088
9091
  strip: !0,
9089
- onWidgetType: (G) => Km((K) => ({
9092
+ onWidgetType: (J) => Km((K) => ({
9090
9093
  ...K,
9091
- [C.field]: G
9094
+ [C.field]: J
9092
9095
  }))
9093
9096
  }
9094
9097
  ),
@@ -9098,8 +9101,8 @@ ${r.join(`
9098
9101
  type: "button",
9099
9102
  "aria-label": "Copy value",
9100
9103
  className: "absolute top-2 right-2 cursor-pointer opacity-0 group-hover:opacity-100 transition-opacity",
9101
- onClick: (G) => r(
9102
- G.currentTarget.closest(
9104
+ onClick: (J) => r(
9105
+ J.currentTarget.closest(
9103
9106
  ".group"
9104
9107
  ),
9105
9108
  C.field
@@ -9138,7 +9141,7 @@ ${r.join(`
9138
9141
  className: Tf,
9139
9142
  "data-header-value": !0,
9140
9143
  children: /* @__PURE__ */ a(
9141
- hv,
9144
+ yv,
9142
9145
  {
9143
9146
  collection: It,
9144
9147
  itemId: Ut
@@ -9167,17 +9170,17 @@ ${r.join(`
9167
9170
  ),
9168
9171
  { asChild: !0 }
9169
9172
  );
9170
- const o = Qe[s.field], l = Cc.get(s.field), c = o ? o.ids : l ?? (s.field in vu ? vu[s.field] : Wn[s.field]), d = Je && !o && (as != null && s.field in as && String(M[s.field] ?? "") !== String(as[s.field] ?? "") || l !== void 0 && Math.round(
9173
+ const o = Qe[s.field], l = Cc.get(s.field), c = o ? o.ids : l ?? (s.field in vu ? vu[s.field] : Wn[s.field]), d = Ge && !o && (as != null && s.field in as && String(M[s.field] ?? "") !== String(as[s.field] ?? "") || l !== void 0 && Math.round(
9171
9174
  Number(M[s.field] ?? 0) * 100
9172
9175
  ) !== Math.round(l * 100)), u = (() => {
9173
9176
  const C = s.thresholds;
9174
9177
  if (!(C != null && C.length)) return;
9175
9178
  const Z = typeof c == "number" ? c : typeof c == "string" && c.trim() !== "" ? Number(c) : Number.NaN;
9176
9179
  if (!Number.isFinite(Z)) return;
9177
- const G = C.find(
9180
+ const J = C.find(
9178
9181
  (K) => K.op === "lt" ? Z < K.value : K.op === "lte" ? Z <= K.value : K.op === "gt" ? Z > K.value : K.op === "gte" ? Z >= K.value : K.op === "eq" ? Z === K.value : !1
9179
9182
  );
9180
- return G == null ? void 0 : G.color;
9183
+ return J == null ? void 0 : J.color;
9181
9184
  })() ?? s.color, f = d ? "text-amber-600 dark:text-amber-400" : u === "cyan" ? "text-nvr-cyan" : u === "blue" ? "text-blue-600 dark:text-blue-400" : u === "green" ? "text-emerald-600 dark:text-emerald-400" : u === "amber" ? "text-amber-600 dark:text-amber-400" : u === "red" ? "text-red-600 dark:text-red-400" : u === "purple" ? "text-purple-600 dark:text-purple-400" : "text-slate-900 dark:text-slate-100", h = s.weight === "bold" ? "font-bold" : s.weight === "semibold" ? "font-semibold" : s.weight === "medium" ? "font-medium" : "font-semibold", v = s.cmsField ? (() => {
9182
9185
  try {
9183
9186
  const C = s.cmsField.options;
@@ -9225,7 +9228,7 @@ ${r.join(`
9225
9228
  );
9226
9229
  const C = s.cmsField ? /* @__PURE__ */ _(Ct, { children: [
9227
9230
  /* @__PURE__ */ a(
9228
- G_,
9231
+ Z_,
9229
9232
  {
9230
9233
  field: s.cmsField,
9231
9234
  val: c,
@@ -9235,8 +9238,8 @@ ${r.join(`
9235
9238
  textClassName: y
9236
9239
  }
9237
9240
  ),
9238
- (s.cmsField.computed_type === "rollup" || (s.cmsField.computed_type === "read" || s.cmsField.computed_type === "write") && S) && !m && !Je && /* @__PURE__ */ a(
9239
- t0,
9241
+ (s.cmsField.computed_type === "rollup" || (s.cmsField.computed_type === "read" || s.cmsField.computed_type === "write") && S) && !m && !Ge && /* @__PURE__ */ a(
9242
+ r0,
9240
9243
  {
9241
9244
  collection: i,
9242
9245
  itemId: p,
@@ -9247,7 +9250,7 @@ ${r.join(`
9247
9250
  "span",
9248
9251
  {
9249
9252
  className: `${S ? gy : yy} ${y}`,
9250
- children: kv(
9253
+ children: Sv(
9251
9254
  c,
9252
9255
  s.displayFormat
9253
9256
  )
@@ -9255,7 +9258,7 @@ ${r.join(`
9255
9258
  ), Z = s.linkTemplate;
9256
9259
  if (!Z || c === null || c === void 0 || c === "" || Array.isArray(c))
9257
9260
  return C;
9258
- const G = Z.replace(
9261
+ const J = Z.replace(
9259
9262
  /\{\{\s*value\s*\}\}/g,
9260
9263
  encodeURIComponent(String(c))
9261
9264
  ).replace(
@@ -9264,10 +9267,10 @@ ${r.join(`
9264
9267
  String(M[V] ?? "")
9265
9268
  )
9266
9269
  );
9267
- return /^https?:\/\//i.test(G) ? /* @__PURE__ */ a(
9270
+ return /^https?:\/\//i.test(J) ? /* @__PURE__ */ a(
9268
9271
  "a",
9269
9272
  {
9270
- href: G,
9273
+ href: J,
9271
9274
  target: "_blank",
9272
9275
  rel: "noopener noreferrer",
9273
9276
  className: "underline decoration-dotted underline-offset-2 hover:decoration-solid",
@@ -9278,8 +9281,8 @@ ${r.join(`
9278
9281
  })()
9279
9282
  }
9280
9283
  ),
9281
- s.cmsField && !s.cmsField.computed_type && !m && !Je && /* @__PURE__ */ a(
9282
- e0,
9284
+ s.cmsField && !s.cmsField.computed_type && !m && !Ge && /* @__PURE__ */ a(
9285
+ n0,
9283
9286
  {
9284
9287
  collection: i,
9285
9288
  itemId: p,
@@ -9298,12 +9301,12 @@ ${r.join(`
9298
9301
  var E;
9299
9302
  const Z = C.currentTarget.closest(
9300
9303
  ".group"
9301
- ), G = Z == null ? void 0 : Z.querySelectorAll(
9304
+ ), J = Z == null ? void 0 : Z.querySelectorAll(
9302
9305
  ":scope > span"
9303
9306
  )[1];
9304
9307
  let K = "";
9305
- if (G) {
9306
- const V = G.cloneNode(
9308
+ if (J) {
9309
+ const V = J.cloneNode(
9307
9310
  !0
9308
9311
  );
9309
9312
  V.querySelectorAll(
@@ -9330,7 +9333,7 @@ ${r.join(`
9330
9333
  });
9331
9334
  return /* @__PURE__ */ _(Ct, { children: [
9332
9335
  /* @__PURE__ */ a(
9333
- X_,
9336
+ t0,
9334
9337
  {
9335
9338
  tiles: e,
9336
9339
  folded: ha ? dp : [],
@@ -9389,10 +9392,10 @@ ${r.join(`
9389
9392
  ),
9390
9393
  onScroll: vn ? Fd : void 0,
9391
9394
  children: [
9392
- !m && /* @__PURE__ */ a(G0, {}),
9395
+ !m && /* @__PURE__ */ a(Z0, {}),
9393
9396
  Cm,
9394
9397
  fd && ru.length > 0 && /* @__PURE__ */ a(
9395
- Ab,
9398
+ Tb,
9396
9399
  {
9397
9400
  items: ru,
9398
9401
  onJump: Wc,
@@ -9426,9 +9429,9 @@ ${r.join(`
9426
9429
  ]
9427
9430
  }
9428
9431
  ),
9429
- !I && Bt != null && /* @__PURE__ */ a(d_, { layoutId: Bt }),
9432
+ !I && Bt != null && /* @__PURE__ */ a(u_, { layoutId: Bt }),
9430
9433
  qm && /* @__PURE__ */ a(
9431
- Tb,
9434
+ Eb,
9432
9435
  {
9433
9436
  roles: rt.roles,
9434
9437
  roleId: rt.roleId,
@@ -9440,7 +9443,7 @@ ${r.join(`
9440
9443
  }
9441
9444
  ),
9442
9445
  !m && gn && /* @__PURE__ */ a("div", { className: "nvr-expand-in", children: /* @__PURE__ */ a(
9443
- fb,
9446
+ pb,
9444
9447
  {
9445
9448
  entry: gn,
9446
9449
  labelFor: (e) => {
@@ -9479,7 +9482,7 @@ ${r.join(`
9479
9482
  }
9480
9483
  ),
9481
9484
  nn.state === "offer" && !(Vt && !m) && /* @__PURE__ */ a("div", { className: "nvr-expand-in", children: /* @__PURE__ */ a(
9482
- j_,
9485
+ q_,
9483
9486
  {
9484
9487
  draft: nn.draft,
9485
9488
  labelFor: (e) => {
@@ -9510,7 +9513,7 @@ ${r.join(`
9510
9513
  }
9511
9514
  ) }),
9512
9515
  !m && p && !I && /* @__PURE__ */ a(
9513
- mb,
9516
+ hb,
9514
9517
  {
9515
9518
  collection: i,
9516
9519
  itemId: String(p)
@@ -9520,7 +9523,7 @@ ${r.join(`
9520
9523
  !I && !((yf = w == null ? void 0 : w.layout) != null && yf.hide_integrity_banner) && // Summary mode marks the affected fields instead —
9521
9524
  // the banner would only push the record down.
9522
9525
  !(bt && Ur) && /* @__PURE__ */ a(
9523
- Lb,
9526
+ Kb,
9524
9527
  {
9525
9528
  collection: i,
9526
9529
  itemId: String(p),
@@ -9528,7 +9531,7 @@ ${r.join(`
9528
9531
  }
9529
9532
  ),
9530
9533
  Rt && !I && !!((bf = (_f = po.data) == null ? void 0 : _f.hidden) != null && bf.length) && /* @__PURE__ */ a(
9531
- F0,
9534
+ A0,
9532
9535
  {
9533
9536
  why: po.data,
9534
9537
  fields: j ?? [],
@@ -9538,14 +9541,14 @@ ${r.join(`
9538
9541
  !m && p && !((vf = w == null ? void 0 : w.layout) != null && vf.hide_sla_banner) && // No wrapper div — an EMPTY sibling in this space-y stack
9539
9542
  // still costs a 16px gap (the banner is null unless breached).
9540
9543
  /* @__PURE__ */ a(
9541
- Mb,
9544
+ Db,
9542
9545
  {
9543
9546
  collection: It,
9544
9547
  itemId: String(Ut)
9545
9548
  }
9546
9549
  ),
9547
9550
  !m && p && !I && /* @__PURE__ */ a(
9548
- Eb,
9551
+ Lb,
9549
9552
  {
9550
9553
  collection: i,
9551
9554
  itemId: String(p)
@@ -9570,8 +9573,8 @@ ${r.join(`
9570
9573
  ]
9571
9574
  }
9572
9575
  ),
9573
- Jl && Qs && Tn && /* @__PURE__ */ a("div", { className: "nvr-expand-in", children: /* @__PURE__ */ a(
9574
- lv,
9576
+ Gl && Qs && Tn && /* @__PURE__ */ a("div", { className: "nvr-expand-in", children: /* @__PURE__ */ a(
9577
+ cv,
9575
9578
  {
9576
9579
  lockHolder: Tn,
9577
9580
  onTakeOver: jp,
@@ -9587,7 +9590,7 @@ ${r.join(`
9587
9590
  }
9588
9591
  ) }),
9589
9592
  !m && !I && /* @__PURE__ */ a(
9590
- cb,
9593
+ fb,
9591
9594
  {
9592
9595
  collection: i,
9593
9596
  itemId: String(p),
@@ -9621,7 +9624,7 @@ ${r.join(`
9621
9624
  }
9622
9625
  ),
9623
9626
  Ur ? bt && !m && (w != null && w.layout) ? /* @__PURE__ */ a(
9624
- Db,
9627
+ zb,
9625
9628
  {
9626
9629
  collection: i,
9627
9630
  itemId: String(p),
@@ -9679,15 +9682,15 @@ ${r.join(`
9679
9682
  vn && /* @__PURE__ */ _(
9680
9683
  "div",
9681
9684
  {
9682
- "data-summary-rail": Js ? "overlay" : "",
9685
+ "data-summary-rail": Gs ? "overlay" : "",
9683
9686
  className: De(
9684
9687
  "flex shrink-0 border-l border-slate-200 dark:border-border",
9685
- I && Ja && "sticky top-0 self-start",
9688
+ I && Ga && "sticky top-0 self-start",
9686
9689
  // Phone width: open, the rail lies OVER the form (with
9687
9690
  // its own background) instead of squeezing it to 114 px.
9688
- Js && !wn && "absolute inset-y-0 right-0 z-20 bg-white shadow-xl dark:bg-card"
9691
+ Gs && !wn && "absolute inset-y-0 right-0 z-20 bg-white shadow-xl dark:bg-card"
9689
9692
  ),
9690
- style: I && Ja ? { height: Ja } : void 0,
9693
+ style: I && Ga ? { height: Ga } : void 0,
9691
9694
  children: [
9692
9695
  /* @__PURE__ */ a(
9693
9696
  "button",
@@ -9695,14 +9698,14 @@ ${r.join(`
9695
9698
  type: "button",
9696
9699
  onClick: () => {
9697
9700
  const e = !wn;
9698
- us(e), I && tv(Le, e);
9701
+ us(e), I && rv(Le, e);
9699
9702
  },
9700
9703
  "data-design-pass": I ? "" : void 0,
9701
9704
  "data-summary-toggle": I ? "" : void 0,
9702
- "aria-expanded": I || Js ? !wn : void 0,
9705
+ "aria-expanded": I || Gs ? !wn : void 0,
9703
9706
  "aria-label": wn ? "Show summary" : "Hide summary",
9704
9707
  title: wn ? "Expand summary" : "Collapse summary",
9705
- className: I ? _v : "border-r flex w-6 shrink-0 items-start justify-center pt-3 bg-slate-100 text-slate-400 hover:bg-slate-200/70 hover:text-slate-600 transition-colors dark:bg-white/[0.04] dark:hover:bg-white/[0.08] dark:text-slate-500 dark:hover:text-slate-300",
9708
+ className: I ? vv : "border-r flex w-6 shrink-0 items-start justify-center pt-3 bg-slate-100 text-slate-400 hover:bg-slate-200/70 hover:text-slate-600 transition-colors dark:bg-white/[0.04] dark:hover:bg-white/[0.08] dark:text-slate-500 dark:hover:text-slate-300",
9706
9709
  children: I ? (
9707
9710
  // Rides with the canvas scroll; folded, it says what comes back.
9708
9711
  /* @__PURE__ */ _("span", { className: "sticky top-3 flex flex-col items-center gap-2", children: [
@@ -9718,7 +9721,7 @@ ${r.join(`
9718
9721
  className: "overflow-hidden transition-all duration-200",
9719
9722
  style: { width: wn ? 0 : 232 },
9720
9723
  children: /* @__PURE__ */ a("div", { className: "w-[232px] overflow-y-auto h-full", children: /* @__PURE__ */ a(
9721
- Ub,
9724
+ Jb,
9722
9725
  {
9723
9726
  onRevertChange: (e) => {
9724
9727
  var t;
@@ -9734,15 +9737,15 @@ ${r.join(`
9734
9737
  label: e.label
9735
9738
  })) : we,
9736
9739
  groupedMap: Te,
9737
- ungroupedFields: Jt,
9738
- sectionGroups: Gt.filter(
9740
+ ungroupedFields: Gt,
9741
+ sectionGroups: Jt.filter(
9739
9742
  (e) => e.type !== "metadata"
9740
9743
  ),
9741
9744
  draft: M,
9742
9745
  relations: D,
9743
9746
  collection: i,
9744
9747
  itemId: p,
9745
- staging: xe,
9748
+ staging: Se,
9746
9749
  stagedO2MRows: je,
9747
9750
  stagedO2MDeletes: We,
9748
9751
  errors: nt,
@@ -9833,46 +9836,46 @@ ${r.join(`
9833
9836
  );
9834
9837
  }
9835
9838
  export {
9836
- cS as ItemEditForm,
9837
- A0 as M2MStagingContext,
9839
+ mS as ItemEditForm,
9840
+ T0 as M2MStagingContext,
9838
9841
  cm as REQUIRED_LINES_MESSAGE,
9839
9842
  Wl as UNAVAILABLE_OPTION_ERROR,
9840
- xv as UnsavedInspector,
9841
- Wv as appendUniqueM2MId,
9842
- Sv as applyLayoutDefaults,
9843
+ Nv as UnsavedInspector,
9844
+ Vv as appendUniqueM2MId,
9845
+ $v as applyLayoutDefaults,
9843
9846
  Sm as computeM2MEffectiveIds,
9844
- Ov as draftDiffers,
9847
+ jv as draftDiffers,
9845
9848
  dm as dropSatisfiedRequired,
9846
- Hv as dropUnsettledAliasResults,
9847
- Cv as duplicateChildRow,
9848
- qv as everyShownFieldLocked,
9849
+ Gv as dropUnsettledAliasResults,
9850
+ Ov as duplicateChildRow,
9851
+ Iv as everyShownFieldLocked,
9849
9852
  Bg as formatApiPayload,
9850
- Qv as idsNeedingStaging,
9853
+ Hv as idsNeedingStaging,
9851
9854
  Vl as isNoDuplicate,
9852
- zv as isRuleFill,
9853
- Fv as keepCollisionBase,
9854
- Bv as keptAmong,
9855
+ Qv as isRuleFill,
9856
+ Av as keepCollisionBase,
9857
+ Wv as keptAmong,
9855
9858
  fm as keptLinksAmong,
9856
- v0 as lineConflictKey,
9859
+ k0 as lineConflictKey,
9857
9860
  Ko as lineLabelOf,
9858
- Av as liveCrossFieldErrors,
9859
- Mv as mergeRuleResults,
9860
- jv as o2mCountIsStale,
9861
- Nv as ownEditFields,
9862
- Uv as partitionRuleResults,
9863
- Kv as prefillAliasLinks,
9861
+ Tv as liveCrossFieldErrors,
9862
+ Dv as mergeRuleResults,
9863
+ qv as o2mCountIsStale,
9864
+ Cv as ownEditFields,
9865
+ Jv as partitionRuleResults,
9866
+ Bv as prefillAliasLinks,
9864
9867
  sm as recordHeadingText,
9865
- Tv as refusalStepText,
9866
- Lv as remoteChangeAuthor,
9867
- Pv as remoteChangedFields,
9868
- w0 as resolveLineCollision,
9868
+ Ev as refusalStepText,
9869
+ Kv as remoteChangeAuthor,
9870
+ Mv as remoteChangedFields,
9871
+ x0 as resolveLineCollision,
9869
9872
  Hl as resolveM2MAlias,
9870
- Vv as resolveM2MFieldState,
9873
+ Uv as resolveM2MFieldState,
9871
9874
  Nm as ruleFillKey,
9872
- Iv as ruleJudgedOnSave,
9875
+ Pv as ruleJudgedOnSave,
9873
9876
  lm as rulesForTriggerField,
9874
- Ev as serverErrorCode,
9875
- Dv as templateLinks,
9876
- mS as useM2MStaging,
9877
+ Lv as serverErrorCode,
9878
+ zv as templateLinks,
9879
+ gS as useM2MStaging,
9877
9880
  zf as withRowBaseRevision
9878
9881
  };