@lark-apaas/miaoda-coding-sdk 0.0.18 → 0.0.19-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -2
- package/dist/design-runtime.dev.js +1 -1
- package/dist/design-runtime.js +1 -1
- package/dist/design-runtime.min.js +1 -1
- package/dist/doubao-html-runtime.dev.js +2192 -0
- package/dist/doubao-html-runtime.js +2192 -0
- package/dist/doubao-html-runtime.min.js +23 -0
- package/dist/doubao-runtime.dev.js +1 -1
- package/dist/doubao-runtime.js +1 -1
- package/dist/doubao-runtime.min.js +1 -1
- package/dist/runtime.dev.js +1 -1
- package/dist/runtime.js +1 -1
- package/dist/runtime.min.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,2192 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var MiaodaRuntime = (() => {
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
10
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
11
|
+
};
|
|
12
|
+
var __export = (target, all) => {
|
|
13
|
+
for (var name2 in all)
|
|
14
|
+
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
15
|
+
};
|
|
16
|
+
var __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
+
for (let key2 of __getOwnPropNames(from))
|
|
19
|
+
if (!__hasOwnProp.call(to, key2) && key2 !== except)
|
|
20
|
+
__defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable });
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
30
|
+
mod
|
|
31
|
+
));
|
|
32
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
33
|
+
|
|
34
|
+
// ../../../node_modules/blueimp-md5/js/md5.js
|
|
35
|
+
var require_md5 = __commonJS({
|
|
36
|
+
"../../../node_modules/blueimp-md5/js/md5.js"(exports, module) {
|
|
37
|
+
"use strict";
|
|
38
|
+
(function($) {
|
|
39
|
+
"use strict";
|
|
40
|
+
function safeAdd(x, y) {
|
|
41
|
+
var lsw = (x & 65535) + (y & 65535);
|
|
42
|
+
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
|
|
43
|
+
return msw << 16 | lsw & 65535;
|
|
44
|
+
}
|
|
45
|
+
function bitRotateLeft(num, cnt) {
|
|
46
|
+
return num << cnt | num >>> 32 - cnt;
|
|
47
|
+
}
|
|
48
|
+
function md5cmn(q, a, b, x, s, t) {
|
|
49
|
+
return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);
|
|
50
|
+
}
|
|
51
|
+
function md5ff(a, b, c, d, x, s, t) {
|
|
52
|
+
return md5cmn(b & c | ~b & d, a, b, x, s, t);
|
|
53
|
+
}
|
|
54
|
+
function md5gg(a, b, c, d, x, s, t) {
|
|
55
|
+
return md5cmn(b & d | c & ~d, a, b, x, s, t);
|
|
56
|
+
}
|
|
57
|
+
function md5hh(a, b, c, d, x, s, t) {
|
|
58
|
+
return md5cmn(b ^ c ^ d, a, b, x, s, t);
|
|
59
|
+
}
|
|
60
|
+
function md5ii(a, b, c, d, x, s, t) {
|
|
61
|
+
return md5cmn(c ^ (b | ~d), a, b, x, s, t);
|
|
62
|
+
}
|
|
63
|
+
function binlMD5(x, len) {
|
|
64
|
+
x[len >> 5] |= 128 << len % 32;
|
|
65
|
+
x[(len + 64 >>> 9 << 4) + 14] = len;
|
|
66
|
+
var i;
|
|
67
|
+
var olda;
|
|
68
|
+
var oldb;
|
|
69
|
+
var oldc;
|
|
70
|
+
var oldd;
|
|
71
|
+
var a = 1732584193;
|
|
72
|
+
var b = -271733879;
|
|
73
|
+
var c = -1732584194;
|
|
74
|
+
var d = 271733878;
|
|
75
|
+
for (i = 0; i < x.length; i += 16) {
|
|
76
|
+
olda = a;
|
|
77
|
+
oldb = b;
|
|
78
|
+
oldc = c;
|
|
79
|
+
oldd = d;
|
|
80
|
+
a = md5ff(a, b, c, d, x[i], 7, -680876936);
|
|
81
|
+
d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);
|
|
82
|
+
c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);
|
|
83
|
+
b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);
|
|
84
|
+
a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);
|
|
85
|
+
d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);
|
|
86
|
+
c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);
|
|
87
|
+
b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);
|
|
88
|
+
a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);
|
|
89
|
+
d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);
|
|
90
|
+
c = md5ff(c, d, a, b, x[i + 10], 17, -42063);
|
|
91
|
+
b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);
|
|
92
|
+
a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);
|
|
93
|
+
d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);
|
|
94
|
+
c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);
|
|
95
|
+
b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);
|
|
96
|
+
a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);
|
|
97
|
+
d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);
|
|
98
|
+
c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);
|
|
99
|
+
b = md5gg(b, c, d, a, x[i], 20, -373897302);
|
|
100
|
+
a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);
|
|
101
|
+
d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);
|
|
102
|
+
c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);
|
|
103
|
+
b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);
|
|
104
|
+
a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);
|
|
105
|
+
d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);
|
|
106
|
+
c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);
|
|
107
|
+
b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);
|
|
108
|
+
a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);
|
|
109
|
+
d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);
|
|
110
|
+
c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);
|
|
111
|
+
b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);
|
|
112
|
+
a = md5hh(a, b, c, d, x[i + 5], 4, -378558);
|
|
113
|
+
d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);
|
|
114
|
+
c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);
|
|
115
|
+
b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);
|
|
116
|
+
a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);
|
|
117
|
+
d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);
|
|
118
|
+
c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);
|
|
119
|
+
b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);
|
|
120
|
+
a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);
|
|
121
|
+
d = md5hh(d, a, b, c, x[i], 11, -358537222);
|
|
122
|
+
c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);
|
|
123
|
+
b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);
|
|
124
|
+
a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);
|
|
125
|
+
d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);
|
|
126
|
+
c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);
|
|
127
|
+
b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);
|
|
128
|
+
a = md5ii(a, b, c, d, x[i], 6, -198630844);
|
|
129
|
+
d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);
|
|
130
|
+
c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);
|
|
131
|
+
b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);
|
|
132
|
+
a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);
|
|
133
|
+
d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);
|
|
134
|
+
c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);
|
|
135
|
+
b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);
|
|
136
|
+
a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);
|
|
137
|
+
d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);
|
|
138
|
+
c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);
|
|
139
|
+
b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);
|
|
140
|
+
a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);
|
|
141
|
+
d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);
|
|
142
|
+
c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);
|
|
143
|
+
b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);
|
|
144
|
+
a = safeAdd(a, olda);
|
|
145
|
+
b = safeAdd(b, oldb);
|
|
146
|
+
c = safeAdd(c, oldc);
|
|
147
|
+
d = safeAdd(d, oldd);
|
|
148
|
+
}
|
|
149
|
+
return [a, b, c, d];
|
|
150
|
+
}
|
|
151
|
+
function binl2rstr(input) {
|
|
152
|
+
var i;
|
|
153
|
+
var output = "";
|
|
154
|
+
var length32 = input.length * 32;
|
|
155
|
+
for (i = 0; i < length32; i += 8) {
|
|
156
|
+
output += String.fromCharCode(input[i >> 5] >>> i % 32 & 255);
|
|
157
|
+
}
|
|
158
|
+
return output;
|
|
159
|
+
}
|
|
160
|
+
function rstr2binl(input) {
|
|
161
|
+
var i;
|
|
162
|
+
var output = [];
|
|
163
|
+
output[(input.length >> 2) - 1] = void 0;
|
|
164
|
+
for (i = 0; i < output.length; i += 1) {
|
|
165
|
+
output[i] = 0;
|
|
166
|
+
}
|
|
167
|
+
var length8 = input.length * 8;
|
|
168
|
+
for (i = 0; i < length8; i += 8) {
|
|
169
|
+
output[i >> 5] |= (input.charCodeAt(i / 8) & 255) << i % 32;
|
|
170
|
+
}
|
|
171
|
+
return output;
|
|
172
|
+
}
|
|
173
|
+
function rstrMD5(s) {
|
|
174
|
+
return binl2rstr(binlMD5(rstr2binl(s), s.length * 8));
|
|
175
|
+
}
|
|
176
|
+
function rstrHMACMD5(key2, data) {
|
|
177
|
+
var i;
|
|
178
|
+
var bkey = rstr2binl(key2);
|
|
179
|
+
var ipad = [];
|
|
180
|
+
var opad = [];
|
|
181
|
+
var hash;
|
|
182
|
+
ipad[15] = opad[15] = void 0;
|
|
183
|
+
if (bkey.length > 16) {
|
|
184
|
+
bkey = binlMD5(bkey, key2.length * 8);
|
|
185
|
+
}
|
|
186
|
+
for (i = 0; i < 16; i += 1) {
|
|
187
|
+
ipad[i] = bkey[i] ^ 909522486;
|
|
188
|
+
opad[i] = bkey[i] ^ 1549556828;
|
|
189
|
+
}
|
|
190
|
+
hash = binlMD5(ipad.concat(rstr2binl(data)), 512 + data.length * 8);
|
|
191
|
+
return binl2rstr(binlMD5(opad.concat(hash), 512 + 128));
|
|
192
|
+
}
|
|
193
|
+
function rstr2hex(input) {
|
|
194
|
+
var hexTab = "0123456789abcdef";
|
|
195
|
+
var output = "";
|
|
196
|
+
var x;
|
|
197
|
+
var i;
|
|
198
|
+
for (i = 0; i < input.length; i += 1) {
|
|
199
|
+
x = input.charCodeAt(i);
|
|
200
|
+
output += hexTab.charAt(x >>> 4 & 15) + hexTab.charAt(x & 15);
|
|
201
|
+
}
|
|
202
|
+
return output;
|
|
203
|
+
}
|
|
204
|
+
function str2rstrUTF8(input) {
|
|
205
|
+
return unescape(encodeURIComponent(input));
|
|
206
|
+
}
|
|
207
|
+
function rawMD5(s) {
|
|
208
|
+
return rstrMD5(str2rstrUTF8(s));
|
|
209
|
+
}
|
|
210
|
+
function hexMD5(s) {
|
|
211
|
+
return rstr2hex(rawMD5(s));
|
|
212
|
+
}
|
|
213
|
+
function rawHMACMD5(k, d) {
|
|
214
|
+
return rstrHMACMD5(str2rstrUTF8(k), str2rstrUTF8(d));
|
|
215
|
+
}
|
|
216
|
+
function hexHMACMD5(k, d) {
|
|
217
|
+
return rstr2hex(rawHMACMD5(k, d));
|
|
218
|
+
}
|
|
219
|
+
function md52(string, key2, raw) {
|
|
220
|
+
if (!key2) {
|
|
221
|
+
if (!raw) {
|
|
222
|
+
return hexMD5(string);
|
|
223
|
+
}
|
|
224
|
+
return rawMD5(string);
|
|
225
|
+
}
|
|
226
|
+
if (!raw) {
|
|
227
|
+
return hexHMACMD5(key2, string);
|
|
228
|
+
}
|
|
229
|
+
return rawHMACMD5(key2, string);
|
|
230
|
+
}
|
|
231
|
+
if (typeof define === "function" && define.amd) {
|
|
232
|
+
define(function() {
|
|
233
|
+
return md52;
|
|
234
|
+
});
|
|
235
|
+
} else if (typeof module === "object" && module.exports) {
|
|
236
|
+
module.exports = md52;
|
|
237
|
+
} else {
|
|
238
|
+
$.md5 = md52;
|
|
239
|
+
}
|
|
240
|
+
})(exports);
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
// ../../../node_modules/crypto-js/core.js
|
|
245
|
+
var require_core = __commonJS({
|
|
246
|
+
"../../../node_modules/crypto-js/core.js"(exports, module) {
|
|
247
|
+
"use strict";
|
|
248
|
+
(function(root, factory) {
|
|
249
|
+
if (typeof exports === "object") {
|
|
250
|
+
module.exports = exports = factory();
|
|
251
|
+
} else if (typeof define === "function" && define.amd) {
|
|
252
|
+
define([], factory);
|
|
253
|
+
} else {
|
|
254
|
+
root.CryptoJS = factory();
|
|
255
|
+
}
|
|
256
|
+
})(exports, function() {
|
|
257
|
+
var CryptoJS = CryptoJS || (function(Math2, undefined2) {
|
|
258
|
+
var create = Object.create || /* @__PURE__ */ (function() {
|
|
259
|
+
function F() {
|
|
260
|
+
}
|
|
261
|
+
;
|
|
262
|
+
return function(obj) {
|
|
263
|
+
var subtype;
|
|
264
|
+
F.prototype = obj;
|
|
265
|
+
subtype = new F();
|
|
266
|
+
F.prototype = null;
|
|
267
|
+
return subtype;
|
|
268
|
+
};
|
|
269
|
+
})();
|
|
270
|
+
var C = {};
|
|
271
|
+
var C_lib = C.lib = {};
|
|
272
|
+
var Base = C_lib.Base = /* @__PURE__ */ (function() {
|
|
273
|
+
return {
|
|
274
|
+
/**
|
|
275
|
+
* Creates a new object that inherits from this object.
|
|
276
|
+
*
|
|
277
|
+
* @param {Object} overrides Properties to copy into the new object.
|
|
278
|
+
*
|
|
279
|
+
* @return {Object} The new object.
|
|
280
|
+
*
|
|
281
|
+
* @static
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
*
|
|
285
|
+
* var MyType = CryptoJS.lib.Base.extend({
|
|
286
|
+
* field: 'value',
|
|
287
|
+
*
|
|
288
|
+
* method: function () {
|
|
289
|
+
* }
|
|
290
|
+
* });
|
|
291
|
+
*/
|
|
292
|
+
extend: function(overrides) {
|
|
293
|
+
var subtype = create(this);
|
|
294
|
+
if (overrides) {
|
|
295
|
+
subtype.mixIn(overrides);
|
|
296
|
+
}
|
|
297
|
+
if (!subtype.hasOwnProperty("init") || this.init === subtype.init) {
|
|
298
|
+
subtype.init = function() {
|
|
299
|
+
subtype.$super.init.apply(this, arguments);
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
subtype.init.prototype = subtype;
|
|
303
|
+
subtype.$super = this;
|
|
304
|
+
return subtype;
|
|
305
|
+
},
|
|
306
|
+
/**
|
|
307
|
+
* Extends this object and runs the init method.
|
|
308
|
+
* Arguments to create() will be passed to init().
|
|
309
|
+
*
|
|
310
|
+
* @return {Object} The new object.
|
|
311
|
+
*
|
|
312
|
+
* @static
|
|
313
|
+
*
|
|
314
|
+
* @example
|
|
315
|
+
*
|
|
316
|
+
* var instance = MyType.create();
|
|
317
|
+
*/
|
|
318
|
+
create: function() {
|
|
319
|
+
var instance = this.extend();
|
|
320
|
+
instance.init.apply(instance, arguments);
|
|
321
|
+
return instance;
|
|
322
|
+
},
|
|
323
|
+
/**
|
|
324
|
+
* Initializes a newly created object.
|
|
325
|
+
* Override this method to add some logic when your objects are created.
|
|
326
|
+
*
|
|
327
|
+
* @example
|
|
328
|
+
*
|
|
329
|
+
* var MyType = CryptoJS.lib.Base.extend({
|
|
330
|
+
* init: function () {
|
|
331
|
+
* // ...
|
|
332
|
+
* }
|
|
333
|
+
* });
|
|
334
|
+
*/
|
|
335
|
+
init: function() {
|
|
336
|
+
},
|
|
337
|
+
/**
|
|
338
|
+
* Copies properties into this object.
|
|
339
|
+
*
|
|
340
|
+
* @param {Object} properties The properties to mix in.
|
|
341
|
+
*
|
|
342
|
+
* @example
|
|
343
|
+
*
|
|
344
|
+
* MyType.mixIn({
|
|
345
|
+
* field: 'value'
|
|
346
|
+
* });
|
|
347
|
+
*/
|
|
348
|
+
mixIn: function(properties) {
|
|
349
|
+
for (var propertyName in properties) {
|
|
350
|
+
if (properties.hasOwnProperty(propertyName)) {
|
|
351
|
+
this[propertyName] = properties[propertyName];
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
if (properties.hasOwnProperty("toString")) {
|
|
355
|
+
this.toString = properties.toString;
|
|
356
|
+
}
|
|
357
|
+
},
|
|
358
|
+
/**
|
|
359
|
+
* Creates a copy of this object.
|
|
360
|
+
*
|
|
361
|
+
* @return {Object} The clone.
|
|
362
|
+
*
|
|
363
|
+
* @example
|
|
364
|
+
*
|
|
365
|
+
* var clone = instance.clone();
|
|
366
|
+
*/
|
|
367
|
+
clone: function() {
|
|
368
|
+
return this.init.prototype.extend(this);
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
})();
|
|
372
|
+
var WordArray = C_lib.WordArray = Base.extend({
|
|
373
|
+
/**
|
|
374
|
+
* Initializes a newly created word array.
|
|
375
|
+
*
|
|
376
|
+
* @param {Array} words (Optional) An array of 32-bit words.
|
|
377
|
+
* @param {number} sigBytes (Optional) The number of significant bytes in the words.
|
|
378
|
+
*
|
|
379
|
+
* @example
|
|
380
|
+
*
|
|
381
|
+
* var wordArray = CryptoJS.lib.WordArray.create();
|
|
382
|
+
* var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);
|
|
383
|
+
* var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);
|
|
384
|
+
*/
|
|
385
|
+
init: function(words, sigBytes) {
|
|
386
|
+
words = this.words = words || [];
|
|
387
|
+
if (sigBytes != undefined2) {
|
|
388
|
+
this.sigBytes = sigBytes;
|
|
389
|
+
} else {
|
|
390
|
+
this.sigBytes = words.length * 4;
|
|
391
|
+
}
|
|
392
|
+
},
|
|
393
|
+
/**
|
|
394
|
+
* Converts this word array to a string.
|
|
395
|
+
*
|
|
396
|
+
* @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex
|
|
397
|
+
*
|
|
398
|
+
* @return {string} The stringified word array.
|
|
399
|
+
*
|
|
400
|
+
* @example
|
|
401
|
+
*
|
|
402
|
+
* var string = wordArray + '';
|
|
403
|
+
* var string = wordArray.toString();
|
|
404
|
+
* var string = wordArray.toString(CryptoJS.enc.Utf8);
|
|
405
|
+
*/
|
|
406
|
+
toString: function(encoder) {
|
|
407
|
+
return (encoder || Hex).stringify(this);
|
|
408
|
+
},
|
|
409
|
+
/**
|
|
410
|
+
* Concatenates a word array to this word array.
|
|
411
|
+
*
|
|
412
|
+
* @param {WordArray} wordArray The word array to append.
|
|
413
|
+
*
|
|
414
|
+
* @return {WordArray} This word array.
|
|
415
|
+
*
|
|
416
|
+
* @example
|
|
417
|
+
*
|
|
418
|
+
* wordArray1.concat(wordArray2);
|
|
419
|
+
*/
|
|
420
|
+
concat: function(wordArray) {
|
|
421
|
+
var thisWords = this.words;
|
|
422
|
+
var thatWords = wordArray.words;
|
|
423
|
+
var thisSigBytes = this.sigBytes;
|
|
424
|
+
var thatSigBytes = wordArray.sigBytes;
|
|
425
|
+
this.clamp();
|
|
426
|
+
if (thisSigBytes % 4) {
|
|
427
|
+
for (var i = 0; i < thatSigBytes; i++) {
|
|
428
|
+
var thatByte = thatWords[i >>> 2] >>> 24 - i % 4 * 8 & 255;
|
|
429
|
+
thisWords[thisSigBytes + i >>> 2] |= thatByte << 24 - (thisSigBytes + i) % 4 * 8;
|
|
430
|
+
}
|
|
431
|
+
} else {
|
|
432
|
+
for (var i = 0; i < thatSigBytes; i += 4) {
|
|
433
|
+
thisWords[thisSigBytes + i >>> 2] = thatWords[i >>> 2];
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
this.sigBytes += thatSigBytes;
|
|
437
|
+
return this;
|
|
438
|
+
},
|
|
439
|
+
/**
|
|
440
|
+
* Removes insignificant bits.
|
|
441
|
+
*
|
|
442
|
+
* @example
|
|
443
|
+
*
|
|
444
|
+
* wordArray.clamp();
|
|
445
|
+
*/
|
|
446
|
+
clamp: function() {
|
|
447
|
+
var words = this.words;
|
|
448
|
+
var sigBytes = this.sigBytes;
|
|
449
|
+
words[sigBytes >>> 2] &= 4294967295 << 32 - sigBytes % 4 * 8;
|
|
450
|
+
words.length = Math2.ceil(sigBytes / 4);
|
|
451
|
+
},
|
|
452
|
+
/**
|
|
453
|
+
* Creates a copy of this word array.
|
|
454
|
+
*
|
|
455
|
+
* @return {WordArray} The clone.
|
|
456
|
+
*
|
|
457
|
+
* @example
|
|
458
|
+
*
|
|
459
|
+
* var clone = wordArray.clone();
|
|
460
|
+
*/
|
|
461
|
+
clone: function() {
|
|
462
|
+
var clone = Base.clone.call(this);
|
|
463
|
+
clone.words = this.words.slice(0);
|
|
464
|
+
return clone;
|
|
465
|
+
},
|
|
466
|
+
/**
|
|
467
|
+
* Creates a word array filled with random bytes.
|
|
468
|
+
*
|
|
469
|
+
* @param {number} nBytes The number of random bytes to generate.
|
|
470
|
+
*
|
|
471
|
+
* @return {WordArray} The random word array.
|
|
472
|
+
*
|
|
473
|
+
* @static
|
|
474
|
+
*
|
|
475
|
+
* @example
|
|
476
|
+
*
|
|
477
|
+
* var wordArray = CryptoJS.lib.WordArray.random(16);
|
|
478
|
+
*/
|
|
479
|
+
random: function(nBytes) {
|
|
480
|
+
var words = [];
|
|
481
|
+
var r = (function(m_w) {
|
|
482
|
+
var m_w = m_w;
|
|
483
|
+
var m_z = 987654321;
|
|
484
|
+
var mask = 4294967295;
|
|
485
|
+
return function() {
|
|
486
|
+
m_z = 36969 * (m_z & 65535) + (m_z >> 16) & mask;
|
|
487
|
+
m_w = 18e3 * (m_w & 65535) + (m_w >> 16) & mask;
|
|
488
|
+
var result = (m_z << 16) + m_w & mask;
|
|
489
|
+
result /= 4294967296;
|
|
490
|
+
result += 0.5;
|
|
491
|
+
return result * (Math2.random() > 0.5 ? 1 : -1);
|
|
492
|
+
};
|
|
493
|
+
});
|
|
494
|
+
for (var i = 0, rcache; i < nBytes; i += 4) {
|
|
495
|
+
var _r = r((rcache || Math2.random()) * 4294967296);
|
|
496
|
+
rcache = _r() * 987654071;
|
|
497
|
+
words.push(_r() * 4294967296 | 0);
|
|
498
|
+
}
|
|
499
|
+
return new WordArray.init(words, nBytes);
|
|
500
|
+
}
|
|
501
|
+
});
|
|
502
|
+
var C_enc = C.enc = {};
|
|
503
|
+
var Hex = C_enc.Hex = {
|
|
504
|
+
/**
|
|
505
|
+
* Converts a word array to a hex string.
|
|
506
|
+
*
|
|
507
|
+
* @param {WordArray} wordArray The word array.
|
|
508
|
+
*
|
|
509
|
+
* @return {string} The hex string.
|
|
510
|
+
*
|
|
511
|
+
* @static
|
|
512
|
+
*
|
|
513
|
+
* @example
|
|
514
|
+
*
|
|
515
|
+
* var hexString = CryptoJS.enc.Hex.stringify(wordArray);
|
|
516
|
+
*/
|
|
517
|
+
stringify: function(wordArray) {
|
|
518
|
+
var words = wordArray.words;
|
|
519
|
+
var sigBytes = wordArray.sigBytes;
|
|
520
|
+
var hexChars = [];
|
|
521
|
+
for (var i = 0; i < sigBytes; i++) {
|
|
522
|
+
var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 255;
|
|
523
|
+
hexChars.push((bite >>> 4).toString(16));
|
|
524
|
+
hexChars.push((bite & 15).toString(16));
|
|
525
|
+
}
|
|
526
|
+
return hexChars.join("");
|
|
527
|
+
},
|
|
528
|
+
/**
|
|
529
|
+
* Converts a hex string to a word array.
|
|
530
|
+
*
|
|
531
|
+
* @param {string} hexStr The hex string.
|
|
532
|
+
*
|
|
533
|
+
* @return {WordArray} The word array.
|
|
534
|
+
*
|
|
535
|
+
* @static
|
|
536
|
+
*
|
|
537
|
+
* @example
|
|
538
|
+
*
|
|
539
|
+
* var wordArray = CryptoJS.enc.Hex.parse(hexString);
|
|
540
|
+
*/
|
|
541
|
+
parse: function(hexStr) {
|
|
542
|
+
var hexStrLength = hexStr.length;
|
|
543
|
+
var words = [];
|
|
544
|
+
for (var i = 0; i < hexStrLength; i += 2) {
|
|
545
|
+
words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << 24 - i % 8 * 4;
|
|
546
|
+
}
|
|
547
|
+
return new WordArray.init(words, hexStrLength / 2);
|
|
548
|
+
}
|
|
549
|
+
};
|
|
550
|
+
var Latin1 = C_enc.Latin1 = {
|
|
551
|
+
/**
|
|
552
|
+
* Converts a word array to a Latin1 string.
|
|
553
|
+
*
|
|
554
|
+
* @param {WordArray} wordArray The word array.
|
|
555
|
+
*
|
|
556
|
+
* @return {string} The Latin1 string.
|
|
557
|
+
*
|
|
558
|
+
* @static
|
|
559
|
+
*
|
|
560
|
+
* @example
|
|
561
|
+
*
|
|
562
|
+
* var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);
|
|
563
|
+
*/
|
|
564
|
+
stringify: function(wordArray) {
|
|
565
|
+
var words = wordArray.words;
|
|
566
|
+
var sigBytes = wordArray.sigBytes;
|
|
567
|
+
var latin1Chars = [];
|
|
568
|
+
for (var i = 0; i < sigBytes; i++) {
|
|
569
|
+
var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 255;
|
|
570
|
+
latin1Chars.push(String.fromCharCode(bite));
|
|
571
|
+
}
|
|
572
|
+
return latin1Chars.join("");
|
|
573
|
+
},
|
|
574
|
+
/**
|
|
575
|
+
* Converts a Latin1 string to a word array.
|
|
576
|
+
*
|
|
577
|
+
* @param {string} latin1Str The Latin1 string.
|
|
578
|
+
*
|
|
579
|
+
* @return {WordArray} The word array.
|
|
580
|
+
*
|
|
581
|
+
* @static
|
|
582
|
+
*
|
|
583
|
+
* @example
|
|
584
|
+
*
|
|
585
|
+
* var wordArray = CryptoJS.enc.Latin1.parse(latin1String);
|
|
586
|
+
*/
|
|
587
|
+
parse: function(latin1Str) {
|
|
588
|
+
var latin1StrLength = latin1Str.length;
|
|
589
|
+
var words = [];
|
|
590
|
+
for (var i = 0; i < latin1StrLength; i++) {
|
|
591
|
+
words[i >>> 2] |= (latin1Str.charCodeAt(i) & 255) << 24 - i % 4 * 8;
|
|
592
|
+
}
|
|
593
|
+
return new WordArray.init(words, latin1StrLength);
|
|
594
|
+
}
|
|
595
|
+
};
|
|
596
|
+
var Utf8 = C_enc.Utf8 = {
|
|
597
|
+
/**
|
|
598
|
+
* Converts a word array to a UTF-8 string.
|
|
599
|
+
*
|
|
600
|
+
* @param {WordArray} wordArray The word array.
|
|
601
|
+
*
|
|
602
|
+
* @return {string} The UTF-8 string.
|
|
603
|
+
*
|
|
604
|
+
* @static
|
|
605
|
+
*
|
|
606
|
+
* @example
|
|
607
|
+
*
|
|
608
|
+
* var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);
|
|
609
|
+
*/
|
|
610
|
+
stringify: function(wordArray) {
|
|
611
|
+
try {
|
|
612
|
+
return decodeURIComponent(escape(Latin1.stringify(wordArray)));
|
|
613
|
+
} catch (e) {
|
|
614
|
+
throw new Error("Malformed UTF-8 data");
|
|
615
|
+
}
|
|
616
|
+
},
|
|
617
|
+
/**
|
|
618
|
+
* Converts a UTF-8 string to a word array.
|
|
619
|
+
*
|
|
620
|
+
* @param {string} utf8Str The UTF-8 string.
|
|
621
|
+
*
|
|
622
|
+
* @return {WordArray} The word array.
|
|
623
|
+
*
|
|
624
|
+
* @static
|
|
625
|
+
*
|
|
626
|
+
* @example
|
|
627
|
+
*
|
|
628
|
+
* var wordArray = CryptoJS.enc.Utf8.parse(utf8String);
|
|
629
|
+
*/
|
|
630
|
+
parse: function(utf8Str) {
|
|
631
|
+
return Latin1.parse(unescape(encodeURIComponent(utf8Str)));
|
|
632
|
+
}
|
|
633
|
+
};
|
|
634
|
+
var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({
|
|
635
|
+
/**
|
|
636
|
+
* Resets this block algorithm's data buffer to its initial state.
|
|
637
|
+
*
|
|
638
|
+
* @example
|
|
639
|
+
*
|
|
640
|
+
* bufferedBlockAlgorithm.reset();
|
|
641
|
+
*/
|
|
642
|
+
reset: function() {
|
|
643
|
+
this._data = new WordArray.init();
|
|
644
|
+
this._nDataBytes = 0;
|
|
645
|
+
},
|
|
646
|
+
/**
|
|
647
|
+
* Adds new data to this block algorithm's buffer.
|
|
648
|
+
*
|
|
649
|
+
* @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.
|
|
650
|
+
*
|
|
651
|
+
* @example
|
|
652
|
+
*
|
|
653
|
+
* bufferedBlockAlgorithm._append('data');
|
|
654
|
+
* bufferedBlockAlgorithm._append(wordArray);
|
|
655
|
+
*/
|
|
656
|
+
_append: function(data) {
|
|
657
|
+
if (typeof data == "string") {
|
|
658
|
+
data = Utf8.parse(data);
|
|
659
|
+
}
|
|
660
|
+
this._data.concat(data);
|
|
661
|
+
this._nDataBytes += data.sigBytes;
|
|
662
|
+
},
|
|
663
|
+
/**
|
|
664
|
+
* Processes available data blocks.
|
|
665
|
+
*
|
|
666
|
+
* This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.
|
|
667
|
+
*
|
|
668
|
+
* @param {boolean} doFlush Whether all blocks and partial blocks should be processed.
|
|
669
|
+
*
|
|
670
|
+
* @return {WordArray} The processed data.
|
|
671
|
+
*
|
|
672
|
+
* @example
|
|
673
|
+
*
|
|
674
|
+
* var processedData = bufferedBlockAlgorithm._process();
|
|
675
|
+
* var processedData = bufferedBlockAlgorithm._process(!!'flush');
|
|
676
|
+
*/
|
|
677
|
+
_process: function(doFlush) {
|
|
678
|
+
var data = this._data;
|
|
679
|
+
var dataWords = data.words;
|
|
680
|
+
var dataSigBytes = data.sigBytes;
|
|
681
|
+
var blockSize = this.blockSize;
|
|
682
|
+
var blockSizeBytes = blockSize * 4;
|
|
683
|
+
var nBlocksReady = dataSigBytes / blockSizeBytes;
|
|
684
|
+
if (doFlush) {
|
|
685
|
+
nBlocksReady = Math2.ceil(nBlocksReady);
|
|
686
|
+
} else {
|
|
687
|
+
nBlocksReady = Math2.max((nBlocksReady | 0) - this._minBufferSize, 0);
|
|
688
|
+
}
|
|
689
|
+
var nWordsReady = nBlocksReady * blockSize;
|
|
690
|
+
var nBytesReady = Math2.min(nWordsReady * 4, dataSigBytes);
|
|
691
|
+
if (nWordsReady) {
|
|
692
|
+
for (var offset = 0; offset < nWordsReady; offset += blockSize) {
|
|
693
|
+
this._doProcessBlock(dataWords, offset);
|
|
694
|
+
}
|
|
695
|
+
var processedWords = dataWords.splice(0, nWordsReady);
|
|
696
|
+
data.sigBytes -= nBytesReady;
|
|
697
|
+
}
|
|
698
|
+
return new WordArray.init(processedWords, nBytesReady);
|
|
699
|
+
},
|
|
700
|
+
/**
|
|
701
|
+
* Creates a copy of this object.
|
|
702
|
+
*
|
|
703
|
+
* @return {Object} The clone.
|
|
704
|
+
*
|
|
705
|
+
* @example
|
|
706
|
+
*
|
|
707
|
+
* var clone = bufferedBlockAlgorithm.clone();
|
|
708
|
+
*/
|
|
709
|
+
clone: function() {
|
|
710
|
+
var clone = Base.clone.call(this);
|
|
711
|
+
clone._data = this._data.clone();
|
|
712
|
+
return clone;
|
|
713
|
+
},
|
|
714
|
+
_minBufferSize: 0
|
|
715
|
+
});
|
|
716
|
+
var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({
|
|
717
|
+
/**
|
|
718
|
+
* Configuration options.
|
|
719
|
+
*/
|
|
720
|
+
cfg: Base.extend(),
|
|
721
|
+
/**
|
|
722
|
+
* Initializes a newly created hasher.
|
|
723
|
+
*
|
|
724
|
+
* @param {Object} cfg (Optional) The configuration options to use for this hash computation.
|
|
725
|
+
*
|
|
726
|
+
* @example
|
|
727
|
+
*
|
|
728
|
+
* var hasher = CryptoJS.algo.SHA256.create();
|
|
729
|
+
*/
|
|
730
|
+
init: function(cfg) {
|
|
731
|
+
this.cfg = this.cfg.extend(cfg);
|
|
732
|
+
this.reset();
|
|
733
|
+
},
|
|
734
|
+
/**
|
|
735
|
+
* Resets this hasher to its initial state.
|
|
736
|
+
*
|
|
737
|
+
* @example
|
|
738
|
+
*
|
|
739
|
+
* hasher.reset();
|
|
740
|
+
*/
|
|
741
|
+
reset: function() {
|
|
742
|
+
BufferedBlockAlgorithm.reset.call(this);
|
|
743
|
+
this._doReset();
|
|
744
|
+
},
|
|
745
|
+
/**
|
|
746
|
+
* Updates this hasher with a message.
|
|
747
|
+
*
|
|
748
|
+
* @param {WordArray|string} messageUpdate The message to append.
|
|
749
|
+
*
|
|
750
|
+
* @return {Hasher} This hasher.
|
|
751
|
+
*
|
|
752
|
+
* @example
|
|
753
|
+
*
|
|
754
|
+
* hasher.update('message');
|
|
755
|
+
* hasher.update(wordArray);
|
|
756
|
+
*/
|
|
757
|
+
update: function(messageUpdate) {
|
|
758
|
+
this._append(messageUpdate);
|
|
759
|
+
this._process();
|
|
760
|
+
return this;
|
|
761
|
+
},
|
|
762
|
+
/**
|
|
763
|
+
* Finalizes the hash computation.
|
|
764
|
+
* Note that the finalize operation is effectively a destructive, read-once operation.
|
|
765
|
+
*
|
|
766
|
+
* @param {WordArray|string} messageUpdate (Optional) A final message update.
|
|
767
|
+
*
|
|
768
|
+
* @return {WordArray} The hash.
|
|
769
|
+
*
|
|
770
|
+
* @example
|
|
771
|
+
*
|
|
772
|
+
* var hash = hasher.finalize();
|
|
773
|
+
* var hash = hasher.finalize('message');
|
|
774
|
+
* var hash = hasher.finalize(wordArray);
|
|
775
|
+
*/
|
|
776
|
+
finalize: function(messageUpdate) {
|
|
777
|
+
if (messageUpdate) {
|
|
778
|
+
this._append(messageUpdate);
|
|
779
|
+
}
|
|
780
|
+
var hash = this._doFinalize();
|
|
781
|
+
return hash;
|
|
782
|
+
},
|
|
783
|
+
blockSize: 512 / 32,
|
|
784
|
+
/**
|
|
785
|
+
* Creates a shortcut function to a hasher's object interface.
|
|
786
|
+
*
|
|
787
|
+
* @param {Hasher} hasher The hasher to create a helper for.
|
|
788
|
+
*
|
|
789
|
+
* @return {Function} The shortcut function.
|
|
790
|
+
*
|
|
791
|
+
* @static
|
|
792
|
+
*
|
|
793
|
+
* @example
|
|
794
|
+
*
|
|
795
|
+
* var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);
|
|
796
|
+
*/
|
|
797
|
+
_createHelper: function(hasher) {
|
|
798
|
+
return function(message, cfg) {
|
|
799
|
+
return new hasher.init(cfg).finalize(message);
|
|
800
|
+
};
|
|
801
|
+
},
|
|
802
|
+
/**
|
|
803
|
+
* Creates a shortcut function to the HMAC's object interface.
|
|
804
|
+
*
|
|
805
|
+
* @param {Hasher} hasher The hasher to use in this HMAC helper.
|
|
806
|
+
*
|
|
807
|
+
* @return {Function} The shortcut function.
|
|
808
|
+
*
|
|
809
|
+
* @static
|
|
810
|
+
*
|
|
811
|
+
* @example
|
|
812
|
+
*
|
|
813
|
+
* var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);
|
|
814
|
+
*/
|
|
815
|
+
_createHmacHelper: function(hasher) {
|
|
816
|
+
return function(message, key2) {
|
|
817
|
+
return new C_algo.HMAC.init(hasher, key2).finalize(message);
|
|
818
|
+
};
|
|
819
|
+
}
|
|
820
|
+
});
|
|
821
|
+
var C_algo = C.algo = {};
|
|
822
|
+
return C;
|
|
823
|
+
})(Math);
|
|
824
|
+
return CryptoJS;
|
|
825
|
+
});
|
|
826
|
+
}
|
|
827
|
+
});
|
|
828
|
+
|
|
829
|
+
// ../../../node_modules/crypto-js/sha1.js
|
|
830
|
+
var require_sha1 = __commonJS({
|
|
831
|
+
"../../../node_modules/crypto-js/sha1.js"(exports, module) {
|
|
832
|
+
"use strict";
|
|
833
|
+
(function(root, factory) {
|
|
834
|
+
if (typeof exports === "object") {
|
|
835
|
+
module.exports = exports = factory(require_core());
|
|
836
|
+
} else if (typeof define === "function" && define.amd) {
|
|
837
|
+
define(["./core"], factory);
|
|
838
|
+
} else {
|
|
839
|
+
factory(root.CryptoJS);
|
|
840
|
+
}
|
|
841
|
+
})(exports, function(CryptoJS) {
|
|
842
|
+
(function() {
|
|
843
|
+
var C = CryptoJS;
|
|
844
|
+
var C_lib = C.lib;
|
|
845
|
+
var WordArray = C_lib.WordArray;
|
|
846
|
+
var Hasher = C_lib.Hasher;
|
|
847
|
+
var C_algo = C.algo;
|
|
848
|
+
var W = [];
|
|
849
|
+
var SHA1 = C_algo.SHA1 = Hasher.extend({
|
|
850
|
+
_doReset: function() {
|
|
851
|
+
this._hash = new WordArray.init([
|
|
852
|
+
1732584193,
|
|
853
|
+
4023233417,
|
|
854
|
+
2562383102,
|
|
855
|
+
271733878,
|
|
856
|
+
3285377520
|
|
857
|
+
]);
|
|
858
|
+
},
|
|
859
|
+
_doProcessBlock: function(M, offset) {
|
|
860
|
+
var H = this._hash.words;
|
|
861
|
+
var a = H[0];
|
|
862
|
+
var b = H[1];
|
|
863
|
+
var c = H[2];
|
|
864
|
+
var d = H[3];
|
|
865
|
+
var e = H[4];
|
|
866
|
+
for (var i = 0; i < 80; i++) {
|
|
867
|
+
if (i < 16) {
|
|
868
|
+
W[i] = M[offset + i] | 0;
|
|
869
|
+
} else {
|
|
870
|
+
var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16];
|
|
871
|
+
W[i] = n << 1 | n >>> 31;
|
|
872
|
+
}
|
|
873
|
+
var t = (a << 5 | a >>> 27) + e + W[i];
|
|
874
|
+
if (i < 20) {
|
|
875
|
+
t += (b & c | ~b & d) + 1518500249;
|
|
876
|
+
} else if (i < 40) {
|
|
877
|
+
t += (b ^ c ^ d) + 1859775393;
|
|
878
|
+
} else if (i < 60) {
|
|
879
|
+
t += (b & c | b & d | c & d) - 1894007588;
|
|
880
|
+
} else {
|
|
881
|
+
t += (b ^ c ^ d) - 899497514;
|
|
882
|
+
}
|
|
883
|
+
e = d;
|
|
884
|
+
d = c;
|
|
885
|
+
c = b << 30 | b >>> 2;
|
|
886
|
+
b = a;
|
|
887
|
+
a = t;
|
|
888
|
+
}
|
|
889
|
+
H[0] = H[0] + a | 0;
|
|
890
|
+
H[1] = H[1] + b | 0;
|
|
891
|
+
H[2] = H[2] + c | 0;
|
|
892
|
+
H[3] = H[3] + d | 0;
|
|
893
|
+
H[4] = H[4] + e | 0;
|
|
894
|
+
},
|
|
895
|
+
_doFinalize: function() {
|
|
896
|
+
var data = this._data;
|
|
897
|
+
var dataWords = data.words;
|
|
898
|
+
var nBitsTotal = this._nDataBytes * 8;
|
|
899
|
+
var nBitsLeft = data.sigBytes * 8;
|
|
900
|
+
dataWords[nBitsLeft >>> 5] |= 128 << 24 - nBitsLeft % 32;
|
|
901
|
+
dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = Math.floor(nBitsTotal / 4294967296);
|
|
902
|
+
dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = nBitsTotal;
|
|
903
|
+
data.sigBytes = dataWords.length * 4;
|
|
904
|
+
this._process();
|
|
905
|
+
return this._hash;
|
|
906
|
+
},
|
|
907
|
+
clone: function() {
|
|
908
|
+
var clone = Hasher.clone.call(this);
|
|
909
|
+
clone._hash = this._hash.clone();
|
|
910
|
+
return clone;
|
|
911
|
+
}
|
|
912
|
+
});
|
|
913
|
+
C.SHA1 = Hasher._createHelper(SHA1);
|
|
914
|
+
C.HmacSHA1 = Hasher._createHmacHelper(SHA1);
|
|
915
|
+
})();
|
|
916
|
+
return CryptoJS.SHA1;
|
|
917
|
+
});
|
|
918
|
+
}
|
|
919
|
+
});
|
|
920
|
+
|
|
921
|
+
// src/doubao-html-runtime.ts
|
|
922
|
+
var doubao_html_runtime_exports = {};
|
|
923
|
+
__export(doubao_html_runtime_exports, {
|
|
924
|
+
TrackKey: () => TrackKey,
|
|
925
|
+
comments: () => runtime_exports,
|
|
926
|
+
name: () => name,
|
|
927
|
+
reportTeaEvent: () => reportTeaEvent,
|
|
928
|
+
version: () => version2
|
|
929
|
+
});
|
|
930
|
+
|
|
931
|
+
// src/runtime/tea.ts
|
|
932
|
+
var import_blueimp_md5 = __toESM(require_md5(), 1);
|
|
933
|
+
var import_sha1 = __toESM(require_sha1(), 1);
|
|
934
|
+
|
|
935
|
+
// src/runtime/utils.ts
|
|
936
|
+
function getAppId() {
|
|
937
|
+
return window.appId || null;
|
|
938
|
+
}
|
|
939
|
+
function getCsrfToken() {
|
|
940
|
+
var _a2;
|
|
941
|
+
const cookieName = "suda-csrf-token";
|
|
942
|
+
const cookies = document.cookie.split("; ");
|
|
943
|
+
for (const cookie of cookies) {
|
|
944
|
+
const [name2, value] = cookie.split("=");
|
|
945
|
+
if (name2 === cookieName) {
|
|
946
|
+
return decodeURIComponent(value);
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
return (_a2 = window.csrfToken) != null ? _a2 : null;
|
|
950
|
+
}
|
|
951
|
+
function isNewPathEnabled() {
|
|
952
|
+
const basePath = globalThis.CLIENT_BASE_PATH || "/";
|
|
953
|
+
return /^\/app\/[^/]/.test(basePath);
|
|
954
|
+
}
|
|
955
|
+
function getEnv() {
|
|
956
|
+
switch (globalThis.ENVIRONMENT) {
|
|
957
|
+
case "gray":
|
|
958
|
+
return "PRE";
|
|
959
|
+
case "online":
|
|
960
|
+
return "ONLINE";
|
|
961
|
+
case "staging":
|
|
962
|
+
default:
|
|
963
|
+
return "BOE";
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
function isOnlineEnv() {
|
|
967
|
+
return window.appEnv != null ? window.appEnv === "runtime" : false;
|
|
968
|
+
}
|
|
969
|
+
function isMobile() {
|
|
970
|
+
const ua = navigator.userAgent;
|
|
971
|
+
const isPhone = /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(
|
|
972
|
+
ua
|
|
973
|
+
);
|
|
974
|
+
const isIpad = /iPad|Tab|Tablet/i.test(ua) && navigator.maxTouchPoints > 1;
|
|
975
|
+
return isPhone || isIpad;
|
|
976
|
+
}
|
|
977
|
+
async function fetchShowBadge() {
|
|
978
|
+
var _a2, _b, _c;
|
|
979
|
+
try {
|
|
980
|
+
const appId = getAppId();
|
|
981
|
+
if (!appId) return true;
|
|
982
|
+
const url = isNewPathEnabled() ? `/app/${appId}/__runtime__/api/v1/studio/get_published` : `/spark/b/${appId}/get_published`;
|
|
983
|
+
const response = await fetch(url, {
|
|
984
|
+
headers: { "X-Suda-Csrf-Token": (_a2 = getCsrfToken()) != null ? _a2 : "" }
|
|
985
|
+
});
|
|
986
|
+
const res = await response.json();
|
|
987
|
+
if (res.code === 0 || res.status_code === "0") {
|
|
988
|
+
return ((_c = (_b = res.data) == null ? void 0 : _b.app_info) == null ? void 0 : _c.show_badge) !== false;
|
|
989
|
+
}
|
|
990
|
+
} catch {
|
|
991
|
+
}
|
|
992
|
+
return true;
|
|
993
|
+
}
|
|
994
|
+
async function getLarkUserInfo() {
|
|
995
|
+
var _a2;
|
|
996
|
+
const appId = getAppId();
|
|
997
|
+
if (!appId) {
|
|
998
|
+
return { code: 1, msg: "appId is required", data: {} };
|
|
999
|
+
}
|
|
1000
|
+
const url = isNewPathEnabled() ? `/app/${appId}/__runtime__/api/v1/studio/lark/user_info` : `/spark/b/${appId}/lark/user_info`;
|
|
1001
|
+
const response = await fetch(url, {
|
|
1002
|
+
headers: {
|
|
1003
|
+
"X-Suda-Csrf-Token": (_a2 = getCsrfToken()) != null ? _a2 : ""
|
|
1004
|
+
}
|
|
1005
|
+
});
|
|
1006
|
+
return await response.json();
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
// src/runtime/tea.ts
|
|
1010
|
+
var TrackKey = {
|
|
1011
|
+
/** 页面浏览。 */
|
|
1012
|
+
VIEW: "aily_agent_artifact_page_view"
|
|
1013
|
+
};
|
|
1014
|
+
var saltA = "08a441";
|
|
1015
|
+
var saltB = "42b91e";
|
|
1016
|
+
function encryptTea(message) {
|
|
1017
|
+
const msgString = String(message);
|
|
1018
|
+
return (0, import_sha1.default)(saltA + (0, import_blueimp_md5.default)(msgString + saltB)).toString();
|
|
1019
|
+
}
|
|
1020
|
+
var teaInstance = false;
|
|
1021
|
+
async function createTracker() {
|
|
1022
|
+
var _a2, _b, _c, _d;
|
|
1023
|
+
const { data } = await getLarkUserInfo();
|
|
1024
|
+
const { tenantID, userID } = data || {};
|
|
1025
|
+
const userIDEncrypt = userID && userID !== "0" ? encryptTea(userID) : void 0;
|
|
1026
|
+
const tenantIDEncrypt = tenantID && tenantID !== "0" ? encryptTea(tenantID) : void 0;
|
|
1027
|
+
(_a2 = window.collectEvent) == null ? void 0 : _a2.call(window, "init", {
|
|
1028
|
+
app_id: 788827,
|
|
1029
|
+
channel: "cn",
|
|
1030
|
+
disable_auto_pv: false,
|
|
1031
|
+
enable_ab_test: false,
|
|
1032
|
+
enable_debug: false,
|
|
1033
|
+
enable_stay_duration: true,
|
|
1034
|
+
// 上报页面停留时间
|
|
1035
|
+
reportTime: 1e3
|
|
1036
|
+
// 事件上报异步队列的时间间隔
|
|
1037
|
+
});
|
|
1038
|
+
(_c = window.collectEvent) == null ? void 0 : _c.call(window, "config", {
|
|
1039
|
+
user_unique_id: userIDEncrypt,
|
|
1040
|
+
device_type: isMobile() ? "mobile" : "pc",
|
|
1041
|
+
evtParams: {
|
|
1042
|
+
open_from: (_b = new URLSearchParams(window.location.search).get("open-from")) != null ? _b : void 0,
|
|
1043
|
+
env: getEnv(),
|
|
1044
|
+
user_id: userIDEncrypt,
|
|
1045
|
+
tenant_id: tenantIDEncrypt
|
|
1046
|
+
}
|
|
1047
|
+
});
|
|
1048
|
+
teaInstance = true;
|
|
1049
|
+
(_d = window.collectEvent) == null ? void 0 : _d.call(window, "start");
|
|
1050
|
+
}
|
|
1051
|
+
async function reportTeaEvent({ trackKey, trackParams = {} }) {
|
|
1052
|
+
var _a2;
|
|
1053
|
+
try {
|
|
1054
|
+
if (!teaInstance) {
|
|
1055
|
+
teaInstance = true;
|
|
1056
|
+
await createTracker();
|
|
1057
|
+
}
|
|
1058
|
+
(_a2 = window.collectEvent) == null ? void 0 : _a2.call(window, trackKey, trackParams);
|
|
1059
|
+
} catch (err) {
|
|
1060
|
+
console.error(err);
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
function reportPageView() {
|
|
1064
|
+
return reportTeaEvent({
|
|
1065
|
+
trackKey: TrackKey.VIEW,
|
|
1066
|
+
trackParams: {
|
|
1067
|
+
artifact_uid: getAppId(),
|
|
1068
|
+
agent_id: "agent_miaoda",
|
|
1069
|
+
url: window.location.href
|
|
1070
|
+
}
|
|
1071
|
+
});
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
// ../observable-web-lite/dist/index.mjs
|
|
1075
|
+
function generateUUID() {
|
|
1076
|
+
if (typeof crypto !== "undefined" && crypto.getRandomValues) {
|
|
1077
|
+
const bytes = new Uint8Array(8);
|
|
1078
|
+
crypto.getRandomValues(bytes);
|
|
1079
|
+
return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
1080
|
+
}
|
|
1081
|
+
let result = "";
|
|
1082
|
+
for (let i = 0; i < 16; i++) {
|
|
1083
|
+
result += Math.floor(Math.random() * 16).toString(16);
|
|
1084
|
+
}
|
|
1085
|
+
return result;
|
|
1086
|
+
}
|
|
1087
|
+
var STORAGE_KEY = "x_sdk_device_id";
|
|
1088
|
+
function getDeviceId() {
|
|
1089
|
+
try {
|
|
1090
|
+
let id = localStorage.getItem(STORAGE_KEY);
|
|
1091
|
+
if (!id) {
|
|
1092
|
+
id = generateUUID();
|
|
1093
|
+
localStorage.setItem(STORAGE_KEY, id);
|
|
1094
|
+
}
|
|
1095
|
+
return id;
|
|
1096
|
+
} catch {
|
|
1097
|
+
return generateUUID();
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
function getDeviceType() {
|
|
1101
|
+
const ua = typeof navigator !== "undefined" ? navigator.userAgent : "";
|
|
1102
|
+
if (!ua) return "desktop";
|
|
1103
|
+
if (/Android/i.test(ua) && /Mobile/i.test(ua) || /iPhone|iPod/i.test(ua) || /BlackBerry|IEMobile|Opera Mini/i.test(ua)) {
|
|
1104
|
+
return "mobile";
|
|
1105
|
+
}
|
|
1106
|
+
return "desktop";
|
|
1107
|
+
}
|
|
1108
|
+
var PV_ID_PARAM = "pageSessionID";
|
|
1109
|
+
function getPvId() {
|
|
1110
|
+
try {
|
|
1111
|
+
return new URLSearchParams(window.location.search).get(PV_ID_PARAM) || "";
|
|
1112
|
+
} catch {
|
|
1113
|
+
return "";
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
function getDefaultAttributes(overrides = {}) {
|
|
1117
|
+
const pvId = overrides.pvId || getPvId();
|
|
1118
|
+
return {
|
|
1119
|
+
app_id: window.appId || "",
|
|
1120
|
+
tenant_id: window.tenantId || "",
|
|
1121
|
+
user_id: window.userId || "",
|
|
1122
|
+
did: getDeviceId(),
|
|
1123
|
+
module: "app_web",
|
|
1124
|
+
app_env: "runtime",
|
|
1125
|
+
source_type: "user",
|
|
1126
|
+
device_type: getDeviceType(),
|
|
1127
|
+
release_commit_id: window.__RELEASE_COMMIT_ID__ || "",
|
|
1128
|
+
// 只在真有值时落 key,不给空串占位(理由见 getPvId)
|
|
1129
|
+
...pvId ? { pv_id: pvId } : {}
|
|
1130
|
+
};
|
|
1131
|
+
}
|
|
1132
|
+
function toNanoString(ms) {
|
|
1133
|
+
const msInt = Math.round(ms);
|
|
1134
|
+
if (!Number.isFinite(msInt)) {
|
|
1135
|
+
throw new RangeError(`toNanoString: \u975E\u6CD5\u65F6\u95F4\u6233 ${ms}`);
|
|
1136
|
+
}
|
|
1137
|
+
if (typeof BigInt !== "function") {
|
|
1138
|
+
return msInt === 0 ? "0" : `${msInt}000000`;
|
|
1139
|
+
}
|
|
1140
|
+
return String(BigInt(msInt) * BigInt(1e6));
|
|
1141
|
+
}
|
|
1142
|
+
var SDK_VERSION = "1.0.2";
|
|
1143
|
+
function buildPayload(dataPoints, overrides) {
|
|
1144
|
+
const defaultAttrs = getDefaultAttributes(overrides);
|
|
1145
|
+
const nowNs = toNanoString(Date.now());
|
|
1146
|
+
return {
|
|
1147
|
+
metricsData: {
|
|
1148
|
+
resource: {
|
|
1149
|
+
attributes: {
|
|
1150
|
+
sdk_version: SDK_VERSION,
|
|
1151
|
+
sdk_lang: "javascript",
|
|
1152
|
+
sdk_type: "client-frontend"
|
|
1153
|
+
}
|
|
1154
|
+
},
|
|
1155
|
+
metrics: [
|
|
1156
|
+
{
|
|
1157
|
+
name: "apaas_internal_metrics_pv_uv",
|
|
1158
|
+
description: "Count of page views",
|
|
1159
|
+
unit: "",
|
|
1160
|
+
scopeName: "apaas_internal_metrics_pv_uv",
|
|
1161
|
+
sum: {
|
|
1162
|
+
aggregationTemporality: 1,
|
|
1163
|
+
// DELTA
|
|
1164
|
+
isMonotonic: true,
|
|
1165
|
+
dataPoints: dataPoints.map((dp) => ({
|
|
1166
|
+
attributes: {
|
|
1167
|
+
...defaultAttrs,
|
|
1168
|
+
url: dp.url,
|
|
1169
|
+
path: dp.path,
|
|
1170
|
+
referrer: dp.referrer
|
|
1171
|
+
},
|
|
1172
|
+
startTimeUnixNano: toNanoString(dp.timestampMs),
|
|
1173
|
+
timeUnixNano: nowNs,
|
|
1174
|
+
asDouble: 1
|
|
1175
|
+
}))
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
]
|
|
1179
|
+
}
|
|
1180
|
+
};
|
|
1181
|
+
}
|
|
1182
|
+
function sendPvData(collectorUrl, dataPoints, headers = {}, overrides) {
|
|
1183
|
+
if (dataPoints.length === 0) return;
|
|
1184
|
+
let body;
|
|
1185
|
+
try {
|
|
1186
|
+
body = JSON.stringify(buildPayload(dataPoints, overrides));
|
|
1187
|
+
} catch {
|
|
1188
|
+
return;
|
|
1189
|
+
}
|
|
1190
|
+
try {
|
|
1191
|
+
fetch(collectorUrl, {
|
|
1192
|
+
method: "POST",
|
|
1193
|
+
headers: {
|
|
1194
|
+
"Content-Type": "application/json",
|
|
1195
|
+
"X-Suda-Csrf-Token": window.csrfToken || "",
|
|
1196
|
+
...headers
|
|
1197
|
+
},
|
|
1198
|
+
body,
|
|
1199
|
+
keepalive: true
|
|
1200
|
+
}).catch(() => {
|
|
1201
|
+
});
|
|
1202
|
+
} catch {
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
var PV_STARTED_FLAG = "__APAAS_PV_TRACKER_STARTED__";
|
|
1206
|
+
function claimPvReporting() {
|
|
1207
|
+
try {
|
|
1208
|
+
const flags = window;
|
|
1209
|
+
if (flags[PV_STARTED_FLAG]) return false;
|
|
1210
|
+
flags[PV_STARTED_FLAG] = true;
|
|
1211
|
+
return true;
|
|
1212
|
+
} catch {
|
|
1213
|
+
return true;
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
function releasePvReporting() {
|
|
1217
|
+
try {
|
|
1218
|
+
window[PV_STARTED_FLAG] = false;
|
|
1219
|
+
} catch {
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
var PvTracker = class _PvTracker {
|
|
1223
|
+
constructor() {
|
|
1224
|
+
this.started = false;
|
|
1225
|
+
this.disposers = [];
|
|
1226
|
+
this.holdsPvReporting = false;
|
|
1227
|
+
this.buffer = [];
|
|
1228
|
+
}
|
|
1229
|
+
static get instance() {
|
|
1230
|
+
if (!this._instance) {
|
|
1231
|
+
this._instance = new _PvTracker();
|
|
1232
|
+
}
|
|
1233
|
+
return this._instance;
|
|
1234
|
+
}
|
|
1235
|
+
start(config) {
|
|
1236
|
+
var _a2;
|
|
1237
|
+
if (this.started) return;
|
|
1238
|
+
if (!claimPvReporting()) return;
|
|
1239
|
+
this.holdsPvReporting = true;
|
|
1240
|
+
this.config = config;
|
|
1241
|
+
this.started = true;
|
|
1242
|
+
try {
|
|
1243
|
+
this.listenRouteChanges();
|
|
1244
|
+
this.registerLifecycleListeners();
|
|
1245
|
+
const interval = (_a2 = config.flushIntervalMs) != null ? _a2 : 1e4;
|
|
1246
|
+
this.flushTimer = setInterval(() => this.flush(), interval);
|
|
1247
|
+
} catch (err) {
|
|
1248
|
+
this.started = false;
|
|
1249
|
+
if (this.flushTimer) {
|
|
1250
|
+
clearInterval(this.flushTimer);
|
|
1251
|
+
this.flushTimer = void 0;
|
|
1252
|
+
}
|
|
1253
|
+
this.holdsPvReporting = false;
|
|
1254
|
+
releasePvReporting();
|
|
1255
|
+
throw err;
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
shutdown() {
|
|
1259
|
+
this.flush();
|
|
1260
|
+
if (this.flushTimer) {
|
|
1261
|
+
clearInterval(this.flushTimer);
|
|
1262
|
+
this.flushTimer = void 0;
|
|
1263
|
+
}
|
|
1264
|
+
if (this.firstFlushTimer) {
|
|
1265
|
+
clearTimeout(this.firstFlushTimer);
|
|
1266
|
+
this.firstFlushTimer = void 0;
|
|
1267
|
+
}
|
|
1268
|
+
this.started = false;
|
|
1269
|
+
for (const dispose of this.disposers.splice(0)) {
|
|
1270
|
+
try {
|
|
1271
|
+
dispose();
|
|
1272
|
+
} catch {
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
if (this.holdsPvReporting) {
|
|
1276
|
+
this.holdsPvReporting = false;
|
|
1277
|
+
releasePvReporting();
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
/**
|
|
1281
|
+
* PV 去重键:`origin + pathname + search`,**刻意不含 hash**。用 `location.href` 会让锚点跳转
|
|
1282
|
+
* 和 hash 切换多计 PV(SPA 里 `pushState(null,'','#tab2')` 很常见),与"hash 变化不算 PV"的
|
|
1283
|
+
* 口径矛盾。`search` **要算进去**:`?id=1` → `?id=2` 是不同内容,算新 PV。
|
|
1284
|
+
*/
|
|
1285
|
+
pageKey() {
|
|
1286
|
+
const { origin, pathname, search } = window.location;
|
|
1287
|
+
return `${origin}${pathname}${search}`;
|
|
1288
|
+
}
|
|
1289
|
+
/**
|
|
1290
|
+
* 安排首屏补发。**从首条 PV 真正入队时起算,不是从 `start()` 起算。**
|
|
1291
|
+
*
|
|
1292
|
+
* 曾经写在 `start()` 里,结果是:创意模式页面加载慢,PV 要等 `load` 才记录,而补发定时器
|
|
1293
|
+
* 早在 start+1s 就烧掉了(那时 buffer 还空,flush 空跑),PV 只能等下一个 10s tick——线上
|
|
1294
|
+
* 实测首次上报落在 **20.6s**。从入队时起算才对得上"首屏尽快发一次"的本意。
|
|
1295
|
+
*/
|
|
1296
|
+
scheduleFirstFlush() {
|
|
1297
|
+
var _a2;
|
|
1298
|
+
const delay = (_a2 = this.config) == null ? void 0 : _a2.firstFlushDelayMs;
|
|
1299
|
+
if (delay == null || this.firstFlushTimer) return;
|
|
1300
|
+
this.firstFlushTimer = setTimeout(() => this.flush(), delay);
|
|
1301
|
+
}
|
|
1302
|
+
recordPv() {
|
|
1303
|
+
const key2 = this.pageKey();
|
|
1304
|
+
if (this.lastKey === key2) return;
|
|
1305
|
+
this.lastKey = key2;
|
|
1306
|
+
this.buffer.push({
|
|
1307
|
+
// 上报完整 href(含 hash):去重不看 hash,但排障时想知道停在哪个片段
|
|
1308
|
+
url: window.location.href,
|
|
1309
|
+
path: window.location.pathname,
|
|
1310
|
+
referrer: document.referrer,
|
|
1311
|
+
timestampMs: Date.now()
|
|
1312
|
+
});
|
|
1313
|
+
this.scheduleFirstFlush();
|
|
1314
|
+
}
|
|
1315
|
+
flush() {
|
|
1316
|
+
if (!this.config || this.buffer.length === 0) return;
|
|
1317
|
+
const batch = this.buffer.splice(0);
|
|
1318
|
+
sendPvData(this.config.collectorUrl, batch, this.config.headers, {
|
|
1319
|
+
pvId: this.config.pvId
|
|
1320
|
+
});
|
|
1321
|
+
}
|
|
1322
|
+
listenRouteChanges() {
|
|
1323
|
+
this.recordPv();
|
|
1324
|
+
const onPopState = () => this.recordPv();
|
|
1325
|
+
window.addEventListener("popstate", onPopState);
|
|
1326
|
+
this.disposers.push(
|
|
1327
|
+
() => window.removeEventListener("popstate", onPopState)
|
|
1328
|
+
);
|
|
1329
|
+
this.patchHistory("pushState");
|
|
1330
|
+
this.patchHistory("replaceState");
|
|
1331
|
+
}
|
|
1332
|
+
patchHistory(method) {
|
|
1333
|
+
const original = history[method];
|
|
1334
|
+
const recordPv = () => this.recordPv();
|
|
1335
|
+
history[method] = function(...args) {
|
|
1336
|
+
const result = original.apply(this, args);
|
|
1337
|
+
recordPv();
|
|
1338
|
+
return result;
|
|
1339
|
+
};
|
|
1340
|
+
this.disposers.push(() => {
|
|
1341
|
+
history[method] = original;
|
|
1342
|
+
});
|
|
1343
|
+
}
|
|
1344
|
+
registerLifecycleListeners() {
|
|
1345
|
+
const onVisibilityChange = () => {
|
|
1346
|
+
if (document.visibilityState === "hidden") this.flush();
|
|
1347
|
+
};
|
|
1348
|
+
document.addEventListener("visibilitychange", onVisibilityChange);
|
|
1349
|
+
this.disposers.push(
|
|
1350
|
+
() => document.removeEventListener("visibilitychange", onVisibilityChange)
|
|
1351
|
+
);
|
|
1352
|
+
const onPageHide = () => this.flush();
|
|
1353
|
+
window.addEventListener("pagehide", onPageHide);
|
|
1354
|
+
this.disposers.push(
|
|
1355
|
+
() => window.removeEventListener("pagehide", onPageHide)
|
|
1356
|
+
);
|
|
1357
|
+
}
|
|
1358
|
+
};
|
|
1359
|
+
var pvTracker = PvTracker.instance;
|
|
1360
|
+
|
|
1361
|
+
// src/runtime/pv.ts
|
|
1362
|
+
function initPvTracking() {
|
|
1363
|
+
var _a2;
|
|
1364
|
+
const appId = (_a2 = getAppId()) != null ? _a2 : "";
|
|
1365
|
+
const collectorUrl = isNewPathEnabled() ? `/app/${appId}/__runtime__/api/v1/observability/metrics/collect` : `/spark/app/${appId}/runtime/api/v1/observability/metrics/collect`;
|
|
1366
|
+
pvTracker.start({ collectorUrl });
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
// src/runtime/feishu-feed-jsbridge.ts
|
|
1370
|
+
var LARK_UA_RE = /\bLark\//i;
|
|
1371
|
+
function isFeishuClient() {
|
|
1372
|
+
var _a2, _b, _c, _d;
|
|
1373
|
+
const w = window;
|
|
1374
|
+
if (typeof ((_c = (_b = (_a2 = w.webkit) == null ? void 0 : _a2.messageHandlers) == null ? void 0 : _b.invokeNative) == null ? void 0 : _c.postMessage) === "function")
|
|
1375
|
+
return true;
|
|
1376
|
+
if (typeof ((_d = w.Lark_Bridge) == null ? void 0 : _d.invokeNative) === "function") return true;
|
|
1377
|
+
return LARK_UA_RE.test(navigator.userAgent);
|
|
1378
|
+
}
|
|
1379
|
+
function markMiaodaFeedMessagesRead({
|
|
1380
|
+
messageIds,
|
|
1381
|
+
token,
|
|
1382
|
+
docType = 113
|
|
1383
|
+
}) {
|
|
1384
|
+
var _a2, _b;
|
|
1385
|
+
if (messageIds.length === 0 || !token) return false;
|
|
1386
|
+
const payload = {
|
|
1387
|
+
apiName: "markMiaodaFeedMessagesRead",
|
|
1388
|
+
data: {
|
|
1389
|
+
__v2__: true,
|
|
1390
|
+
messageIds: messageIds.map(String),
|
|
1391
|
+
token,
|
|
1392
|
+
docType
|
|
1393
|
+
}
|
|
1394
|
+
};
|
|
1395
|
+
const w = window;
|
|
1396
|
+
const iosBridge = (_b = (_a2 = w.webkit) == null ? void 0 : _a2.messageHandlers) == null ? void 0 : _b.invokeNative;
|
|
1397
|
+
if (iosBridge == null ? void 0 : iosBridge.postMessage) {
|
|
1398
|
+
iosBridge.postMessage(payload);
|
|
1399
|
+
return true;
|
|
1400
|
+
}
|
|
1401
|
+
const androidBridge = w.Lark_Bridge;
|
|
1402
|
+
if (androidBridge == null ? void 0 : androidBridge.invokeNative) {
|
|
1403
|
+
androidBridge.invokeNative(JSON.stringify(payload));
|
|
1404
|
+
return true;
|
|
1405
|
+
}
|
|
1406
|
+
return false;
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
// src/runtime/mark-feed-read.ts
|
|
1410
|
+
var DOC_TYPE = 113;
|
|
1411
|
+
var API_PATH_PREFIX = "/app/";
|
|
1412
|
+
var API_PATH_SUFFIX = "/__runtime__/api/v1/devops/read_lark_messages";
|
|
1413
|
+
function extractMessageIds(payload) {
|
|
1414
|
+
if (!payload || typeof payload !== "object") return [];
|
|
1415
|
+
const { data } = payload;
|
|
1416
|
+
if (Array.isArray(data)) return data.map(String);
|
|
1417
|
+
if (data && Array.isArray(data.message_ids)) {
|
|
1418
|
+
return data.message_ids.map(String);
|
|
1419
|
+
}
|
|
1420
|
+
return [];
|
|
1421
|
+
}
|
|
1422
|
+
var markedOnce = false;
|
|
1423
|
+
async function fetchFeedMessageIds(appId) {
|
|
1424
|
+
var _a2;
|
|
1425
|
+
const response = await fetch(`${API_PATH_PREFIX}${appId}${API_PATH_SUFFIX}`, {
|
|
1426
|
+
method: "POST",
|
|
1427
|
+
credentials: "same-origin",
|
|
1428
|
+
headers: {
|
|
1429
|
+
"Content-Type": "application/json",
|
|
1430
|
+
"X-Suda-Csrf-Token": (_a2 = getCsrfToken()) != null ? _a2 : ""
|
|
1431
|
+
}
|
|
1432
|
+
});
|
|
1433
|
+
if (!response.ok) return [];
|
|
1434
|
+
const json = await response.json();
|
|
1435
|
+
return extractMessageIds(json);
|
|
1436
|
+
}
|
|
1437
|
+
async function markFeedReadOnce() {
|
|
1438
|
+
if (markedOnce) return;
|
|
1439
|
+
if (!isFeishuClient()) return;
|
|
1440
|
+
markedOnce = true;
|
|
1441
|
+
const appId = getAppId();
|
|
1442
|
+
if (!appId) return;
|
|
1443
|
+
try {
|
|
1444
|
+
const ids = await fetchFeedMessageIds(appId);
|
|
1445
|
+
if (!ids.length) return;
|
|
1446
|
+
markMiaodaFeedMessagesRead({
|
|
1447
|
+
messageIds: ids,
|
|
1448
|
+
token: appId,
|
|
1449
|
+
docType: DOC_TYPE
|
|
1450
|
+
});
|
|
1451
|
+
} catch {
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
// src/register-inspector-id.ts
|
|
1456
|
+
function registerInspectorIdPlugin() {
|
|
1457
|
+
const PLUGIN_NAME = "inspector-id";
|
|
1458
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
1459
|
+
const Babel = window.Babel;
|
|
1460
|
+
if (!Babel || !Babel.registerPlugin) return;
|
|
1461
|
+
let fileMap = null;
|
|
1462
|
+
const buildFileMap = () => {
|
|
1463
|
+
const map = {};
|
|
1464
|
+
let inlineSeq = 0;
|
|
1465
|
+
document.querySelectorAll('script[type="text/babel"],script[type="text/jsx"]').forEach((el) => {
|
|
1466
|
+
const src = el.getAttribute("src");
|
|
1467
|
+
if (src) {
|
|
1468
|
+
const clean = src.split("?")[0];
|
|
1469
|
+
const basename = clean.split("/").pop() || clean;
|
|
1470
|
+
map[basename] = basename in map ? "" : clean;
|
|
1471
|
+
} else {
|
|
1472
|
+
inlineSeq++;
|
|
1473
|
+
const babelName = inlineSeq === 1 ? "Inline Babel script" : `Inline Babel script (${inlineSeq})`;
|
|
1474
|
+
map[babelName] = el.getAttribute("data-filename") || `inline-${inlineSeq - 1}`;
|
|
1475
|
+
}
|
|
1476
|
+
});
|
|
1477
|
+
return map;
|
|
1478
|
+
};
|
|
1479
|
+
if (Babel.availablePlugins) delete Babel.availablePlugins[PLUGIN_NAME];
|
|
1480
|
+
Babel.registerPlugin(
|
|
1481
|
+
PLUGIN_NAME,
|
|
1482
|
+
({ types: t }) => ({
|
|
1483
|
+
visitor: {
|
|
1484
|
+
JSXOpeningElement(path, state2) {
|
|
1485
|
+
const node = path.node;
|
|
1486
|
+
if (node.name && node.name.type === "JSXMemberExpression") return;
|
|
1487
|
+
for (let i = 0; i < node.attributes.length; i++) {
|
|
1488
|
+
const attr = node.attributes[i];
|
|
1489
|
+
if (attr.type === "JSXAttribute" && attr.name && attr.name.name === "data-inspector-id")
|
|
1490
|
+
return;
|
|
1491
|
+
}
|
|
1492
|
+
const rawFilename = state2.file && state2.file.opts && state2.file.opts.filename || "?";
|
|
1493
|
+
if (fileMap === null) fileMap = buildFileMap();
|
|
1494
|
+
const noQuery = rawFilename.split("?")[0];
|
|
1495
|
+
const basename = noQuery.split("/").pop() || noQuery;
|
|
1496
|
+
const filePath = fileMap[rawFilename] || fileMap[basename] || noQuery.replace(/^\/?[a-z][a-z0-9+.-]*:\/{1,2}[^/]+/i, "").replace(/^\/+/, "") || // 去开头多余的 /
|
|
1497
|
+
rawFilename;
|
|
1498
|
+
const loc = node.loc && node.loc.start;
|
|
1499
|
+
const line = loc ? loc.line : 0;
|
|
1500
|
+
const column = loc ? loc.column + 1 : 0;
|
|
1501
|
+
const elementName = node.name && node.name.type === "JSXIdentifier" ? node.name.name : filePath;
|
|
1502
|
+
const id = `jsx:${filePath}:${elementName}:${line}:${column}`;
|
|
1503
|
+
node.attributes.push(
|
|
1504
|
+
t.jsxAttribute(
|
|
1505
|
+
t.jsxIdentifier("data-inspector-id"),
|
|
1506
|
+
t.stringLiteral(id)
|
|
1507
|
+
)
|
|
1508
|
+
);
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1511
|
+
})
|
|
1512
|
+
);
|
|
1513
|
+
let hostFile = "";
|
|
1514
|
+
try {
|
|
1515
|
+
const srcmapEl = document.getElementById("__srcmap");
|
|
1516
|
+
if (srcmapEl && srcmapEl.textContent) {
|
|
1517
|
+
const parsed = JSON.parse(srcmapEl.textContent);
|
|
1518
|
+
const file = parsed == null ? void 0 : parsed.file;
|
|
1519
|
+
if (typeof file === "string") hostFile = file;
|
|
1520
|
+
}
|
|
1521
|
+
} catch {
|
|
1522
|
+
}
|
|
1523
|
+
document.querySelectorAll('script[type="text/babel"],script[type="text/jsx"]').forEach((el, i) => {
|
|
1524
|
+
const plugins = el.getAttribute("data-plugins") || "";
|
|
1525
|
+
if (plugins.indexOf(PLUGIN_NAME) < 0) {
|
|
1526
|
+
el.setAttribute(
|
|
1527
|
+
"data-plugins",
|
|
1528
|
+
plugins ? `${plugins},${PLUGIN_NAME}` : PLUGIN_NAME
|
|
1529
|
+
);
|
|
1530
|
+
}
|
|
1531
|
+
if (!el.hasAttribute("data-filename")) {
|
|
1532
|
+
const inlineName = hostFile ? `${hostFile}#inline-${i}` : `inline-${i}`;
|
|
1533
|
+
el.setAttribute(
|
|
1534
|
+
"data-filename",
|
|
1535
|
+
el.getAttribute("src") || inlineName
|
|
1536
|
+
);
|
|
1537
|
+
}
|
|
1538
|
+
});
|
|
1539
|
+
});
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1542
|
+
// src/comment/runtime.ts
|
|
1543
|
+
var runtime_exports = {};
|
|
1544
|
+
__export(runtime_exports, {
|
|
1545
|
+
destroy: () => destroy,
|
|
1546
|
+
init: () => init,
|
|
1547
|
+
version: () => version
|
|
1548
|
+
});
|
|
1549
|
+
|
|
1550
|
+
// src/comment/bootstrap-loader.ts
|
|
1551
|
+
var COMMENT_ORIGINS = /* @__PURE__ */ new Set([
|
|
1552
|
+
"https://comment.feishuapp.cn",
|
|
1553
|
+
"https://comment.aiforce.cloud",
|
|
1554
|
+
"https://comment.doubaoapps.com",
|
|
1555
|
+
"https://comment.feishu.link",
|
|
1556
|
+
"https://comment.feishuapp.com",
|
|
1557
|
+
"https://comment.doubaowork.link",
|
|
1558
|
+
"https://comment.doubao.link"
|
|
1559
|
+
]);
|
|
1560
|
+
var CHANNEL = "ccm-comment-bootstrap";
|
|
1561
|
+
function createBootstrapLoader() {
|
|
1562
|
+
return (iframe, nonce, signal) => {
|
|
1563
|
+
const url = new URL(iframe.src, document.URL);
|
|
1564
|
+
if (!iframe.isConnected || iframe.hasAttribute("srcdoc") || !COMMENT_ORIGINS.has(url.origin) || url.username || url.password)
|
|
1565
|
+
return Promise.reject(new Error("Untrusted comment iframe"));
|
|
1566
|
+
return new Promise((resolve, reject) => {
|
|
1567
|
+
var _a2;
|
|
1568
|
+
const cleanup = () => {
|
|
1569
|
+
clearTimeout(timer);
|
|
1570
|
+
window.removeEventListener("message", receive);
|
|
1571
|
+
signal.removeEventListener("abort", abort);
|
|
1572
|
+
};
|
|
1573
|
+
const fail = (error) => {
|
|
1574
|
+
cleanup();
|
|
1575
|
+
reject(error);
|
|
1576
|
+
};
|
|
1577
|
+
const abort = () => fail(new Error("Comment session destroyed"));
|
|
1578
|
+
const receive = (event) => {
|
|
1579
|
+
const data = event.data;
|
|
1580
|
+
if (event.source !== iframe.contentWindow || event.origin !== url.origin || (data == null ? void 0 : data.channel) !== CHANNEL || data.version !== 1 || data.type !== "waiting")
|
|
1581
|
+
return;
|
|
1582
|
+
if (data.bootstrapSource === void 0) return;
|
|
1583
|
+
if (typeof data.bootstrapSource !== "string" || !data.bootstrapSource.length || data.bootstrapSource.length > 65536 || typeof data.bootstrapVersion !== "string" || !/^\d+\.\d+\.\d+(?:-[a-zA-Z0-9]+(?:\.[a-zA-Z0-9]+)*)?$/.test(
|
|
1584
|
+
data.bootstrapVersion
|
|
1585
|
+
) || data.bootstrapVersion.length > 64 || typeof data.buildId !== "string" || !data.buildId.length || data.buildId.length > 128) {
|
|
1586
|
+
fail(new Error("Invalid comment bootstrap payload"));
|
|
1587
|
+
return;
|
|
1588
|
+
}
|
|
1589
|
+
cleanup();
|
|
1590
|
+
const host = window;
|
|
1591
|
+
const previous = host.CCMCommentBootstrap;
|
|
1592
|
+
const script = document.createElement("script");
|
|
1593
|
+
if (nonce) script.nonce = nonce;
|
|
1594
|
+
script.textContent = data.bootstrapSource;
|
|
1595
|
+
try {
|
|
1596
|
+
host.CCMCommentBootstrap = void 0;
|
|
1597
|
+
document.head.appendChild(script);
|
|
1598
|
+
const api = host.CCMCommentBootstrap;
|
|
1599
|
+
if (!api || typeof api.init !== "function" || api.version !== data.bootstrapVersion || api.buildId !== data.buildId)
|
|
1600
|
+
throw new Error(
|
|
1601
|
+
"Comment bootstrap blocked or version/buildId mismatch"
|
|
1602
|
+
);
|
|
1603
|
+
resolve(api);
|
|
1604
|
+
} catch (error) {
|
|
1605
|
+
host.CCMCommentBootstrap = previous;
|
|
1606
|
+
reject(error);
|
|
1607
|
+
} finally {
|
|
1608
|
+
script.remove();
|
|
1609
|
+
}
|
|
1610
|
+
};
|
|
1611
|
+
const timer = setTimeout(
|
|
1612
|
+
() => fail(new Error("Comment bootstrap announcement timed out")),
|
|
1613
|
+
15e3
|
|
1614
|
+
);
|
|
1615
|
+
window.addEventListener("message", receive);
|
|
1616
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
1617
|
+
if (signal.aborted) {
|
|
1618
|
+
abort();
|
|
1619
|
+
return;
|
|
1620
|
+
}
|
|
1621
|
+
(_a2 = iframe.contentWindow) == null ? void 0 : _a2.postMessage(
|
|
1622
|
+
{ channel: CHANNEL, version: 1, type: "request-bootstrap" },
|
|
1623
|
+
url.origin
|
|
1624
|
+
);
|
|
1625
|
+
});
|
|
1626
|
+
};
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1629
|
+
// src/comment/session.ts
|
|
1630
|
+
function createCommentRuntime(mount) {
|
|
1631
|
+
let current;
|
|
1632
|
+
function destroy2() {
|
|
1633
|
+
current == null ? void 0 : current.session.destroy();
|
|
1634
|
+
}
|
|
1635
|
+
function init2(options) {
|
|
1636
|
+
const { iframe } = options;
|
|
1637
|
+
if (!(iframe instanceof HTMLIFrameElement))
|
|
1638
|
+
throw new Error("A comment iframe is required");
|
|
1639
|
+
if ((current == null ? void 0 : current.iframe) === iframe) return current.session;
|
|
1640
|
+
destroy2();
|
|
1641
|
+
const controller = new AbortController();
|
|
1642
|
+
let mounted2;
|
|
1643
|
+
const ready = new Promise((resolve, reject) => {
|
|
1644
|
+
const start = () => {
|
|
1645
|
+
dispose();
|
|
1646
|
+
resolve();
|
|
1647
|
+
};
|
|
1648
|
+
const abort = () => {
|
|
1649
|
+
dispose();
|
|
1650
|
+
reject(new Error("Comment session destroyed"));
|
|
1651
|
+
};
|
|
1652
|
+
const dispose = () => {
|
|
1653
|
+
document.removeEventListener("DOMContentLoaded", start);
|
|
1654
|
+
controller.signal.removeEventListener("abort", abort);
|
|
1655
|
+
};
|
|
1656
|
+
controller.signal.addEventListener("abort", abort, { once: true });
|
|
1657
|
+
if (document.readyState === "loading")
|
|
1658
|
+
document.addEventListener("DOMContentLoaded", start, { once: true });
|
|
1659
|
+
else start();
|
|
1660
|
+
}).then(async () => {
|
|
1661
|
+
if (controller.signal.aborted)
|
|
1662
|
+
throw new Error("Comment session destroyed");
|
|
1663
|
+
const session2 = await mount(options, controller.signal);
|
|
1664
|
+
mounted2 = session2;
|
|
1665
|
+
if (controller.signal.aborted) {
|
|
1666
|
+
session2.destroy();
|
|
1667
|
+
throw new Error("Comment session destroyed");
|
|
1668
|
+
}
|
|
1669
|
+
return session2.ready;
|
|
1670
|
+
});
|
|
1671
|
+
const onPageHide = (event) => {
|
|
1672
|
+
if (!event.persisted) session.destroy();
|
|
1673
|
+
};
|
|
1674
|
+
const session = {
|
|
1675
|
+
ready,
|
|
1676
|
+
destroy() {
|
|
1677
|
+
controller.abort();
|
|
1678
|
+
mounted2 == null ? void 0 : mounted2.destroy();
|
|
1679
|
+
window.removeEventListener("pagehide", onPageHide);
|
|
1680
|
+
if ((current == null ? void 0 : current.session) === session) current = void 0;
|
|
1681
|
+
}
|
|
1682
|
+
};
|
|
1683
|
+
current = { iframe, session };
|
|
1684
|
+
window.addEventListener("pagehide", onPageHide);
|
|
1685
|
+
void ready.catch(() => session.destroy());
|
|
1686
|
+
return session;
|
|
1687
|
+
}
|
|
1688
|
+
return { init: init2, destroy: destroy2 };
|
|
1689
|
+
}
|
|
1690
|
+
|
|
1691
|
+
// src/comment/runtime.ts
|
|
1692
|
+
var hostNonce = document.currentScript instanceof HTMLScriptElement ? document.currentScript.nonce : void 0;
|
|
1693
|
+
var key = "__miaodaCommentRuntime__";
|
|
1694
|
+
var state = window;
|
|
1695
|
+
var loadBootstrap = createBootstrapLoader();
|
|
1696
|
+
var _a;
|
|
1697
|
+
var runtime = (_a = state[key]) != null ? _a : createCommentRuntime(async (options, signal) => {
|
|
1698
|
+
const bootstrap = await loadBootstrap(
|
|
1699
|
+
options.iframe,
|
|
1700
|
+
options.nonce,
|
|
1701
|
+
signal
|
|
1702
|
+
);
|
|
1703
|
+
if (signal.aborted) throw new Error("Comment session destroyed");
|
|
1704
|
+
return bootstrap.init(options);
|
|
1705
|
+
});
|
|
1706
|
+
state[key] = runtime;
|
|
1707
|
+
var version = "0.0.19-beta.0";
|
|
1708
|
+
function init({
|
|
1709
|
+
iframe,
|
|
1710
|
+
nonce = hostNonce
|
|
1711
|
+
}) {
|
|
1712
|
+
return runtime.init({ iframe, nonce });
|
|
1713
|
+
}
|
|
1714
|
+
var destroy = runtime.destroy;
|
|
1715
|
+
|
|
1716
|
+
// src/comment/auto-init.ts
|
|
1717
|
+
function initDoubaoComments() {
|
|
1718
|
+
const start = () => {
|
|
1719
|
+
const iframe = document.getElementById("miaoda-html-comment");
|
|
1720
|
+
if (!(iframe instanceof HTMLIFrameElement)) return;
|
|
1721
|
+
try {
|
|
1722
|
+
void init({ iframe }).ready.catch((error) => {
|
|
1723
|
+
console.warn("[MiaodaComments] initialization failed", error);
|
|
1724
|
+
});
|
|
1725
|
+
} catch (error) {
|
|
1726
|
+
console.warn("[MiaodaComments] initialization failed", error);
|
|
1727
|
+
}
|
|
1728
|
+
};
|
|
1729
|
+
if (document.readyState === "loading")
|
|
1730
|
+
document.addEventListener("DOMContentLoaded", start, { once: true });
|
|
1731
|
+
else start();
|
|
1732
|
+
}
|
|
1733
|
+
|
|
1734
|
+
// src/runtime/watermark.ts
|
|
1735
|
+
var CDN = "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp";
|
|
1736
|
+
var DOUBAO_LOGO_SRC = `${CDN}/miaoda-ui/doubao.svg`;
|
|
1737
|
+
var DOUBAO_BRAND_TEXT_SRC = `${CDN}/miaoda-ui/Doubao_watermark_aigc.svg`;
|
|
1738
|
+
var MIAODA_LOGO_SRC = `${CDN}/logo/miaodalogo.svg`;
|
|
1739
|
+
var CLOSE_ICON_SVG = '<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>';
|
|
1740
|
+
var FEEDBACK_ICON_SVG = '<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>';
|
|
1741
|
+
var REPORT_ICON_SVG = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M7.13397 2.5C7.51887 1.83333 8.48113 1.83333 8.86603 2.5L14.0622 11.5C14.4471 12.1667 13.966 13 13.1962 13H2.80385C2.03405 13 1.55292 12.1667 1.93782 11.5L7.13397 2.5Z" stroke="currentColor" stroke-width="1.2" fill="none"/><path d="M8 6.16667V8.83333" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/><circle cx="8" cy="10.6667" r="0.6667" fill="currentColor"/></svg>';
|
|
1742
|
+
var DOUBAO_CLOSE_ICON_SVG = '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M9.91685 2.08234C10.2097 2.37519 10.2096 2.8501 9.91685 3.143L7.06253 5.99732L9.91858 8.85337C10.2114 9.14627 10.2115 9.62115 9.91858 9.91403C9.62568 10.2068 9.15076 10.2068 8.85792 9.91403L6.00187 7.05798L3.14444 9.91541C2.85155 10.2083 2.37667 10.2083 2.08378 9.91541C1.791 9.62251 1.79093 9.14761 2.08378 8.85475L4.94121 5.99732L2.08551 3.14162C1.79267 2.84878 1.79278 2.37387 2.08551 2.08096C2.3784 1.78807 2.85327 1.78807 3.14617 2.08096L6.00187 4.93666L8.85619 2.08234C9.14906 1.78961 9.62399 1.7896 9.91685 2.08234Z" fill="white" fill-opacity="0.3"/></svg>';
|
|
1743
|
+
var DOWNLOAD_ICON_SVG = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M11.9922 1.99221C12.5445 1.98895 12.9958 2.43407 12.999 2.98634L13.0762 16.1943L14.6387 14.6328L17.8926 11.3789C18.2831 10.9884 18.9171 10.9885 19.3076 11.3789C19.6977 11.7695 19.6979 12.4026 19.3076 12.793L16.0527 16.0479L12.7979 19.3018C12.7111 19.3884 12.6098 19.4566 12.5 19.5059H20.375C20.9271 19.5059 21.3748 19.9538 21.375 20.5059C21.375 21.0581 20.9273 21.5059 20.375 21.5059H3.625C3.07272 21.5059 2.625 21.0581 2.625 20.5059C2.62523 19.9538 3.07286 19.5059 3.625 19.5059H11.6816C11.572 19.4566 11.4704 19.3884 11.3838 19.3018L4.87402 12.793C4.48372 12.4026 4.4839 11.7694 4.87402 11.3789C5.26452 10.9884 5.89756 10.9885 6.28809 11.3789L11.0762 16.166L10.999 2.99806C10.9958 2.44603 11.4402 1.99582 11.9922 1.99221Z" fill="currentColor"/></svg>';
|
|
1744
|
+
var EFFICIENCY_ICON_SVG = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M2.0754 7.57153C2.23188 9.44922 3.49231 11.053 5.27982 11.6488C5.31351 11.6601 5.33994 11.6865 5.35117 11.7202L5.72076 12.8289C5.88752 13.3292 6.3557 13.6667 6.88304 13.6667H9.11696C9.6443 13.6667 10.1125 13.3292 10.2792 12.8289L10.6488 11.7202C10.6601 11.6865 10.6865 11.6601 10.7202 11.6488C12.5077 11.053 13.7681 9.44922 13.9246 7.57153L14 6.66667C14 3.35296 11.3137 0.666668 8 0.666668C4.68629 0.666668 2 3.35296 2 6.66667L2.0754 7.57153ZM9.38392 11.2985L9.03899 12.3333H6.96101L6.61608 11.2985C6.47214 10.8667 6.13328 10.5279 5.70146 10.3839C4.41995 9.95675 3.51631 8.80696 3.40413 7.4608L3.33362 6.61462C3.36152 4.06127 5.44004 2 8 2C10.56 2 12.6385 4.06127 12.6664 6.61462L12.5959 7.4608C12.4837 8.80696 11.5801 9.95675 10.2985 10.3839C9.86672 10.5279 9.52786 10.8667 9.38392 11.2985Z" fill="currentColor"/><path d="M6.66667 14.3333C6.29848 14.3333 6 14.6318 6 15C6 15.3682 6.29848 15.6667 6.66667 15.6667H9.33333C9.70152 15.6667 10 15.3682 10 15C10 14.6318 9.70152 14.3333 9.33333 14.3333H6.66667Z" fill="currentColor"/><path d="M8.00864 4.13208L5.44578 6.94049C5.20258 7.18228 5.37835 7.56531 5.74361 7.58951L7.2181 7.6872L7.21814 9.60852C7.21814 9.96788 7.72139 10.1366 7.99168 9.86792C8.26197 9.59921 10.5545 7.05951 10.5545 7.05951C10.7977 6.81772 10.622 6.43469 10.2567 6.41049L8.78222 6.3128L8.78219 4.39148C8.78218 4.03212 8.27893 3.86336 8.00864 4.13208Z" fill="currentColor"/></svg>';
|
|
1745
|
+
var REPORT_ENABLED = true;
|
|
1746
|
+
var PILL_SHADOW = "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)";
|
|
1747
|
+
var CARD_SHADOW = "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)";
|
|
1748
|
+
var FONT_FAMILY = "'PingFang SC', -apple-system, BlinkMacSystemFont, sans-serif";
|
|
1749
|
+
var DOUBAO_FONT_FAMILY = "'Doubao Sans', 'PingFang SC', -apple-system, BlinkMacSystemFont, sans-serif";
|
|
1750
|
+
var VARIANT_CONFIG = {
|
|
1751
|
+
doubao: {
|
|
1752
|
+
brandText: "\u8C46\u5305\u5DE5\u4F5C AI \u751F\u6210",
|
|
1753
|
+
logoSrc: DOUBAO_LOGO_SRC,
|
|
1754
|
+
downloadUrl: "https://ugapk.com/FCtLH"
|
|
1755
|
+
},
|
|
1756
|
+
miaoda: {
|
|
1757
|
+
brandText: "\u5999\u642D\u751F\u6210",
|
|
1758
|
+
logoSrc: MIAODA_LOGO_SRC,
|
|
1759
|
+
landingUrl: "https://miaoda.feishu.cn/landing"
|
|
1760
|
+
}
|
|
1761
|
+
};
|
|
1762
|
+
var REPORT_DOMAIN = {
|
|
1763
|
+
BOE: "tns.feishu-boe.cn",
|
|
1764
|
+
PRE: "tns.feishu-pre.cn",
|
|
1765
|
+
ONLINE: "tns.feishu.cn"
|
|
1766
|
+
};
|
|
1767
|
+
function openReport() {
|
|
1768
|
+
var _a2;
|
|
1769
|
+
const params = JSON.stringify({
|
|
1770
|
+
scene: "miaoda_app_report",
|
|
1771
|
+
entity_id: (_a2 = getAppId()) != null ? _a2 : "",
|
|
1772
|
+
entity_type: "miaoda_app",
|
|
1773
|
+
extra: ""
|
|
1774
|
+
});
|
|
1775
|
+
const url = `https://${REPORT_DOMAIN[getEnv()]}/cust/lark_report/?type=common¶ms=${encodeURIComponent(
|
|
1776
|
+
params
|
|
1777
|
+
)}&lang=zh-CN`;
|
|
1778
|
+
window.open(url, "_blank", "noopener,noreferrer");
|
|
1779
|
+
}
|
|
1780
|
+
var ICON_SVG_MAP = {
|
|
1781
|
+
feedback: FEEDBACK_ICON_SVG,
|
|
1782
|
+
report: REPORT_ICON_SVG,
|
|
1783
|
+
close: CLOSE_ICON_SVG,
|
|
1784
|
+
download: DOWNLOAD_ICON_SVG,
|
|
1785
|
+
efficiency: EFFICIENCY_ICON_SVG
|
|
1786
|
+
};
|
|
1787
|
+
function makeCloseIcon(size) {
|
|
1788
|
+
const span = document.createElement("span");
|
|
1789
|
+
Object.assign(span.style, {
|
|
1790
|
+
display: "inline-flex",
|
|
1791
|
+
width: `${size}px`,
|
|
1792
|
+
height: `${size}px`,
|
|
1793
|
+
flexShrink: "0"
|
|
1794
|
+
});
|
|
1795
|
+
span.innerHTML = CLOSE_ICON_SVG;
|
|
1796
|
+
const svg = span.firstElementChild;
|
|
1797
|
+
if (svg) {
|
|
1798
|
+
svg.setAttribute("width", String(size));
|
|
1799
|
+
svg.setAttribute("height", String(size));
|
|
1800
|
+
svg.style.display = "block";
|
|
1801
|
+
}
|
|
1802
|
+
return span;
|
|
1803
|
+
}
|
|
1804
|
+
function makeIcon(type, size = 16) {
|
|
1805
|
+
if (type === "close") return makeCloseIcon(size);
|
|
1806
|
+
const span = document.createElement("span");
|
|
1807
|
+
Object.assign(span.style, {
|
|
1808
|
+
display: "inline-flex",
|
|
1809
|
+
width: `${size}px`,
|
|
1810
|
+
height: `${size}px`,
|
|
1811
|
+
flexShrink: "0"
|
|
1812
|
+
});
|
|
1813
|
+
span.innerHTML = ICON_SVG_MAP[type];
|
|
1814
|
+
const svg = span.firstElementChild;
|
|
1815
|
+
if (svg) svg.style.display = "block";
|
|
1816
|
+
return span;
|
|
1817
|
+
}
|
|
1818
|
+
function makeLogo(src, size) {
|
|
1819
|
+
const img = document.createElement("img");
|
|
1820
|
+
img.src = src;
|
|
1821
|
+
img.width = size;
|
|
1822
|
+
img.height = size;
|
|
1823
|
+
img.alt = "";
|
|
1824
|
+
Object.assign(img.style, {
|
|
1825
|
+
width: `${size}px`,
|
|
1826
|
+
height: `${size}px`,
|
|
1827
|
+
maxWidth: "none",
|
|
1828
|
+
maxHeight: "none",
|
|
1829
|
+
borderRadius: "100px",
|
|
1830
|
+
flexShrink: "0",
|
|
1831
|
+
display: "block"
|
|
1832
|
+
});
|
|
1833
|
+
return img;
|
|
1834
|
+
}
|
|
1835
|
+
function buildPill(variant, platform, onClose) {
|
|
1836
|
+
const isDesktop = platform === "desktop";
|
|
1837
|
+
const isDoubao = variant === "doubao";
|
|
1838
|
+
const config = VARIANT_CONFIG[variant];
|
|
1839
|
+
const pill = document.createElement("div");
|
|
1840
|
+
if (isDoubao) {
|
|
1841
|
+
Object.assign(pill.style, {
|
|
1842
|
+
boxSizing: "border-box",
|
|
1843
|
+
display: "inline-flex",
|
|
1844
|
+
alignItems: "center",
|
|
1845
|
+
gap: "6px",
|
|
1846
|
+
padding: "6px 8px",
|
|
1847
|
+
background: "rgba(77,77,77,0.7)",
|
|
1848
|
+
borderRadius: "6px",
|
|
1849
|
+
cursor: "pointer"
|
|
1850
|
+
});
|
|
1851
|
+
} else {
|
|
1852
|
+
Object.assign(pill.style, {
|
|
1853
|
+
boxSizing: "border-box",
|
|
1854
|
+
display: "inline-flex",
|
|
1855
|
+
alignItems: "center",
|
|
1856
|
+
gap: "4px",
|
|
1857
|
+
padding: isDesktop ? "6px 12px 6px 8px" : "5px 12px 5px 8px",
|
|
1858
|
+
background: "#363636",
|
|
1859
|
+
border: "0.5px solid rgba(255,255,255,0.1)",
|
|
1860
|
+
borderRadius: "100px",
|
|
1861
|
+
boxShadow: PILL_SHADOW,
|
|
1862
|
+
cursor: "pointer"
|
|
1863
|
+
});
|
|
1864
|
+
}
|
|
1865
|
+
let brandEl;
|
|
1866
|
+
if (isDoubao) {
|
|
1867
|
+
const img = document.createElement("img");
|
|
1868
|
+
img.src = DOUBAO_BRAND_TEXT_SRC;
|
|
1869
|
+
img.alt = config.brandText;
|
|
1870
|
+
img.draggable = false;
|
|
1871
|
+
Object.assign(img.style, {
|
|
1872
|
+
height: isDesktop ? "12px" : "14px",
|
|
1873
|
+
width: "auto",
|
|
1874
|
+
display: "block",
|
|
1875
|
+
flexShrink: "0"
|
|
1876
|
+
});
|
|
1877
|
+
brandEl = img;
|
|
1878
|
+
} else {
|
|
1879
|
+
const logo = makeLogo(config.logoSrc, 16);
|
|
1880
|
+
const span = document.createElement("span");
|
|
1881
|
+
span.textContent = config.brandText;
|
|
1882
|
+
Object.assign(span.style, {
|
|
1883
|
+
fontFamily: FONT_FAMILY,
|
|
1884
|
+
fontSize: isDesktop ? "12px" : "14px",
|
|
1885
|
+
lineHeight: isDesktop ? "18px" : "22px",
|
|
1886
|
+
color: "rgba(255,255,255,0.85)",
|
|
1887
|
+
whiteSpace: "nowrap"
|
|
1888
|
+
});
|
|
1889
|
+
brandEl = span;
|
|
1890
|
+
pill.append(logo);
|
|
1891
|
+
}
|
|
1892
|
+
pill.append(brandEl);
|
|
1893
|
+
if (isDesktop && onClose) {
|
|
1894
|
+
const close = document.createElement("span");
|
|
1895
|
+
close.setAttribute("role", "button");
|
|
1896
|
+
close.setAttribute("aria-label", "\u5173\u95ED");
|
|
1897
|
+
close.setAttribute("data-watermark-close", "");
|
|
1898
|
+
Object.assign(close.style, {
|
|
1899
|
+
display: "none",
|
|
1900
|
+
alignItems: "center",
|
|
1901
|
+
cursor: "pointer",
|
|
1902
|
+
flexShrink: "0"
|
|
1903
|
+
});
|
|
1904
|
+
if (isDoubao) {
|
|
1905
|
+
close.innerHTML = DOUBAO_CLOSE_ICON_SVG;
|
|
1906
|
+
} else {
|
|
1907
|
+
close.style.color = "rgba(255,255,255,0.5)";
|
|
1908
|
+
close.appendChild(makeCloseIcon(10));
|
|
1909
|
+
}
|
|
1910
|
+
close.addEventListener("click", (e) => {
|
|
1911
|
+
e.stopPropagation();
|
|
1912
|
+
onClose();
|
|
1913
|
+
});
|
|
1914
|
+
pill.appendChild(close);
|
|
1915
|
+
}
|
|
1916
|
+
return pill;
|
|
1917
|
+
}
|
|
1918
|
+
function buildMenuRow(opts) {
|
|
1919
|
+
const row = document.createElement("div");
|
|
1920
|
+
row.setAttribute("role", "menuitem");
|
|
1921
|
+
row.setAttribute("data-label", opts.label);
|
|
1922
|
+
Object.assign(row.style, {
|
|
1923
|
+
boxSizing: "border-box",
|
|
1924
|
+
display: "flex",
|
|
1925
|
+
alignItems: "center",
|
|
1926
|
+
gap: "8px",
|
|
1927
|
+
minHeight: "38px",
|
|
1928
|
+
padding: "4px 10px",
|
|
1929
|
+
borderRadius: "6px",
|
|
1930
|
+
cursor: "pointer",
|
|
1931
|
+
color: "#000000"
|
|
1932
|
+
});
|
|
1933
|
+
const icon = document.createElement("span");
|
|
1934
|
+
Object.assign(icon.style, {
|
|
1935
|
+
display: "inline-flex",
|
|
1936
|
+
width: "16px",
|
|
1937
|
+
height: "16px",
|
|
1938
|
+
flexShrink: "0",
|
|
1939
|
+
color: "#000000"
|
|
1940
|
+
});
|
|
1941
|
+
icon.appendChild(makeIcon(opts.icon));
|
|
1942
|
+
const label = document.createElement("span");
|
|
1943
|
+
label.textContent = opts.label;
|
|
1944
|
+
Object.assign(label.style, {
|
|
1945
|
+
fontFamily: FONT_FAMILY,
|
|
1946
|
+
fontSize: `${opts.fontSize}px`,
|
|
1947
|
+
lineHeight: `${opts.fontSize + 8}px`,
|
|
1948
|
+
color: "#000000",
|
|
1949
|
+
whiteSpace: "nowrap"
|
|
1950
|
+
});
|
|
1951
|
+
row.append(icon, label);
|
|
1952
|
+
row.addEventListener("mouseenter", () => {
|
|
1953
|
+
row.style.background = "rgba(0,0,0,0.04)";
|
|
1954
|
+
});
|
|
1955
|
+
row.addEventListener("mouseleave", () => {
|
|
1956
|
+
row.style.background = "transparent";
|
|
1957
|
+
});
|
|
1958
|
+
row.addEventListener("click", opts.onClick);
|
|
1959
|
+
return row;
|
|
1960
|
+
}
|
|
1961
|
+
function buildDivider() {
|
|
1962
|
+
const div = document.createElement("div");
|
|
1963
|
+
Object.assign(div.style, {
|
|
1964
|
+
height: "1px",
|
|
1965
|
+
background: "rgba(0,0,0,0.08)",
|
|
1966
|
+
margin: "0 10px"
|
|
1967
|
+
});
|
|
1968
|
+
return div;
|
|
1969
|
+
}
|
|
1970
|
+
function buildMenuCard(opts) {
|
|
1971
|
+
var _a2;
|
|
1972
|
+
const card = document.createElement("div");
|
|
1973
|
+
Object.assign(card.style, {
|
|
1974
|
+
boxSizing: "border-box",
|
|
1975
|
+
display: "flex",
|
|
1976
|
+
flexDirection: "column",
|
|
1977
|
+
minWidth: `${opts.minWidth}px`,
|
|
1978
|
+
background: "#ffffff",
|
|
1979
|
+
border: "0.5px solid rgba(0,0,0,0.1)",
|
|
1980
|
+
borderRadius: "10px",
|
|
1981
|
+
boxShadow: CARD_SHADOW,
|
|
1982
|
+
overflow: "hidden",
|
|
1983
|
+
outline: "none"
|
|
1984
|
+
});
|
|
1985
|
+
if (opts.items.length) {
|
|
1986
|
+
const section = document.createElement("div");
|
|
1987
|
+
Object.assign(section.style, {
|
|
1988
|
+
boxSizing: "border-box",
|
|
1989
|
+
padding: "4px",
|
|
1990
|
+
display: "flex",
|
|
1991
|
+
flexDirection: "column",
|
|
1992
|
+
gap: `${(_a2 = opts.itemGap) != null ? _a2 : 0}px`
|
|
1993
|
+
});
|
|
1994
|
+
opts.items.forEach((r) => section.appendChild(r));
|
|
1995
|
+
card.appendChild(section);
|
|
1996
|
+
}
|
|
1997
|
+
if (opts.extraItems && opts.extraItems.length) {
|
|
1998
|
+
card.appendChild(buildDivider());
|
|
1999
|
+
const section = document.createElement("div");
|
|
2000
|
+
Object.assign(section.style, { boxSizing: "border-box", padding: "4px" });
|
|
2001
|
+
opts.extraItems.forEach((r) => section.appendChild(r));
|
|
2002
|
+
card.appendChild(section);
|
|
2003
|
+
}
|
|
2004
|
+
return card;
|
|
2005
|
+
}
|
|
2006
|
+
function createWatermarkRoot(variant, mobile = false) {
|
|
2007
|
+
const host = document.createElement("div");
|
|
2008
|
+
host.setAttribute(
|
|
2009
|
+
"data-custom-element",
|
|
2010
|
+
`${variant}-watermark${mobile ? "-mobile" : ""}`
|
|
2011
|
+
);
|
|
2012
|
+
const shadow = host.attachShadow({ mode: "open" });
|
|
2013
|
+
const fontFamily = variant === "doubao" ? DOUBAO_FONT_FAMILY : FONT_FAMILY;
|
|
2014
|
+
const style = document.createElement("style");
|
|
2015
|
+
style.textContent = `
|
|
2016
|
+
:host {
|
|
2017
|
+
all: initial !important;
|
|
2018
|
+
display: block !important;
|
|
2019
|
+
position: fixed !important;
|
|
2020
|
+
right: 12px !important;
|
|
2021
|
+
bottom: 12px !important;
|
|
2022
|
+
z-index: 9999 !important;
|
|
2023
|
+
direction: ltr !important;
|
|
2024
|
+
unicode-bidi: isolate !important;
|
|
2025
|
+
}
|
|
2026
|
+
:host::before, :host::after { content: none !important; }
|
|
2027
|
+
.watermark-root {
|
|
2028
|
+
all: initial;
|
|
2029
|
+
direction: ltr;
|
|
2030
|
+
unicode-bidi: isolate;
|
|
2031
|
+
font-family: ${fontFamily};
|
|
2032
|
+
display: flex;
|
|
2033
|
+
flex-direction: column;
|
|
2034
|
+
align-items: flex-end;
|
|
2035
|
+
gap: 8px;
|
|
2036
|
+
}
|
|
2037
|
+
`;
|
|
2038
|
+
const container = document.createElement("div");
|
|
2039
|
+
container.className = "watermark-root";
|
|
2040
|
+
shadow.append(style, container);
|
|
2041
|
+
return { host, container };
|
|
2042
|
+
}
|
|
2043
|
+
function buildDesktopWatermark(variant) {
|
|
2044
|
+
const { host, container } = createWatermarkRoot(variant);
|
|
2045
|
+
const items = [];
|
|
2046
|
+
if (variant === "doubao") {
|
|
2047
|
+
items.push(
|
|
2048
|
+
buildMenuRow({
|
|
2049
|
+
icon: "download",
|
|
2050
|
+
label: "\u4E0B\u8F7D\u8C46\u5305\u5DE5\u4F5C",
|
|
2051
|
+
fontSize: 14,
|
|
2052
|
+
onClick: () => window.open(
|
|
2053
|
+
VARIANT_CONFIG.doubao.downloadUrl,
|
|
2054
|
+
"_blank",
|
|
2055
|
+
"noopener,noreferrer"
|
|
2056
|
+
)
|
|
2057
|
+
})
|
|
2058
|
+
);
|
|
2059
|
+
} else {
|
|
2060
|
+
items.push(
|
|
2061
|
+
buildMenuRow({
|
|
2062
|
+
icon: "efficiency",
|
|
2063
|
+
label: "\u4E86\u89E3\u5999\u642D",
|
|
2064
|
+
fontSize: 14,
|
|
2065
|
+
onClick: () => window.open(
|
|
2066
|
+
VARIANT_CONFIG.miaoda.landingUrl,
|
|
2067
|
+
"_blank",
|
|
2068
|
+
"noopener,noreferrer"
|
|
2069
|
+
)
|
|
2070
|
+
})
|
|
2071
|
+
);
|
|
2072
|
+
}
|
|
2073
|
+
if (REPORT_ENABLED) {
|
|
2074
|
+
items.push(
|
|
2075
|
+
buildMenuRow({
|
|
2076
|
+
icon: variant === "doubao" ? "report" : "feedback",
|
|
2077
|
+
label: "\u6295\u8BC9\u4E0E\u4E3E\u62A5",
|
|
2078
|
+
fontSize: 14,
|
|
2079
|
+
onClick: openReport
|
|
2080
|
+
})
|
|
2081
|
+
);
|
|
2082
|
+
}
|
|
2083
|
+
const menu = buildMenuCard({ items, minWidth: 160, itemGap: 8 });
|
|
2084
|
+
menu.style.display = "none";
|
|
2085
|
+
const pill = buildPill(variant, "desktop", () => host.remove());
|
|
2086
|
+
const close = pill.querySelector("[data-watermark-close]");
|
|
2087
|
+
container.append(menu, pill);
|
|
2088
|
+
let timer = null;
|
|
2089
|
+
container.addEventListener("mouseenter", () => {
|
|
2090
|
+
if (timer) clearTimeout(timer);
|
|
2091
|
+
menu.style.display = "flex";
|
|
2092
|
+
if (close) close.style.display = "inline-flex";
|
|
2093
|
+
});
|
|
2094
|
+
container.addEventListener("mouseleave", () => {
|
|
2095
|
+
timer = setTimeout(() => {
|
|
2096
|
+
menu.style.display = "none";
|
|
2097
|
+
if (close) close.style.display = "none";
|
|
2098
|
+
}, 100);
|
|
2099
|
+
});
|
|
2100
|
+
return host;
|
|
2101
|
+
}
|
|
2102
|
+
function buildMobileWatermark(variant) {
|
|
2103
|
+
const { host, container: wrapper } = createWatermarkRoot(variant, true);
|
|
2104
|
+
wrapper.style.cursor = "pointer";
|
|
2105
|
+
const items = [];
|
|
2106
|
+
if (variant === "miaoda") {
|
|
2107
|
+
items.push(
|
|
2108
|
+
buildMenuRow({
|
|
2109
|
+
icon: "efficiency",
|
|
2110
|
+
label: "\u4E86\u89E3\u5999\u642D",
|
|
2111
|
+
fontSize: 16,
|
|
2112
|
+
onClick: () => window.open(
|
|
2113
|
+
VARIANT_CONFIG.miaoda.landingUrl,
|
|
2114
|
+
"_blank",
|
|
2115
|
+
"noopener,noreferrer"
|
|
2116
|
+
)
|
|
2117
|
+
})
|
|
2118
|
+
);
|
|
2119
|
+
}
|
|
2120
|
+
if (REPORT_ENABLED) {
|
|
2121
|
+
items.push(
|
|
2122
|
+
buildMenuRow({
|
|
2123
|
+
icon: variant === "doubao" ? "report" : "feedback",
|
|
2124
|
+
label: "\u6295\u8BC9\u4E0E\u4E3E\u62A5",
|
|
2125
|
+
fontSize: 16,
|
|
2126
|
+
onClick: openReport
|
|
2127
|
+
})
|
|
2128
|
+
);
|
|
2129
|
+
}
|
|
2130
|
+
const extraItems = [
|
|
2131
|
+
buildMenuRow({
|
|
2132
|
+
icon: "close",
|
|
2133
|
+
label: "\u4E0D\u518D\u5C55\u793A",
|
|
2134
|
+
fontSize: 16,
|
|
2135
|
+
onClick: (e) => {
|
|
2136
|
+
e.stopPropagation();
|
|
2137
|
+
document.removeEventListener("click", onOutsideClick);
|
|
2138
|
+
host.remove();
|
|
2139
|
+
}
|
|
2140
|
+
})
|
|
2141
|
+
];
|
|
2142
|
+
const menu = buildMenuCard({ items, extraItems, minWidth: 160 });
|
|
2143
|
+
menu.style.display = "none";
|
|
2144
|
+
const pill = buildPill(variant, "mobile");
|
|
2145
|
+
wrapper.append(menu, pill);
|
|
2146
|
+
wrapper.addEventListener("click", (e) => {
|
|
2147
|
+
e.stopPropagation();
|
|
2148
|
+
menu.style.display = menu.style.display === "none" ? "flex" : "none";
|
|
2149
|
+
});
|
|
2150
|
+
const onOutsideClick = () => {
|
|
2151
|
+
menu.style.display = "none";
|
|
2152
|
+
};
|
|
2153
|
+
document.addEventListener("click", onOutsideClick);
|
|
2154
|
+
return host;
|
|
2155
|
+
}
|
|
2156
|
+
var mounted = false;
|
|
2157
|
+
var pending = false;
|
|
2158
|
+
async function mountWatermark(variant) {
|
|
2159
|
+
if (mounted || pending || typeof document === "undefined") return;
|
|
2160
|
+
if (document.readyState === "loading") {
|
|
2161
|
+
document.addEventListener(
|
|
2162
|
+
"DOMContentLoaded",
|
|
2163
|
+
() => mountWatermark(variant),
|
|
2164
|
+
{ once: true }
|
|
2165
|
+
);
|
|
2166
|
+
return;
|
|
2167
|
+
}
|
|
2168
|
+
pending = true;
|
|
2169
|
+
const shouldShow = await fetchShowBadge();
|
|
2170
|
+
mounted = true;
|
|
2171
|
+
pending = false;
|
|
2172
|
+
if (!shouldShow) return;
|
|
2173
|
+
const el = isMobile() ? buildMobileWatermark(variant) : buildDesktopWatermark(variant);
|
|
2174
|
+
document.body.appendChild(el);
|
|
2175
|
+
}
|
|
2176
|
+
function mountDoubaoWatermark() {
|
|
2177
|
+
return mountWatermark("doubao");
|
|
2178
|
+
}
|
|
2179
|
+
|
|
2180
|
+
// src/doubao-html-runtime.ts
|
|
2181
|
+
var version2 = "0.0.19-beta.0";
|
|
2182
|
+
var name = "@lark-apaas/miaoda-coding-sdk";
|
|
2183
|
+
registerInspectorIdPlugin();
|
|
2184
|
+
if (isOnlineEnv()) {
|
|
2185
|
+
reportPageView();
|
|
2186
|
+
initPvTracking();
|
|
2187
|
+
}
|
|
2188
|
+
mountDoubaoWatermark();
|
|
2189
|
+
void markFeedReadOnce();
|
|
2190
|
+
initDoubaoComments();
|
|
2191
|
+
return __toCommonJS(doubao_html_runtime_exports);
|
|
2192
|
+
})();
|