@fses/workbench-app 0.1.3 → 0.2.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.
@@ -0,0 +1,837 @@
1
+ import { toRefs as ne, shallowReadonly as W, inject as oe, defineComponent as E, provide as ae, openBlock as b, createElementBlock as I, renderSlot as g, createElementVNode as A, normalizeClass as q, normalizeStyle as R, withModifiers as se, createCommentVNode as P, createVNode as z, Transition as ie, withCtx as w, computed as de, createBlock as K, defineAsyncComponent as ce, unref as le } from "vue";
2
+ import "./canvasFacade-B0oy__da.js";
3
+ import "./useWorkbenchRuntime-XpOzwm56.js";
4
+ import "./cardFactory-CoDF-zsR.js";
5
+ import "./workbenchCustomComponentRegistry-6GHzavdM.js";
6
+ const G = Symbol("workbench-app-context");
7
+ function ue(e) {
8
+ const { adapters: r, config: t, extensions: n } = ne(e);
9
+ return {
10
+ adapters: W(r),
11
+ config: W(t),
12
+ extensions: W(n)
13
+ };
14
+ }
15
+ function er() {
16
+ const e = oe(G);
17
+ if (!e)
18
+ throw new Error("useWorkbenchAppContext must be used inside WorkbenchWorkspaceCore");
19
+ return e;
20
+ }
21
+ const fe = { class: "fses-workbench-app" }, me = /* @__PURE__ */ E({
22
+ __name: "WorkbenchWorkspaceCore",
23
+ props: {
24
+ adapters: {},
25
+ config: {},
26
+ extensions: {}
27
+ },
28
+ setup(e) {
29
+ return ae(G, ue(e)), (t, n) => (b(), I("div", fe, [
30
+ g(t.$slots, "default")
31
+ ]));
32
+ }
33
+ }), he = { class: "workbench-shell" }, pe = ["aria-hidden", "inert"], ge = { class: "workbench-studio-panel__body" }, L = 48, ye = /* @__PURE__ */ E({
34
+ __name: "WorkbenchShell",
35
+ props: {
36
+ studioPanelWidth: {},
37
+ studioPanelCollapsed: { type: Boolean },
38
+ studioPanelEnabled: { type: Boolean },
39
+ drawerOpen: { type: Boolean },
40
+ drawerWidth: {},
41
+ dragging: { type: Boolean },
42
+ canvasFocusMode: { type: Boolean },
43
+ imageWorkbench: { type: Boolean }
44
+ },
45
+ emits: ["startDrag"],
46
+ setup(e, { emit: r }) {
47
+ const t = r;
48
+ return (n, o) => (b(), I("div", he, [
49
+ A("div", {
50
+ class: q(["workbench-shell__body", { "workbench-shell__body--dragging": e.dragging }])
51
+ }, [
52
+ A("div", {
53
+ class: "workbench-shell__canvas-pane",
54
+ style: R({
55
+ flexBasis: e.drawerOpen ? `calc(100% - ${e.drawerWidth || 392}px)` : e.canvasFocusMode || !e.studioPanelEnabled ? "100%" : e.studioPanelCollapsed ? `calc(100% - ${L}px)` : `calc(100% - ${e.studioPanelWidth}px - 8px)`
56
+ })
57
+ }, [
58
+ g(n.$slots, "left", {}, void 0, !0)
59
+ ], 4),
60
+ e.studioPanelEnabled && !e.studioPanelCollapsed && !e.canvasFocusMode && !e.drawerOpen ? (b(), I("div", {
61
+ key: 0,
62
+ "aria-orientation": "vertical",
63
+ "aria-label": "调整问数栏宽度",
64
+ class: "workbench-splitter",
65
+ role: "separator",
66
+ onPointerdown: o[0] || (o[0] = (d) => t("startDrag", d)),
67
+ onDragstart: o[1] || (o[1] = se(() => {
68
+ }, ["prevent"]))
69
+ }, [...o[2] || (o[2] = [
70
+ A("div", { class: "workbench-splitter__track" }, null, -1)
71
+ ])], 32)) : P("", !0),
72
+ e.studioPanelEnabled && !e.canvasFocusMode && !e.drawerOpen ? (b(), I("div", {
73
+ key: 1,
74
+ class: q(["workbench-studio-panel", { "workbench-studio-panel--collapsed": e.studioPanelCollapsed }]),
75
+ style: R({ flexBasis: e.studioPanelCollapsed ? "0px" : `${e.studioPanelWidth}px` }),
76
+ "aria-hidden": e.studioPanelCollapsed ? "true" : void 0,
77
+ inert: e.studioPanelCollapsed ? !0 : void 0
78
+ }, [
79
+ A("div", ge, [
80
+ g(n.$slots, "right", {}, void 0, !0)
81
+ ])
82
+ ], 14, pe)) : P("", !0),
83
+ z(ie, { name: "workbench-assistant-rail-shell" }, {
84
+ default: w(() => [
85
+ e.studioPanelEnabled && e.studioPanelCollapsed && !e.canvasFocusMode && !e.drawerOpen ? (b(), I("div", {
86
+ key: 0,
87
+ class: "workbench-assistant-rail-shell",
88
+ style: R({ flexBasis: `${L}px` }),
89
+ "aria-label": "收起状态问数助手入口"
90
+ }, [
91
+ g(n.$slots, "collapsed-right", {}, void 0, !0)
92
+ ], 4)) : P("", !0)
93
+ ]),
94
+ _: 3
95
+ }),
96
+ e.drawerOpen ? (b(), I("div", {
97
+ key: 2,
98
+ class: "workbench-shell__drawer",
99
+ style: R({ flexBasis: `${e.drawerWidth || 392}px` })
100
+ }, [
101
+ g(n.$slots, "drawer", {}, void 0, !0)
102
+ ], 4)) : P("", !0)
103
+ ], 2)
104
+ ]));
105
+ }
106
+ }), be = (e, r) => {
107
+ const t = e.__vccOpts || e;
108
+ for (const [n, o] of r)
109
+ t[n] = o;
110
+ return t;
111
+ }, we = /* @__PURE__ */ be(ye, [["__scopeId", "data-v-352c4f8f"]]), rr = /* @__PURE__ */ E({
112
+ __name: "WorkbenchAppHost",
113
+ props: {
114
+ adapters: {},
115
+ config: {},
116
+ extensions: {},
117
+ runtime: {}
118
+ },
119
+ setup(e) {
120
+ const r = e, t = de(() => ({
121
+ canvasFocusMode: r.runtime.canvasFocusMode ?? !1,
122
+ drawerOpen: r.runtime.drawerOpen ?? !1,
123
+ drawerWidth: r.runtime.drawerWidth,
124
+ dragging: r.runtime.dragging ?? !1,
125
+ imageWorkbench: r.runtime.imageWorkbench ?? !1,
126
+ studioPanelCollapsed: r.runtime.studioPanelCollapsed ?? !1,
127
+ studioPanelEnabled: r.runtime.studioPanelEnabled ?? !0,
128
+ studioPanelWidth: r.runtime.studioPanelWidth ?? 420
129
+ }));
130
+ return (n, o) => (b(), K(me, {
131
+ adapters: r.adapters,
132
+ config: r.config,
133
+ extensions: r.extensions
134
+ }, {
135
+ default: w(() => [
136
+ z(we, {
137
+ "canvas-focus-mode": t.value.canvasFocusMode,
138
+ "drawer-open": t.value.drawerOpen,
139
+ "drawer-width": t.value.drawerWidth,
140
+ dragging: t.value.dragging,
141
+ "image-workbench": t.value.imageWorkbench,
142
+ "studio-panel-collapsed": t.value.studioPanelCollapsed,
143
+ "studio-panel-enabled": t.value.studioPanelEnabled,
144
+ "studio-panel-width": t.value.studioPanelWidth,
145
+ onStartDrag: o[0] || (o[0] = (d) => {
146
+ var h, y;
147
+ return (y = (h = r.runtime).startStudioPanelDrag) == null ? void 0 : y.call(h, d);
148
+ })
149
+ }, {
150
+ left: w(() => [
151
+ g(n.$slots, "left")
152
+ ]),
153
+ right: w(() => [
154
+ g(n.$slots, "right")
155
+ ]),
156
+ "collapsed-right": w(() => [
157
+ g(n.$slots, "collapsed-right")
158
+ ]),
159
+ drawer: w(() => [
160
+ g(n.$slots, "drawer")
161
+ ]),
162
+ _: 3
163
+ }, 8, ["canvas-focus-mode", "drawer-open", "drawer-width", "dragging", "image-workbench", "studio-panel-collapsed", "studio-panel-enabled", "studio-panel-width"])
164
+ ]),
165
+ _: 3
166
+ }, 8, ["adapters", "config", "extensions"]));
167
+ }
168
+ });
169
+ let N = {}, Y = {}, J = {};
170
+ function ke(e) {
171
+ N = e;
172
+ }
173
+ function Ie(e, r, t) {
174
+ Y = e, J = r, ke(t);
175
+ }
176
+ function tr() {
177
+ return Y;
178
+ }
179
+ function nr() {
180
+ return J;
181
+ }
182
+ function or() {
183
+ return N;
184
+ }
185
+ function ar() {
186
+ var e;
187
+ return (e = N.fde) == null ? void 0 : e.generatedTemplateShell;
188
+ }
189
+ const sr = /* @__PURE__ */ E({
190
+ __name: "WorkbenchApplication",
191
+ props: {
192
+ adapters: {},
193
+ config: {},
194
+ embedInPortal: { type: Boolean, default: !1 },
195
+ extensions: {}
196
+ },
197
+ setup(e) {
198
+ const r = e;
199
+ Ie(r.adapters, r.config, r.extensions);
200
+ const t = ce(() => import("./Workspace-DMye5DU8.js"));
201
+ return (n, o) => (b(), K(le(t), {
202
+ "embed-in-portal": r.embedInPortal
203
+ }, {
204
+ "before-workbench": w(() => [
205
+ g(n.$slots, "before-workbench")
206
+ ]),
207
+ _: 3
208
+ }, 8, ["embed-in-portal"]));
209
+ }
210
+ });
211
+ function ir(e) {
212
+ return {
213
+ getItem: (r) => e.getItem(r),
214
+ removeItem: (r) => e.removeItem(r),
215
+ setItem: (r, t) => e.setItem(r, t)
216
+ };
217
+ }
218
+ const Se = {
219
+ resolveAssetUrl: (e) => e
220
+ }, S = {
221
+ debug: (e, r) => console.debug(e, r),
222
+ error: (e, r) => console.error(e, r),
223
+ info: (e, r) => console.info(e, r),
224
+ warn: (e, r) => console.warn(e, r)
225
+ }, Ce = {
226
+ error: (e) => S.error(e),
227
+ info: (e) => S.info(e),
228
+ success: (e) => S.info(e),
229
+ warning: (e) => S.warn(e)
230
+ };
231
+ function dr(e = {}) {
232
+ const r = /* @__PURE__ */ new Map();
233
+ return {
234
+ agentTransportAdapter: {
235
+ openEventStream: async () => {
236
+ },
237
+ requestJson: async () => ({})
238
+ },
239
+ assetAdapter: Se,
240
+ identityAdapter: {
241
+ readIdentity: () => ({ appId: "test-app", roleId: "default", tenantId: "test-tenant", userId: "test-user" })
242
+ },
243
+ loggerAdapter: S,
244
+ messageAdapter: Ce,
245
+ platformRequestAdapter: {
246
+ ensureSessionReady: async () => !0,
247
+ requestJson: async () => ({})
248
+ },
249
+ routerAdapter: {
250
+ push: () => {
251
+ },
252
+ readQuery: () => ({}),
253
+ replaceQuery: () => {
254
+ }
255
+ },
256
+ storageAdapter: {
257
+ getItem: (t) => r.get(t) ?? null,
258
+ removeItem: (t) => {
259
+ r.delete(t);
260
+ },
261
+ setItem: (t, n) => {
262
+ r.set(t, n);
263
+ }
264
+ },
265
+ uploadAdapter: {
266
+ uploadFile: async () => ({})
267
+ },
268
+ ...e
269
+ };
270
+ }
271
+ const Ae = [
272
+ "attachments",
273
+ "cards",
274
+ "cardRecommendationDraft",
275
+ "defaultExpanded",
276
+ "detail",
277
+ "error",
278
+ "initialEventsPending",
279
+ "markThinking",
280
+ "memoryCaptureDraft",
281
+ "planDraft",
282
+ "processInvocations",
283
+ "processPreamble",
284
+ "queryResultTable",
285
+ "queryResultTables",
286
+ "registeredCardInsertDraft",
287
+ "removeThinking",
288
+ "taskStateDraft",
289
+ "thinkingProcess",
290
+ "thinkingProcessMessages",
291
+ "workbenchTurnId"
292
+ ];
293
+ function cr(e, r) {
294
+ for (const t of Ae)
295
+ e[t] = r[t];
296
+ }
297
+ function Re(e) {
298
+ const r = e.cardRecommendationDraft;
299
+ if (!r || typeof r != "object") return "";
300
+ const t = r.sourceTurnId;
301
+ return typeof t == "string" && t.trim() ? t.trim() : "";
302
+ }
303
+ function Pe(e) {
304
+ const r = e.cardRecommendationDraft;
305
+ if (!r || typeof r != "object") return "";
306
+ const t = r.placementTurnId;
307
+ return typeof t == "string" && t.trim() ? t.trim() : "";
308
+ }
309
+ function X(e) {
310
+ const r = e.workbenchTurnId;
311
+ return typeof r == "string" && r.trim() ? r.trim() : "";
312
+ }
313
+ function Z(e) {
314
+ if (typeof e != "string" || !e.startsWith("workbench-turn-")) return "";
315
+ const r = ["-reply", "-conclusion-stream", "-item-", "-process-", "-task-", "-card-mutation-confirmation"];
316
+ for (const t of r) {
317
+ const n = e.indexOf(t, 15);
318
+ if (n > 15) return e.slice(15, n);
319
+ }
320
+ return "";
321
+ }
322
+ function _(e, r) {
323
+ var n;
324
+ if (e.role !== "assistant" || !((n = e.content) != null && n.trim())) return !1;
325
+ const t = X(e);
326
+ return t ? t === r : Z(e.id) !== r ? !1 : typeof e.id == "string" && (e.id.endsWith("-reply") || e.id.endsWith("-conclusion-stream"));
327
+ }
328
+ function U(e, r) {
329
+ return !!(r && e.some((t) => _(t, r)));
330
+ }
331
+ function Te(e, r) {
332
+ const t = Re(r), n = Pe(r);
333
+ return U(e, t) ? t : U(e, n) ? n : n || X(r) || t || Z(r.id);
334
+ }
335
+ function lr(e) {
336
+ for (const r of e.appendedMessages.values()) {
337
+ if (!r.cardRecommendationDraft) continue;
338
+ const t = Te(e.messages, r);
339
+ if (!t) continue;
340
+ const n = e.messages.indexOf(r);
341
+ if (n < 0) continue;
342
+ const o = e.messages.findIndex((y) => _(y, t));
343
+ if (o < 0 || n === o + 1) continue;
344
+ const [d] = e.messages.splice(n, 1), h = e.messages.findIndex((y) => _(y, t));
345
+ if (h < 0) {
346
+ e.messages.splice(n, 0, d);
347
+ continue;
348
+ }
349
+ e.messages.splice(h + 1, 0, d);
350
+ }
351
+ }
352
+ function Ee(e) {
353
+ return !e.thinkingProcess;
354
+ }
355
+ function We(e) {
356
+ const r = e.content.trim();
357
+ return Ee(e) ? `${r.replace(/完成(?:,用时 .*)?$/u, "").trim()}完成` : r;
358
+ }
359
+ function ur(e, r) {
360
+ return {
361
+ content: We(e),
362
+ loading: !1,
363
+ ...typeof e.startTime == "number" ? { startTime: e.startTime } : {},
364
+ ...typeof e.endTime == "number" ? { endTime: e.endTime } : typeof r == "number" ? { endTime: r } : {}
365
+ };
366
+ }
367
+ function p(e) {
368
+ return e && typeof e == "object" && !Array.isArray(e) ? e : {};
369
+ }
370
+ function a(e) {
371
+ return typeof e == "string" ? e.trim() : typeof e == "number" || typeof e == "boolean" ? String(e) : "";
372
+ }
373
+ function Q(e) {
374
+ return Array.isArray(e) ? String(e.length) : "";
375
+ }
376
+ function ee(e) {
377
+ const r = p(e);
378
+ return [
379
+ a(r.bindingId),
380
+ a(r.id),
381
+ a(r.metricId),
382
+ a(r.metricCode),
383
+ a(r.source),
384
+ a(r.bindingKind),
385
+ a(r.serviceOperation),
386
+ a(r.refreshApi),
387
+ a(r.contractHash)
388
+ ].join("|");
389
+ }
390
+ function re(e) {
391
+ const r = p(e), t = p(r.data);
392
+ return [
393
+ a(r.resultId),
394
+ a(r.sourceTurnId),
395
+ a(r.rowCount),
396
+ Q(r.rows || t.rows),
397
+ Q(r.columns || t.columns),
398
+ ee(r.dataBinding || t.dataBinding)
399
+ ].join("|");
400
+ }
401
+ function _e(e) {
402
+ const r = p(e), t = p(r.blockPlan), n = p(t.data), o = p(t.meta), d = p(o.queryResult);
403
+ return [
404
+ a(r.recommendationId),
405
+ a(r.capabilityId),
406
+ a(r.title),
407
+ a(r.previewStatus),
408
+ a(r.nextAction),
409
+ a(r.dataShape),
410
+ a(t.id),
411
+ a(t.title),
412
+ ee(r.dataBinding || n.dataBinding),
413
+ re(r.queryResult || d)
414
+ ].join(":");
415
+ }
416
+ function fr(e) {
417
+ const r = p(e), t = typeof r.type == "string" ? r.type : "";
418
+ if (t === "card_recommendations_ready") {
419
+ const n = Array.isArray(r.recommendations) ? r.recommendations : [];
420
+ return [
421
+ t,
422
+ a(r.sourceTurnId),
423
+ a(r.placementTurnId),
424
+ re(r.queryResult),
425
+ n.map(_e).join(",")
426
+ ].join(":");
427
+ }
428
+ if (t === "query_result_table_ready") {
429
+ const n = p(r.queryResult), o = Array.isArray(n.rows) ? n.rows.length : "", d = Array.isArray(n.columns) ? n.columns.length : "";
430
+ return `${t}:${o}:${d}:${n.rowCount ?? ""}`;
431
+ }
432
+ return t;
433
+ }
434
+ const Me = /* @__PURE__ */ new Set(["pending", "running"]), Be = "/data-binding-candidate/query", De = "/workbench/v2/documents/", Ne = "/data-bindings/";
435
+ function ve(e) {
436
+ return typeof (e == null ? void 0 : e.refreshApi) == "string" ? e.refreshApi.trim() : "";
437
+ }
438
+ function $e(e) {
439
+ return e.includes(Be);
440
+ }
441
+ function te(e) {
442
+ let r = e;
443
+ try {
444
+ r = new URL(e, "http://localhost").pathname;
445
+ } catch {
446
+ r = e;
447
+ }
448
+ return r.includes(De) && r.includes(Ne);
449
+ }
450
+ function M(e) {
451
+ return !!(e && typeof e == "object" && !Array.isArray(e));
452
+ }
453
+ function m(e) {
454
+ if (!M(e)) return !1;
455
+ const r = typeof e.source == "string" ? e.source.trim().toLowerCase() : "", t = typeof e.sourceType == "string" ? e.sourceType.trim().toLowerCase() : "", n = typeof e.composeSource == "string" ? e.composeSource.trim().toLowerCase() : "";
456
+ return r === "image" || t === "image" || n === "image" || m(e.params);
457
+ }
458
+ function C(e) {
459
+ return M(e) ? m(e) || m(e.recognition) ? !0 : M(e.v2) ? C(e.v2) : !1 : !1;
460
+ }
461
+ function Oe(e, r, t) {
462
+ return (r == null ? void 0 : r.suppressImageComposeAutoRefresh) !== !0 || !te(t) ? !1 : m(e == null ? void 0 : e.params) || m(e) || m(r) || m(r == null ? void 0 : r.source) || m(r == null ? void 0 : r.data) || C(r == null ? void 0 : r.recognition) || C(r == null ? void 0 : r.meta);
463
+ }
464
+ function Fe(e, r) {
465
+ return m(e == null ? void 0 : e.params) || m(e) || m(r) || m(r == null ? void 0 : r.source) || m(r == null ? void 0 : r.data) || C(r == null ? void 0 : r.recognition) || C(r == null ? void 0 : r.meta);
466
+ }
467
+ function mr(e, r) {
468
+ if (!e) return !1;
469
+ const t = ve(e);
470
+ if (!t || $e(t) || Oe(e, r, t)) return !1;
471
+ const n = typeof (e == null ? void 0 : e.status) == "string" ? e.status.trim().toLowerCase() : "";
472
+ return !(Me.has(n) || te(t) && Fe(e, r));
473
+ }
474
+ function hr(e) {
475
+ var n;
476
+ const r = (n = e.title) == null ? void 0 : n.trim(), t = r ? He(r) : void 0;
477
+ return t || `字段 ${e.index + 1}`;
478
+ }
479
+ function He(e) {
480
+ const r = e.replace(/[A-Za-z0-9_./\\()[\]{}::,,;;#%+\-=]+/gu, "").replace(/\s+/gu, "").trim();
481
+ return r && /[\u3400-\u9fff]/u.test(r) ? r : void 0;
482
+ }
483
+ function B(e, r = {}, t = "-") {
484
+ return Number.isFinite(e) ? new Intl.NumberFormat("zh-CN", r).format(e) : t;
485
+ }
486
+ function pr(e, r = "") {
487
+ return r === "percent" ? `${(e * 100).toFixed(1)}%` : r === "currency" ? Math.abs(e) >= 1e8 ? `¥${(e / 1e8).toFixed(2)}亿` : Math.abs(e) >= 1e4 ? `¥${(e / 1e4).toFixed(1)}万` : `¥${B(e)}` : B(e);
488
+ }
489
+ function gr(e, r = {}) {
490
+ return e === 0 ? "-" : B(e, r);
491
+ }
492
+ function j(e = {}) {
493
+ var t, n, o, d, h, y, v, $, O, F, H, x;
494
+ const r = {
495
+ workspaceId: l([
496
+ s((t = e.routeQuery) == null ? void 0 : t.workspaceId),
497
+ c(e.locationSearch, "workspaceId"),
498
+ u(e.locationHash, "workspaceId"),
499
+ f(e.locationPathname, "workspaceId")
500
+ ]),
501
+ userId: l([
502
+ s((n = e.routeQuery) == null ? void 0 : n.userId),
503
+ c(e.locationSearch, "userId"),
504
+ u(e.locationHash, "userId"),
505
+ f(e.locationPathname, "userId")
506
+ ]),
507
+ tenantId: V(e, ["tenantId", "tenant_id", "tenant-id"]),
508
+ appId: V(e, ["appId", "app_id", "app-id"]),
509
+ roleId: "",
510
+ mode: l([
511
+ s((o = e.routeQuery) == null ? void 0 : o.mode),
512
+ c(e.locationSearch, "mode"),
513
+ u(e.locationHash, "mode"),
514
+ f(e.locationPathname, "mode")
515
+ ]),
516
+ fdeMode: l([
517
+ s((d = e.routeQuery) == null ? void 0 : d.fdeMode),
518
+ c(e.locationSearch, "fdeMode"),
519
+ u(e.locationHash, "fdeMode"),
520
+ f(e.locationPathname, "fdeMode")
521
+ ]),
522
+ workbenchEditable: l([
523
+ s((h = e.routeQuery) == null ? void 0 : h.workbenchEditable),
524
+ c(e.locationSearch, "workbenchEditable"),
525
+ u(e.locationHash, "workbenchEditable"),
526
+ f(e.locationPathname, "workbenchEditable")
527
+ ]),
528
+ conversationId: l([
529
+ s((y = e.routeQuery) == null ? void 0 : y.conversationId),
530
+ c(e.locationSearch, "conversationId"),
531
+ u(e.locationHash, "conversationId"),
532
+ f(e.locationPathname, "conversationId")
533
+ ]),
534
+ resourceId: l([
535
+ s((v = e.routeQuery) == null ? void 0 : v.resourceId),
536
+ c(e.locationSearch, "resourceId"),
537
+ u(e.locationHash, "resourceId"),
538
+ f(e.locationPathname, "resourceId")
539
+ ]),
540
+ fdeResourceId: l([
541
+ s(($ = e.routeQuery) == null ? void 0 : $.fdeResourceId),
542
+ c(e.locationSearch, "fdeResourceId"),
543
+ u(e.locationHash, "fdeResourceId"),
544
+ f(e.locationPathname, "fdeResourceId")
545
+ ]),
546
+ path: l([
547
+ s((O = e.routeQuery) == null ? void 0 : O.path),
548
+ c(e.locationSearch, "path"),
549
+ u(e.locationHash, "path"),
550
+ f(e.locationPathname, "path")
551
+ ]),
552
+ fdePath: l([
553
+ s((F = e.routeQuery) == null ? void 0 : F.fdePath),
554
+ c(e.locationSearch, "fdePath"),
555
+ u(e.locationHash, "fdePath"),
556
+ f(e.locationPathname, "fdePath")
557
+ ]),
558
+ name: l([
559
+ s((H = e.routeQuery) == null ? void 0 : H.name),
560
+ c(e.locationSearch, "name"),
561
+ u(e.locationHash, "name"),
562
+ f(e.locationPathname, "name")
563
+ ]),
564
+ fdeName: l([
565
+ s((x = e.routeQuery) == null ? void 0 : x.fdeName),
566
+ c(e.locationSearch, "fdeName"),
567
+ u(e.locationHash, "fdeName"),
568
+ f(e.locationPathname, "fdeName")
569
+ ])
570
+ };
571
+ return Le(r);
572
+ }
573
+ function yr(e) {
574
+ if (typeof window > "u")
575
+ return j({ routeQuery: e });
576
+ const r = j({
577
+ routeQuery: e,
578
+ locationPathname: window.location.pathname,
579
+ locationSearch: window.location.search,
580
+ locationHash: window.location.hash
581
+ });
582
+ return {
583
+ ...r,
584
+ userId: r.userId || xe(window)
585
+ };
586
+ }
587
+ function s(e) {
588
+ return Array.isArray(e) ? s(e[0]) : typeof e == "string" ? e.trim() : "";
589
+ }
590
+ function c(e, r) {
591
+ var t;
592
+ return e && ((t = new URLSearchParams(e.startsWith("?") ? e.slice(1) : e).get(r)) == null ? void 0 : t.trim()) || "";
593
+ }
594
+ function u(e, r) {
595
+ if (!e) return "";
596
+ const t = e.indexOf("?");
597
+ if (t < 0) return "";
598
+ const n = e.indexOf("#", t + 1), o = n >= 0 ? e.slice(t + 1, n) : e.slice(t + 1);
599
+ return c(o, r);
600
+ }
601
+ function f(e, r) {
602
+ if (!e || !e.includes("=")) return "";
603
+ const t = e.split("/").filter(Boolean).find((n) => n.includes("="));
604
+ return t ? c(t, r) : "";
605
+ }
606
+ function V(e, r) {
607
+ return l(r.flatMap((t) => {
608
+ var n;
609
+ return [
610
+ s((n = e.routeQuery) == null ? void 0 : n[t]),
611
+ c(e.locationSearch, t),
612
+ u(e.locationHash, t),
613
+ f(e.locationPathname, t)
614
+ ];
615
+ }));
616
+ }
617
+ function l(e) {
618
+ return e.find((r) => r.trim()) || "";
619
+ }
620
+ function xe(e) {
621
+ const r = [
622
+ e.__BT_WORKBENCH_USER__,
623
+ e.__BT_RUNTIME_IDENTITY__,
624
+ e.__BT_RUNTIME_CONTEXT__
625
+ ];
626
+ for (const t of r) {
627
+ const n = qe(t);
628
+ if (n) return n;
629
+ }
630
+ return "";
631
+ }
632
+ function qe(e) {
633
+ if (!e || typeof e != "object" || Array.isArray(e)) return "";
634
+ const r = e;
635
+ return l([
636
+ s(r.userId),
637
+ s(r.user_id),
638
+ s(r.egoUserinfo),
639
+ s(r.egoUserInfo),
640
+ s(r["ego-userinfo"])
641
+ ]);
642
+ }
643
+ function Le(e) {
644
+ if (!Ue(e)) return e;
645
+ const r = e.fdeResourceId || e.resourceId;
646
+ return {
647
+ ...e,
648
+ workspaceId: e.workspaceId || r,
649
+ userId: e.userId || "fdeadmin",
650
+ roleId: e.roleId || "fde",
651
+ fdeResourceId: r
652
+ };
653
+ }
654
+ function Ue(e) {
655
+ const r = e.mode.trim().toLowerCase(), t = e.fdeMode.trim().toLowerCase();
656
+ return r === "fde" || t === "true" || t === "1" || t === "yes";
657
+ }
658
+ const i = {
659
+ radius: "standard",
660
+ border: "light",
661
+ shadow: "soft",
662
+ texture: "white",
663
+ textureColor: "#ffffff",
664
+ motion: "none",
665
+ density: "standard"
666
+ }, br = [
667
+ {
668
+ key: "radius",
669
+ label: "圆角",
670
+ options: [
671
+ { value: "square", label: "直角" },
672
+ { value: "small", label: "小圆角" },
673
+ { value: "standard", label: "标准圆角" },
674
+ { value: "large", label: "大圆角" }
675
+ ]
676
+ },
677
+ {
678
+ key: "border",
679
+ label: "边框",
680
+ options: [
681
+ { value: "none", label: "无边框" },
682
+ { value: "light", label: "浅色细边框" },
683
+ { value: "strong", label: "强边框" }
684
+ ]
685
+ },
686
+ {
687
+ key: "shadow",
688
+ label: "阴影",
689
+ options: [
690
+ { value: "none", label: "无阴影" },
691
+ { value: "soft", label: "弱悬浮" },
692
+ { value: "strong", label: "强悬浮" }
693
+ ]
694
+ },
695
+ {
696
+ key: "texture",
697
+ label: "质感",
698
+ options: [
699
+ { value: "white", label: "纯白" },
700
+ { value: "muted", label: "浅灰底" },
701
+ { value: "glass", label: "磨砂玻璃" },
702
+ { value: "texture", label: "纹理底" }
703
+ ]
704
+ },
705
+ {
706
+ key: "motion",
707
+ label: "动效",
708
+ options: [
709
+ { value: "none", label: "无动效" },
710
+ { value: "lift", label: "悬浮微动" },
711
+ { value: "glow", label: "渐变光效" }
712
+ ]
713
+ },
714
+ {
715
+ key: "density",
716
+ label: "密度",
717
+ options: [
718
+ { value: "loose", label: "宽松版" },
719
+ { value: "standard", label: "标准版" },
720
+ { value: "compact", label: "高密度紧凑版" }
721
+ ]
722
+ }
723
+ ], Qe = {
724
+ radius: ["square", "small", "standard", "large"],
725
+ border: ["none", "light", "strong"],
726
+ shadow: ["none", "soft", "strong"],
727
+ texture: ["white", "muted", "glass", "texture", "color"],
728
+ motion: ["none", "lift", "glow"],
729
+ density: ["loose", "standard", "compact"]
730
+ };
731
+ function D(e) {
732
+ return e && typeof e == "object" && !Array.isArray(e) ? e : {};
733
+ }
734
+ function k(e, r) {
735
+ const t = i[e];
736
+ return typeof r == "string" && Qe[e].includes(r) ? r : t;
737
+ }
738
+ function je(e) {
739
+ return typeof e == "string" && /^#[0-9a-fA-F]{6}$/.test(e) ? e.toLowerCase() : i.textureColor;
740
+ }
741
+ function T(e) {
742
+ const r = D(e);
743
+ return {
744
+ radius: k("radius", r.radius),
745
+ border: k("border", r.border),
746
+ shadow: k("shadow", r.shadow),
747
+ texture: k("texture", r.texture),
748
+ textureColor: je(r.textureColor),
749
+ motion: k("motion", r.motion),
750
+ density: k("density", r.density)
751
+ };
752
+ }
753
+ function wr(e) {
754
+ const r = T(e);
755
+ return r.radius === i.radius && r.border === i.border && r.shadow === i.shadow && r.texture === i.texture && r.textureColor === i.textureColor && r.motion === i.motion && r.density === i.density;
756
+ }
757
+ const Ve = {
758
+ square: 0,
759
+ small: 4,
760
+ standard: 8,
761
+ large: 16
762
+ }, ze = {
763
+ none: "none",
764
+ soft: "soft",
765
+ standard: "soft",
766
+ strong: "strong"
767
+ }, Ke = {
768
+ thumbnail: "compact",
769
+ compact: "compact",
770
+ standard: "standard",
771
+ expanded: "loose"
772
+ };
773
+ function kr(e) {
774
+ const r = T(e);
775
+ return {
776
+ cardStyle: {
777
+ cardRadius: Ve[r.radius],
778
+ cardShadow: r.shadow === "strong" ? "strong" : r.shadow,
779
+ density: r.density === "loose" ? "expanded" : r.density,
780
+ ...r.texture === "color" ? { backgroundColor: r.textureColor } : {},
781
+ shell: { ...r }
782
+ }
783
+ };
784
+ }
785
+ function Ir(e) {
786
+ const r = D(e == null ? void 0 : e.cardStyle), t = D(r.shell);
787
+ if (Object.keys(t).length > 0)
788
+ return T(t);
789
+ const n = typeof r.cardRadius == "number" ? r.cardRadius <= 0 ? "square" : r.cardRadius <= 4 ? "small" : r.cardRadius >= 16 ? "large" : "standard" : i.radius, o = typeof r.cardShadow == "string" && ze[r.cardShadow] || i.shadow, d = typeof r.density == "string" && Ke[r.density] || i.density, h = typeof r.backgroundColor == "string" ? r.backgroundColor : void 0;
790
+ return T({
791
+ radius: n,
792
+ border: i.border,
793
+ shadow: o,
794
+ texture: h ? "color" : i.texture,
795
+ textureColor: h,
796
+ motion: i.motion,
797
+ density: d
798
+ });
799
+ }
800
+ const Sr = "@fses/workbench-app";
801
+ export {
802
+ dr as A,
803
+ Se as B,
804
+ S as C,
805
+ i as D,
806
+ Ce as E,
807
+ gr as F,
808
+ er as G,
809
+ br as W,
810
+ be as _,
811
+ hr as a,
812
+ ar as b,
813
+ We as c,
814
+ cr as d,
815
+ ur as e,
816
+ pr as f,
817
+ fr as g,
818
+ tr as h,
819
+ nr as i,
820
+ yr as j,
821
+ Ir as k,
822
+ wr as l,
823
+ kr as m,
824
+ T as n,
825
+ G as o,
826
+ lr as p,
827
+ Sr as q,
828
+ or as r,
829
+ mr as s,
830
+ rr as t,
831
+ sr as u,
832
+ we as v,
833
+ ve as w,
834
+ me as x,
835
+ ir as y,
836
+ ue as z
837
+ };