@kumwe/studio-core 0.1.0-alpha.7 → 0.1.0-beta.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/README.md +87 -4
- package/THIRD_PARTY_NOTICES.md +9 -0
- package/dist/authentication-lifetime.d.ts +16 -0
- package/dist/authentication-lifetime.d.ts.map +1 -0
- package/dist/authentication-lifetime.js +1 -0
- package/dist/binding-projection.d.ts +47 -0
- package/dist/binding-projection.d.ts.map +1 -0
- package/dist/binding-projection.js +1 -0
- package/dist/canonical.js +1 -100
- package/dist/clone.js +1 -4
- package/dist/commands.d.ts +1 -1
- package/dist/commands.d.ts.map +1 -1
- package/dist/commands.js +1 -799
- package/dist/contextual-session.d.ts +112 -0
- package/dist/contextual-session.d.ts.map +1 -0
- package/dist/contextual-session.js +1 -0
- package/dist/contributions.d.ts +63 -2
- package/dist/contributions.d.ts.map +1 -1
- package/dist/contributions.js +1 -302
- package/dist/deployment-validation.d.ts +10 -0
- package/dist/deployment-validation.d.ts.map +1 -0
- package/dist/deployment-validation.js +1 -0
- package/dist/entry-commands.js +1 -36
- package/dist/extension-sdk.d.ts +12 -6
- package/dist/extension-sdk.d.ts.map +1 -1
- package/dist/extension-sdk.js +1 -188
- package/dist/history.d.ts +12 -2
- package/dist/history.d.ts.map +1 -1
- package/dist/history.js +1 -63
- package/dist/host-session.d.ts +93 -0
- package/dist/host-session.d.ts.map +1 -0
- package/dist/host-session.js +1 -0
- package/dist/http-authoring-contract.d.ts +29 -0
- package/dist/http-authoring-contract.d.ts.map +1 -0
- package/dist/http-authoring-contract.js +1 -0
- package/dist/http-host-adapter.d.ts +173 -0
- package/dist/http-host-adapter.d.ts.map +1 -0
- package/dist/http-host-adapter.js +1 -0
- package/dist/index.d.ts +14 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -18
- package/dist/layout.d.ts +66 -0
- package/dist/layout.d.ts.map +1 -0
- package/dist/layout.js +1 -0
- package/dist/migrations.js +1 -83
- package/dist/model-commands.js +1 -21
- package/dist/modes.js +1 -280
- package/dist/negotiation.js +1 -65
- package/dist/production-values.d.ts +12 -0
- package/dist/production-values.d.ts.map +1 -0
- package/dist/production-values.js +1 -0
- package/dist/production.d.ts +86 -0
- package/dist/production.d.ts.map +1 -0
- package/dist/production.js +1 -0
- package/dist/profile-validator.d.ts +2 -2
- package/dist/profile-validator.d.ts.map +1 -1
- package/dist/profile-validator.js +1 -783
- package/dist/recipes.js +1 -34
- package/dist/registry.js +1 -56
- package/dist/schema-profile.d.ts +23 -5
- package/dist/schema-profile.d.ts.map +1 -1
- package/dist/schema-profile.js +1 -390
- package/dist/semver.js +1 -128
- package/dist/session-policy.d.ts +23 -0
- package/dist/session-policy.d.ts.map +1 -0
- package/dist/session-policy.js +1 -0
- package/dist/session.d.ts +14 -2
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +1 -178
- package/dist/strict-json.d.ts +7 -0
- package/dist/strict-json.d.ts.map +1 -0
- package/dist/strict-json.js +2 -0
- package/dist/url-policy.js +1 -248
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +1 -398
- package/package.json +5 -3
- package/dist/canonical.js.map +0 -1
- package/dist/clone.js.map +0 -1
- package/dist/commands.js.map +0 -1
- package/dist/contributions.js.map +0 -1
- package/dist/entry-commands.js.map +0 -1
- package/dist/extension-sdk.js.map +0 -1
- package/dist/history.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/migrations.js.map +0 -1
- package/dist/model-commands.js.map +0 -1
- package/dist/modes.js.map +0 -1
- package/dist/negotiation.js.map +0 -1
- package/dist/profile-validator.js.map +0 -1
- package/dist/recipes.js.map +0 -1
- package/dist/registry.js.map +0 -1
- package/dist/schema-profile.js.map +0 -1
- package/dist/semver.js.map +0 -1
- package/dist/session.js.map +0 -1
- package/dist/url-policy.js.map +0 -1
- package/dist/validation.js.map +0 -1
package/dist/modes.js
CHANGED
|
@@ -1,280 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
/**
|
|
3
|
-
* Every session mode, in stable sorted order. The permitted-command table is
|
|
4
|
-
* total over exactly this set.
|
|
5
|
-
*/
|
|
6
|
-
export const STUDIO_SESSION_MODES = Object.freeze([
|
|
7
|
-
'blueprint',
|
|
8
|
-
'content',
|
|
9
|
-
'hybrid',
|
|
10
|
-
'model',
|
|
11
|
-
'read-only',
|
|
12
|
-
]);
|
|
13
|
-
const BLUEPRINT_STRUCTURE_COMMAND_TYPES = [
|
|
14
|
-
'studio.command/apply-pattern',
|
|
15
|
-
'studio.command/batch',
|
|
16
|
-
'studio.command/duplicate-node',
|
|
17
|
-
'studio.command/insert-node',
|
|
18
|
-
'studio.command/move-node',
|
|
19
|
-
'studio.command/remove-binding',
|
|
20
|
-
'studio.command/remove-node',
|
|
21
|
-
'studio.command/reorder-children',
|
|
22
|
-
'studio.command/reset-inherited-property',
|
|
23
|
-
'studio.command/restore-node',
|
|
24
|
-
'studio.command/set-binding',
|
|
25
|
-
'studio.command/set-property',
|
|
26
|
-
'studio.command/set-size-role',
|
|
27
|
-
'studio.command/unset-property',
|
|
28
|
-
'studio.command/unset-size-role',
|
|
29
|
-
];
|
|
30
|
-
/**
|
|
31
|
-
* The structure commands hybrid composition may dispatch when every affected
|
|
32
|
-
* collection stays inside a structural authoring region. Property, binding,
|
|
33
|
-
* size-role, inheritance-reset, and pattern commands remain Blueprint-mode
|
|
34
|
-
* vocabulary.
|
|
35
|
-
*/
|
|
36
|
-
const HYBRID_STRUCTURE_OPERATION_TYPES = [
|
|
37
|
-
'studio.command/duplicate-node',
|
|
38
|
-
'studio.command/insert-node',
|
|
39
|
-
'studio.command/move-node',
|
|
40
|
-
'studio.command/remove-node',
|
|
41
|
-
'studio.command/reorder-children',
|
|
42
|
-
'studio.command/restore-node',
|
|
43
|
-
];
|
|
44
|
-
const PERMITTED_COMMAND_TYPES = Object.freeze({
|
|
45
|
-
blueprint: immutableCommandTypeSet(BLUEPRINT_STRUCTURE_COMMAND_TYPES),
|
|
46
|
-
content: immutableCommandTypeSet(['studio.command/set-field-value']),
|
|
47
|
-
hybrid: immutableCommandTypeSet([
|
|
48
|
-
'studio.command/batch',
|
|
49
|
-
...HYBRID_STRUCTURE_OPERATION_TYPES,
|
|
50
|
-
'studio.command/set-field-value',
|
|
51
|
-
]),
|
|
52
|
-
model: immutableCommandTypeSet(['studio.command/add-model-field']),
|
|
53
|
-
'read-only': immutableCommandTypeSet([]),
|
|
54
|
-
});
|
|
55
|
-
const HYBRID_BATCHABLE_OPERATION_TYPES = immutableCommandTypeSet(HYBRID_STRUCTURE_OPERATION_TYPES);
|
|
56
|
-
/**
|
|
57
|
-
* The deterministic mode-to-permitted-command table: one immutable set per
|
|
58
|
-
* session mode, shared across calls, so UIs derive disabled affordances from
|
|
59
|
-
* the same source the session enforces. The table is type-level only; the
|
|
60
|
-
* hybrid entries additionally require every affected collection to stay
|
|
61
|
-
* inside a structural authoring region, which the session enforces per
|
|
62
|
-
* command target.
|
|
63
|
-
*/
|
|
64
|
-
export function permittedCommandTypes(mode) {
|
|
65
|
-
return PERMITTED_COMMAND_TYPES[mode];
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Flattens a configuration's editing mode, composite, and session state into
|
|
69
|
-
* the single session mode fixed at session creation: a read-only session
|
|
70
|
-
* state always flattens to `read-only`, the hybrid composite flattens to
|
|
71
|
-
* `hybrid`, and every other session keeps its authoring mode. The hybrid
|
|
72
|
-
* composite is invalid with Model mode, mirroring the configuration schema.
|
|
73
|
-
*/
|
|
74
|
-
export function resolveSessionMode(configuration) {
|
|
75
|
-
if (configuration.sessionState === 'read-only') {
|
|
76
|
-
return 'read-only';
|
|
77
|
-
}
|
|
78
|
-
if (configuration.composite === 'hybrid') {
|
|
79
|
-
if (configuration.mode === 'model') {
|
|
80
|
-
throw new RangeError('The hybrid composite is invalid with the model editing mode.');
|
|
81
|
-
}
|
|
82
|
-
return 'hybrid';
|
|
83
|
-
}
|
|
84
|
-
return configuration.mode;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Fails closed with the stable `mode-forbidden` code when the command type is
|
|
88
|
-
* outside the active mode's permitted set.
|
|
89
|
-
*/
|
|
90
|
-
export function assertModePermitsCommandType(mode, type) {
|
|
91
|
-
if (!PERMITTED_COMMAND_TYPES[mode].has(type)) {
|
|
92
|
-
throw new StudioCommandError('mode-forbidden', `Command type ${type} is not permitted in ${mode} mode.`);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Enforces the bounded-composition rule for one hybrid structure command:
|
|
97
|
-
* every collection the command inserts into, removes from, moves across, or
|
|
98
|
-
* reorders must be a named slot of a node whose authoring policy mode is
|
|
99
|
-
* `structural`; inserted block types must satisfy the structural node's
|
|
100
|
-
* `allowedBlocks` when declared; subtrees containing a `locked` node are
|
|
101
|
-
* never inserted, removed, moved, or duplicated; and document roots are
|
|
102
|
-
* never in bounds. Batch operations are evaluated sequentially against a
|
|
103
|
-
* trial state so later operations may compose nodes earlier operations
|
|
104
|
-
* introduced. A violation fails closed with `mode-forbidden`; a reference
|
|
105
|
-
* the gate cannot resolve is left for the reducer's canonical failure code.
|
|
106
|
-
*
|
|
107
|
-
* The passed document is consumed as trial scratch state and may be mutated;
|
|
108
|
-
* callers pass a clone.
|
|
109
|
-
*/
|
|
110
|
-
export function assertHybridCommandInBounds(document, command) {
|
|
111
|
-
switch (command.type) {
|
|
112
|
-
case 'studio.command/batch': {
|
|
113
|
-
for (const operation of command.payload.operations) {
|
|
114
|
-
const type = operation.type;
|
|
115
|
-
if (type === 'studio.command/batch' ||
|
|
116
|
-
type === 'studio.command/apply-pattern' ||
|
|
117
|
-
type === 'studio.command/reset-inherited-property') {
|
|
118
|
-
// Never legal inside a batch; the reducer's canonical
|
|
119
|
-
// invalid-batch rejection resurfaces when the command executes.
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
if (!HYBRID_BATCHABLE_OPERATION_TYPES.has(operation.type)) {
|
|
123
|
-
throw new StudioCommandError('mode-forbidden', `Batch operation type ${operation.type} is not permitted in hybrid mode.`);
|
|
124
|
-
}
|
|
125
|
-
assertHybridOperationInBounds(document, operation);
|
|
126
|
-
try {
|
|
127
|
-
applyOperation(document, operation);
|
|
128
|
-
}
|
|
129
|
-
catch {
|
|
130
|
-
// The trial cannot advance past this operation; the reducer's
|
|
131
|
-
// canonical failure code resurfaces when the command executes.
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
case 'studio.command/apply-pattern':
|
|
138
|
-
case 'studio.command/reset-inherited-property':
|
|
139
|
-
// Unreachable behind the type gate; kept for fail-closed defence.
|
|
140
|
-
throw new StudioCommandError('mode-forbidden', `Command type ${command.type} is not permitted in hybrid mode.`);
|
|
141
|
-
default:
|
|
142
|
-
assertHybridOperationInBounds(document, command);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
function assertHybridOperationInBounds(document, operation) {
|
|
146
|
-
switch (operation.type) {
|
|
147
|
-
case 'studio.command/insert-node':
|
|
148
|
-
case 'studio.command/restore-node': {
|
|
149
|
-
assertSubtreeUnlocked(operation.payload.node);
|
|
150
|
-
assertComposableDestination(document, operation.payload.destination, operation.payload.node);
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
case 'studio.command/remove-node': {
|
|
154
|
-
const location = locateNode(document.roots, operation.payload.nodeId);
|
|
155
|
-
if (location === undefined) {
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
assertSubtreeUnlocked(location.node);
|
|
159
|
-
assertComposableParent(location.parent, location.slot);
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
case 'studio.command/move-node': {
|
|
163
|
-
const location = locateNode(document.roots, operation.payload.nodeId);
|
|
164
|
-
if (location === undefined) {
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
assertSubtreeUnlocked(location.node);
|
|
168
|
-
assertComposableParent(location.parent, location.slot);
|
|
169
|
-
assertComposableDestination(document, operation.payload.destination, location.node);
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
case 'studio.command/duplicate-node': {
|
|
173
|
-
const location = locateNode(document.roots, operation.payload.nodeId);
|
|
174
|
-
if (location === undefined) {
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
assertSubtreeUnlocked(location.node);
|
|
178
|
-
if (operation.payload.destination === undefined) {
|
|
179
|
-
assertComposableParent(location.parent, location.slot);
|
|
180
|
-
if (location.parent !== undefined) {
|
|
181
|
-
assertAllowedBlock(location.parent, location.slot, location.node);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
assertComposableDestination(document, operation.payload.destination, location.node);
|
|
186
|
-
}
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
case 'studio.command/reorder-children': {
|
|
190
|
-
if (operation.payload.parentNodeId === undefined) {
|
|
191
|
-
throw rootsOutOfBounds();
|
|
192
|
-
}
|
|
193
|
-
assertComposableParent(locateNode(document.roots, operation.payload.parentNodeId)?.node, operation.payload.slot);
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
default:
|
|
197
|
-
// Unreachable behind the type gate; kept for fail-closed defence.
|
|
198
|
-
throw new StudioCommandError('mode-forbidden', `Batch operation type ${operation.type} is not permitted in hybrid mode.`);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
function locateNode(nodes, nodeId, parent, slot) {
|
|
202
|
-
for (const node of nodes) {
|
|
203
|
-
if (node.id === nodeId) {
|
|
204
|
-
if (parent === undefined) {
|
|
205
|
-
return { node };
|
|
206
|
-
}
|
|
207
|
-
return slot === undefined ? { node, parent } : { node, parent, slot };
|
|
208
|
-
}
|
|
209
|
-
for (const [slotName, children] of Object.entries(node.slots)) {
|
|
210
|
-
const nested = locateNode(children, nodeId, node, slotName);
|
|
211
|
-
if (nested !== undefined) {
|
|
212
|
-
return nested;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
return undefined;
|
|
217
|
-
}
|
|
218
|
-
function assertComposableDestination(document, destination, node) {
|
|
219
|
-
if (destination.parentNodeId === undefined) {
|
|
220
|
-
throw rootsOutOfBounds();
|
|
221
|
-
}
|
|
222
|
-
const parent = locateNode(document.roots, destination.parentNodeId)?.node;
|
|
223
|
-
if (parent === undefined) {
|
|
224
|
-
// The reducer's canonical parent-not-found rejection resurfaces.
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
assertComposableParent(parent, destination.slot);
|
|
228
|
-
assertAllowedBlock(parent, destination.slot, node);
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* A collection is composable when its parent node declares structural
|
|
232
|
-
* authoring, or when the parent's per-slot composition marker names the slot
|
|
233
|
-
* (ADR 0013). The marker only grants composability; it never revokes what
|
|
234
|
-
* the node-level policy permits.
|
|
235
|
-
*/
|
|
236
|
-
function assertComposableParent(parent, slot) {
|
|
237
|
-
if (parent === undefined) {
|
|
238
|
-
throw rootsOutOfBounds();
|
|
239
|
-
}
|
|
240
|
-
if (parent.authoring.mode === 'structural') {
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
243
|
-
if (slot !== undefined && parent.authoring.slots?.[slot]?.composable === true) {
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
246
|
-
throw new StudioCommandError('mode-forbidden', `Hybrid composition is bounded to structural slots; node ${parent.id} declares neither structural authoring nor a composable marker for the affected slot.`);
|
|
247
|
-
}
|
|
248
|
-
function assertAllowedBlock(parent, slot, node) {
|
|
249
|
-
const slotPolicy = slot === undefined ? undefined : parent.authoring.slots?.[slot];
|
|
250
|
-
const allowedBlocks = slotPolicy?.allowedBlocks ?? parent.authoring.allowedBlocks;
|
|
251
|
-
if (allowedBlocks !== undefined && !allowedBlocks.includes(node.type)) {
|
|
252
|
-
throw new StudioCommandError('mode-forbidden', `Block type ${node.type} is not an allowed block inside the composable region of node ${parent.id}.`);
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
function assertSubtreeUnlocked(node) {
|
|
256
|
-
const stack = [node];
|
|
257
|
-
while (stack.length > 0) {
|
|
258
|
-
const current = stack.pop();
|
|
259
|
-
if (current === undefined) {
|
|
260
|
-
break;
|
|
261
|
-
}
|
|
262
|
-
if (current.authoring.mode === 'locked') {
|
|
263
|
-
throw new StudioCommandError('mode-forbidden', `Node ${current.id} is locked and never changes through hybrid composition.`);
|
|
264
|
-
}
|
|
265
|
-
for (const children of Object.values(current.slots)) {
|
|
266
|
-
stack.push(...children);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
function rootsOutOfBounds() {
|
|
271
|
-
return new StudioCommandError('mode-forbidden', 'Hybrid composition is bounded to structural slots; the document roots are out of bounds.');
|
|
272
|
-
}
|
|
273
|
-
function immutableCommandTypeSet(types) {
|
|
274
|
-
const set = new Set(types);
|
|
275
|
-
const forbidMutation = () => {
|
|
276
|
-
throw new TypeError('The permitted command-type table is immutable.');
|
|
277
|
-
};
|
|
278
|
-
return Object.freeze(Object.assign(set, { add: forbidMutation, clear: forbidMutation, delete: forbidMutation }));
|
|
279
|
-
}
|
|
280
|
-
//# sourceMappingURL=modes.js.map
|
|
1
|
+
import{applyOperation as e,StudioCommandError as t}from"./commands.js";export const STUDIO_SESSION_MODES=Object.freeze([`blueprint`,`content`,`hybrid`,`model`,`read-only`]);const r=[`studio.command/apply-pattern`,`studio.command/batch`,`studio.command/duplicate-node`,`studio.command/insert-node`,`studio.command/move-node`,`studio.command/remove-binding`,`studio.command/remove-node`,`studio.command/reorder-children`,`studio.command/reset-inherited-property`,`studio.command/restore-node`,`studio.command/set-binding`,`studio.command/set-property`,`studio.command/set-size-role`,`studio.command/unset-property`,`studio.command/unset-size-role`],i=[`studio.command/duplicate-node`,`studio.command/insert-node`,`studio.command/move-node`,`studio.command/remove-node`,`studio.command/reorder-children`,`studio.command/restore-node`],a=Object.freeze({blueprint:m(r),content:m([`studio.command/set-field-value`]),hybrid:m([`studio.command/batch`,...i,`studio.command/set-field-value`]),model:m([`studio.command/add-model-field`]),"read-only":m([])}),o=m(i);export function permittedCommandTypes(e){return a[e]}export function resolveSessionMode(e){if(e.sessionState===`read-only`)return`read-only`;if(e.composite===`hybrid`){if(e.mode===`model`)throw RangeError(`The hybrid composite is invalid with the model editing mode.`);return`hybrid`}return e.mode}export function assertModePermitsCommandType(e,n){if(!a[e].has(n))throw new t(`mode-forbidden`,`Command type ${n} is not permitted in ${e} mode.`)}export function assertHybridCommandInBounds(n,r){switch(r.type){case`studio.command/batch`:for(let i of r.payload.operations){let r=i.type;if(r===`studio.command/batch`||r===`studio.command/apply-pattern`||r===`studio.command/reset-inherited-property`)return;if(!o.has(i.type))throw new t(`mode-forbidden`,`Batch operation type ${i.type} is not permitted in hybrid mode.`);s(n,i);try{e(n,i)}catch{return}}return;case`studio.command/apply-pattern`:case`studio.command/reset-inherited-property`:throw new t(`mode-forbidden`,`Command type ${r.type} is not permitted in hybrid mode.`);default:s(n,r)}}function s(e,n){switch(n.type){case`studio.command/insert-node`:case`studio.command/restore-node`:f(n.payload.node),l(e,n.payload.destination,n.payload.node);return;case`studio.command/remove-node`:{let t=c(e.roots,n.payload.nodeId);if(t===void 0)return;f(t.node),u(t.parent,t.slot);return}case`studio.command/move-node`:{let t=c(e.roots,n.payload.nodeId);if(t===void 0)return;f(t.node),u(t.parent,t.slot),l(e,n.payload.destination,t.node);return}case`studio.command/duplicate-node`:{let t=c(e.roots,n.payload.nodeId);if(t===void 0)return;f(t.node),n.payload.destination===void 0?(u(t.parent,t.slot),t.parent!==void 0&&d(t.parent,t.slot,t.node)):l(e,n.payload.destination,t.node);return}case`studio.command/reorder-children`:if(n.payload.parentNodeId===void 0)throw p();u(c(e.roots,n.payload.parentNodeId)?.node,n.payload.slot);return;default:throw new t(`mode-forbidden`,`Batch operation type ${n.type} is not permitted in hybrid mode.`)}}function c(e,t,n,r){for(let i of e){if(i.id===t)return n===void 0?{node:i}:r===void 0?{node:i,parent:n}:{node:i,parent:n,slot:r};for(let[e,n]of Object.entries(i.slots)){let r=c(n,t,i,e);if(r!==void 0)return r}}}function l(e,t,n){if(t.parentNodeId===void 0)throw p();let r=c(e.roots,t.parentNodeId)?.node;r!==void 0&&(u(r,t.slot),d(r,t.slot,n))}function u(e,n){if(e===void 0)throw p();if(e.authoring.mode!==`structural`&&(n===void 0||e.authoring.slots?.[n]?.composable!==!0))throw new t(`mode-forbidden`,`Hybrid composition is bounded to structural slots; node ${e.id} declares neither structural authoring nor a composable marker for the affected slot.`)}function d(e,n,r){let i=(n===void 0?void 0:e.authoring.slots?.[n])?.allowedBlocks??e.authoring.allowedBlocks;if(i!==void 0&&!i.includes(r.type))throw new t(`mode-forbidden`,`Block type ${r.type} is not an allowed block inside the composable region of node ${e.id}.`)}function f(e){let n=[e];for(;n.length>0;){let e=n.pop();if(e===void 0)break;if(e.authoring.mode===`locked`)throw new t(`mode-forbidden`,`Node ${e.id} is locked and never changes through hybrid composition.`);for(let t of Object.values(e.slots))n.push(...t)}}function p(){return new t(`mode-forbidden`,`Hybrid composition is bounded to structural slots; the document roots are out of bounds.`)}function m(e){let t=new Set(e),n=()=>{throw TypeError(`The permitted command-type table is immutable.`)};return Object.freeze(Object.assign(t,{add:n,clear:n,delete:n}))}
|
package/dist/negotiation.js
CHANGED
|
@@ -1,65 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
const DEFAULT_REQUIRED_PORTS = ['studio.port/artifact'];
|
|
3
|
-
/**
|
|
4
|
-
* Resolve one session posture from a host capability document. Capability
|
|
5
|
-
* negotiation fails closed: without a common wire protocol version or a
|
|
6
|
-
* required port there is no editable session, only a diagnosable read-only
|
|
7
|
-
* one. Optional ports degrade with informational diagnostics instead of
|
|
8
|
-
* being silently assumed.
|
|
9
|
-
*/
|
|
10
|
-
export function negotiateCapabilities(capabilities, options = {}) {
|
|
11
|
-
const supportedVersions = options.supportedProtocolVersions ?? [STUDIO_WIRE_PROTOCOL_VERSION];
|
|
12
|
-
const requiredPorts = options.requiredPorts ?? DEFAULT_REQUIRED_PORTS;
|
|
13
|
-
const optionalPorts = options.optionalPorts ?? [];
|
|
14
|
-
const diagnostics = [];
|
|
15
|
-
const availablePorts = capabilities.ports.map((port) => port.id);
|
|
16
|
-
const available = new Set(availablePorts);
|
|
17
|
-
const protocolVersion = supportedVersions.find((version) => capabilities.protocolVersions.includes(version));
|
|
18
|
-
if (protocolVersion === undefined) {
|
|
19
|
-
diagnostics.push({
|
|
20
|
-
code: 'studio.host/no-common-protocol-version',
|
|
21
|
-
message: {
|
|
22
|
-
defaultMessage: 'Studio and the host share no wire protocol version.',
|
|
23
|
-
key: 'studio.host/no-common-protocol-version',
|
|
24
|
-
},
|
|
25
|
-
severity: 'blocking',
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
const missingRequiredPorts = requiredPorts.filter((port) => !available.has(port));
|
|
29
|
-
for (const port of missingRequiredPorts) {
|
|
30
|
-
diagnostics.push({
|
|
31
|
-
code: 'studio.host/missing-required-port',
|
|
32
|
-
message: {
|
|
33
|
-
defaultMessage: `The host does not provide the required ${port} port.`,
|
|
34
|
-
key: 'studio.host/missing-required-port',
|
|
35
|
-
},
|
|
36
|
-
parameters: { port },
|
|
37
|
-
severity: 'blocking',
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
const missingOptionalPorts = optionalPorts.filter((port) => !available.has(port));
|
|
41
|
-
for (const port of missingOptionalPorts) {
|
|
42
|
-
diagnostics.push({
|
|
43
|
-
code: 'studio.host/missing-optional-port',
|
|
44
|
-
message: {
|
|
45
|
-
defaultMessage: `The optional ${port} port is unavailable; its features are disabled.`,
|
|
46
|
-
key: 'studio.host/missing-optional-port',
|
|
47
|
-
},
|
|
48
|
-
parameters: { port },
|
|
49
|
-
severity: 'information',
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
const editable = protocolVersion !== undefined && missingRequiredPorts.length === 0;
|
|
53
|
-
const result = {
|
|
54
|
-
availablePorts,
|
|
55
|
-
diagnostics,
|
|
56
|
-
missingOptionalPorts,
|
|
57
|
-
missingRequiredPorts,
|
|
58
|
-
sessionState: editable ? 'editable' : 'read-only',
|
|
59
|
-
};
|
|
60
|
-
if (protocolVersion !== undefined) {
|
|
61
|
-
result.protocolVersion = protocolVersion;
|
|
62
|
-
}
|
|
63
|
-
return result;
|
|
64
|
-
}
|
|
65
|
-
//# sourceMappingURL=negotiation.js.map
|
|
1
|
+
import{STUDIO_WIRE_PROTOCOL_VERSION as e}from"@kumwe/studio-protocol";const t=[`studio.port/artifact`];export function negotiateCapabilities(n,r={}){let i=r.supportedProtocolVersions??[e],a=r.requiredPorts??t,o=r.optionalPorts??[],s=[],c=n.ports.map(e=>e.id),l=new Set(c),u=i.find(e=>n.protocolVersions.includes(e));u===void 0&&s.push({code:`studio.host/no-common-protocol-version`,message:{defaultMessage:`Studio and the host share no wire protocol version.`,key:`studio.host/no-common-protocol-version`},severity:`blocking`});let d=a.filter(e=>!l.has(e));for(let e of d)s.push({code:`studio.host/missing-required-port`,message:{defaultMessage:`The host does not provide the required ${e} port.`,key:`studio.host/missing-required-port`},parameters:{port:e},severity:`blocking`});let f=o.filter(e=>!l.has(e));for(let e of f)s.push({code:`studio.host/missing-optional-port`,message:{defaultMessage:`The optional ${e} port is unavailable; its features are disabled.`,key:`studio.host/missing-optional-port`},parameters:{port:e},severity:`information`});let p={availablePorts:c,diagnostics:s,missingOptionalPorts:f,missingRequiredPorts:d,sessionState:u!==void 0&&d.length===0?`editable`:`read-only`};return u!==void 0&&(p.protocolVersion=u),p}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { StudioChartSpec, StudioDrawingDocument, StudioMoneyValue, StudioPresentationIntent, StudioTableDocument } from '@kumwe/studio-protocol';
|
|
2
|
+
/** Parse and detach one canonical chart spec, refusing library-specific configuration. */
|
|
3
|
+
export declare function parseStudioChartSpec(value: unknown): StudioChartSpec;
|
|
4
|
+
/** Parse bounded vector strokes and reject SVG, data URLs, and canvas commands. */
|
|
5
|
+
export declare function parseStudioDrawingDocument(value: unknown): StudioDrawingDocument;
|
|
6
|
+
/** Parse exact decimal money without converting through a binary float. */
|
|
7
|
+
export declare function parseStudioMoneyValue(value: unknown): StudioMoneyValue;
|
|
8
|
+
/** Parse closed presentation intent without accepting selectors, declarations, or measurements. */
|
|
9
|
+
export declare function parseStudioPresentationIntent(value: unknown): StudioPresentationIntent;
|
|
10
|
+
/** Parse a bounded, text-only table and require one cell per declared column. */
|
|
11
|
+
export declare function parseStudioTableDocument(value: unknown): StudioTableDocument;
|
|
12
|
+
//# sourceMappingURL=production-values.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"production-values.d.ts","sourceRoot":"","sources":["../src/production-values.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,eAAe,EACf,qBAAqB,EAGrB,gBAAgB,EAChB,wBAAwB,EACxB,mBAAmB,EACpB,MAAM,wBAAwB,CAAC;AAOhC,0FAA0F;AAC1F,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CA4CpE;AAED,mFAAmF;AACnF,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,qBAAqB,CA2ChF;AAED,2EAA2E;AAC3E,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAStE;AAED,mGAAmG;AACnG,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,OAAO,GAAG,wBAAwB,CA4FtF;AAED,iFAAiF;AACjF,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,mBAAmB,CAsB5E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=new Set([`bar`,`doughnut`,`line`,`pie`]),t=/^-?(?:0|[1-9][0-9]{0,17})(?:\.[0-9]{1,6})?$/u,n=/^[A-Z]{3}$/u,r=/^(?:#[0-9A-Fa-f]{6}|[a-z][a-z0-9-]{0,62}\/[a-z][a-z0-9-]{0,62})$/u;export function parseStudioChartSpec(t){let n=l(t,[`datasets`,`labels`,`title`,`type`],`Chart`);if(typeof n.type!=`string`||!e.has(n.type))throw TypeError(`Chart type must be bar, doughnut, line, or pie.`);let r=u(n.labels,200,500,`Chart labels`);if(!Array.isArray(n.datasets)||n.datasets.length<1||n.datasets.length>20)throw RangeError(`Chart datasets must contain between 1 and 20 datasets.`);let i={datasets:n.datasets.map((e,t)=>{let n=l(e,[`label`,`values`],`Chart dataset ${t}`);if(typeof n.label!=`string`||n.label.length>500)throw TypeError(`Chart dataset ${t} label must be a bounded string.`);if(!Array.isArray(n.values)||n.values.length>200)throw RangeError(`Chart dataset ${t} values exceed the 200-value limit.`);let i=n.values.map(e=>{if(typeof e!=`number`||!Number.isFinite(e)||Math.abs(e)>0x38d7ea4c68000)throw TypeError(`Chart dataset ${t} contains an invalid finite number.`);return e});if(i.length!==r.length)throw RangeError(`Chart dataset ${t} must have one value per label.`);return{label:n.label,values:i}}),labels:r,type:n.type};if(n.title!==void 0){if(typeof n.title!=`string`||n.title.length>500)throw TypeError(`Chart title must be a bounded string.`);i.title=n.title}return i}export function parseStudioDrawingDocument(e){let t=l(e,[`alt`,`height`,`strokes`,`width`],`Drawing`),n=d(t.width,1,4096,`Drawing width`),i=d(t.height,1,4096,`Drawing height`);if(typeof t.alt!=`string`||t.alt.length<1||t.alt.length>5e3)throw TypeError(`Drawing alternative text must contain between 1 and 5000 characters.`);if(!Array.isArray(t.strokes)||t.strokes.length>5e3)throw RangeError(`Drawing strokes exceed the 5000-stroke limit.`);let a=t.strokes.map((e,t)=>{let a=l(e,[`color`,`points`,`width`],`Drawing stroke ${t}`);if(typeof a.color!=`string`||!r.test(a.color))throw TypeError(`Drawing stroke ${t} uses an invalid color token.`);if(typeof a.width!=`number`||!Number.isFinite(a.width)||a.width<.25||a.width>64)throw RangeError(`Drawing stroke ${t} width is outside 0.25 through 64.`);if(!Array.isArray(a.points)||a.points.length<1||a.points.length>1e4)throw RangeError(`Drawing stroke ${t} must contain 1 through 10000 points.`);let o=a.points.map((e,t)=>{let r=l(e,[`x`,`y`],`Drawing point ${t}`);return{x:f(r.x,n,`Drawing point ${t} x`),y:f(r.y,i,`Drawing point ${t} y`)}});return{color:a.color,points:o,width:a.width}});return{alt:t.alt,height:i,strokes:a,width:n}}export function parseStudioMoneyValue(e){let r=l(e,[`amount`,`currency`],`Money`);if(typeof r.amount!=`string`||!t.test(r.amount))throw TypeError(`Money amount must be a canonical decimal string with at most six places.`);if(typeof r.currency!=`string`||!n.test(r.currency))throw TypeError(`Money currency must be an uppercase ISO-style three-letter code.`);return{amount:r.amount,currency:r.currency}}export function parseStudioPresentationIntent(e){let t=l(e,[`align`,`animation`,`height`,`inverse`,`margin`,`marker`,`padding`,`position`,`print`,`scrolling`,`visibility`,`width`],`Presentation intent`),n=p(t.align,[`center`,`end`,`start`,`stretch`],`align`),r=p(t.animation,[`fade`,`none`,`parallax`,`scale`,`slide`],`animation`),i=p(t.height,[`auto`,`content`,`full`,`viewport`],`height`),a;if(t.inverse!==void 0){if(typeof t.inverse!=`boolean`)throw TypeError(`inverse must be a boolean.`);a=t.inverse}let o=p(t.margin,[`comfortable`,`compact`,`none`,`spacious`],`margin`),s=p(t.marker,[`check`,`decimal`,`disc`,`none`],`marker`),c=p(t.padding,[`comfortable`,`compact`,`none`,`spacious`],`padding`),u=p(t.position,[`flow`,`relative`,`sticky`],`position`),d=p(t.print,[`hide`,`only`,`show`],`print`),f=p(t.scrolling,[`auto`,`clip`,`snap`,`visible`],`scrolling`),m=p(t.width,[`auto`,`content`,`full`],`width`),h;if(t.visibility!==void 0){let e=l(t.visibility,[`compact`,`expanded`,`medium`],`Presentation visibility`),n=p(e.compact,[`hidden`,`visible`],`compact visibility`),r=p(e.expanded,[`hidden`,`visible`],`expanded visibility`),i=p(e.medium,[`hidden`,`visible`],`medium visibility`);h={...n===void 0?{}:{compact:n},...r===void 0?{}:{expanded:r},...i===void 0?{}:{medium:i}}}return{...n===void 0?{}:{align:n},...r===void 0?{}:{animation:r},...i===void 0?{}:{height:i},...a===void 0?{}:{inverse:a},...o===void 0?{}:{margin:o},...s===void 0?{}:{marker:s},...c===void 0?{}:{padding:c},...u===void 0?{}:{position:u},...d===void 0?{}:{print:d},...f===void 0?{}:{scrolling:f},...h===void 0?{}:{visibility:h},...m===void 0?{}:{width:m}}}export function parseStudioTableDocument(e){let t=l(e,[`caption`,`columns`,`rows`],`Table`),n=u(t.columns,50,500,`Table columns`);if(n.length===0)throw RangeError(`Table must declare at least one column.`);if(!Array.isArray(t.rows)||t.rows.length>1e3)throw RangeError(`Table rows exceed the 1000-row limit.`);let r=t.rows.map((e,t)=>{let r=u(e,50,5e3,`Table row ${t}`);if(r.length!==n.length)throw RangeError(`Table row ${t} must contain one cell per column.`);return r}),i;if(t.caption!==void 0){if(typeof t.caption!=`string`||t.caption.length>500)throw TypeError(`Table caption must be a bounded string.`);i=t.caption}return{...i===void 0?{}:{caption:i},columns:n,rows:r}}function l(e,t,n){if(typeof e!=`object`||!e||Array.isArray(e)||Object.getPrototypeOf(e)!==Object.prototype)throw TypeError(`${n} must be a plain JSON object.`);let r=e,i=new Set(t),a=Object.keys(r).find(e=>!i.has(e));if(a!==void 0)throw TypeError(`${n} contains unknown member ${a}.`);return r}function u(e,t,n,r){if(!Array.isArray(e)||e.length>t)throw RangeError(`${r} exceed their item limit.`);return e.map(e=>{if(typeof e!=`string`||e.length>n)throw TypeError(`${r} must be bounded strings.`);return e})}function d(e,t,n,r){if(typeof e!=`number`||!Number.isInteger(e)||e<t||e>n)throw RangeError(`${r} must be an integer from ${t} through ${n}.`);return e}function f(e,t,n){if(typeof e!=`number`||!Number.isFinite(e)||e<0||e>t)throw RangeError(`${n} must be a finite coordinate inside the drawing bounds.`);return e}function p(e,t,n){if(e!==void 0){if(typeof e!=`string`||!t.some(t=>t===e))throw TypeError(`${n} is not an allowed presentation value.`);return e}}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { type BlockDefinition, type BlockType, type JsonObject, type PatternDocument } from '@kumwe/studio-protocol';
|
|
2
|
+
/** The host-neutral first-party blocks shipped by every Studio installation. */
|
|
3
|
+
export interface CoreProductionBlockTypeMap {
|
|
4
|
+
readonly accordion: 'studio.core/accordion';
|
|
5
|
+
readonly accordionItem: 'studio.core/accordion-item';
|
|
6
|
+
readonly article: 'studio.core/article';
|
|
7
|
+
readonly attachment: 'studio.core/attachment';
|
|
8
|
+
readonly audio: 'studio.core/audio';
|
|
9
|
+
readonly badge: 'studio.core/badge';
|
|
10
|
+
readonly callToAction: 'studio.core/call-to-action';
|
|
11
|
+
readonly callout: 'studio.core/callout';
|
|
12
|
+
readonly card: 'studio.core/card';
|
|
13
|
+
readonly chart: 'studio.core/chart';
|
|
14
|
+
readonly code: 'studio.core/code';
|
|
15
|
+
readonly columns: 'studio.core/columns';
|
|
16
|
+
readonly contentCollection: 'studio.core/content-collection';
|
|
17
|
+
readonly contentReference: 'studio.core/content-reference';
|
|
18
|
+
readonly countdown: 'studio.core/countdown';
|
|
19
|
+
readonly cover: 'studio.core/cover';
|
|
20
|
+
readonly descriptionItem: 'studio.core/description-item';
|
|
21
|
+
readonly descriptionList: 'studio.core/description-list';
|
|
22
|
+
readonly diagram: 'studio.core/diagram';
|
|
23
|
+
readonly dialog: 'studio.core/dialog';
|
|
24
|
+
readonly divider: 'studio.core/divider';
|
|
25
|
+
readonly drawing: 'studio.core/drawing';
|
|
26
|
+
readonly embed: 'studio.core/embed';
|
|
27
|
+
readonly gallery: 'studio.core/gallery';
|
|
28
|
+
readonly grid: 'studio.core/grid';
|
|
29
|
+
readonly heading: 'studio.core/heading';
|
|
30
|
+
readonly icon: 'studio.core/icon';
|
|
31
|
+
readonly image: 'studio.core/image';
|
|
32
|
+
readonly label: 'studio.core/label';
|
|
33
|
+
readonly math: 'studio.core/math';
|
|
34
|
+
readonly money: 'studio.core/money';
|
|
35
|
+
readonly notice: 'studio.core/notice';
|
|
36
|
+
readonly navigation: 'studio.core/navigation';
|
|
37
|
+
readonly navigationItem: 'studio.core/navigation-item';
|
|
38
|
+
readonly popover: 'studio.core/popover';
|
|
39
|
+
readonly progress: 'studio.core/progress';
|
|
40
|
+
readonly richText: 'studio.core/rich-text';
|
|
41
|
+
readonly search: 'studio.core/search';
|
|
42
|
+
readonly section: 'studio.core/section';
|
|
43
|
+
readonly stack: 'studio.core/stack';
|
|
44
|
+
readonly spinner: 'studio.core/spinner';
|
|
45
|
+
readonly tab: 'studio.core/tab';
|
|
46
|
+
readonly table: 'studio.core/table';
|
|
47
|
+
readonly tabs: 'studio.core/tabs';
|
|
48
|
+
readonly video: 'studio.core/video';
|
|
49
|
+
}
|
|
50
|
+
export declare const CORE_PRODUCTION_BLOCK_TYPES: Readonly<CoreProductionBlockTypeMap>;
|
|
51
|
+
export type CoreProductionBlockType = (typeof CORE_PRODUCTION_BLOCK_TYPES)[keyof typeof CORE_PRODUCTION_BLOCK_TYPES];
|
|
52
|
+
/** Stable control identifiers. Hosts register ports; they do not know editor implementations. */
|
|
53
|
+
export interface CoreProductionControlIdMap {
|
|
54
|
+
readonly chart: 'studio.control/chart';
|
|
55
|
+
readonly drawing: 'studio.control/drawing';
|
|
56
|
+
readonly mediaCollection: 'studio.control/media-collection';
|
|
57
|
+
readonly mediaReference: 'studio.control/media-reference';
|
|
58
|
+
readonly money: 'studio.control/money';
|
|
59
|
+
readonly presentation: 'studio.control/presentation';
|
|
60
|
+
readonly richText: 'studio.control/rich-text';
|
|
61
|
+
readonly scopedCss: 'studio.control/scoped-css';
|
|
62
|
+
readonly source: 'studio.control/source';
|
|
63
|
+
readonly table: 'studio.control/table';
|
|
64
|
+
}
|
|
65
|
+
export declare const CORE_PRODUCTION_CONTROL_IDS: Readonly<CoreProductionControlIdMap>;
|
|
66
|
+
/** The ten reusable compositions distributed with the production catalog. */
|
|
67
|
+
export declare const CORE_PRODUCTION_PATTERN_IDS: readonly [
|
|
68
|
+
'studio.pattern/article',
|
|
69
|
+
'studio.pattern/collection-index',
|
|
70
|
+
'studio.pattern/document-header',
|
|
71
|
+
'studio.pattern/faq',
|
|
72
|
+
'studio.pattern/feature-grid',
|
|
73
|
+
'studio.pattern/hero',
|
|
74
|
+
'studio.pattern/media-gallery',
|
|
75
|
+
'studio.pattern/pricing',
|
|
76
|
+
'studio.pattern/product',
|
|
77
|
+
'studio.pattern/tabbed-content'
|
|
78
|
+
];
|
|
79
|
+
/** Build the entire canonical catalog with explicit allowlists and no host imports. */
|
|
80
|
+
export declare function createCoreProductionBlockDefinitions(): BlockDefinition[];
|
|
81
|
+
/** Minimal schema-valid persisted properties for a newly inserted production node. */
|
|
82
|
+
export declare function coreProductionInitialProperties(type: CoreProductionBlockType): JsonObject;
|
|
83
|
+
export declare function isCoreProductionBlockType(type: BlockType): type is CoreProductionBlockType;
|
|
84
|
+
/** Create the ten deterministic, schema-valid starter patterns. */
|
|
85
|
+
export declare function createCoreProductionPatterns(): PatternDocument[];
|
|
86
|
+
//# sourceMappingURL=production.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"production.d.ts","sourceRoot":"","sources":["../src/production.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{STUDIO_CONTRACT_VERSION as e,studioPresentationSchema as t}from"@kumwe/studio-protocol";import{cloneContractValue as n}from"./clone.js";import{CORE_LAYOUT_BLOCK_TYPES as r,coreLayoutInitialProperties as i,createCoreLayoutBlockDefinitions as a,isCoreLayoutBlockType as o}from"./layout.js";export const CORE_PRODUCTION_BLOCK_TYPES=Object.freeze({...r,accordion:`studio.core/accordion`,accordionItem:`studio.core/accordion-item`,article:`studio.core/article`,attachment:`studio.core/attachment`,audio:`studio.core/audio`,badge:`studio.core/badge`,callToAction:`studio.core/call-to-action`,callout:`studio.core/callout`,card:`studio.core/card`,chart:`studio.core/chart`,code:`studio.core/code`,contentCollection:`studio.core/content-collection`,contentReference:`studio.core/content-reference`,countdown:`studio.core/countdown`,cover:`studio.core/cover`,descriptionItem:`studio.core/description-item`,descriptionList:`studio.core/description-list`,diagram:`studio.core/diagram`,dialog:`studio.core/dialog`,divider:`studio.core/divider`,drawing:`studio.core/drawing`,embed:`studio.core/embed`,gallery:`studio.core/gallery`,heading:`studio.core/heading`,icon:`studio.core/icon`,image:`studio.core/image`,label:`studio.core/label`,math:`studio.core/math`,money:`studio.core/money`,navigation:`studio.core/navigation`,navigationItem:`studio.core/navigation-item`,notice:`studio.core/notice`,popover:`studio.core/popover`,progress:`studio.core/progress`,richText:`studio.core/rich-text`,search:`studio.core/search`,spinner:`studio.core/spinner`,tab:`studio.core/tab`,table:`studio.core/table`,tabs:`studio.core/tabs`,video:`studio.core/video`});export const CORE_PRODUCTION_CONTROL_IDS=Object.freeze({chart:`studio.control/chart`,drawing:`studio.control/drawing`,mediaCollection:`studio.control/media-collection`,mediaReference:`studio.control/media-reference`,money:`studio.control/money`,presentation:`studio.control/presentation`,richText:`studio.control/rich-text`,scopedCss:`studio.control/scoped-css`,source:`studio.control/source`,table:`studio.control/table`});export const CORE_PRODUCTION_PATTERN_IDS=Object.freeze([`studio.pattern/article`,`studio.pattern/collection-index`,`studio.pattern/document-header`,`studio.pattern/faq`,`studio.pattern/feature-grid`,`studio.pattern/hero`,`studio.pattern/media-gallery`,`studio.pattern/pricing`,`studio.pattern/product`,`studio.pattern/tabbed-content`]);const l=`1.0.0`,u=Object.freeze({id:`studio.core/blocks`,version:l}),d=Object.freeze([{capability:`studio.renderer/semantic-web`,surface:`preview`,versions:`^1.0.0`},{capability:`studio.renderer/semantic-web`,surface:`web`,versions:`^1.0.0`}]),f=Object.freeze(Object.values(CORE_PRODUCTION_BLOCK_TYPES)),p=Object.freeze(f.filter(e=>e!==CORE_PRODUCTION_BLOCK_TYPES.accordionItem&&e!==CORE_PRODUCTION_BLOCK_TYPES.descriptionItem&&e!==CORE_PRODUCTION_BLOCK_TYPES.navigationItem&&e!==CORE_PRODUCTION_BLOCK_TYPES.tab)),m=(e,t=!1)=>({authoring:{control:`studio.control/single-line-text`},id:e,label:L(`port-${e}`,R(e)),multiple:!1,required:t,valueType:`text`}),h=(e,t=!1)=>({authoring:{control:`studio.control/integer`},id:e,label:L(`port-${e}`,R(e)),multiple:!1,required:t,valueType:`integer`}),g=(e=`content`)=>({authoring:{control:CORE_PRODUCTION_CONTROL_IDS.richText,profile:`studio.rich-text/marketing`},id:e,label:L(`port-${e}`,R(e)),multiple:!1,required:!1,valueType:`rich-text`}),_=(e,t=!1)=>({authoring:{control:t?CORE_PRODUCTION_CONTROL_IDS.mediaCollection:CORE_PRODUCTION_CONTROL_IDS.mediaReference},id:e,label:L(`port-${e}`,R(e)),multiple:t,required:!1,valueType:`media`}),v=e=>({authoring:{control:CORE_PRODUCTION_CONTROL_IDS.source,profile:e},id:`source`,label:L(`port-source`,`Source`),multiple:!1,required:!0,valueType:`text`}),y=(e,t)=>({authoring:{readOnly:!0},id:e,label:L(`port-${e}`,R(e)),multiple:t,required:!0,valueType:`resource`}),b=(e=2e4)=>({maxLength:e,type:`string`}),x=()=>({type:`boolean`}),S=(...e)=>({enum:e}),C=(e,t)=>({maximum:t,minimum:e,type:`integer`}),w=O(),T=Object.freeze({accordion:{accessibility:`composite`,controls:{"allow-multiple":`studio.control/switch`},defaults:{"allow-multiple":!1},properties:{"allow-multiple":x()},slots:[{accepts:[CORE_PRODUCTION_BLOCK_TYPES.accordionItem],id:`items`,maximum:50}]},accordionItem:{accessibility:`composite`,controls:{expanded:`studio.control/switch`},defaults:{expanded:!1},ports:[m(`title`,!0)],properties:{expanded:x()},slots:[{accepts:p,id:`content`,maximum:100}]},article:{accessibility:`landmark`,defaults:{},ports:[m(`title`)],slots:[{accepts:p,id:`content`,maximum:200}]},attachment:{accessibility:`media`,controls:{download:`studio.control/switch`},defaults:{download:!0},ports:[_(`asset`),m(`label`)],properties:{download:x()}},audio:{accessibility:`media`,controls:{autoplay:`studio.control/switch`,controls:`studio.control/switch`},defaults:{autoplay:!1,controls:!0},ports:[_(`asset`),m(`transcript`)],properties:{autoplay:x(),controls:x()}},badge:{accessibility:`text`,controls:{appearance:`studio.control/select`,tone:`studio.control/select`},defaults:{appearance:`solid`,tone:`neutral`},ports:[m(`label`,!0)],properties:{appearance:S(`outline`,`soft`,`solid`),tone:S(`error`,`information`,`neutral`,`success`,`warning`)}},callToAction:{accessibility:`interactive`,controls:{appearance:`studio.control/select`,href:`studio.control/single-line-text`},defaults:{appearance:`primary`,href:``},ports:[m(`label`,!0)],properties:{appearance:S(`primary`,`secondary`,`link`),href:b(2048)}},callout:{accessibility:`composite`,controls:{tone:`studio.control/select`},defaults:{tone:`information`},ports:[m(`title`),g()],properties:{tone:S(`information`,`success`,`warning`,`danger`)}},card:{accessibility:`composite`,controls:{appearance:`studio.control/select`},defaults:{appearance:`plain`},ports:[_(`media`),m(`title`),g(`summary`)],properties:{appearance:S(`plain`,`bordered`,`elevated`)},slots:[{accepts:p,id:`actions`,maximum:5}]},chart:{accessibility:`data-display`,defaults:{},ports:[{authoring:{control:CORE_PRODUCTION_CONTROL_IDS.chart,profile:`studio.chart/canonical`},id:`chart`,label:L(`port-chart`,`Chart`),multiple:!1,required:!0,valueType:`studio.value/chart`}]},code:{accessibility:`text`,controls:{language:`studio.control/single-line-text`,"show-line-numbers":`studio.control/switch`},defaults:{language:`text`,"show-line-numbers":!1},ports:[v(`studio.source/code`)],properties:{language:b(100),"show-line-numbers":x()}},contentCollection:{accessibility:`data-display`,controls:{limit:`studio.control/integer`,presentation:`studio.control/select`},defaults:{limit:12,presentation:`cards`},ports:[y(`items`,!0)],properties:{limit:C(1,100),presentation:S(`cards`,`grid`,`list`,`slideshow`)}},contentReference:{accessibility:`data-display`,controls:{presentation:`studio.control/select`},defaults:{presentation:`summary`},ports:[y(`item`,!1)],properties:{presentation:S(`full`,`summary`,`title`)}},countdown:{accessibility:`data-display`,controls:{display:`studio.control/select`,"expired-behavior":`studio.control/select`},defaults:{display:`detailed`,"expired-behavior":`zero`},ports:[m(`target`,!0),m(`completion-message`)],properties:{display:S(`compact`,`detailed`),"expired-behavior":S(`hide`,`message`,`zero`)}},cover:{accessibility:`composite`,controls:{alignment:`studio.control/select`,overlay:`studio.control/select`},defaults:{alignment:`center`,overlay:`medium`},ports:[_(`background`)],properties:{alignment:S(`center`,`end`,`start`),overlay:S(`light`,`medium`,`none`,`strong`)},slots:[{accepts:p,id:`content`,maximum:100}]},descriptionItem:{accessibility:`text`,defaults:{},ports:[m(`term`,!0),g(`description`)]},descriptionList:{accessibility:`data-display`,defaults:{},ports:[m(`title`)],slots:[{accepts:[CORE_PRODUCTION_BLOCK_TYPES.descriptionItem],id:`items`,maximum:100}]},diagram:{accessibility:`data-display`,controls:{theme:`studio.control/select`},defaults:{theme:`neutral`},ports:[v(`studio.source/mermaid`)],properties:{theme:S(`dark`,`forest`,`neutral`)}},dialog:{accessibility:`interactive`,controls:{modal:`studio.control/switch`,presentation:`studio.control/select`},defaults:{modal:!0,presentation:`modal`},ports:[m(`trigger-label`,!0),m(`title`,!0)],properties:{modal:x(),presentation:S(`modal`,`offcanvas`,`overlay`)},slots:[{accepts:p,id:`content`,maximum:100}]},divider:{accessibility:`structural`,controls:{style:`studio.control/select`},defaults:{style:`solid`},ports:[m(`label`)],properties:{style:S(`dashed`,`dotted`,`solid`)}},drawing:{accessibility:`media`,defaults:{},ports:[{authoring:{control:CORE_PRODUCTION_CONTROL_IDS.drawing,profile:`studio.drawing/canonical`},id:`drawing`,label:L(`port-drawing`,`Drawing`),multiple:!1,required:!0,valueType:`studio.value/drawing`}]},embed:{accessibility:`media`,controls:{"aspect-ratio":`studio.control/select`},defaults:{"aspect-ratio":`16:9`},ports:[y(`resource`,!1)],properties:{"aspect-ratio":S(`1:1`,`4:3`,`16:9`,`21:9`)}},gallery:{accessibility:`composite`,controls:{autoplay:`studio.control/switch`,columns:`studio.control/integer`,lightbox:`studio.control/switch`,presentation:`studio.control/select`},defaults:{autoplay:!1,columns:4,lightbox:!1,presentation:`grid`},ports:[_(`items`,!0)],properties:{autoplay:x(),columns:C(1,12),lightbox:x(),presentation:S(`grid`,`slideshow`)}},heading:{accessibility:`text`,controls:{level:`studio.control/select`},defaults:{level:2},ports:[m(`text`,!0)],properties:{level:C(1,6)}},icon:{accessibility:`media`,controls:{decorative:`studio.control/switch`,name:`studio.control/single-line-text`},defaults:{decorative:!0,name:`symbol`},ports:[m(`alternative-text`)],properties:{decorative:x(),name:b(200)}},image:{accessibility:`media`,controls:{fit:`studio.control/select`,loading:`studio.control/select`},defaults:{fit:`cover`,loading:`lazy`},ports:[_(`asset`)],properties:{fit:S(`contain`,`cover`,`fill`,`scale-down`),loading:S(`eager`,`lazy`)}},label:{accessibility:`text`,controls:{tone:`studio.control/select`},defaults:{tone:`neutral`},ports:[m(`text`,!0)],properties:{tone:S(`error`,`information`,`neutral`,`success`,`warning`)}},math:{accessibility:`text`,controls:{"display-mode":`studio.control/switch`},defaults:{"display-mode":!0},ports:[v(`studio.source/latex`)],properties:{"display-mode":x()}},money:{accessibility:`data-display`,defaults:{},ports:[{authoring:{control:CORE_PRODUCTION_CONTROL_IDS.money,profile:`studio.money/canonical`},id:`amount`,label:L(`port-amount`,`Amount`),multiple:!1,required:!0,valueType:`money`}]},navigation:{accessibility:`landmark`,controls:{presentation:`studio.control/select`},defaults:{presentation:`nav`},ports:[m(`label`)],properties:{presentation:S(`breadcrumbs`,`dotnav`,`dropnav`,`navbar`,`nav`,`pagination`,`subnav`,`thumbnav`)},slots:[{accepts:[CORE_PRODUCTION_BLOCK_TYPES.navigationItem],id:`items`,maximum:100}]},navigationItem:{accessibility:`interactive`,controls:{current:`studio.control/switch`,href:`studio.control/single-line-text`},defaults:{current:!1,href:``},ports:[m(`label`,!0)],properties:{current:x(),href:b(2048)},slots:[{accepts:[CORE_PRODUCTION_BLOCK_TYPES.navigationItem],id:`children`,maximum:50}]},notice:{accessibility:`composite`,controls:{dismissible:`studio.control/switch`,tone:`studio.control/select`},defaults:{dismissible:!1,tone:`information`},ports:[m(`title`),g()],properties:{dismissible:x(),tone:S(`comment`,`error`,`information`,`success`,`warning`)}},popover:{accessibility:`interactive`,controls:{"dismiss-on-blur":`studio.control/switch`,placement:`studio.control/select`,presentation:`studio.control/select`},defaults:{"dismiss-on-blur":!0,placement:`auto`,presentation:`popover`},ports:[m(`trigger-label`,!0),m(`title`)],properties:{"dismiss-on-blur":x(),placement:S(`auto`,`bottom`,`left`,`right`,`top`),presentation:S(`dropbar`,`dropdown`,`popover`,`tooltip`)},slots:[{accepts:p,id:`content`,maximum:100}]},progress:{accessibility:`data-display`,controls:{maximum:`studio.control/integer`},defaults:{maximum:100},ports:[m(`label`),h(`value`,!0)],properties:{maximum:C(1,1e6)}},richText:{accessibility:`text`,defaults:{},ports:[g()]},search:{accessibility:`interactive`,controls:{action:`studio.control/single-line-text`,"query-parameter":`studio.control/single-line-text`},defaults:{action:``,"query-parameter":`q`},ports:[m(`label`),m(`placeholder`)],properties:{action:b(2048),"query-parameter":b(100)}},spinner:{accessibility:`data-display`,controls:{active:`studio.control/switch`,size:`studio.control/select`},defaults:{active:!0,size:`medium`},ports:[m(`label`)],properties:{active:x(),size:S(`large`,`medium`,`small`)}},tab:{accessibility:`composite`,defaults:{},ports:[m(`title`,!0)],slots:[{accepts:p,id:`content`,maximum:100}]},tabs:{accessibility:`composite`,controls:{activation:`studio.control/select`},defaults:{activation:`automatic`},properties:{activation:S(`automatic`,`manual`)},slots:[{accepts:[CORE_PRODUCTION_BLOCK_TYPES.tab],id:`items`,maximum:30}]},table:{accessibility:`data-display`,defaults:{},ports:[{authoring:{control:CORE_PRODUCTION_CONTROL_IDS.table,profile:`studio.table/canonical`},id:`table`,label:L(`port-table`,`Table`),multiple:!1,required:!0,valueType:`studio.value/table`}]},video:{accessibility:`media`,controls:{autoplay:`studio.control/switch`,controls:`studio.control/switch`,muted:`studio.control/switch`},defaults:{autoplay:!1,controls:!0,muted:!1},ports:[_(`asset`),_(`poster`),m(`captions`)],properties:{autoplay:x(),controls:x(),muted:x()}}});export function createCoreProductionBlockDefinitions(){let e=a({acceptedChildTypes:p,rendererRequirements:d}).map(D),t=Object.keys(T).map(e=>E(e,T[e]));return[...e,...t]}export function coreProductionInitialProperties(e){if(o(e))return i(e);let t=I(e);return n(T[t].defaults)}export function isCoreProductionBlockType(e){return f.includes(e)}export function createCoreProductionPatterns(){return[A(`article`,[j(`article`,`stack`,{},[j(`article-title`,`heading`,{text:`Article title`}),j(`article-body`,`richText`,{content:F(`Start writing…`)})])]),A(`collection-index`,[j(`collection-index`,`section`,{},[j(`collection-heading`,`heading`,{text:`Latest content`}),j(`collection`,`contentCollection`,{},void 0,{items:N(`studio.query/content`)})])]),A(`document-header`,[j(`document-header`,`columns`,{},[j(`document-logo`,`image`),j(`document-title`,`heading`,{text:`Document title`})])]),A(`faq`,[j(`faq`,`accordion`,{},[j(`faq-item`,`accordionItem`,{title:`Question`},[j(`faq-answer`,`richText`,{content:F(`Answer`)})])])]),A(`feature-grid`,[j(`features`,`grid`,{},[j(`feature-one`,`card`,{title:`Feature one`}),j(`feature-two`,`card`,{title:`Feature two`}),j(`feature-three`,`card`,{title:`Feature three`})])]),A(`hero`,[j(`hero`,`section`,{},[j(`hero-stack`,`stack`,{},[j(`hero-title`,`heading`,{text:`Build something meaningful`}),j(`hero-copy`,`richText`,{content:F(`A portable Studio page.`)}),j(`hero-action`,`callToAction`,{label:`Get started`})])])]),A(`media-gallery`,[j(`media-gallery`,`gallery`)]),A(`pricing`,[j(`pricing`,`card`,{title:`Plan`},[j(`price`,`money`,{amount:{amount:`0.00`,currency:`USD`}}),j(`price-action`,`callToAction`,{label:`Choose plan`})])]),A(`product`,[j(`product`,`columns`,{},[j(`product-media`,`gallery`),j(`product-copy`,`stack`,{},[j(`product-title`,`heading`,{text:`Product`}),j(`product-description`,`richText`,{content:F(`Product description`)}),j(`product-price`,`money`,{},void 0,{amount:P(`catalog/product-price`,`studio.resource/money`)})])])]),A(`tabbed-content`,[j(`tabbed-content`,`tabs`,{},[j(`tab-one`,`tab`,{title:`First`},[j(`tab-one-copy`,`richText`,{content:F(`First panel`)})]),j(`tab-two`,`tab`,{title:`Second`},[j(`tab-two-copy`,`richText`,{content:F(`Second panel`)})])])])]}function E(t,r){let i=CORE_PRODUCTION_BLOCK_TYPES[t];return{accessibility:{accessibleName:r.accessibility===`decorative`||r.accessibility===`structural`?`not-applicable`:`derived`,category:r.accessibility,keyboard:L(`block-keyboard`,`Use Studio controls to edit and reorder this block.`),outputChecks:[`studio.check/accessible-name`,`studio.check/reflow`],reducedMotion:[`audio`,`gallery`,`video`].includes(t)?`disable-motion`:`not-applicable`},category:`studio.category/${B(r.accessibility)}`,contractVersion:e,editingModes:[`blueprint`,`content`],icon:{kind:`symbol`,value:z(t)},kind:`block-definition`,label:L(`block-${z(t)}`,R(t)),owner:u,ports:n([...r.ports??[]]),propertyControls:[...Object.entries(r.controls??{}).map(([e,t])=>({control:t,property:e})),{control:CORE_PRODUCTION_CONTROL_IDS.presentation,property:`design`}],propertySchema:{additionalProperties:!1,properties:n({...r.properties??{},design:w}),...r.required===void 0?{}:{required:[...r.required]},type:`object`},rendererRequirements:n([...d]),revision:`production-${z(t)}-r1`,slots:(r.slots??[]).map(e=>({accepts:{types:n([...e.accepts])},id:e.id,label:L(`slot-${e.id}`,R(e.id)),maximum:e.maximum??100,minimum:e.minimum??0,ordered:!0})),themeControls:[],type:i,version:l}}function D(e){let t=e.propertySchema.properties;if(!k(t))throw TypeError(`${e.type} property schema must declare an object property map.`);return{...e,propertyControls:[...e.propertyControls??[],{control:CORE_PRODUCTION_CONTROL_IDS.presentation,property:`design`}],propertySchema:{...e.propertySchema,properties:n({...t,design:w})}}}function O(){let e=n(t);return delete e.$id,delete e.$schema,delete e.title,e}function k(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function A(t,n){let r=new Map(createCoreProductionBlockDefinitions().map(e=>[e.type,e])),i=new Set,a=e=>{i.add(e.type),Object.values(e.slots).flat().forEach(a)};return n.forEach(a),{blockDependencies:[...i].sort().map(e=>{let n=r.get(e);if(n===void 0)throw Error(`Pattern ${t} uses unknown block ${e}.`);return{revision:n.revision,type:e,version:n.version}}),contractVersion:e,id:`studio.pattern/${t}`,kind:`pattern`,label:L(`pattern-${t}`,R(t)),owner:u,revision:`production-pattern-${t}-r1`,roots:n,version:l}}function j(e,t,n={},r,i={}){let a=CORE_PRODUCTION_BLOCK_TYPES[t],s=t===`section`||t===`accordionItem`||t===`dialog`||t===`popover`||t===`tab`?`content`:t===`card`?`actions`:`items`,c={};for(let[e,t]of Object.entries(n))c[e]=M({kind:`static-value`,value:t});for(let[e,t]of Object.entries(i))c[e]=M(t);let u={authoring:{mode:o(a)||r!==void 0?`structural`:`content`},bindings:c,id:e,properties:coreProductionInitialProperties(a),slots:r===void 0?{}:{[s]:r},type:a,version:l};return t===`grid`&&(u.responsive={columns:{expanded:4,medium:2}}),u}function M(e){return{onError:`error`,onNull:`empty`,source:e,transforms:[]}}function N(e){return{kind:`query-reference`,parameters:{},query:e,version:l}}function P(e,t){return{id:e,kind:`resource-reference`,resourceType:t}}function F(e){return{content:[{content:[{text:e,type:`text`}],type:`paragraph`}],type:`doc`}}function I(e){let t=Object.entries(CORE_PRODUCTION_BLOCK_TYPES).find(([,t])=>t===e);if(t===void 0||o(e))throw TypeError(`Unsupported production block ${e}.`);return t[0]}function L(e,t){return{defaultMessage:t,key:`studio.blocks/${e}`}}function R(e){return e.replace(/([a-z])([A-Z])/gu,`$1 $2`).replaceAll(`-`,` `).replace(/^./u,e=>e.toUpperCase())}function z(e){return e.replace(/([a-z])([A-Z])/gu,`$1-$2`).toLowerCase()}function B(e){return e===`structural`||e===`landmark`?`layout`:e}
|
|
@@ -26,8 +26,8 @@ interface CompiledProgram {
|
|
|
26
26
|
/**
|
|
27
27
|
* A compiled (pre-walked, pre-resolved) profile schema. `validate` mirrors
|
|
28
28
|
* the verdict-plus-`errors` shape of the code-generating validator it
|
|
29
|
-
* replaces: `errors` is `null` after a passing run and carries the
|
|
30
|
-
* of the most recent failing run otherwise.
|
|
29
|
+
* replaces: `errors` is `null` after a passing run and carries the ordered,
|
|
30
|
+
* distinct failures of the most recent failing run otherwise.
|
|
31
31
|
*/
|
|
32
32
|
export declare class CompiledSchemaValidator {
|
|
33
33
|
#private;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile-validator.d.ts","sourceRoot":"","sources":["../src/profile-validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"profile-validator.d.ts","sourceRoot":"","sources":["../src/profile-validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AA6FzD,qEAAqE;AACrE,MAAM,WAAW,qBAAqB;IACpC,wEAAwE;IACxE,YAAY,EAAE,MAAM,CAAC;IACrB,sCAAsC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,wCAAwC;IACxC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,OAAO,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;CACjC;AAED,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC1C,KAAK,SAAS,GAAG,UAAU,GAAG,OAAO,CAAC;AAgBtC,UAAU,eAAe;IACvB,QAAQ,EAAE,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IACtC,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IAC3C,IAAI,EAAE,UAAU,CAAC;CAClB;AASD;;;;;GAKG;AACH,qBAAa,uBAAuB;;IAC3B,MAAM,EAAE,qBAAqB,EAAE,GAAG,IAAI,CAAQ;gBAGlC,OAAO,EAAE,eAAe;IAIpC,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO;CAkB5C;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,UAAU,EAClB,OAAO,GAAE,oBAAyB,GACjC,uBAAuB,CA6CzB"}
|