@fses/workbench-app 0.1.2 → 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.
- package/dist/{Workspace-BVe_v-3T.js → Workspace-DMye5DU8.js} +11459 -11326
- package/dist/canvas/api/index.d.ts +7 -0
- package/dist/canvas/api/index.js +4 -0
- package/dist/canvasFacade-B0oy__da.js +1932 -0
- package/dist/cardFactory-CoDF-zsR.js +1392 -0
- package/dist/extensions/index.d.ts +2 -0
- package/dist/extensions/index.js +8 -0
- package/dist/fses-workbench-app.js +89 -86
- package/dist/index-DbH6tMQy.js +837 -0
- package/dist/internal/personal-workbench/lib/workbenchChatReplyBridge.d.ts +24 -0
- package/dist/internal/personal-workbench/pages/Workspace.vue.d.ts +2 -2
- package/dist/runtime/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/{useWorkbenchRuntime-Pekhufen.js → useWorkbenchRuntime-XpOzwm56.js} +8752 -11980
- package/dist/workbenchCustomComponentRegistry-6GHzavdM.js +267 -0
- package/package.json +6 -2
- package/dist/index-Dy9REnVD.js +0 -1096
package/dist/index-Dy9REnVD.js
DELETED
|
@@ -1,1096 +0,0 @@
|
|
|
1
|
-
import { toRefs as Ie, shallowReadonly as V, inject as Ee, defineComponent as D, provide as Pe, openBlock as _, createElementBlock as v, renderSlot as A, createElementVNode as u, normalizeClass as j, normalizeStyle as q, withModifiers as Se, createCommentVNode as B, createVNode as de, Transition as Ae, withCtx as T, computed as Q, createBlock as ce, defineAsyncComponent as Re, unref as Te, ref as K, watch as We, onBeforeUnmount as Be, toDisplayString as P } from "vue";
|
|
2
|
-
import { c as Me, b as Ne } from "./useWorkbenchRuntime-Pekhufen.js";
|
|
3
|
-
const le = Symbol("workbench-app-context");
|
|
4
|
-
function $e(e) {
|
|
5
|
-
const { adapters: r, config: t, extensions: n } = Ie(e);
|
|
6
|
-
return {
|
|
7
|
-
adapters: V(r),
|
|
8
|
-
config: V(t),
|
|
9
|
-
extensions: V(n)
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
function qr() {
|
|
13
|
-
const e = Ee(le);
|
|
14
|
-
if (!e)
|
|
15
|
-
throw new Error("useWorkbenchAppContext must be used inside WorkbenchWorkspaceCore");
|
|
16
|
-
return e;
|
|
17
|
-
}
|
|
18
|
-
const Oe = { class: "fses-workbench-app" }, De = /* @__PURE__ */ D({
|
|
19
|
-
__name: "WorkbenchWorkspaceCore",
|
|
20
|
-
props: {
|
|
21
|
-
adapters: {},
|
|
22
|
-
config: {},
|
|
23
|
-
extensions: {}
|
|
24
|
-
},
|
|
25
|
-
setup(e) {
|
|
26
|
-
return Pe(le, $e(e)), (t, n) => (_(), v("div", Oe, [
|
|
27
|
-
A(t.$slots, "default")
|
|
28
|
-
]));
|
|
29
|
-
}
|
|
30
|
-
}), He = { class: "workbench-shell" }, Ue = ["aria-hidden", "inert"], Fe = { class: "workbench-studio-panel__body" }, ne = 48, Le = /* @__PURE__ */ D({
|
|
31
|
-
__name: "WorkbenchShell",
|
|
32
|
-
props: {
|
|
33
|
-
studioPanelWidth: {},
|
|
34
|
-
studioPanelCollapsed: { type: Boolean },
|
|
35
|
-
studioPanelEnabled: { type: Boolean },
|
|
36
|
-
drawerOpen: { type: Boolean },
|
|
37
|
-
drawerWidth: {},
|
|
38
|
-
dragging: { type: Boolean },
|
|
39
|
-
canvasFocusMode: { type: Boolean },
|
|
40
|
-
imageWorkbench: { type: Boolean }
|
|
41
|
-
},
|
|
42
|
-
emits: ["startDrag"],
|
|
43
|
-
setup(e, { emit: r }) {
|
|
44
|
-
const t = r;
|
|
45
|
-
return (n, o) => (_(), v("div", He, [
|
|
46
|
-
u("div", {
|
|
47
|
-
class: j(["workbench-shell__body", { "workbench-shell__body--dragging": e.dragging }])
|
|
48
|
-
}, [
|
|
49
|
-
u("div", {
|
|
50
|
-
class: "workbench-shell__canvas-pane",
|
|
51
|
-
style: q({
|
|
52
|
-
flexBasis: e.drawerOpen ? `calc(100% - ${e.drawerWidth || 392}px)` : e.canvasFocusMode || !e.studioPanelEnabled ? "100%" : e.studioPanelCollapsed ? `calc(100% - ${ne}px)` : `calc(100% - ${e.studioPanelWidth}px - 8px)`
|
|
53
|
-
})
|
|
54
|
-
}, [
|
|
55
|
-
A(n.$slots, "left", {}, void 0, !0)
|
|
56
|
-
], 4),
|
|
57
|
-
e.studioPanelEnabled && !e.studioPanelCollapsed && !e.canvasFocusMode && !e.drawerOpen ? (_(), v("div", {
|
|
58
|
-
key: 0,
|
|
59
|
-
"aria-orientation": "vertical",
|
|
60
|
-
"aria-label": "调整问数栏宽度",
|
|
61
|
-
class: "workbench-splitter",
|
|
62
|
-
role: "separator",
|
|
63
|
-
onPointerdown: o[0] || (o[0] = (l) => t("startDrag", l)),
|
|
64
|
-
onDragstart: o[1] || (o[1] = Se(() => {
|
|
65
|
-
}, ["prevent"]))
|
|
66
|
-
}, [...o[2] || (o[2] = [
|
|
67
|
-
u("div", { class: "workbench-splitter__track" }, null, -1)
|
|
68
|
-
])], 32)) : B("", !0),
|
|
69
|
-
e.studioPanelEnabled && !e.canvasFocusMode && !e.drawerOpen ? (_(), v("div", {
|
|
70
|
-
key: 1,
|
|
71
|
-
class: j(["workbench-studio-panel", { "workbench-studio-panel--collapsed": e.studioPanelCollapsed }]),
|
|
72
|
-
style: q({ flexBasis: e.studioPanelCollapsed ? "0px" : `${e.studioPanelWidth}px` }),
|
|
73
|
-
"aria-hidden": e.studioPanelCollapsed ? "true" : void 0,
|
|
74
|
-
inert: e.studioPanelCollapsed ? !0 : void 0
|
|
75
|
-
}, [
|
|
76
|
-
u("div", Fe, [
|
|
77
|
-
A(n.$slots, "right", {}, void 0, !0)
|
|
78
|
-
])
|
|
79
|
-
], 14, Ue)) : B("", !0),
|
|
80
|
-
de(Ae, { name: "workbench-assistant-rail-shell" }, {
|
|
81
|
-
default: T(() => [
|
|
82
|
-
e.studioPanelEnabled && e.studioPanelCollapsed && !e.canvasFocusMode && !e.drawerOpen ? (_(), v("div", {
|
|
83
|
-
key: 0,
|
|
84
|
-
class: "workbench-assistant-rail-shell",
|
|
85
|
-
style: q({ flexBasis: `${ne}px` }),
|
|
86
|
-
"aria-label": "收起状态问数助手入口"
|
|
87
|
-
}, [
|
|
88
|
-
A(n.$slots, "collapsed-right", {}, void 0, !0)
|
|
89
|
-
], 4)) : B("", !0)
|
|
90
|
-
]),
|
|
91
|
-
_: 3
|
|
92
|
-
}),
|
|
93
|
-
e.drawerOpen ? (_(), v("div", {
|
|
94
|
-
key: 2,
|
|
95
|
-
class: "workbench-shell__drawer",
|
|
96
|
-
style: q({ flexBasis: `${e.drawerWidth || 392}px` })
|
|
97
|
-
}, [
|
|
98
|
-
A(n.$slots, "drawer", {}, void 0, !0)
|
|
99
|
-
], 4)) : B("", !0)
|
|
100
|
-
], 2)
|
|
101
|
-
]));
|
|
102
|
-
}
|
|
103
|
-
}), xe = (e, r) => {
|
|
104
|
-
const t = e.__vccOpts || e;
|
|
105
|
-
for (const [n, o] of r)
|
|
106
|
-
t[n] = o;
|
|
107
|
-
return t;
|
|
108
|
-
}, qe = /* @__PURE__ */ xe(Le, [["__scopeId", "data-v-ed22309e"]]), Kr = /* @__PURE__ */ D({
|
|
109
|
-
__name: "WorkbenchAppHost",
|
|
110
|
-
props: {
|
|
111
|
-
adapters: {},
|
|
112
|
-
config: {},
|
|
113
|
-
extensions: {},
|
|
114
|
-
runtime: {}
|
|
115
|
-
},
|
|
116
|
-
setup(e) {
|
|
117
|
-
const r = e, t = Q(() => ({
|
|
118
|
-
canvasFocusMode: r.runtime.canvasFocusMode ?? !1,
|
|
119
|
-
drawerOpen: r.runtime.drawerOpen ?? !1,
|
|
120
|
-
drawerWidth: r.runtime.drawerWidth,
|
|
121
|
-
dragging: r.runtime.dragging ?? !1,
|
|
122
|
-
imageWorkbench: r.runtime.imageWorkbench ?? !1,
|
|
123
|
-
studioPanelCollapsed: r.runtime.studioPanelCollapsed ?? !1,
|
|
124
|
-
studioPanelEnabled: r.runtime.studioPanelEnabled ?? !0,
|
|
125
|
-
studioPanelWidth: r.runtime.studioPanelWidth ?? 420
|
|
126
|
-
}));
|
|
127
|
-
return (n, o) => (_(), ce(De, {
|
|
128
|
-
adapters: r.adapters,
|
|
129
|
-
config: r.config,
|
|
130
|
-
extensions: r.extensions
|
|
131
|
-
}, {
|
|
132
|
-
default: T(() => [
|
|
133
|
-
de(qe, {
|
|
134
|
-
"canvas-focus-mode": t.value.canvasFocusMode,
|
|
135
|
-
"drawer-open": t.value.drawerOpen,
|
|
136
|
-
"drawer-width": t.value.drawerWidth,
|
|
137
|
-
dragging: t.value.dragging,
|
|
138
|
-
"image-workbench": t.value.imageWorkbench,
|
|
139
|
-
"studio-panel-collapsed": t.value.studioPanelCollapsed,
|
|
140
|
-
"studio-panel-enabled": t.value.studioPanelEnabled,
|
|
141
|
-
"studio-panel-width": t.value.studioPanelWidth,
|
|
142
|
-
onStartDrag: o[0] || (o[0] = (l) => {
|
|
143
|
-
var p, s;
|
|
144
|
-
return (s = (p = r.runtime).startStudioPanelDrag) == null ? void 0 : s.call(p, l);
|
|
145
|
-
})
|
|
146
|
-
}, {
|
|
147
|
-
left: T(() => [
|
|
148
|
-
A(n.$slots, "left")
|
|
149
|
-
]),
|
|
150
|
-
right: T(() => [
|
|
151
|
-
A(n.$slots, "right")
|
|
152
|
-
]),
|
|
153
|
-
"collapsed-right": T(() => [
|
|
154
|
-
A(n.$slots, "collapsed-right")
|
|
155
|
-
]),
|
|
156
|
-
drawer: T(() => [
|
|
157
|
-
A(n.$slots, "drawer")
|
|
158
|
-
]),
|
|
159
|
-
_: 3
|
|
160
|
-
}, 8, ["canvas-focus-mode", "drawer-open", "drawer-width", "dragging", "image-workbench", "studio-panel-collapsed", "studio-panel-enabled", "studio-panel-width"])
|
|
161
|
-
]),
|
|
162
|
-
_: 3
|
|
163
|
-
}, 8, ["adapters", "config", "extensions"]));
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
let Z = {}, ue = {}, me = {};
|
|
167
|
-
function Ke(e) {
|
|
168
|
-
Z = e;
|
|
169
|
-
}
|
|
170
|
-
function je(e, r, t) {
|
|
171
|
-
ue = e, me = r, Ke(t);
|
|
172
|
-
}
|
|
173
|
-
function jr() {
|
|
174
|
-
return ue;
|
|
175
|
-
}
|
|
176
|
-
function zr() {
|
|
177
|
-
return me;
|
|
178
|
-
}
|
|
179
|
-
function Vr() {
|
|
180
|
-
return Z;
|
|
181
|
-
}
|
|
182
|
-
function Qr() {
|
|
183
|
-
var e;
|
|
184
|
-
return (e = Z.fde) == null ? void 0 : e.generatedTemplateShell;
|
|
185
|
-
}
|
|
186
|
-
const Gr = /* @__PURE__ */ D({
|
|
187
|
-
__name: "WorkbenchApplication",
|
|
188
|
-
props: {
|
|
189
|
-
adapters: {},
|
|
190
|
-
config: {},
|
|
191
|
-
embedInPortal: { type: Boolean, default: !1 },
|
|
192
|
-
extensions: {}
|
|
193
|
-
},
|
|
194
|
-
setup(e) {
|
|
195
|
-
const r = e;
|
|
196
|
-
je(r.adapters, r.config, r.extensions);
|
|
197
|
-
const t = Re(() => import("./Workspace-BVe_v-3T.js"));
|
|
198
|
-
return (n, o) => (_(), ce(Te(t), {
|
|
199
|
-
"embed-in-portal": r.embedInPortal
|
|
200
|
-
}, {
|
|
201
|
-
"before-workbench": T(() => [
|
|
202
|
-
A(n.$slots, "before-workbench")
|
|
203
|
-
]),
|
|
204
|
-
_: 3
|
|
205
|
-
}, 8, ["embed-in-portal"]));
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
function Yr(e) {
|
|
209
|
-
return {
|
|
210
|
-
getItem: (r) => e.getItem(r),
|
|
211
|
-
removeItem: (r) => e.removeItem(r),
|
|
212
|
-
setItem: (r, t) => e.setItem(r, t)
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
const ze = {
|
|
216
|
-
resolveAssetUrl: (e) => e
|
|
217
|
-
}, $ = {
|
|
218
|
-
debug: (e, r) => console.debug(e, r),
|
|
219
|
-
error: (e, r) => console.error(e, r),
|
|
220
|
-
info: (e, r) => console.info(e, r),
|
|
221
|
-
warn: (e, r) => console.warn(e, r)
|
|
222
|
-
}, Ve = {
|
|
223
|
-
error: (e) => $.error(e),
|
|
224
|
-
info: (e) => $.info(e),
|
|
225
|
-
success: (e) => $.info(e),
|
|
226
|
-
warning: (e) => $.warn(e)
|
|
227
|
-
};
|
|
228
|
-
function Jr(e = {}) {
|
|
229
|
-
const r = /* @__PURE__ */ new Map();
|
|
230
|
-
return {
|
|
231
|
-
agentTransportAdapter: {
|
|
232
|
-
openEventStream: async () => {
|
|
233
|
-
},
|
|
234
|
-
requestJson: async () => ({})
|
|
235
|
-
},
|
|
236
|
-
assetAdapter: ze,
|
|
237
|
-
identityAdapter: {
|
|
238
|
-
readIdentity: () => ({ appId: "test-app", roleId: "default", tenantId: "test-tenant", userId: "test-user" })
|
|
239
|
-
},
|
|
240
|
-
loggerAdapter: $,
|
|
241
|
-
messageAdapter: Ve,
|
|
242
|
-
platformRequestAdapter: {
|
|
243
|
-
ensureSessionReady: async () => !0,
|
|
244
|
-
requestJson: async () => ({})
|
|
245
|
-
},
|
|
246
|
-
routerAdapter: {
|
|
247
|
-
push: () => {
|
|
248
|
-
},
|
|
249
|
-
readQuery: () => ({}),
|
|
250
|
-
replaceQuery: () => {
|
|
251
|
-
}
|
|
252
|
-
},
|
|
253
|
-
storageAdapter: {
|
|
254
|
-
getItem: (t) => r.get(t) ?? null,
|
|
255
|
-
removeItem: (t) => {
|
|
256
|
-
r.delete(t);
|
|
257
|
-
},
|
|
258
|
-
setItem: (t, n) => {
|
|
259
|
-
r.set(t, n);
|
|
260
|
-
}
|
|
261
|
-
},
|
|
262
|
-
uploadAdapter: {
|
|
263
|
-
uploadFile: async () => ({})
|
|
264
|
-
},
|
|
265
|
-
...e
|
|
266
|
-
};
|
|
267
|
-
}
|
|
268
|
-
const Qe = [
|
|
269
|
-
"attachments",
|
|
270
|
-
"cards",
|
|
271
|
-
"cardRecommendationDraft",
|
|
272
|
-
"defaultExpanded",
|
|
273
|
-
"detail",
|
|
274
|
-
"error",
|
|
275
|
-
"initialEventsPending",
|
|
276
|
-
"markThinking",
|
|
277
|
-
"memoryCaptureDraft",
|
|
278
|
-
"planDraft",
|
|
279
|
-
"processInvocations",
|
|
280
|
-
"processPreamble",
|
|
281
|
-
"queryResultTable",
|
|
282
|
-
"queryResultTables",
|
|
283
|
-
"registeredCardInsertDraft",
|
|
284
|
-
"removeThinking",
|
|
285
|
-
"taskStateDraft",
|
|
286
|
-
"thinkingProcess",
|
|
287
|
-
"thinkingProcessMessages",
|
|
288
|
-
"workbenchTurnId"
|
|
289
|
-
];
|
|
290
|
-
function Xr(e, r) {
|
|
291
|
-
for (const t of Qe)
|
|
292
|
-
e[t] = r[t];
|
|
293
|
-
}
|
|
294
|
-
function Ge(e) {
|
|
295
|
-
const r = e.cardRecommendationDraft;
|
|
296
|
-
if (!r || typeof r != "object") return "";
|
|
297
|
-
const t = r.sourceTurnId;
|
|
298
|
-
return typeof t == "string" && t.trim() ? t.trim() : "";
|
|
299
|
-
}
|
|
300
|
-
function Ye(e) {
|
|
301
|
-
const r = e.cardRecommendationDraft;
|
|
302
|
-
if (!r || typeof r != "object") return "";
|
|
303
|
-
const t = r.placementTurnId;
|
|
304
|
-
return typeof t == "string" && t.trim() ? t.trim() : "";
|
|
305
|
-
}
|
|
306
|
-
function fe(e) {
|
|
307
|
-
const r = e.workbenchTurnId;
|
|
308
|
-
return typeof r == "string" && r.trim() ? r.trim() : "";
|
|
309
|
-
}
|
|
310
|
-
function he(e) {
|
|
311
|
-
if (typeof e != "string" || !e.startsWith("workbench-turn-")) return "";
|
|
312
|
-
const r = ["-reply", "-conclusion-stream", "-item-", "-process-", "-task-", "-card-mutation-confirmation"];
|
|
313
|
-
for (const t of r) {
|
|
314
|
-
const n = e.indexOf(t, 15);
|
|
315
|
-
if (n > 15) return e.slice(15, n);
|
|
316
|
-
}
|
|
317
|
-
return "";
|
|
318
|
-
}
|
|
319
|
-
function G(e, r) {
|
|
320
|
-
var n;
|
|
321
|
-
if (e.role !== "assistant" || !((n = e.content) != null && n.trim())) return !1;
|
|
322
|
-
const t = fe(e);
|
|
323
|
-
return t ? t === r : he(e.id) !== r ? !1 : typeof e.id == "string" && (e.id.endsWith("-reply") || e.id.endsWith("-conclusion-stream"));
|
|
324
|
-
}
|
|
325
|
-
function ae(e, r) {
|
|
326
|
-
return !!(r && e.some((t) => G(t, r)));
|
|
327
|
-
}
|
|
328
|
-
function Je(e, r) {
|
|
329
|
-
const t = Ge(r), n = Ye(r);
|
|
330
|
-
return ae(e, t) ? t : ae(e, n) ? n : n || fe(r) || t || he(r.id);
|
|
331
|
-
}
|
|
332
|
-
function Zr(e) {
|
|
333
|
-
for (const r of e.appendedMessages.values()) {
|
|
334
|
-
if (!r.cardRecommendationDraft) continue;
|
|
335
|
-
const t = Je(e.messages, r);
|
|
336
|
-
if (!t) continue;
|
|
337
|
-
const n = e.messages.indexOf(r);
|
|
338
|
-
if (n < 0) continue;
|
|
339
|
-
const o = e.messages.findIndex((s) => G(s, t));
|
|
340
|
-
if (o < 0 || n === o + 1) continue;
|
|
341
|
-
const [l] = e.messages.splice(n, 1), p = e.messages.findIndex((s) => G(s, t));
|
|
342
|
-
if (p < 0) {
|
|
343
|
-
e.messages.splice(n, 0, l);
|
|
344
|
-
continue;
|
|
345
|
-
}
|
|
346
|
-
e.messages.splice(p + 1, 0, l);
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
function Xe(e) {
|
|
350
|
-
return !e.thinkingProcess;
|
|
351
|
-
}
|
|
352
|
-
function Ze(e) {
|
|
353
|
-
const r = e.content.trim();
|
|
354
|
-
return Xe(e) ? `${r.replace(/完成(?:,用时 .*)?$/u, "").trim()}完成` : r;
|
|
355
|
-
}
|
|
356
|
-
function et(e, r) {
|
|
357
|
-
return {
|
|
358
|
-
content: Ze(e),
|
|
359
|
-
loading: !1,
|
|
360
|
-
...typeof e.startTime == "number" ? { startTime: e.startTime } : {},
|
|
361
|
-
...typeof e.endTime == "number" ? { endTime: e.endTime } : typeof r == "number" ? { endTime: r } : {}
|
|
362
|
-
};
|
|
363
|
-
}
|
|
364
|
-
function S(e) {
|
|
365
|
-
return e && typeof e == "object" && !Array.isArray(e) ? e : {};
|
|
366
|
-
}
|
|
367
|
-
function c(e) {
|
|
368
|
-
return typeof e == "string" ? e.trim() : typeof e == "number" || typeof e == "boolean" ? String(e) : "";
|
|
369
|
-
}
|
|
370
|
-
function oe(e) {
|
|
371
|
-
return Array.isArray(e) ? String(e.length) : "";
|
|
372
|
-
}
|
|
373
|
-
function pe(e) {
|
|
374
|
-
const r = S(e);
|
|
375
|
-
return [
|
|
376
|
-
c(r.bindingId),
|
|
377
|
-
c(r.id),
|
|
378
|
-
c(r.metricId),
|
|
379
|
-
c(r.metricCode),
|
|
380
|
-
c(r.source),
|
|
381
|
-
c(r.bindingKind),
|
|
382
|
-
c(r.serviceOperation),
|
|
383
|
-
c(r.refreshApi),
|
|
384
|
-
c(r.contractHash)
|
|
385
|
-
].join("|");
|
|
386
|
-
}
|
|
387
|
-
function ye(e) {
|
|
388
|
-
const r = S(e), t = S(r.data);
|
|
389
|
-
return [
|
|
390
|
-
c(r.resultId),
|
|
391
|
-
c(r.sourceTurnId),
|
|
392
|
-
c(r.rowCount),
|
|
393
|
-
oe(r.rows || t.rows),
|
|
394
|
-
oe(r.columns || t.columns),
|
|
395
|
-
pe(r.dataBinding || t.dataBinding)
|
|
396
|
-
].join("|");
|
|
397
|
-
}
|
|
398
|
-
function er(e) {
|
|
399
|
-
const r = S(e), t = S(r.blockPlan), n = S(t.data), o = S(t.meta), l = S(o.queryResult);
|
|
400
|
-
return [
|
|
401
|
-
c(r.recommendationId),
|
|
402
|
-
c(r.capabilityId),
|
|
403
|
-
c(r.title),
|
|
404
|
-
c(r.previewStatus),
|
|
405
|
-
c(r.nextAction),
|
|
406
|
-
c(r.dataShape),
|
|
407
|
-
c(t.id),
|
|
408
|
-
c(t.title),
|
|
409
|
-
pe(r.dataBinding || n.dataBinding),
|
|
410
|
-
ye(r.queryResult || l)
|
|
411
|
-
].join(":");
|
|
412
|
-
}
|
|
413
|
-
function rt(e) {
|
|
414
|
-
const r = S(e), t = typeof r.type == "string" ? r.type : "";
|
|
415
|
-
if (t === "card_recommendations_ready") {
|
|
416
|
-
const n = Array.isArray(r.recommendations) ? r.recommendations : [];
|
|
417
|
-
return [
|
|
418
|
-
t,
|
|
419
|
-
c(r.sourceTurnId),
|
|
420
|
-
c(r.placementTurnId),
|
|
421
|
-
ye(r.queryResult),
|
|
422
|
-
n.map(er).join(",")
|
|
423
|
-
].join(":");
|
|
424
|
-
}
|
|
425
|
-
if (t === "query_result_table_ready") {
|
|
426
|
-
const n = S(r.queryResult), o = Array.isArray(n.rows) ? n.rows.length : "", l = Array.isArray(n.columns) ? n.columns.length : "";
|
|
427
|
-
return `${t}:${o}:${l}:${n.rowCount ?? ""}`;
|
|
428
|
-
}
|
|
429
|
-
return t;
|
|
430
|
-
}
|
|
431
|
-
const rr = /* @__PURE__ */ new Set(["pending", "running"]), tr = "/data-binding-candidate/query", nr = "/workbench/v2/documents/", ar = "/data-bindings/";
|
|
432
|
-
function or(e) {
|
|
433
|
-
return typeof (e == null ? void 0 : e.refreshApi) == "string" ? e.refreshApi.trim() : "";
|
|
434
|
-
}
|
|
435
|
-
function sr(e) {
|
|
436
|
-
return e.includes(tr);
|
|
437
|
-
}
|
|
438
|
-
function ge(e) {
|
|
439
|
-
let r = e;
|
|
440
|
-
try {
|
|
441
|
-
r = new URL(e, "http://localhost").pathname;
|
|
442
|
-
} catch {
|
|
443
|
-
r = e;
|
|
444
|
-
}
|
|
445
|
-
return r.includes(nr) && r.includes(ar);
|
|
446
|
-
}
|
|
447
|
-
function Y(e) {
|
|
448
|
-
return !!(e && typeof e == "object" && !Array.isArray(e));
|
|
449
|
-
}
|
|
450
|
-
function k(e) {
|
|
451
|
-
if (!Y(e)) return !1;
|
|
452
|
-
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() : "";
|
|
453
|
-
return r === "image" || t === "image" || n === "image" || k(e.params);
|
|
454
|
-
}
|
|
455
|
-
function O(e) {
|
|
456
|
-
return Y(e) ? k(e) || k(e.recognition) ? !0 : Y(e.v2) ? O(e.v2) : !1 : !1;
|
|
457
|
-
}
|
|
458
|
-
function ir(e, r, t) {
|
|
459
|
-
return (r == null ? void 0 : r.suppressImageComposeAutoRefresh) !== !0 || !ge(t) ? !1 : k(e == null ? void 0 : e.params) || k(e) || k(r) || k(r == null ? void 0 : r.source) || k(r == null ? void 0 : r.data) || O(r == null ? void 0 : r.recognition) || O(r == null ? void 0 : r.meta);
|
|
460
|
-
}
|
|
461
|
-
function dr(e, r) {
|
|
462
|
-
return k(e == null ? void 0 : e.params) || k(e) || k(r) || k(r == null ? void 0 : r.source) || k(r == null ? void 0 : r.data) || O(r == null ? void 0 : r.recognition) || O(r == null ? void 0 : r.meta);
|
|
463
|
-
}
|
|
464
|
-
function tt(e, r) {
|
|
465
|
-
if (!e) return !1;
|
|
466
|
-
const t = or(e);
|
|
467
|
-
if (!t || sr(t) || ir(e, r, t)) return !1;
|
|
468
|
-
const n = typeof (e == null ? void 0 : e.status) == "string" ? e.status.trim().toLowerCase() : "";
|
|
469
|
-
return !(rr.has(n) || ge(t) && dr(e, r));
|
|
470
|
-
}
|
|
471
|
-
function nt(e) {
|
|
472
|
-
var n;
|
|
473
|
-
const r = (n = e.title) == null ? void 0 : n.trim(), t = r ? cr(r) : void 0;
|
|
474
|
-
return t || `字段 ${e.index + 1}`;
|
|
475
|
-
}
|
|
476
|
-
function cr(e) {
|
|
477
|
-
const r = e.replace(/[A-Za-z0-9_./\\()[\]{}::,,;;#%+\-=]+/gu, "").replace(/\s+/gu, "").trim();
|
|
478
|
-
return r && /[\u3400-\u9fff]/u.test(r) ? r : void 0;
|
|
479
|
-
}
|
|
480
|
-
function J(e, r = {}, t = "-") {
|
|
481
|
-
return Number.isFinite(e) ? new Intl.NumberFormat("zh-CN", r).format(e) : t;
|
|
482
|
-
}
|
|
483
|
-
function at(e, r = "") {
|
|
484
|
-
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)}万` : `¥${J(e)}` : J(e);
|
|
485
|
-
}
|
|
486
|
-
function ot(e, r = {}) {
|
|
487
|
-
return e === 0 ? "-" : J(e, r);
|
|
488
|
-
}
|
|
489
|
-
function se(e = {}) {
|
|
490
|
-
var t, n, o, l, p, s, C, R, H, U, F, L;
|
|
491
|
-
const r = {
|
|
492
|
-
workspaceId: g([
|
|
493
|
-
f((t = e.routeQuery) == null ? void 0 : t.workspaceId),
|
|
494
|
-
y(e.locationSearch, "workspaceId"),
|
|
495
|
-
b(e.locationHash, "workspaceId"),
|
|
496
|
-
w(e.locationPathname, "workspaceId")
|
|
497
|
-
]),
|
|
498
|
-
userId: g([
|
|
499
|
-
f((n = e.routeQuery) == null ? void 0 : n.userId),
|
|
500
|
-
y(e.locationSearch, "userId"),
|
|
501
|
-
b(e.locationHash, "userId"),
|
|
502
|
-
w(e.locationPathname, "userId")
|
|
503
|
-
]),
|
|
504
|
-
tenantId: ie(e, ["tenantId", "tenant_id", "tenant-id"]),
|
|
505
|
-
appId: ie(e, ["appId", "app_id", "app-id"]),
|
|
506
|
-
roleId: "",
|
|
507
|
-
mode: g([
|
|
508
|
-
f((o = e.routeQuery) == null ? void 0 : o.mode),
|
|
509
|
-
y(e.locationSearch, "mode"),
|
|
510
|
-
b(e.locationHash, "mode"),
|
|
511
|
-
w(e.locationPathname, "mode")
|
|
512
|
-
]),
|
|
513
|
-
fdeMode: g([
|
|
514
|
-
f((l = e.routeQuery) == null ? void 0 : l.fdeMode),
|
|
515
|
-
y(e.locationSearch, "fdeMode"),
|
|
516
|
-
b(e.locationHash, "fdeMode"),
|
|
517
|
-
w(e.locationPathname, "fdeMode")
|
|
518
|
-
]),
|
|
519
|
-
workbenchEditable: g([
|
|
520
|
-
f((p = e.routeQuery) == null ? void 0 : p.workbenchEditable),
|
|
521
|
-
y(e.locationSearch, "workbenchEditable"),
|
|
522
|
-
b(e.locationHash, "workbenchEditable"),
|
|
523
|
-
w(e.locationPathname, "workbenchEditable")
|
|
524
|
-
]),
|
|
525
|
-
conversationId: g([
|
|
526
|
-
f((s = e.routeQuery) == null ? void 0 : s.conversationId),
|
|
527
|
-
y(e.locationSearch, "conversationId"),
|
|
528
|
-
b(e.locationHash, "conversationId"),
|
|
529
|
-
w(e.locationPathname, "conversationId")
|
|
530
|
-
]),
|
|
531
|
-
resourceId: g([
|
|
532
|
-
f((C = e.routeQuery) == null ? void 0 : C.resourceId),
|
|
533
|
-
y(e.locationSearch, "resourceId"),
|
|
534
|
-
b(e.locationHash, "resourceId"),
|
|
535
|
-
w(e.locationPathname, "resourceId")
|
|
536
|
-
]),
|
|
537
|
-
fdeResourceId: g([
|
|
538
|
-
f((R = e.routeQuery) == null ? void 0 : R.fdeResourceId),
|
|
539
|
-
y(e.locationSearch, "fdeResourceId"),
|
|
540
|
-
b(e.locationHash, "fdeResourceId"),
|
|
541
|
-
w(e.locationPathname, "fdeResourceId")
|
|
542
|
-
]),
|
|
543
|
-
path: g([
|
|
544
|
-
f((H = e.routeQuery) == null ? void 0 : H.path),
|
|
545
|
-
y(e.locationSearch, "path"),
|
|
546
|
-
b(e.locationHash, "path"),
|
|
547
|
-
w(e.locationPathname, "path")
|
|
548
|
-
]),
|
|
549
|
-
fdePath: g([
|
|
550
|
-
f((U = e.routeQuery) == null ? void 0 : U.fdePath),
|
|
551
|
-
y(e.locationSearch, "fdePath"),
|
|
552
|
-
b(e.locationHash, "fdePath"),
|
|
553
|
-
w(e.locationPathname, "fdePath")
|
|
554
|
-
]),
|
|
555
|
-
name: g([
|
|
556
|
-
f((F = e.routeQuery) == null ? void 0 : F.name),
|
|
557
|
-
y(e.locationSearch, "name"),
|
|
558
|
-
b(e.locationHash, "name"),
|
|
559
|
-
w(e.locationPathname, "name")
|
|
560
|
-
]),
|
|
561
|
-
fdeName: g([
|
|
562
|
-
f((L = e.routeQuery) == null ? void 0 : L.fdeName),
|
|
563
|
-
y(e.locationSearch, "fdeName"),
|
|
564
|
-
b(e.locationHash, "fdeName"),
|
|
565
|
-
w(e.locationPathname, "fdeName")
|
|
566
|
-
])
|
|
567
|
-
};
|
|
568
|
-
return mr(r);
|
|
569
|
-
}
|
|
570
|
-
function st(e) {
|
|
571
|
-
if (typeof window > "u")
|
|
572
|
-
return se({ routeQuery: e });
|
|
573
|
-
const r = se({
|
|
574
|
-
routeQuery: e,
|
|
575
|
-
locationPathname: window.location.pathname,
|
|
576
|
-
locationSearch: window.location.search,
|
|
577
|
-
locationHash: window.location.hash
|
|
578
|
-
});
|
|
579
|
-
return {
|
|
580
|
-
...r,
|
|
581
|
-
userId: r.userId || lr(window)
|
|
582
|
-
};
|
|
583
|
-
}
|
|
584
|
-
function f(e) {
|
|
585
|
-
return Array.isArray(e) ? f(e[0]) : typeof e == "string" ? e.trim() : "";
|
|
586
|
-
}
|
|
587
|
-
function y(e, r) {
|
|
588
|
-
var t;
|
|
589
|
-
return e && ((t = new URLSearchParams(e.startsWith("?") ? e.slice(1) : e).get(r)) == null ? void 0 : t.trim()) || "";
|
|
590
|
-
}
|
|
591
|
-
function b(e, r) {
|
|
592
|
-
if (!e) return "";
|
|
593
|
-
const t = e.indexOf("?");
|
|
594
|
-
if (t < 0) return "";
|
|
595
|
-
const n = e.indexOf("#", t + 1), o = n >= 0 ? e.slice(t + 1, n) : e.slice(t + 1);
|
|
596
|
-
return y(o, r);
|
|
597
|
-
}
|
|
598
|
-
function w(e, r) {
|
|
599
|
-
if (!e || !e.includes("=")) return "";
|
|
600
|
-
const t = e.split("/").filter(Boolean).find((n) => n.includes("="));
|
|
601
|
-
return t ? y(t, r) : "";
|
|
602
|
-
}
|
|
603
|
-
function ie(e, r) {
|
|
604
|
-
return g(r.flatMap((t) => {
|
|
605
|
-
var n;
|
|
606
|
-
return [
|
|
607
|
-
f((n = e.routeQuery) == null ? void 0 : n[t]),
|
|
608
|
-
y(e.locationSearch, t),
|
|
609
|
-
b(e.locationHash, t),
|
|
610
|
-
w(e.locationPathname, t)
|
|
611
|
-
];
|
|
612
|
-
}));
|
|
613
|
-
}
|
|
614
|
-
function g(e) {
|
|
615
|
-
return e.find((r) => r.trim()) || "";
|
|
616
|
-
}
|
|
617
|
-
function lr(e) {
|
|
618
|
-
const r = [
|
|
619
|
-
e.__BT_WORKBENCH_USER__,
|
|
620
|
-
e.__BT_RUNTIME_IDENTITY__,
|
|
621
|
-
e.__BT_RUNTIME_CONTEXT__
|
|
622
|
-
];
|
|
623
|
-
for (const t of r) {
|
|
624
|
-
const n = ur(t);
|
|
625
|
-
if (n) return n;
|
|
626
|
-
}
|
|
627
|
-
return "";
|
|
628
|
-
}
|
|
629
|
-
function ur(e) {
|
|
630
|
-
if (!e || typeof e != "object" || Array.isArray(e)) return "";
|
|
631
|
-
const r = e;
|
|
632
|
-
return g([
|
|
633
|
-
f(r.userId),
|
|
634
|
-
f(r.user_id),
|
|
635
|
-
f(r.egoUserinfo),
|
|
636
|
-
f(r.egoUserInfo),
|
|
637
|
-
f(r["ego-userinfo"])
|
|
638
|
-
]);
|
|
639
|
-
}
|
|
640
|
-
function mr(e) {
|
|
641
|
-
if (!fr(e)) return e;
|
|
642
|
-
const r = e.fdeResourceId || e.resourceId;
|
|
643
|
-
return {
|
|
644
|
-
...e,
|
|
645
|
-
workspaceId: e.workspaceId || r,
|
|
646
|
-
userId: e.userId || "fdeadmin",
|
|
647
|
-
roleId: e.roleId || "fde",
|
|
648
|
-
fdeResourceId: r
|
|
649
|
-
};
|
|
650
|
-
}
|
|
651
|
-
function fr(e) {
|
|
652
|
-
const r = e.mode.trim().toLowerCase(), t = e.fdeMode.trim().toLowerCase();
|
|
653
|
-
return r === "fde" || t === "true" || t === "1" || t === "yes";
|
|
654
|
-
}
|
|
655
|
-
const hr = "/workbench-card-previews/custom-cards";
|
|
656
|
-
function be(e) {
|
|
657
|
-
return `${e.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "") || "system_card"}.png`;
|
|
658
|
-
}
|
|
659
|
-
function it(e) {
|
|
660
|
-
const r = Me(
|
|
661
|
-
{
|
|
662
|
-
capabilityId: e,
|
|
663
|
-
meta: {
|
|
664
|
-
id: `system-card-preview-${be(e).replace(/\.png$/u, "")}`,
|
|
665
|
-
systemCardPreview: !0
|
|
666
|
-
}
|
|
667
|
-
},
|
|
668
|
-
[]
|
|
669
|
-
);
|
|
670
|
-
return r.status !== "success" || !r.block || !r.registryEntry ? null : {
|
|
671
|
-
...r.block,
|
|
672
|
-
meta: {
|
|
673
|
-
...r.block.meta,
|
|
674
|
-
rendererKey: r.registryEntry.rendererKey,
|
|
675
|
-
dataShape: r.registryEntry.dataShape
|
|
676
|
-
}
|
|
677
|
-
};
|
|
678
|
-
}
|
|
679
|
-
async function dt(e) {
|
|
680
|
-
const r = await Ne(
|
|
681
|
-
{
|
|
682
|
-
capabilityId: e,
|
|
683
|
-
meta: {
|
|
684
|
-
id: `system-card-preview-${be(e).replace(/\.png$/u, "")}`,
|
|
685
|
-
systemCardPreview: !0
|
|
686
|
-
}
|
|
687
|
-
},
|
|
688
|
-
[]
|
|
689
|
-
);
|
|
690
|
-
return r.status !== "success" || !r.block || !r.registryEntry ? null : {
|
|
691
|
-
...r.block,
|
|
692
|
-
meta: {
|
|
693
|
-
...r.block.meta,
|
|
694
|
-
rendererKey: r.registryEntry.rendererKey,
|
|
695
|
-
dataShape: r.registryEntry.dataShape
|
|
696
|
-
}
|
|
697
|
-
};
|
|
698
|
-
}
|
|
699
|
-
function pr(e) {
|
|
700
|
-
const r = e.trim().replace(/^\/+/, "");
|
|
701
|
-
return `${hr}/${r}`;
|
|
702
|
-
}
|
|
703
|
-
const yr = pr("template_weather_card.png"), gr = "@byteluck-fe/workbench-template.WeatherCard", br = "card.fde.templateWeather", ct = [
|
|
704
|
-
{
|
|
705
|
-
capabilityId: br,
|
|
706
|
-
category: "card.fde_custom_cards",
|
|
707
|
-
type: "templateWeather",
|
|
708
|
-
title: "天气组件",
|
|
709
|
-
description: "@byteluck-fe/workbench-template 提供的天气组件,按城市展示实时天气。",
|
|
710
|
-
blockType: "display",
|
|
711
|
-
subType: "fdeCustom",
|
|
712
|
-
rendererKey: "fdeCustomComponent",
|
|
713
|
-
dataShape: "fdeCustomComponent",
|
|
714
|
-
shell: "card",
|
|
715
|
-
styleVariants: ["standard", "compact", "tile"],
|
|
716
|
-
defaultSize: "componentTall",
|
|
717
|
-
handlerClassName: "WorkbenchTemplateWeatherComponentAbility",
|
|
718
|
-
status: "implemented",
|
|
719
|
-
sourceLabel: "npm",
|
|
720
|
-
componentRef: gr,
|
|
721
|
-
packageName: "@byteluck-fe/workbench-template",
|
|
722
|
-
packageVersion: "0.1.1",
|
|
723
|
-
exportName: "WeatherCard",
|
|
724
|
-
previewUrl: yr,
|
|
725
|
-
defaultProps: { city: "上海" },
|
|
726
|
-
insertionMode: "registered"
|
|
727
|
-
}
|
|
728
|
-
], wr = ["aria-busy"], _r = { class: "weather-card__header" }, kr = { class: "weather-card__heading" }, Cr = { class: "weather-card__city" }, vr = {
|
|
729
|
-
key: 0,
|
|
730
|
-
class: "weather-card__region"
|
|
731
|
-
}, Ir = {
|
|
732
|
-
key: 0,
|
|
733
|
-
class: "weather-card__state"
|
|
734
|
-
}, Er = {
|
|
735
|
-
key: 2,
|
|
736
|
-
class: "weather-card__body"
|
|
737
|
-
}, Pr = { class: "weather-card__temperature" }, Sr = { class: "weather-card__summary" }, Ar = { class: "weather-card__metrics" }, Rr = { class: "weather-card__metric" }, Tr = { class: "weather-card__metric" }, Wr = { class: "weather-card__updated" }, Br = /* @__PURE__ */ D({
|
|
738
|
-
__name: "WeatherCard",
|
|
739
|
-
props: {
|
|
740
|
-
city: {}
|
|
741
|
-
},
|
|
742
|
-
setup(e) {
|
|
743
|
-
const r = e, t = Q(() => r.city.trim()), n = Q(() => {
|
|
744
|
-
var a;
|
|
745
|
-
return ((a = s.value) == null ? void 0 : a.city) ?? (t.value || "未选择城市");
|
|
746
|
-
}), o = K(!1), l = K(""), p = K("empty"), s = K(null);
|
|
747
|
-
let C = null, R = 0;
|
|
748
|
-
We(
|
|
749
|
-
t,
|
|
750
|
-
(a) => {
|
|
751
|
-
H(a);
|
|
752
|
-
},
|
|
753
|
-
{ immediate: !0 }
|
|
754
|
-
), Be(() => {
|
|
755
|
-
C == null || C.abort();
|
|
756
|
-
});
|
|
757
|
-
async function H(a) {
|
|
758
|
-
const i = ++R;
|
|
759
|
-
if (C == null || C.abort(), C = null, s.value = null, l.value = "", !a) {
|
|
760
|
-
o.value = !1, p.value = "empty", l.value = "请输入城市名称";
|
|
761
|
-
return;
|
|
762
|
-
}
|
|
763
|
-
const d = new AbortController();
|
|
764
|
-
C = d, o.value = !0;
|
|
765
|
-
try {
|
|
766
|
-
const m = await U(a, d.signal), I = await F(m, d.signal);
|
|
767
|
-
if (i !== R)
|
|
768
|
-
return;
|
|
769
|
-
s.value = L(m, I);
|
|
770
|
-
} catch (m) {
|
|
771
|
-
if (d.signal.aborted || i !== R)
|
|
772
|
-
return;
|
|
773
|
-
p.value = "error", l.value = m instanceof Error ? m.message : "天气数据请求失败";
|
|
774
|
-
} finally {
|
|
775
|
-
i === R && (o.value = !1, C === d && (C = null));
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
async function U(a, i) {
|
|
779
|
-
var d;
|
|
780
|
-
const m = new URL("https://geocoding-api.open-meteo.com/v1/search");
|
|
781
|
-
m.searchParams.set("name", a), m.searchParams.set("count", "1"), m.searchParams.set("language", "zh"), m.searchParams.set("format", "json");
|
|
782
|
-
const I = await fetch(m, { signal: i });
|
|
783
|
-
if (!I.ok)
|
|
784
|
-
throw new Error("城市查询失败");
|
|
785
|
-
const N = (d = (await I.json()).results) == null ? void 0 : d[0];
|
|
786
|
-
if (!N)
|
|
787
|
-
throw new Error(`未找到城市:${a}`);
|
|
788
|
-
return N;
|
|
789
|
-
}
|
|
790
|
-
async function F(a, i) {
|
|
791
|
-
const d = new URL("https://api.open-meteo.com/v1/forecast");
|
|
792
|
-
d.searchParams.set("latitude", String(a.latitude)), d.searchParams.set("longitude", String(a.longitude)), d.searchParams.set(
|
|
793
|
-
"current",
|
|
794
|
-
"temperature_2m,relative_humidity_2m,weather_code,wind_speed_10m"
|
|
795
|
-
), d.searchParams.set("daily", "temperature_2m_max,temperature_2m_min"), d.searchParams.set("forecast_days", "1"), d.searchParams.set("timezone", "auto");
|
|
796
|
-
const m = await fetch(d, { signal: i });
|
|
797
|
-
if (!m.ok)
|
|
798
|
-
throw new Error("天气数据请求失败");
|
|
799
|
-
const I = await m.json();
|
|
800
|
-
if (!I.current)
|
|
801
|
-
throw new Error("天气数据暂不可用");
|
|
802
|
-
return I;
|
|
803
|
-
}
|
|
804
|
-
function L(a, i) {
|
|
805
|
-
var d, m, I, N, ee, re;
|
|
806
|
-
const E = i.current, x = i.daily, ke = [a.admin2, a.admin1, a.country].filter((te, Ce, ve) => !!te && ve.indexOf(te) === Ce).join(" / ");
|
|
807
|
-
return {
|
|
808
|
-
city: a.name,
|
|
809
|
-
region: ke,
|
|
810
|
-
condition: we(E == null ? void 0 : E.weather_code),
|
|
811
|
-
temperature: E == null ? void 0 : E.temperature_2m,
|
|
812
|
-
temperatureUnit: ((d = i.current_units) == null ? void 0 : d.temperature_2m) ?? "°C",
|
|
813
|
-
humidity: E == null ? void 0 : E.relative_humidity_2m,
|
|
814
|
-
humidityUnit: ((m = i.current_units) == null ? void 0 : m.relative_humidity_2m) ?? "%",
|
|
815
|
-
windSpeed: E == null ? void 0 : E.wind_speed_10m,
|
|
816
|
-
windSpeedUnit: ((I = i.current_units) == null ? void 0 : I.wind_speed_10m) ?? "km/h",
|
|
817
|
-
high: (N = x == null ? void 0 : x.temperature_2m_max) == null ? void 0 : N[0],
|
|
818
|
-
low: (ee = x == null ? void 0 : x.temperature_2m_min) == null ? void 0 : ee[0],
|
|
819
|
-
rangeUnit: ((re = i.daily_units) == null ? void 0 : re.temperature_2m_max) ?? "°C",
|
|
820
|
-
updatedAt: _e(E == null ? void 0 : E.time)
|
|
821
|
-
};
|
|
822
|
-
}
|
|
823
|
-
function we(a) {
|
|
824
|
-
return a === 0 ? { label: "晴", tone: "clear" } : a === 1 || a === 2 ? { label: "多云", tone: "cloudy" } : a === 3 ? { label: "阴", tone: "cloudy" } : a === 45 || a === 48 ? { label: "雾", tone: "fog" } : [51, 53, 55, 56, 57, 61, 63, 65, 66, 67, 80, 81, 82].includes(a ?? -1) ? { label: "降雨", tone: "rain" } : [71, 73, 75, 77, 85, 86].includes(a ?? -1) ? { label: "降雪", tone: "snow" } : [95, 96, 99].includes(a ?? -1) ? { label: "雷阵雨", tone: "storm" } : { label: "未知", tone: "neutral" };
|
|
825
|
-
}
|
|
826
|
-
function _e(a) {
|
|
827
|
-
return a ? a.replace("T", " ") : "未知";
|
|
828
|
-
}
|
|
829
|
-
function M(a, i) {
|
|
830
|
-
return typeof a != "number" ? "--" : `${Math.round(a)}${i}`;
|
|
831
|
-
}
|
|
832
|
-
return (a, i) => {
|
|
833
|
-
var d, m;
|
|
834
|
-
return _(), v("section", {
|
|
835
|
-
class: "weather-card",
|
|
836
|
-
"aria-busy": o.value
|
|
837
|
-
}, [
|
|
838
|
-
u("div", _r, [
|
|
839
|
-
u("div", kr, [
|
|
840
|
-
i[0] || (i[0] = u("div", { class: "weather-card__label" }, "实时天气", -1)),
|
|
841
|
-
u("h2", Cr, P(n.value), 1),
|
|
842
|
-
(d = s.value) != null && d.region ? (_(), v("p", vr, P(s.value.region), 1)) : B("", !0)
|
|
843
|
-
]),
|
|
844
|
-
u("div", {
|
|
845
|
-
class: j(["weather-card__badge", s.value ? `weather-card__badge--${s.value.condition.tone}` : void 0])
|
|
846
|
-
}, P(((m = s.value) == null ? void 0 : m.condition.label) ?? "待更新"), 3)
|
|
847
|
-
]),
|
|
848
|
-
o.value ? (_(), v("div", Ir, "正在获取天气...")) : l.value ? (_(), v("div", {
|
|
849
|
-
key: 1,
|
|
850
|
-
class: j(["weather-card__state", { "weather-card__state--error": p.value === "error" }])
|
|
851
|
-
}, P(l.value), 3)) : s.value ? (_(), v("div", Er, [
|
|
852
|
-
u("div", Pr, P(M(s.value.temperature, s.value.temperatureUnit)), 1),
|
|
853
|
-
u("div", Sr, [
|
|
854
|
-
u("span", null, "最高 " + P(M(s.value.high, s.value.rangeUnit)), 1),
|
|
855
|
-
u("span", null, "最低 " + P(M(s.value.low, s.value.rangeUnit)), 1)
|
|
856
|
-
]),
|
|
857
|
-
u("div", Ar, [
|
|
858
|
-
u("div", Rr, [
|
|
859
|
-
i[1] || (i[1] = u("span", { class: "weather-card__metric-label" }, "湿度", -1)),
|
|
860
|
-
u("strong", null, P(M(s.value.humidity, s.value.humidityUnit)), 1)
|
|
861
|
-
]),
|
|
862
|
-
u("div", Tr, [
|
|
863
|
-
i[2] || (i[2] = u("span", { class: "weather-card__metric-label" }, "风速", -1)),
|
|
864
|
-
u("strong", null, P(M(s.value.windSpeed, s.value.windSpeedUnit)), 1)
|
|
865
|
-
])
|
|
866
|
-
]),
|
|
867
|
-
u("p", Wr, "更新时间 " + P(s.value.updatedAt), 1)
|
|
868
|
-
])) : B("", !0)
|
|
869
|
-
], 8, wr);
|
|
870
|
-
};
|
|
871
|
-
}
|
|
872
|
-
}), Mr = [
|
|
873
|
-
{
|
|
874
|
-
packageName: "@byteluck-fe/workbench-template",
|
|
875
|
-
version: "0.1.1",
|
|
876
|
-
componentRef: "@byteluck-fe/workbench-template.WeatherCard",
|
|
877
|
-
componentName: "天气组件",
|
|
878
|
-
exportName: "WeatherCard",
|
|
879
|
-
enabled: !0,
|
|
880
|
-
component: Br,
|
|
881
|
-
validateProps: (e) => typeof e.city == "string" && e.city.trim().length > 0
|
|
882
|
-
}
|
|
883
|
-
// 示例:
|
|
884
|
-
// {
|
|
885
|
-
// packageName: '@fde-components/sales-summary',
|
|
886
|
-
// version: '1.2.0',
|
|
887
|
-
// componentRef: '@fde-components/sales-summary.SalesSummaryCard',
|
|
888
|
-
// componentName: '销售摘要组件',
|
|
889
|
-
// exportName: 'SalesSummaryCard',
|
|
890
|
-
// enabled: true,
|
|
891
|
-
// component: SalesSummaryCard,
|
|
892
|
-
// validateProps: (props) => typeof props.amount === 'number' && typeof props.trend === 'number',
|
|
893
|
-
// },
|
|
894
|
-
], Nr = new Map(Mr.map((e) => [e.componentRef, e]));
|
|
895
|
-
function $r(e, r, t) {
|
|
896
|
-
var n;
|
|
897
|
-
return ((n = e.validateProps) == null ? void 0 : n.call(e, r, t)) ?? !0;
|
|
898
|
-
}
|
|
899
|
-
const lt = {
|
|
900
|
-
/**
|
|
901
|
-
* 根据 componentRef 查找已安装、已审核并启用的 npm 组件。
|
|
902
|
-
* @param data - FDE 自定义组件卡片数据。
|
|
903
|
-
* @returns 命中的组件登记项;未登记或禁用时返回 null。
|
|
904
|
-
*/
|
|
905
|
-
resolve(e) {
|
|
906
|
-
const r = Nr.get(e.componentRef);
|
|
907
|
-
return !r || r.enabled === !1 ? null : r;
|
|
908
|
-
},
|
|
909
|
-
validateProps: $r
|
|
910
|
-
}, h = {
|
|
911
|
-
radius: "standard",
|
|
912
|
-
border: "light",
|
|
913
|
-
shadow: "soft",
|
|
914
|
-
texture: "white",
|
|
915
|
-
textureColor: "#ffffff",
|
|
916
|
-
motion: "none",
|
|
917
|
-
density: "standard"
|
|
918
|
-
}, ut = [
|
|
919
|
-
{
|
|
920
|
-
key: "radius",
|
|
921
|
-
label: "圆角",
|
|
922
|
-
options: [
|
|
923
|
-
{ value: "square", label: "直角" },
|
|
924
|
-
{ value: "small", label: "小圆角" },
|
|
925
|
-
{ value: "standard", label: "标准圆角" },
|
|
926
|
-
{ value: "large", label: "大圆角" }
|
|
927
|
-
]
|
|
928
|
-
},
|
|
929
|
-
{
|
|
930
|
-
key: "border",
|
|
931
|
-
label: "边框",
|
|
932
|
-
options: [
|
|
933
|
-
{ value: "none", label: "无边框" },
|
|
934
|
-
{ value: "light", label: "浅色细边框" },
|
|
935
|
-
{ value: "strong", label: "强边框" }
|
|
936
|
-
]
|
|
937
|
-
},
|
|
938
|
-
{
|
|
939
|
-
key: "shadow",
|
|
940
|
-
label: "阴影",
|
|
941
|
-
options: [
|
|
942
|
-
{ value: "none", label: "无阴影" },
|
|
943
|
-
{ value: "soft", label: "弱悬浮" },
|
|
944
|
-
{ value: "strong", label: "强悬浮" }
|
|
945
|
-
]
|
|
946
|
-
},
|
|
947
|
-
{
|
|
948
|
-
key: "texture",
|
|
949
|
-
label: "质感",
|
|
950
|
-
options: [
|
|
951
|
-
{ value: "white", label: "纯白" },
|
|
952
|
-
{ value: "muted", label: "浅灰底" },
|
|
953
|
-
{ value: "glass", label: "磨砂玻璃" },
|
|
954
|
-
{ value: "texture", label: "纹理底" }
|
|
955
|
-
]
|
|
956
|
-
},
|
|
957
|
-
{
|
|
958
|
-
key: "motion",
|
|
959
|
-
label: "动效",
|
|
960
|
-
options: [
|
|
961
|
-
{ value: "none", label: "无动效" },
|
|
962
|
-
{ value: "lift", label: "悬浮微动" },
|
|
963
|
-
{ value: "glow", label: "渐变光效" }
|
|
964
|
-
]
|
|
965
|
-
},
|
|
966
|
-
{
|
|
967
|
-
key: "density",
|
|
968
|
-
label: "密度",
|
|
969
|
-
options: [
|
|
970
|
-
{ value: "loose", label: "宽松版" },
|
|
971
|
-
{ value: "standard", label: "标准版" },
|
|
972
|
-
{ value: "compact", label: "高密度紧凑版" }
|
|
973
|
-
]
|
|
974
|
-
}
|
|
975
|
-
], Or = {
|
|
976
|
-
radius: ["square", "small", "standard", "large"],
|
|
977
|
-
border: ["none", "light", "strong"],
|
|
978
|
-
shadow: ["none", "soft", "strong"],
|
|
979
|
-
texture: ["white", "muted", "glass", "texture", "color"],
|
|
980
|
-
motion: ["none", "lift", "glow"],
|
|
981
|
-
density: ["loose", "standard", "compact"]
|
|
982
|
-
};
|
|
983
|
-
function X(e) {
|
|
984
|
-
return e && typeof e == "object" && !Array.isArray(e) ? e : {};
|
|
985
|
-
}
|
|
986
|
-
function W(e, r) {
|
|
987
|
-
const t = h[e];
|
|
988
|
-
return typeof r == "string" && Or[e].includes(r) ? r : t;
|
|
989
|
-
}
|
|
990
|
-
function Dr(e) {
|
|
991
|
-
return typeof e == "string" && /^#[0-9a-fA-F]{6}$/.test(e) ? e.toLowerCase() : h.textureColor;
|
|
992
|
-
}
|
|
993
|
-
function z(e) {
|
|
994
|
-
const r = X(e);
|
|
995
|
-
return {
|
|
996
|
-
radius: W("radius", r.radius),
|
|
997
|
-
border: W("border", r.border),
|
|
998
|
-
shadow: W("shadow", r.shadow),
|
|
999
|
-
texture: W("texture", r.texture),
|
|
1000
|
-
textureColor: Dr(r.textureColor),
|
|
1001
|
-
motion: W("motion", r.motion),
|
|
1002
|
-
density: W("density", r.density)
|
|
1003
|
-
};
|
|
1004
|
-
}
|
|
1005
|
-
function mt(e) {
|
|
1006
|
-
const r = z(e);
|
|
1007
|
-
return r.radius === h.radius && r.border === h.border && r.shadow === h.shadow && r.texture === h.texture && r.textureColor === h.textureColor && r.motion === h.motion && r.density === h.density;
|
|
1008
|
-
}
|
|
1009
|
-
const Hr = {
|
|
1010
|
-
square: 0,
|
|
1011
|
-
small: 4,
|
|
1012
|
-
standard: 8,
|
|
1013
|
-
large: 16
|
|
1014
|
-
}, Ur = {
|
|
1015
|
-
none: "none",
|
|
1016
|
-
soft: "soft",
|
|
1017
|
-
standard: "soft",
|
|
1018
|
-
strong: "strong"
|
|
1019
|
-
}, Fr = {
|
|
1020
|
-
thumbnail: "compact",
|
|
1021
|
-
compact: "compact",
|
|
1022
|
-
standard: "standard",
|
|
1023
|
-
expanded: "loose"
|
|
1024
|
-
};
|
|
1025
|
-
function ft(e) {
|
|
1026
|
-
const r = z(e);
|
|
1027
|
-
return {
|
|
1028
|
-
cardStyle: {
|
|
1029
|
-
cardRadius: Hr[r.radius],
|
|
1030
|
-
cardShadow: r.shadow === "strong" ? "strong" : r.shadow,
|
|
1031
|
-
density: r.density === "loose" ? "expanded" : r.density,
|
|
1032
|
-
...r.texture === "color" ? { backgroundColor: r.textureColor } : {},
|
|
1033
|
-
shell: { ...r }
|
|
1034
|
-
}
|
|
1035
|
-
};
|
|
1036
|
-
}
|
|
1037
|
-
function ht(e) {
|
|
1038
|
-
const r = X(e == null ? void 0 : e.cardStyle), t = X(r.shell);
|
|
1039
|
-
if (Object.keys(t).length > 0)
|
|
1040
|
-
return z(t);
|
|
1041
|
-
const n = typeof r.cardRadius == "number" ? r.cardRadius <= 0 ? "square" : r.cardRadius <= 4 ? "small" : r.cardRadius >= 16 ? "large" : "standard" : h.radius, o = typeof r.cardShadow == "string" && Ur[r.cardShadow] || h.shadow, l = typeof r.density == "string" && Fr[r.density] || h.density, p = typeof r.backgroundColor == "string" ? r.backgroundColor : void 0;
|
|
1042
|
-
return z({
|
|
1043
|
-
radius: n,
|
|
1044
|
-
border: h.border,
|
|
1045
|
-
shadow: o,
|
|
1046
|
-
texture: p ? "color" : h.texture,
|
|
1047
|
-
textureColor: p,
|
|
1048
|
-
motion: h.motion,
|
|
1049
|
-
density: l
|
|
1050
|
-
});
|
|
1051
|
-
}
|
|
1052
|
-
const pt = "@fses/workbench-app";
|
|
1053
|
-
export {
|
|
1054
|
-
Kr as A,
|
|
1055
|
-
Gr as B,
|
|
1056
|
-
qe as C,
|
|
1057
|
-
h as D,
|
|
1058
|
-
De as E,
|
|
1059
|
-
Yr as F,
|
|
1060
|
-
$e as G,
|
|
1061
|
-
Jr as H,
|
|
1062
|
-
lt as I,
|
|
1063
|
-
ze as J,
|
|
1064
|
-
$ as K,
|
|
1065
|
-
Ve as L,
|
|
1066
|
-
ot as M,
|
|
1067
|
-
qr as N,
|
|
1068
|
-
ut as W,
|
|
1069
|
-
xe as _,
|
|
1070
|
-
nt as a,
|
|
1071
|
-
Qr as b,
|
|
1072
|
-
dt as c,
|
|
1073
|
-
tt as d,
|
|
1074
|
-
Ze as e,
|
|
1075
|
-
at as f,
|
|
1076
|
-
Xr as g,
|
|
1077
|
-
et as h,
|
|
1078
|
-
rt as i,
|
|
1079
|
-
jr as j,
|
|
1080
|
-
zr as k,
|
|
1081
|
-
st as l,
|
|
1082
|
-
ht as m,
|
|
1083
|
-
z as n,
|
|
1084
|
-
mt as o,
|
|
1085
|
-
Zr as p,
|
|
1086
|
-
ft as q,
|
|
1087
|
-
Vr as r,
|
|
1088
|
-
it as s,
|
|
1089
|
-
le as t,
|
|
1090
|
-
pt as u,
|
|
1091
|
-
ct as v,
|
|
1092
|
-
or as w,
|
|
1093
|
-
br as x,
|
|
1094
|
-
gr as y,
|
|
1095
|
-
yr as z
|
|
1096
|
-
};
|