@cratis/event-models 0.347.0 → 0.348.1

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.
Files changed (30) hide show
  1. package/dist/Collections/reportedModuleFeatures.d.ts +6 -0
  2. package/dist/References/EventNavigateButton.d.ts +1 -0
  3. package/dist/Rows/UserExperience/UiCell.d.ts +2 -1
  4. package/dist/event-models.css +1 -1
  5. package/dist/index.js +1587 -1565
  6. package/dist/index.js.map +1 -1
  7. package/dist/screen-editor/DataBindingSections-BeQxUfQM.js +1919 -0
  8. package/dist/screen-editor/{QueryBindingPropertyEditor-BzDtdbGf.js → QueryBindingPropertyEditor-XQDHU9xb.js} +15 -15
  9. package/dist/screen-editor/ScreenEditor/DesignMode/DesignModeStrings.d.ts +1 -0
  10. package/dist/screen-editor/ScreenEditor/DesignMode/designModeFeedback.d.ts +10 -0
  11. package/dist/screen-editor/ScreenEditor/DesignMode/useDesignMode.d.ts +1 -0
  12. package/dist/screen-editor/ScreenEditor/Host/ScreenEditorController.d.ts +2 -0
  13. package/dist/screen-editor/ScreenEditor/Host/ScreenEditorHost.d.ts +1 -0
  14. package/dist/screen-editor/ScreenEditor/Host/openSubject.d.ts +1 -0
  15. package/dist/screen-editor/ScreenEditor/Host/useEditingScene.d.ts +1 -1
  16. package/dist/screen-editor/ScreenEditor/Inspector/ScreenEditorStrings.d.ts +2 -0
  17. package/dist/screen-editor/ScreenEditor/Inspector/ViewportControls.d.ts +2 -1
  18. package/dist/screen-editor/ScreenEditor/Play/PlayScreen.d.ts +2 -1
  19. package/dist/screen-editor/ScreenEditor/Play/composePlayScreen.d.ts +4 -2
  20. package/dist/screen-editor/ScreenEditor/ShellFrame/shellVisibility.d.ts +3 -2
  21. package/dist/screen-editor/ScreenEditor/ShellFrame/useShellFrame.d.ts +3 -1
  22. package/dist/screen-editor/ScreenEditor/Surface/dialogFrameAttributes.d.ts +6 -0
  23. package/dist/screen-editor/ScreenEditor/Templates/dialogActionsChrome.d.ts +3 -3
  24. package/dist/screen-editor/ScreenEditor/Templates/dialogPresentation.d.ts +13 -0
  25. package/dist/screen-editor/ScreenEditor/Templates/displayedFits.d.ts +6 -0
  26. package/dist/screen-editor/ScreenEditor/Thumbnail/ScreenThumbnail.d.ts +2 -1
  27. package/dist/screen-editor/index.js +3701 -3626
  28. package/dist/screen-editor/screen-editor.css +1 -1
  29. package/package.json +3 -3
  30. package/dist/screen-editor/DataBindingSections-DLo6sV-E.js +0 -1862
