@lark-apaas/miaoda-coding-sdk 0.0.12-alpha.20260831083241 → 0.0.12
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/design-runtime.dev.js +298 -42
- package/dist/design-runtime.js +298 -42
- package/dist/design-runtime.min.js +1 -1
- package/dist/doubao-runtime.dev.js +2 -2
- package/dist/doubao-runtime.js +2 -2
- package/dist/doubao-runtime.min.js +1 -1
- package/dist/runtime.dev.js +2 -2
- package/dist/runtime.js +2 -2
- package/dist/runtime.min.js +1 -1
- package/package.json +2 -2
|
@@ -26,12 +26,268 @@ var MiaodaRuntime = (() => {
|
|
|
26
26
|
version: () => version
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
// src/creative-
|
|
30
|
-
var
|
|
29
|
+
// src/creative-babel-stages.ts
|
|
30
|
+
var BABEL_SCRIPT_TYPES = /* @__PURE__ */ new Set([
|
|
31
|
+
"text/babel",
|
|
32
|
+
"text/jsx"
|
|
33
|
+
]);
|
|
34
|
+
var RENDER_GRACE_MS = 3e3;
|
|
35
|
+
var HARD_DEADLINE_MS = 15e3;
|
|
36
|
+
var SLARDAR_RETRY_MS = 1e3;
|
|
37
|
+
var SLARDAR_RETRY_MAX = 20;
|
|
31
38
|
var initialized = false;
|
|
32
|
-
function
|
|
39
|
+
function initCreativeBabelStages() {
|
|
33
40
|
if (initialized) return;
|
|
34
41
|
initialized = true;
|
|
42
|
+
document.addEventListener("DOMContentLoaded", onDomContentLoaded, {
|
|
43
|
+
once: true
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
__name(initCreativeBabelStages, "initCreativeBabelStages");
|
|
47
|
+
function onDomContentLoaded() {
|
|
48
|
+
const scripts = collectBabelScripts();
|
|
49
|
+
if (!scripts.length) return;
|
|
50
|
+
const stages = {
|
|
51
|
+
fetchDur: 0,
|
|
52
|
+
transformDur: 0,
|
|
53
|
+
evalDur: 0,
|
|
54
|
+
externalCount: scripts.filter((s) => s.src).length
|
|
55
|
+
};
|
|
56
|
+
const state = {
|
|
57
|
+
sent: false,
|
|
58
|
+
scriptsDone: false,
|
|
59
|
+
scriptsDoneAt: null,
|
|
60
|
+
totalStart: null,
|
|
61
|
+
renderStart: null,
|
|
62
|
+
renderDur: null,
|
|
63
|
+
takeover: false,
|
|
64
|
+
retries: 0,
|
|
65
|
+
hardTimer: null
|
|
66
|
+
};
|
|
67
|
+
const babel = window.Babel;
|
|
68
|
+
if (!babel || typeof babel.transform !== "function" || typeof babel.disableScriptTags !== "function" || stages.externalCount > 0 && typeof fetch !== "function") {
|
|
69
|
+
state.scriptsDone = true;
|
|
70
|
+
trySend(stages, state);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
try {
|
|
74
|
+
babel.disableScriptTags();
|
|
75
|
+
} catch {
|
|
76
|
+
state.scriptsDone = true;
|
|
77
|
+
trySend(stages, state);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
state.takeover = true;
|
|
81
|
+
state.totalStart = performance.now();
|
|
82
|
+
state.hardTimer = setTimeout(() => trySend(stages, state), HARD_DEADLINE_MS);
|
|
83
|
+
instrumentRender(stages, state);
|
|
84
|
+
runScripts(babel, scripts, stages, state);
|
|
85
|
+
}
|
|
86
|
+
__name(onDomContentLoaded, "onDomContentLoaded");
|
|
87
|
+
function collectBabelScripts() {
|
|
88
|
+
const all = document.getElementsByTagName("script");
|
|
89
|
+
const out = [];
|
|
90
|
+
for (let i = 0; i < all.length; i++) {
|
|
91
|
+
const el = all[i];
|
|
92
|
+
if (BABEL_SCRIPT_TYPES.has((el.type || "").split(";")[0])) out.push(el);
|
|
93
|
+
}
|
|
94
|
+
return out;
|
|
95
|
+
}
|
|
96
|
+
__name(collectBabelScripts, "collectBabelScripts");
|
|
97
|
+
function attrList(el, name2) {
|
|
98
|
+
const v = el.getAttribute(name2);
|
|
99
|
+
if (v === "") return [];
|
|
100
|
+
return v ? v.split(",").map((s) => s.trim()) : null;
|
|
101
|
+
}
|
|
102
|
+
__name(attrList, "attrList");
|
|
103
|
+
function buildOptions(el, filename) {
|
|
104
|
+
var _a2, _b, _c;
|
|
105
|
+
const type = el.getAttribute("data-type");
|
|
106
|
+
const targets = {
|
|
107
|
+
browsers: (_a2 = attrList(el, "data-targets")) != null ? _a2 : void 0
|
|
108
|
+
};
|
|
109
|
+
if (type === "module") targets.esmodules = "intersect";
|
|
110
|
+
return {
|
|
111
|
+
filename,
|
|
112
|
+
presets: (_b = attrList(el, "data-presets")) != null ? _b : type === "module" ? [
|
|
113
|
+
"react",
|
|
114
|
+
[
|
|
115
|
+
"env",
|
|
116
|
+
{
|
|
117
|
+
modules: false
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
] : [
|
|
121
|
+
"react",
|
|
122
|
+
"env"
|
|
123
|
+
],
|
|
124
|
+
plugins: (_c = attrList(el, "data-plugins")) != null ? _c : [
|
|
125
|
+
"transform-class-properties",
|
|
126
|
+
"transform-object-rest-spread",
|
|
127
|
+
"transform-flow-strip-types"
|
|
128
|
+
],
|
|
129
|
+
sourceMaps: "inline",
|
|
130
|
+
sourceFileName: filename,
|
|
131
|
+
targets
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
__name(buildOptions, "buildOptions");
|
|
135
|
+
function runScripts(babel, scripts, stages, state) {
|
|
136
|
+
let inlineSeq = 0;
|
|
137
|
+
const runOne = /* @__PURE__ */ __name((el, content) => {
|
|
138
|
+
var _a2;
|
|
139
|
+
let filename;
|
|
140
|
+
if (el.src) {
|
|
141
|
+
filename = el.src;
|
|
142
|
+
} else {
|
|
143
|
+
const dataModule = el.getAttribute("data-module");
|
|
144
|
+
if (dataModule) {
|
|
145
|
+
filename = dataModule;
|
|
146
|
+
} else {
|
|
147
|
+
inlineSeq++;
|
|
148
|
+
filename = inlineSeq === 1 ? "Inline Babel script" : `Inline Babel script (${inlineSeq})`;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
try {
|
|
152
|
+
const t0 = performance.now();
|
|
153
|
+
const result = babel.transform(content, buildOptions(el, filename));
|
|
154
|
+
const t1 = performance.now();
|
|
155
|
+
const s = document.createElement("script");
|
|
156
|
+
const dataType = el.getAttribute("data-type");
|
|
157
|
+
if (dataType) s.setAttribute("type", dataType);
|
|
158
|
+
if (el.nonce) s.nonce = el.nonce;
|
|
159
|
+
s.text = (_a2 = result == null ? void 0 : result.code) != null ? _a2 : "";
|
|
160
|
+
document.head.appendChild(s);
|
|
161
|
+
stages.transformDur += t1 - t0;
|
|
162
|
+
stages.evalDur += performance.now() - t1;
|
|
163
|
+
} catch (err) {
|
|
164
|
+
console.error("[creative-babel-stages] script failed:", filename, err);
|
|
165
|
+
}
|
|
166
|
+
}, "runOne");
|
|
167
|
+
let i = 0;
|
|
168
|
+
while (i < scripts.length && !scripts[i].src) {
|
|
169
|
+
runOne(scripts[i], scripts[i].innerHTML);
|
|
170
|
+
i++;
|
|
171
|
+
}
|
|
172
|
+
if (i >= scripts.length) {
|
|
173
|
+
onScriptsDone(stages, state);
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
const rest = scripts.slice(i);
|
|
177
|
+
const contents = rest.map((el) => {
|
|
178
|
+
if (!el.src) return Promise.resolve(el.innerHTML);
|
|
179
|
+
const t0 = performance.now();
|
|
180
|
+
return fetch(el.src).then((res) => {
|
|
181
|
+
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
182
|
+
return res.text();
|
|
183
|
+
}).then((text) => {
|
|
184
|
+
stages.fetchDur += performance.now() - t0;
|
|
185
|
+
return text;
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
void (async () => {
|
|
189
|
+
for (let k = 0; k < rest.length; k++) {
|
|
190
|
+
let content = null;
|
|
191
|
+
try {
|
|
192
|
+
content = await contents[k];
|
|
193
|
+
} catch (err) {
|
|
194
|
+
console.error("[creative-babel-stages] load failed:", rest[k].src, err);
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
runOne(rest[k], content);
|
|
198
|
+
}
|
|
199
|
+
onScriptsDone(stages, state);
|
|
200
|
+
})();
|
|
201
|
+
}
|
|
202
|
+
__name(runScripts, "runScripts");
|
|
203
|
+
function instrumentRender(stages, state) {
|
|
204
|
+
const reactDom = window.ReactDOM;
|
|
205
|
+
if (!reactDom) return;
|
|
206
|
+
const observeCommit = /* @__PURE__ */ __name((container) => {
|
|
207
|
+
if (state.renderStart !== null) return;
|
|
208
|
+
state.renderStart = performance.now();
|
|
209
|
+
try {
|
|
210
|
+
const mo = new MutationObserver(() => {
|
|
211
|
+
mo.disconnect();
|
|
212
|
+
state.renderDur = performance.now() - state.renderStart;
|
|
213
|
+
if (state.scriptsDone) trySend(stages, state);
|
|
214
|
+
});
|
|
215
|
+
mo.observe(container, {
|
|
216
|
+
childList: true,
|
|
217
|
+
subtree: true
|
|
218
|
+
});
|
|
219
|
+
} catch {
|
|
220
|
+
}
|
|
221
|
+
}, "observeCommit");
|
|
222
|
+
const origCreateRoot = reactDom.createRoot;
|
|
223
|
+
if (typeof origCreateRoot === "function") {
|
|
224
|
+
reactDom.createRoot = (container, options) => {
|
|
225
|
+
const root = origCreateRoot.call(reactDom, container, options);
|
|
226
|
+
const origRender2 = root.render.bind(root);
|
|
227
|
+
root.render = (el) => {
|
|
228
|
+
observeCommit(container);
|
|
229
|
+
return origRender2(el);
|
|
230
|
+
};
|
|
231
|
+
return root;
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
const origRender = reactDom.render;
|
|
235
|
+
if (typeof origRender === "function") {
|
|
236
|
+
reactDom.render = (el, container, callback) => {
|
|
237
|
+
observeCommit(container);
|
|
238
|
+
return origRender.call(reactDom, el, container, callback);
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
__name(instrumentRender, "instrumentRender");
|
|
243
|
+
function onScriptsDone(stages, state) {
|
|
244
|
+
state.scriptsDone = true;
|
|
245
|
+
state.scriptsDoneAt = performance.now();
|
|
246
|
+
if (state.renderStart === null || state.renderDur !== null) {
|
|
247
|
+
trySend(stages, state);
|
|
248
|
+
} else {
|
|
249
|
+
setTimeout(() => trySend(stages, state), RENDER_GRACE_MS);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
__name(onScriptsDone, "onScriptsDone");
|
|
253
|
+
function trySend(stages, state) {
|
|
254
|
+
var _a2;
|
|
255
|
+
if (state.sent) return;
|
|
256
|
+
const slardar = window.Slardar;
|
|
257
|
+
if (!slardar) {
|
|
258
|
+
if (state.retries++ < SLARDAR_RETRY_MAX) {
|
|
259
|
+
setTimeout(() => trySend(stages, state), SLARDAR_RETRY_MS);
|
|
260
|
+
}
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
state.sent = true;
|
|
264
|
+
if (state.hardTimer !== null) clearTimeout(state.hardTimer);
|
|
265
|
+
const totalEnd = state.renderDur !== null && state.renderStart !== null ? state.renderStart + state.renderDur : (_a2 = state.scriptsDoneAt) != null ? _a2 : performance.now();
|
|
266
|
+
const totalDur = state.totalStart === null ? 0 : Math.max(0, totalEnd - state.totalStart);
|
|
267
|
+
slardar("sendEvent", {
|
|
268
|
+
name: "creative_babel_stages",
|
|
269
|
+
metrics: {
|
|
270
|
+
babel_total_dur: Math.round(totalDur),
|
|
271
|
+
babel_fetch_dur: Math.round(stages.fetchDur),
|
|
272
|
+
babel_transform_dur: Math.round(stages.transformDur),
|
|
273
|
+
babel_eval_dur: Math.round(stages.evalDur)
|
|
274
|
+
},
|
|
275
|
+
// custom.metrics 不支持按值过滤,口径维度放 categories
|
|
276
|
+
categories: {
|
|
277
|
+
takeover: String(state.takeover),
|
|
278
|
+
external: String(stages.externalCount > 0),
|
|
279
|
+
render_observed: String(state.renderDur !== null)
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
__name(trySend, "trySend");
|
|
284
|
+
|
|
285
|
+
// src/creative-perf.ts
|
|
286
|
+
var SLARDAR_URL = "https://lf3-short.ibytedapm.com/slardar/fe/sdk-web/browser.cn.js";
|
|
287
|
+
var initialized2 = false;
|
|
288
|
+
function initCreativePerf() {
|
|
289
|
+
if (initialized2) return;
|
|
290
|
+
initialized2 = true;
|
|
35
291
|
if (window.Slardar) {
|
|
36
292
|
bootstrap();
|
|
37
293
|
return;
|
|
@@ -50,6 +306,7 @@ var MiaodaRuntime = (() => {
|
|
|
50
306
|
var _a2, _b, _c;
|
|
51
307
|
const slardar = window.Slardar;
|
|
52
308
|
if (!slardar) return;
|
|
309
|
+
let fcpStartTime = null;
|
|
53
310
|
slardar("context.merge", {
|
|
54
311
|
app_id: (_a2 = window.__appId__) != null ? _a2 : "",
|
|
55
312
|
creative_type: (_b = window.__creativeType__) != null ? _b : "unknown",
|
|
@@ -60,14 +317,15 @@ var MiaodaRuntime = (() => {
|
|
|
60
317
|
env: window.ENVIRONMENT || "online"
|
|
61
318
|
});
|
|
62
319
|
slardar("start");
|
|
63
|
-
const metrics = {};
|
|
64
|
-
let sent = false;
|
|
65
320
|
try {
|
|
66
321
|
new PerformanceObserver((list) => {
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
322
|
+
for (const entry of list.getEntries()) {
|
|
323
|
+
if (entry.name === "first-contentful-paint") {
|
|
324
|
+
fcpStartTime = entry.startTime;
|
|
325
|
+
slardar("context.merge", {
|
|
326
|
+
has_painted: "true"
|
|
327
|
+
});
|
|
328
|
+
break;
|
|
71
329
|
}
|
|
72
330
|
}
|
|
73
331
|
}).observe({
|
|
@@ -76,46 +334,43 @@ var MiaodaRuntime = (() => {
|
|
|
76
334
|
});
|
|
77
335
|
} catch {
|
|
78
336
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const entries = list.getEntries();
|
|
82
|
-
if (entries.length) {
|
|
83
|
-
metrics.lcp = Math.round(entries[entries.length - 1].startTime);
|
|
84
|
-
}
|
|
85
|
-
}).observe({
|
|
86
|
-
type: "largest-contentful-paint",
|
|
87
|
-
buffered: true
|
|
88
|
-
});
|
|
89
|
-
} catch {
|
|
90
|
-
}
|
|
91
|
-
function send() {
|
|
92
|
-
var _a3, _b2, _c2, _d, _e, _f;
|
|
337
|
+
let sent = false;
|
|
338
|
+
const send = /* @__PURE__ */ __name(() => {
|
|
93
339
|
if (sent || !window.Slardar) return;
|
|
94
340
|
sent = true;
|
|
95
|
-
const nav = (_a3 = performance.getEntriesByType("navigation")[0]) != null ? _a3 : {};
|
|
96
341
|
const res = performance.getEntriesByType("resource");
|
|
342
|
+
const nav = performance.getEntriesByType("navigation")[0];
|
|
343
|
+
const fcp = fcpStartTime != null ? fcpStartTime : getBufferedFcpStartTime();
|
|
344
|
+
const metrics = {
|
|
345
|
+
// transfer_size = 所有子资源加总,不含 HTML 文档本身。SDK 自动上报的
|
|
346
|
+
// performance_timing.navigation_timing.transferSize 只是 HTML 文档单独,两者语义互补。
|
|
347
|
+
transfer_size: res.reduce((s, e) => {
|
|
348
|
+
var _a3;
|
|
349
|
+
return s + ((_a3 = e.transferSize) != null ? _a3 : 0);
|
|
350
|
+
}, 0)
|
|
351
|
+
};
|
|
352
|
+
if (nav && nav.domContentLoadedEventEnd >= nav.responseStart) {
|
|
353
|
+
metrics.ttfb_to_dom_ready_dur = Math.round(nav.domContentLoadedEventEnd - nav.responseStart);
|
|
354
|
+
}
|
|
355
|
+
if (nav && fcp !== null && fcp >= nav.domContentLoadedEventEnd) {
|
|
356
|
+
metrics.render_to_fcp_dur = Math.round(fcp - nav.domContentLoadedEventEnd);
|
|
357
|
+
}
|
|
97
358
|
window.Slardar("sendEvent", {
|
|
98
359
|
name: "creative_perf",
|
|
99
|
-
metrics
|
|
100
|
-
fcp: (_b2 = metrics.fcp) != null ? _b2 : 0,
|
|
101
|
-
lcp: (_d = (_c2 = metrics.lcp) != null ? _c2 : metrics.fcp) != null ? _d : 0,
|
|
102
|
-
load: Math.round((_e = nav.loadEventEnd) != null ? _e : 0),
|
|
103
|
-
dom_ready: Math.round((_f = nav.domContentLoadedEventEnd) != null ? _f : 0),
|
|
104
|
-
transfer_size: res.reduce((s, e) => {
|
|
105
|
-
var _a4;
|
|
106
|
-
return s + ((_a4 = e.transferSize) != null ? _a4 : 0);
|
|
107
|
-
}, 0)
|
|
108
|
-
},
|
|
109
|
-
categories: {}
|
|
360
|
+
metrics
|
|
110
361
|
});
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
window.addEventListener("load", () => {
|
|
114
|
-
setTimeout(send, 500);
|
|
115
|
-
});
|
|
362
|
+
}, "send");
|
|
363
|
+
window.addEventListener("load", () => setTimeout(send, 500));
|
|
116
364
|
setTimeout(send, 15e3);
|
|
117
365
|
}
|
|
118
366
|
__name(bootstrap, "bootstrap");
|
|
367
|
+
function getBufferedFcpStartTime() {
|
|
368
|
+
var _a2;
|
|
369
|
+
const paintEntries = performance.getEntriesByType("paint");
|
|
370
|
+
const fcp = paintEntries.find((entry) => entry.name === "first-contentful-paint");
|
|
371
|
+
return (_a2 = fcp == null ? void 0 : fcp.startTime) != null ? _a2 : null;
|
|
372
|
+
}
|
|
373
|
+
__name(getBufferedFcpStartTime, "getBufferedFcpStartTime");
|
|
119
374
|
|
|
120
375
|
// src/register-inspector-id.ts
|
|
121
376
|
function registerInspectorIdPlugin() {
|
|
@@ -264,7 +519,7 @@ var MiaodaRuntime = (() => {
|
|
|
264
519
|
return String(BigInt(msInt) * BigInt(1e6));
|
|
265
520
|
}
|
|
266
521
|
__name(toNanoString, "toNanoString");
|
|
267
|
-
var SDK_VERSION = "1.0.
|
|
522
|
+
var SDK_VERSION = "1.0.1";
|
|
268
523
|
function buildPayload(dataPoints, overrides) {
|
|
269
524
|
const defaultAttrs = getDefaultAttributes(overrides);
|
|
270
525
|
const nowNs = toNanoString(Date.now());
|
|
@@ -506,13 +761,14 @@ var MiaodaRuntime = (() => {
|
|
|
506
761
|
__name(initCreativePvTracking, "initCreativePvTracking");
|
|
507
762
|
|
|
508
763
|
// src/design-runtime.ts
|
|
509
|
-
var version = "0.0.12
|
|
764
|
+
var version = "0.0.12";
|
|
510
765
|
var name = "@lark-apaas/miaoda-coding-sdk";
|
|
511
766
|
if (!window.__CREATIVITY_RUNTIME__) {
|
|
512
767
|
window.__CREATIVITY_RUNTIME__ = true;
|
|
513
768
|
registerInspectorIdPlugin();
|
|
514
769
|
initCreativePerf();
|
|
515
770
|
initCreativePvTracking();
|
|
771
|
+
initCreativeBabelStages();
|
|
516
772
|
}
|
|
517
773
|
return __toCommonJS(design_runtime_exports);
|
|
518
774
|
})();
|
package/dist/design-runtime.js
CHANGED
|
@@ -26,12 +26,268 @@ var MiaodaRuntime = (() => {
|
|
|
26
26
|
version: () => version
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
// src/creative-
|
|
30
|
-
var
|
|
29
|
+
// src/creative-babel-stages.ts
|
|
30
|
+
var BABEL_SCRIPT_TYPES = /* @__PURE__ */ new Set([
|
|
31
|
+
"text/babel",
|
|
32
|
+
"text/jsx"
|
|
33
|
+
]);
|
|
34
|
+
var RENDER_GRACE_MS = 3e3;
|
|
35
|
+
var HARD_DEADLINE_MS = 15e3;
|
|
36
|
+
var SLARDAR_RETRY_MS = 1e3;
|
|
37
|
+
var SLARDAR_RETRY_MAX = 20;
|
|
31
38
|
var initialized = false;
|
|
32
|
-
function
|
|
39
|
+
function initCreativeBabelStages() {
|
|
33
40
|
if (initialized) return;
|
|
34
41
|
initialized = true;
|
|
42
|
+
document.addEventListener("DOMContentLoaded", onDomContentLoaded, {
|
|
43
|
+
once: true
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
__name(initCreativeBabelStages, "initCreativeBabelStages");
|
|
47
|
+
function onDomContentLoaded() {
|
|
48
|
+
const scripts = collectBabelScripts();
|
|
49
|
+
if (!scripts.length) return;
|
|
50
|
+
const stages = {
|
|
51
|
+
fetchDur: 0,
|
|
52
|
+
transformDur: 0,
|
|
53
|
+
evalDur: 0,
|
|
54
|
+
externalCount: scripts.filter((s) => s.src).length
|
|
55
|
+
};
|
|
56
|
+
const state = {
|
|
57
|
+
sent: false,
|
|
58
|
+
scriptsDone: false,
|
|
59
|
+
scriptsDoneAt: null,
|
|
60
|
+
totalStart: null,
|
|
61
|
+
renderStart: null,
|
|
62
|
+
renderDur: null,
|
|
63
|
+
takeover: false,
|
|
64
|
+
retries: 0,
|
|
65
|
+
hardTimer: null
|
|
66
|
+
};
|
|
67
|
+
const babel = window.Babel;
|
|
68
|
+
if (!babel || typeof babel.transform !== "function" || typeof babel.disableScriptTags !== "function" || stages.externalCount > 0 && typeof fetch !== "function") {
|
|
69
|
+
state.scriptsDone = true;
|
|
70
|
+
trySend(stages, state);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
try {
|
|
74
|
+
babel.disableScriptTags();
|
|
75
|
+
} catch {
|
|
76
|
+
state.scriptsDone = true;
|
|
77
|
+
trySend(stages, state);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
state.takeover = true;
|
|
81
|
+
state.totalStart = performance.now();
|
|
82
|
+
state.hardTimer = setTimeout(() => trySend(stages, state), HARD_DEADLINE_MS);
|
|
83
|
+
instrumentRender(stages, state);
|
|
84
|
+
runScripts(babel, scripts, stages, state);
|
|
85
|
+
}
|
|
86
|
+
__name(onDomContentLoaded, "onDomContentLoaded");
|
|
87
|
+
function collectBabelScripts() {
|
|
88
|
+
const all = document.getElementsByTagName("script");
|
|
89
|
+
const out = [];
|
|
90
|
+
for (let i = 0; i < all.length; i++) {
|
|
91
|
+
const el = all[i];
|
|
92
|
+
if (BABEL_SCRIPT_TYPES.has((el.type || "").split(";")[0])) out.push(el);
|
|
93
|
+
}
|
|
94
|
+
return out;
|
|
95
|
+
}
|
|
96
|
+
__name(collectBabelScripts, "collectBabelScripts");
|
|
97
|
+
function attrList(el, name2) {
|
|
98
|
+
const v = el.getAttribute(name2);
|
|
99
|
+
if (v === "") return [];
|
|
100
|
+
return v ? v.split(",").map((s) => s.trim()) : null;
|
|
101
|
+
}
|
|
102
|
+
__name(attrList, "attrList");
|
|
103
|
+
function buildOptions(el, filename) {
|
|
104
|
+
var _a2, _b, _c;
|
|
105
|
+
const type = el.getAttribute("data-type");
|
|
106
|
+
const targets = {
|
|
107
|
+
browsers: (_a2 = attrList(el, "data-targets")) != null ? _a2 : void 0
|
|
108
|
+
};
|
|
109
|
+
if (type === "module") targets.esmodules = "intersect";
|
|
110
|
+
return {
|
|
111
|
+
filename,
|
|
112
|
+
presets: (_b = attrList(el, "data-presets")) != null ? _b : type === "module" ? [
|
|
113
|
+
"react",
|
|
114
|
+
[
|
|
115
|
+
"env",
|
|
116
|
+
{
|
|
117
|
+
modules: false
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
] : [
|
|
121
|
+
"react",
|
|
122
|
+
"env"
|
|
123
|
+
],
|
|
124
|
+
plugins: (_c = attrList(el, "data-plugins")) != null ? _c : [
|
|
125
|
+
"transform-class-properties",
|
|
126
|
+
"transform-object-rest-spread",
|
|
127
|
+
"transform-flow-strip-types"
|
|
128
|
+
],
|
|
129
|
+
sourceMaps: "inline",
|
|
130
|
+
sourceFileName: filename,
|
|
131
|
+
targets
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
__name(buildOptions, "buildOptions");
|
|
135
|
+
function runScripts(babel, scripts, stages, state) {
|
|
136
|
+
let inlineSeq = 0;
|
|
137
|
+
const runOne = /* @__PURE__ */ __name((el, content) => {
|
|
138
|
+
var _a2;
|
|
139
|
+
let filename;
|
|
140
|
+
if (el.src) {
|
|
141
|
+
filename = el.src;
|
|
142
|
+
} else {
|
|
143
|
+
const dataModule = el.getAttribute("data-module");
|
|
144
|
+
if (dataModule) {
|
|
145
|
+
filename = dataModule;
|
|
146
|
+
} else {
|
|
147
|
+
inlineSeq++;
|
|
148
|
+
filename = inlineSeq === 1 ? "Inline Babel script" : `Inline Babel script (${inlineSeq})`;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
try {
|
|
152
|
+
const t0 = performance.now();
|
|
153
|
+
const result = babel.transform(content, buildOptions(el, filename));
|
|
154
|
+
const t1 = performance.now();
|
|
155
|
+
const s = document.createElement("script");
|
|
156
|
+
const dataType = el.getAttribute("data-type");
|
|
157
|
+
if (dataType) s.setAttribute("type", dataType);
|
|
158
|
+
if (el.nonce) s.nonce = el.nonce;
|
|
159
|
+
s.text = (_a2 = result == null ? void 0 : result.code) != null ? _a2 : "";
|
|
160
|
+
document.head.appendChild(s);
|
|
161
|
+
stages.transformDur += t1 - t0;
|
|
162
|
+
stages.evalDur += performance.now() - t1;
|
|
163
|
+
} catch (err) {
|
|
164
|
+
console.error("[creative-babel-stages] script failed:", filename, err);
|
|
165
|
+
}
|
|
166
|
+
}, "runOne");
|
|
167
|
+
let i = 0;
|
|
168
|
+
while (i < scripts.length && !scripts[i].src) {
|
|
169
|
+
runOne(scripts[i], scripts[i].innerHTML);
|
|
170
|
+
i++;
|
|
171
|
+
}
|
|
172
|
+
if (i >= scripts.length) {
|
|
173
|
+
onScriptsDone(stages, state);
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
const rest = scripts.slice(i);
|
|
177
|
+
const contents = rest.map((el) => {
|
|
178
|
+
if (!el.src) return Promise.resolve(el.innerHTML);
|
|
179
|
+
const t0 = performance.now();
|
|
180
|
+
return fetch(el.src).then((res) => {
|
|
181
|
+
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
182
|
+
return res.text();
|
|
183
|
+
}).then((text) => {
|
|
184
|
+
stages.fetchDur += performance.now() - t0;
|
|
185
|
+
return text;
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
void (async () => {
|
|
189
|
+
for (let k = 0; k < rest.length; k++) {
|
|
190
|
+
let content = null;
|
|
191
|
+
try {
|
|
192
|
+
content = await contents[k];
|
|
193
|
+
} catch (err) {
|
|
194
|
+
console.error("[creative-babel-stages] load failed:", rest[k].src, err);
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
runOne(rest[k], content);
|
|
198
|
+
}
|
|
199
|
+
onScriptsDone(stages, state);
|
|
200
|
+
})();
|
|
201
|
+
}
|
|
202
|
+
__name(runScripts, "runScripts");
|
|
203
|
+
function instrumentRender(stages, state) {
|
|
204
|
+
const reactDom = window.ReactDOM;
|
|
205
|
+
if (!reactDom) return;
|
|
206
|
+
const observeCommit = /* @__PURE__ */ __name((container) => {
|
|
207
|
+
if (state.renderStart !== null) return;
|
|
208
|
+
state.renderStart = performance.now();
|
|
209
|
+
try {
|
|
210
|
+
const mo = new MutationObserver(() => {
|
|
211
|
+
mo.disconnect();
|
|
212
|
+
state.renderDur = performance.now() - state.renderStart;
|
|
213
|
+
if (state.scriptsDone) trySend(stages, state);
|
|
214
|
+
});
|
|
215
|
+
mo.observe(container, {
|
|
216
|
+
childList: true,
|
|
217
|
+
subtree: true
|
|
218
|
+
});
|
|
219
|
+
} catch {
|
|
220
|
+
}
|
|
221
|
+
}, "observeCommit");
|
|
222
|
+
const origCreateRoot = reactDom.createRoot;
|
|
223
|
+
if (typeof origCreateRoot === "function") {
|
|
224
|
+
reactDom.createRoot = (container, options) => {
|
|
225
|
+
const root = origCreateRoot.call(reactDom, container, options);
|
|
226
|
+
const origRender2 = root.render.bind(root);
|
|
227
|
+
root.render = (el) => {
|
|
228
|
+
observeCommit(container);
|
|
229
|
+
return origRender2(el);
|
|
230
|
+
};
|
|
231
|
+
return root;
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
const origRender = reactDom.render;
|
|
235
|
+
if (typeof origRender === "function") {
|
|
236
|
+
reactDom.render = (el, container, callback) => {
|
|
237
|
+
observeCommit(container);
|
|
238
|
+
return origRender.call(reactDom, el, container, callback);
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
__name(instrumentRender, "instrumentRender");
|
|
243
|
+
function onScriptsDone(stages, state) {
|
|
244
|
+
state.scriptsDone = true;
|
|
245
|
+
state.scriptsDoneAt = performance.now();
|
|
246
|
+
if (state.renderStart === null || state.renderDur !== null) {
|
|
247
|
+
trySend(stages, state);
|
|
248
|
+
} else {
|
|
249
|
+
setTimeout(() => trySend(stages, state), RENDER_GRACE_MS);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
__name(onScriptsDone, "onScriptsDone");
|
|
253
|
+
function trySend(stages, state) {
|
|
254
|
+
var _a2;
|
|
255
|
+
if (state.sent) return;
|
|
256
|
+
const slardar = window.Slardar;
|
|
257
|
+
if (!slardar) {
|
|
258
|
+
if (state.retries++ < SLARDAR_RETRY_MAX) {
|
|
259
|
+
setTimeout(() => trySend(stages, state), SLARDAR_RETRY_MS);
|
|
260
|
+
}
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
state.sent = true;
|
|
264
|
+
if (state.hardTimer !== null) clearTimeout(state.hardTimer);
|
|
265
|
+
const totalEnd = state.renderDur !== null && state.renderStart !== null ? state.renderStart + state.renderDur : (_a2 = state.scriptsDoneAt) != null ? _a2 : performance.now();
|
|
266
|
+
const totalDur = state.totalStart === null ? 0 : Math.max(0, totalEnd - state.totalStart);
|
|
267
|
+
slardar("sendEvent", {
|
|
268
|
+
name: "creative_babel_stages",
|
|
269
|
+
metrics: {
|
|
270
|
+
babel_total_dur: Math.round(totalDur),
|
|
271
|
+
babel_fetch_dur: Math.round(stages.fetchDur),
|
|
272
|
+
babel_transform_dur: Math.round(stages.transformDur),
|
|
273
|
+
babel_eval_dur: Math.round(stages.evalDur)
|
|
274
|
+
},
|
|
275
|
+
// custom.metrics 不支持按值过滤,口径维度放 categories
|
|
276
|
+
categories: {
|
|
277
|
+
takeover: String(state.takeover),
|
|
278
|
+
external: String(stages.externalCount > 0),
|
|
279
|
+
render_observed: String(state.renderDur !== null)
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
__name(trySend, "trySend");
|
|
284
|
+
|
|
285
|
+
// src/creative-perf.ts
|
|
286
|
+
var SLARDAR_URL = "https://lf3-short.ibytedapm.com/slardar/fe/sdk-web/browser.cn.js";
|
|
287
|
+
var initialized2 = false;
|
|
288
|
+
function initCreativePerf() {
|
|
289
|
+
if (initialized2) return;
|
|
290
|
+
initialized2 = true;
|
|
35
291
|
if (window.Slardar) {
|
|
36
292
|
bootstrap();
|
|
37
293
|
return;
|
|
@@ -50,6 +306,7 @@ var MiaodaRuntime = (() => {
|
|
|
50
306
|
var _a2, _b, _c;
|
|
51
307
|
const slardar = window.Slardar;
|
|
52
308
|
if (!slardar) return;
|
|
309
|
+
let fcpStartTime = null;
|
|
53
310
|
slardar("context.merge", {
|
|
54
311
|
app_id: (_a2 = window.__appId__) != null ? _a2 : "",
|
|
55
312
|
creative_type: (_b = window.__creativeType__) != null ? _b : "unknown",
|
|
@@ -60,14 +317,15 @@ var MiaodaRuntime = (() => {
|
|
|
60
317
|
env: window.ENVIRONMENT || "online"
|
|
61
318
|
});
|
|
62
319
|
slardar("start");
|
|
63
|
-
const metrics = {};
|
|
64
|
-
let sent = false;
|
|
65
320
|
try {
|
|
66
321
|
new PerformanceObserver((list) => {
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
322
|
+
for (const entry of list.getEntries()) {
|
|
323
|
+
if (entry.name === "first-contentful-paint") {
|
|
324
|
+
fcpStartTime = entry.startTime;
|
|
325
|
+
slardar("context.merge", {
|
|
326
|
+
has_painted: "true"
|
|
327
|
+
});
|
|
328
|
+
break;
|
|
71
329
|
}
|
|
72
330
|
}
|
|
73
331
|
}).observe({
|
|
@@ -76,46 +334,43 @@ var MiaodaRuntime = (() => {
|
|
|
76
334
|
});
|
|
77
335
|
} catch {
|
|
78
336
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const entries = list.getEntries();
|
|
82
|
-
if (entries.length) {
|
|
83
|
-
metrics.lcp = Math.round(entries[entries.length - 1].startTime);
|
|
84
|
-
}
|
|
85
|
-
}).observe({
|
|
86
|
-
type: "largest-contentful-paint",
|
|
87
|
-
buffered: true
|
|
88
|
-
});
|
|
89
|
-
} catch {
|
|
90
|
-
}
|
|
91
|
-
function send() {
|
|
92
|
-
var _a3, _b2, _c2, _d, _e, _f;
|
|
337
|
+
let sent = false;
|
|
338
|
+
const send = /* @__PURE__ */ __name(() => {
|
|
93
339
|
if (sent || !window.Slardar) return;
|
|
94
340
|
sent = true;
|
|
95
|
-
const nav = (_a3 = performance.getEntriesByType("navigation")[0]) != null ? _a3 : {};
|
|
96
341
|
const res = performance.getEntriesByType("resource");
|
|
342
|
+
const nav = performance.getEntriesByType("navigation")[0];
|
|
343
|
+
const fcp = fcpStartTime != null ? fcpStartTime : getBufferedFcpStartTime();
|
|
344
|
+
const metrics = {
|
|
345
|
+
// transfer_size = 所有子资源加总,不含 HTML 文档本身。SDK 自动上报的
|
|
346
|
+
// performance_timing.navigation_timing.transferSize 只是 HTML 文档单独,两者语义互补。
|
|
347
|
+
transfer_size: res.reduce((s, e) => {
|
|
348
|
+
var _a3;
|
|
349
|
+
return s + ((_a3 = e.transferSize) != null ? _a3 : 0);
|
|
350
|
+
}, 0)
|
|
351
|
+
};
|
|
352
|
+
if (nav && nav.domContentLoadedEventEnd >= nav.responseStart) {
|
|
353
|
+
metrics.ttfb_to_dom_ready_dur = Math.round(nav.domContentLoadedEventEnd - nav.responseStart);
|
|
354
|
+
}
|
|
355
|
+
if (nav && fcp !== null && fcp >= nav.domContentLoadedEventEnd) {
|
|
356
|
+
metrics.render_to_fcp_dur = Math.round(fcp - nav.domContentLoadedEventEnd);
|
|
357
|
+
}
|
|
97
358
|
window.Slardar("sendEvent", {
|
|
98
359
|
name: "creative_perf",
|
|
99
|
-
metrics
|
|
100
|
-
fcp: (_b2 = metrics.fcp) != null ? _b2 : 0,
|
|
101
|
-
lcp: (_d = (_c2 = metrics.lcp) != null ? _c2 : metrics.fcp) != null ? _d : 0,
|
|
102
|
-
load: Math.round((_e = nav.loadEventEnd) != null ? _e : 0),
|
|
103
|
-
dom_ready: Math.round((_f = nav.domContentLoadedEventEnd) != null ? _f : 0),
|
|
104
|
-
transfer_size: res.reduce((s, e) => {
|
|
105
|
-
var _a4;
|
|
106
|
-
return s + ((_a4 = e.transferSize) != null ? _a4 : 0);
|
|
107
|
-
}, 0)
|
|
108
|
-
},
|
|
109
|
-
categories: {}
|
|
360
|
+
metrics
|
|
110
361
|
});
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
window.addEventListener("load", () => {
|
|
114
|
-
setTimeout(send, 500);
|
|
115
|
-
});
|
|
362
|
+
}, "send");
|
|
363
|
+
window.addEventListener("load", () => setTimeout(send, 500));
|
|
116
364
|
setTimeout(send, 15e3);
|
|
117
365
|
}
|
|
118
366
|
__name(bootstrap, "bootstrap");
|
|
367
|
+
function getBufferedFcpStartTime() {
|
|
368
|
+
var _a2;
|
|
369
|
+
const paintEntries = performance.getEntriesByType("paint");
|
|
370
|
+
const fcp = paintEntries.find((entry) => entry.name === "first-contentful-paint");
|
|
371
|
+
return (_a2 = fcp == null ? void 0 : fcp.startTime) != null ? _a2 : null;
|
|
372
|
+
}
|
|
373
|
+
__name(getBufferedFcpStartTime, "getBufferedFcpStartTime");
|
|
119
374
|
|
|
120
375
|
// src/register-inspector-id.ts
|
|
121
376
|
function registerInspectorIdPlugin() {
|
|
@@ -264,7 +519,7 @@ var MiaodaRuntime = (() => {
|
|
|
264
519
|
return String(BigInt(msInt) * BigInt(1e6));
|
|
265
520
|
}
|
|
266
521
|
__name(toNanoString, "toNanoString");
|
|
267
|
-
var SDK_VERSION = "1.0.
|
|
522
|
+
var SDK_VERSION = "1.0.1";
|
|
268
523
|
function buildPayload(dataPoints, overrides) {
|
|
269
524
|
const defaultAttrs = getDefaultAttributes(overrides);
|
|
270
525
|
const nowNs = toNanoString(Date.now());
|
|
@@ -506,13 +761,14 @@ var MiaodaRuntime = (() => {
|
|
|
506
761
|
__name(initCreativePvTracking, "initCreativePvTracking");
|
|
507
762
|
|
|
508
763
|
// src/design-runtime.ts
|
|
509
|
-
var version = "0.0.12
|
|
764
|
+
var version = "0.0.12";
|
|
510
765
|
var name = "@lark-apaas/miaoda-coding-sdk";
|
|
511
766
|
if (!window.__CREATIVITY_RUNTIME__) {
|
|
512
767
|
window.__CREATIVITY_RUNTIME__ = true;
|
|
513
768
|
registerInspectorIdPlugin();
|
|
514
769
|
initCreativePerf();
|
|
515
770
|
initCreativePvTracking();
|
|
771
|
+
initCreativeBabelStages();
|
|
516
772
|
}
|
|
517
773
|
return __toCommonJS(design_runtime_exports);
|
|
518
774
|
})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var MiaodaRuntime=(()=>{var _=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var $=Object.prototype.hasOwnProperty;var n=(e,t)=>_(e,"name",{value:t,configurable:!0});var F=(e,t)=>{for(var i in t)_(e,i,{get:t[i],enumerable:!0})},B=(e,t,i,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of O(t))!$.call(e,o)&&o!==i&&_(e,o,{get:()=>t[o],enumerable:!(c=D(t,o))||c.enumerable});return e};var U=e=>B(_({},"__esModule",{value:!0}),e);var tt={};F(tt,{name:()=>Z,version:()=>W});var V="https://lf3-short.ibytedapm.com/slardar/fe/sdk-web/browser.cn.js",I=!1;function S(){if(I)return;if(I=!0,window.Slardar){P();return}let e=document.createElement("script");e.src=V,e.onload=()=>{window.Slardar&&P()},e.onerror=()=>{},document.head.appendChild(e)}n(S,"initCreativePerf");function P(){var o,s,u;let e=window.Slardar;if(!e)return;e("context.merge",{app_id:(o=window.__appId__)!=null?o:"",creative_type:(s=window.__creativeType__)!=null?s:"unknown",is_public:String((u=window.__isExternallyVisible__)!=null?u:!1)}),e("init",{bid:"apaas_miaoda",env:window.ENVIRONMENT||"online"}),e("start");let t={},i=!1;try{new PerformanceObserver(a=>{let r=a.getEntries();for(let l=0;l<r.length;l++)r[l].name==="first-contentful-paint"&&(t.fcp=Math.round(r[l].startTime))}).observe({type:"paint",buffered:!0})}catch{}try{new PerformanceObserver(a=>{let r=a.getEntries();r.length&&(t.lcp=Math.round(r[r.length-1].startTime))}).observe({type:"largest-contentful-paint",buffered:!0})}catch{}function c(){var l,p,m,h,d,g;if(i||!window.Slardar)return;i=!0;let a=(l=performance.getEntriesByType("navigation")[0])!=null?l:{},r=performance.getEntriesByType("resource");window.Slardar("sendEvent",{name:"creative_perf",metrics:{fcp:(p=t.fcp)!=null?p:0,lcp:(h=(m=t.lcp)!=null?m:t.fcp)!=null?h:0,load:Math.round((d=a.loadEventEnd)!=null?d:0),dom_ready:Math.round((g=a.domContentLoadedEventEnd)!=null?g:0),transfer_size:r.reduce((w,y)=>{var v;return w+((v=y.transferSize)!=null?v:0)},0)},categories:{}})}n(c,"send"),window.addEventListener("load",()=>{setTimeout(c,500)}),setTimeout(c,15e3)}n(P,"bootstrap");function A(){let e="inspector-id";document.addEventListener("DOMContentLoaded",()=>{let t=window.Babel;if(!t||!t.registerPlugin)return;let i=null,c=n(()=>{let s={},u=0;return document.querySelectorAll('script[type="text/babel"],script[type="text/jsx"]').forEach(a=>{let r=a.getAttribute("src");if(r){let l=r.split("?")[0],p=l.split("/").pop()||l;s[p]=p in s?"":l}else{u++;let l=u===1?"Inline Babel script":`Inline Babel script (${u})`;s[l]=a.getAttribute("data-filename")||`inline-${u-1}`}}),s},"buildFileMap");t.availablePlugins&&delete t.availablePlugins[e],t.registerPlugin(e,({types:s})=>({visitor:{JSXOpeningElement(u,a){let r=u.node;if(r.name&&r.name.type==="JSXMemberExpression")return;for(let b=0;b<r.attributes.length;b++){let E=r.attributes[b];if(E.type==="JSXAttribute"&&E.name&&E.name.name==="data-inspector-id")return}let l=a.file&&a.file.opts&&a.file.opts.filename||"?";i===null&&(i=c());let p=l.split("?")[0],m=p.split("/").pop()||p,h=i[l]||i[m]||p.replace(/^\/?[a-z][a-z0-9+.-]*:\/{1,2}[^/]+/i,"").replace(/^\/+/,"")||l,d=r.loc&&r.loc.start,g=d?d.line:0,w=d?d.column+1:0,y=r.name&&r.name.type==="JSXIdentifier"?r.name.name:h,v=`jsx:${h}:${y}:${g}:${w}`;r.attributes.push(s.jsxAttribute(s.jsxIdentifier("data-inspector-id"),s.stringLiteral(v)))}}}));let o="";try{let s=document.getElementById("__srcmap");if(s&&s.textContent){let u=JSON.parse(s.textContent),a=u==null?void 0:u.file;typeof a=="string"&&(o=a)}}catch{}document.querySelectorAll('script[type="text/babel"],script[type="text/jsx"]').forEach((s,u)=>{let a=s.getAttribute("data-plugins")||"";if(a.indexOf(e)<0&&s.setAttribute("data-plugins",a?`${a},${e}`:e),!s.hasAttribute("data-filename")){let r=o?`${o}#inline-${u}`:`inline-${u}`;s.setAttribute("data-filename",s.getAttribute("src")||r)}})})}n(A,"registerInspectorIdPlugin");function k(){if(typeof crypto!="undefined"&&crypto.getRandomValues){let t=new Uint8Array(8);return crypto.getRandomValues(t),Array.from(t).map(i=>i.toString(16).padStart(2,"0")).join("")}let e="";for(let t=0;t<16;t++)e+=Math.floor(Math.random()*16).toString(16);return e}n(k,"generateUUID");var x="x_sdk_device_id";function j(){try{let e=localStorage.getItem(x);return e||(e=k(),localStorage.setItem(x,e)),e}catch{return k()}}n(j,"getDeviceId");function K(){let e=typeof navigator!="undefined"?navigator.userAgent:"";return e&&(/Android/i.test(e)&&/Mobile/i.test(e)||/iPhone|iPod/i.test(e)||/BlackBerry|IEMobile|Opera Mini/i.test(e))?"mobile":"desktop"}n(K,"getDeviceType");var J="pageSessionID";function X(){try{return new URLSearchParams(window.location.search).get(J)||""}catch{return""}}n(X,"getPvId");function z(e={}){let t=e.pvId||X();return{app_id:window.appId||"",tenant_id:window.tenantId||"",user_id:window.userId||"",did:j(),module:"app_web",app_env:"runtime",source_type:"user",device_type:K(),release_commit_id:window.__RELEASE_COMMIT_ID__||"",...t?{pv_id:t}:{}}}n(z,"getDefaultAttributes");function N(e){let t=Math.round(e);if(!Number.isFinite(t))throw new RangeError(`toNanoString: \u975E\u6CD5\u65F6\u95F4\u6233 ${e}`);return typeof BigInt!="function"?t===0?"0":`${t}000000`:String(BigInt(t)*BigInt(1e6))}n(N,"toNanoString");var H="1.0.2-alpha.20260831083248";function q(e,t){let i=z(t),c=N(Date.now());return{metricsData:{resource:{attributes:{sdk_version:H,sdk_lang:"javascript",sdk_type:"client-frontend"}},metrics:[{name:"apaas_internal_metrics_pv_uv",description:"Count of page views",unit:"",scopeName:"apaas_internal_metrics_pv_uv",sum:{aggregationTemporality:1,isMonotonic:!0,dataPoints:e.map(o=>({attributes:{...i,url:o.url,path:o.path,referrer:o.referrer},startTimeUnixNano:N(o.timestampMs),timeUnixNano:c,asDouble:1}))}}]}}}n(q,"buildPayload");function G(e,t,i={},c){if(t.length===0)return;let o;try{o=JSON.stringify(q(t,c))}catch{return}try{fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-Suda-Csrf-Token":window.csrfToken||"",...i},body:o,keepalive:!0}).catch(()=>{})}catch{}}n(G,"sendPvData");var T="__APAAS_PV_TRACKER_STARTED__";function Q(){try{let e=window;return e[T]?!1:(e[T]=!0,!0)}catch{return!0}}n(Q,"claimPvReporting");function R(){try{window[T]=!1}catch{}}n(R,"releasePvReporting");var f,Y=(f=class{constructor(){this.started=!1,this.disposers=[],this.holdsPvReporting=!1,this.buffer=[]}static get instance(){return this._instance||(this._instance=new f),this._instance}start(t){var i;if(!this.started&&Q()){this.holdsPvReporting=!0,this.config=t,this.started=!0;try{this.listenRouteChanges(),this.registerLifecycleListeners();let c=(i=t.flushIntervalMs)!=null?i:1e4;this.flushTimer=setInterval(()=>this.flush(),c)}catch(c){throw this.started=!1,this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=void 0),this.holdsPvReporting=!1,R(),c}}}shutdown(){this.flush(),this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=void 0),this.firstFlushTimer&&(clearTimeout(this.firstFlushTimer),this.firstFlushTimer=void 0),this.started=!1;for(let t of this.disposers.splice(0))try{t()}catch{}this.holdsPvReporting&&(this.holdsPvReporting=!1,R())}pageKey(){let{origin:t,pathname:i,search:c}=window.location;return`${t}${i}${c}`}scheduleFirstFlush(){var t;let i=(t=this.config)==null?void 0:t.firstFlushDelayMs;i==null||this.firstFlushTimer||(this.firstFlushTimer=setTimeout(()=>this.flush(),i))}recordPv(){let t=this.pageKey();this.lastKey!==t&&(this.lastKey=t,this.buffer.push({url:window.location.href,path:window.location.pathname,referrer:document.referrer,timestampMs:Date.now()}),this.scheduleFirstFlush())}flush(){if(!this.config||this.buffer.length===0)return;let t=this.buffer.splice(0);G(this.config.collectorUrl,t,this.config.headers,{pvId:this.config.pvId})}listenRouteChanges(){this.recordPv();let t=n(()=>this.recordPv(),"onPopState");window.addEventListener("popstate",t),this.disposers.push(()=>window.removeEventListener("popstate",t)),this.patchHistory("pushState"),this.patchHistory("replaceState")}patchHistory(t){let i=history[t],c=n(()=>this.recordPv(),"recordPv");history[t]=function(...o){let s=i.apply(this,o);return c(),s},this.disposers.push(()=>{history[t]=i})}registerLifecycleListeners(){let t=n(()=>{document.visibilityState==="hidden"&&this.flush()},"onVisibilityChange");document.addEventListener("visibilitychange",t),this.disposers.push(()=>document.removeEventListener("visibilitychange",t));let i=n(()=>this.flush(),"onPageHide");window.addEventListener("pagehide",i),this.disposers.push(()=>window.removeEventListener("pagehide",i))}},n(f,"_PvTracker"),f),M=Y.instance;function C(){return window.appId||null}n(C,"getAppId");function L(){var t;let e=(t=C())!=null?t:"";M.start({collectorUrl:`/app/${e}/__runtime__/api/v1/observability/metrics/collect`,firstFlushDelayMs:1e3})}n(L,"initCreativePvTracking");var W="0.0.12-alpha.20260831083241",Z="@lark-apaas/miaoda-coding-sdk";window.__CREATIVITY_RUNTIME__||(window.__CREATIVITY_RUNTIME__=!0,A(),S(),L());return U(tt);})();
|
|
1
|
+
"use strict";var MiaodaRuntime=(()=>{var y=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var i=(t,e)=>y(t,"name",{value:e,configurable:!0});var H=(t,e)=>{for(var r in e)y(t,r,{get:e[r],enumerable:!0})},K=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of V(e))!j.call(t,o)&&o!==r&&y(t,o,{get:()=>e[o],enumerable:!(n=U(e,o))||n.enumerable});return t};var J=t=>K(y({},"__esModule",{value:!0}),t);var _e={};H(_e,{name:()=>me,version:()=>he});var X=new Set(["text/babel","text/jsx"]),z=3e3,Y=15e3,q=1e3,G=20,P=!1;function A(){P||(P=!0,document.addEventListener("DOMContentLoaded",Q,{once:!0}))}i(A,"initCreativeBabelStages");function Q(){let t=W();if(!t.length)return;let e={fetchDur:0,transformDur:0,evalDur:0,externalCount:t.filter(o=>o.src).length},r={sent:!1,scriptsDone:!1,scriptsDoneAt:null,totalStart:null,renderStart:null,renderDur:null,takeover:!1,retries:0,hardTimer:null},n=window.Babel;if(!n||typeof n.transform!="function"||typeof n.disableScriptTags!="function"||e.externalCount>0&&typeof fetch!="function"){r.scriptsDone=!0,m(e,r);return}try{n.disableScriptTags()}catch{r.scriptsDone=!0,m(e,r);return}r.takeover=!0,r.totalStart=performance.now(),r.hardTimer=setTimeout(()=>m(e,r),Y),te(e,r),ee(n,t,e,r)}i(Q,"onDomContentLoaded");function W(){let t=document.getElementsByTagName("script"),e=[];for(let r=0;r<t.length;r++){let n=t[r];X.has((n.type||"").split(";")[0])&&e.push(n)}return e}i(W,"collectBabelScripts");function T(t,e){let r=t.getAttribute(e);return r===""?[]:r?r.split(",").map(n=>n.trim()):null}i(T,"attrList");function Z(t,e){var o,a,c;let r=t.getAttribute("data-type"),n={browsers:(o=T(t,"data-targets"))!=null?o:void 0};return r==="module"&&(n.esmodules="intersect"),{filename:e,presets:(a=T(t,"data-presets"))!=null?a:r==="module"?["react",["env",{modules:!1}]]:["react","env"],plugins:(c=T(t,"data-plugins"))!=null?c:["transform-class-properties","transform-object-rest-spread","transform-flow-strip-types"],sourceMaps:"inline",sourceFileName:e,targets:n}}i(Z,"buildOptions");function ee(t,e,r,n){let o=0,a=i((l,d)=>{var h;let p;if(l.src)p=l.src;else{let f=l.getAttribute("data-module");f?p=f:(o++,p=o===1?"Inline Babel script":`Inline Babel script (${o})`)}try{let f=performance.now(),g=t.transform(d,Z(l,p)),b=performance.now(),v=document.createElement("script"),w=l.getAttribute("data-type");w&&v.setAttribute("type",w),l.nonce&&(v.nonce=l.nonce),v.text=(h=g==null?void 0:g.code)!=null?h:"",document.head.appendChild(v),r.transformDur+=b-f,r.evalDur+=performance.now()-b}catch(f){console.error("[creative-babel-stages] script failed:",p,f)}},"runOne"),c=0;for(;c<e.length&&!e[c].src;)a(e[c],e[c].innerHTML),c++;if(c>=e.length){D(r,n);return}let u=e.slice(c),s=u.map(l=>{if(!l.src)return Promise.resolve(l.innerHTML);let d=performance.now();return fetch(l.src).then(p=>{if(!p.ok)throw new Error(`HTTP ${p.status}`);return p.text()}).then(p=>(r.fetchDur+=performance.now()-d,p))});(async()=>{for(let l=0;l<u.length;l++){let d=null;try{d=await s[l]}catch(p){console.error("[creative-babel-stages] load failed:",u[l].src,p);continue}a(u[l],d)}D(r,n)})()}i(ee,"runScripts");function te(t,e){let r=window.ReactDOM;if(!r)return;let n=i(c=>{if(e.renderStart===null){e.renderStart=performance.now();try{let u=new MutationObserver(()=>{u.disconnect(),e.renderDur=performance.now()-e.renderStart,e.scriptsDone&&m(t,e)});u.observe(c,{childList:!0,subtree:!0})}catch{}}},"observeCommit"),o=r.createRoot;typeof o=="function"&&(r.createRoot=(c,u)=>{let s=o.call(r,c,u),l=s.render.bind(s);return s.render=d=>(n(c),l(d)),s});let a=r.render;typeof a=="function"&&(r.render=(c,u,s)=>(n(u),a.call(r,c,u,s)))}i(te,"instrumentRender");function D(t,e){e.scriptsDone=!0,e.scriptsDoneAt=performance.now(),e.renderStart===null||e.renderDur!==null?m(t,e):setTimeout(()=>m(t,e),z)}i(D,"onScriptsDone");function m(t,e){var a;if(e.sent)return;let r=window.Slardar;if(!r){e.retries++<G&&setTimeout(()=>m(t,e),q);return}e.sent=!0,e.hardTimer!==null&&clearTimeout(e.hardTimer);let n=e.renderDur!==null&&e.renderStart!==null?e.renderStart+e.renderDur:(a=e.scriptsDoneAt)!=null?a:performance.now(),o=e.totalStart===null?0:Math.max(0,n-e.totalStart);r("sendEvent",{name:"creative_babel_stages",metrics:{babel_total_dur:Math.round(o),babel_fetch_dur:Math.round(t.fetchDur),babel_transform_dur:Math.round(t.transformDur),babel_eval_dur:Math.round(t.evalDur)},categories:{takeover:String(e.takeover),external:String(t.externalCount>0),render_observed:String(e.renderDur!==null)}})}i(m,"trySend");var re="https://lf3-short.ibytedapm.com/slardar/fe/sdk-web/browser.cn.js",R=!1;function M(){if(R)return;if(R=!0,window.Slardar){x();return}let t=document.createElement("script");t.src=re,t.onload=()=>{window.Slardar&&x()},t.onerror=()=>{},document.head.appendChild(t)}i(M,"initCreativePerf");function x(){var o,a,c;let t=window.Slardar;if(!t)return;let e=null;t("context.merge",{app_id:(o=window.__appId__)!=null?o:"",creative_type:(a=window.__creativeType__)!=null?a:"unknown",is_public:String((c=window.__isExternallyVisible__)!=null?c:!1)}),t("init",{bid:"apaas_miaoda",env:window.ENVIRONMENT||"online"}),t("start");try{new PerformanceObserver(u=>{for(let s of u.getEntries())if(s.name==="first-contentful-paint"){e=s.startTime,t("context.merge",{has_painted:"true"});break}}).observe({type:"paint",buffered:!0})}catch{}let r=!1,n=i(()=>{if(r||!window.Slardar)return;r=!0;let u=performance.getEntriesByType("resource"),s=performance.getEntriesByType("navigation")[0],l=e!=null?e:ne(),d={transfer_size:u.reduce((p,h)=>{var f;return p+((f=h.transferSize)!=null?f:0)},0)};s&&s.domContentLoadedEventEnd>=s.responseStart&&(d.ttfb_to_dom_ready_dur=Math.round(s.domContentLoadedEventEnd-s.responseStart)),s&&l!==null&&l>=s.domContentLoadedEventEnd&&(d.render_to_fcp_dur=Math.round(l-s.domContentLoadedEventEnd)),window.Slardar("sendEvent",{name:"creative_perf",metrics:d})},"send");window.addEventListener("load",()=>setTimeout(n,500)),setTimeout(n,15e3)}i(x,"bootstrap");function ne(){var r;let e=performance.getEntriesByType("paint").find(n=>n.name==="first-contentful-paint");return(r=e==null?void 0:e.startTime)!=null?r:null}i(ne,"getBufferedFcpStartTime");function k(){let t="inspector-id";document.addEventListener("DOMContentLoaded",()=>{let e=window.Babel;if(!e||!e.registerPlugin)return;let r=null,n=i(()=>{let a={},c=0;return document.querySelectorAll('script[type="text/babel"],script[type="text/jsx"]').forEach(u=>{let s=u.getAttribute("src");if(s){let l=s.split("?")[0],d=l.split("/").pop()||l;a[d]=d in a?"":l}else{c++;let l=c===1?"Inline Babel script":`Inline Babel script (${c})`;a[l]=u.getAttribute("data-filename")||`inline-${c-1}`}}),a},"buildFileMap");e.availablePlugins&&delete e.availablePlugins[t],e.registerPlugin(t,({types:a})=>({visitor:{JSXOpeningElement(c,u){let s=c.node;if(s.name&&s.name.type==="JSXMemberExpression")return;for(let E=0;E<s.attributes.length;E++){let S=s.attributes[E];if(S.type==="JSXAttribute"&&S.name&&S.name.name==="data-inspector-id")return}let l=u.file&&u.file.opts&&u.file.opts.filename||"?";r===null&&(r=n());let d=l.split("?")[0],p=d.split("/").pop()||d,h=r[l]||r[p]||d.replace(/^\/?[a-z][a-z0-9+.-]*:\/{1,2}[^/]+/i,"").replace(/^\/+/,"")||l,f=s.loc&&s.loc.start,g=f?f.line:0,b=f?f.column+1:0,v=s.name&&s.name.type==="JSXIdentifier"?s.name.name:h,w=`jsx:${h}:${v}:${g}:${b}`;s.attributes.push(a.jsxAttribute(a.jsxIdentifier("data-inspector-id"),a.stringLiteral(w)))}}}));let o="";try{let a=document.getElementById("__srcmap");if(a&&a.textContent){let c=JSON.parse(a.textContent),u=c==null?void 0:c.file;typeof u=="string"&&(o=u)}}catch{}document.querySelectorAll('script[type="text/babel"],script[type="text/jsx"]').forEach((a,c)=>{let u=a.getAttribute("data-plugins")||"";if(u.indexOf(t)<0&&a.setAttribute("data-plugins",u?`${u},${t}`:t),!a.hasAttribute("data-filename")){let s=o?`${o}#inline-${c}`:`inline-${c}`;a.setAttribute("data-filename",a.getAttribute("src")||s)}})})}i(k,"registerInspectorIdPlugin");function C(){if(typeof crypto!="undefined"&&crypto.getRandomValues){let e=new Uint8Array(8);return crypto.getRandomValues(e),Array.from(e).map(r=>r.toString(16).padStart(2,"0")).join("")}let t="";for(let e=0;e<16;e++)t+=Math.floor(Math.random()*16).toString(16);return t}i(C,"generateUUID");var L="x_sdk_device_id";function ie(){try{let t=localStorage.getItem(L);return t||(t=C(),localStorage.setItem(L,t)),t}catch{return C()}}i(ie,"getDeviceId");function oe(){let t=typeof navigator!="undefined"?navigator.userAgent:"";return t&&(/Android/i.test(t)&&/Mobile/i.test(t)||/iPhone|iPod/i.test(t)||/BlackBerry|IEMobile|Opera Mini/i.test(t))?"mobile":"desktop"}i(oe,"getDeviceType");var se="pageSessionID";function ae(){try{return new URLSearchParams(window.location.search).get(se)||""}catch{return""}}i(ae,"getPvId");function ce(t={}){let e=t.pvId||ae();return{app_id:window.appId||"",tenant_id:window.tenantId||"",user_id:window.userId||"",did:ie(),module:"app_web",app_env:"runtime",source_type:"user",device_type:oe(),release_commit_id:window.__RELEASE_COMMIT_ID__||"",...e?{pv_id:e}:{}}}i(ce,"getDefaultAttributes");function N(t){let e=Math.round(t);if(!Number.isFinite(e))throw new RangeError(`toNanoString: \u975E\u6CD5\u65F6\u95F4\u6233 ${t}`);return typeof BigInt!="function"?e===0?"0":`${e}000000`:String(BigInt(e)*BigInt(1e6))}i(N,"toNanoString");var le="1.0.1";function ue(t,e){let r=ce(e),n=N(Date.now());return{metricsData:{resource:{attributes:{sdk_version:le,sdk_lang:"javascript",sdk_type:"client-frontend"}},metrics:[{name:"apaas_internal_metrics_pv_uv",description:"Count of page views",unit:"",scopeName:"apaas_internal_metrics_pv_uv",sum:{aggregationTemporality:1,isMonotonic:!0,dataPoints:t.map(o=>({attributes:{...r,url:o.url,path:o.path,referrer:o.referrer},startTimeUnixNano:N(o.timestampMs),timeUnixNano:n,asDouble:1}))}}]}}}i(ue,"buildPayload");function de(t,e,r={},n){if(e.length===0)return;let o;try{o=JSON.stringify(ue(e,n))}catch{return}try{fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-Suda-Csrf-Token":window.csrfToken||"",...r},body:o,keepalive:!0}).catch(()=>{})}catch{}}i(de,"sendPvData");var I="__APAAS_PV_TRACKER_STARTED__";function pe(){try{let t=window;return t[I]?!1:(t[I]=!0,!0)}catch{return!0}}i(pe,"claimPvReporting");function B(){try{window[I]=!1}catch{}}i(B,"releasePvReporting");var _,fe=(_=class{constructor(){this.started=!1,this.disposers=[],this.holdsPvReporting=!1,this.buffer=[]}static get instance(){return this._instance||(this._instance=new _),this._instance}start(e){var r;if(!this.started&&pe()){this.holdsPvReporting=!0,this.config=e,this.started=!0;try{this.listenRouteChanges(),this.registerLifecycleListeners();let n=(r=e.flushIntervalMs)!=null?r:1e4;this.flushTimer=setInterval(()=>this.flush(),n)}catch(n){throw this.started=!1,this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=void 0),this.holdsPvReporting=!1,B(),n}}}shutdown(){this.flush(),this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=void 0),this.firstFlushTimer&&(clearTimeout(this.firstFlushTimer),this.firstFlushTimer=void 0),this.started=!1;for(let e of this.disposers.splice(0))try{e()}catch{}this.holdsPvReporting&&(this.holdsPvReporting=!1,B())}pageKey(){let{origin:e,pathname:r,search:n}=window.location;return`${e}${r}${n}`}scheduleFirstFlush(){var e;let r=(e=this.config)==null?void 0:e.firstFlushDelayMs;r==null||this.firstFlushTimer||(this.firstFlushTimer=setTimeout(()=>this.flush(),r))}recordPv(){let e=this.pageKey();this.lastKey!==e&&(this.lastKey=e,this.buffer.push({url:window.location.href,path:window.location.pathname,referrer:document.referrer,timestampMs:Date.now()}),this.scheduleFirstFlush())}flush(){if(!this.config||this.buffer.length===0)return;let e=this.buffer.splice(0);de(this.config.collectorUrl,e,this.config.headers,{pvId:this.config.pvId})}listenRouteChanges(){this.recordPv();let e=i(()=>this.recordPv(),"onPopState");window.addEventListener("popstate",e),this.disposers.push(()=>window.removeEventListener("popstate",e)),this.patchHistory("pushState"),this.patchHistory("replaceState")}patchHistory(e){let r=history[e],n=i(()=>this.recordPv(),"recordPv");history[e]=function(...o){let a=r.apply(this,o);return n(),a},this.disposers.push(()=>{history[e]=r})}registerLifecycleListeners(){let e=i(()=>{document.visibilityState==="hidden"&&this.flush()},"onVisibilityChange");document.addEventListener("visibilitychange",e),this.disposers.push(()=>document.removeEventListener("visibilitychange",e));let r=i(()=>this.flush(),"onPageHide");window.addEventListener("pagehide",r),this.disposers.push(()=>window.removeEventListener("pagehide",r))}},i(_,"_PvTracker"),_),O=fe.instance;function F(){return window.appId||null}i(F,"getAppId");function $(){var e;let t=(e=F())!=null?e:"";O.start({collectorUrl:`/app/${t}/__runtime__/api/v1/observability/metrics/collect`,firstFlushDelayMs:1e3})}i($,"initCreativePvTracking");var he="0.0.12",me="@lark-apaas/miaoda-coding-sdk";window.__CREATIVITY_RUNTIME__||(window.__CREATIVITY_RUNTIME__=!0,k(),M(),$(),A());return J(_e);})();
|
|
@@ -1166,7 +1166,7 @@ var MiaodaRuntime = (() => {
|
|
|
1166
1166
|
return String(BigInt(msInt) * BigInt(1e6));
|
|
1167
1167
|
}
|
|
1168
1168
|
__name(toNanoString, "toNanoString");
|
|
1169
|
-
var SDK_VERSION = "1.0.
|
|
1169
|
+
var SDK_VERSION = "1.0.1";
|
|
1170
1170
|
function buildPayload(dataPoints, overrides) {
|
|
1171
1171
|
const defaultAttrs = getDefaultAttributes(overrides);
|
|
1172
1172
|
const nowNs = toNanoString(Date.now());
|
|
@@ -1711,7 +1711,7 @@ var MiaodaRuntime = (() => {
|
|
|
1711
1711
|
__name(mountDoubaoWatermark, "mountDoubaoWatermark");
|
|
1712
1712
|
|
|
1713
1713
|
// src/doubao-runtime.ts
|
|
1714
|
-
var version = "0.0.12
|
|
1714
|
+
var version = "0.0.12";
|
|
1715
1715
|
var name = "@lark-apaas/miaoda-coding-sdk";
|
|
1716
1716
|
if (isOnlineEnv()) {
|
|
1717
1717
|
reportPageView();
|
package/dist/doubao-runtime.js
CHANGED
|
@@ -1166,7 +1166,7 @@ var MiaodaRuntime = (() => {
|
|
|
1166
1166
|
return String(BigInt(msInt) * BigInt(1e6));
|
|
1167
1167
|
}
|
|
1168
1168
|
__name(toNanoString, "toNanoString");
|
|
1169
|
-
var SDK_VERSION = "1.0.
|
|
1169
|
+
var SDK_VERSION = "1.0.1";
|
|
1170
1170
|
function buildPayload(dataPoints, overrides) {
|
|
1171
1171
|
const defaultAttrs = getDefaultAttributes(overrides);
|
|
1172
1172
|
const nowNs = toNanoString(Date.now());
|
|
@@ -1711,7 +1711,7 @@ var MiaodaRuntime = (() => {
|
|
|
1711
1711
|
__name(mountDoubaoWatermark, "mountDoubaoWatermark");
|
|
1712
1712
|
|
|
1713
1713
|
// src/doubao-runtime.ts
|
|
1714
|
-
var version = "0.0.12
|
|
1714
|
+
var version = "0.0.12";
|
|
1715
1715
|
var name = "@lark-apaas/miaoda-coding-sdk";
|
|
1716
1716
|
if (isOnlineEnv()) {
|
|
1717
1717
|
reportPageView();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var MiaodaRuntime=(()=>{var we=Object.create;var R=Object.defineProperty;var xe=Object.getOwnPropertyDescriptor;var Ce=Object.getOwnPropertyNames;var Se=Object.getPrototypeOf,ke=Object.prototype.hasOwnProperty;var i=(n,e)=>R(n,"name",{value:e,configurable:!0});var z=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),Ee=(n,e)=>{for(var o in e)R(n,o,{get:e[o],enumerable:!0})},J=(n,e,o,h)=>{if(e&&typeof e=="object"||typeof e=="function")for(let p of Ce(e))!ke.call(n,p)&&p!==o&&R(n,p,{get:()=>e[p],enumerable:!(h=xe(e,p))||h.enumerable});return n};var q=(n,e,o)=>(o=n!=null?we(Se(n)):{},J(e||!n||!n.__esModule?R(o,"default",{value:n,enumerable:!0}):o,n)),Ie=n=>J(R({},"__esModule",{value:!0}),n);var Y=z((X,O)=>{"use strict";(function(n){"use strict";function e(t,f){var r=(t&65535)+(f&65535),b=(t>>16)+(f>>16)+(r>>16);return b<<16|r&65535}i(e,"safeAdd");function o(t,f){return t<<f|t>>>32-f}i(o,"bitRotateLeft");function h(t,f,r,b,w,S){return e(o(e(e(f,t),e(b,S)),w),r)}i(h,"md5cmn");function p(t,f,r,b,w,S,A){return h(f&r|~f&b,t,f,w,S,A)}i(p,"md5ff");function g(t,f,r,b,w,S,A){return h(f&b|r&~b,t,f,w,S,A)}i(g,"md5gg");function v(t,f,r,b,w,S,A){return h(f^r^b,t,f,w,S,A)}i(v,"md5hh");function y(t,f,r,b,w,S,A){return h(r^(f|~b),t,f,w,S,A)}i(y,"md5ii");function k(t,f){t[f>>5]|=128<<f%32,t[(f+64>>>9<<4)+14]=f;var r,b,w,S,A,a=1732584193,s=-271733879,c=-1732584194,l=271733878;for(r=0;r<t.length;r+=16)b=a,w=s,S=c,A=l,a=p(a,s,c,l,t[r],7,-680876936),l=p(l,a,s,c,t[r+1],12,-389564586),c=p(c,l,a,s,t[r+2],17,606105819),s=p(s,c,l,a,t[r+3],22,-1044525330),a=p(a,s,c,l,t[r+4],7,-176418897),l=p(l,a,s,c,t[r+5],12,1200080426),c=p(c,l,a,s,t[r+6],17,-1473231341),s=p(s,c,l,a,t[r+7],22,-45705983),a=p(a,s,c,l,t[r+8],7,1770035416),l=p(l,a,s,c,t[r+9],12,-1958414417),c=p(c,l,a,s,t[r+10],17,-42063),s=p(s,c,l,a,t[r+11],22,-1990404162),a=p(a,s,c,l,t[r+12],7,1804603682),l=p(l,a,s,c,t[r+13],12,-40341101),c=p(c,l,a,s,t[r+14],17,-1502002290),s=p(s,c,l,a,t[r+15],22,1236535329),a=g(a,s,c,l,t[r+1],5,-165796510),l=g(l,a,s,c,t[r+6],9,-1069501632),c=g(c,l,a,s,t[r+11],14,643717713),s=g(s,c,l,a,t[r],20,-373897302),a=g(a,s,c,l,t[r+5],5,-701558691),l=g(l,a,s,c,t[r+10],9,38016083),c=g(c,l,a,s,t[r+15],14,-660478335),s=g(s,c,l,a,t[r+4],20,-405537848),a=g(a,s,c,l,t[r+9],5,568446438),l=g(l,a,s,c,t[r+14],9,-1019803690),c=g(c,l,a,s,t[r+3],14,-187363961),s=g(s,c,l,a,t[r+8],20,1163531501),a=g(a,s,c,l,t[r+13],5,-1444681467),l=g(l,a,s,c,t[r+2],9,-51403784),c=g(c,l,a,s,t[r+7],14,1735328473),s=g(s,c,l,a,t[r+12],20,-1926607734),a=v(a,s,c,l,t[r+5],4,-378558),l=v(l,a,s,c,t[r+8],11,-2022574463),c=v(c,l,a,s,t[r+11],16,1839030562),s=v(s,c,l,a,t[r+14],23,-35309556),a=v(a,s,c,l,t[r+1],4,-1530992060),l=v(l,a,s,c,t[r+4],11,1272893353),c=v(c,l,a,s,t[r+7],16,-155497632),s=v(s,c,l,a,t[r+10],23,-1094730640),a=v(a,s,c,l,t[r+13],4,681279174),l=v(l,a,s,c,t[r],11,-358537222),c=v(c,l,a,s,t[r+3],16,-722521979),s=v(s,c,l,a,t[r+6],23,76029189),a=v(a,s,c,l,t[r+9],4,-640364487),l=v(l,a,s,c,t[r+12],11,-421815835),c=v(c,l,a,s,t[r+15],16,530742520),s=v(s,c,l,a,t[r+2],23,-995338651),a=y(a,s,c,l,t[r],6,-198630844),l=y(l,a,s,c,t[r+7],10,1126891415),c=y(c,l,a,s,t[r+14],15,-1416354905),s=y(s,c,l,a,t[r+5],21,-57434055),a=y(a,s,c,l,t[r+12],6,1700485571),l=y(l,a,s,c,t[r+3],10,-1894986606),c=y(c,l,a,s,t[r+10],15,-1051523),s=y(s,c,l,a,t[r+1],21,-2054922799),a=y(a,s,c,l,t[r+8],6,1873313359),l=y(l,a,s,c,t[r+15],10,-30611744),c=y(c,l,a,s,t[r+6],15,-1560198380),s=y(s,c,l,a,t[r+13],21,1309151649),a=y(a,s,c,l,t[r+4],6,-145523070),l=y(l,a,s,c,t[r+11],10,-1120210379),c=y(c,l,a,s,t[r+2],15,718787259),s=y(s,c,l,a,t[r+9],21,-343485551),a=e(a,b),s=e(s,w),c=e(c,S),l=e(l,A);return[a,s,c,l]}i(k,"binlMD5");function L(t){var f,r="",b=t.length*32;for(f=0;f<b;f+=8)r+=String.fromCharCode(t[f>>5]>>>f%32&255);return r}i(L,"binl2rstr");function x(t){var f,r=[];for(r[(t.length>>2)-1]=void 0,f=0;f<r.length;f+=1)r[f]=0;var b=t.length*8;for(f=0;f<b;f+=8)r[f>>5]|=(t.charCodeAt(f/8)&255)<<f%32;return r}i(x,"rstr2binl");function I(t){return L(k(x(t),t.length*8))}i(I,"rstrMD5");function E(t,f){var r,b=x(t),w=[],S=[],A;for(w[15]=S[15]=void 0,b.length>16&&(b=k(b,t.length*8)),r=0;r<16;r+=1)w[r]=b[r]^909522486,S[r]=b[r]^1549556828;return A=k(w.concat(x(f)),512+f.length*8),L(k(S.concat(A),640))}i(E,"rstrHMACMD5");function P(t){var f="0123456789abcdef",r="",b,w;for(w=0;w<t.length;w+=1)b=t.charCodeAt(w),r+=f.charAt(b>>>4&15)+f.charAt(b&15);return r}i(P,"rstr2hex");function T(t){return unescape(encodeURIComponent(t))}i(T,"str2rstrUTF8");function u(t){return I(T(t))}i(u,"rawMD5");function d(t){return P(u(t))}i(d,"hexMD5");function _(t,f){return E(T(t),T(f))}i(_,"rawHMACMD5");function m(t,f){return P(_(t,f))}i(m,"hexHMACMD5");function C(t,f,r){return f?r?_(f,t):m(f,t):r?u(t):d(t)}i(C,"md5"),typeof define=="function"&&define.amd?define(function(){return C}):typeof O=="object"&&O.exports?O.exports=C:n.md5=C})(X)});var ee=z((M,Q)=>{"use strict";(function(n,e){typeof M=="object"?Q.exports=M=e():typeof define=="function"&&define.amd?define([],e):n.CryptoJS=e()})(M,function(){var n=n||(function(e,o){var h=Object.create||(function(){function u(){}return i(u,"F"),function(d){var _;return u.prototype=d,_=new u,u.prototype=null,_}})(),p={},g=p.lib={},v=g.Base=(function(){return{extend:i(function(u){var d=h(this);return u&&d.mixIn(u),(!d.hasOwnProperty("init")||this.init===d.init)&&(d.init=function(){d.$super.init.apply(this,arguments)}),d.init.prototype=d,d.$super=this,d},"extend"),create:i(function(){var u=this.extend();return u.init.apply(u,arguments),u},"create"),init:i(function(){},"init"),mixIn:i(function(u){for(var d in u)u.hasOwnProperty(d)&&(this[d]=u[d]);u.hasOwnProperty("toString")&&(this.toString=u.toString)},"mixIn"),clone:i(function(){return this.init.prototype.extend(this)},"clone")}})(),y=g.WordArray=v.extend({init:i(function(u,d){u=this.words=u||[],d!=o?this.sigBytes=d:this.sigBytes=u.length*4},"init"),toString:i(function(u){return(u||L).stringify(this)},"toString"),concat:i(function(u){var d=this.words,_=u.words,m=this.sigBytes,C=u.sigBytes;if(this.clamp(),m%4)for(var t=0;t<C;t++){var f=_[t>>>2]>>>24-t%4*8&255;d[m+t>>>2]|=f<<24-(m+t)%4*8}else for(var t=0;t<C;t+=4)d[m+t>>>2]=_[t>>>2];return this.sigBytes+=C,this},"concat"),clamp:i(function(){var u=this.words,d=this.sigBytes;u[d>>>2]&=4294967295<<32-d%4*8,u.length=e.ceil(d/4)},"clamp"),clone:i(function(){var u=v.clone.call(this);return u.words=this.words.slice(0),u},"clone"),random:i(function(u){for(var d=[],_=i(function(r){var r=r,b=987654321,w=4294967295;return function(){b=36969*(b&65535)+(b>>16)&w,r=18e3*(r&65535)+(r>>16)&w;var S=(b<<16)+r&w;return S/=4294967296,S+=.5,S*(e.random()>.5?1:-1)}},"r"),m=0,C;m<u;m+=4){var t=_((C||e.random())*4294967296);C=t()*987654071,d.push(t()*4294967296|0)}return new y.init(d,u)},"random")}),k=p.enc={},L=k.Hex={stringify:i(function(u){for(var d=u.words,_=u.sigBytes,m=[],C=0;C<_;C++){var t=d[C>>>2]>>>24-C%4*8&255;m.push((t>>>4).toString(16)),m.push((t&15).toString(16))}return m.join("")},"stringify"),parse:i(function(u){for(var d=u.length,_=[],m=0;m<d;m+=2)_[m>>>3]|=parseInt(u.substr(m,2),16)<<24-m%8*4;return new y.init(_,d/2)},"parse")},x=k.Latin1={stringify:i(function(u){for(var d=u.words,_=u.sigBytes,m=[],C=0;C<_;C++){var t=d[C>>>2]>>>24-C%4*8&255;m.push(String.fromCharCode(t))}return m.join("")},"stringify"),parse:i(function(u){for(var d=u.length,_=[],m=0;m<d;m++)_[m>>>2]|=(u.charCodeAt(m)&255)<<24-m%4*8;return new y.init(_,d)},"parse")},I=k.Utf8={stringify:i(function(u){try{return decodeURIComponent(escape(x.stringify(u)))}catch{throw new Error("Malformed UTF-8 data")}},"stringify"),parse:i(function(u){return x.parse(unescape(encodeURIComponent(u)))},"parse")},E=g.BufferedBlockAlgorithm=v.extend({reset:i(function(){this._data=new y.init,this._nDataBytes=0},"reset"),_append:i(function(u){typeof u=="string"&&(u=I.parse(u)),this._data.concat(u),this._nDataBytes+=u.sigBytes},"_append"),_process:i(function(u){var d=this._data,_=d.words,m=d.sigBytes,C=this.blockSize,t=C*4,f=m/t;u?f=e.ceil(f):f=e.max((f|0)-this._minBufferSize,0);var r=f*C,b=e.min(r*4,m);if(r){for(var w=0;w<r;w+=C)this._doProcessBlock(_,w);var S=_.splice(0,r);d.sigBytes-=b}return new y.init(S,b)},"_process"),clone:i(function(){var u=v.clone.call(this);return u._data=this._data.clone(),u},"clone"),_minBufferSize:0}),P=g.Hasher=E.extend({cfg:v.extend(),init:i(function(u){this.cfg=this.cfg.extend(u),this.reset()},"init"),reset:i(function(){E.reset.call(this),this._doReset()},"reset"),update:i(function(u){return this._append(u),this._process(),this},"update"),finalize:i(function(u){u&&this._append(u);var d=this._doFinalize();return d},"finalize"),blockSize:512/32,_createHelper:i(function(u){return function(d,_){return new u.init(_).finalize(d)}},"_createHelper"),_createHmacHelper:i(function(u){return function(d,_){return new T.HMAC.init(u,_).finalize(d)}},"_createHmacHelper")}),T=p.algo={};return p})(Math);return n})});var ne=z((H,te)=>{"use strict";(function(n,e){typeof H=="object"?te.exports=H=e(ee()):typeof define=="function"&&define.amd?define(["./core"],e):e(n.CryptoJS)})(H,function(n){return(function(){var e=n,o=e.lib,h=o.WordArray,p=o.Hasher,g=e.algo,v=[],y=g.SHA1=p.extend({_doReset:i(function(){this._hash=new h.init([1732584193,4023233417,2562383102,271733878,3285377520])},"_doReset"),_doProcessBlock:i(function(k,L){for(var x=this._hash.words,I=x[0],E=x[1],P=x[2],T=x[3],u=x[4],d=0;d<80;d++){if(d<16)v[d]=k[L+d]|0;else{var _=v[d-3]^v[d-8]^v[d-14]^v[d-16];v[d]=_<<1|_>>>31}var m=(I<<5|I>>>27)+u+v[d];d<20?m+=(E&P|~E&T)+1518500249:d<40?m+=(E^P^T)+1859775393:d<60?m+=(E&P|E&T|P&T)-1894007588:m+=(E^P^T)-899497514,u=T,T=P,P=E<<30|E>>>2,E=I,I=m}x[0]=x[0]+I|0,x[1]=x[1]+E|0,x[2]=x[2]+P|0,x[3]=x[3]+T|0,x[4]=x[4]+u|0},"_doProcessBlock"),_doFinalize:i(function(){var k=this._data,L=k.words,x=this._nDataBytes*8,I=k.sigBytes*8;return L[I>>>5]|=128<<24-I%32,L[(I+64>>>9<<4)+14]=Math.floor(x/4294967296),L[(I+64>>>9<<4)+15]=x,k.sigBytes=L.length*4,this._process(),this._hash},"_doFinalize"),clone:i(function(){var k=p.clone.call(this);return k._hash=this._hash.clone(),k},"clone")});e.SHA1=p._createHelper(y),e.HmacSHA1=p._createHmacHelper(y)})(),n.SHA1})});var nt={};Ee(nt,{TrackKey:()=>$,name:()=>tt,reportTeaEvent:()=>U,version:()=>et});var ae=q(Y(),1),se=q(ne(),1);function B(){return window.appId||null}i(B,"getAppId");function Te(){var o;let n="suda-csrf-token",e=document.cookie.split("; ");for(let h of e){let[p,g]=h.split("=");if(p===n)return decodeURIComponent(g)}return(o=window.csrfToken)!=null?o:null}i(Te,"getCsrfToken");function W(){let n=globalThis.CLIENT_BASE_PATH||"/";return/^\/app\/[^/]/.test(n)}i(W,"isNewPathEnabled");function F(){switch(globalThis.ENVIRONMENT){case"gray":return"PRE";case"online":return"ONLINE";default:return"BOE"}}i(F,"getEnv");function re(){return window.appEnv!=null?window.appEnv==="runtime":!0}i(re,"isOnlineEnv");function N(){let n=navigator.userAgent,e=/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(n),o=/iPad|Tab|Tablet/i.test(n)&&navigator.maxTouchPoints>1;return e||o}i(N,"isMobile");async function ie(){var h;let n=B();if(!n)return{code:1,msg:"appId is required",data:{}};let e=W()?`/app/${n}/__runtime__/api/v1/studio/lark/user_info`:`/spark/b/${n}/lark/user_info`;return await(await fetch(e,{headers:{"X-Suda-Csrf-Token":(h=Te())!=null?h:""}})).json()}i(ie,"getLarkUserInfo");var $={VIEW:"aily_agent_artifact_page_view"},Ae="08a441",Pe="42b91e";function oe(n){let e=String(n);return(0,se.default)(Ae+(0,ae.default)(e+Pe)).toString()}i(oe,"encryptTea");var j=!1;async function Le(){var g,v,y,k;let{data:n}=await ie(),{tenantID:e,userID:o}=n||{},h=o&&o!=="0"?oe(o):void 0,p=e&&e!=="0"?oe(e):void 0;(g=window.collectEvent)==null||g.call(window,"init",{app_id:788827,channel:"cn",disable_auto_pv:!1,enable_ab_test:!1,enable_debug:!1,enable_stay_duration:!0,reportTime:1e3}),(y=window.collectEvent)==null||y.call(window,"config",{user_unique_id:h,device_type:N()?"mobile":"pc",evtParams:{open_from:(v=new URLSearchParams(window.location.search).get("open-from"))!=null?v:void 0,env:F(),user_id:h,tenant_id:p}}),j=!0,(k=window.collectEvent)==null||k.call(window,"start")}i(Le,"createTracker");async function U({trackKey:n,trackParams:e={}}){var o;try{j||(j=!0,await Le()),(o=window.collectEvent)==null||o.call(window,n,e)}catch(h){console.error(h)}}i(U,"reportTeaEvent");function ce(){return U({trackKey:$.VIEW,trackParams:{artifact_uid:B(),agent_id:"agent_miaoda",url:window.location.href}})}i(ce,"reportPageView");function le(){if(typeof crypto!="undefined"&&crypto.getRandomValues){let e=new Uint8Array(8);return crypto.getRandomValues(e),Array.from(e).map(o=>o.toString(16).padStart(2,"0")).join("")}let n="";for(let e=0;e<16;e++)n+=Math.floor(Math.random()*16).toString(16);return n}i(le,"generateUUID");var ue="x_sdk_device_id";function Be(){try{let n=localStorage.getItem(ue);return n||(n=le(),localStorage.setItem(ue,n)),n}catch{return le()}}i(Be,"getDeviceId");function De(){let n=typeof navigator!="undefined"?navigator.userAgent:"";return n&&(/Android/i.test(n)&&/Mobile/i.test(n)||/iPhone|iPod/i.test(n)||/BlackBerry|IEMobile|Opera Mini/i.test(n))?"mobile":"desktop"}i(De,"getDeviceType");var Re="pageSessionID";function Oe(){try{return new URLSearchParams(window.location.search).get(Re)||""}catch{return""}}i(Oe,"getPvId");function Me(n={}){let e=n.pvId||Oe();return{app_id:window.appId||"",tenant_id:window.tenantId||"",user_id:window.userId||"",did:Be(),module:"app_web",app_env:"runtime",source_type:"user",device_type:De(),release_commit_id:window.__RELEASE_COMMIT_ID__||"",...e?{pv_id:e}:{}}}i(Me,"getDefaultAttributes");function de(n){let e=Math.round(n);if(!Number.isFinite(e))throw new RangeError(`toNanoString: \u975E\u6CD5\u65F6\u95F4\u6233 ${n}`);return typeof BigInt!="function"?e===0?"0":`${e}000000`:String(BigInt(e)*BigInt(1e6))}i(de,"toNanoString");var He="1.0.2-alpha.20260831083248";function Fe(n,e){let o=Me(e),h=de(Date.now());return{metricsData:{resource:{attributes:{sdk_version:He,sdk_lang:"javascript",sdk_type:"client-frontend"}},metrics:[{name:"apaas_internal_metrics_pv_uv",description:"Count of page views",unit:"",scopeName:"apaas_internal_metrics_pv_uv",sum:{aggregationTemporality:1,isMonotonic:!0,dataPoints:n.map(p=>({attributes:{...o,url:p.url,path:p.path,referrer:p.referrer},startTimeUnixNano:de(p.timestampMs),timeUnixNano:h,asDouble:1}))}}]}}}i(Fe,"buildPayload");function Ne(n,e,o={},h){if(e.length===0)return;let p;try{p=JSON.stringify(Fe(e,h))}catch{return}try{fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-Suda-Csrf-Token":window.csrfToken||"",...o},body:p,keepalive:!0}).catch(()=>{})}catch{}}i(Ne,"sendPvData");var V="__APAAS_PV_TRACKER_STARTED__";function ze(){try{let n=window;return n[V]?!1:(n[V]=!0,!0)}catch{return!0}}i(ze,"claimPvReporting");function fe(){try{window[V]=!1}catch{}}i(fe,"releasePvReporting");var D,We=(D=class{constructor(){this.started=!1,this.disposers=[],this.holdsPvReporting=!1,this.buffer=[]}static get instance(){return this._instance||(this._instance=new D),this._instance}start(e){var o;if(!this.started&&ze()){this.holdsPvReporting=!0,this.config=e,this.started=!0;try{this.listenRouteChanges(),this.registerLifecycleListeners();let h=(o=e.flushIntervalMs)!=null?o:1e4;this.flushTimer=setInterval(()=>this.flush(),h)}catch(h){throw this.started=!1,this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=void 0),this.holdsPvReporting=!1,fe(),h}}}shutdown(){this.flush(),this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=void 0),this.firstFlushTimer&&(clearTimeout(this.firstFlushTimer),this.firstFlushTimer=void 0),this.started=!1;for(let e of this.disposers.splice(0))try{e()}catch{}this.holdsPvReporting&&(this.holdsPvReporting=!1,fe())}pageKey(){let{origin:e,pathname:o,search:h}=window.location;return`${e}${o}${h}`}scheduleFirstFlush(){var e;let o=(e=this.config)==null?void 0:e.firstFlushDelayMs;o==null||this.firstFlushTimer||(this.firstFlushTimer=setTimeout(()=>this.flush(),o))}recordPv(){let e=this.pageKey();this.lastKey!==e&&(this.lastKey=e,this.buffer.push({url:window.location.href,path:window.location.pathname,referrer:document.referrer,timestampMs:Date.now()}),this.scheduleFirstFlush())}flush(){if(!this.config||this.buffer.length===0)return;let e=this.buffer.splice(0);Ne(this.config.collectorUrl,e,this.config.headers,{pvId:this.config.pvId})}listenRouteChanges(){this.recordPv();let e=i(()=>this.recordPv(),"onPopState");window.addEventListener("popstate",e),this.disposers.push(()=>window.removeEventListener("popstate",e)),this.patchHistory("pushState"),this.patchHistory("replaceState")}patchHistory(e){let o=history[e],h=i(()=>this.recordPv(),"recordPv");history[e]=function(...p){let g=o.apply(this,p);return h(),g},this.disposers.push(()=>{history[e]=o})}registerLifecycleListeners(){let e=i(()=>{document.visibilityState==="hidden"&&this.flush()},"onVisibilityChange");document.addEventListener("visibilitychange",e),this.disposers.push(()=>document.removeEventListener("visibilitychange",e));let o=i(()=>this.flush(),"onPageHide");window.addEventListener("pagehide",o),this.disposers.push(()=>window.removeEventListener("pagehide",o))}},i(D,"_PvTracker"),D),pe=We.instance;function he(){var o;let n=(o=B())!=null?o:"",e=W()?`/app/${n}/__runtime__/api/v1/observability/metrics/collect`:`/spark/app/${n}/runtime/api/v1/observability/metrics/collect`;pe.start({collectorUrl:e})}i(he,"initPvTracking");var je="https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/miaoda-ui",$e=`${je}/doubao.svg`,Ue='<svg viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8.08312 8.08298C8.2384 7.92769 8.23953 7.67705 8.08424 7.52176L5.3625 4.80002L8.08422 2.07829C8.23951 1.92301 8.23839 1.67236 8.0831 1.51708C7.92781 1.36179 7.67717 1.36066 7.52188 1.51595C7.36659 1.67124 4.80016 4.23767 4.80016 4.23767L2.07841 1.51593C1.92313 1.36064 1.67248 1.36177 1.5172 1.51705C1.36191 1.67234 1.36078 1.92298 1.51607 2.07827L4.23782 4.80002L1.51605 7.52178C1.36076 7.67707 1.36189 7.92771 1.51718 8.083C1.67246 8.23829 1.92311 8.23941 2.07839 8.08412L4.80016 5.36236L7.5219 8.0841C7.67719 8.23939 7.92783 8.23826 8.08312 8.08298Z" fill="currentColor"/></svg>',Ve='<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12.6667 2H3.33333V14H6.66667V15.3334H3.33333C2.59695 15.3334 2 14.7364 2 14V2C2 1.26364 2.59695 0.666687 3.33333 0.666687H12.6667C13.403 0.666687 14 1.26364 14 2V7.33335H12.6667V2Z" fill="currentColor"/><path d="M5.33333 4.66669C4.96514 4.66669 4.66667 4.96516 4.66667 5.33335C4.66667 5.70154 4.96514 6 5.33333 6H10.6667C11.0349 6 11.3333 5.70154 11.3333 5.33335C11.3333 4.96516 11.0349 4.66669 10.6667 4.66669H5.33333Z" fill="currentColor"/><path d="M4.66667 8.33335C4.66667 7.96516 4.96514 7.66669 5.33333 7.66669H8C8.36819 7.66669 8.66667 7.96516 8.66667 8.33335C8.66667 8.70154 8.36819 9 8 9H5.33333C4.96514 9 4.66667 8.70154 4.66667 8.33335Z" fill="currentColor"/><path d="M13.5523 8.70017C13.9428 8.30964 14.576 8.30964 14.9665 8.70017C15.357 9.09069 15.357 9.72386 14.9665 10.1144L14.2594 10.8215L12.8452 9.40728L13.5523 8.70017Z" fill="currentColor"/><path d="M12.1381 10.1144L13.5523 11.5286L10.2309 14.85C10.0916 14.9892 9.91229 15.0815 9.71798 15.1138L8.45737 15.3234C8.42136 15.3294 8.38467 15.3177 8.35885 15.2918C8.33271 15.2657 8.32099 15.2284 8.32749 15.192L8.55128 13.9374C8.58465 13.7502 8.6746 13.5779 8.80901 13.4435L12.1381 10.1144Z" fill="currentColor"/></svg>',ge=!0,Ke="\u8C46\u5305 AI \u751F\u6210",Ze="\u7531\u98DE\u4E66\u5999\u642D\u63D0\u4F9B\u652F\u6301",Ge="0px 8px 32px rgba(0,0,0,0.08), 0px 4px 16px rgba(0,0,0,0.04), 0px 2px 4px rgba(0,0,0,0.02)",Je="0px 4px 16px rgba(0,0,0,0.03), 0px 4px 10px rgba(0,0,0,0.03), 0px 2px 4px rgba(0,0,0,0.02)",Z="'PingFang SC', -apple-system, BlinkMacSystemFont, sans-serif",qe={BOE:"tns.feishu-boe.cn",PRE:"tns.feishu-pre.cn",ONLINE:"tns.feishu.cn"};function me(){var o;let n=JSON.stringify({scene:"miaoda_app_report",entity_id:(o=B())!=null?o:"",entity_type:"miaoda_app",extra:""}),e=`https://${qe[F()]}/cust/lark_report/?type=common¶ms=${encodeURIComponent(n)}&lang=zh-CN`;window.open(e,"_blank","noopener,noreferrer")}i(me,"openDoubaoReport");function be(n){let e=document.createElement("span");Object.assign(e.style,{display:"inline-flex",width:`${n}px`,height:`${n}px`,flexShrink:"0"}),e.innerHTML=Ue;let o=e.firstElementChild;return o&&(o.setAttribute("width",String(n)),o.setAttribute("height",String(n)),o.style.display="block"),e}i(be,"makeCloseIcon");function Xe(n){let e=document.createElement("img");return e.src=$e,e.width=n,e.height=n,e.alt="",Object.assign(e.style,{width:`${n}px`,height:`${n}px`,maxWidth:"none",maxHeight:"none",borderRadius:"100px",flexShrink:"0",display:"block"}),e}i(Xe,"makeAvatar");function ye(n,e){let o=n==="desktop",h=document.createElement("div");Object.assign(h.style,{boxSizing:"border-box",display:"inline-flex",alignItems:"center",gap:o?"4px":"6px",padding:o?"6px 12px 6px 8px":"4px 12px 4px 8px",background:"#363636",border:"0.5px solid rgba(255,255,255,0.1)",borderRadius:"100px",boxShadow:Ge,cursor:"pointer"});let p=Xe(o?16:18),g=document.createElement("span");if(g.textContent=Ke,Object.assign(g.style,{fontFamily:Z,fontSize:o?"12px":"14px",lineHeight:o?"18px":"22px",color:"rgba(255,255,255,0.85)",whiteSpace:"nowrap"}),h.append(p,g),o&&e){let v=document.createElement("span");v.setAttribute("role","button"),v.setAttribute("aria-label","\u5173\u95ED"),v.setAttribute("data-doubao-close",""),Object.assign(v.style,{display:"none",alignItems:"center",cursor:"pointer",flexShrink:"0",color:"rgba(255,255,255,0.5)"}),v.appendChild(be(10)),v.addEventListener("click",y=>{y.stopPropagation(),e()}),h.appendChild(v)}return h}i(ye,"buildPill");function K(n){let e=document.createElement("div");e.setAttribute("role","menuitem"),e.setAttribute("data-label",n.label),Object.assign(e.style,{boxSizing:"border-box",display:"flex",alignItems:"center",gap:"8px",padding:"4px 10px",borderRadius:"6px",cursor:"pointer",color:"#000000"});let o=document.createElement("span");Object.assign(o.style,{display:"inline-flex",width:"16px",height:"16px",flexShrink:"0",color:"#000000"}),n.icon==="feedback"?o.innerHTML=Ve:o.appendChild(be(16));let h=document.createElement("span");return h.textContent=n.label,Object.assign(h.style,{fontFamily:Z,fontSize:`${n.fontSize}px`,lineHeight:`${n.fontSize+8}px`,color:"#000000",whiteSpace:"nowrap"}),e.append(o,h),e.addEventListener("mouseenter",()=>{e.style.background="rgba(0,0,0,0.04)"}),e.addEventListener("mouseleave",()=>{e.style.background="transparent"}),e.addEventListener("click",n.onClick),e}i(K,"buildMenuRow");function _e(n){let e=document.createElement("div");if(Object.assign(e.style,{boxSizing:"border-box",display:"flex",flexDirection:"column",minWidth:`${n.minWidth}px`,background:"#ffffff",border:"0.5px solid rgba(0,0,0,0.1)",borderRadius:"10px",boxShadow:Je,overflow:"hidden",outline:"none"}),n.rows.length){let h=document.createElement("div");Object.assign(h.style,{boxSizing:"border-box",padding:"4px"}),n.rows.forEach(p=>h.appendChild(p)),e.appendChild(h)}let o=document.createElement("div");return o.textContent=Ze,Object.assign(o.style,{boxSizing:"border-box",background:"#f9f9f9",padding:"8px 14px",fontFamily:Z,fontSize:`${n.footerFontSize}px`,lineHeight:`${n.footerFontSize+8}px`,color:"rgba(0,0,0,0.35)",whiteSpace:"nowrap"}),e.appendChild(o),e}i(_e,"buildMenuCard");function Ye(){let n=document.createElement("div");n.setAttribute("data-custom-element","doubao-watermark"),Object.assign(n.style,{position:"fixed",right:"12px",bottom:"12px",zIndex:"9999",display:"flex",flexDirection:"column",alignItems:"flex-end",gap:"8px"});let e=[];ge&&e.push(K({icon:"feedback",label:"\u6295\u8BC9\u4E0E\u4E3E\u62A5",fontSize:14,onClick:me}));let o=_e({rows:e,footerFontSize:12,minWidth:144});o.style.display="none";let h=ye("desktop",()=>n.remove()),p=h.querySelector("[data-doubao-close]");n.append(o,h);let g=null;return n.addEventListener("mouseenter",()=>{g&&clearTimeout(g),o.style.display="flex",p&&(p.style.display="inline-flex")}),n.addEventListener("mouseleave",()=>{g=setTimeout(()=>{o.style.display="none",p&&(p.style.display="none")},100)}),n}i(Ye,"buildDesktopWatermark");function Qe(){let n=document.createElement("div");n.setAttribute("data-custom-element","doubao-watermark-mobile"),Object.assign(n.style,{position:"fixed",right:"12px",bottom:"12px",zIndex:"9999",display:"flex",flexDirection:"column",alignItems:"flex-end",gap:"8px",cursor:"pointer"});let e=[];ge&&e.push(K({icon:"feedback",label:"\u6295\u8BC9\u4E0E\u4E3E\u62A5",fontSize:16,onClick:me})),e.push(K({icon:"close",label:"\u4E0D\u518D\u5C55\u793A",fontSize:16,onClick:i(p=>{p.stopPropagation(),n.remove()},"onClick")}));let o=_e({rows:e,footerFontSize:14,minWidth:160});o.style.display="none";let h=ye("mobile");return n.append(o,h),n.addEventListener("click",p=>{p.stopPropagation(),o.style.display=o.style.display==="none"?"flex":"none"}),document.addEventListener("click",()=>{o.style.display="none"}),n}i(Qe,"buildMobileWatermark");var ve=!1;function G(){if(ve||typeof document=="undefined")return;if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",G,{once:!0});return}ve=!0;let n=N()?Qe():Ye();document.body.appendChild(n)}i(G,"mountDoubaoWatermark");var et="0.0.12-alpha.20260831083241",tt="@lark-apaas/miaoda-coding-sdk";re()&&(ce(),he());G();return Ie(nt);})();
|
|
1
|
+
"use strict";var MiaodaRuntime=(()=>{var we=Object.create;var R=Object.defineProperty;var xe=Object.getOwnPropertyDescriptor;var Ce=Object.getOwnPropertyNames;var Se=Object.getPrototypeOf,ke=Object.prototype.hasOwnProperty;var i=(n,e)=>R(n,"name",{value:e,configurable:!0});var z=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),Ee=(n,e)=>{for(var o in e)R(n,o,{get:e[o],enumerable:!0})},J=(n,e,o,h)=>{if(e&&typeof e=="object"||typeof e=="function")for(let p of Ce(e))!ke.call(n,p)&&p!==o&&R(n,p,{get:()=>e[p],enumerable:!(h=xe(e,p))||h.enumerable});return n};var q=(n,e,o)=>(o=n!=null?we(Se(n)):{},J(e||!n||!n.__esModule?R(o,"default",{value:n,enumerable:!0}):o,n)),Ie=n=>J(R({},"__esModule",{value:!0}),n);var Y=z((X,O)=>{"use strict";(function(n){"use strict";function e(t,f){var r=(t&65535)+(f&65535),b=(t>>16)+(f>>16)+(r>>16);return b<<16|r&65535}i(e,"safeAdd");function o(t,f){return t<<f|t>>>32-f}i(o,"bitRotateLeft");function h(t,f,r,b,w,S){return e(o(e(e(f,t),e(b,S)),w),r)}i(h,"md5cmn");function p(t,f,r,b,w,S,A){return h(f&r|~f&b,t,f,w,S,A)}i(p,"md5ff");function g(t,f,r,b,w,S,A){return h(f&b|r&~b,t,f,w,S,A)}i(g,"md5gg");function v(t,f,r,b,w,S,A){return h(f^r^b,t,f,w,S,A)}i(v,"md5hh");function y(t,f,r,b,w,S,A){return h(r^(f|~b),t,f,w,S,A)}i(y,"md5ii");function k(t,f){t[f>>5]|=128<<f%32,t[(f+64>>>9<<4)+14]=f;var r,b,w,S,A,s=1732584193,a=-271733879,c=-1732584194,l=271733878;for(r=0;r<t.length;r+=16)b=s,w=a,S=c,A=l,s=p(s,a,c,l,t[r],7,-680876936),l=p(l,s,a,c,t[r+1],12,-389564586),c=p(c,l,s,a,t[r+2],17,606105819),a=p(a,c,l,s,t[r+3],22,-1044525330),s=p(s,a,c,l,t[r+4],7,-176418897),l=p(l,s,a,c,t[r+5],12,1200080426),c=p(c,l,s,a,t[r+6],17,-1473231341),a=p(a,c,l,s,t[r+7],22,-45705983),s=p(s,a,c,l,t[r+8],7,1770035416),l=p(l,s,a,c,t[r+9],12,-1958414417),c=p(c,l,s,a,t[r+10],17,-42063),a=p(a,c,l,s,t[r+11],22,-1990404162),s=p(s,a,c,l,t[r+12],7,1804603682),l=p(l,s,a,c,t[r+13],12,-40341101),c=p(c,l,s,a,t[r+14],17,-1502002290),a=p(a,c,l,s,t[r+15],22,1236535329),s=g(s,a,c,l,t[r+1],5,-165796510),l=g(l,s,a,c,t[r+6],9,-1069501632),c=g(c,l,s,a,t[r+11],14,643717713),a=g(a,c,l,s,t[r],20,-373897302),s=g(s,a,c,l,t[r+5],5,-701558691),l=g(l,s,a,c,t[r+10],9,38016083),c=g(c,l,s,a,t[r+15],14,-660478335),a=g(a,c,l,s,t[r+4],20,-405537848),s=g(s,a,c,l,t[r+9],5,568446438),l=g(l,s,a,c,t[r+14],9,-1019803690),c=g(c,l,s,a,t[r+3],14,-187363961),a=g(a,c,l,s,t[r+8],20,1163531501),s=g(s,a,c,l,t[r+13],5,-1444681467),l=g(l,s,a,c,t[r+2],9,-51403784),c=g(c,l,s,a,t[r+7],14,1735328473),a=g(a,c,l,s,t[r+12],20,-1926607734),s=v(s,a,c,l,t[r+5],4,-378558),l=v(l,s,a,c,t[r+8],11,-2022574463),c=v(c,l,s,a,t[r+11],16,1839030562),a=v(a,c,l,s,t[r+14],23,-35309556),s=v(s,a,c,l,t[r+1],4,-1530992060),l=v(l,s,a,c,t[r+4],11,1272893353),c=v(c,l,s,a,t[r+7],16,-155497632),a=v(a,c,l,s,t[r+10],23,-1094730640),s=v(s,a,c,l,t[r+13],4,681279174),l=v(l,s,a,c,t[r],11,-358537222),c=v(c,l,s,a,t[r+3],16,-722521979),a=v(a,c,l,s,t[r+6],23,76029189),s=v(s,a,c,l,t[r+9],4,-640364487),l=v(l,s,a,c,t[r+12],11,-421815835),c=v(c,l,s,a,t[r+15],16,530742520),a=v(a,c,l,s,t[r+2],23,-995338651),s=y(s,a,c,l,t[r],6,-198630844),l=y(l,s,a,c,t[r+7],10,1126891415),c=y(c,l,s,a,t[r+14],15,-1416354905),a=y(a,c,l,s,t[r+5],21,-57434055),s=y(s,a,c,l,t[r+12],6,1700485571),l=y(l,s,a,c,t[r+3],10,-1894986606),c=y(c,l,s,a,t[r+10],15,-1051523),a=y(a,c,l,s,t[r+1],21,-2054922799),s=y(s,a,c,l,t[r+8],6,1873313359),l=y(l,s,a,c,t[r+15],10,-30611744),c=y(c,l,s,a,t[r+6],15,-1560198380),a=y(a,c,l,s,t[r+13],21,1309151649),s=y(s,a,c,l,t[r+4],6,-145523070),l=y(l,s,a,c,t[r+11],10,-1120210379),c=y(c,l,s,a,t[r+2],15,718787259),a=y(a,c,l,s,t[r+9],21,-343485551),s=e(s,b),a=e(a,w),c=e(c,S),l=e(l,A);return[s,a,c,l]}i(k,"binlMD5");function L(t){var f,r="",b=t.length*32;for(f=0;f<b;f+=8)r+=String.fromCharCode(t[f>>5]>>>f%32&255);return r}i(L,"binl2rstr");function x(t){var f,r=[];for(r[(t.length>>2)-1]=void 0,f=0;f<r.length;f+=1)r[f]=0;var b=t.length*8;for(f=0;f<b;f+=8)r[f>>5]|=(t.charCodeAt(f/8)&255)<<f%32;return r}i(x,"rstr2binl");function I(t){return L(k(x(t),t.length*8))}i(I,"rstrMD5");function E(t,f){var r,b=x(t),w=[],S=[],A;for(w[15]=S[15]=void 0,b.length>16&&(b=k(b,t.length*8)),r=0;r<16;r+=1)w[r]=b[r]^909522486,S[r]=b[r]^1549556828;return A=k(w.concat(x(f)),512+f.length*8),L(k(S.concat(A),640))}i(E,"rstrHMACMD5");function P(t){var f="0123456789abcdef",r="",b,w;for(w=0;w<t.length;w+=1)b=t.charCodeAt(w),r+=f.charAt(b>>>4&15)+f.charAt(b&15);return r}i(P,"rstr2hex");function T(t){return unescape(encodeURIComponent(t))}i(T,"str2rstrUTF8");function u(t){return I(T(t))}i(u,"rawMD5");function d(t){return P(u(t))}i(d,"hexMD5");function _(t,f){return E(T(t),T(f))}i(_,"rawHMACMD5");function m(t,f){return P(_(t,f))}i(m,"hexHMACMD5");function C(t,f,r){return f?r?_(f,t):m(f,t):r?u(t):d(t)}i(C,"md5"),typeof define=="function"&&define.amd?define(function(){return C}):typeof O=="object"&&O.exports?O.exports=C:n.md5=C})(X)});var ee=z((M,Q)=>{"use strict";(function(n,e){typeof M=="object"?Q.exports=M=e():typeof define=="function"&&define.amd?define([],e):n.CryptoJS=e()})(M,function(){var n=n||(function(e,o){var h=Object.create||(function(){function u(){}return i(u,"F"),function(d){var _;return u.prototype=d,_=new u,u.prototype=null,_}})(),p={},g=p.lib={},v=g.Base=(function(){return{extend:i(function(u){var d=h(this);return u&&d.mixIn(u),(!d.hasOwnProperty("init")||this.init===d.init)&&(d.init=function(){d.$super.init.apply(this,arguments)}),d.init.prototype=d,d.$super=this,d},"extend"),create:i(function(){var u=this.extend();return u.init.apply(u,arguments),u},"create"),init:i(function(){},"init"),mixIn:i(function(u){for(var d in u)u.hasOwnProperty(d)&&(this[d]=u[d]);u.hasOwnProperty("toString")&&(this.toString=u.toString)},"mixIn"),clone:i(function(){return this.init.prototype.extend(this)},"clone")}})(),y=g.WordArray=v.extend({init:i(function(u,d){u=this.words=u||[],d!=o?this.sigBytes=d:this.sigBytes=u.length*4},"init"),toString:i(function(u){return(u||L).stringify(this)},"toString"),concat:i(function(u){var d=this.words,_=u.words,m=this.sigBytes,C=u.sigBytes;if(this.clamp(),m%4)for(var t=0;t<C;t++){var f=_[t>>>2]>>>24-t%4*8&255;d[m+t>>>2]|=f<<24-(m+t)%4*8}else for(var t=0;t<C;t+=4)d[m+t>>>2]=_[t>>>2];return this.sigBytes+=C,this},"concat"),clamp:i(function(){var u=this.words,d=this.sigBytes;u[d>>>2]&=4294967295<<32-d%4*8,u.length=e.ceil(d/4)},"clamp"),clone:i(function(){var u=v.clone.call(this);return u.words=this.words.slice(0),u},"clone"),random:i(function(u){for(var d=[],_=i(function(r){var r=r,b=987654321,w=4294967295;return function(){b=36969*(b&65535)+(b>>16)&w,r=18e3*(r&65535)+(r>>16)&w;var S=(b<<16)+r&w;return S/=4294967296,S+=.5,S*(e.random()>.5?1:-1)}},"r"),m=0,C;m<u;m+=4){var t=_((C||e.random())*4294967296);C=t()*987654071,d.push(t()*4294967296|0)}return new y.init(d,u)},"random")}),k=p.enc={},L=k.Hex={stringify:i(function(u){for(var d=u.words,_=u.sigBytes,m=[],C=0;C<_;C++){var t=d[C>>>2]>>>24-C%4*8&255;m.push((t>>>4).toString(16)),m.push((t&15).toString(16))}return m.join("")},"stringify"),parse:i(function(u){for(var d=u.length,_=[],m=0;m<d;m+=2)_[m>>>3]|=parseInt(u.substr(m,2),16)<<24-m%8*4;return new y.init(_,d/2)},"parse")},x=k.Latin1={stringify:i(function(u){for(var d=u.words,_=u.sigBytes,m=[],C=0;C<_;C++){var t=d[C>>>2]>>>24-C%4*8&255;m.push(String.fromCharCode(t))}return m.join("")},"stringify"),parse:i(function(u){for(var d=u.length,_=[],m=0;m<d;m++)_[m>>>2]|=(u.charCodeAt(m)&255)<<24-m%4*8;return new y.init(_,d)},"parse")},I=k.Utf8={stringify:i(function(u){try{return decodeURIComponent(escape(x.stringify(u)))}catch{throw new Error("Malformed UTF-8 data")}},"stringify"),parse:i(function(u){return x.parse(unescape(encodeURIComponent(u)))},"parse")},E=g.BufferedBlockAlgorithm=v.extend({reset:i(function(){this._data=new y.init,this._nDataBytes=0},"reset"),_append:i(function(u){typeof u=="string"&&(u=I.parse(u)),this._data.concat(u),this._nDataBytes+=u.sigBytes},"_append"),_process:i(function(u){var d=this._data,_=d.words,m=d.sigBytes,C=this.blockSize,t=C*4,f=m/t;u?f=e.ceil(f):f=e.max((f|0)-this._minBufferSize,0);var r=f*C,b=e.min(r*4,m);if(r){for(var w=0;w<r;w+=C)this._doProcessBlock(_,w);var S=_.splice(0,r);d.sigBytes-=b}return new y.init(S,b)},"_process"),clone:i(function(){var u=v.clone.call(this);return u._data=this._data.clone(),u},"clone"),_minBufferSize:0}),P=g.Hasher=E.extend({cfg:v.extend(),init:i(function(u){this.cfg=this.cfg.extend(u),this.reset()},"init"),reset:i(function(){E.reset.call(this),this._doReset()},"reset"),update:i(function(u){return this._append(u),this._process(),this},"update"),finalize:i(function(u){u&&this._append(u);var d=this._doFinalize();return d},"finalize"),blockSize:512/32,_createHelper:i(function(u){return function(d,_){return new u.init(_).finalize(d)}},"_createHelper"),_createHmacHelper:i(function(u){return function(d,_){return new T.HMAC.init(u,_).finalize(d)}},"_createHmacHelper")}),T=p.algo={};return p})(Math);return n})});var ne=z((H,te)=>{"use strict";(function(n,e){typeof H=="object"?te.exports=H=e(ee()):typeof define=="function"&&define.amd?define(["./core"],e):e(n.CryptoJS)})(H,function(n){return(function(){var e=n,o=e.lib,h=o.WordArray,p=o.Hasher,g=e.algo,v=[],y=g.SHA1=p.extend({_doReset:i(function(){this._hash=new h.init([1732584193,4023233417,2562383102,271733878,3285377520])},"_doReset"),_doProcessBlock:i(function(k,L){for(var x=this._hash.words,I=x[0],E=x[1],P=x[2],T=x[3],u=x[4],d=0;d<80;d++){if(d<16)v[d]=k[L+d]|0;else{var _=v[d-3]^v[d-8]^v[d-14]^v[d-16];v[d]=_<<1|_>>>31}var m=(I<<5|I>>>27)+u+v[d];d<20?m+=(E&P|~E&T)+1518500249:d<40?m+=(E^P^T)+1859775393:d<60?m+=(E&P|E&T|P&T)-1894007588:m+=(E^P^T)-899497514,u=T,T=P,P=E<<30|E>>>2,E=I,I=m}x[0]=x[0]+I|0,x[1]=x[1]+E|0,x[2]=x[2]+P|0,x[3]=x[3]+T|0,x[4]=x[4]+u|0},"_doProcessBlock"),_doFinalize:i(function(){var k=this._data,L=k.words,x=this._nDataBytes*8,I=k.sigBytes*8;return L[I>>>5]|=128<<24-I%32,L[(I+64>>>9<<4)+14]=Math.floor(x/4294967296),L[(I+64>>>9<<4)+15]=x,k.sigBytes=L.length*4,this._process(),this._hash},"_doFinalize"),clone:i(function(){var k=p.clone.call(this);return k._hash=this._hash.clone(),k},"clone")});e.SHA1=p._createHelper(y),e.HmacSHA1=p._createHmacHelper(y)})(),n.SHA1})});var nt={};Ee(nt,{TrackKey:()=>$,name:()=>tt,reportTeaEvent:()=>U,version:()=>et});var se=q(Y(),1),ae=q(ne(),1);function B(){return window.appId||null}i(B,"getAppId");function Te(){var o;let n="suda-csrf-token",e=document.cookie.split("; ");for(let h of e){let[p,g]=h.split("=");if(p===n)return decodeURIComponent(g)}return(o=window.csrfToken)!=null?o:null}i(Te,"getCsrfToken");function W(){let n=globalThis.CLIENT_BASE_PATH||"/";return/^\/app\/[^/]/.test(n)}i(W,"isNewPathEnabled");function F(){switch(globalThis.ENVIRONMENT){case"gray":return"PRE";case"online":return"ONLINE";default:return"BOE"}}i(F,"getEnv");function re(){return window.appEnv!=null?window.appEnv==="runtime":!0}i(re,"isOnlineEnv");function N(){let n=navigator.userAgent,e=/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(n),o=/iPad|Tab|Tablet/i.test(n)&&navigator.maxTouchPoints>1;return e||o}i(N,"isMobile");async function ie(){var h;let n=B();if(!n)return{code:1,msg:"appId is required",data:{}};let e=W()?`/app/${n}/__runtime__/api/v1/studio/lark/user_info`:`/spark/b/${n}/lark/user_info`;return await(await fetch(e,{headers:{"X-Suda-Csrf-Token":(h=Te())!=null?h:""}})).json()}i(ie,"getLarkUserInfo");var $={VIEW:"aily_agent_artifact_page_view"},Ae="08a441",Pe="42b91e";function oe(n){let e=String(n);return(0,ae.default)(Ae+(0,se.default)(e+Pe)).toString()}i(oe,"encryptTea");var j=!1;async function Le(){var g,v,y,k;let{data:n}=await ie(),{tenantID:e,userID:o}=n||{},h=o&&o!=="0"?oe(o):void 0,p=e&&e!=="0"?oe(e):void 0;(g=window.collectEvent)==null||g.call(window,"init",{app_id:788827,channel:"cn",disable_auto_pv:!1,enable_ab_test:!1,enable_debug:!1,enable_stay_duration:!0,reportTime:1e3}),(y=window.collectEvent)==null||y.call(window,"config",{user_unique_id:h,device_type:N()?"mobile":"pc",evtParams:{open_from:(v=new URLSearchParams(window.location.search).get("open-from"))!=null?v:void 0,env:F(),user_id:h,tenant_id:p}}),j=!0,(k=window.collectEvent)==null||k.call(window,"start")}i(Le,"createTracker");async function U({trackKey:n,trackParams:e={}}){var o;try{j||(j=!0,await Le()),(o=window.collectEvent)==null||o.call(window,n,e)}catch(h){console.error(h)}}i(U,"reportTeaEvent");function ce(){return U({trackKey:$.VIEW,trackParams:{artifact_uid:B(),agent_id:"agent_miaoda",url:window.location.href}})}i(ce,"reportPageView");function le(){if(typeof crypto!="undefined"&&crypto.getRandomValues){let e=new Uint8Array(8);return crypto.getRandomValues(e),Array.from(e).map(o=>o.toString(16).padStart(2,"0")).join("")}let n="";for(let e=0;e<16;e++)n+=Math.floor(Math.random()*16).toString(16);return n}i(le,"generateUUID");var ue="x_sdk_device_id";function Be(){try{let n=localStorage.getItem(ue);return n||(n=le(),localStorage.setItem(ue,n)),n}catch{return le()}}i(Be,"getDeviceId");function De(){let n=typeof navigator!="undefined"?navigator.userAgent:"";return n&&(/Android/i.test(n)&&/Mobile/i.test(n)||/iPhone|iPod/i.test(n)||/BlackBerry|IEMobile|Opera Mini/i.test(n))?"mobile":"desktop"}i(De,"getDeviceType");var Re="pageSessionID";function Oe(){try{return new URLSearchParams(window.location.search).get(Re)||""}catch{return""}}i(Oe,"getPvId");function Me(n={}){let e=n.pvId||Oe();return{app_id:window.appId||"",tenant_id:window.tenantId||"",user_id:window.userId||"",did:Be(),module:"app_web",app_env:"runtime",source_type:"user",device_type:De(),release_commit_id:window.__RELEASE_COMMIT_ID__||"",...e?{pv_id:e}:{}}}i(Me,"getDefaultAttributes");function de(n){let e=Math.round(n);if(!Number.isFinite(e))throw new RangeError(`toNanoString: \u975E\u6CD5\u65F6\u95F4\u6233 ${n}`);return typeof BigInt!="function"?e===0?"0":`${e}000000`:String(BigInt(e)*BigInt(1e6))}i(de,"toNanoString");var He="1.0.1";function Fe(n,e){let o=Me(e),h=de(Date.now());return{metricsData:{resource:{attributes:{sdk_version:He,sdk_lang:"javascript",sdk_type:"client-frontend"}},metrics:[{name:"apaas_internal_metrics_pv_uv",description:"Count of page views",unit:"",scopeName:"apaas_internal_metrics_pv_uv",sum:{aggregationTemporality:1,isMonotonic:!0,dataPoints:n.map(p=>({attributes:{...o,url:p.url,path:p.path,referrer:p.referrer},startTimeUnixNano:de(p.timestampMs),timeUnixNano:h,asDouble:1}))}}]}}}i(Fe,"buildPayload");function Ne(n,e,o={},h){if(e.length===0)return;let p;try{p=JSON.stringify(Fe(e,h))}catch{return}try{fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-Suda-Csrf-Token":window.csrfToken||"",...o},body:p,keepalive:!0}).catch(()=>{})}catch{}}i(Ne,"sendPvData");var V="__APAAS_PV_TRACKER_STARTED__";function ze(){try{let n=window;return n[V]?!1:(n[V]=!0,!0)}catch{return!0}}i(ze,"claimPvReporting");function fe(){try{window[V]=!1}catch{}}i(fe,"releasePvReporting");var D,We=(D=class{constructor(){this.started=!1,this.disposers=[],this.holdsPvReporting=!1,this.buffer=[]}static get instance(){return this._instance||(this._instance=new D),this._instance}start(e){var o;if(!this.started&&ze()){this.holdsPvReporting=!0,this.config=e,this.started=!0;try{this.listenRouteChanges(),this.registerLifecycleListeners();let h=(o=e.flushIntervalMs)!=null?o:1e4;this.flushTimer=setInterval(()=>this.flush(),h)}catch(h){throw this.started=!1,this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=void 0),this.holdsPvReporting=!1,fe(),h}}}shutdown(){this.flush(),this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=void 0),this.firstFlushTimer&&(clearTimeout(this.firstFlushTimer),this.firstFlushTimer=void 0),this.started=!1;for(let e of this.disposers.splice(0))try{e()}catch{}this.holdsPvReporting&&(this.holdsPvReporting=!1,fe())}pageKey(){let{origin:e,pathname:o,search:h}=window.location;return`${e}${o}${h}`}scheduleFirstFlush(){var e;let o=(e=this.config)==null?void 0:e.firstFlushDelayMs;o==null||this.firstFlushTimer||(this.firstFlushTimer=setTimeout(()=>this.flush(),o))}recordPv(){let e=this.pageKey();this.lastKey!==e&&(this.lastKey=e,this.buffer.push({url:window.location.href,path:window.location.pathname,referrer:document.referrer,timestampMs:Date.now()}),this.scheduleFirstFlush())}flush(){if(!this.config||this.buffer.length===0)return;let e=this.buffer.splice(0);Ne(this.config.collectorUrl,e,this.config.headers,{pvId:this.config.pvId})}listenRouteChanges(){this.recordPv();let e=i(()=>this.recordPv(),"onPopState");window.addEventListener("popstate",e),this.disposers.push(()=>window.removeEventListener("popstate",e)),this.patchHistory("pushState"),this.patchHistory("replaceState")}patchHistory(e){let o=history[e],h=i(()=>this.recordPv(),"recordPv");history[e]=function(...p){let g=o.apply(this,p);return h(),g},this.disposers.push(()=>{history[e]=o})}registerLifecycleListeners(){let e=i(()=>{document.visibilityState==="hidden"&&this.flush()},"onVisibilityChange");document.addEventListener("visibilitychange",e),this.disposers.push(()=>document.removeEventListener("visibilitychange",e));let o=i(()=>this.flush(),"onPageHide");window.addEventListener("pagehide",o),this.disposers.push(()=>window.removeEventListener("pagehide",o))}},i(D,"_PvTracker"),D),pe=We.instance;function he(){var o;let n=(o=B())!=null?o:"",e=W()?`/app/${n}/__runtime__/api/v1/observability/metrics/collect`:`/spark/app/${n}/runtime/api/v1/observability/metrics/collect`;pe.start({collectorUrl:e})}i(he,"initPvTracking");var je="https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/miaoda-ui",$e=`${je}/doubao.svg`,Ue='<svg viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8.08312 8.08298C8.2384 7.92769 8.23953 7.67705 8.08424 7.52176L5.3625 4.80002L8.08422 2.07829C8.23951 1.92301 8.23839 1.67236 8.0831 1.51708C7.92781 1.36179 7.67717 1.36066 7.52188 1.51595C7.36659 1.67124 4.80016 4.23767 4.80016 4.23767L2.07841 1.51593C1.92313 1.36064 1.67248 1.36177 1.5172 1.51705C1.36191 1.67234 1.36078 1.92298 1.51607 2.07827L4.23782 4.80002L1.51605 7.52178C1.36076 7.67707 1.36189 7.92771 1.51718 8.083C1.67246 8.23829 1.92311 8.23941 2.07839 8.08412L4.80016 5.36236L7.5219 8.0841C7.67719 8.23939 7.92783 8.23826 8.08312 8.08298Z" fill="currentColor"/></svg>',Ve='<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12.6667 2H3.33333V14H6.66667V15.3334H3.33333C2.59695 15.3334 2 14.7364 2 14V2C2 1.26364 2.59695 0.666687 3.33333 0.666687H12.6667C13.403 0.666687 14 1.26364 14 2V7.33335H12.6667V2Z" fill="currentColor"/><path d="M5.33333 4.66669C4.96514 4.66669 4.66667 4.96516 4.66667 5.33335C4.66667 5.70154 4.96514 6 5.33333 6H10.6667C11.0349 6 11.3333 5.70154 11.3333 5.33335C11.3333 4.96516 11.0349 4.66669 10.6667 4.66669H5.33333Z" fill="currentColor"/><path d="M4.66667 8.33335C4.66667 7.96516 4.96514 7.66669 5.33333 7.66669H8C8.36819 7.66669 8.66667 7.96516 8.66667 8.33335C8.66667 8.70154 8.36819 9 8 9H5.33333C4.96514 9 4.66667 8.70154 4.66667 8.33335Z" fill="currentColor"/><path d="M13.5523 8.70017C13.9428 8.30964 14.576 8.30964 14.9665 8.70017C15.357 9.09069 15.357 9.72386 14.9665 10.1144L14.2594 10.8215L12.8452 9.40728L13.5523 8.70017Z" fill="currentColor"/><path d="M12.1381 10.1144L13.5523 11.5286L10.2309 14.85C10.0916 14.9892 9.91229 15.0815 9.71798 15.1138L8.45737 15.3234C8.42136 15.3294 8.38467 15.3177 8.35885 15.2918C8.33271 15.2657 8.32099 15.2284 8.32749 15.192L8.55128 13.9374C8.58465 13.7502 8.6746 13.5779 8.80901 13.4435L12.1381 10.1144Z" fill="currentColor"/></svg>',ge=!0,Ke="\u8C46\u5305 AI \u751F\u6210",Ze="\u7531\u98DE\u4E66\u5999\u642D\u63D0\u4F9B\u652F\u6301",Ge="0px 8px 32px rgba(0,0,0,0.08), 0px 4px 16px rgba(0,0,0,0.04), 0px 2px 4px rgba(0,0,0,0.02)",Je="0px 4px 16px rgba(0,0,0,0.03), 0px 4px 10px rgba(0,0,0,0.03), 0px 2px 4px rgba(0,0,0,0.02)",Z="'PingFang SC', -apple-system, BlinkMacSystemFont, sans-serif",qe={BOE:"tns.feishu-boe.cn",PRE:"tns.feishu-pre.cn",ONLINE:"tns.feishu.cn"};function me(){var o;let n=JSON.stringify({scene:"miaoda_app_report",entity_id:(o=B())!=null?o:"",entity_type:"miaoda_app",extra:""}),e=`https://${qe[F()]}/cust/lark_report/?type=common¶ms=${encodeURIComponent(n)}&lang=zh-CN`;window.open(e,"_blank","noopener,noreferrer")}i(me,"openDoubaoReport");function be(n){let e=document.createElement("span");Object.assign(e.style,{display:"inline-flex",width:`${n}px`,height:`${n}px`,flexShrink:"0"}),e.innerHTML=Ue;let o=e.firstElementChild;return o&&(o.setAttribute("width",String(n)),o.setAttribute("height",String(n)),o.style.display="block"),e}i(be,"makeCloseIcon");function Xe(n){let e=document.createElement("img");return e.src=$e,e.width=n,e.height=n,e.alt="",Object.assign(e.style,{width:`${n}px`,height:`${n}px`,maxWidth:"none",maxHeight:"none",borderRadius:"100px",flexShrink:"0",display:"block"}),e}i(Xe,"makeAvatar");function ye(n,e){let o=n==="desktop",h=document.createElement("div");Object.assign(h.style,{boxSizing:"border-box",display:"inline-flex",alignItems:"center",gap:o?"4px":"6px",padding:o?"6px 12px 6px 8px":"4px 12px 4px 8px",background:"#363636",border:"0.5px solid rgba(255,255,255,0.1)",borderRadius:"100px",boxShadow:Ge,cursor:"pointer"});let p=Xe(o?16:18),g=document.createElement("span");if(g.textContent=Ke,Object.assign(g.style,{fontFamily:Z,fontSize:o?"12px":"14px",lineHeight:o?"18px":"22px",color:"rgba(255,255,255,0.85)",whiteSpace:"nowrap"}),h.append(p,g),o&&e){let v=document.createElement("span");v.setAttribute("role","button"),v.setAttribute("aria-label","\u5173\u95ED"),v.setAttribute("data-doubao-close",""),Object.assign(v.style,{display:"none",alignItems:"center",cursor:"pointer",flexShrink:"0",color:"rgba(255,255,255,0.5)"}),v.appendChild(be(10)),v.addEventListener("click",y=>{y.stopPropagation(),e()}),h.appendChild(v)}return h}i(ye,"buildPill");function K(n){let e=document.createElement("div");e.setAttribute("role","menuitem"),e.setAttribute("data-label",n.label),Object.assign(e.style,{boxSizing:"border-box",display:"flex",alignItems:"center",gap:"8px",padding:"4px 10px",borderRadius:"6px",cursor:"pointer",color:"#000000"});let o=document.createElement("span");Object.assign(o.style,{display:"inline-flex",width:"16px",height:"16px",flexShrink:"0",color:"#000000"}),n.icon==="feedback"?o.innerHTML=Ve:o.appendChild(be(16));let h=document.createElement("span");return h.textContent=n.label,Object.assign(h.style,{fontFamily:Z,fontSize:`${n.fontSize}px`,lineHeight:`${n.fontSize+8}px`,color:"#000000",whiteSpace:"nowrap"}),e.append(o,h),e.addEventListener("mouseenter",()=>{e.style.background="rgba(0,0,0,0.04)"}),e.addEventListener("mouseleave",()=>{e.style.background="transparent"}),e.addEventListener("click",n.onClick),e}i(K,"buildMenuRow");function _e(n){let e=document.createElement("div");if(Object.assign(e.style,{boxSizing:"border-box",display:"flex",flexDirection:"column",minWidth:`${n.minWidth}px`,background:"#ffffff",border:"0.5px solid rgba(0,0,0,0.1)",borderRadius:"10px",boxShadow:Je,overflow:"hidden",outline:"none"}),n.rows.length){let h=document.createElement("div");Object.assign(h.style,{boxSizing:"border-box",padding:"4px"}),n.rows.forEach(p=>h.appendChild(p)),e.appendChild(h)}let o=document.createElement("div");return o.textContent=Ze,Object.assign(o.style,{boxSizing:"border-box",background:"#f9f9f9",padding:"8px 14px",fontFamily:Z,fontSize:`${n.footerFontSize}px`,lineHeight:`${n.footerFontSize+8}px`,color:"rgba(0,0,0,0.35)",whiteSpace:"nowrap"}),e.appendChild(o),e}i(_e,"buildMenuCard");function Ye(){let n=document.createElement("div");n.setAttribute("data-custom-element","doubao-watermark"),Object.assign(n.style,{position:"fixed",right:"12px",bottom:"12px",zIndex:"9999",display:"flex",flexDirection:"column",alignItems:"flex-end",gap:"8px"});let e=[];ge&&e.push(K({icon:"feedback",label:"\u6295\u8BC9\u4E0E\u4E3E\u62A5",fontSize:14,onClick:me}));let o=_e({rows:e,footerFontSize:12,minWidth:144});o.style.display="none";let h=ye("desktop",()=>n.remove()),p=h.querySelector("[data-doubao-close]");n.append(o,h);let g=null;return n.addEventListener("mouseenter",()=>{g&&clearTimeout(g),o.style.display="flex",p&&(p.style.display="inline-flex")}),n.addEventListener("mouseleave",()=>{g=setTimeout(()=>{o.style.display="none",p&&(p.style.display="none")},100)}),n}i(Ye,"buildDesktopWatermark");function Qe(){let n=document.createElement("div");n.setAttribute("data-custom-element","doubao-watermark-mobile"),Object.assign(n.style,{position:"fixed",right:"12px",bottom:"12px",zIndex:"9999",display:"flex",flexDirection:"column",alignItems:"flex-end",gap:"8px",cursor:"pointer"});let e=[];ge&&e.push(K({icon:"feedback",label:"\u6295\u8BC9\u4E0E\u4E3E\u62A5",fontSize:16,onClick:me})),e.push(K({icon:"close",label:"\u4E0D\u518D\u5C55\u793A",fontSize:16,onClick:i(p=>{p.stopPropagation(),n.remove()},"onClick")}));let o=_e({rows:e,footerFontSize:14,minWidth:160});o.style.display="none";let h=ye("mobile");return n.append(o,h),n.addEventListener("click",p=>{p.stopPropagation(),o.style.display=o.style.display==="none"?"flex":"none"}),document.addEventListener("click",()=>{o.style.display="none"}),n}i(Qe,"buildMobileWatermark");var ve=!1;function G(){if(ve||typeof document=="undefined")return;if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",G,{once:!0});return}ve=!0;let n=N()?Qe():Ye();document.body.appendChild(n)}i(G,"mountDoubaoWatermark");var et="0.0.12",tt="@lark-apaas/miaoda-coding-sdk";re()&&(ce(),he());G();return Ie(nt);})();
|
package/dist/runtime.dev.js
CHANGED
|
@@ -1166,7 +1166,7 @@ var MiaodaRuntime = (() => {
|
|
|
1166
1166
|
return String(BigInt(msInt) * BigInt(1e6));
|
|
1167
1167
|
}
|
|
1168
1168
|
__name(toNanoString, "toNanoString");
|
|
1169
|
-
var SDK_VERSION = "1.0.
|
|
1169
|
+
var SDK_VERSION = "1.0.1";
|
|
1170
1170
|
function buildPayload(dataPoints, overrides) {
|
|
1171
1171
|
const defaultAttrs = getDefaultAttributes(overrides);
|
|
1172
1172
|
const nowNs = toNanoString(Date.now());
|
|
@@ -1711,7 +1711,7 @@ var MiaodaRuntime = (() => {
|
|
|
1711
1711
|
__name(mountDoubaoWatermark, "mountDoubaoWatermark");
|
|
1712
1712
|
|
|
1713
1713
|
// src/runtime.ts
|
|
1714
|
-
var version = "0.0.12
|
|
1714
|
+
var version = "0.0.12";
|
|
1715
1715
|
var name = "@lark-apaas/miaoda-coding-sdk";
|
|
1716
1716
|
if (isOnlineEnv()) {
|
|
1717
1717
|
reportPageView();
|
package/dist/runtime.js
CHANGED
|
@@ -1166,7 +1166,7 @@ var MiaodaRuntime = (() => {
|
|
|
1166
1166
|
return String(BigInt(msInt) * BigInt(1e6));
|
|
1167
1167
|
}
|
|
1168
1168
|
__name(toNanoString, "toNanoString");
|
|
1169
|
-
var SDK_VERSION = "1.0.
|
|
1169
|
+
var SDK_VERSION = "1.0.1";
|
|
1170
1170
|
function buildPayload(dataPoints, overrides) {
|
|
1171
1171
|
const defaultAttrs = getDefaultAttributes(overrides);
|
|
1172
1172
|
const nowNs = toNanoString(Date.now());
|
|
@@ -1711,7 +1711,7 @@ var MiaodaRuntime = (() => {
|
|
|
1711
1711
|
__name(mountDoubaoWatermark, "mountDoubaoWatermark");
|
|
1712
1712
|
|
|
1713
1713
|
// src/runtime.ts
|
|
1714
|
-
var version = "0.0.12
|
|
1714
|
+
var version = "0.0.12";
|
|
1715
1715
|
var name = "@lark-apaas/miaoda-coding-sdk";
|
|
1716
1716
|
if (isOnlineEnv()) {
|
|
1717
1717
|
reportPageView();
|
package/dist/runtime.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var MiaodaRuntime=(()=>{var we=Object.create;var R=Object.defineProperty;var xe=Object.getOwnPropertyDescriptor;var Ce=Object.getOwnPropertyNames;var Se=Object.getPrototypeOf,ke=Object.prototype.hasOwnProperty;var i=(n,e)=>R(n,"name",{value:e,configurable:!0});var z=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),Ee=(n,e)=>{for(var o in e)R(n,o,{get:e[o],enumerable:!0})},J=(n,e,o,h)=>{if(e&&typeof e=="object"||typeof e=="function")for(let p of Ce(e))!ke.call(n,p)&&p!==o&&R(n,p,{get:()=>e[p],enumerable:!(h=xe(e,p))||h.enumerable});return n};var q=(n,e,o)=>(o=n!=null?we(Se(n)):{},J(e||!n||!n.__esModule?R(o,"default",{value:n,enumerable:!0}):o,n)),Ie=n=>J(R({},"__esModule",{value:!0}),n);var Y=z((X,O)=>{"use strict";(function(n){"use strict";function e(t,f){var r=(t&65535)+(f&65535),b=(t>>16)+(f>>16)+(r>>16);return b<<16|r&65535}i(e,"safeAdd");function o(t,f){return t<<f|t>>>32-f}i(o,"bitRotateLeft");function h(t,f,r,b,w,S){return e(o(e(e(f,t),e(b,S)),w),r)}i(h,"md5cmn");function p(t,f,r,b,w,S,A){return h(f&r|~f&b,t,f,w,S,A)}i(p,"md5ff");function g(t,f,r,b,w,S,A){return h(f&b|r&~b,t,f,w,S,A)}i(g,"md5gg");function v(t,f,r,b,w,S,A){return h(f^r^b,t,f,w,S,A)}i(v,"md5hh");function y(t,f,r,b,w,S,A){return h(r^(f|~b),t,f,w,S,A)}i(y,"md5ii");function k(t,f){t[f>>5]|=128<<f%32,t[(f+64>>>9<<4)+14]=f;var r,b,w,S,A,a=1732584193,s=-271733879,c=-1732584194,l=271733878;for(r=0;r<t.length;r+=16)b=a,w=s,S=c,A=l,a=p(a,s,c,l,t[r],7,-680876936),l=p(l,a,s,c,t[r+1],12,-389564586),c=p(c,l,a,s,t[r+2],17,606105819),s=p(s,c,l,a,t[r+3],22,-1044525330),a=p(a,s,c,l,t[r+4],7,-176418897),l=p(l,a,s,c,t[r+5],12,1200080426),c=p(c,l,a,s,t[r+6],17,-1473231341),s=p(s,c,l,a,t[r+7],22,-45705983),a=p(a,s,c,l,t[r+8],7,1770035416),l=p(l,a,s,c,t[r+9],12,-1958414417),c=p(c,l,a,s,t[r+10],17,-42063),s=p(s,c,l,a,t[r+11],22,-1990404162),a=p(a,s,c,l,t[r+12],7,1804603682),l=p(l,a,s,c,t[r+13],12,-40341101),c=p(c,l,a,s,t[r+14],17,-1502002290),s=p(s,c,l,a,t[r+15],22,1236535329),a=g(a,s,c,l,t[r+1],5,-165796510),l=g(l,a,s,c,t[r+6],9,-1069501632),c=g(c,l,a,s,t[r+11],14,643717713),s=g(s,c,l,a,t[r],20,-373897302),a=g(a,s,c,l,t[r+5],5,-701558691),l=g(l,a,s,c,t[r+10],9,38016083),c=g(c,l,a,s,t[r+15],14,-660478335),s=g(s,c,l,a,t[r+4],20,-405537848),a=g(a,s,c,l,t[r+9],5,568446438),l=g(l,a,s,c,t[r+14],9,-1019803690),c=g(c,l,a,s,t[r+3],14,-187363961),s=g(s,c,l,a,t[r+8],20,1163531501),a=g(a,s,c,l,t[r+13],5,-1444681467),l=g(l,a,s,c,t[r+2],9,-51403784),c=g(c,l,a,s,t[r+7],14,1735328473),s=g(s,c,l,a,t[r+12],20,-1926607734),a=v(a,s,c,l,t[r+5],4,-378558),l=v(l,a,s,c,t[r+8],11,-2022574463),c=v(c,l,a,s,t[r+11],16,1839030562),s=v(s,c,l,a,t[r+14],23,-35309556),a=v(a,s,c,l,t[r+1],4,-1530992060),l=v(l,a,s,c,t[r+4],11,1272893353),c=v(c,l,a,s,t[r+7],16,-155497632),s=v(s,c,l,a,t[r+10],23,-1094730640),a=v(a,s,c,l,t[r+13],4,681279174),l=v(l,a,s,c,t[r],11,-358537222),c=v(c,l,a,s,t[r+3],16,-722521979),s=v(s,c,l,a,t[r+6],23,76029189),a=v(a,s,c,l,t[r+9],4,-640364487),l=v(l,a,s,c,t[r+12],11,-421815835),c=v(c,l,a,s,t[r+15],16,530742520),s=v(s,c,l,a,t[r+2],23,-995338651),a=y(a,s,c,l,t[r],6,-198630844),l=y(l,a,s,c,t[r+7],10,1126891415),c=y(c,l,a,s,t[r+14],15,-1416354905),s=y(s,c,l,a,t[r+5],21,-57434055),a=y(a,s,c,l,t[r+12],6,1700485571),l=y(l,a,s,c,t[r+3],10,-1894986606),c=y(c,l,a,s,t[r+10],15,-1051523),s=y(s,c,l,a,t[r+1],21,-2054922799),a=y(a,s,c,l,t[r+8],6,1873313359),l=y(l,a,s,c,t[r+15],10,-30611744),c=y(c,l,a,s,t[r+6],15,-1560198380),s=y(s,c,l,a,t[r+13],21,1309151649),a=y(a,s,c,l,t[r+4],6,-145523070),l=y(l,a,s,c,t[r+11],10,-1120210379),c=y(c,l,a,s,t[r+2],15,718787259),s=y(s,c,l,a,t[r+9],21,-343485551),a=e(a,b),s=e(s,w),c=e(c,S),l=e(l,A);return[a,s,c,l]}i(k,"binlMD5");function L(t){var f,r="",b=t.length*32;for(f=0;f<b;f+=8)r+=String.fromCharCode(t[f>>5]>>>f%32&255);return r}i(L,"binl2rstr");function x(t){var f,r=[];for(r[(t.length>>2)-1]=void 0,f=0;f<r.length;f+=1)r[f]=0;var b=t.length*8;for(f=0;f<b;f+=8)r[f>>5]|=(t.charCodeAt(f/8)&255)<<f%32;return r}i(x,"rstr2binl");function I(t){return L(k(x(t),t.length*8))}i(I,"rstrMD5");function E(t,f){var r,b=x(t),w=[],S=[],A;for(w[15]=S[15]=void 0,b.length>16&&(b=k(b,t.length*8)),r=0;r<16;r+=1)w[r]=b[r]^909522486,S[r]=b[r]^1549556828;return A=k(w.concat(x(f)),512+f.length*8),L(k(S.concat(A),640))}i(E,"rstrHMACMD5");function P(t){var f="0123456789abcdef",r="",b,w;for(w=0;w<t.length;w+=1)b=t.charCodeAt(w),r+=f.charAt(b>>>4&15)+f.charAt(b&15);return r}i(P,"rstr2hex");function T(t){return unescape(encodeURIComponent(t))}i(T,"str2rstrUTF8");function u(t){return I(T(t))}i(u,"rawMD5");function d(t){return P(u(t))}i(d,"hexMD5");function _(t,f){return E(T(t),T(f))}i(_,"rawHMACMD5");function m(t,f){return P(_(t,f))}i(m,"hexHMACMD5");function C(t,f,r){return f?r?_(f,t):m(f,t):r?u(t):d(t)}i(C,"md5"),typeof define=="function"&&define.amd?define(function(){return C}):typeof O=="object"&&O.exports?O.exports=C:n.md5=C})(X)});var ee=z((M,Q)=>{"use strict";(function(n,e){typeof M=="object"?Q.exports=M=e():typeof define=="function"&&define.amd?define([],e):n.CryptoJS=e()})(M,function(){var n=n||(function(e,o){var h=Object.create||(function(){function u(){}return i(u,"F"),function(d){var _;return u.prototype=d,_=new u,u.prototype=null,_}})(),p={},g=p.lib={},v=g.Base=(function(){return{extend:i(function(u){var d=h(this);return u&&d.mixIn(u),(!d.hasOwnProperty("init")||this.init===d.init)&&(d.init=function(){d.$super.init.apply(this,arguments)}),d.init.prototype=d,d.$super=this,d},"extend"),create:i(function(){var u=this.extend();return u.init.apply(u,arguments),u},"create"),init:i(function(){},"init"),mixIn:i(function(u){for(var d in u)u.hasOwnProperty(d)&&(this[d]=u[d]);u.hasOwnProperty("toString")&&(this.toString=u.toString)},"mixIn"),clone:i(function(){return this.init.prototype.extend(this)},"clone")}})(),y=g.WordArray=v.extend({init:i(function(u,d){u=this.words=u||[],d!=o?this.sigBytes=d:this.sigBytes=u.length*4},"init"),toString:i(function(u){return(u||L).stringify(this)},"toString"),concat:i(function(u){var d=this.words,_=u.words,m=this.sigBytes,C=u.sigBytes;if(this.clamp(),m%4)for(var t=0;t<C;t++){var f=_[t>>>2]>>>24-t%4*8&255;d[m+t>>>2]|=f<<24-(m+t)%4*8}else for(var t=0;t<C;t+=4)d[m+t>>>2]=_[t>>>2];return this.sigBytes+=C,this},"concat"),clamp:i(function(){var u=this.words,d=this.sigBytes;u[d>>>2]&=4294967295<<32-d%4*8,u.length=e.ceil(d/4)},"clamp"),clone:i(function(){var u=v.clone.call(this);return u.words=this.words.slice(0),u},"clone"),random:i(function(u){for(var d=[],_=i(function(r){var r=r,b=987654321,w=4294967295;return function(){b=36969*(b&65535)+(b>>16)&w,r=18e3*(r&65535)+(r>>16)&w;var S=(b<<16)+r&w;return S/=4294967296,S+=.5,S*(e.random()>.5?1:-1)}},"r"),m=0,C;m<u;m+=4){var t=_((C||e.random())*4294967296);C=t()*987654071,d.push(t()*4294967296|0)}return new y.init(d,u)},"random")}),k=p.enc={},L=k.Hex={stringify:i(function(u){for(var d=u.words,_=u.sigBytes,m=[],C=0;C<_;C++){var t=d[C>>>2]>>>24-C%4*8&255;m.push((t>>>4).toString(16)),m.push((t&15).toString(16))}return m.join("")},"stringify"),parse:i(function(u){for(var d=u.length,_=[],m=0;m<d;m+=2)_[m>>>3]|=parseInt(u.substr(m,2),16)<<24-m%8*4;return new y.init(_,d/2)},"parse")},x=k.Latin1={stringify:i(function(u){for(var d=u.words,_=u.sigBytes,m=[],C=0;C<_;C++){var t=d[C>>>2]>>>24-C%4*8&255;m.push(String.fromCharCode(t))}return m.join("")},"stringify"),parse:i(function(u){for(var d=u.length,_=[],m=0;m<d;m++)_[m>>>2]|=(u.charCodeAt(m)&255)<<24-m%4*8;return new y.init(_,d)},"parse")},I=k.Utf8={stringify:i(function(u){try{return decodeURIComponent(escape(x.stringify(u)))}catch{throw new Error("Malformed UTF-8 data")}},"stringify"),parse:i(function(u){return x.parse(unescape(encodeURIComponent(u)))},"parse")},E=g.BufferedBlockAlgorithm=v.extend({reset:i(function(){this._data=new y.init,this._nDataBytes=0},"reset"),_append:i(function(u){typeof u=="string"&&(u=I.parse(u)),this._data.concat(u),this._nDataBytes+=u.sigBytes},"_append"),_process:i(function(u){var d=this._data,_=d.words,m=d.sigBytes,C=this.blockSize,t=C*4,f=m/t;u?f=e.ceil(f):f=e.max((f|0)-this._minBufferSize,0);var r=f*C,b=e.min(r*4,m);if(r){for(var w=0;w<r;w+=C)this._doProcessBlock(_,w);var S=_.splice(0,r);d.sigBytes-=b}return new y.init(S,b)},"_process"),clone:i(function(){var u=v.clone.call(this);return u._data=this._data.clone(),u},"clone"),_minBufferSize:0}),P=g.Hasher=E.extend({cfg:v.extend(),init:i(function(u){this.cfg=this.cfg.extend(u),this.reset()},"init"),reset:i(function(){E.reset.call(this),this._doReset()},"reset"),update:i(function(u){return this._append(u),this._process(),this},"update"),finalize:i(function(u){u&&this._append(u);var d=this._doFinalize();return d},"finalize"),blockSize:512/32,_createHelper:i(function(u){return function(d,_){return new u.init(_).finalize(d)}},"_createHelper"),_createHmacHelper:i(function(u){return function(d,_){return new T.HMAC.init(u,_).finalize(d)}},"_createHmacHelper")}),T=p.algo={};return p})(Math);return n})});var ne=z((H,te)=>{"use strict";(function(n,e){typeof H=="object"?te.exports=H=e(ee()):typeof define=="function"&&define.amd?define(["./core"],e):e(n.CryptoJS)})(H,function(n){return(function(){var e=n,o=e.lib,h=o.WordArray,p=o.Hasher,g=e.algo,v=[],y=g.SHA1=p.extend({_doReset:i(function(){this._hash=new h.init([1732584193,4023233417,2562383102,271733878,3285377520])},"_doReset"),_doProcessBlock:i(function(k,L){for(var x=this._hash.words,I=x[0],E=x[1],P=x[2],T=x[3],u=x[4],d=0;d<80;d++){if(d<16)v[d]=k[L+d]|0;else{var _=v[d-3]^v[d-8]^v[d-14]^v[d-16];v[d]=_<<1|_>>>31}var m=(I<<5|I>>>27)+u+v[d];d<20?m+=(E&P|~E&T)+1518500249:d<40?m+=(E^P^T)+1859775393:d<60?m+=(E&P|E&T|P&T)-1894007588:m+=(E^P^T)-899497514,u=T,T=P,P=E<<30|E>>>2,E=I,I=m}x[0]=x[0]+I|0,x[1]=x[1]+E|0,x[2]=x[2]+P|0,x[3]=x[3]+T|0,x[4]=x[4]+u|0},"_doProcessBlock"),_doFinalize:i(function(){var k=this._data,L=k.words,x=this._nDataBytes*8,I=k.sigBytes*8;return L[I>>>5]|=128<<24-I%32,L[(I+64>>>9<<4)+14]=Math.floor(x/4294967296),L[(I+64>>>9<<4)+15]=x,k.sigBytes=L.length*4,this._process(),this._hash},"_doFinalize"),clone:i(function(){var k=p.clone.call(this);return k._hash=this._hash.clone(),k},"clone")});e.SHA1=p._createHelper(y),e.HmacSHA1=p._createHmacHelper(y)})(),n.SHA1})});var nt={};Ee(nt,{TrackKey:()=>$,name:()=>tt,reportTeaEvent:()=>U,version:()=>et});var ae=q(Y(),1),se=q(ne(),1);function B(){return window.appId||null}i(B,"getAppId");function Te(){var o;let n="suda-csrf-token",e=document.cookie.split("; ");for(let h of e){let[p,g]=h.split("=");if(p===n)return decodeURIComponent(g)}return(o=window.csrfToken)!=null?o:null}i(Te,"getCsrfToken");function W(){let n=globalThis.CLIENT_BASE_PATH||"/";return/^\/app\/[^/]/.test(n)}i(W,"isNewPathEnabled");function F(){switch(globalThis.ENVIRONMENT){case"gray":return"PRE";case"online":return"ONLINE";default:return"BOE"}}i(F,"getEnv");function re(){return window.appEnv!=null?window.appEnv==="runtime":!0}i(re,"isOnlineEnv");function N(){let n=navigator.userAgent,e=/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(n),o=/iPad|Tab|Tablet/i.test(n)&&navigator.maxTouchPoints>1;return e||o}i(N,"isMobile");async function ie(){var h;let n=B();if(!n)return{code:1,msg:"appId is required",data:{}};let e=W()?`/app/${n}/__runtime__/api/v1/studio/lark/user_info`:`/spark/b/${n}/lark/user_info`;return await(await fetch(e,{headers:{"X-Suda-Csrf-Token":(h=Te())!=null?h:""}})).json()}i(ie,"getLarkUserInfo");var $={VIEW:"aily_agent_artifact_page_view"},Ae="08a441",Pe="42b91e";function oe(n){let e=String(n);return(0,se.default)(Ae+(0,ae.default)(e+Pe)).toString()}i(oe,"encryptTea");var j=!1;async function Le(){var g,v,y,k;let{data:n}=await ie(),{tenantID:e,userID:o}=n||{},h=o&&o!=="0"?oe(o):void 0,p=e&&e!=="0"?oe(e):void 0;(g=window.collectEvent)==null||g.call(window,"init",{app_id:788827,channel:"cn",disable_auto_pv:!1,enable_ab_test:!1,enable_debug:!1,enable_stay_duration:!0,reportTime:1e3}),(y=window.collectEvent)==null||y.call(window,"config",{user_unique_id:h,device_type:N()?"mobile":"pc",evtParams:{open_from:(v=new URLSearchParams(window.location.search).get("open-from"))!=null?v:void 0,env:F(),user_id:h,tenant_id:p}}),j=!0,(k=window.collectEvent)==null||k.call(window,"start")}i(Le,"createTracker");async function U({trackKey:n,trackParams:e={}}){var o;try{j||(j=!0,await Le()),(o=window.collectEvent)==null||o.call(window,n,e)}catch(h){console.error(h)}}i(U,"reportTeaEvent");function ce(){return U({trackKey:$.VIEW,trackParams:{artifact_uid:B(),agent_id:"agent_miaoda",url:window.location.href}})}i(ce,"reportPageView");function le(){if(typeof crypto!="undefined"&&crypto.getRandomValues){let e=new Uint8Array(8);return crypto.getRandomValues(e),Array.from(e).map(o=>o.toString(16).padStart(2,"0")).join("")}let n="";for(let e=0;e<16;e++)n+=Math.floor(Math.random()*16).toString(16);return n}i(le,"generateUUID");var ue="x_sdk_device_id";function Be(){try{let n=localStorage.getItem(ue);return n||(n=le(),localStorage.setItem(ue,n)),n}catch{return le()}}i(Be,"getDeviceId");function De(){let n=typeof navigator!="undefined"?navigator.userAgent:"";return n&&(/Android/i.test(n)&&/Mobile/i.test(n)||/iPhone|iPod/i.test(n)||/BlackBerry|IEMobile|Opera Mini/i.test(n))?"mobile":"desktop"}i(De,"getDeviceType");var Re="pageSessionID";function Oe(){try{return new URLSearchParams(window.location.search).get(Re)||""}catch{return""}}i(Oe,"getPvId");function Me(n={}){let e=n.pvId||Oe();return{app_id:window.appId||"",tenant_id:window.tenantId||"",user_id:window.userId||"",did:Be(),module:"app_web",app_env:"runtime",source_type:"user",device_type:De(),release_commit_id:window.__RELEASE_COMMIT_ID__||"",...e?{pv_id:e}:{}}}i(Me,"getDefaultAttributes");function de(n){let e=Math.round(n);if(!Number.isFinite(e))throw new RangeError(`toNanoString: \u975E\u6CD5\u65F6\u95F4\u6233 ${n}`);return typeof BigInt!="function"?e===0?"0":`${e}000000`:String(BigInt(e)*BigInt(1e6))}i(de,"toNanoString");var He="1.0.2-alpha.20260831083248";function Fe(n,e){let o=Me(e),h=de(Date.now());return{metricsData:{resource:{attributes:{sdk_version:He,sdk_lang:"javascript",sdk_type:"client-frontend"}},metrics:[{name:"apaas_internal_metrics_pv_uv",description:"Count of page views",unit:"",scopeName:"apaas_internal_metrics_pv_uv",sum:{aggregationTemporality:1,isMonotonic:!0,dataPoints:n.map(p=>({attributes:{...o,url:p.url,path:p.path,referrer:p.referrer},startTimeUnixNano:de(p.timestampMs),timeUnixNano:h,asDouble:1}))}}]}}}i(Fe,"buildPayload");function Ne(n,e,o={},h){if(e.length===0)return;let p;try{p=JSON.stringify(Fe(e,h))}catch{return}try{fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-Suda-Csrf-Token":window.csrfToken||"",...o},body:p,keepalive:!0}).catch(()=>{})}catch{}}i(Ne,"sendPvData");var V="__APAAS_PV_TRACKER_STARTED__";function ze(){try{let n=window;return n[V]?!1:(n[V]=!0,!0)}catch{return!0}}i(ze,"claimPvReporting");function fe(){try{window[V]=!1}catch{}}i(fe,"releasePvReporting");var D,We=(D=class{constructor(){this.started=!1,this.disposers=[],this.holdsPvReporting=!1,this.buffer=[]}static get instance(){return this._instance||(this._instance=new D),this._instance}start(e){var o;if(!this.started&&ze()){this.holdsPvReporting=!0,this.config=e,this.started=!0;try{this.listenRouteChanges(),this.registerLifecycleListeners();let h=(o=e.flushIntervalMs)!=null?o:1e4;this.flushTimer=setInterval(()=>this.flush(),h)}catch(h){throw this.started=!1,this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=void 0),this.holdsPvReporting=!1,fe(),h}}}shutdown(){this.flush(),this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=void 0),this.firstFlushTimer&&(clearTimeout(this.firstFlushTimer),this.firstFlushTimer=void 0),this.started=!1;for(let e of this.disposers.splice(0))try{e()}catch{}this.holdsPvReporting&&(this.holdsPvReporting=!1,fe())}pageKey(){let{origin:e,pathname:o,search:h}=window.location;return`${e}${o}${h}`}scheduleFirstFlush(){var e;let o=(e=this.config)==null?void 0:e.firstFlushDelayMs;o==null||this.firstFlushTimer||(this.firstFlushTimer=setTimeout(()=>this.flush(),o))}recordPv(){let e=this.pageKey();this.lastKey!==e&&(this.lastKey=e,this.buffer.push({url:window.location.href,path:window.location.pathname,referrer:document.referrer,timestampMs:Date.now()}),this.scheduleFirstFlush())}flush(){if(!this.config||this.buffer.length===0)return;let e=this.buffer.splice(0);Ne(this.config.collectorUrl,e,this.config.headers,{pvId:this.config.pvId})}listenRouteChanges(){this.recordPv();let e=i(()=>this.recordPv(),"onPopState");window.addEventListener("popstate",e),this.disposers.push(()=>window.removeEventListener("popstate",e)),this.patchHistory("pushState"),this.patchHistory("replaceState")}patchHistory(e){let o=history[e],h=i(()=>this.recordPv(),"recordPv");history[e]=function(...p){let g=o.apply(this,p);return h(),g},this.disposers.push(()=>{history[e]=o})}registerLifecycleListeners(){let e=i(()=>{document.visibilityState==="hidden"&&this.flush()},"onVisibilityChange");document.addEventListener("visibilitychange",e),this.disposers.push(()=>document.removeEventListener("visibilitychange",e));let o=i(()=>this.flush(),"onPageHide");window.addEventListener("pagehide",o),this.disposers.push(()=>window.removeEventListener("pagehide",o))}},i(D,"_PvTracker"),D),pe=We.instance;function he(){var o;let n=(o=B())!=null?o:"",e=W()?`/app/${n}/__runtime__/api/v1/observability/metrics/collect`:`/spark/app/${n}/runtime/api/v1/observability/metrics/collect`;pe.start({collectorUrl:e})}i(he,"initPvTracking");var je="https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/miaoda-ui",$e=`${je}/doubao.svg`,Ue='<svg viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8.08312 8.08298C8.2384 7.92769 8.23953 7.67705 8.08424 7.52176L5.3625 4.80002L8.08422 2.07829C8.23951 1.92301 8.23839 1.67236 8.0831 1.51708C7.92781 1.36179 7.67717 1.36066 7.52188 1.51595C7.36659 1.67124 4.80016 4.23767 4.80016 4.23767L2.07841 1.51593C1.92313 1.36064 1.67248 1.36177 1.5172 1.51705C1.36191 1.67234 1.36078 1.92298 1.51607 2.07827L4.23782 4.80002L1.51605 7.52178C1.36076 7.67707 1.36189 7.92771 1.51718 8.083C1.67246 8.23829 1.92311 8.23941 2.07839 8.08412L4.80016 5.36236L7.5219 8.0841C7.67719 8.23939 7.92783 8.23826 8.08312 8.08298Z" fill="currentColor"/></svg>',Ve='<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12.6667 2H3.33333V14H6.66667V15.3334H3.33333C2.59695 15.3334 2 14.7364 2 14V2C2 1.26364 2.59695 0.666687 3.33333 0.666687H12.6667C13.403 0.666687 14 1.26364 14 2V7.33335H12.6667V2Z" fill="currentColor"/><path d="M5.33333 4.66669C4.96514 4.66669 4.66667 4.96516 4.66667 5.33335C4.66667 5.70154 4.96514 6 5.33333 6H10.6667C11.0349 6 11.3333 5.70154 11.3333 5.33335C11.3333 4.96516 11.0349 4.66669 10.6667 4.66669H5.33333Z" fill="currentColor"/><path d="M4.66667 8.33335C4.66667 7.96516 4.96514 7.66669 5.33333 7.66669H8C8.36819 7.66669 8.66667 7.96516 8.66667 8.33335C8.66667 8.70154 8.36819 9 8 9H5.33333C4.96514 9 4.66667 8.70154 4.66667 8.33335Z" fill="currentColor"/><path d="M13.5523 8.70017C13.9428 8.30964 14.576 8.30964 14.9665 8.70017C15.357 9.09069 15.357 9.72386 14.9665 10.1144L14.2594 10.8215L12.8452 9.40728L13.5523 8.70017Z" fill="currentColor"/><path d="M12.1381 10.1144L13.5523 11.5286L10.2309 14.85C10.0916 14.9892 9.91229 15.0815 9.71798 15.1138L8.45737 15.3234C8.42136 15.3294 8.38467 15.3177 8.35885 15.2918C8.33271 15.2657 8.32099 15.2284 8.32749 15.192L8.55128 13.9374C8.58465 13.7502 8.6746 13.5779 8.80901 13.4435L12.1381 10.1144Z" fill="currentColor"/></svg>',ge=!0,Ke="\u8C46\u5305 AI \u751F\u6210",Ze="\u7531\u98DE\u4E66\u5999\u642D\u63D0\u4F9B\u652F\u6301",Ge="0px 8px 32px rgba(0,0,0,0.08), 0px 4px 16px rgba(0,0,0,0.04), 0px 2px 4px rgba(0,0,0,0.02)",Je="0px 4px 16px rgba(0,0,0,0.03), 0px 4px 10px rgba(0,0,0,0.03), 0px 2px 4px rgba(0,0,0,0.02)",Z="'PingFang SC', -apple-system, BlinkMacSystemFont, sans-serif",qe={BOE:"tns.feishu-boe.cn",PRE:"tns.feishu-pre.cn",ONLINE:"tns.feishu.cn"};function me(){var o;let n=JSON.stringify({scene:"miaoda_app_report",entity_id:(o=B())!=null?o:"",entity_type:"miaoda_app",extra:""}),e=`https://${qe[F()]}/cust/lark_report/?type=common¶ms=${encodeURIComponent(n)}&lang=zh-CN`;window.open(e,"_blank","noopener,noreferrer")}i(me,"openDoubaoReport");function be(n){let e=document.createElement("span");Object.assign(e.style,{display:"inline-flex",width:`${n}px`,height:`${n}px`,flexShrink:"0"}),e.innerHTML=Ue;let o=e.firstElementChild;return o&&(o.setAttribute("width",String(n)),o.setAttribute("height",String(n)),o.style.display="block"),e}i(be,"makeCloseIcon");function Xe(n){let e=document.createElement("img");return e.src=$e,e.width=n,e.height=n,e.alt="",Object.assign(e.style,{width:`${n}px`,height:`${n}px`,maxWidth:"none",maxHeight:"none",borderRadius:"100px",flexShrink:"0",display:"block"}),e}i(Xe,"makeAvatar");function ye(n,e){let o=n==="desktop",h=document.createElement("div");Object.assign(h.style,{boxSizing:"border-box",display:"inline-flex",alignItems:"center",gap:o?"4px":"6px",padding:o?"6px 12px 6px 8px":"4px 12px 4px 8px",background:"#363636",border:"0.5px solid rgba(255,255,255,0.1)",borderRadius:"100px",boxShadow:Ge,cursor:"pointer"});let p=Xe(o?16:18),g=document.createElement("span");if(g.textContent=Ke,Object.assign(g.style,{fontFamily:Z,fontSize:o?"12px":"14px",lineHeight:o?"18px":"22px",color:"rgba(255,255,255,0.85)",whiteSpace:"nowrap"}),h.append(p,g),o&&e){let v=document.createElement("span");v.setAttribute("role","button"),v.setAttribute("aria-label","\u5173\u95ED"),v.setAttribute("data-doubao-close",""),Object.assign(v.style,{display:"none",alignItems:"center",cursor:"pointer",flexShrink:"0",color:"rgba(255,255,255,0.5)"}),v.appendChild(be(10)),v.addEventListener("click",y=>{y.stopPropagation(),e()}),h.appendChild(v)}return h}i(ye,"buildPill");function K(n){let e=document.createElement("div");e.setAttribute("role","menuitem"),e.setAttribute("data-label",n.label),Object.assign(e.style,{boxSizing:"border-box",display:"flex",alignItems:"center",gap:"8px",padding:"4px 10px",borderRadius:"6px",cursor:"pointer",color:"#000000"});let o=document.createElement("span");Object.assign(o.style,{display:"inline-flex",width:"16px",height:"16px",flexShrink:"0",color:"#000000"}),n.icon==="feedback"?o.innerHTML=Ve:o.appendChild(be(16));let h=document.createElement("span");return h.textContent=n.label,Object.assign(h.style,{fontFamily:Z,fontSize:`${n.fontSize}px`,lineHeight:`${n.fontSize+8}px`,color:"#000000",whiteSpace:"nowrap"}),e.append(o,h),e.addEventListener("mouseenter",()=>{e.style.background="rgba(0,0,0,0.04)"}),e.addEventListener("mouseleave",()=>{e.style.background="transparent"}),e.addEventListener("click",n.onClick),e}i(K,"buildMenuRow");function _e(n){let e=document.createElement("div");if(Object.assign(e.style,{boxSizing:"border-box",display:"flex",flexDirection:"column",minWidth:`${n.minWidth}px`,background:"#ffffff",border:"0.5px solid rgba(0,0,0,0.1)",borderRadius:"10px",boxShadow:Je,overflow:"hidden",outline:"none"}),n.rows.length){let h=document.createElement("div");Object.assign(h.style,{boxSizing:"border-box",padding:"4px"}),n.rows.forEach(p=>h.appendChild(p)),e.appendChild(h)}let o=document.createElement("div");return o.textContent=Ze,Object.assign(o.style,{boxSizing:"border-box",background:"#f9f9f9",padding:"8px 14px",fontFamily:Z,fontSize:`${n.footerFontSize}px`,lineHeight:`${n.footerFontSize+8}px`,color:"rgba(0,0,0,0.35)",whiteSpace:"nowrap"}),e.appendChild(o),e}i(_e,"buildMenuCard");function Ye(){let n=document.createElement("div");n.setAttribute("data-custom-element","doubao-watermark"),Object.assign(n.style,{position:"fixed",right:"12px",bottom:"12px",zIndex:"9999",display:"flex",flexDirection:"column",alignItems:"flex-end",gap:"8px"});let e=[];ge&&e.push(K({icon:"feedback",label:"\u6295\u8BC9\u4E0E\u4E3E\u62A5",fontSize:14,onClick:me}));let o=_e({rows:e,footerFontSize:12,minWidth:144});o.style.display="none";let h=ye("desktop",()=>n.remove()),p=h.querySelector("[data-doubao-close]");n.append(o,h);let g=null;return n.addEventListener("mouseenter",()=>{g&&clearTimeout(g),o.style.display="flex",p&&(p.style.display="inline-flex")}),n.addEventListener("mouseleave",()=>{g=setTimeout(()=>{o.style.display="none",p&&(p.style.display="none")},100)}),n}i(Ye,"buildDesktopWatermark");function Qe(){let n=document.createElement("div");n.setAttribute("data-custom-element","doubao-watermark-mobile"),Object.assign(n.style,{position:"fixed",right:"12px",bottom:"12px",zIndex:"9999",display:"flex",flexDirection:"column",alignItems:"flex-end",gap:"8px",cursor:"pointer"});let e=[];ge&&e.push(K({icon:"feedback",label:"\u6295\u8BC9\u4E0E\u4E3E\u62A5",fontSize:16,onClick:me})),e.push(K({icon:"close",label:"\u4E0D\u518D\u5C55\u793A",fontSize:16,onClick:i(p=>{p.stopPropagation(),n.remove()},"onClick")}));let o=_e({rows:e,footerFontSize:14,minWidth:160});o.style.display="none";let h=ye("mobile");return n.append(o,h),n.addEventListener("click",p=>{p.stopPropagation(),o.style.display=o.style.display==="none"?"flex":"none"}),document.addEventListener("click",()=>{o.style.display="none"}),n}i(Qe,"buildMobileWatermark");var ve=!1;function G(){if(ve||typeof document=="undefined")return;if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",G,{once:!0});return}ve=!0;let n=N()?Qe():Ye();document.body.appendChild(n)}i(G,"mountDoubaoWatermark");var et="0.0.12-alpha.20260831083241",tt="@lark-apaas/miaoda-coding-sdk";re()&&(ce(),he());G();return Ie(nt);})();
|
|
1
|
+
"use strict";var MiaodaRuntime=(()=>{var we=Object.create;var R=Object.defineProperty;var xe=Object.getOwnPropertyDescriptor;var Ce=Object.getOwnPropertyNames;var Se=Object.getPrototypeOf,ke=Object.prototype.hasOwnProperty;var i=(n,e)=>R(n,"name",{value:e,configurable:!0});var z=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),Ee=(n,e)=>{for(var o in e)R(n,o,{get:e[o],enumerable:!0})},J=(n,e,o,h)=>{if(e&&typeof e=="object"||typeof e=="function")for(let p of Ce(e))!ke.call(n,p)&&p!==o&&R(n,p,{get:()=>e[p],enumerable:!(h=xe(e,p))||h.enumerable});return n};var q=(n,e,o)=>(o=n!=null?we(Se(n)):{},J(e||!n||!n.__esModule?R(o,"default",{value:n,enumerable:!0}):o,n)),Ie=n=>J(R({},"__esModule",{value:!0}),n);var Y=z((X,O)=>{"use strict";(function(n){"use strict";function e(t,f){var r=(t&65535)+(f&65535),b=(t>>16)+(f>>16)+(r>>16);return b<<16|r&65535}i(e,"safeAdd");function o(t,f){return t<<f|t>>>32-f}i(o,"bitRotateLeft");function h(t,f,r,b,w,S){return e(o(e(e(f,t),e(b,S)),w),r)}i(h,"md5cmn");function p(t,f,r,b,w,S,A){return h(f&r|~f&b,t,f,w,S,A)}i(p,"md5ff");function g(t,f,r,b,w,S,A){return h(f&b|r&~b,t,f,w,S,A)}i(g,"md5gg");function v(t,f,r,b,w,S,A){return h(f^r^b,t,f,w,S,A)}i(v,"md5hh");function y(t,f,r,b,w,S,A){return h(r^(f|~b),t,f,w,S,A)}i(y,"md5ii");function k(t,f){t[f>>5]|=128<<f%32,t[(f+64>>>9<<4)+14]=f;var r,b,w,S,A,s=1732584193,a=-271733879,c=-1732584194,l=271733878;for(r=0;r<t.length;r+=16)b=s,w=a,S=c,A=l,s=p(s,a,c,l,t[r],7,-680876936),l=p(l,s,a,c,t[r+1],12,-389564586),c=p(c,l,s,a,t[r+2],17,606105819),a=p(a,c,l,s,t[r+3],22,-1044525330),s=p(s,a,c,l,t[r+4],7,-176418897),l=p(l,s,a,c,t[r+5],12,1200080426),c=p(c,l,s,a,t[r+6],17,-1473231341),a=p(a,c,l,s,t[r+7],22,-45705983),s=p(s,a,c,l,t[r+8],7,1770035416),l=p(l,s,a,c,t[r+9],12,-1958414417),c=p(c,l,s,a,t[r+10],17,-42063),a=p(a,c,l,s,t[r+11],22,-1990404162),s=p(s,a,c,l,t[r+12],7,1804603682),l=p(l,s,a,c,t[r+13],12,-40341101),c=p(c,l,s,a,t[r+14],17,-1502002290),a=p(a,c,l,s,t[r+15],22,1236535329),s=g(s,a,c,l,t[r+1],5,-165796510),l=g(l,s,a,c,t[r+6],9,-1069501632),c=g(c,l,s,a,t[r+11],14,643717713),a=g(a,c,l,s,t[r],20,-373897302),s=g(s,a,c,l,t[r+5],5,-701558691),l=g(l,s,a,c,t[r+10],9,38016083),c=g(c,l,s,a,t[r+15],14,-660478335),a=g(a,c,l,s,t[r+4],20,-405537848),s=g(s,a,c,l,t[r+9],5,568446438),l=g(l,s,a,c,t[r+14],9,-1019803690),c=g(c,l,s,a,t[r+3],14,-187363961),a=g(a,c,l,s,t[r+8],20,1163531501),s=g(s,a,c,l,t[r+13],5,-1444681467),l=g(l,s,a,c,t[r+2],9,-51403784),c=g(c,l,s,a,t[r+7],14,1735328473),a=g(a,c,l,s,t[r+12],20,-1926607734),s=v(s,a,c,l,t[r+5],4,-378558),l=v(l,s,a,c,t[r+8],11,-2022574463),c=v(c,l,s,a,t[r+11],16,1839030562),a=v(a,c,l,s,t[r+14],23,-35309556),s=v(s,a,c,l,t[r+1],4,-1530992060),l=v(l,s,a,c,t[r+4],11,1272893353),c=v(c,l,s,a,t[r+7],16,-155497632),a=v(a,c,l,s,t[r+10],23,-1094730640),s=v(s,a,c,l,t[r+13],4,681279174),l=v(l,s,a,c,t[r],11,-358537222),c=v(c,l,s,a,t[r+3],16,-722521979),a=v(a,c,l,s,t[r+6],23,76029189),s=v(s,a,c,l,t[r+9],4,-640364487),l=v(l,s,a,c,t[r+12],11,-421815835),c=v(c,l,s,a,t[r+15],16,530742520),a=v(a,c,l,s,t[r+2],23,-995338651),s=y(s,a,c,l,t[r],6,-198630844),l=y(l,s,a,c,t[r+7],10,1126891415),c=y(c,l,s,a,t[r+14],15,-1416354905),a=y(a,c,l,s,t[r+5],21,-57434055),s=y(s,a,c,l,t[r+12],6,1700485571),l=y(l,s,a,c,t[r+3],10,-1894986606),c=y(c,l,s,a,t[r+10],15,-1051523),a=y(a,c,l,s,t[r+1],21,-2054922799),s=y(s,a,c,l,t[r+8],6,1873313359),l=y(l,s,a,c,t[r+15],10,-30611744),c=y(c,l,s,a,t[r+6],15,-1560198380),a=y(a,c,l,s,t[r+13],21,1309151649),s=y(s,a,c,l,t[r+4],6,-145523070),l=y(l,s,a,c,t[r+11],10,-1120210379),c=y(c,l,s,a,t[r+2],15,718787259),a=y(a,c,l,s,t[r+9],21,-343485551),s=e(s,b),a=e(a,w),c=e(c,S),l=e(l,A);return[s,a,c,l]}i(k,"binlMD5");function L(t){var f,r="",b=t.length*32;for(f=0;f<b;f+=8)r+=String.fromCharCode(t[f>>5]>>>f%32&255);return r}i(L,"binl2rstr");function x(t){var f,r=[];for(r[(t.length>>2)-1]=void 0,f=0;f<r.length;f+=1)r[f]=0;var b=t.length*8;for(f=0;f<b;f+=8)r[f>>5]|=(t.charCodeAt(f/8)&255)<<f%32;return r}i(x,"rstr2binl");function I(t){return L(k(x(t),t.length*8))}i(I,"rstrMD5");function E(t,f){var r,b=x(t),w=[],S=[],A;for(w[15]=S[15]=void 0,b.length>16&&(b=k(b,t.length*8)),r=0;r<16;r+=1)w[r]=b[r]^909522486,S[r]=b[r]^1549556828;return A=k(w.concat(x(f)),512+f.length*8),L(k(S.concat(A),640))}i(E,"rstrHMACMD5");function P(t){var f="0123456789abcdef",r="",b,w;for(w=0;w<t.length;w+=1)b=t.charCodeAt(w),r+=f.charAt(b>>>4&15)+f.charAt(b&15);return r}i(P,"rstr2hex");function T(t){return unescape(encodeURIComponent(t))}i(T,"str2rstrUTF8");function u(t){return I(T(t))}i(u,"rawMD5");function d(t){return P(u(t))}i(d,"hexMD5");function _(t,f){return E(T(t),T(f))}i(_,"rawHMACMD5");function m(t,f){return P(_(t,f))}i(m,"hexHMACMD5");function C(t,f,r){return f?r?_(f,t):m(f,t):r?u(t):d(t)}i(C,"md5"),typeof define=="function"&&define.amd?define(function(){return C}):typeof O=="object"&&O.exports?O.exports=C:n.md5=C})(X)});var ee=z((M,Q)=>{"use strict";(function(n,e){typeof M=="object"?Q.exports=M=e():typeof define=="function"&&define.amd?define([],e):n.CryptoJS=e()})(M,function(){var n=n||(function(e,o){var h=Object.create||(function(){function u(){}return i(u,"F"),function(d){var _;return u.prototype=d,_=new u,u.prototype=null,_}})(),p={},g=p.lib={},v=g.Base=(function(){return{extend:i(function(u){var d=h(this);return u&&d.mixIn(u),(!d.hasOwnProperty("init")||this.init===d.init)&&(d.init=function(){d.$super.init.apply(this,arguments)}),d.init.prototype=d,d.$super=this,d},"extend"),create:i(function(){var u=this.extend();return u.init.apply(u,arguments),u},"create"),init:i(function(){},"init"),mixIn:i(function(u){for(var d in u)u.hasOwnProperty(d)&&(this[d]=u[d]);u.hasOwnProperty("toString")&&(this.toString=u.toString)},"mixIn"),clone:i(function(){return this.init.prototype.extend(this)},"clone")}})(),y=g.WordArray=v.extend({init:i(function(u,d){u=this.words=u||[],d!=o?this.sigBytes=d:this.sigBytes=u.length*4},"init"),toString:i(function(u){return(u||L).stringify(this)},"toString"),concat:i(function(u){var d=this.words,_=u.words,m=this.sigBytes,C=u.sigBytes;if(this.clamp(),m%4)for(var t=0;t<C;t++){var f=_[t>>>2]>>>24-t%4*8&255;d[m+t>>>2]|=f<<24-(m+t)%4*8}else for(var t=0;t<C;t+=4)d[m+t>>>2]=_[t>>>2];return this.sigBytes+=C,this},"concat"),clamp:i(function(){var u=this.words,d=this.sigBytes;u[d>>>2]&=4294967295<<32-d%4*8,u.length=e.ceil(d/4)},"clamp"),clone:i(function(){var u=v.clone.call(this);return u.words=this.words.slice(0),u},"clone"),random:i(function(u){for(var d=[],_=i(function(r){var r=r,b=987654321,w=4294967295;return function(){b=36969*(b&65535)+(b>>16)&w,r=18e3*(r&65535)+(r>>16)&w;var S=(b<<16)+r&w;return S/=4294967296,S+=.5,S*(e.random()>.5?1:-1)}},"r"),m=0,C;m<u;m+=4){var t=_((C||e.random())*4294967296);C=t()*987654071,d.push(t()*4294967296|0)}return new y.init(d,u)},"random")}),k=p.enc={},L=k.Hex={stringify:i(function(u){for(var d=u.words,_=u.sigBytes,m=[],C=0;C<_;C++){var t=d[C>>>2]>>>24-C%4*8&255;m.push((t>>>4).toString(16)),m.push((t&15).toString(16))}return m.join("")},"stringify"),parse:i(function(u){for(var d=u.length,_=[],m=0;m<d;m+=2)_[m>>>3]|=parseInt(u.substr(m,2),16)<<24-m%8*4;return new y.init(_,d/2)},"parse")},x=k.Latin1={stringify:i(function(u){for(var d=u.words,_=u.sigBytes,m=[],C=0;C<_;C++){var t=d[C>>>2]>>>24-C%4*8&255;m.push(String.fromCharCode(t))}return m.join("")},"stringify"),parse:i(function(u){for(var d=u.length,_=[],m=0;m<d;m++)_[m>>>2]|=(u.charCodeAt(m)&255)<<24-m%4*8;return new y.init(_,d)},"parse")},I=k.Utf8={stringify:i(function(u){try{return decodeURIComponent(escape(x.stringify(u)))}catch{throw new Error("Malformed UTF-8 data")}},"stringify"),parse:i(function(u){return x.parse(unescape(encodeURIComponent(u)))},"parse")},E=g.BufferedBlockAlgorithm=v.extend({reset:i(function(){this._data=new y.init,this._nDataBytes=0},"reset"),_append:i(function(u){typeof u=="string"&&(u=I.parse(u)),this._data.concat(u),this._nDataBytes+=u.sigBytes},"_append"),_process:i(function(u){var d=this._data,_=d.words,m=d.sigBytes,C=this.blockSize,t=C*4,f=m/t;u?f=e.ceil(f):f=e.max((f|0)-this._minBufferSize,0);var r=f*C,b=e.min(r*4,m);if(r){for(var w=0;w<r;w+=C)this._doProcessBlock(_,w);var S=_.splice(0,r);d.sigBytes-=b}return new y.init(S,b)},"_process"),clone:i(function(){var u=v.clone.call(this);return u._data=this._data.clone(),u},"clone"),_minBufferSize:0}),P=g.Hasher=E.extend({cfg:v.extend(),init:i(function(u){this.cfg=this.cfg.extend(u),this.reset()},"init"),reset:i(function(){E.reset.call(this),this._doReset()},"reset"),update:i(function(u){return this._append(u),this._process(),this},"update"),finalize:i(function(u){u&&this._append(u);var d=this._doFinalize();return d},"finalize"),blockSize:512/32,_createHelper:i(function(u){return function(d,_){return new u.init(_).finalize(d)}},"_createHelper"),_createHmacHelper:i(function(u){return function(d,_){return new T.HMAC.init(u,_).finalize(d)}},"_createHmacHelper")}),T=p.algo={};return p})(Math);return n})});var ne=z((H,te)=>{"use strict";(function(n,e){typeof H=="object"?te.exports=H=e(ee()):typeof define=="function"&&define.amd?define(["./core"],e):e(n.CryptoJS)})(H,function(n){return(function(){var e=n,o=e.lib,h=o.WordArray,p=o.Hasher,g=e.algo,v=[],y=g.SHA1=p.extend({_doReset:i(function(){this._hash=new h.init([1732584193,4023233417,2562383102,271733878,3285377520])},"_doReset"),_doProcessBlock:i(function(k,L){for(var x=this._hash.words,I=x[0],E=x[1],P=x[2],T=x[3],u=x[4],d=0;d<80;d++){if(d<16)v[d]=k[L+d]|0;else{var _=v[d-3]^v[d-8]^v[d-14]^v[d-16];v[d]=_<<1|_>>>31}var m=(I<<5|I>>>27)+u+v[d];d<20?m+=(E&P|~E&T)+1518500249:d<40?m+=(E^P^T)+1859775393:d<60?m+=(E&P|E&T|P&T)-1894007588:m+=(E^P^T)-899497514,u=T,T=P,P=E<<30|E>>>2,E=I,I=m}x[0]=x[0]+I|0,x[1]=x[1]+E|0,x[2]=x[2]+P|0,x[3]=x[3]+T|0,x[4]=x[4]+u|0},"_doProcessBlock"),_doFinalize:i(function(){var k=this._data,L=k.words,x=this._nDataBytes*8,I=k.sigBytes*8;return L[I>>>5]|=128<<24-I%32,L[(I+64>>>9<<4)+14]=Math.floor(x/4294967296),L[(I+64>>>9<<4)+15]=x,k.sigBytes=L.length*4,this._process(),this._hash},"_doFinalize"),clone:i(function(){var k=p.clone.call(this);return k._hash=this._hash.clone(),k},"clone")});e.SHA1=p._createHelper(y),e.HmacSHA1=p._createHmacHelper(y)})(),n.SHA1})});var nt={};Ee(nt,{TrackKey:()=>$,name:()=>tt,reportTeaEvent:()=>U,version:()=>et});var se=q(Y(),1),ae=q(ne(),1);function B(){return window.appId||null}i(B,"getAppId");function Te(){var o;let n="suda-csrf-token",e=document.cookie.split("; ");for(let h of e){let[p,g]=h.split("=");if(p===n)return decodeURIComponent(g)}return(o=window.csrfToken)!=null?o:null}i(Te,"getCsrfToken");function W(){let n=globalThis.CLIENT_BASE_PATH||"/";return/^\/app\/[^/]/.test(n)}i(W,"isNewPathEnabled");function F(){switch(globalThis.ENVIRONMENT){case"gray":return"PRE";case"online":return"ONLINE";default:return"BOE"}}i(F,"getEnv");function re(){return window.appEnv!=null?window.appEnv==="runtime":!0}i(re,"isOnlineEnv");function N(){let n=navigator.userAgent,e=/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(n),o=/iPad|Tab|Tablet/i.test(n)&&navigator.maxTouchPoints>1;return e||o}i(N,"isMobile");async function ie(){var h;let n=B();if(!n)return{code:1,msg:"appId is required",data:{}};let e=W()?`/app/${n}/__runtime__/api/v1/studio/lark/user_info`:`/spark/b/${n}/lark/user_info`;return await(await fetch(e,{headers:{"X-Suda-Csrf-Token":(h=Te())!=null?h:""}})).json()}i(ie,"getLarkUserInfo");var $={VIEW:"aily_agent_artifact_page_view"},Ae="08a441",Pe="42b91e";function oe(n){let e=String(n);return(0,ae.default)(Ae+(0,se.default)(e+Pe)).toString()}i(oe,"encryptTea");var j=!1;async function Le(){var g,v,y,k;let{data:n}=await ie(),{tenantID:e,userID:o}=n||{},h=o&&o!=="0"?oe(o):void 0,p=e&&e!=="0"?oe(e):void 0;(g=window.collectEvent)==null||g.call(window,"init",{app_id:788827,channel:"cn",disable_auto_pv:!1,enable_ab_test:!1,enable_debug:!1,enable_stay_duration:!0,reportTime:1e3}),(y=window.collectEvent)==null||y.call(window,"config",{user_unique_id:h,device_type:N()?"mobile":"pc",evtParams:{open_from:(v=new URLSearchParams(window.location.search).get("open-from"))!=null?v:void 0,env:F(),user_id:h,tenant_id:p}}),j=!0,(k=window.collectEvent)==null||k.call(window,"start")}i(Le,"createTracker");async function U({trackKey:n,trackParams:e={}}){var o;try{j||(j=!0,await Le()),(o=window.collectEvent)==null||o.call(window,n,e)}catch(h){console.error(h)}}i(U,"reportTeaEvent");function ce(){return U({trackKey:$.VIEW,trackParams:{artifact_uid:B(),agent_id:"agent_miaoda",url:window.location.href}})}i(ce,"reportPageView");function le(){if(typeof crypto!="undefined"&&crypto.getRandomValues){let e=new Uint8Array(8);return crypto.getRandomValues(e),Array.from(e).map(o=>o.toString(16).padStart(2,"0")).join("")}let n="";for(let e=0;e<16;e++)n+=Math.floor(Math.random()*16).toString(16);return n}i(le,"generateUUID");var ue="x_sdk_device_id";function Be(){try{let n=localStorage.getItem(ue);return n||(n=le(),localStorage.setItem(ue,n)),n}catch{return le()}}i(Be,"getDeviceId");function De(){let n=typeof navigator!="undefined"?navigator.userAgent:"";return n&&(/Android/i.test(n)&&/Mobile/i.test(n)||/iPhone|iPod/i.test(n)||/BlackBerry|IEMobile|Opera Mini/i.test(n))?"mobile":"desktop"}i(De,"getDeviceType");var Re="pageSessionID";function Oe(){try{return new URLSearchParams(window.location.search).get(Re)||""}catch{return""}}i(Oe,"getPvId");function Me(n={}){let e=n.pvId||Oe();return{app_id:window.appId||"",tenant_id:window.tenantId||"",user_id:window.userId||"",did:Be(),module:"app_web",app_env:"runtime",source_type:"user",device_type:De(),release_commit_id:window.__RELEASE_COMMIT_ID__||"",...e?{pv_id:e}:{}}}i(Me,"getDefaultAttributes");function de(n){let e=Math.round(n);if(!Number.isFinite(e))throw new RangeError(`toNanoString: \u975E\u6CD5\u65F6\u95F4\u6233 ${n}`);return typeof BigInt!="function"?e===0?"0":`${e}000000`:String(BigInt(e)*BigInt(1e6))}i(de,"toNanoString");var He="1.0.1";function Fe(n,e){let o=Me(e),h=de(Date.now());return{metricsData:{resource:{attributes:{sdk_version:He,sdk_lang:"javascript",sdk_type:"client-frontend"}},metrics:[{name:"apaas_internal_metrics_pv_uv",description:"Count of page views",unit:"",scopeName:"apaas_internal_metrics_pv_uv",sum:{aggregationTemporality:1,isMonotonic:!0,dataPoints:n.map(p=>({attributes:{...o,url:p.url,path:p.path,referrer:p.referrer},startTimeUnixNano:de(p.timestampMs),timeUnixNano:h,asDouble:1}))}}]}}}i(Fe,"buildPayload");function Ne(n,e,o={},h){if(e.length===0)return;let p;try{p=JSON.stringify(Fe(e,h))}catch{return}try{fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-Suda-Csrf-Token":window.csrfToken||"",...o},body:p,keepalive:!0}).catch(()=>{})}catch{}}i(Ne,"sendPvData");var V="__APAAS_PV_TRACKER_STARTED__";function ze(){try{let n=window;return n[V]?!1:(n[V]=!0,!0)}catch{return!0}}i(ze,"claimPvReporting");function fe(){try{window[V]=!1}catch{}}i(fe,"releasePvReporting");var D,We=(D=class{constructor(){this.started=!1,this.disposers=[],this.holdsPvReporting=!1,this.buffer=[]}static get instance(){return this._instance||(this._instance=new D),this._instance}start(e){var o;if(!this.started&&ze()){this.holdsPvReporting=!0,this.config=e,this.started=!0;try{this.listenRouteChanges(),this.registerLifecycleListeners();let h=(o=e.flushIntervalMs)!=null?o:1e4;this.flushTimer=setInterval(()=>this.flush(),h)}catch(h){throw this.started=!1,this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=void 0),this.holdsPvReporting=!1,fe(),h}}}shutdown(){this.flush(),this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=void 0),this.firstFlushTimer&&(clearTimeout(this.firstFlushTimer),this.firstFlushTimer=void 0),this.started=!1;for(let e of this.disposers.splice(0))try{e()}catch{}this.holdsPvReporting&&(this.holdsPvReporting=!1,fe())}pageKey(){let{origin:e,pathname:o,search:h}=window.location;return`${e}${o}${h}`}scheduleFirstFlush(){var e;let o=(e=this.config)==null?void 0:e.firstFlushDelayMs;o==null||this.firstFlushTimer||(this.firstFlushTimer=setTimeout(()=>this.flush(),o))}recordPv(){let e=this.pageKey();this.lastKey!==e&&(this.lastKey=e,this.buffer.push({url:window.location.href,path:window.location.pathname,referrer:document.referrer,timestampMs:Date.now()}),this.scheduleFirstFlush())}flush(){if(!this.config||this.buffer.length===0)return;let e=this.buffer.splice(0);Ne(this.config.collectorUrl,e,this.config.headers,{pvId:this.config.pvId})}listenRouteChanges(){this.recordPv();let e=i(()=>this.recordPv(),"onPopState");window.addEventListener("popstate",e),this.disposers.push(()=>window.removeEventListener("popstate",e)),this.patchHistory("pushState"),this.patchHistory("replaceState")}patchHistory(e){let o=history[e],h=i(()=>this.recordPv(),"recordPv");history[e]=function(...p){let g=o.apply(this,p);return h(),g},this.disposers.push(()=>{history[e]=o})}registerLifecycleListeners(){let e=i(()=>{document.visibilityState==="hidden"&&this.flush()},"onVisibilityChange");document.addEventListener("visibilitychange",e),this.disposers.push(()=>document.removeEventListener("visibilitychange",e));let o=i(()=>this.flush(),"onPageHide");window.addEventListener("pagehide",o),this.disposers.push(()=>window.removeEventListener("pagehide",o))}},i(D,"_PvTracker"),D),pe=We.instance;function he(){var o;let n=(o=B())!=null?o:"",e=W()?`/app/${n}/__runtime__/api/v1/observability/metrics/collect`:`/spark/app/${n}/runtime/api/v1/observability/metrics/collect`;pe.start({collectorUrl:e})}i(he,"initPvTracking");var je="https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/miaoda-ui",$e=`${je}/doubao.svg`,Ue='<svg viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8.08312 8.08298C8.2384 7.92769 8.23953 7.67705 8.08424 7.52176L5.3625 4.80002L8.08422 2.07829C8.23951 1.92301 8.23839 1.67236 8.0831 1.51708C7.92781 1.36179 7.67717 1.36066 7.52188 1.51595C7.36659 1.67124 4.80016 4.23767 4.80016 4.23767L2.07841 1.51593C1.92313 1.36064 1.67248 1.36177 1.5172 1.51705C1.36191 1.67234 1.36078 1.92298 1.51607 2.07827L4.23782 4.80002L1.51605 7.52178C1.36076 7.67707 1.36189 7.92771 1.51718 8.083C1.67246 8.23829 1.92311 8.23941 2.07839 8.08412L4.80016 5.36236L7.5219 8.0841C7.67719 8.23939 7.92783 8.23826 8.08312 8.08298Z" fill="currentColor"/></svg>',Ve='<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12.6667 2H3.33333V14H6.66667V15.3334H3.33333C2.59695 15.3334 2 14.7364 2 14V2C2 1.26364 2.59695 0.666687 3.33333 0.666687H12.6667C13.403 0.666687 14 1.26364 14 2V7.33335H12.6667V2Z" fill="currentColor"/><path d="M5.33333 4.66669C4.96514 4.66669 4.66667 4.96516 4.66667 5.33335C4.66667 5.70154 4.96514 6 5.33333 6H10.6667C11.0349 6 11.3333 5.70154 11.3333 5.33335C11.3333 4.96516 11.0349 4.66669 10.6667 4.66669H5.33333Z" fill="currentColor"/><path d="M4.66667 8.33335C4.66667 7.96516 4.96514 7.66669 5.33333 7.66669H8C8.36819 7.66669 8.66667 7.96516 8.66667 8.33335C8.66667 8.70154 8.36819 9 8 9H5.33333C4.96514 9 4.66667 8.70154 4.66667 8.33335Z" fill="currentColor"/><path d="M13.5523 8.70017C13.9428 8.30964 14.576 8.30964 14.9665 8.70017C15.357 9.09069 15.357 9.72386 14.9665 10.1144L14.2594 10.8215L12.8452 9.40728L13.5523 8.70017Z" fill="currentColor"/><path d="M12.1381 10.1144L13.5523 11.5286L10.2309 14.85C10.0916 14.9892 9.91229 15.0815 9.71798 15.1138L8.45737 15.3234C8.42136 15.3294 8.38467 15.3177 8.35885 15.2918C8.33271 15.2657 8.32099 15.2284 8.32749 15.192L8.55128 13.9374C8.58465 13.7502 8.6746 13.5779 8.80901 13.4435L12.1381 10.1144Z" fill="currentColor"/></svg>',ge=!0,Ke="\u8C46\u5305 AI \u751F\u6210",Ze="\u7531\u98DE\u4E66\u5999\u642D\u63D0\u4F9B\u652F\u6301",Ge="0px 8px 32px rgba(0,0,0,0.08), 0px 4px 16px rgba(0,0,0,0.04), 0px 2px 4px rgba(0,0,0,0.02)",Je="0px 4px 16px rgba(0,0,0,0.03), 0px 4px 10px rgba(0,0,0,0.03), 0px 2px 4px rgba(0,0,0,0.02)",Z="'PingFang SC', -apple-system, BlinkMacSystemFont, sans-serif",qe={BOE:"tns.feishu-boe.cn",PRE:"tns.feishu-pre.cn",ONLINE:"tns.feishu.cn"};function me(){var o;let n=JSON.stringify({scene:"miaoda_app_report",entity_id:(o=B())!=null?o:"",entity_type:"miaoda_app",extra:""}),e=`https://${qe[F()]}/cust/lark_report/?type=common¶ms=${encodeURIComponent(n)}&lang=zh-CN`;window.open(e,"_blank","noopener,noreferrer")}i(me,"openDoubaoReport");function be(n){let e=document.createElement("span");Object.assign(e.style,{display:"inline-flex",width:`${n}px`,height:`${n}px`,flexShrink:"0"}),e.innerHTML=Ue;let o=e.firstElementChild;return o&&(o.setAttribute("width",String(n)),o.setAttribute("height",String(n)),o.style.display="block"),e}i(be,"makeCloseIcon");function Xe(n){let e=document.createElement("img");return e.src=$e,e.width=n,e.height=n,e.alt="",Object.assign(e.style,{width:`${n}px`,height:`${n}px`,maxWidth:"none",maxHeight:"none",borderRadius:"100px",flexShrink:"0",display:"block"}),e}i(Xe,"makeAvatar");function ye(n,e){let o=n==="desktop",h=document.createElement("div");Object.assign(h.style,{boxSizing:"border-box",display:"inline-flex",alignItems:"center",gap:o?"4px":"6px",padding:o?"6px 12px 6px 8px":"4px 12px 4px 8px",background:"#363636",border:"0.5px solid rgba(255,255,255,0.1)",borderRadius:"100px",boxShadow:Ge,cursor:"pointer"});let p=Xe(o?16:18),g=document.createElement("span");if(g.textContent=Ke,Object.assign(g.style,{fontFamily:Z,fontSize:o?"12px":"14px",lineHeight:o?"18px":"22px",color:"rgba(255,255,255,0.85)",whiteSpace:"nowrap"}),h.append(p,g),o&&e){let v=document.createElement("span");v.setAttribute("role","button"),v.setAttribute("aria-label","\u5173\u95ED"),v.setAttribute("data-doubao-close",""),Object.assign(v.style,{display:"none",alignItems:"center",cursor:"pointer",flexShrink:"0",color:"rgba(255,255,255,0.5)"}),v.appendChild(be(10)),v.addEventListener("click",y=>{y.stopPropagation(),e()}),h.appendChild(v)}return h}i(ye,"buildPill");function K(n){let e=document.createElement("div");e.setAttribute("role","menuitem"),e.setAttribute("data-label",n.label),Object.assign(e.style,{boxSizing:"border-box",display:"flex",alignItems:"center",gap:"8px",padding:"4px 10px",borderRadius:"6px",cursor:"pointer",color:"#000000"});let o=document.createElement("span");Object.assign(o.style,{display:"inline-flex",width:"16px",height:"16px",flexShrink:"0",color:"#000000"}),n.icon==="feedback"?o.innerHTML=Ve:o.appendChild(be(16));let h=document.createElement("span");return h.textContent=n.label,Object.assign(h.style,{fontFamily:Z,fontSize:`${n.fontSize}px`,lineHeight:`${n.fontSize+8}px`,color:"#000000",whiteSpace:"nowrap"}),e.append(o,h),e.addEventListener("mouseenter",()=>{e.style.background="rgba(0,0,0,0.04)"}),e.addEventListener("mouseleave",()=>{e.style.background="transparent"}),e.addEventListener("click",n.onClick),e}i(K,"buildMenuRow");function _e(n){let e=document.createElement("div");if(Object.assign(e.style,{boxSizing:"border-box",display:"flex",flexDirection:"column",minWidth:`${n.minWidth}px`,background:"#ffffff",border:"0.5px solid rgba(0,0,0,0.1)",borderRadius:"10px",boxShadow:Je,overflow:"hidden",outline:"none"}),n.rows.length){let h=document.createElement("div");Object.assign(h.style,{boxSizing:"border-box",padding:"4px"}),n.rows.forEach(p=>h.appendChild(p)),e.appendChild(h)}let o=document.createElement("div");return o.textContent=Ze,Object.assign(o.style,{boxSizing:"border-box",background:"#f9f9f9",padding:"8px 14px",fontFamily:Z,fontSize:`${n.footerFontSize}px`,lineHeight:`${n.footerFontSize+8}px`,color:"rgba(0,0,0,0.35)",whiteSpace:"nowrap"}),e.appendChild(o),e}i(_e,"buildMenuCard");function Ye(){let n=document.createElement("div");n.setAttribute("data-custom-element","doubao-watermark"),Object.assign(n.style,{position:"fixed",right:"12px",bottom:"12px",zIndex:"9999",display:"flex",flexDirection:"column",alignItems:"flex-end",gap:"8px"});let e=[];ge&&e.push(K({icon:"feedback",label:"\u6295\u8BC9\u4E0E\u4E3E\u62A5",fontSize:14,onClick:me}));let o=_e({rows:e,footerFontSize:12,minWidth:144});o.style.display="none";let h=ye("desktop",()=>n.remove()),p=h.querySelector("[data-doubao-close]");n.append(o,h);let g=null;return n.addEventListener("mouseenter",()=>{g&&clearTimeout(g),o.style.display="flex",p&&(p.style.display="inline-flex")}),n.addEventListener("mouseleave",()=>{g=setTimeout(()=>{o.style.display="none",p&&(p.style.display="none")},100)}),n}i(Ye,"buildDesktopWatermark");function Qe(){let n=document.createElement("div");n.setAttribute("data-custom-element","doubao-watermark-mobile"),Object.assign(n.style,{position:"fixed",right:"12px",bottom:"12px",zIndex:"9999",display:"flex",flexDirection:"column",alignItems:"flex-end",gap:"8px",cursor:"pointer"});let e=[];ge&&e.push(K({icon:"feedback",label:"\u6295\u8BC9\u4E0E\u4E3E\u62A5",fontSize:16,onClick:me})),e.push(K({icon:"close",label:"\u4E0D\u518D\u5C55\u793A",fontSize:16,onClick:i(p=>{p.stopPropagation(),n.remove()},"onClick")}));let o=_e({rows:e,footerFontSize:14,minWidth:160});o.style.display="none";let h=ye("mobile");return n.append(o,h),n.addEventListener("click",p=>{p.stopPropagation(),o.style.display=o.style.display==="none"?"flex":"none"}),document.addEventListener("click",()=>{o.style.display="none"}),n}i(Qe,"buildMobileWatermark");var ve=!1;function G(){if(ve||typeof document=="undefined")return;if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",G,{once:!0});return}ve=!0;let n=N()?Qe():Ye();document.body.appendChild(n)}i(G,"mountDoubaoWatermark");var et="0.0.12",tt="@lark-apaas/miaoda-coding-sdk";re()&&(ce(),he());G();return Ie(nt);})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-apaas/miaoda-coding-sdk",
|
|
3
|
-
"version": "0.0.12
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"description": "CDN distribution of aPaaS Web SDK for no-build HTML — self-contained IIFE entries consumed via <script src>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"typecheck": "tsc --noEmit"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@lark-apaas/observable-web-lite": "1.0.2
|
|
23
|
+
"@lark-apaas/observable-web-lite": "^1.0.2",
|
|
24
24
|
"blueimp-md5": "^2.10.0",
|
|
25
25
|
"crypto-js": "^3.1.9-1"
|
|
26
26
|
},
|