@cratis/event-models 0.346.0 → 0.348.0

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 (52) hide show
  1. package/dist/References/EventNavigateButton.d.ts +1 -0
  2. package/dist/Rows/UserExperience/UiCell.d.ts +2 -1
  3. package/dist/event-models.css +1 -1
  4. package/dist/index.js +805 -791
  5. package/dist/index.js.map +1 -1
  6. package/dist/screen-editor/BindingExpressionPropertyEditor-BDzuLWUA.js +471 -0
  7. package/dist/screen-editor/DataBindingSections-BeQxUfQM.js +1919 -0
  8. package/dist/screen-editor/{QueryBindingPropertyEditor-BofsQo32.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/designModeAnnouncements.d.ts +9 -0
  11. package/dist/screen-editor/ScreenEditor/DesignMode/designModeFeedback.d.ts +10 -0
  12. package/dist/screen-editor/ScreenEditor/DesignMode/designModeSelection.d.ts +9 -0
  13. package/dist/screen-editor/ScreenEditor/DesignMode/useDesignMode.d.ts +1 -0
  14. package/dist/screen-editor/ScreenEditor/Host/ScreenEditorController.d.ts +2 -0
  15. package/dist/screen-editor/ScreenEditor/Host/ScreenEditorHost.d.ts +1 -0
  16. package/dist/screen-editor/ScreenEditor/Host/openSubject.d.ts +1 -0
  17. package/dist/screen-editor/ScreenEditor/Host/useDocumentSetters.d.ts +15 -0
  18. package/dist/screen-editor/ScreenEditor/Host/useEditApplication.d.ts +15 -0
  19. package/dist/screen-editor/ScreenEditor/Host/useEditingScene.d.ts +12 -0
  20. package/dist/screen-editor/ScreenEditor/Host/useNavigationEditing.d.ts +17 -0
  21. package/dist/screen-editor/ScreenEditor/Host/useStructureOperations.d.ts +39 -0
  22. package/dist/screen-editor/ScreenEditor/Inspector/ActionProperties.d.ts +14 -0
  23. package/dist/screen-editor/ScreenEditor/Inspector/CommandFormProperties.d.ts +12 -0
  24. package/dist/screen-editor/ScreenEditor/Inspector/ComponentProperties.d.ts +17 -0
  25. package/dist/screen-editor/ScreenEditor/Inspector/ExternalComponentSections.d.ts +14 -0
  26. package/dist/screen-editor/ScreenEditor/Inspector/PropertiesPanel.d.ts +1 -1
  27. package/dist/screen-editor/ScreenEditor/Inspector/PropertyGroups.d.ts +20 -0
  28. package/dist/screen-editor/ScreenEditor/Inspector/ScreenEditorStrings.d.ts +2 -0
  29. package/dist/screen-editor/ScreenEditor/Inspector/ScreenProperties.d.ts +10 -0
  30. package/dist/screen-editor/ScreenEditor/Inspector/ViewportControls.d.ts +2 -1
  31. package/dist/screen-editor/ScreenEditor/Inspector/bindingExpressionEdits.d.ts +26 -0
  32. package/dist/screen-editor/ScreenEditor/Play/PlayScreen.d.ts +2 -1
  33. package/dist/screen-editor/ScreenEditor/Play/composePlayScreen.d.ts +4 -2
  34. package/dist/screen-editor/ScreenEditor/ShellFrame/shellVisibility.d.ts +3 -2
  35. package/dist/screen-editor/ScreenEditor/ShellFrame/useShellFrame.d.ts +3 -1
  36. package/dist/screen-editor/ScreenEditor/Surface/ScreenSurface.d.ts +1 -1
  37. package/dist/screen-editor/ScreenEditor/Surface/SelectionGrip.d.ts +10 -0
  38. package/dist/screen-editor/ScreenEditor/Surface/dialogFrameAttributes.d.ts +6 -0
  39. package/dist/screen-editor/ScreenEditor/Surface/surfaceText.d.ts +4 -0
  40. package/dist/screen-editor/ScreenEditor/Surface/useDrawnScreen.d.ts +7 -0
  41. package/dist/screen-editor/ScreenEditor/Surface/useSurfaceKeys.d.ts +5 -0
  42. package/dist/screen-editor/ScreenEditor/Surface/useSurfaceMeasurer.d.ts +3 -0
  43. package/dist/screen-editor/ScreenEditor/Surface/useSurfaceViewportHeight.d.ts +2 -0
  44. package/dist/screen-editor/ScreenEditor/Templates/dialogActionsChrome.d.ts +3 -3
  45. package/dist/screen-editor/ScreenEditor/Templates/dialogPresentation.d.ts +13 -0
  46. package/dist/screen-editor/ScreenEditor/Templates/displayedFits.d.ts +6 -0
  47. package/dist/screen-editor/ScreenEditor/Thumbnail/ScreenThumbnail.d.ts +2 -1
  48. package/dist/screen-editor/index.js +6451 -6246
  49. package/dist/screen-editor/screen-editor.css +1 -1
  50. package/package.json +3 -3
  51. package/dist/screen-editor/BindingExpressionPropertyEditor-D63oFTJg.js +0 -455
  52. package/dist/screen-editor/DataBindingSections-wybsadzf.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
- }, Le = () => globalThis.crypto.randomUUID(), Et = {
161
- kinds: {
162
- actions: "actions",
163
- filters: "filters",
164
- tabs: "tabs",
165
- stats: "stats",
166
- navigation: "navigation"
167
- },
168
- newItem: {
169
- button: "New button",
170
- filter: "New filter",
171
- tab: "New tab",
172
- stat: "New stat",
173
- navigation: "New item",
174
- menuEntry: "New entry",
175
- separator: "Separator",
176
- group: "New group"
177
- },
178
- frameName: (e, t) => `outlet ${e} · ${t}`,
179
- tagLong: (e, t) => `${e} · ${t}`,
180
- title: (e, t) => `Outlet · ${e} ${t}`,
181
- declaredBy: (e) => `From ${e}.`,
182
- editingAs: "Editing as",
183
- levels: {
184
- module: "module",
185
- feature: "feature",
186
- slice: "slice",
187
- screen: "screen",
188
- template: "template",
189
- layout: "layout"
190
- },
191
- levelName: (e, t) => `${e} ${t}`,
192
- everyScreenBelow: (e) => `Every screen in ${e} gets this.`,
193
- modeTitle: "How this level takes the outlet",
194
- modes: {
195
- inherit: {
196
- title: "Inherit",
197
- description: (e) => `${e}'s items, unchanged.`
198
- },
199
- extend: {
200
- title: "Extend",
201
- description: (e) => `${e}'s items, then yours. Hide the ones you don't want.`
202
- },
203
- override: {
204
- title: "Override",
205
- description: (e) => `Only your items. ${e}'s stay listed, struck through, so you can bring one back.`
206
- }
207
- },
208
- copyPrompt: "Copy the inherited items, so you start from them?",
209
- copyYes: "Copy them",
210
- copyNo: "Start empty",
211
- extendsNotice: "This level now extends the inherited items",
212
- items: "Items",
213
- add: (e) => `Add ${e}`,
214
- own: "yours",
215
- fromLevel: (e) => `from ${e}`,
216
- contributedBy: (e) => `contributed by ${e}`,
217
- hiddenHere: "hidden here",
218
- overriddenHere: "overridden here",
219
- hide: "Hide",
220
- bringBack: "Bring back",
221
- contributionNote: "Contributed items belong to the feature that adds them; they always come after the inherited items.",
222
- nothingYet: "No items yet.",
223
- bindings: {
224
- title: "Title",
225
- sets: "Sets",
226
- control: "Control",
227
- controls: {
228
- search: "Search",
229
- choice: "Choice chips",
230
- range: "Range",
231
- date: "Date"
232
- },
233
- shows: "Shows",
234
- valueFrom: "Value from",
235
- trend: "Trend from",
236
- target: "Navigate to",
237
- slot: "Render into slot",
238
- icon: "Icon",
239
- opens: "Opens",
240
- opensChoices: {
241
- automatic: "Automatic",
242
- none: "Run directly",
243
- dialog: "Dialog",
244
- drawer: "Drawer",
245
- slot: "In a slot"
246
- },
247
- chooseParameter: "Choose parameter",
248
- chooseScreen: "Choose screen",
249
- chooseField: "Choose field",
250
- automatic: "Automatic",
251
- noQuery: "The screen shows no query yet, so there is nothing to bind to."
252
- },
253
- otherOutlets: "Other outlets on this screen",
254
- modeOf: {
255
- inherit: "inherits",
256
- extend: "extends",
257
- override: "overrides",
258
- declares: "declares"
259
- },
260
- added: (e) => `+${e}`,
261
- template: {
262
- slots: "Slots",
263
- outlets: "Outlets",
264
- name: "Name",
265
- kind: "Kind",
266
- subject: "Acts on",
267
- subjects: {
268
- "": "The screen",
269
- item: "The selected item",
270
- screen: "The screen"
271
- },
272
- slot: "In slot",
273
- noSlot: "No slot",
274
- defaults: "Defaults",
275
- defaultsCount: (e) => e === 1 ? "1 default" : `${e} defaults`,
276
- addOutlet: "Add outlet",
277
- removeOutlet: "Remove outlet",
278
- removeDefault: "Remove",
279
- newOutletName: "outlet",
280
- routed: "routed",
281
- primary: "primary",
282
- optional: "optional"
283
- }
284
- }, Ft = {
285
- toolbarLabel: (e) => `Actions for ${e}`,
286
- slotName: (e) => `slot: ${e}`,
287
- titleField: "Title",
288
- notLinked: "Not linked",
289
- chooseSlice: "Choose slice",
290
- mainArea: "Main area",
291
- emphasis: {
292
- primary: "Primary",
293
- secondary: "Secondary",
294
- quiet: "Quiet"
295
- },
296
- noSliceWarning: "No slice is linked to this button",
297
- readOnlyReasons: { "item.inherited": "Inherited from the template" },
298
- inheritedFrom: (e) => `Inherited from ${e}`,
299
- editAtOwner: "Edit at application level",
300
- choiceLabel: (e) => e,
301
- toolbar: {
302
- toolbarButton: "Button",
303
- opensAsDialog: "opens as dialog",
304
- dialogFromSlice: (e) => `Opens the slice's own dialog template, ${e}.`,
305
- dialogDefault: (e) => `The slice names no dialog template, so it opens the default ${e}.`,
306
- sliceHelp: "Only State Change slices can be picked. State Views and Automations never take user input, so they are listed as unavailable.",
307
- stateChangeHeading: "State Change slices",
308
- notInvokableHeading: "Not invokable from a button",
309
- upgrade: "Upgrade to the slice",
310
- upgradeNote: (e) => `This button names a command. The slice that accepts it is ${e}, and that is what it runs. `,
311
- shows: "Shows",
312
- showsHelp: "An icon-only button keeps its title as its accessible name and tooltip.",
313
- displays: {
314
- iconAndTitle: "Icon and title",
315
- icon: "Icon only",
316
- title: "Title only"
317
- }
318
- },
319
- navigation: {
320
- application: "Application",
321
- extendsNotice: "Region now extends the inherited items",
322
- overrideHere: "Override here",
323
- editAtApplication: "Edit at application level",
324
- backToModule: (e) => `Back to ${e}`,
325
- 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"}`,
326
- regionName: {
327
- topbar: "topbar",
328
- sidebar: "sidebar"
329
- },
330
- inheritedFromApplication: "Inherited from Application",
331
- inheritedNote: (e) => `This item comes from the Application. Override this region to edit a copy in ${e}.`,
332
- definedIn: (e) => `defined in ${e}`,
333
- inheritedReadOnly: "inherited · read-only",
334
- navigationItem: "Navigation item",
335
- hierarchy: "Where it appears",
336
- label: "Label",
337
- navigateTo: "Navigate to",
338
- renderIntoSlot: "Render into slot",
339
- icon: "Icon",
340
- notLinked: "Not linked",
341
- mainArea: "Main area",
342
- sidePanel: "Side panel",
343
- modeTitle: (e, t) => `${e} · ${t}`,
344
- modeDescription: (e) => `How this module relates to the application-level ${e} items.`,
345
- modes: {
346
- inherit: {
347
- title: "Inherit",
348
- description: "Use the application items as they are. Removes items added in this module."
349
- },
350
- extend: {
351
- title: "Extend",
352
- description: "Application items first, then this module's own items."
353
- },
354
- override: {
355
- title: "Override",
356
- description: "Only this module's items. Switching copies the application items so you can edit them."
357
- }
358
- },
359
- copyPrompt: "Copy the application items so you can edit them?",
360
- copyYes: "Copy them",
361
- copyNo: "Start empty",
362
- logo: "Logo",
363
- logoTitle: "Name",
364
- logoImage: "Image",
365
- logoLocked: "The logo is defined at the application level only.",
366
- target: {
367
- heading: "Navigate to",
368
- application: "Application",
369
- module: "module",
370
- unresolved: (e) => `${e} no longer exists`
371
- },
372
- problems: {
373
- navTargetMissing: "This item leads nowhere yet.",
374
- navTargetOutOfScope: "A module can only link to itself.",
375
- navModuleWithoutFeatures: "That module has no feature to open.",
376
- navSlotUnknown: "The layout has no such slot.",
377
- navDuplicateId: "Another item uses this identity."
378
- }
379
- },
380
- close: "Close",
381
- outlets: Et,
382
- announce: {
383
- added: (e) => `Added ${e}`,
384
- moved: (e, t, n) => `Moved ${e} to position ${t} of ${n}`,
385
- duplicated: (e) => `Duplicated ${e}`,
386
- removed: (e) => `Removed ${e}`,
387
- refused: (e) => `Not possible: ${e}`
388
- }
389
- }, d = {
390
- addItem: "addItem",
391
- addButton: "addButton",
392
- rename: "rename",
393
- target: "target",
394
- slot: "slot",
395
- slice: "slice",
396
- emphasis: "emphasis",
397
- display: "display",
398
- addFilter: "addFilter",
399
- addTab: "addTab",
400
- addStat: "addStat",
401
- sets: "sets",
402
- control: "control",
403
- shows: "shows",
404
- valueFrom: "valueFrom",
405
- opens: "opens",
406
- enabled: "enabled",
407
- moveEarlier: "moveEarlier",
408
- moveLater: "moveLater",
409
- duplicate: "duplicate",
410
- delete: "delete",
411
- addSubItem: "addSubItem"
412
- }, Be = /* @__PURE__ */ (function(e) {
413
- return e.Elements = "elements", e.Collection = "collection", e.Region = "region", e.Outlet = "outlet", e;
414
- })({}), xt = (e) => "rejected" in e;
415
- function Mt(e, t) {
416
- return {
417
- id: e,
418
- name: t,
419
- visibility: lt.Visible,
420
- isEnabled: !0,
421
- opacity: 1,
422
- size: {},
423
- zIndex: 0,
424
- minimumSize: {},
425
- maximumSize: {},
426
- margin: {
427
- left: 0,
428
- top: 0,
429
- right: 0,
430
- bottom: 0
431
- },
432
- horizontalAlignment: ot.Stretch,
433
- verticalAlignment: at.Stretch,
434
- properties: {}
435
- };
436
- }
437
- function Rt(e, t, n, r = {}, o = {}) {
438
- return {
439
- ...Mt(e, t),
440
- componentName: n,
441
- properties: r,
442
- slots: o
443
- };
444
- }
445
- var Lt = "dialog-actions-chrome";
446
- function Bt(e) {
447
- const t = e.screens.find((n) => n.name === q)?.fits;
448
- return !t || t.length === 0 || t.includes(Oe.Dialog) || t.includes(Oe.Drawer);
449
- }
450
- function Dt(e) {
451
- const t = e.dialogTemplates ?? [];
452
- return t.find((n) => n.name === "FormDialog") ?? t[0] ?? {
453
- name: "FormDialog",
454
- slots: []
455
- };
456
- }
457
- function _t(e, t = [], n = []) {
458
- if (!Bt(e)) return !1;
459
- 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;
460
- return ![...o?.outlets ?? [], ...i?.outlets ?? []].some((s) => s.name === $e);
461
- }
462
- function er(e, t) {
463
- if (t.length === 0) return e;
464
- const n = e.screens.map((r) => {
465
- if (r.name !== "Screen") return r;
466
- const o = r.slotContent?.[P]?.[0];
467
- return o ? {
468
- ...r,
469
- slotContent: {
470
- ...r.slotContent,
471
- [P]: [{
472
- ...o,
473
- children: [...o.children ?? [], ...t]
474
- }, ...r.slotContent[P].slice(1)]
475
- }
476
- } : r;
477
- });
478
- return {
479
- ...e,
480
- screens: n
481
- };
482
- }
483
- function tr() {
484
- return Rt(Lt, "Dialog actions", Ee, {
485
- name: $e,
486
- kind: "actions",
487
- items: []
488
- });
489
- }
490
- function qt({ document: e, screen: t, slices: n, queries: r, templates: o = [], layouts: i = [] }) {
491
- return {
492
- slices: n,
493
- slots: Xe(e, o, i, t),
494
- itemFields: new Set(r.filter((s) => s.resultShape === Ce.Collection).flatMap((s) => s.resultFields.map((c) => c.name))),
495
- routeParameters: []
496
- };
497
- }
498
- function Ht(e, t) {
499
- switch (e.availability) {
500
- case void 0:
501
- return !0;
502
- case Fe:
503
- return !t.readOnly;
504
- default:
505
- return !1;
506
- }
507
- }
508
- var Q = xe;
509
- function nr(e, t) {
510
- if (!Ht(e, t)) return {
511
- visible: !1,
512
- enabled: !1
513
- };
514
- switch (e.id) {
515
- case d.moveEarlier:
516
- return {
517
- visible: !0,
518
- enabled: t.index > 0
519
- };
520
- case d.moveLater:
521
- return {
522
- visible: !0,
523
- enabled: t.index < t.count - 1
524
- };
525
- case d.addSubItem:
526
- return {
527
- visible: !0,
528
- enabled: t.parentId === void 0
529
- };
530
- default:
531
- return {
532
- visible: !0,
533
- enabled: !0
534
- };
535
- }
536
- }
537
- var fe = (e, t, n) => e.flatMap((r) => {
538
- if (r.id === t) {
539
- const o = n(r);
540
- return o ? [o] : [];
541
- }
542
- return [r.children ? {
543
- ...r,
544
- children: fe(r.children, t, n)
545
- } : r];
546
- }), Pt = (e) => Object.fromEntries(Object.entries(e).filter(([, t]) => t !== void 0)), J = (e, t, n) => fe(e, t, (r) => Pt({
547
- ...r,
548
- ...n
549
- })), Vt = (e, t) => fe(e, t, () => {
550
- });
551
- function G(e, t) {
552
- for (const n of e) {
553
- if (n.id === t) return n;
554
- const r = n.children ? G(n.children, t) : void 0;
555
- if (r) return r;
556
- }
557
- }
558
- function Y(e, t) {
559
- if (e.some((n) => n.id === t)) return e;
560
- for (const n of e) {
561
- const r = n.children ? Y(n.children, t) : void 0;
562
- if (r) return r;
563
- }
564
- }
565
- function Wt(e, t, n) {
566
- const r = Y(e, t);
567
- if (!r) return [...e];
568
- const o = r.findIndex((c) => c.id === t);
569
- if (o < 0 || n < 0 || n >= r.length || o === n) return [...e];
570
- const i = [...r], [s] = i.splice(o, 1);
571
- return i.splice(n, 0, s), r === e ? i : he(e, r, i);
572
- }
573
- function he(e, t, n) {
574
- return e.map((r) => r.children === t ? {
575
- ...r,
576
- children: n
577
- } : r.children ? {
578
- ...r,
579
- children: he(r.children, t, n)
580
- } : r);
581
- }
582
- var De = (e, t) => ({
583
- ...structuredClone(e),
584
- id: t(),
585
- ...e.children ? { children: e.children.map((n) => De(n, t)) } : {}
586
- });
587
- function Ut(e, t, n) {
588
- const r = G(e, t), o = Y(e, t);
589
- if (!r || !o) return { items: [...e] };
590
- const i = De(r, n), s = o.findIndex((l) => l.id === t) + 1, c = [
591
- ...o.slice(0, s),
592
- i,
593
- ...o.slice(s)
594
- ];
595
- return {
596
- items: o === e ? c : he(e, o, c),
597
- copy: i
598
- };
599
- }
600
- var zt = (e) => e === R.Inherits ? "inherit" : e === R.Extends ? "extend" : e === R.Overrides ? "override" : void 0;
601
- function _e(e, t) {
602
- if (!t?.module) return;
603
- const n = e.modules.find((i) => i.id === t.module);
604
- if (!n) return t.module;
605
- if (!t.feature) return n.name;
606
- const r = [];
607
- let o = n.features;
608
- for (const i of t.feature.split(".")) {
609
- const s = o.find((c) => c.id === i);
610
- r.push(s?.name ?? i), o = s?.features ?? [];
611
- }
612
- return [n.name, ...r].join(" › ");
613
- }
614
- function rr(e) {
615
- 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) => {
616
- const S = k.filter((u) => !u.readOnly);
617
- k.forEach((u) => {
618
- const C = G(y, u.id)?.target ?? (u.target ? {
619
- module: u.target.module,
620
- ...u.target.feature ? { feature: u.target.feature } : {}
621
- } : void 0), z = u.readOnly ? -1 : S.indexOf(u), ee = _e(o, C), V = h.filter((W) => W.entry === g(u.id)).map((W) => ({
622
- code: W.code,
623
- message: W.message
624
- }));
625
- p.push({
626
- id: u.id,
627
- label: u.title,
628
- index: z,
629
- count: S.length,
630
- ...v ? { parentId: v } : {},
631
- readOnly: u.readOnly,
632
- ...u.readOnly ? {
633
- readOnlyReason: Q,
634
- origin: l.application
635
- } : {},
636
- values: {
637
- target: C,
638
- slot: u.slot,
639
- icon: u.icon,
640
- children: u.children?.length
641
- },
642
- chips: {
643
- target: ee ?? "",
644
- slot: u.slot === "content" || u.slot === "" ? l.mainArea : u.slot
645
- },
646
- ...V.length > 0 ? { problems: V } : {},
647
- unlinked: C === void 0 && !(u.children && u.children.length > 0)
648
- }), u.children && I(u.children, u.id);
649
- });
650
- };
651
- I(f.items);
652
- const L = t, j = (k, v, S, u = {}) => v.rejected ? { rejected: v.rejected } : {
653
- label: k,
654
- edits: [],
655
- navigationEdits: v.edits,
656
- ...S ? { select: S } : {},
657
- ...u
658
- }, w = (k) => ({ edits: [{
659
- kind: Se.SetOutletItems,
660
- ...n !== void 0 ? { module: n } : {},
661
- outlet: t,
662
- items: k
663
- }] }), A = (k) => {
664
- const v = i(), S = ut(r, n, t, {
665
- kind: O.Navigation,
666
- id: v,
667
- title: c
668
- }, k), u = S.edits.some((C) => C.kind === Se.SetOutletMode);
669
- return j("Add", S, { itemId: v }, {
670
- renameNext: !0,
671
- ...u ? { notice: l.extendsNotice } : {}
672
- });
673
- };
674
- return {
675
- kind: Be.Region,
676
- items: p,
677
- regionTag: {
678
- text: f.sources.label,
679
- long: l.tagLong(t, f.sources.label),
680
- kind: f.sources.kind
681
- },
682
- region: {
683
- region: L,
684
- ...n !== void 0 ? { module: n } : {},
685
- ...f.mode ? { mode: zt(f.mode) } : {}
686
- },
687
- add: (k) => k === d.addItem ? A() : { rejected: k },
688
- act: (k, v) => {
689
- switch (k) {
690
- case d.addSubItem:
691
- return v.parentId !== void 0 ? { rejected: "subItemOfSubItem" } : A(v.id);
692
- case d.moveEarlier:
693
- case d.moveLater: {
694
- const S = v.index + (k === d.moveEarlier ? -1 : 1), u = Y(y, v.id);
695
- return !u || S < 0 || S >= u.length ? { rejected: "noWhere" } : j("Move", w(Wt(y, v.id, S)), { itemId: v.id });
696
- }
697
- case d.duplicate: {
698
- const S = Ut(y, v.id, i);
699
- return S.copy ? j("Duplicate", w(S.items), { itemId: S.copy.id }) : { rejected: k };
700
- }
701
- case d.delete: {
702
- const S = Y(y, v.id) ?? [], u = S.findIndex((z) => z.id === v.id), C = S[u + 1] ?? S[u - 1];
703
- return j("Remove", w(Vt(y, v.id)), { itemId: C?.id ?? null });
704
- }
705
- default:
706
- return { rejected: k };
707
- }
708
- },
709
- rename: (k, v) => j("Rename", w(J(y, k.id, { title: v })), { itemId: k.id }),
710
- choice: (k, v) => {
711
- const S = G(y, v.id);
712
- if (S) {
713
- if (k === d.target) return {
714
- property: ne("target", "Navigate to", "navigationItemTarget", S.target),
715
- plan: (u) => j("Link", w(J(y, v.id, { target: Kt(u) ? u : void 0 })), { itemId: v.id })
716
- };
717
- if (k === d.slot) return {
718
- property: ne("slot", "Render into slot", "renderingSlot", S.slot ?? "content"),
719
- plan: (u) => j("Change", w(J(y, v.id, { slot: typeof u == "string" && u !== "content" ? u : void 0 })), { itemId: v.id })
720
- };
721
- if (k === "icon") return {
722
- property: ne("icon", "Icon", "icon", S.icon),
723
- plan: (u) => j("Change", w(J(y, v.id, { icon: typeof u == "string" && u !== "" ? u : void 0 })), { itemId: v.id })
724
- };
725
- }
726
- },
727
- readOnlyActions: () => n === void 0 ? [] : [{
728
- id: "overrideHere",
729
- label: l.overrideHere,
730
- plan: () => j("Override", wt(r, n, t, R.Overrides, { copy: !0 }))
731
- }, {
732
- id: "editAtApplication",
733
- label: l.editAtApplication,
734
- plan: () => ({
735
- label: "Edit at application level",
736
- edits: [],
737
- editAtApplication: !0
738
- })
739
- }]
740
- };
741
- }
742
- var Kt = (e) => typeof e == "object" && e !== null && typeof e.module == "string";
743
- function ne(e, t, n, r) {
744
- return {
745
- descriptor: {
746
- path: e,
747
- label: t,
748
- group: "Content",
749
- valueType: F.String,
750
- editorKind: n
751
- },
752
- currentValue: r,
753
- effectiveValue: r,
754
- source: ce.Local,
755
- editable: !0
756
- };
757
- }
758
- function X(e, t) {
759
- const n = e;
760
- return {
761
- ...typeof n.slice == "string" && n.slice !== "" ? { slice: n.slice } : typeof n.command == "string" && n.command !== "" ? { slice: n.command } : {},
762
- ...n.opens ? { opens: n.opens } : {},
763
- ...typeof n.opensIn == "string" && n.opensIn !== "" ? { opensIn: n.opensIn } : {},
764
- subject: n.subject ?? t.outletSubject ?? st.Screen,
765
- ...typeof n.enabledWhen == "string" && n.enabledWhen !== "" ? { enabledWhen: n.enabledWhen } : {}
766
- };
767
- }
768
- var Qt = (e) => {
769
- switch (e) {
770
- case O.Button:
771
- case O.MenuEntry:
772
- return [
773
- d.slice,
774
- d.opens,
775
- d.enabled,
776
- d.emphasis,
777
- d.display
778
- ];
779
- case O.Filter:
780
- return [d.sets, d.control];
781
- case O.Tab:
782
- return [d.shows];
783
- case O.Stat:
784
- return [d.valueFrom];
785
- case O.Navigation:
786
- return [
787
- d.target,
788
- d.slot,
789
- "icon"
790
- ];
791
- default:
792
- return [];
793
- }
794
- }, ge = (e, t) => `${e}.${t}`, ke = (e) => {
795
- if (typeof e != "string") return;
796
- const t = e.lastIndexOf(".");
797
- return t > 0 && t < e.length - 1 ? {
798
- first: e.slice(0, t),
799
- second: e.slice(t + 1)
800
- } : void 0;
801
- }, D = (e, t, n, r, o, i, s) => ({
802
- descriptor: {
803
- path: e,
804
- label: t,
805
- group: "Behavior",
806
- valueType: n,
807
- editorKind: r,
808
- ...i ? { choices: [...i] } : {},
809
- ...s ? { editorOptions: s } : {}
810
- },
811
- currentValue: o,
812
- effectiveValue: o,
813
- source: ce.Local,
814
- editable: !0
815
- }), Yt = (e) => e.flatMap((t) => t.parameters.map((n) => ({
816
- value: ge(t.name, n.name),
817
- label: `${t.name} › ${n.name}`
818
- }))), Jt = (e) => e.filter((t) => t.resultShape !== Ce.Collection).flatMap((t) => t.resultFields.map((n) => ({
819
- value: ge(t.name, n.name),
820
- label: `${t.name} › ${n.name}`
821
- })));
822
- function Gt(e, t, n) {
823
- const r = t, o = n.strings, i = (s) => {
824
- const c = s;
825
- return c?.query ? ge(c.query, c.parameter ?? c.field ?? "") : void 0;
826
- };
827
- switch (e) {
828
- case d.sets:
829
- return D("sets", o.sets, F.Enum, K.Enum, i(r.sets), Yt(n.queries));
830
- case d.control:
831
- return D("control", o.control, F.Enum, K.Enum, r.control ?? se.Search, Object.values(se).map((s) => ({
832
- value: s,
833
- label: o.controls[s] ?? s
834
- })));
835
- case d.shows:
836
- return D("shows", o.shows, F.Enum, K.Enum, r.shows, n.screens.map((s) => ({
837
- value: s.id,
838
- label: s.label
839
- })));
840
- case d.valueFrom:
841
- return D("valueFrom", o.valueFrom, F.Enum, K.Enum, i(r.valueFrom), Jt(n.queries));
842
- case d.target:
843
- return D("target", o.target, F.String, "navigationItemTarget", r.target);
844
- case d.slot:
845
- return D("slot", o.slot, F.String, "renderingSlot", r.slot ?? "content");
846
- case "icon":
847
- return D("icon", o.icon, F.String, "icon", r.icon);
848
- case d.opens:
849
- return D("opens", n.placementStrings?.opens ?? o.opens, F.String, "hookOpens", {
850
- value: Ge(r.opens, r.opensIn),
851
- hook: X(t, n)
852
- });
853
- case d.enabled:
854
- return D("enabled", n.placementStrings?.enabled ?? "Enabled", F.String, "hookEnabled", {
855
- subject: r.subject,
856
- enabledWhen: r.enabledWhen,
857
- hook: X(t, n),
858
- ...n.outletSubject ? { outletSubject: n.outletSubject } : {}
859
- });
860
- case d.slice:
861
- case d.emphasis:
862
- case d.display: {
863
- const s = n.actionProperties.find((c) => c.path === e);
864
- return s ? {
865
- descriptor: s,
866
- currentValue: r[e],
867
- effectiveValue: r[e] ?? s.default,
868
- source: ce.Local,
869
- editable: !0
870
- } : e === d.slice ? D("slice", "Slice", F.String, K.Slice, r.slice) : void 0;
871
- }
872
- default:
873
- return;
874
- }
875
- }
876
- function Xt(e, t) {
877
- const n = t == null || t === "";
878
- switch (e) {
879
- case d.sets: {
880
- const r = ke(t);
881
- return n ? { sets: void 0 } : r ? { sets: {
882
- query: r.first,
883
- parameter: r.second
884
- } } : void 0;
885
- }
886
- case d.valueFrom: {
887
- const r = ke(t);
888
- return n ? { valueFrom: void 0 } : r ? { valueFrom: {
889
- query: r.first,
890
- field: r.second
891
- } } : void 0;
892
- }
893
- case d.control:
894
- return { control: n ? void 0 : t };
895
- case d.shows:
896
- return typeof t == "string" && t !== "" ? { shows: t } : void 0;
897
- case d.target:
898
- return { target: typeof t == "object" && t !== null && typeof t.module == "string" ? t : void 0 };
899
- case d.slot:
900
- return { slot: typeof t == "string" && t !== "content" && t !== "" ? t : void 0 };
901
- case d.opens:
902
- return tt(t);
903
- case d.enabled:
904
- return nt(t);
905
- case "icon":
906
- case d.slice:
907
- case d.emphasis:
908
- case d.display:
909
- return { [e]: n ? void 0 : t };
910
- default:
911
- return;
912
- }
913
- }
914
- function Zt(e, t) {
915
- const n = e, r = t.strings, o = {}, i = n.sets, s = n.valueFrom;
916
- switch (e.kind) {
917
- case O.Filter:
918
- o[d.sets] = i?.query ? `${i.query} › ${i.parameter ?? ""}` : r.chooseParameter, o[d.control] = r.controls[String(n.control ?? se.Search)] ?? String(n.control);
919
- break;
920
- case O.Tab:
921
- o[d.shows] = typeof n.shows == "string" && n.shows !== "" ? t.screens.find((c) => c.id === n.shows)?.label ?? n.shows : r.chooseScreen;
922
- break;
923
- case O.Stat:
924
- o[d.valueFrom] = s?.query ? `${s.query} › ${s.field ?? ""}` : r.chooseField;
925
- break;
926
- case O.Navigation: {
927
- const c = n.target;
928
- o[d.target] = (t.structure ? _e(t.structure, c) : c?.module) ?? "";
929
- break;
930
- }
931
- case O.Button:
932
- case O.MenuEntry:
933
- 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);
934
- }
935
- return o;
936
- }
937
- function en(e) {
938
- const t = e;
939
- switch (e.kind) {
940
- case O.Button:
941
- case O.MenuEntry:
942
- return !t.slice && !t.command && !t.navigateTo && !t.builtIn;
943
- case O.Filter:
944
- return !t.sets;
945
- case O.Tab:
946
- return !t.shows;
947
- case O.Stat:
948
- return !t.valueFrom;
949
- case O.Navigation:
950
- return !t.target && !(Array.isArray(t.children) && t.children.length > 0);
951
- default:
952
- return !1;
953
- }
954
- }
955
- var x = (e, t, n) => ({
956
- id: e,
957
- icon: je(t),
958
- title: n,
959
- availability: Fe,
960
- readOnlyReason: xe
961
- }), tn = [
962
- x(d.moveEarlier, "arrow-left", "Move earlier"),
963
- x(d.moveLater, "arrow-right", "Move later"),
964
- x(d.duplicate, "copy", "Duplicate"),
965
- x(d.delete, "trash", "Delete")
966
- ], ie = {
967
- [E.Actions]: {
968
- id: d.addButton,
969
- item: O.Button
970
- },
971
- [E.Filters]: {
972
- id: d.addFilter,
973
- item: O.Filter
974
- },
975
- [E.Tabs]: {
976
- id: d.addTab,
977
- item: O.Tab
978
- },
979
- [E.Stats]: {
980
- id: d.addStat,
981
- item: O.Stat
982
- },
983
- [E.Navigation]: {
984
- id: d.addItem,
985
- item: O.Navigation
986
- }
987
- }, re = (e, t, n) => ({
988
- addActions: [{
989
- id: ie[e].id,
990
- label: t,
991
- icon: je("plus")
992
- }],
993
- itemToolbar: [
994
- x(d.rename, "pencil", "Rename"),
995
- ...n,
996
- ...tn
997
- ]
998
- });
999
- function nn(e) {
1000
- switch (e) {
1001
- case E.Actions: {
1002
- 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] : [
1003
- ...t.itemToolbar.slice(0, n),
1004
- ...r,
1005
- ...t.itemToolbar.slice(n)
1006
- ];
1007
- return {
1008
- ...t,
1009
- itemToolbar: o
1010
- };
1011
- }
1012
- case E.Navigation:
1013
- return kt({ sidebar: !0 });
1014
- case E.Filters:
1015
- return re(e, "Add filter", [x(d.sets, "filter", "Sets"), x(d.control, "sliders-horizontal", "Control")]);
1016
- case E.Tabs:
1017
- return re(e, "Add tab", [x(d.shows, "app-window", "Shows")]);
1018
- case E.Stats:
1019
- return re(e, "Add stat", [x(d.valueFrom, "hash", "Value from")]);
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: Zt(a, f),
1215
- ...H.length > 0 ? { problems: H } : {},
1216
- unlinked: en(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 = nn(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: Be.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 || !Qt(b.kind).includes(a)) return;
1389
- const N = Gt(a, b, f);
1390
- if (N)
1391
- return {
1392
- property: N,
1393
- plan: (B) => {
1394
- const H = Xt(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: qt({
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 ?? Le;
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 && _t(r, l, f) ? Dt(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 ?? Ft, 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, Le()));
1681
- !xt(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
- d as A,
1813
- me as B,
1814
- qt as C,
1815
- Rt as D,
1816
- _t 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
- Ft as M,
1825
- Le as N,
1826
- Mt as O,
1827
- Zn as P,
1828
- $t as R,
1829
- Q 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
- rr 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
- xt as j,
1846
- Be 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
- ie as v,
1858
- tr as w,
1859
- nr as x,
1860
- Qt as y,
1861
- Gn as z
1862
- };