@@ -1,1862 +0,0 @@
1
- import { r as Ye, t as Je } from "./sceneTree-CNx3I3MJ.js";
2
- import { a as Ge, c as Xe, i as Ze, n as et, r as tt, t as nt } from "./hookBinding-DOpu2dMp.js";
3
- import { useMemo as M } from "react";
4
- import { Fragment as rt, jsx as T, jsxs as _ } from "react/jsx-runtime";
5
- import { EditingScopeKind as oe, FilterControl as se, HorizontalAlignment as ot, OutletItemKind as O, OutletKind as E, OutletMode as R, OutletSubject as st, PropertyEditorKind as K, PropertyValueType as F, QueryResultShape as Ce, SceneEditKind as it, ScreenFit as Oe, ValueSource as ce, VerticalAlignment as at, Visibility as lt, componentIcon as je, dialogActionsOutletName as $e } from "@cratis/scene.model";
6
- import { NavigationEditKind as Se, OutletDiagnosticCode as dt, OutletItemSource as we, OutletLevelKind as $, OutletRemoval as ct, addNavigationItem as ut, applicationNavigationLevel as mt, diagnoseNavigationOutlets as pt, dialogTemplateOutlets as ft, effectiveNavigation as ht, effectiveOutlet as gt, elementNodeId as vt, findComponentDescriptor as bt, isExternalComponent as yt, outletChainOf as Ot, outletItemsComponentName as Ee, ownOutletItems as St, switchOutletMode as wt } from "@cratis/scene.engine";
7
- import { itemEditableRule as Fe, itemInheritedReason as xe, navigationDesignMode as kt, toolbarDesignMode as It } from "@cratis/scene.react";
8
- var ue = {
9
- name: "StudioScreen",
10
- slots: [{ name: "content" }]
11
- }, P = "content", q = "Screen", Un = "template-root", zn = "screen-root", Me = () => ({
12
- layouts: [ue],
13
- screenTemplates: [],
14
- dialogTemplates: [],
15
- screens: [],
16
- exposures: [],
17
- instanceContributions: []
18
- });
19
- function Kn(e, t) {
20
- return {
21
- ...Me(),
22
- screens: [{
23
- name: q,
24
- layout: ue.name,
25
- slotContent: { [P]: [e] },
26
- forms: [],
27
- contributions: [],
28
- ...t ? { screenTemplate: t } : {}
29
- }]
30
- };
31
- }
32
- function Qn(e, t, n) {
33
- return {
34
- ...Me(),
35
- screenTemplates: [{
36
- name: e,
37
- slots: [{ name: P }],
38
- content: { [P]: [t] },
39
- ...n ? { fitsSlot: n } : {}
40
- }]
41
- };
42
- }
43
- function Yn(e, t) {
44
- return (t === void 0 ? e.screens.find((n) => n.name === q)?.slotContent : e.screenTemplates.find((n) => n.name === t)?.content)?.[P]?.[0];
45
- }
46
- function Jn(e, t = !1) {
47
- return t && e !== void 0 ? {
48
- kind: oe.ScreenTemplate,
49
- name: e,
50
- layout: ue.name
51
- } : {
52
- kind: oe.Screen,
53
- name: q
54
- };
55
- }
56
- var Tt = () => ({
57
- application: { outlets: [] },
58
- modules: []
59
- }), me = (e) => e.navigation ?? Tt(), Nt = (e, t) => ({
60
- ...e,
61
- navigation: t
62
- });
63
- function At(e, t, n) {
64
- return St(e, t, n).filter((r) => r.kind === O.Navigation);
65
- }
66
- var Re = (e, t) => e !== void 0 && t !== void 0 && e.kind === t.kind && e.name === t.name, pe = (e) => e.outletLevels ?? [];
67
- function Ct(e, t) {
68
- const { outletLevels: n, ...r } = e, o = t.filter((i) => (i.refinements ?? []).length > 0 || (i.contributions ?? []).length > 0 || (i.outlets ?? []).length > 0);
69
- return o.length === 0 ? r : {
70
- ...r,
71
- outletLevels: o
72
- };
73
- }
74
- function jt(e, t, n) {
75
- return t.kind === $.Module ? me(e).modules.find((r) => r.module === t.name)?.refinements?.find((r) => r.outlet === n) : pe(e).find((r) => r.kind === t.kind && r.name === t.name)?.refinements?.find((r) => r.outlet === n);
76
- }
77
- function $t(e, t, n, r) {
78
- const o = (s) => {
79
- const c = (s ?? []).filter((l) => l.outlet !== n);
80
- return r ? [...c, r] : c;
81
- };
82
- if (t.kind === $.Module) {
83
- const s = me(e), c = (s.modules.some((l) => l.module === t.name) ? s.modules : [...s.modules, { module: t.name }]).flatMap((l) => {
84
- if (l.module !== t.name) return [l];
85
- const { refinements: f, ...y } = l, h = o(l.refinements), g = h.length > 0 ? {
86
- ...y,
87
- refinements: h
88
- } : y;
89
- return g.refinements || g.contributions ? [g] : [];
90
- });
91
- return Nt(e, {
92
- ...s,
93
- modules: c
94
- });
95
- }
96
- const i = pe(e);
97
- return Ct(e, (i.some((s) => s.kind === t.kind && s.name === t.name) ? i : [...i, {
98
- kind: t.kind,
99
- name: t.name
100
- }]).map((s) => {
101
- if (s.kind !== t.kind || s.name !== t.name) return s;
102
- const { refinements: c, ...l } = s, f = o(s.refinements);
103
- return f.length > 0 ? {
104
- ...l,
105
- refinements: f
106
- } : l;
107
- }));
108
- }
109
- function Gn(e, t, n) {
110
- return {
111
- ...e,
112
- screenTemplates: e.screenTemplates.map((r) => {
113
- if (r.name !== t) return r;
114
- const { outlets: o, ...i } = r;
115
- return n.length > 0 ? {
116
- ...i,
117
- outlets: [...n]
118
- } : i;
119
- })
120
- };
121
- }
122
- function Xn(e) {
123
- return { types: e };
124
- }
125
- var Zn = ({ diagnostics: e, label: t }) => {
126
- if (e.length === 0) return null;
127
- const n = [...e].sort((r, o) => +(o.severity === "error") - +(r.severity === "error"));
128
- return /* @__PURE__ */ T("div", {
129
- className: "studio-editor-diagnostics__announce",
130
- role: "alert",
131
- "aria-label": t,
132
- children: /* @__PURE__ */ T("ul", {
133
- className: "studio-editor-diagnostics",
134
- children: n.map((r, o) => /* @__PURE__ */ _("li", {
135
- "data-severity": r.severity,
136
- "data-code": r.code,
137
- children: [
138
- r.severityLabel && /* @__PURE__ */ T("strong", {
139
- className: "studio-editor-diagnostics__severity",
140
- children: r.severityLabel
141
- }),
142
- /* @__PURE__ */ T("span", {
143
- className: "studio-editor-diagnostics__message",
144
- children: r.message
145
- }),
146
- r.where && /* @__PURE__ */ T("span", {
147
- className: "studio-editor-diagnostics__where",
148
- children: r.where
149
- }),
150
- r.jump && /* @__PURE__ */ T("button", {
151
- type: "button",
152
- className: "studio-editor-diagnostics__jump",
153
- onClick: r.jump.onJump,
154
- children: r.jump.label
155
- })
156
- ]
157
- }, `${r.code}:${r.path ?? ""}:${o}`))
158
- })
159
- });
160
- }, d = {
161
- addItem: "addItem",
162
- addButton: "addButton",
163
- rename: "rename",
164
- target: "target",
165
- slot: "slot",
166
- slice: "slice",
167
- emphasis: "emphasis",
168
- display: "display",
169
- addFilter: "addFilter",
170
- addTab: "addTab",
171
- addStat: "addStat",
172
- sets: "sets",
173
- control: "control",
174
- shows: "shows",
175
- valueFrom: "valueFrom",
176
- opens: "opens",
177
- enabled: "enabled",
178
- moveEarlier: "moveEarlier",
179
- moveLater: "moveLater",
180
- duplicate: "duplicate",
181
- delete: "delete",
182
- addSubItem: "addSubItem"
183
- }, Le = /* @__PURE__ */ (function(e) {
184
- return e.Elements = "elements", e.Collection = "collection", e.Region = "region", e.Outlet = "outlet", e;
185
- })({}), Et = (e) => "rejected" in e, x = (e, t, n) => ({
186
- id: e,
187
- icon: je(t),
188
- title: n,
189
- availability: Fe,
190
- readOnlyReason: xe
191
- }), Ft = [
192
- x(d.moveEarlier, "arrow-left", "Move earlier"),
193
- x(d.moveLater, "arrow-right", "Move later"),
194
- x(d.duplicate, "copy", "Duplicate"),
195
- x(d.delete, "trash", "Delete")
196
- ], ie = {
197
- [E.Actions]: {
198
- id: d.addButton,
199
- item: O.Button
200
- },
201
- [E.Filters]: {
202
- id: d.addFilter,
203
- item: O.Filter
204
- },
205
- [E.Tabs]: {
206
- id: d.addTab,
207
- item: O.Tab
208
- },
209
- [E.Stats]: {
210
- id: d.addStat,
211
- item: O.Stat
212
- },
213
- [E.Navigation]: {
214
- id: d.addItem,
215
- item: O.Navigation
216
- }
217
- }, ne = (e, t, n) => ({
218
- addActions: [{
219
- id: ie[e].id,
220
- label: t,
221
- icon: je("plus")
222
- }],
223
- itemToolbar: [
224
- x(d.rename, "pencil", "Rename"),
225
- ...n,
226
- ...Ft
227
- ]
228
- });
229
- function xt(e) {
230
- switch (e) {
231
- case E.Actions: {
232
- const t = It(), n = t.itemToolbar.findIndex((i) => i.id === d.emphasis), r = [x(d.opens, "panel-right-open", "Opens"), x(d.enabled, "toggle-right", "Enabled")], o = n < 0 ? [...t.itemToolbar, ...r] : [
233
- ...t.itemToolbar.slice(0, n),
234
- ...r,
235
- ...t.itemToolbar.slice(n)
236
- ];
237
- return {
238
- ...t,
239
- itemToolbar: o
240
- };
241
- }
242
- case E.Navigation:
243
- return kt({ sidebar: !0 });
244
- case E.Filters:
245
- return ne(e, "Add filter", [x(d.sets, "filter", "Sets"), x(d.control, "sliders-horizontal", "Control")]);
246
- case E.Tabs:
247
- return ne(e, "Add tab", [x(d.shows, "app-window", "Shows")]);
248
- case E.Stats:
249
- return ne(e, "Add stat", [x(d.valueFrom, "hash", "Value from")]);
250
- }
251
- }
252
- var Mt = {
253
- kinds: {
254
- actions: "actions",
255
- filters: "filters",
256
- tabs: "tabs",
257
- stats: "stats",
258
- navigation: "navigation"
259
- },
260
- newItem: {
261
- button: "New button",
262
- filter: "New filter",
263
- tab: "New tab",
264
- stat: "New stat",
265
- navigation: "New item",
266
- menuEntry: "New entry",
267
- separator: "Separator",
268
- group: "New group"
269
- },
270
- frameName: (e, t) => `outlet ${e} · ${t}`,
271
- tagLong: (e, t) => `${e} · ${t}`,
272
- title: (e, t) => `Outlet · ${e} ${t}`,
273
- declaredBy: (e) => `From ${e}.`,
274
- editingAs: "Editing as",
275
- levels: {
276
- module: "module",
277
- feature: "feature",
278
- slice: "slice",
279
- screen: "screen",
280
- template: "template",
281
- layout: "layout"
282
- },
283
- levelName: (e, t) => `${e} ${t}`,
284
- everyScreenBelow: (e) => `Every screen in ${e} gets this.`,
285
- modeTitle: "How this level takes the outlet",
286
- modes: {
287
- inherit: {
288
- title: "Inherit",
289
- description: (e) => `${e}'s items, unchanged.`
290
- },
291
- extend: {
292
- title: "Extend",
293
- description: (e) => `${e}'s items, then yours. Hide the ones you don't want.`
294
- },
295
- override: {
296
- title: "Override",
297
- description: (e) => `Only your items. ${e}'s stay listed, struck through, so you can bring one back.`
298
- }
299
- },
300
- copyPrompt: "Copy the inherited items, so you start from them?",
301
- copyYes: "Copy them",
302
- copyNo: "Start empty",
303
- extendsNotice: "This level now extends the inherited items",
304
- items: "Items",
305
- add: (e) => `Add ${e}`,
306
- own: "yours",
307
- fromLevel: (e) => `from ${e}`,
308
- contributedBy: (e) => `contributed by ${e}`,
309
- hiddenHere: "hidden here",
310
- overriddenHere: "overridden here",
311
- hide: "Hide",
312
- bringBack: "Bring back",
313
- contributionNote: "Contributed items belong to the feature that adds them; they always come after the inherited items.",
314
- nothingYet: "No items yet.",
315
- bindings: {
316
- title: "Title",
317
- sets: "Sets",
318
- control: "Control",
319
- controls: {
320
- search: "Search",
321
- choice: "Choice chips",
322
- range: "Range",
323
- date: "Date"
324
- },
325
- shows: "Shows",
326
- valueFrom: "Value from",
327
- trend: "Trend from",
328
- target: "Navigate to",
329
- slot: "Render into slot",
330
- icon: "Icon",
331
- opens: "Opens",
332
- opensChoices: {
333
- automatic: "Automatic",
334
- none: "Run directly",
335
- dialog: "Dialog",
336
- drawer: "Drawer",
337
- slot: "In a slot"
338
- },
339
- chooseParameter: "Choose parameter",
340
- chooseScreen: "Choose screen",
341
- chooseField: "Choose field",
342
- automatic: "Automatic",
343
- noQuery: "The screen shows no query yet, so there is nothing to bind to."
344
- },
345
- otherOutlets: "Other outlets on this screen",
346
- modeOf: {
347
- inherit: "inherits",
348
- extend: "extends",
349
- override: "overrides",
350
- declares: "declares"
351
- },
352
- added: (e) => `+${e}`,
353
- template: {
354
- slots: "Slots",
355
- outlets: "Outlets",
356
- name: "Name",
357
- kind: "Kind",
358
- subject: "Acts on",
359
- subjects: {
360
- "": "The screen",
361
- item: "The selected item",
362
- screen: "The screen"
363
- },
364
- slot: "In slot",
365
- noSlot: "No slot",
366
- defaults: "Defaults",
367
- defaultsCount: (e) => e === 1 ? "1 default" : `${e} defaults`,
368
- addOutlet: "Add outlet",
369
- removeOutlet: "Remove outlet",
370
- removeDefault: "Remove",
371
- newOutletName: "outlet",
372
- routed: "routed",
373
- primary: "primary",
374
- optional: "optional"
375
- }
376
- }, Rt = {
377
- toolbarLabel: (e) => `Actions for ${e}`,
378
- slotName: (e) => `slot: ${e}`,
379
- titleField: "Title",
380
- notLinked: "Not linked",
381
- chooseSlice: "Choose slice",
382
- mainArea: "Main area",
383
- emphasis: {
384
- primary: "Primary",
385
- secondary: "Secondary",
386
- quiet: "Quiet"
387
- },
388
- noSliceWarning: "No slice is linked to this button",
389
- readOnlyReasons: { "item.inherited": "Inherited from the template" },
390
- inheritedFrom: (e) => `Inherited from ${e}`,
391
- editAtOwner: "Edit at application level",
392
- choiceLabel: (e) => e,
393
- toolbar: {
394
- toolbarButton: "Button",
395
- opensAsDialog: "opens as dialog",
396
- dialogFromSlice: (e) => `Opens the slice's own dialog template, ${e}.`,
397
- dialogDefault: (e) => `The slice names no dialog template, so it opens the default ${e}.`,
398
- sliceHelp: "Only State Change slices can be picked. State Views and Automations never take user input, so they are listed as unavailable.",
399
- stateChangeHeading: "State Change slices",
400
- notInvokableHeading: "Not invokable from a button",
401
- upgrade: "Upgrade to the slice",
402
- upgradeNote: (e) => `This button names a command. The slice that accepts it is ${e}, and that is what it runs. `,
403
- shows: "Shows",
404
- showsHelp: "An icon-only button keeps its title as its accessible name and tooltip.",
405
- displays: {
406
- iconAndTitle: "Icon and title",
407
- icon: "Icon only",
408
- title: "Title only"
409
- }
410
- },
411
- navigation: {
412
- application: "Application",
413
- extendsNotice: "Region now extends the inherited items",
414
- overrideHere: "Override here",
415
- editAtApplication: "Edit at application level",
416
- backToModule: (e) => `Back to ${e}`,
417
- tagLong: (e, t) => `${e === "sidebar" ? "Sidebar" : "Topbar"} · ${t === "defined here" ? "defined here" : t === "inherited" ? "inherits the application" : t.endsWith(" only") ? "overrides the application" : "extends application"}`,
418
- regionName: {
419
- topbar: "topbar",
420
- sidebar: "sidebar"
421
- },
422
- inheritedFromApplication: "Inherited from Application",
423
- inheritedNote: (e) => `This item comes from the Application. Override this region to edit a copy in ${e}.`,
424
- definedIn: (e) => `defined in ${e}`,
425
- inheritedReadOnly: "inherited · read-only",
426
- navigationItem: "Navigation item",
427
- hierarchy: "Where it appears",
428
- label: "Label",
429
- navigateTo: "Navigate to",
430
- renderIntoSlot: "Render into slot",
431
- icon: "Icon",
432
- notLinked: "Not linked",
433
- mainArea: "Main area",
434
- sidePanel: "Side panel",
435
- modeTitle: (e, t) => `${e} · ${t}`,
436
- modeDescription: (e) => `How this module relates to the application-level ${e} items.`,
437
- modes: {
438
- inherit: {
439
- title: "Inherit",
440
- description: "Use the application items as they are. Removes items added in this module."
441
- },
442
- extend: {
443
- title: "Extend",
444
- description: "Application items first, then this module's own items."
445
- },
446
- override: {
447
- title: "Override",
448
- description: "Only this module's items. Switching copies the application items so you can edit them."
449
- }
450
- },
451
- copyPrompt: "Copy the application items so you can edit them?",
452
- copyYes: "Copy them",
453
- copyNo: "Start empty",
454
- logo: "Logo",
455
- logoTitle: "Name",
456
- logoImage: "Image",
457
- logoLocked: "The logo is defined at the application level only.",
458
- target: {
459
- heading: "Navigate to",
460
- application: "Application",
461
- module: "module",
462
- unresolved: (e) => `${e} no longer exists`
463
- },
464
- problems: {
465
- navTargetMissing: "This item leads nowhere yet.",
466
- navTargetOutOfScope: "A module can only link to itself.",
467
- navModuleWithoutFeatures: "That module has no feature to open.",
468
- navSlotUnknown: "The layout has no such slot.",
469
- navDuplicateId: "Another item uses this identity."
470
- }
471
- },
472
- close: "Close",
473
- outlets: Mt,
474
- announce: {
475
- added: (e) => `Added ${e}`,
476
- moved: (e, t, n) => `Moved ${e} to position ${t} of ${n}`,
477
- duplicated: (e) => `Duplicated ${e}`,
478
- removed: (e) => `Removed ${e}`,
479
- refused: (e) => `Not possible: ${e}`
480
- }
481
- }, Be = () => globalThis.crypto.randomUUID();
482
- function Lt({ document: e, screen: t, slices: n, queries: r, templates: o = [], layouts: i = [] }) {
483
- return {
484
- slices: n,
485
- slots: Xe(e, o, i, t),
486
- itemFields: new Set(r.filter((s) => s.resultShape === Ce.Collection).flatMap((s) => s.resultFields.map((c) => c.name))),
487
- routeParameters: []
488
- };
489
- }
490
- function Bt(e, t) {
491
- switch (e.availability) {
492
- case void 0:
493
- return !0;
494
- case Fe:
495
- return !t.readOnly;
496
- default:
497
- return !1;
498
- }
499
- }
500
- var Q = xe;
501
- function er(e, t) {
502
- if (!Bt(e, t)) return {
503
- visible: !1,
504
- enabled: !1
505
- };
506
- switch (e.id) {
507
- case d.moveEarlier:
508
- return {
509
- visible: !0,
510
- enabled: t.index > 0
511
- };
512
- case d.moveLater:
513
- return {
514
- visible: !0,
515
- enabled: t.index < t.count - 1
516
- };
517
- case d.addSubItem:
518
- return {
519
- visible: !0,
520
- enabled: t.parentId === void 0
521
- };
522
- default:
523
- return {
524
- visible: !0,
525
- enabled: !0
526
- };
527
- }
528
- }
529
- var fe = (e, t, n) => e.flatMap((r) => {
530
- if (r.id === t) {
531
- const o = n(r);
532
- return o ? [o] : [];
533
- }
534
- return [r.children ? {
535
- ...r,
536
- children: fe(r.children, t, n)
537
- } : r];
538
- }), Dt = (e) => Object.fromEntries(Object.entries(e).filter(([, t]) => t !== void 0)), J = (e, t, n) => fe(e, t, (r) => Dt({
539
- ...r,
540
- ...n
541
- })), _t = (e, t) => fe(e, t, () => {
542
- });
543
- function G(e, t) {
544
- for (const n of e) {
545
- if (n.id === t) return n;
546
- const r = n.children ? G(n.children, t) : void 0;
547
- if (r) return r;
548
- }
549
- }
550
- function Y(e, t) {
551
- if (e.some((n) => n.id === t)) return e;
552
- for (const n of e) {
553
- const r = n.children ? Y(n.children, t) : void 0;
554
- if (r) return r;
555
- }
556
- }
557
- function qt(e, t, n) {
558
- const r = Y(e, t);
559
- if (!r) return [...e];
560
- const o = r.findIndex((c) => c.id === t);
561
- if (o < 0 || n < 0 || n >= r.length || o === n) return [...e];
562
- const i = [...r], [s] = i.splice(o, 1);
563
- return i.splice(n, 0, s), r === e ? i : he(e, r, i);
564
- }
565
- function he(e, t, n) {
566
- return e.map((r) => r.children === t ? {
567
- ...r,
568
- children: n
569
- } : r.children ? {
570
- ...r,
571
- children: he(r.children, t, n)
572
- } : r);
573
- }
574
- var De = (e, t) => ({
575
- ...structuredClone(e),
576
- id: t(),
577
- ...e.children ? { children: e.children.map((n) => De(n, t)) } : {}
578
- });
579
- function Ht(e, t, n) {
580
- const r = G(e, t), o = Y(e, t);
581
- if (!r || !o) return { items: [...e] };
582
- const i = De(r, n), s = o.findIndex((l) => l.id === t) + 1, c = [
583
- ...o.slice(0, s),
584
- i,
585
- ...o.slice(s)
586
- ];
587
- return {
588
- items: o === e ? c : he(e, o, c),
589
- copy: i
590
- };
591
- }
592
- var Pt = (e) => e === R.Inherits ? "inherit" : e === R.Extends ? "extend" : e === R.Overrides ? "override" : void 0;
593
- function _e(e, t) {
594
- if (!t?.module) return;
595
- const n = e.modules.find((i) => i.id === t.module);
596
- if (!n) return t.module;
597
- if (!t.feature) return n.name;
598
- const r = [];
599
- let o = n.features;
600
- for (const i of t.feature.split(".")) {
601
- const s = o.find((c) => c.id === i);
602
- r.push(s?.name ?? i), o = s?.features ?? [];
603
- }
604
- return [n.name, ...r].join(" › ");
605
- }
606
- function tr(e) {
607
- const { region: t, module: n, navigation: r, structure: o, newId: i, slots: s, startingLabel: c, strings: l } = e, f = ht(o, r, n, t), y = At(r, n, t), h = pt(o, r, { slots: [...s] }), g = (k) => `${n ?? "application"}:${t}:${k}`, p = [], I = (k, v) => {
608
- const S = k.filter((u) => !u.readOnly);
609
- k.forEach((u) => {
610
- const C = G(y, u.id)?.target ?? (u.target ? {
611
- module: u.target.module,
612
- ...u.target.feature ? { feature: u.target.feature } : {}
613
- } : void 0), z = u.readOnly ? -1 : S.indexOf(u), ee = _e(o, C), V = h.filter((W) => W.entry === g(u.id)).map((W) => ({
614
- code: W.code,
615
- message: W.message
616
- }));
617
- p.push({
618
- id: u.id,
619
- label: u.title,
620
- index: z,
621
- count: S.length,
622
- ...v ? { parentId: v } : {},
623
- readOnly: u.readOnly,
624
- ...u.readOnly ? {
625
- readOnlyReason: Q,
626
- origin: l.application
627
- } : {},
628
- values: {
629
- target: C,
630
- slot: u.slot,
631
- icon: u.icon,
632
- children: u.children?.length
633
- },
634
- chips: {
635
- target: ee ?? "",
636
- slot: u.slot === "content" || u.slot === "" ? l.mainArea : u.slot
637
- },
638
- ...V.length > 0 ? { problems: V } : {},
639
- unlinked: C === void 0 && !(u.children && u.children.length > 0)
640
- }), u.children && I(u.children, u.id);
641
- });
642
- };
643
- I(f.items);
644
- const L = t, j = (k, v, S, u = {}) => v.rejected ? { rejected: v.rejected } : {
645
- label: k,
646
- edits: [],
647
- navigationEdits: v.edits,
648
- ...S ? { select: S } : {},
649
- ...u
650
- }, w = (k) => ({ edits: [{
651
- kind: Se.SetOutletItems,
652
- ...n !== void 0 ? { module: n } : {},
653
- outlet: t,
654
- items: k
655
- }] }), A = (k) => {
656
- const v = i(), S = ut(r, n, t, {
657
- kind: O.Navigation,
658
- id: v,
659
- title: c
660
- }, k), u = S.edits.some((C) => C.kind === Se.SetOutletMode);
661
- return j("Add", S, { itemId: v }, {
662
- renameNext: !0,
663
- ...u ? { notice: l.extendsNotice } : {}
664
- });
665
- };
666
- return {
667
- kind: Le.Region,
668
- items: p,
669
- regionTag: {
670
- text: f.sources.label,
671
- long: l.tagLong(t, f.sources.label),
672
- kind: f.sources.kind
673
- },
674
- region: {
675
- region: L,
676
- ...n !== void 0 ? { module: n } : {},
677
- ...f.mode ? { mode: Pt(f.mode) } : {}
678
- },
679
- add: (k) => k === d.addItem ? A() : { rejected: k },
680
- act: (k, v) => {
681
- switch (k) {
682
- case d.addSubItem:
683
- return v.parentId !== void 0 ? { rejected: "subItemOfSubItem" } : A(v.id);
684
- case d.moveEarlier:
685
- case d.moveLater: {
686
- const S = v.index + (k === d.moveEarlier ? -1 : 1), u = Y(y, v.id);
687
- return !u || S < 0 || S >= u.length ? { rejected: "noWhere" } : j("Move", w(qt(y, v.id, S)), { itemId: v.id });
688
- }
689
- case d.duplicate: {
690
- const S = Ht(y, v.id, i);
691
- return S.copy ? j("Duplicate", w(S.items), { itemId: S.copy.id }) : { rejected: k };
692
- }
693
- case d.delete: {
694
- const S = Y(y, v.id) ?? [], u = S.findIndex((z) => z.id === v.id), C = S[u + 1] ?? S[u - 1];
695
- return j("Remove", w(_t(y, v.id)), { itemId: C?.id ?? null });
696
- }
697
- default:
698
- return { rejected: k };
699
- }
700
- },
701
- rename: (k, v) => j("Rename", w(J(y, k.id, { title: v })), { itemId: k.id }),
702
- choice: (k, v) => {
703
- const S = G(y, v.id);
704
- if (S) {
705
- if (k === d.target) return {
706
- property: re("target", "Navigate to", "navigationItemTarget", S.target),
707
- plan: (u) => j("Link", w(J(y, v.id, { target: Vt(u) ? u : void 0 })), { itemId: v.id })
708
- };
709
- if (k === d.slot) return {
710
- property: re("slot", "Render into slot", "renderingSlot", S.slot ?? "content"),
711
- plan: (u) => j("Change", w(J(y, v.id, { slot: typeof u == "string" && u !== "content" ? u : void 0 })), { itemId: v.id })
712
- };
713
- if (k === "icon") return {
714
- property: re("icon", "Icon", "icon", S.icon),
715
- plan: (u) => j("Change", w(J(y, v.id, { icon: typeof u == "string" && u !== "" ? u : void 0 })), { itemId: v.id })
716
- };
717
- }
718
- },
719
- readOnlyActions: () => n === void 0 ? [] : [{
720
- id: "overrideHere",
721
- label: l.overrideHere,
722
- plan: () => j("Override", wt(r, n, t, R.Overrides, { copy: !0 }))
723
- }, {
724
- id: "editAtApplication",
725
- label: l.editAtApplication,
726
- plan: () => ({
727
- label: "Edit at application level",
728
- edits: [],
729
- editAtApplication: !0
730
- })
731
- }]
732
- };
733
- }
734
- var Vt = (e) => typeof e == "object" && e !== null && typeof e.module == "string";
735
- function re(e, t, n, r) {
736
- return {
737
- descriptor: {
738
- path: e,
739
- label: t,
740
- group: "Content",
741
- valueType: F.String,
742
- editorKind: n
743
- },
744
- currentValue: r,
745
- effectiveValue: r,
746
- source: ce.Local,
747
- editable: !0
748
- };
749
- }
750
- function Wt(e, t) {
751
- return {
752
- id: e,
753
- name: t,
754
- visibility: lt.Visible,
755
- isEnabled: !0,
756
- opacity: 1,
757
- size: {},
758
- zIndex: 0,
759
- minimumSize: {},
760
- maximumSize: {},
761
- margin: {
762
- left: 0,
763
- top: 0,
764
- right: 0,
765
- bottom: 0
766
- },
767
- horizontalAlignment: ot.Stretch,
768
- verticalAlignment: at.Stretch,
769
- properties: {}
770
- };
771
- }
772
- function Ut(e, t, n, r = {}, o = {}) {
773
- return {
774
- ...Wt(e, t),
775
- componentName: n,
776
- properties: r,
777
- slots: o
778
- };
779
- }
780
- var zt = "dialog-actions-chrome";
781
- function Kt(e) {
782
- const t = e.screens.find((n) => n.name === q)?.fits;
783
- return !t || t.length === 0 || t.includes(Oe.Dialog) || t.includes(Oe.Drawer);
784
- }
785
- function Qt(e) {
786
- const t = e.dialogTemplates ?? [];
787
- return t.find((n) => n.name === "FormDialog") ?? t[0] ?? {
788
- name: "FormDialog",
789
- slots: []
790
- };
791
- }
792
- function Yt(e, t = [], n = []) {
793
- if (!Kt(e)) return !1;
794
- const r = e.screens.find((s) => s.name === q), o = r?.screenTemplate ? [...e.screenTemplates, ...t].find((s) => s.name === r.screenTemplate) : void 0, i = r?.layout ? [...e.layouts, ...n].find((s) => s.name === r.layout) : void 0;
795
- return ![...o?.outlets ?? [], ...i?.outlets ?? []].some((s) => s.name === $e);
796
- }
797
- function nr(e, t) {
798
- if (t.length === 0) return e;
799
- const n = e.screens.map((r) => {
800
- if (r.name !== "Screen") return r;
801
- const o = r.slotContent?.[P]?.[0];
802
- return o ? {
803
- ...r,
804
- slotContent: {
805
- ...r.slotContent,
806
- [P]: [{
807
- ...o,
808
- children: [...o.children ?? [], ...t]
809
- }, ...r.slotContent[P].slice(1)]
810
- }
811
- } : r;
812
- });
813
- return {
814
- ...e,
815
- screens: n
816
- };
817
- }
818
- function rr() {
819
- return Ut(zt, "Dialog actions", Ee, {
820
- name: $e,
821
- kind: "actions",
822
- items: []
823
- });
824
- }
825
- function X(e, t) {
826
- const n = e;
827
- return {
828
- ...typeof n.slice == "string" && n.slice !== "" ? { slice: n.slice } : typeof n.command == "string" && n.command !== "" ? { slice: n.command } : {},
829
- ...n.opens ? { opens: n.opens } : {},
830
- ...typeof n.opensIn == "string" && n.opensIn !== "" ? { opensIn: n.opensIn } : {},
831
- subject: n.subject ?? t.outletSubject ?? st.Screen,
832
- ...typeof n.enabledWhen == "string" && n.enabledWhen !== "" ? { enabledWhen: n.enabledWhen } : {}
833
- };
834
- }
835
- var Jt = (e) => {
836
- switch (e) {
837
- case O.Button:
838
- case O.MenuEntry:
839
- return [
840
- d.slice,
841
- d.opens,
842
- d.enabled,
843
- d.emphasis,
844
- d.display
845
- ];
846
- case O.Filter:
847
- return [d.sets, d.control];
848
- case O.Tab:
849
- return [d.shows];
850
- case O.Stat:
851
- return [d.valueFrom];
852
- case O.Navigation:
853
- return [
854
- d.target,
855
- d.slot,
856
- "icon"
857
- ];
858
- default:
859
- return [];
860
- }
861
- }, ge = (e, t) => `${e}.${t}`, ke = (e) => {
862
- if (typeof e != "string") return;
863
- const t = e.lastIndexOf(".");
864
- return t > 0 && t < e.length - 1 ? {
865
- first: e.slice(0, t),
866
- second: e.slice(t + 1)
867
- } : void 0;
868
- }, D = (e, t, n, r, o, i, s) => ({
869
- descriptor: {
870
- path: e,
871
- label: t,
872
- group: "Behavior",
873
- valueType: n,
874
- editorKind: r,
875
- ...i ? { choices: [...i] } : {},
876
- ...s ? { editorOptions: s } : {}
877
- },
878
- currentValue: o,
879
- effectiveValue: o,
880
- source: ce.Local,
881
- editable: !0
882
- }), Gt = (e) => e.flatMap((t) => t.parameters.map((n) => ({
883
- value: ge(t.name, n.name),
884
- label: `${t.name} › ${n.name}`
885
- }))), Xt = (e) => e.filter((t) => t.resultShape !== Ce.Collection).flatMap((t) => t.resultFields.map((n) => ({
886
- value: ge(t.name, n.name),
887
- label: `${t.name} › ${n.name}`
888
- })));
889
- function Zt(e, t, n) {
890
- const r = t, o = n.strings, i = (s) => {
891
- const c = s;
892
- return c?.query ? ge(c.query, c.parameter ?? c.field ?? "") : void 0;
893
- };
894
- switch (e) {
895
- case d.sets:
896
- return D("sets", o.sets, F.Enum, K.Enum, i(r.sets), Gt(n.queries));
897
- case d.control:
898
- return D("control", o.control, F.Enum, K.Enum, r.control ?? se.Search, Object.values(se).map((s) => ({
899
- value: s,
900
- label: o.controls[s] ?? s
901
- })));
902
- case d.shows:
903
- return D("shows", o.shows, F.Enum, K.Enum, r.shows, n.screens.map((s) => ({
904
- value: s.id,
905
- label: s.label
906
- })));
907
- case d.valueFrom:
908
- return D("valueFrom", o.valueFrom, F.Enum, K.Enum, i(r.valueFrom), Xt(n.queries));
909
- case d.target:
910
- return D("target", o.target, F.String, "navigationItemTarget", r.target);
911
- case d.slot:
912
- return D("slot", o.slot, F.String, "renderingSlot", r.slot ?? "content");
913
- case "icon":
914
- return D("icon", o.icon, F.String, "icon", r.icon);
915
- case d.opens:
916
- return D("opens", n.placementStrings?.opens ?? o.opens, F.String, "hookOpens", {
917
- value: Ge(r.opens, r.opensIn),
918
- hook: X(t, n)
919
- });
920
- case d.enabled:
921
- return D("enabled", n.placementStrings?.enabled ?? "Enabled", F.String, "hookEnabled", {
922
- subject: r.subject,
923
- enabledWhen: r.enabledWhen,
924
- hook: X(t, n),
925
- ...n.outletSubject ? { outletSubject: n.outletSubject } : {}
926
- });
927
- case d.slice:
928
- case d.emphasis:
929
- case d.display: {
930
- const s = n.actionProperties.find((c) => c.path === e);
931
- return s ? {
932
- descriptor: s,
933
- currentValue: r[e],
934
- effectiveValue: r[e] ?? s.default,
935
- source: ce.Local,
936
- editable: !0
937
- } : e === d.slice ? D("slice", "Slice", F.String, K.Slice, r.slice) : void 0;
938
- }
939
- default:
940
- return;
941
- }
942
- }
943
- function en(e, t) {
944
- const n = t == null || t === "";
945
- switch (e) {
946
- case d.sets: {
947
- const r = ke(t);
948
- return n ? { sets: void 0 } : r ? { sets: {
949
- query: r.first,
950
- parameter: r.second
951
- } } : void 0;
952
- }
953
- case d.valueFrom: {
954
- const r = ke(t);
955
- return n ? { valueFrom: void 0 } : r ? { valueFrom: {
956
- query: r.first,
957
- field: r.second
958
- } } : void 0;
959
- }
960
- case d.control:
961
- return { control: n ? void 0 : t };
962
- case d.shows:
963
- return typeof t == "string" && t !== "" ? { shows: t } : void 0;
964
- case d.target:
965
- return { target: typeof t == "object" && t !== null && typeof t.module == "string" ? t : void 0 };
966
- case d.slot:
967
- return { slot: typeof t == "string" && t !== "content" && t !== "" ? t : void 0 };
968
- case d.opens:
969
- return tt(t);
970
- case d.enabled:
971
- return nt(t);
972
- case "icon":
973
- case d.slice:
974
- case d.emphasis:
975
- case d.display:
976
- return { [e]: n ? void 0 : t };
977
- default:
978
- return;
979
- }
980
- }
981
- function tn(e, t) {
982
- const n = e, r = t.strings, o = {}, i = n.sets, s = n.valueFrom;
983
- switch (e.kind) {
984
- case O.Filter:
985
- o[d.sets] = i?.query ? `${i.query} › ${i.parameter ?? ""}` : r.chooseParameter, o[d.control] = r.controls[String(n.control ?? se.Search)] ?? String(n.control);
986
- break;
987
- case O.Tab:
988
- o[d.shows] = typeof n.shows == "string" && n.shows !== "" ? t.screens.find((c) => c.id === n.shows)?.label ?? n.shows : r.chooseScreen;
989
- break;
990
- case O.Stat:
991
- o[d.valueFrom] = s?.query ? `${s.query} › ${s.field ?? ""}` : r.chooseField;
992
- break;
993
- case O.Navigation: {
994
- const c = n.target;
995
- o[d.target] = (t.structure ? _e(t.structure, c) : c?.module) ?? "";
996
- break;
997
- }
998
- case O.Button:
999
- case O.MenuEntry:
1000
- o[d.opens] = t.placement ? Ze(X(e, t), t.placement, t.placementStrings) : r.opensChoices[String(n.opens ?? "automatic")] ?? r.automatic, o[d.enabled] = et(X(e, t), t.outletSubject, t.placementStrings);
1001
- }
1002
- return o;
1003
- }
1004
- function nn(e) {
1005
- const t = e;
1006
- switch (e.kind) {
1007
- case O.Button:
1008
- case O.MenuEntry:
1009
- return !t.slice && !t.command && !t.navigateTo && !t.builtIn;
1010
- case O.Filter:
1011
- return !t.sets;
1012
- case O.Tab:
1013
- return !t.shows;
1014
- case O.Stat:
1015
- return !t.valueFrom;
1016
- case O.Navigation:
1017
- return !t.target && !(Array.isArray(t.children) && t.children.length > 0);
1018
- default:
1019
- return !1;
1020
- }
1021
- }
1022
- var U = (e) => {
1023
- const t = e;
1024
- if (Array.isArray(t.children)) return {
1025
- key: "children",
1026
- items: t.children
1027
- };
1028
- if (Array.isArray(t.items)) return {
1029
- key: "items",
1030
- items: t.items
1031
- };
1032
- }, rn = (e) => Object.fromEntries(Object.entries(e).filter(([, t]) => t !== void 0));
1033
- function Z(e, t, n) {
1034
- return e.flatMap((r) => {
1035
- if (r.id === t) {
1036
- const i = n(r);
1037
- return i ? [i] : [];
1038
- }
1039
- const o = U(r);
1040
- return [o ? {
1041
- ...r,
1042
- [o.key]: Z(o.items, t, n)
1043
- } : r];
1044
- });
1045
- }
1046
- function ve(e, t) {
1047
- for (const n of e) {
1048
- if (n.id === t) return n;
1049
- const r = U(n), o = r ? ve(r.items, t) : void 0;
1050
- if (o) return o;
1051
- }
1052
- }
1053
- function ae(e, t) {
1054
- if (e.some((n) => n.id === t)) return e;
1055
- for (const n of e) {
1056
- const r = U(n), o = r ? ae(r.items, t) : void 0;
1057
- if (o) return o;
1058
- }
1059
- }
1060
- var Ie = (e, t, n) => Z(e, t, (r) => rn({
1061
- ...r,
1062
- ...n
1063
- })), on = (e, t) => Z(e, t, () => {
1064
- });
1065
- function sn(e, t, n) {
1066
- const r = (o) => {
1067
- const i = o.findIndex((l) => l.id === t);
1068
- if (i < 0) return o.map((l) => {
1069
- const f = U(l);
1070
- return f ? {
1071
- ...l,
1072
- [f.key]: r(f.items)
1073
- } : l;
1074
- });
1075
- const s = [...o], [c] = s.splice(i, 1);
1076
- return s.splice(Math.max(0, Math.min(n, s.length)), 0, c), s;
1077
- };
1078
- return r(e);
1079
- }
1080
- function an(e, t, n) {
1081
- const r = ve(e, t);
1082
- if (!r) return { items: [...e] };
1083
- const o = (c) => {
1084
- const l = U(c), f = {
1085
- ...c,
1086
- id: n()
1087
- };
1088
- return l ? {
1089
- ...f,
1090
- [l.key]: l.items.map(o)
1091
- } : f;
1092
- }, i = o(r), s = (c) => c.flatMap((l) => {
1093
- if (l.id === t) return [l, i];
1094
- const f = U(l);
1095
- return [f ? {
1096
- ...l,
1097
- [f.key]: s(f.items)
1098
- } : l];
1099
- });
1100
- return {
1101
- items: s(e),
1102
- copy: i
1103
- };
1104
- }
1105
- var ln = (e, t, n) => Z(e, t, (r) => ({
1106
- ...r,
1107
- children: [...r.children ?? [], n]
1108
- })), Te = (e, t) => [...e, ...(t ?? []).filter((n) => !e.some((r) => r.name === n.name))];
1109
- function dn({ document: e, screen: t, path: n, templates: r, layouts: o, dialogTemplate: i }) {
1110
- const s = pe(e), c = s.find((p) => p.kind === $.Screen && p.name === t), l = e.screens.map((p) => p.name === t && !p.path && n && n.length > 0 ? {
1111
- ...p,
1112
- path: [...n]
1113
- } : p), { chain: f, contributors: y } = Ot({
1114
- layouts: Te(e.layouts, o),
1115
- screenTemplates: Te(e.screenTemplates, r),
1116
- screens: l,
1117
- navigation: me(e),
1118
- levels: s.filter((p) => p.kind !== $.Screen)
1119
- }, t), h = i ? cn(f, i) : f;
1120
- if (h.length === 0 || !c?.refinements) return {
1121
- chain: h,
1122
- contributors: y
1123
- };
1124
- const g = h[h.length - 1];
1125
- return {
1126
- chain: [...h.slice(0, -1), {
1127
- ...g,
1128
- refinements: [...g.refinements ?? [], ...c.refinements]
1129
- }],
1130
- contributors: y
1131
- };
1132
- }
1133
- function cn(e, t) {
1134
- const n = new Set(e.flatMap((s) => (s.outlets ?? []).map((c) => c.name))), r = ft(t).filter((s) => !n.has(s.name));
1135
- if (r.length === 0) return [...e];
1136
- const o = e.findIndex((s) => s.kind === $.Module || s.kind === $.Feature || s.kind === $.Slice || s.kind === $.Screen), i = o < 0 ? e.length : o;
1137
- return [
1138
- ...e.slice(0, i),
1139
- {
1140
- kind: $.Template,
1141
- name: t.name,
1142
- outlets: r
1143
- },
1144
- ...e.slice(i)
1145
- ];
1146
- }
1147
- var un = (e) => e.filter((t) => t.kind === $.Module || t.kind === $.Feature || t.kind === $.Slice || t.kind === $.Screen).map((t) => ({
1148
- kind: t.kind,
1149
- name: t.name
1150
- }));
1151
- function mn(e, t) {
1152
- if (!t) return e;
1153
- const n = pn(e.chain, (o) => Re(o, t));
1154
- if (n < 0 || n === e.chain.length - 1) return e;
1155
- const r = e.chain.slice(n + 1).filter((o) => (o.contributions ?? []).length > 0).map((o) => ({
1156
- kind: o.kind,
1157
- name: o.name,
1158
- contributions: o.contributions
1159
- }));
1160
- return {
1161
- chain: e.chain.slice(0, n + 1),
1162
- contributors: [...e.contributors, ...r]
1163
- };
1164
- }
1165
- function pn(e, t) {
1166
- for (let n = e.length - 1; n >= 0; n--) if (t(e[n])) return n;
1167
- return -1;
1168
- }
1169
- var fn = (e) => e.flatMap((t) => (t.outlets ?? []).map((n) => ({
1170
- outlet: n,
1171
- level: t
1172
- }))), hn = (e) => e === R.Overrides ? "override" : e === R.Extends ? "extend" : "inherit", gn = {
1173
- inherit: R.Inherits,
1174
- extend: R.Extends,
1175
- override: R.Overrides
1176
- }, Ne = (e) => {
1177
- const t = e.title;
1178
- return typeof t == "string" ? t : "";
1179
- }, vn = (e) => {
1180
- const t = e.children;
1181
- return Array.isArray(t) ? t : [];
1182
- };
1183
- function bn(e, t) {
1184
- return e.chain.some((n) => (n.outlets ?? []).some((r) => r.name === t));
1185
- }
1186
- function yn(e) {
1187
- const { document: t, outlet: n, level: r, newId: o, binding: i, strings: s } = e, c = mn(e.outlets, r);
1188
- if (!bn(c, n)) return;
1189
- const l = gt(c.chain, n, c.contributors), f = l.subject ? {
1190
- ...i,
1191
- outletSubject: l.subject
1192
- } : i;
1193
- if (l.diagnostics.some((a) => a.code === dt.UnknownOutlet) || !l.kind) return;
1194
- const y = l.kind, h = jt(t, r, n), g = h?.items ?? [], p = h?.hide ?? [], I = hn(l.mode), L = (a) => l.diagnostics.filter((m) => m.item === a).map((m) => ({
1195
- code: m.code,
1196
- message: m.message
1197
- })), j = [], w = g.map((a) => a.id), A = (a, m, b, N) => {
1198
- const B = b ? ae(g, a.id) ?? [] : [], H = L(a.id);
1199
- j.push({
1200
- id: a.id,
1201
- label: Ne(a),
1202
- index: b ? B.findIndex((te) => te.id === a.id) : -1,
1203
- count: b ? B.length : 0,
1204
- ...N ? { parentId: N } : {},
1205
- readOnly: !b,
1206
- ...b ? {} : {
1207
- readOnlyReason: Q,
1208
- origin: m.owner
1209
- },
1210
- values: {
1211
- ...a,
1212
- provenance: m
1213
- },
1214
- chips: tn(a, f),
1215
- ...H.length > 0 ? { problems: H } : {},
1216
- unlinked: nn(a),
1217
- provenance: m
1218
- }), vn(a).forEach((te) => A(te, m, b, a.id));
1219
- };
1220
- l.items.forEach((a) => {
1221
- const m = a.provenance.source === we.Own && a.editable && w.includes(a.item.id);
1222
- A(a.item, {
1223
- owner: a.provenance.owner,
1224
- level: a.provenance.level,
1225
- source: a.provenance.source
1226
- }, m);
1227
- });
1228
- const k = l.removed.map((a) => ({
1229
- id: a.item.id,
1230
- label: Ne(a.item),
1231
- index: -1,
1232
- count: 0,
1233
- readOnly: !0,
1234
- readOnlyReason: Q,
1235
- origin: a.provenance.owner,
1236
- values: { ...a.item },
1237
- unlinked: !1,
1238
- provenance: {
1239
- owner: a.provenance.owner,
1240
- level: a.provenance.level,
1241
- source: a.provenance.source
1242
- },
1243
- removal: a.removal === ct.Hidden ? "hidden" : "overridden"
1244
- })), v = (a) => {
1245
- const m = {
1246
- ...h ?? { outlet: n },
1247
- ...a,
1248
- outlet: n
1249
- };
1250
- return (!m.items || m.items.length === 0) && delete m.items, (!m.hide || m.hide.length === 0) && delete m.hide, m.mode === void 0 && delete m.mode, m.items || m.hide || m.mode !== void 0 ? m : void 0;
1251
- }, S = (a, m, b, N = {}) => ({
1252
- label: a,
1253
- edits: [],
1254
- documentChange: (B) => $t(B, r, n, m),
1255
- ...b ? { select: b } : {},
1256
- ...N
1257
- }), u = () => I === "inherit" ? { mode: R.Extends } : {}, C = (a, m, b, N = {}) => {
1258
- const B = I === "inherit" && m.length > g.length;
1259
- return S(a, v({
1260
- items: m,
1261
- ...u()
1262
- }), { itemId: b }, {
1263
- ...N,
1264
- ...B ? { notice: s.extendsNotice } : {}
1265
- });
1266
- }, z = () => {
1267
- const a = o(), m = ie[y].item, b = s.newItem[m] ?? s.newItem.button;
1268
- switch (m) {
1269
- case O.Tab: {
1270
- const N = i.screens[0];
1271
- return N ? {
1272
- kind: O.Tab,
1273
- id: a,
1274
- title: b,
1275
- shows: N.id
1276
- } : { rejected: "noScreenForTab" };
1277
- }
1278
- case O.Filter:
1279
- return {
1280
- kind: O.Filter,
1281
- id: a,
1282
- title: b
1283
- };
1284
- case O.Stat:
1285
- return {
1286
- kind: O.Stat,
1287
- id: a,
1288
- title: b
1289
- };
1290
- case O.Navigation:
1291
- return {
1292
- kind: O.Navigation,
1293
- id: a,
1294
- title: b
1295
- };
1296
- default:
1297
- return {
1298
- kind: O.Button,
1299
- id: a,
1300
- title: b
1301
- };
1302
- }
1303
- }, ee = (a) => "rejected" in a, V = (a) => a.readOnly ? void 0 : ve(g, a.id), W = xt(y), be = (a) => a.readOnly ? p.includes(a.id) ? { rejected: "alreadyHidden" } : S("Hide", v({
1304
- hide: [...p, a.id],
1305
- ...u()
1306
- }), { itemId: null }) : { rejected: "ownItem" }, ye = (a) => {
1307
- if (p.includes(a.id)) return S("Bring back", v({ hide: p.filter((m) => m !== a.id) }), { itemId: a.id });
1308
- if (a.removal === "overridden") {
1309
- const m = l.removed.find((b) => b.item.id === a.id)?.item;
1310
- return m ? S("Bring back", v({ items: [...g, structuredClone(m)] }), { itemId: a.id }) : { rejected: "notRemoved" };
1311
- }
1312
- return { rejected: "notRemoved" };
1313
- }, Ke = (a, m = !1) => {
1314
- if (a === I) return { rejected: "sameMode" };
1315
- if (a === "inherit") return S("Inherit", void 0, { itemId: null });
1316
- if (a === "extend") return S("Extend", v({ mode: R.Extends }));
1317
- const b = m ? l.items.filter((N) => N.provenance.source !== we.Contribution && !w.includes(N.item.id)).map((N) => structuredClone(N.item)) : [];
1318
- return S("Override", v({
1319
- mode: gn.override,
1320
- items: [...b, ...g],
1321
- hide: []
1322
- }));
1323
- }, Qe = (a) => a.removal ? [{
1324
- id: "bringBack",
1325
- label: s.bringBack,
1326
- plan: () => ye(a)
1327
- }] : a.parentId !== void 0 ? [] : [{
1328
- id: "hide",
1329
- label: s.hide,
1330
- plan: () => be(a)
1331
- }];
1332
- return {
1333
- kind: Le.Outlet,
1334
- items: j,
1335
- removed: k,
1336
- name: n,
1337
- ...l.subject ? { subject: l.subject } : {},
1338
- ...l.slot ? { slot: l.slot } : {},
1339
- ...l.declaredBy ? { declaredBy: l.declaredBy } : {},
1340
- outletKind: y,
1341
- level: r,
1342
- mode: I,
1343
- effective: l,
1344
- designMode: W,
1345
- regionTag: {
1346
- text: l.summary,
1347
- long: s.tagLong(n, l.summary),
1348
- kind: I
1349
- },
1350
- addItem: (a) => C("Add", [...g, a], a.id),
1351
- add: (a) => {
1352
- if (a !== ie[y].id) return { rejected: a };
1353
- const m = z();
1354
- return ee(m) ? m : C("Add", [...g, m], m.id, { renameNext: !0 });
1355
- },
1356
- act: (a, m) => {
1357
- if (!V(m)) return { rejected: m.readOnlyReason ?? Q };
1358
- switch (a) {
1359
- case d.moveEarlier:
1360
- case d.moveLater: {
1361
- const b = m.index + (a === d.moveEarlier ? -1 : 1);
1362
- return b < 0 || b >= m.count ? { rejected: "noWhere" } : C("Move", sn(g, m.id, b), m.id);
1363
- }
1364
- case d.duplicate: {
1365
- const b = an(g, m.id, o);
1366
- return b.copy ? C("Duplicate", b.items, b.copy.id) : { rejected: a };
1367
- }
1368
- case d.delete: {
1369
- const b = ae(g, m.id) ?? [], N = b.findIndex((H) => H.id === m.id), B = b[N + 1] ?? b[N - 1];
1370
- return C("Remove", on(g, m.id), B?.id ?? null);
1371
- }
1372
- case d.addSubItem: {
1373
- if (y !== E.Navigation || m.parentId !== void 0) return { rejected: "subItemOfSubItem" };
1374
- const b = {
1375
- kind: O.Navigation,
1376
- id: o(),
1377
- title: s.newItem.navigation
1378
- };
1379
- return C("Add", ln(g, m.id, b), b.id, { renameNext: !0 });
1380
- }
1381
- default:
1382
- return { rejected: a };
1383
- }
1384
- },
1385
- rename: (a, m) => V(a) ? C("Rename", Ie(g, a.id, { title: m }), a.id) : { rejected: a.readOnlyReason ?? Q },
1386
- choice: (a, m) => {
1387
- const b = V(m);
1388
- if (!b || !Jt(b.kind).includes(a)) return;
1389
- const N = Zt(a, b, f);
1390
- if (N)
1391
- return {
1392
- property: N,
1393
- plan: (B) => {
1394
- const H = en(a, B);
1395
- return H ? C("Bind", Ie(g, m.id, H), m.id) : { rejected: a };
1396
- }
1397
- };
1398
- },
1399
- readOnlyActions: Qe,
1400
- setMode: Ke,
1401
- hide: be,
1402
- bringBack: ye
1403
- };
1404
- }
1405
- function On(e, t) {
1406
- const n = /* @__PURE__ */ new Set(), r = (i) => {
1407
- if (Array.isArray(i)) {
1408
- i.forEach(r);
1409
- return;
1410
- }
1411
- if (typeof i != "object" || i === null) return;
1412
- const s = i;
1413
- typeof s.queryId == "string" && n.add(s.queryId), typeof s.queryId == "string" && typeof s.query == "string" && n.add(s.query), Object.values(s).forEach(r);
1414
- };
1415
- r(e.screens.find((i) => i.name === q));
1416
- const o = t.filter((i) => n.has(i.id) || n.has(i.name));
1417
- return o.length > 0 ? o : [...t];
1418
- }
1419
- function Sn(e) {
1420
- return bt(e, Ee)?.properties.find((t) => t.path === "items")?.item?.properties ?? [];
1421
- }
1422
- function wn(e) {
1423
- const { document: t, catalog: n, strings: r } = e, o = dn({
1424
- document: t,
1425
- screen: q,
1426
- ...e.path ? { path: e.path } : {},
1427
- ...e.templates ? { templates: e.templates } : {},
1428
- ...e.layouts ? { layouts: e.layouts } : {},
1429
- ...e.dialogTemplate ? { dialogTemplate: e.dialogTemplate } : {}
1430
- }), i = un(o.chain), s = i.find((h) => h.kind === $.Screen), c = i.find((h) => Re(h, e.requestedLevel)) ?? s, l = {
1431
- queries: On(t, e.queries),
1432
- screens: e.screens,
1433
- actionProperties: Sn(n),
1434
- ...e.slices ? { placement: Lt({
1435
- document: t,
1436
- screen: q,
1437
- slices: e.slices,
1438
- queries: e.queries,
1439
- ...e.templates ? { templates: e.templates } : {},
1440
- ...e.layouts ? { layouts: e.layouts } : {}
1441
- }) } : {},
1442
- ...e.structure ? { structure: e.structure } : {},
1443
- strings: r.bindings
1444
- }, f = fn(o.chain).map(({ outlet: h, level: g }) => ({
1445
- name: h.name,
1446
- kind: h.kind,
1447
- owner: g.name,
1448
- shell: g.kind === $.Layout && g.name === mt
1449
- })), y = e.newId ?? Be;
1450
- return {
1451
- outlets: o,
1452
- levels: i,
1453
- level: c,
1454
- declared: f,
1455
- binding: l,
1456
- design: (h) => c ? yn({
1457
- document: t,
1458
- outlets: o,
1459
- outlet: h,
1460
- level: c,
1461
- newId: y,
1462
- binding: l,
1463
- strings: r
1464
- }) : void 0
1465
- };
1466
- }
1467
- function kn(e, t, n) {
1468
- const { document: r, context: o, outletLevel: i, structure: s } = e, c = t.location?.path, l = M(() => [...t.ownTemplates ?? [], ...t.runtime.bundles.flatMap((p) => p.screenTemplates ?? [])], [t.ownTemplates, t.runtime.bundles]), f = M(() => t.runtime.bundles.flatMap((p) => p.layouts ?? []), [t.runtime.bundles]), y = M(() => t.destinations.map((p) => ({
1469
- id: p.id,
1470
- label: p.label
1471
- })), [t.destinations]), h = o.scope.kind === oe.Screen, g = M(() => h && Yt(r, l, f) ? Qt(r) : void 0, [
1472
- r,
1473
- h,
1474
- l,
1475
- f
1476
- ]);
1477
- return M(() => wn({
1478
- document: r,
1479
- catalog: o.catalog,
1480
- templates: l,
1481
- layouts: f,
1482
- ...g ? { dialogTemplate: g } : {},
1483
- queries: t.queryCandidates,
1484
- slices: t.stateChangeSlices,
1485
- screens: y,
1486
- strings: n,
1487
- ...c ? { path: c } : {},
1488
- ...i ? { requestedLevel: i } : {},
1489
- ...s.modules.length > 0 ? { structure: s } : {}
1490
- }), [
1491
- r,
1492
- o.catalog,
1493
- l,
1494
- f,
1495
- t.queryCandidates,
1496
- t.stateChangeSlices,
1497
- y,
1498
- n,
1499
- c,
1500
- i,
1501
- s,
1502
- g
1503
- ]);
1504
- }
1505
- function or(e) {
1506
- return {
1507
- queryId: e.id,
1508
- query: e.name,
1509
- arguments: [],
1510
- results: []
1511
- };
1512
- }
1513
- function In(e) {
1514
- const t = e;
1515
- return !!t && typeof t == "object" && typeof t.queryId == "string" && Array.isArray(t.arguments) && Array.isArray(t.results);
1516
- }
1517
- function Tn(e, t, n) {
1518
- const r = e.arguments.filter((o) => o.parameter !== t);
1519
- return {
1520
- ...e,
1521
- arguments: n.trim() === "" ? r : [...r, {
1522
- parameter: t,
1523
- source: { path: n.trim() }
1524
- }]
1525
- };
1526
- }
1527
- function sr(e, t, n = t) {
1528
- return e.results.some((r) => r.field === t) ? e : {
1529
- ...e,
1530
- results: [...e.results, {
1531
- target: n,
1532
- field: t
1533
- }]
1534
- };
1535
- }
1536
- function ir(e, t, n, r = t) {
1537
- const o = e.results.findIndex((f) => f.field === t), i = e.results.filter((f) => f.field !== t), s = o >= 0 ? e.results[o] : {
1538
- target: r,
1539
- field: t
1540
- }, c = n === void 0 ? o >= 0 ? o : i.length : o >= 0 && o < n ? n - 1 : n, l = Math.max(0, Math.min(i.length, c));
1541
- return {
1542
- ...e,
1543
- results: [
1544
- ...i.slice(0, l),
1545
- s,
1546
- ...i.slice(l)
1547
- ]
1548
- };
1549
- }
1550
- function ar(e, t) {
1551
- return {
1552
- ...e,
1553
- results: e.results.filter((n) => n.field !== t)
1554
- };
1555
- }
1556
- var Nn = (e, t) => e.arguments.find((n) => n.parameter === t.name)?.source.path ?? "", lr = (e, t) => e.results.some((n) => n.field === t.name), le = (e) => {
1557
- const t = e.values.sets;
1558
- return t !== null && typeof t == "object" && typeof t.query == "string" && typeof t.parameter == "string" ? t : void 0;
1559
- };
1560
- function An(e, t, n, r) {
1561
- return t.filter((o) => o.values.kind === O.Filter && le(o)?.query === n && le(o)?.parameter === r).map((o) => ({
1562
- outlet: e,
1563
- id: o.id,
1564
- title: o.label
1565
- }));
1566
- }
1567
- var dr = (e, t) => e.filter((n) => n.values.kind === O.Filter && le(n)?.query === t);
1568
- function Cn(e, t, n) {
1569
- return {
1570
- kind: O.Filter,
1571
- id: n,
1572
- title: t.charAt(0).toUpperCase() + t.slice(1),
1573
- sets: {
1574
- query: e,
1575
- parameter: t
1576
- }
1577
- };
1578
- }
1579
- var jn = (e, t, n) => {
1580
- const r = e.arguments.find((o) => o.parameter === t)?.source.path;
1581
- return n.find((o) => o.path === r);
1582
- }, $n = (e, t, n) => Tn(e, t, n?.path ?? ""), qe = /^show\s+(\S+)\s+by\s+(\S+)\s+from\s+(\S+?)\.selection\s*$/, En = (e) => `show ${e.screen} by ${e.by} from ${e.element}.selection`;
1583
- function Fn(e) {
1584
- const t = [...e].filter((n) => /[A-Za-z0-9_]/.test(n)).join("");
1585
- return t.length === 0 ? "Unnamed" : /^[0-9]/.test(t) ? `_${t}` : t;
1586
- }
1587
- var He = (e) => e.screens.find((t) => t.name === q);
1588
- function xn(e) {
1589
- const t = He(e)?.native?.slots ?? {};
1590
- return Object.entries(t).flatMap(([n, r]) => r.flatMap((o) => {
1591
- const i = qe.exec(o.text.trim());
1592
- return i ? [{
1593
- slot: n,
1594
- screen: i[1],
1595
- by: i[2],
1596
- element: i[3]
1597
- }] : [];
1598
- }));
1599
- }
1600
- function Ae(e, t, n) {
1601
- const r = He(e);
1602
- if (!r) return e;
1603
- const o = r.native ?? {}, i = (o.slots?.[t] ?? []).filter((I) => !qe.test(I.text.trim())), s = n ? [...i, {
1604
- at: (r.slotContent[t] ?? []).length,
1605
- text: En(n)
1606
- }] : i, c = {
1607
- ...o.slots ?? {},
1608
- [t]: s
1609
- };
1610
- s.length === 0 && delete c[t];
1611
- const { slots: l, ...f } = o, y = {
1612
- ...f,
1613
- ...Object.keys(c).length > 0 ? { slots: c } : {}
1614
- }, { native: h, ...g } = r, p = Object.keys(y).length > 0 ? {
1615
- ...g,
1616
- native: y
1617
- } : g;
1618
- return {
1619
- ...e,
1620
- screens: e.screens.map((I) => I === r ? p : I)
1621
- };
1622
- }
1623
- function Pe(e, t, n) {
1624
- const r = e.screens.find((o) => o.name === q);
1625
- return (r?.screenTemplate ? t.find((o) => o.name === r.screenTemplate)?.slots : n.find((o) => o.name === r?.layout)?.slots) ?? [];
1626
- }
1627
- var Mn = (e, t, n) => Pe(e, t, n).some((r) => r.routed === !0);
1628
- function Ve(e, t, n) {
1629
- return Pe(e, t, n).filter((r) => r.routed === !0 && (r.routedBy ?? []).length > 0).map((r) => ({
1630
- name: r.name,
1631
- routedBy: r.routedBy ?? []
1632
- }));
1633
- }
1634
- var Rn = [
1635
- "dataTable",
1636
- "table",
1637
- "observableDataTable"
1638
- ], We = "query", Ln = (e) => e.slice(e.lastIndexOf(":") + 1);
1639
- function de(e) {
1640
- if (!yt(e)) return;
1641
- const t = e, n = t.properties?.[We];
1642
- return Rn.includes(Ln(t.componentName)) && In(n) ? {
1643
- elementId: t.id,
1644
- binding: n
1645
- } : void 0;
1646
- }
1647
- function Bn(e) {
1648
- return e.flatMap((t) => [...de(t) ? [de(t)] : [], ...Bn(Je(t))]);
1649
- }
1650
- var cr = (e, t) => ({
1651
- kind: it.SetProperty,
1652
- nodeId: vt(e),
1653
- path: We,
1654
- value: t
1655
- }), Ue = (e, t) => [
1656
- ...t.screenTemplates,
1657
- ...e.ownTemplates ?? [],
1658
- ...e.runtime.bundles.flatMap((n) => n.screenTemplates ?? [])
1659
- ], ze = (e, t) => [...t.layouts, ...e.runtime.bundles.flatMap((n) => n.layouts ?? [])], ur = ({ controller: e, environment: t, strings: n, binding: r, candidate: o, disabled: i, onChange: s }) => {
1660
- const c = n.properties.dataBinding, l = n.designMode ?? Rt, f = kn(e, t, l.outlets), y = M(() => Ue(t, e.document), [t, e.document]), h = M(() => ze(t, e.document), [t, e.document]), g = M(() => Ve(e.document, y, h), [
1661
- e.document,
1662
- y,
1663
- h
1664
- ]), p = g.flatMap((w) => w.routedBy.map((A) => ({
1665
- slot: w.name,
1666
- parameter: A,
1667
- path: `route.${A}`
1668
- }))), I = f.declared.filter((w) => w.kind === E.Filters && !w.shell);
1669
- if (o.parameters.length === 0) return null;
1670
- const L = I.flatMap((w) => (f.design(w.name)?.items ?? []).map((A) => ({
1671
- outlet: w.name,
1672
- item: {
1673
- id: A.id,
1674
- label: A.label,
1675
- values: A.values
1676
- }
1677
- }))), j = (w) => {
1678
- const A = I[0] && f.design(I[0].name);
1679
- if (!A) return;
1680
- const k = A.addItem(Cn(o.name, w, Be()));
1681
- !Et(k) && k.documentChange && e.changeDocument(k.documentChange, k.label);
1682
- };
1683
- return /* @__PURE__ */ _("div", {
1684
- className: "studio-editor-query__group",
1685
- "data-parameter-feeds": o.name,
1686
- children: [
1687
- /* @__PURE__ */ T("strong", { children: c.feedsTitle }),
1688
- /* @__PURE__ */ T("ul", {
1689
- className: "studio-editor-query__feeds",
1690
- children: o.parameters.map((w) => {
1691
- const A = L.flatMap((u) => An(u.outlet, [u.item], o.name, w.name)), k = g.filter((u) => u.routedBy.includes(w.name)), v = Nn(r, w), S = A.length > 0 || k.length > 0 || v !== "";
1692
- return /* @__PURE__ */ _("li", {
1693
- "data-fed": S,
1694
- children: [
1695
- /* @__PURE__ */ T("span", { children: w.name }),
1696
- A.map((u) => /* @__PURE__ */ T("span", {
1697
- className: "studio-editor-properties__chip",
1698
- "data-feed": "filter",
1699
- children: c.fedByFilter(u.title)
1700
- }, u.id)),
1701
- k.map((u) => /* @__PURE__ */ T("span", {
1702
- className: "studio-editor-properties__chip",
1703
- "data-feed": "route",
1704
- children: c.fedByRoute(w.name, u.name)
1705
- }, u.name)),
1706
- v !== "" && /* @__PURE__ */ T("span", {
1707
- className: "studio-editor-properties__chip",
1708
- "data-feed": "mapping",
1709
- children: c.fedByMapping(v)
1710
- }),
1711
- !S && /* @__PURE__ */ T("span", {
1712
- className: "studio-editor-properties__chip",
1713
- "data-feed": "none",
1714
- children: c.fedByNothing
1715
- }),
1716
- !S && I.length > 0 && /* @__PURE__ */ T("button", {
1717
- type: "button",
1718
- onClick: () => j(w.name),
1719
- children: c.addFilter
1720
- }),
1721
- s && p.length > 0 && /* @__PURE__ */ _("select", {
1722
- "aria-label": c.routeSource(w.name),
1723
- "data-route-source": w.name,
1724
- disabled: i,
1725
- value: jn(r, w.name, p)?.path ?? "",
1726
- onChange: (u) => s($n(r, w.name, p.find((C) => C.path === u.target.value)), w, u.target.value),
1727
- children: [/* @__PURE__ */ T("option", {
1728
- value: "",
1729
- children: c.routeSourceNone
1730
- }), p.map((u) => /* @__PURE__ */ T("option", {
1731
- value: u.path,
1732
- children: c.routeSourceOption(u.parameter, u.slot)
1733
- }, `${u.slot}.${u.parameter}`))]
1734
- })
1735
- ]
1736
- }, w.name);
1737
- })
1738
- }),
1739
- L.length > 0 && Mn(e.document, y, h) && /* @__PURE__ */ T("p", {
1740
- className: "studio-editor-properties__hint",
1741
- children: c.filtersInAddress
1742
- })
1743
- ]
1744
- });
1745
- }, mr = ({ controller: e, environment: t, strings: n, elementId: r, disabled: o }) => {
1746
- const i = n.properties.dataBinding, s = M(() => Ue(t, e.document), [t, e.document]), c = M(() => ze(t, e.document), [t, e.document]), l = M(() => Ve(e.document, s, c), [
1747
- e.document,
1748
- s,
1749
- c
1750
- ]), f = Ye(e.composition.roots, r);
1751
- if (!(f && de(f))) return null;
1752
- const y = Fn(r), h = xn(e.document).filter((p) => p.element === y)[0], g = (p, I, L) => e.changeDocument((j) => {
1753
- const w = h && h.slot !== p ? Ae(j, h.slot, void 0) : j;
1754
- return Ae(w, p, I === "" ? void 0 : {
1755
- screen: I,
1756
- by: L,
1757
- element: y
1758
- });
1759
- }, i.selectionTitle);
1760
- return /* @__PURE__ */ _("fieldset", {
1761
- className: "studio-editor-query",
1762
- disabled: o,
1763
- "data-selection-detail": r,
1764
- children: [
1765
- /* @__PURE__ */ T("legend", { children: i.selectionTitle }),
1766
- l.length === 0 && /* @__PURE__ */ T("p", {
1767
- className: "studio-editor-properties__hint",
1768
- children: i.selectionNoSlot
1769
- }),
1770
- l.length > 0 && /* @__PURE__ */ _(rt, { children: [
1771
- /* @__PURE__ */ T("p", {
1772
- className: "studio-editor-properties__hint",
1773
- children: i.selectionHint
1774
- }),
1775
- /* @__PURE__ */ _("label", { children: [/* @__PURE__ */ T("span", { children: i.selectionSlot }), /* @__PURE__ */ T("select", {
1776
- value: h?.slot ?? l[0].name,
1777
- onChange: (p) => h && g(p.target.value, h.screen, l.find((I) => I.name === p.target.value)?.routedBy[0] ?? h.by),
1778
- children: l.map((p) => /* @__PURE__ */ _("option", {
1779
- value: p.name,
1780
- children: [
1781
- p.name,
1782
- " (",
1783
- p.routedBy.join(", "),
1784
- ")"
1785
- ]
1786
- }, p.name))
1787
- })] }),
1788
- /* @__PURE__ */ _("label", { children: [/* @__PURE__ */ T("span", { children: i.selectionScreen }), /* @__PURE__ */ _("select", {
1789
- value: h?.screen ?? "",
1790
- onChange: (p) => {
1791
- const I = l.find((L) => L.name === (h?.slot ?? l[0].name)) ?? l[0];
1792
- g(I.name, p.target.value, I.routedBy[0]);
1793
- },
1794
- children: [/* @__PURE__ */ T("option", {
1795
- value: "",
1796
- children: i.selectionNone
1797
- }), t.destinations.map((p) => /* @__PURE__ */ T("option", {
1798
- value: p.label,
1799
- children: p.label
1800
- }, p.id))]
1801
- })] }),
1802
- h && /* @__PURE__ */ T("p", {
1803
- className: "studio-editor-query__preview",
1804
- role: "status",
1805
- children: i.selectionSummary(h.screen, h.slot, h.by)
1806
- })
1807
- ] })
1808
- ]
1809
- });
1810
- };
1811
- export {
1812
- ie as A,
1813
- me as B,
1814
- Wt as C,
1815
- Lt as D,
1816
- Q as E,
1817
- Xn as F,
1818
- Qn as G,
1819
- Yn as H,
1820
- pe as I,
1821
- zn as J,
1822
- Jn as K,
1823
- Ct as L,
1824
- d as M,
1825
- Et as N,
1826
- Be as O,
1827
- Zn as P,
1828
- $t as R,
1829
- Ut as S,
1830
- er as T,
1831
- P as U,
1832
- Nt as V,
1833
- Kn as W,
1834
- Un as X,
1835
- ue as Y,
1836
- mn as _,
1837
- Bn as a,
1838
- nr as b,
1839
- or as c,
1840
- sr as d,
1841
- Tn as f,
1842
- kn as g,
1843
- ar as h,
1844
- de as i,
1845
- Le as j,
1846
- Rt as k,
1847
- lr as l,
1848
- Nn as m,
1849
- mr as n,
1850
- Rn as o,
1851
- ir as p,
1852
- q,
1853
- cr as r,
1854
- dr as s,
1855
- ur as t,
1856
- In as u,
1857
- Jt as v,
1858
- tr as w,
1859
- Yt as x,
1860
- rr as y,
1861
- Gn as z
1862
- };