@ai-matrx/records-ui 0.116.0 → 0.116.2
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.
- package/CHANGELOG.md +48 -1
- package/dist/SaveToTable-3VDK4U5M.js +20 -0
- package/dist/chunk-32TUVT57.js +246 -0
- package/dist/chunk-32TUVT57.js.map +1 -0
- package/dist/chunk-B5S5F5NH.js +445 -0
- package/dist/chunk-B5S5F5NH.js.map +1 -0
- package/dist/chunk-IUUZVQZD.js +95 -0
- package/dist/chunk-IUUZVQZD.js.map +1 -0
- package/dist/{chunk-6NSGVKYL.js → chunk-NJYJEAQC.js} +1 -91
- package/dist/chunk-NJYJEAQC.js.map +1 -0
- package/dist/{chunk-4ZYGWYQP.js → chunk-QRZ4RW2T.js} +56 -31
- package/dist/chunk-QRZ4RW2T.js.map +1 -0
- package/dist/chunk-SPPATZSR.js +288 -0
- package/dist/chunk-SPPATZSR.js.map +1 -0
- package/dist/{chunk-7IZJT3DV.js → chunk-TCRNJVGZ.js} +93 -512
- package/dist/chunk-TCRNJVGZ.js.map +1 -0
- package/dist/{chunk-W5SOKJ5P.js → chunk-TNIC2SGW.js} +5 -3
- package/dist/{chunk-W5SOKJ5P.js.map → chunk-TNIC2SGW.js.map} +1 -1
- package/dist/{chunk-3OKHOGSO.js → chunk-VCAOXQ5K.js} +2 -283
- package/dist/chunk-VCAOXQ5K.js.map +1 -0
- package/dist/first-page.cjs.map +1 -1
- package/dist/first-page.js.map +1 -1
- package/dist/helpers.cjs +812 -8
- package/dist/helpers.cjs.map +1 -1
- package/dist/helpers.d.cts +441 -3
- package/dist/helpers.d.ts +441 -3
- package/dist/helpers.js +754 -10
- package/dist/helpers.js.map +1 -1
- package/dist/index.cjs +1634 -1581
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +156 -168
- package/dist/index.d.ts +156 -168
- package/dist/index.js +4286 -4477
- package/dist/index.js.map +1 -1
- package/dist/object-actions.js +3 -2
- package/dist/pickers.cjs +52 -13
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +6 -3
- package/dist/skeleton.cjs +262 -0
- package/dist/skeleton.cjs.map +1 -0
- package/dist/skeleton.d.cts +50 -0
- package/dist/skeleton.d.ts +50 -0
- package/dist/skeleton.js +26 -0
- package/dist/skeleton.js.map +1 -0
- package/package.json +18 -7
- package/dist/SaveToTable-AG7ZY4IG.js +0 -18
- package/dist/chunk-3OKHOGSO.js.map +0 -1
- package/dist/chunk-4ZYGWYQP.js.map +0 -1
- package/dist/chunk-6NSGVKYL.js.map +0 -1
- package/dist/chunk-7IZJT3DV.js.map +0 -1
- /package/dist/{SaveToTable-AG7ZY4IG.js.map → SaveToTable-3VDK4U5M.js.map} +0 -0
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
fieldTypeChoice,
|
|
4
|
+
isSystemFieldKind
|
|
5
|
+
} from "./chunk-NJYJEAQC.js";
|
|
6
|
+
|
|
7
|
+
// src/docs.ts
|
|
8
|
+
function fieldToken(fieldId) {
|
|
9
|
+
return `{{field:${fieldId}}}`;
|
|
10
|
+
}
|
|
11
|
+
function bodyFromKeys(body, fields) {
|
|
12
|
+
const byKey = new Map(fields.map((f) => [f.key, f.id]));
|
|
13
|
+
return body.replace(/\{\{\s*([a-zA-Z0-9_]+)\s*\}\}/g, (whole, key) => {
|
|
14
|
+
const id = byKey.get(key);
|
|
15
|
+
return id ? fieldToken(id) : whole;
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function bodyForReading(body, fields) {
|
|
19
|
+
const byId = new Map(fields.map((f) => [f.id, f.label || f.key]));
|
|
20
|
+
return body.replace(/\{\{\s*field:([0-9a-fA-F-]{36})\s*\}\}/g, (whole, id) => {
|
|
21
|
+
const label = byId.get(id);
|
|
22
|
+
return label ? `{{${label}}}` : whole;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function isSignatureField(field) {
|
|
26
|
+
return field.type === "text" && (field.format ?? "").toLowerCase() === "signature";
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// src/choiceLooks.ts
|
|
30
|
+
import { newerKindOf } from "@ai-matrx/records/field-kinds";
|
|
31
|
+
import { CHOICE_CHIP_CLASS, NEUTRAL_CHIP_CLASS, STYLE_COLORS } from "@ai-matrx/design-system/data-table/table-style";
|
|
32
|
+
function displayFormatOf(field) {
|
|
33
|
+
const raw = field.display_format;
|
|
34
|
+
if (!raw || typeof raw !== "object") return null;
|
|
35
|
+
const id = raw.id;
|
|
36
|
+
if (typeof id !== "string" || id === "") return null;
|
|
37
|
+
const options = raw.options;
|
|
38
|
+
return { id, options: options && typeof options === "object" ? options : {} };
|
|
39
|
+
}
|
|
40
|
+
function isStyleColor(v) {
|
|
41
|
+
return typeof v === "string" && STYLE_COLORS.includes(v);
|
|
42
|
+
}
|
|
43
|
+
function choiceLooksOf(field) {
|
|
44
|
+
const display = displayFormatOf(field);
|
|
45
|
+
const choices = display?.options["choices"];
|
|
46
|
+
if (!Array.isArray(choices)) return [];
|
|
47
|
+
const out = [];
|
|
48
|
+
for (const c of choices) {
|
|
49
|
+
if (!c || typeof c !== "object") continue;
|
|
50
|
+
const value = c.value;
|
|
51
|
+
if (typeof value !== "string" || value.trim() === "") continue;
|
|
52
|
+
const color = c.color;
|
|
53
|
+
const label = c.label;
|
|
54
|
+
out.push({
|
|
55
|
+
value: value.trim(),
|
|
56
|
+
...typeof label === "string" && label.trim() !== "" ? { label: label.trim() } : {},
|
|
57
|
+
...isStyleColor(color) ? { color } : {}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return out;
|
|
61
|
+
}
|
|
62
|
+
function choiceWord(value) {
|
|
63
|
+
return String(value ?? "").trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
64
|
+
}
|
|
65
|
+
var STATUS_GROUP_COLOR = { todo: "gray", in_progress: "blue", done: "green" };
|
|
66
|
+
function statusGroupColor(field, value) {
|
|
67
|
+
if (newerKindOf(field) !== "status" || value === null || value === void 0 || value === "") return void 0;
|
|
68
|
+
const word = choiceWord(value);
|
|
69
|
+
if (word === "") return void 0;
|
|
70
|
+
const groups = (field.config ?? {})["status_groups"];
|
|
71
|
+
if (groups && typeof groups === "object") {
|
|
72
|
+
for (const [key, group] of Object.entries(groups)) {
|
|
73
|
+
if (choiceWord(key) !== word) continue;
|
|
74
|
+
return group === "in_progress" ? STATUS_GROUP_COLOR.in_progress : group === "done" ? STATUS_GROUP_COLOR.done : STATUS_GROUP_COLOR.todo;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return STATUS_GROUP_COLOR.todo;
|
|
78
|
+
}
|
|
79
|
+
function storedChoiceColor(field, value) {
|
|
80
|
+
if (value === null || value === void 0 || value === "") return void 0;
|
|
81
|
+
const word = choiceWord(value);
|
|
82
|
+
if (word === "") return void 0;
|
|
83
|
+
for (const look of choiceLooksOf(field)) {
|
|
84
|
+
if (!look.color) continue;
|
|
85
|
+
if (choiceWord(look.value) === word || look.label && choiceWord(look.label) === word) return look.color;
|
|
86
|
+
}
|
|
87
|
+
return statusGroupColor(field, value);
|
|
88
|
+
}
|
|
89
|
+
function storedChoiceColorLookup(fields, fallback) {
|
|
90
|
+
const byKey = new Map(fields.map((f) => [f.key, f]));
|
|
91
|
+
return (fieldKey, value) => {
|
|
92
|
+
const field = byKey.get(fieldKey);
|
|
93
|
+
return (field ? storedChoiceColor(field, value) : void 0) ?? fallback(fieldKey, value);
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
var NEW_CHOICE_PALETTE = ["blue", "green", "amber", "red", "violet", "teal", "slate"];
|
|
97
|
+
function nextChoiceColor(worn) {
|
|
98
|
+
const taken = new Set(worn.filter((c) => Boolean(c)));
|
|
99
|
+
const free = NEW_CHOICE_PALETTE.find((c) => !taken.has(c));
|
|
100
|
+
return free ?? NEW_CHOICE_PALETTE[worn.length % NEW_CHOICE_PALETTE.length];
|
|
101
|
+
}
|
|
102
|
+
function choiceChipLookOf(field, ...words) {
|
|
103
|
+
for (const word of words) {
|
|
104
|
+
const color = storedChoiceColor(field, word);
|
|
105
|
+
if (color) return { className: CHOICE_CHIP_CLASS[color], color };
|
|
106
|
+
}
|
|
107
|
+
return { className: NEUTRAL_CHIP_CLASS, color: null };
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// src/parity.ts
|
|
111
|
+
import {
|
|
112
|
+
KERNEL_TABLES,
|
|
113
|
+
PARITY_FIELD_TYPES,
|
|
114
|
+
fieldKindFor,
|
|
115
|
+
newerKindOf as newerKindOf2,
|
|
116
|
+
isButtonField
|
|
117
|
+
} from "@ai-matrx/records/field-kinds";
|
|
118
|
+
import { humanizeIdentifier } from "@ai-matrx/kit/text-case";
|
|
119
|
+
var kernelId = (name) => KERNEL_TABLES.find((t) => t.name === name)?.id ?? "";
|
|
120
|
+
var KERNEL_FILE_TABLE = kernelId("File");
|
|
121
|
+
var KERNEL_PERSON_TABLE = kernelId("Person");
|
|
122
|
+
var PARITY_LABEL = {
|
|
123
|
+
attachment: "Attachment",
|
|
124
|
+
checkbox: "Yes / no",
|
|
125
|
+
currency: "Currency",
|
|
126
|
+
datetime: "Date",
|
|
127
|
+
email: "Email",
|
|
128
|
+
formula: "Formula",
|
|
129
|
+
lookup: "Lookup",
|
|
130
|
+
member: "Person",
|
|
131
|
+
multi_select: "Multi-select",
|
|
132
|
+
percent: "Percent",
|
|
133
|
+
phone: "Phone",
|
|
134
|
+
rollup: "Rollup",
|
|
135
|
+
select: "Select",
|
|
136
|
+
url: "Link"
|
|
137
|
+
};
|
|
138
|
+
var PARITY_MADE_OF = Object.fromEntries(
|
|
139
|
+
PARITY_FIELD_TYPES.map((p) => [p.parity_type, p.made_of])
|
|
140
|
+
);
|
|
141
|
+
var KERNEL = { file: KERNEL_FILE_TABLE, person: KERNEL_PERSON_TABLE };
|
|
142
|
+
function editorKindFor(field) {
|
|
143
|
+
return fieldKindFor(field, KERNEL);
|
|
144
|
+
}
|
|
145
|
+
function pickableTypeOf(field) {
|
|
146
|
+
if (isSignatureField(field)) return "signature";
|
|
147
|
+
if (isButtonField(field)) return "button";
|
|
148
|
+
const newer = newerKindOf2(field);
|
|
149
|
+
if (newer) return newer;
|
|
150
|
+
const look = displayFormatOf(field)?.id;
|
|
151
|
+
if (look === "rating" && field.type === "range") return "rating";
|
|
152
|
+
if (look === "time" && field.type === "text") return "time";
|
|
153
|
+
const system = field.config?.["system"];
|
|
154
|
+
if (field.type === "formula" && typeof system === "string" && isSystemFieldKind(system)) return system;
|
|
155
|
+
const kind = editorKindFor(field);
|
|
156
|
+
return fieldTypeChoice(kind) ? kind : void 0;
|
|
157
|
+
}
|
|
158
|
+
function fieldTypeLabel(field) {
|
|
159
|
+
const kind = pickableTypeOf(field) ?? editorKindFor(field);
|
|
160
|
+
const known = fieldTypeChoice(kind)?.label;
|
|
161
|
+
if (known) return field.multi && kind !== "multi_select" ? `${known} (many)` : known;
|
|
162
|
+
const plain = {
|
|
163
|
+
// `boolean` is the BEHAVIOUR word; `checkbox` is the type a person picks. Both are
|
|
164
|
+
// written the way a person writes them, never as a raw token.
|
|
165
|
+
boolean: "Yes / no",
|
|
166
|
+
date: "Date",
|
|
167
|
+
json: "Structured data",
|
|
168
|
+
relation: "Link to a record"
|
|
169
|
+
};
|
|
170
|
+
return plain[kind] ?? humanizeIdentifier(kind);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// src/dates.ts
|
|
174
|
+
import { formatFieldValue } from "@ai-matrx/design-system/field-formats";
|
|
175
|
+
var BARE_CALENDAR_DATE = /^(\d{4})-(\d{2})-(\d{2})(?:[T ]00:00(?::00(?:\.0+)?)?)?$/;
|
|
176
|
+
function systemStampOf(field) {
|
|
177
|
+
if (field.type !== "formula") return null;
|
|
178
|
+
const system = String((field.config ?? {})["system"] ?? "");
|
|
179
|
+
return system === "autonumber" || system === "created_time" || system === "modified_time" ? system : null;
|
|
180
|
+
}
|
|
181
|
+
function carriesTimeOfDay(field, value) {
|
|
182
|
+
if (value !== void 0 && value !== null && value !== "") return hasTimePart(value);
|
|
183
|
+
const stamp = systemStampOf(field);
|
|
184
|
+
if (stamp === "created_time" || stamp === "modified_time") return true;
|
|
185
|
+
return (field.format ?? "").toLowerCase() === "datetime";
|
|
186
|
+
}
|
|
187
|
+
function timeOfDayWords(value) {
|
|
188
|
+
if (!hasTimePart(value)) return null;
|
|
189
|
+
const at = value instanceof Date ? value : new Date(value);
|
|
190
|
+
return Number.isNaN(at.getTime()) ? null : at.toLocaleTimeString(void 0, { hour: "numeric", minute: "2-digit" });
|
|
191
|
+
}
|
|
192
|
+
function hasTimePart(value) {
|
|
193
|
+
if (value instanceof Date || typeof value === "number") return true;
|
|
194
|
+
if (typeof value !== "string") return false;
|
|
195
|
+
const trimmed = value.trim();
|
|
196
|
+
if (BARE_CALENDAR_DATE.test(trimmed)) return false;
|
|
197
|
+
return /^\d{4}-\d{2}-\d{2}[T ]\d/.test(trimmed);
|
|
198
|
+
}
|
|
199
|
+
function isDateField(field) {
|
|
200
|
+
const stamp = systemStampOf(field);
|
|
201
|
+
if (stamp === "created_time" || stamp === "modified_time") return true;
|
|
202
|
+
if (field.type !== "range") return false;
|
|
203
|
+
const kind = String((field.config ?? {})["kind"] ?? "");
|
|
204
|
+
return kind === "date" || kind === "datetime";
|
|
205
|
+
}
|
|
206
|
+
function dateFormatFor(field, value) {
|
|
207
|
+
if (!isDateField(field)) return void 0;
|
|
208
|
+
return carriesTimeOfDay(field, value) ? { id: "datetime" } : { id: "date" };
|
|
209
|
+
}
|
|
210
|
+
function dateText(field, value) {
|
|
211
|
+
const format = dateFormatFor(field, value) ?? (isDateLike(value) ? { id: hasTimePart(value) ? "datetime" : "date" } : void 0);
|
|
212
|
+
if (!format) return null;
|
|
213
|
+
const result = formatFieldValue(value, format);
|
|
214
|
+
return result.ok && !result.empty ? result.text : null;
|
|
215
|
+
}
|
|
216
|
+
function isDateLike(value) {
|
|
217
|
+
return typeof value === "string" && /^\d{4}-\d{2}-\d{2}/.test(value.trim());
|
|
218
|
+
}
|
|
219
|
+
function pad(n) {
|
|
220
|
+
return n < 10 ? `0${n}` : String(n);
|
|
221
|
+
}
|
|
222
|
+
function calendarDayOf(value) {
|
|
223
|
+
if (typeof value === "string") {
|
|
224
|
+
const trimmed = value.trim();
|
|
225
|
+
const bare = BARE_CALENDAR_DATE.exec(trimmed);
|
|
226
|
+
if (bare) return `${bare[1]}-${bare[2]}-${bare[3]}`;
|
|
227
|
+
if (trimmed === "") return null;
|
|
228
|
+
} else if (typeof value !== "number" && !(value instanceof Date)) {
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
const at = value instanceof Date ? value : new Date(value);
|
|
232
|
+
if (Number.isNaN(at.getTime())) return null;
|
|
233
|
+
return `${at.getFullYear()}-${pad(at.getMonth() + 1)}-${pad(at.getDate())}`;
|
|
234
|
+
}
|
|
235
|
+
function calendarDayLabel(day) {
|
|
236
|
+
const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(day);
|
|
237
|
+
if (!m) return day;
|
|
238
|
+
const at = new Date(Number(m[1]), Number(m[2]) - 1, Number(m[3]));
|
|
239
|
+
return at.toLocaleDateString(void 0, { month: "short", day: "numeric", year: "numeric" });
|
|
240
|
+
}
|
|
241
|
+
function dayKeyOf(at) {
|
|
242
|
+
return `${at.getFullYear()}-${pad(at.getMonth() + 1)}-${pad(at.getDate())}`;
|
|
243
|
+
}
|
|
244
|
+
function dayAt(day) {
|
|
245
|
+
const [y, m, d] = day.split("-").map(Number);
|
|
246
|
+
return new Date(y, (m ?? 1) - 1, d ?? 1);
|
|
247
|
+
}
|
|
248
|
+
function addDays(day, n) {
|
|
249
|
+
const at = dayAt(day);
|
|
250
|
+
at.setDate(at.getDate() + n);
|
|
251
|
+
return dayKeyOf(at);
|
|
252
|
+
}
|
|
253
|
+
function daysBetween(from, to) {
|
|
254
|
+
return Math.round((dayAt(to).getTime() - dayAt(from).getTime()) / 864e5);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export {
|
|
258
|
+
displayFormatOf,
|
|
259
|
+
choiceLooksOf,
|
|
260
|
+
choiceWord,
|
|
261
|
+
storedChoiceColor,
|
|
262
|
+
storedChoiceColorLookup,
|
|
263
|
+
nextChoiceColor,
|
|
264
|
+
choiceChipLookOf,
|
|
265
|
+
fieldToken,
|
|
266
|
+
bodyFromKeys,
|
|
267
|
+
bodyForReading,
|
|
268
|
+
isSignatureField,
|
|
269
|
+
PARITY_LABEL,
|
|
270
|
+
PARITY_MADE_OF,
|
|
271
|
+
editorKindFor,
|
|
272
|
+
pickableTypeOf,
|
|
273
|
+
fieldTypeLabel,
|
|
274
|
+
systemStampOf,
|
|
275
|
+
carriesTimeOfDay,
|
|
276
|
+
timeOfDayWords,
|
|
277
|
+
hasTimePart,
|
|
278
|
+
isDateField,
|
|
279
|
+
dateFormatFor,
|
|
280
|
+
dateText,
|
|
281
|
+
calendarDayOf,
|
|
282
|
+
calendarDayLabel,
|
|
283
|
+
dayKeyOf,
|
|
284
|
+
dayAt,
|
|
285
|
+
addDays,
|
|
286
|
+
daysBetween
|
|
287
|
+
};
|
|
288
|
+
//# sourceMappingURL=chunk-SPPATZSR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/docs.ts","../src/choiceLooks.ts","../src/parity.ts","../src/dates.ts"],"sourcesContent":["// src/docs.ts — @ai-matrx/records-ui · SCR-20, SCR-21, SCR-22\n//\n// DOCUMENTS OVER RECORDS. A template is a body whose tokens point at Fields BY\n// ID; a render is written ONCE and frozen with the SHA-256 of its own text; a\n// signature seals that exact version and is immutable once made.\n//\n// Three things this package refuses to re-implement, because the store already\n// does them and doing them twice is how two answers appear:\n// · which tokens a body contains — `custom.doc_tokens`;\n// · which of them this Table cannot answer, and why — `custom.doc_unresolved_tokens`;\n// · whether a signature still holds — `custom.doc_signature_intact`.\n//\n// The token syntax is the store's own: `{{field:<the field's id>}}`. A name\n// would be a token that silently stops resolving the day somebody renames a\n// Field, which is the exact failure REC-17 exists to prevent.\n\nimport type { Field, Uuid } from \"@ai-matrx/records\";\n\n/** The one token form, written the way the store's own pattern reads it. */\nexport function fieldToken(fieldId: Uuid): string {\n return `{{field:${fieldId}}}`;\n}\n\n/** THE DECLARATIVE SPEC an agent writes. One template, whole, in one object. */\nexport interface DocTemplateSpec {\n name: string;\n /** The body, tokens and all. */\n body: string;\n}\n\n/**\n * A template written in terms of Field KEYS — which is how an agent thinks and\n * how a person reads — turned into the store's id-based tokens. The agent writes\n * `{{title}}`; what is stored points at the Field's id, so a rename never\n * silently empties the document.\n *\n * A key this Table does not have is LEFT EXACTLY AS IT IS, so\n * `custom.doc_unresolved_tokens` names it and the screen shows the store's own\n * reason — it is never quietly deleted from the body.\n */\nexport function bodyFromKeys(body: string, fields: Field[]): string {\n const byKey = new Map(fields.map((f) => [f.key, f.id]));\n return body.replace(/\\{\\{\\s*([a-zA-Z0-9_]+)\\s*\\}\\}/g, (whole, key: string) => {\n const id = byKey.get(key);\n return id ? fieldToken(id) : whole;\n });\n}\n\n/** The reverse, for a person reading a stored body: ids shown as the Field's label. */\nexport function bodyForReading(body: string, fields: Field[]): string {\n const byId = new Map(fields.map((f) => [f.id, f.label || f.key]));\n return body.replace(/\\{\\{\\s*field:([0-9a-fA-F-]{36})\\s*\\}\\}/g, (whole, id: string) => {\n const label = byId.get(id);\n return label ? `{{${label}}}` : whole;\n });\n}\n\n/** VAL-10: a signature is a Value on a text Field whose format is `signature`. */\nexport function isSignatureField(field: Field): boolean {\n return field.type === \"text\" && (field.format ?? \"\").toLowerCase() === \"signature\";\n}\n","// src/choiceLooks.ts — @ai-matrx/records-ui · merge tranche 6f (early)\n//\n// A CHOICE WEARS THE COLOUR ITS OWNER GAVE IT.\n//\n// The older /data grid let a person paint each choice of a list (\"Completed\" green, \"Scheduled\"\n// blue), and those colours are kept on the Field itself: `display_format.options.choices`, the\n// document `custom.field_update` writes (the /data Sheet's seam writes it the same way, and a\n// column's settings here write it back). The grid used to ignore it and HASH THE WORD into a\n// colour, so a column painted green on /data came up amber here, and a colour a person set in the\n// settings changed nothing on screen — the silent half of a setting.\n//\n// Pure: no React, no store call. The Field the grid already holds carries everything.\n\nimport { newerKindOf } from \"@ai-matrx/records/field-kinds\";\nimport type { Field } from \"@ai-matrx/records\";\n// The values from the pure `table-style` subpath (no \"use client\", no grid): `@ai-matrx/records-ui/helpers`\n// reaches this file through `fieldTypeLabel`, and the data-table root would drag the whole grid with it.\nimport { CHOICE_CHIP_CLASS, NEUTRAL_CHIP_CLASS, STYLE_COLORS } from \"@ai-matrx/design-system/data-table/table-style\";\nimport type { ChoiceColorLookup, StyleColor } from \"@ai-matrx/design-system/data-table\";\n\n/** One choice's look, as the Field keeps it. */\nexport interface ChoiceLook {\n value: string;\n label?: string;\n color?: StyleColor;\n}\n\n/** The Field's display document, which the store keeps beside its declared keys. */\nexport function displayFormatOf(field: Field): { id: string; options: Record<string, unknown> } | null {\n const raw = (field as unknown as { display_format?: unknown }).display_format;\n if (!raw || typeof raw !== \"object\") return null;\n const id = (raw as { id?: unknown }).id;\n if (typeof id !== \"string\" || id === \"\") return null;\n const options = (raw as { options?: unknown }).options;\n return { id, options: options && typeof options === \"object\" ? (options as Record<string, unknown>) : {} };\n}\n\nfunction isStyleColor(v: unknown): v is StyleColor {\n return typeof v === \"string\" && (STYLE_COLORS as readonly string[]).includes(v);\n}\n\n/** Every choice look the Field keeps, in its own order. A colour outside the palette is dropped. */\nexport function choiceLooksOf(field: Field): ChoiceLook[] {\n const display = displayFormatOf(field);\n const choices = display?.options[\"choices\"];\n if (!Array.isArray(choices)) return [];\n const out: ChoiceLook[] = [];\n for (const c of choices) {\n if (!c || typeof c !== \"object\") continue;\n const value = (c as { value?: unknown }).value;\n if (typeof value !== \"string\" || value.trim() === \"\") continue;\n const color = (c as { color?: unknown }).color;\n const label = (c as { label?: unknown }).label;\n out.push({\n value: value.trim(),\n ...(typeof label === \"string\" && label.trim() !== \"\" ? { label: label.trim() } : {}),\n ...(isStyleColor(color) ? { color } : {}),\n });\n }\n return out;\n}\n\n/**\n * ONE WORD, HOWEVER IT WAS WRITTEN. A moved list keeps its words as `completed` / `truck_4` and\n * shows them as `Completed` / `Truck 4`; a colour kept against either spelling is the same choice.\n */\nexport function choiceWord(value: unknown): string {\n return String(value ?? \"\")\n .trim()\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"_\")\n .replace(/^_+|_+$/g, \"\");\n}\n\n/**\n * NOTION'S STATUS COLOURS, BY GROUP: To-do grey, In progress blue, Complete green. A status choice\n * the column paints nothing for wears its group's colour, so a fresh Status column reads the way\n * Notion's does with nobody picking a colour. A choice with a colour of its own keeps it\n * (`storedChoiceColor` asks the column first).\n */\nexport const STATUS_GROUP_COLOR = { todo: \"gray\", in_progress: \"blue\", done: \"green\" } as const satisfies Record<string, StyleColor>;\n\n/** The colour a status choice's GROUP gives it, or `undefined` when the column is not a Status. */\nexport function statusGroupColor(field: Field, value: unknown): StyleColor | undefined {\n if (newerKindOf(field) !== \"status\" || value === null || value === undefined || value === \"\") return undefined;\n const word = choiceWord(value);\n if (word === \"\") return undefined;\n const groups = ((field.config ?? {}) as Record<string, unknown>)[\"status_groups\"];\n if (groups && typeof groups === \"object\") {\n // the group is kept under the choice's KEY; the cell may hold its WORDS (\"In progress\" ↔ in_progress)\n for (const [key, group] of Object.entries(groups as Record<string, unknown>)) {\n if (choiceWord(key) !== word) continue;\n return group === \"in_progress\" ? STATUS_GROUP_COLOR.in_progress : group === \"done\" ? STATUS_GROUP_COLOR.done : STATUS_GROUP_COLOR.todo;\n }\n }\n return STATUS_GROUP_COLOR.todo;\n}\n\n/** The colour this Field keeps for this value, or `undefined` when it keeps none. */\nexport function storedChoiceColor(field: Field, value: unknown): StyleColor | undefined {\n if (value === null || value === undefined || value === \"\") return undefined;\n const word = choiceWord(value);\n if (word === \"\") return undefined;\n for (const look of choiceLooksOf(field)) {\n if (!look.color) continue;\n if (choiceWord(look.value) === word || (look.label && choiceWord(look.label) === word)) return look.color;\n }\n return statusGroupColor(field, value);\n}\n\n/**\n * THE COLOUR-BY LOOKUP, STORED COLOURS FIRST. A value whose column keeps a colour for it wears\n * that colour; any other value still paints, deterministically, through `fallback` — a colour-by\n * that silently did nothing would be the screen lying about a setting a person just changed.\n */\nexport function storedChoiceColorLookup(\n fields: readonly Field[],\n fallback: ChoiceColorLookup,\n): ChoiceColorLookup {\n const byKey = new Map(fields.map((f) => [f.key, f] as const));\n return (fieldKey, value) => {\n const field = byKey.get(fieldKey);\n return (field ? storedChoiceColor(field, value) : undefined) ?? fallback(fieldKey, value);\n };\n}\n\n/**\n * THE ORDER A NEW CHOICE IS PAINTED IN (Airtable): each choice added to a list takes the next\n * palette colour the list does not wear yet, so a fresh list reads as distinct chips with nobody\n * picking a colour. Grey last — it reads as \"no colour\".\n */\nexport const NEW_CHOICE_PALETTE: readonly StyleColor[] = [\"blue\", \"green\", \"amber\", \"red\", \"violet\", \"teal\", \"slate\"];\n\n/** The colour the next choice of a list takes, given the colours its choices already wear. */\nexport function nextChoiceColor(worn: ReadonlyArray<StyleColor | null | undefined>): StyleColor {\n const taken = new Set(worn.filter((c): c is StyleColor => Boolean(c)));\n const free = NEW_CHOICE_PALETTE.find((c) => !taken.has(c));\n return free ?? NEW_CHOICE_PALETTE[worn.length % NEW_CHOICE_PALETTE.length]!;\n}\n\n/**\n * THE ONE CHIP A CHOICE IS DRAWN AS — the grid cell, the picker's list and its chip, a form's\n * pills: the colour the column keeps for the value (by any of the words given — its key, its\n * label), else the neutral chip. One answer, so no surface paints a choice its own way.\n */\nexport function choiceChipLookOf(field: Field, ...words: unknown[]): { className: string; color: StyleColor | null } {\n for (const word of words) {\n const color = storedChoiceColor(field, word);\n if (color) return { className: CHOICE_CHIP_CLASS[color], color };\n }\n return { className: NEUTRAL_CHIP_CLASS, color: null };\n}\n","// src/parity.ts — @ai-matrx/records-ui\n//\n// FLD-11, the parity floor. A Field stores a BEHAVIOUR (one of five) plus\n// modifiers, unit and format; a person picked one of THIRTEEN parity types in\n// the UI. This resolves the second from the first, using the same facts the\n// store's own `custom.parity_field_types()` describes — which is generated into\n// `@ai-matrx/records` and imported here, never retyped.\n//\n// Nothing in this file decides policy. It decides which editor to draw.\n\nimport { displayFormatOf } from \"./choiceLooks\";\nimport {\n KERNEL_TABLES,\n PARITY_FIELD_TYPES,\n fieldKindFor,\n newerKindOf,\n isButtonField,\n type FieldKind,\n type KernelTargets,\n type ParityFieldType,\n} from \"@ai-matrx/records/field-kinds\";\nimport type { Field } from \"@ai-matrx/records\";\nimport { humanizeIdentifier } from \"@ai-matrx/kit/text-case\";\nimport { isSignatureField } from \"./docs\";\nimport { fieldTypeChoice, isSystemFieldKind, type PickableFieldType } from \"./fieldTypes\";\n\n/** The kernel ids come from the store's own kernel rows, never from a literal here. */\nconst kernelId = (name: string): string =>\n KERNEL_TABLES.find((t) => t.name === name)?.id ?? \"\";\nconst KERNEL_FILE_TABLE = kernelId(\"File\");\nconst KERNEL_PERSON_TABLE = kernelId(\"Person\");\n\nexport const PARITY_LABEL: Record<ParityFieldType, string> = {\n attachment: \"Attachment\",\n checkbox: \"Yes / no\",\n currency: \"Currency\",\n datetime: \"Date\",\n email: \"Email\",\n formula: \"Formula\",\n lookup: \"Lookup\",\n member: \"Person\",\n multi_select: \"Multi-select\",\n percent: \"Percent\",\n phone: \"Phone\",\n rollup: \"Rollup\",\n select: \"Select\",\n url: \"Link\",\n};\n\n/** The \"made of\" sentence the store itself publishes, for the field editor's help text. */\nexport const PARITY_MADE_OF: Record<string, string> = Object.fromEntries(\n PARITY_FIELD_TYPES.map((p) => [p.parity_type, p.made_of]),\n);\n\n/**\n * Plain text and plain number are behaviours with no parity type of their own.\n *\n * 🚨 THIS IS NOW AN ALIAS, AND THAT IS THE POINT (TAILS-3, 2026-09-21). The\n * classifier moved into `@ai-matrx/records` as `FieldKind` so that the editor a\n * person types into and the COERCION applied to what they typed are decided by\n * one body. They were decided by two, and the public booking page paid for it:\n * \"Vehicle Year takes a number, and it was given a string\" on every table with\n * a number field.\n */\nexport type EditorKind = FieldKind;\n\n/** The kernel ids come from the store's own kernel rows, never from a literal here. */\nconst KERNEL: KernelTargets = { file: KERNEL_FILE_TABLE, person: KERNEL_PERSON_TABLE };\n\n/**\n * Which editor one Field wants. Reads the Field's own declaration only — the\n * behaviour, the modifiers, the format, the relation target and the config —\n * because those are what the store stores, and a screen that guessed from a\n * value would draw a different editor for an empty record.\n *\n * It is `fieldKindFor` with this package's kernel ids bound. Nothing here\n * decides anything the core does not.\n */\nexport function editorKindFor(field: Field): EditorKind {\n return fieldKindFor(field, KERNEL);\n}\n\n/**\n * WHICH KIND A PERSON PICKED, read back off the Field the store keeps — the ONE reader every\n * \"what does this column hold\" answer goes through (the Settings column list, the column panel).\n *\n * `editorKindFor` answers which EDITOR to draw, and for two families that is not the kind a\n * person picked: a Signature is a text Field whose format is `signature` (it draws a line of\n * text), and the store's stamps — Record number, Created time, Last changed time — are formula\n * Fields whose `config.system` names the stamp. Read through the editor classifier alone, the\n * Settings list called a Signature \"Text\" and a Record number \"Worked out from other columns\"\n * (lane 10 W1-A, guard `every-pickable-kind-reads-back-as-itself.test.tsx`).\n *\n * `undefined` when the Field is none of the kinds the menu offers.\n */\nexport function pickableTypeOf(field: Field): PickableFieldType | undefined {\n if (isSignatureField(field)) return \"signature\";\n // NOTION-PROPS-3: a button is text wearing the format `button`.\n if (isButtonField(field)) return \"button\";\n // LANE 10 P4: the nine newer kinds, each a base type wearing a format (`newerKindOf`).\n const newer = newerKindOf(field);\n if (newer) return newer;\n // A RATING OR A TIME made as a plain column wearing its look (`LOOK_KINDS`): named by that kind.\n const look = displayFormatOf(field)?.id;\n if (look === \"rating\" && field.type === \"range\") return \"rating\";\n if (look === \"time\" && field.type === \"text\") return \"time\";\n const system = (field.config as Record<string, unknown> | undefined)?.[\"system\"];\n if (field.type === \"formula\" && typeof system === \"string\" && isSystemFieldKind(system)) return system;\n const kind = editorKindFor(field);\n return fieldTypeChoice(kind) ? (kind as PickableFieldType) : undefined;\n}\n\n/**\n * The type word a person sees in a header or a settings row — and it is the\n * SAME word the field panel offers, read from `FIELD_TYPE_CHOICES`, so a column\n * added as \"Money\" is never described anywhere else as \"Currency\".\n */\nexport function fieldTypeLabel(field: Field): string {\n const kind = pickableTypeOf(field) ?? editorKindFor(field);\n const known = fieldTypeChoice(kind)?.label;\n if (known) return field.multi && kind !== \"multi_select\" ? `${known} (many)` : known;\n const plain: Record<string, string> = {\n // `boolean` is the BEHAVIOUR word; `checkbox` is the type a person picks. Both are\n // written the way a person writes them, never as a raw token.\n boolean: \"Yes / no\",\n date: \"Date\",\n json: \"Structured data\",\n relation: \"Link to a record\",\n };\n // Never a raw token on a screen: an editor kind this table has not named is\n // still written the way a person writes it.\n return plain[kind] ?? humanizeIdentifier(kind);\n}\n","/**\n * 🚨 THE ONE DATE HELPER EVERY LAYOUT READS (lane UI-FIX-18, VERIFIER-18 H2 / M1).\n *\n * MEASURED 2026-09-24 on production, browser in America/Los_Angeles: Kitchen's start date,\n * stored `2026-04-01`, read **Apr 1** in the grid, **Mar 31** on the calendar, **3/31** in\n * the gallery, and Backyard Deck's May 1 read **4/30** in the record panel. The grid was right\n * because it formats through the design system's registry (`formatFieldValue`), which reads a\n * bare `YYYY-MM-DD` as a day on a calendar. Every other surface called `new Date(\"2026-04-01\")`\n * itself — which JavaScript parses as UTC MIDNIGHT — and then printed it in the viewer's zone,\n * so everybody west of Greenwich saw the day before.\n *\n * THE CLASS, NOT THE INSTANCE. No component in this package parses or prints a date on its\n * own any more; it asks this file, and this file asks the SAME registry the grid asks. The\n * calendar's day key is the one thing the registry does not answer, and it is answered here\n * by the same rule: a bare calendar date IS its own day (read the characters), an instant\n * (`…Z`, `…+hh:mm`) is placed on the viewer's own calendar.\n *\n * The store's own stamps — Created time and Last changed time (`fx.created_time`,\n * `fx.modified_time`) — are instants, and are printed like every other date-and-time cell\n * (VERIFIER-18 M1 found `2026-09-25T00:13:34.564Z` in the grid, the gallery and the panel).\n */\nimport { formatFieldValue, type FieldFormatConfig } from \"@ai-matrx/design-system/field-formats\";\nimport type { Field } from \"@ai-matrx/records\";\n\n/** A day on a calendar with no time and no zone — `2026-04-01`, or a zoneless local midnight. */\nconst BARE_CALENDAR_DATE = /^(\\d{4})-(\\d{2})-(\\d{2})(?:[T ]00:00(?::00(?:\\.0+)?)?)?$/;\n\ntype SystemStamp = \"autonumber\" | \"created_time\" | \"modified_time\";\n\n/** The store's own stamp this Field is, when it is one (`config.system`). */\nexport function systemStampOf(field: Pick<Field, \"type\" | \"config\">): SystemStamp | null {\n if (field.type !== \"formula\") return null;\n const system = String((field.config ?? {})[\"system\"] ?? \"\");\n return system === \"autonumber\" || system === \"created_time\" || system === \"modified_time\" ? system : null;\n}\n\n/**\n * Does this value (or, with no value, this Field) carry a TIME OF DAY as well as a date?\n *\n * A DATE IS A DATE (chair ruling, 2026-09-24). The control and the text follow the STORED\n * VALUE's shape, never `config.kind` alone: a value with no time part — `1988-06-14`, a date\n * of birth on a `kind: \"datetime\"` Field — gets a date-only control and a date-only reading\n * everywhere (grid, form, panel, calendar). With no value yet, only a Field that says so\n * outright carries a time: the older `format: \"datetime\"`, or the store's own Created / Last\n * changed stamps (instants by construction).\n */\nexport function carriesTimeOfDay(field: Pick<Field, \"type\" | \"config\" | \"format\">, value?: unknown): boolean {\n if (value !== undefined && value !== null && value !== \"\") return hasTimePart(value);\n const stamp = systemStampOf(field);\n if (stamp === \"created_time\" || stamp === \"modified_time\") return true;\n return (field.format ?? \"\").toLowerCase() === \"datetime\";\n}\n\n/**\n * THE TIME OF DAY A MOMENT CARRIES, in the reader's clock (\"3:30 PM\") — the same words the grid's\n * date-and-time cell ends in — or null for a bare day. A calendar's month card and a timeline's bar\n * show it before the title (lane 10 P4, verifier V8 #7), as Google Calendar does.\n */\nexport function timeOfDayWords(value: unknown): string | null {\n if (!hasTimePart(value)) return null;\n const at = value instanceof Date ? value : new Date(value as string | number);\n return Number.isNaN(at.getTime()) ? null : at.toLocaleTimeString(undefined, { hour: \"numeric\", minute: \"2-digit\" });\n}\n\n/** A value that names a moment in the day, not just the day. */\nexport function hasTimePart(value: unknown): boolean {\n if (value instanceof Date || typeof value === \"number\") return true;\n if (typeof value !== \"string\") return false;\n const trimmed = value.trim();\n if (BARE_CALENDAR_DATE.test(trimmed)) return false;\n return /^\\d{4}-\\d{2}-\\d{2}[T ]\\d/.test(trimmed);\n}\n\n/** Is this Field a date column at all — a dated range, or the store's own time stamp? */\nexport function isDateField(field: Pick<Field, \"type\" | \"config\">): boolean {\n const stamp = systemStampOf(field);\n if (stamp === \"created_time\" || stamp === \"modified_time\") return true;\n if (field.type !== \"range\") return false;\n const kind = String((field.config ?? {})[\"kind\"] ?? \"\");\n return kind === \"date\" || kind === \"datetime\";\n}\n\n/**\n * The format a date-ish Field draws with, or `undefined` for a Field that is not one. With a\n * value, it is that value's own shape; without, the Field's (`carriesTimeOfDay`).\n * `presentation.formatForField` answers dates through this, so the grid and every card agree.\n */\nexport function dateFormatFor(\n field: Pick<Field, \"type\" | \"config\" | \"format\">,\n value?: unknown,\n): FieldFormatConfig | undefined {\n if (!isDateField(field)) return undefined;\n return carriesTimeOfDay(field, value) ? { id: \"datetime\" } : { id: \"date\" };\n}\n\n/**\n * THE TEXT OF ONE DATE VALUE, in the viewer's language — through the design system's\n * registry, exactly as the grid prints it, in the value's own shape. `null` when the value is\n * not a date at all, so the caller can fall back to its own reading (THE FALLBACK LAW).\n */\nexport function dateText(field: Pick<Field, \"type\" | \"config\" | \"format\">, value: unknown): string | null {\n const format = dateFormatFor(field, value) ?? (isDateLike(value) ? { id: hasTimePart(value) ? \"datetime\" : \"date\" } : undefined);\n if (!format) return null;\n const result = formatFieldValue(value, format);\n return result.ok && !result.empty ? result.text : null;\n}\n\nfunction isDateLike(value: unknown): boolean {\n return typeof value === \"string\" && /^\\d{4}-\\d{2}-\\d{2}/.test(value.trim());\n}\n\nfunction pad(n: number): string {\n return n < 10 ? `0${n}` : String(n);\n}\n\n/**\n * THE CALENDAR DAY a value falls on, as `YYYY-MM-DD` — the key a calendar files a card under.\n *\n * A bare calendar date is its own day. An instant is placed on the VIEWER's calendar: a visit\n * logged at 5:13 PM Pacific on 24 September is on the 24th for the person in Pacific time,\n * even though it is already the 25th in UTC.\n */\nexport function calendarDayOf(value: unknown): string | null {\n if (typeof value === \"string\") {\n const trimmed = value.trim();\n const bare = BARE_CALENDAR_DATE.exec(trimmed);\n if (bare) return `${bare[1]}-${bare[2]}-${bare[3]}`;\n if (trimmed === \"\") return null;\n } else if (typeof value !== \"number\" && !(value instanceof Date)) {\n return null;\n }\n const at = value instanceof Date ? value : new Date(value as string | number);\n if (Number.isNaN(at.getTime())) return null;\n return `${at.getFullYear()}-${pad(at.getMonth() + 1)}-${pad(at.getDate())}`;\n}\n\n/** The heading of one calendar day — `Apr 1, 2026` — built on local midnight, never UTC. */\nexport function calendarDayLabel(day: string): string {\n const m = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(day);\n if (!m) return day;\n const at = new Date(Number(m[1]), Number(m[2]) - 1, Number(m[3]));\n return at.toLocaleDateString(undefined, { month: \"short\", day: \"numeric\", year: \"numeric\" });\n}\n\n// ---------------------------------------------------------------------------------------------\n// DAY ARITHMETIC ON THE VIEWER'S OWN CALENDAR (lane VIEWS-AND-FIELDS, sublane TL, 2026-10-02).\n// A day key is `YYYY-MM-DD`, built and read at LOCAL midnight — never `new Date(\"YYYY-MM-DD\")`,\n// which is UTC midnight and lands on the day before for everybody west of Greenwich. The timeline\n// places and moves bars with these; a move is always a whole number of days.\n\n/** The day key of a moment, on the viewer's calendar. */\nexport function dayKeyOf(at: Date): string {\n return `${at.getFullYear()}-${pad(at.getMonth() + 1)}-${pad(at.getDate())}`;\n}\n\n/** A day key as local midnight. */\nexport function dayAt(day: string): Date {\n const [y, m, d] = day.split(\"-\").map(Number);\n return new Date(y!, (m ?? 1) - 1, d ?? 1);\n}\n\n/** The day `n` days after (or before, when negative) `day`. */\nexport function addDays(day: string, n: number): string {\n const at = dayAt(day);\n at.setDate(at.getDate() + n);\n return dayKeyOf(at);\n}\n\n/** Whole days from `from` to `to` (negative when `to` is earlier). DST-safe: rounds the hour away. */\nexport function daysBetween(from: string, to: string): number {\n return Math.round((dayAt(to).getTime() - dayAt(from).getTime()) / 86_400_000);\n}\n"],"mappings":";;;;;;;AAmBO,SAAS,WAAW,SAAuB;AAChD,SAAO,WAAW,OAAO;AAC3B;AAmBO,SAAS,aAAa,MAAc,QAAyB;AAClE,QAAM,QAAQ,IAAI,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;AACtD,SAAO,KAAK,QAAQ,kCAAkC,CAAC,OAAO,QAAgB;AAC5E,UAAM,KAAK,MAAM,IAAI,GAAG;AACxB,WAAO,KAAK,WAAW,EAAE,IAAI;AAAA,EAC/B,CAAC;AACH;AAGO,SAAS,eAAe,MAAc,QAAyB;AACpE,QAAM,OAAO,IAAI,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;AAChE,SAAO,KAAK,QAAQ,2CAA2C,CAAC,OAAO,OAAe;AACpF,UAAM,QAAQ,KAAK,IAAI,EAAE;AACzB,WAAO,QAAQ,KAAK,KAAK,OAAO;AAAA,EAClC,CAAC;AACH;AAGO,SAAS,iBAAiB,OAAuB;AACtD,SAAO,MAAM,SAAS,WAAW,MAAM,UAAU,IAAI,YAAY,MAAM;AACzE;;;AC/CA,SAAS,mBAAmB;AAI5B,SAAS,mBAAmB,oBAAoB,oBAAoB;AAW7D,SAAS,gBAAgB,OAAuE;AACrG,QAAM,MAAO,MAAkD;AAC/D,MAAI,CAAC,OAAO,OAAO,QAAQ,SAAU,QAAO;AAC5C,QAAM,KAAM,IAAyB;AACrC,MAAI,OAAO,OAAO,YAAY,OAAO,GAAI,QAAO;AAChD,QAAM,UAAW,IAA8B;AAC/C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