@lvce-editor/preview-sandbox-worker 3.4.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/previewSandBoxWorkerMain.js +285 -120
- package/package.json +1 -1
|
@@ -1129,6 +1129,60 @@ const terminate = () => {
|
|
|
1129
1129
|
globalThis.close();
|
|
1130
1130
|
};
|
|
1131
1131
|
|
|
1132
|
+
const ENTRY_SIZE = 9;
|
|
1133
|
+
const OFFSET_EXISTS = 0;
|
|
1134
|
+
const OFFSET_X = 1;
|
|
1135
|
+
const OFFSET_Y = 2;
|
|
1136
|
+
const OFFSET_TOP = 3;
|
|
1137
|
+
const OFFSET_LEFT = 4;
|
|
1138
|
+
const OFFSET_RIGHT = 5;
|
|
1139
|
+
const OFFSET_BOTTOM = 6;
|
|
1140
|
+
const OFFSET_WIDTH = 7;
|
|
1141
|
+
const OFFSET_HEIGHT = 8;
|
|
1142
|
+
const states$2 = new Map();
|
|
1143
|
+
const getIndex = hdId => {
|
|
1144
|
+
const value = Number(hdId);
|
|
1145
|
+
if (!Number.isInteger(value) || value < 0) {
|
|
1146
|
+
return -1;
|
|
1147
|
+
}
|
|
1148
|
+
return value;
|
|
1149
|
+
};
|
|
1150
|
+
const getOffset = hdId => {
|
|
1151
|
+
const index = getIndex(hdId);
|
|
1152
|
+
if (index === -1) {
|
|
1153
|
+
return -1;
|
|
1154
|
+
}
|
|
1155
|
+
return index * ENTRY_SIZE;
|
|
1156
|
+
};
|
|
1157
|
+
|
|
1158
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1159
|
+
const setGeometryBuffer = (uid, geometryBuffer) => {
|
|
1160
|
+
states$2.set(uid, new Float64Array(geometryBuffer));
|
|
1161
|
+
};
|
|
1162
|
+
const getRect = (uid, hdId) => {
|
|
1163
|
+
const view = states$2.get(uid);
|
|
1164
|
+
if (!view) {
|
|
1165
|
+
return undefined;
|
|
1166
|
+
}
|
|
1167
|
+
const offset = getOffset(hdId);
|
|
1168
|
+
if (offset === -1 || offset + ENTRY_SIZE > view.length) {
|
|
1169
|
+
return undefined;
|
|
1170
|
+
}
|
|
1171
|
+
if (view[offset + OFFSET_EXISTS] !== 1) {
|
|
1172
|
+
return undefined;
|
|
1173
|
+
}
|
|
1174
|
+
return {
|
|
1175
|
+
bottom: view[offset + OFFSET_BOTTOM],
|
|
1176
|
+
height: view[offset + OFFSET_HEIGHT],
|
|
1177
|
+
left: view[offset + OFFSET_LEFT],
|
|
1178
|
+
right: view[offset + OFFSET_RIGHT],
|
|
1179
|
+
top: view[offset + OFFSET_TOP],
|
|
1180
|
+
width: view[offset + OFFSET_WIDTH],
|
|
1181
|
+
x: view[offset + OFFSET_X],
|
|
1182
|
+
y: view[offset + OFFSET_Y]
|
|
1183
|
+
};
|
|
1184
|
+
};
|
|
1185
|
+
|
|
1132
1186
|
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
|
|
1133
1187
|
|
|
1134
1188
|
const callBacks = Object.create(null);
|
|
@@ -1343,6 +1397,20 @@ const TAGS_TO_SKIP_TAG_ONLY = new Set(['html', 'body', 'head']);
|
|
|
1343
1397
|
|
|
1344
1398
|
// Tags where we extract content as CSS
|
|
1345
1399
|
const CSS_TAGS = new Set(['style']);
|
|
1400
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1401
|
+
const getOrCreateHdId = (node, context) => {
|
|
1402
|
+
const existingHdId = node.getAttribute?.('data-id');
|
|
1403
|
+
if (existingHdId) {
|
|
1404
|
+
const numericValue = Number(existingHdId);
|
|
1405
|
+
if (Number.isInteger(numericValue) && numericValue >= context.nextId) {
|
|
1406
|
+
context.nextId = numericValue + 1;
|
|
1407
|
+
}
|
|
1408
|
+
return existingHdId;
|
|
1409
|
+
}
|
|
1410
|
+
const hdId = String(context.nextId++);
|
|
1411
|
+
node.setAttribute?.('data-id', hdId);
|
|
1412
|
+
return hdId;
|
|
1413
|
+
};
|
|
1346
1414
|
const serializeAttributeName = attrName => {
|
|
1347
1415
|
if (attrName === 'class') {
|
|
1348
1416
|
return 'className';
|
|
@@ -1440,7 +1508,7 @@ const serializeNode = (node, dom, css, context) => {
|
|
|
1440
1508
|
applyAllowedAttributes(newNode, node);
|
|
1441
1509
|
|
|
1442
1510
|
// Assign element tracking ID for interactivity
|
|
1443
|
-
const hdId =
|
|
1511
|
+
const hdId = getOrCreateHdId(node, context);
|
|
1444
1512
|
newNode['data-id'] = hdId;
|
|
1445
1513
|
context.elementMap[hdId] = node
|
|
1446
1514
|
|
|
@@ -2164,7 +2232,7 @@ var hasRequiredLib;
|
|
|
2164
2232
|
function requireLib () {
|
|
2165
2233
|
if (hasRequiredLib) return lib;
|
|
2166
2234
|
hasRequiredLib = 1;
|
|
2167
|
-
(function (exports
|
|
2235
|
+
(function (exports) {
|
|
2168
2236
|
|
|
2169
2237
|
function makeException(ErrorType, message, options) {
|
|
2170
2238
|
if (options.globals) {
|
|
@@ -2299,51 +2367,51 @@ function requireLib () {
|
|
|
2299
2367
|
return Number(xBigInt);
|
|
2300
2368
|
};
|
|
2301
2369
|
}
|
|
2302
|
-
exports
|
|
2370
|
+
exports.any = value => {
|
|
2303
2371
|
return value;
|
|
2304
2372
|
};
|
|
2305
|
-
exports
|
|
2373
|
+
exports.undefined = () => {
|
|
2306
2374
|
return undefined;
|
|
2307
2375
|
};
|
|
2308
|
-
exports
|
|
2376
|
+
exports.boolean = value => {
|
|
2309
2377
|
return Boolean(value);
|
|
2310
2378
|
};
|
|
2311
|
-
exports
|
|
2379
|
+
exports.byte = createIntegerConversion(8, {
|
|
2312
2380
|
unsigned: false
|
|
2313
2381
|
});
|
|
2314
|
-
exports
|
|
2382
|
+
exports.octet = createIntegerConversion(8, {
|
|
2315
2383
|
unsigned: true
|
|
2316
2384
|
});
|
|
2317
|
-
exports
|
|
2385
|
+
exports.short = createIntegerConversion(16, {
|
|
2318
2386
|
unsigned: false
|
|
2319
2387
|
});
|
|
2320
|
-
exports
|
|
2388
|
+
exports["unsigned short"] = createIntegerConversion(16, {
|
|
2321
2389
|
unsigned: true
|
|
2322
2390
|
});
|
|
2323
|
-
exports
|
|
2391
|
+
exports.long = createIntegerConversion(32, {
|
|
2324
2392
|
unsigned: false
|
|
2325
2393
|
});
|
|
2326
|
-
exports
|
|
2394
|
+
exports["unsigned long"] = createIntegerConversion(32, {
|
|
2327
2395
|
unsigned: true
|
|
2328
2396
|
});
|
|
2329
|
-
exports
|
|
2397
|
+
exports["long long"] = createLongLongConversion(64, {
|
|
2330
2398
|
unsigned: false
|
|
2331
2399
|
});
|
|
2332
|
-
exports
|
|
2400
|
+
exports["unsigned long long"] = createLongLongConversion(64, {
|
|
2333
2401
|
unsigned: true
|
|
2334
2402
|
});
|
|
2335
|
-
exports
|
|
2403
|
+
exports.double = (value, options = {}) => {
|
|
2336
2404
|
const x = toNumber(value, options);
|
|
2337
2405
|
if (!Number.isFinite(x)) {
|
|
2338
2406
|
throw makeException(TypeError, "is not a finite floating-point value", options);
|
|
2339
2407
|
}
|
|
2340
2408
|
return x;
|
|
2341
2409
|
};
|
|
2342
|
-
exports
|
|
2410
|
+
exports["unrestricted double"] = (value, options = {}) => {
|
|
2343
2411
|
const x = toNumber(value, options);
|
|
2344
2412
|
return x;
|
|
2345
2413
|
};
|
|
2346
|
-
exports
|
|
2414
|
+
exports.float = (value, options = {}) => {
|
|
2347
2415
|
const x = toNumber(value, options);
|
|
2348
2416
|
if (!Number.isFinite(x)) {
|
|
2349
2417
|
throw makeException(TypeError, "is not a finite floating-point value", options);
|
|
@@ -2357,7 +2425,7 @@ function requireLib () {
|
|
|
2357
2425
|
}
|
|
2358
2426
|
return y;
|
|
2359
2427
|
};
|
|
2360
|
-
exports
|
|
2428
|
+
exports["unrestricted float"] = (value, options = {}) => {
|
|
2361
2429
|
const x = toNumber(value, options);
|
|
2362
2430
|
if (isNaN(x)) {
|
|
2363
2431
|
return x;
|
|
@@ -2367,7 +2435,7 @@ function requireLib () {
|
|
|
2367
2435
|
}
|
|
2368
2436
|
return Math.fround(x);
|
|
2369
2437
|
};
|
|
2370
|
-
exports
|
|
2438
|
+
exports.DOMString = (value, options = {}) => {
|
|
2371
2439
|
if (options.treatNullAsEmptyString && value === null) {
|
|
2372
2440
|
return "";
|
|
2373
2441
|
}
|
|
@@ -2377,8 +2445,8 @@ function requireLib () {
|
|
|
2377
2445
|
const StringCtor = options.globals ? options.globals.String : String;
|
|
2378
2446
|
return StringCtor(value);
|
|
2379
2447
|
};
|
|
2380
|
-
exports
|
|
2381
|
-
const x = exports
|
|
2448
|
+
exports.ByteString = (value, options = {}) => {
|
|
2449
|
+
const x = exports.DOMString(value, options);
|
|
2382
2450
|
let c;
|
|
2383
2451
|
for (let i = 0; (c = x.codePointAt(i)) !== undefined; ++i) {
|
|
2384
2452
|
if (c > 255) {
|
|
@@ -2387,8 +2455,8 @@ function requireLib () {
|
|
|
2387
2455
|
}
|
|
2388
2456
|
return x;
|
|
2389
2457
|
};
|
|
2390
|
-
exports
|
|
2391
|
-
const S = exports
|
|
2458
|
+
exports.USVString = (value, options = {}) => {
|
|
2459
|
+
const S = exports.DOMString(value, options);
|
|
2392
2460
|
const n = S.length;
|
|
2393
2461
|
const U = [];
|
|
2394
2462
|
for (let i = 0; i < n; ++i) {
|
|
@@ -2413,7 +2481,7 @@ function requireLib () {
|
|
|
2413
2481
|
}
|
|
2414
2482
|
return U.join("");
|
|
2415
2483
|
};
|
|
2416
|
-
exports
|
|
2484
|
+
exports.object = (value, options = {}) => {
|
|
2417
2485
|
if (value === null || typeof value !== "object" && typeof value !== "function") {
|
|
2418
2486
|
throw makeException(TypeError, "is not an object", options);
|
|
2419
2487
|
}
|
|
@@ -2448,7 +2516,7 @@ function requireLib () {
|
|
|
2448
2516
|
return true;
|
|
2449
2517
|
}
|
|
2450
2518
|
}
|
|
2451
|
-
exports
|
|
2519
|
+
exports.ArrayBuffer = (value, options = {}) => {
|
|
2452
2520
|
if (!isNonSharedArrayBuffer(value)) {
|
|
2453
2521
|
if (options.allowShared && !isSharedArrayBuffer(value)) {
|
|
2454
2522
|
throw makeException(TypeError, "is not an ArrayBuffer or SharedArrayBuffer", options);
|
|
@@ -2461,7 +2529,7 @@ function requireLib () {
|
|
|
2461
2529
|
return value;
|
|
2462
2530
|
};
|
|
2463
2531
|
const dvByteLengthGetter = Object.getOwnPropertyDescriptor(DataView.prototype, "byteLength").get;
|
|
2464
|
-
exports
|
|
2532
|
+
exports.DataView = (value, options = {}) => {
|
|
2465
2533
|
try {
|
|
2466
2534
|
dvByteLengthGetter.call(value);
|
|
2467
2535
|
} catch (e) {
|
|
@@ -2486,7 +2554,7 @@ function requireLib () {
|
|
|
2486
2554
|
name
|
|
2487
2555
|
} = func;
|
|
2488
2556
|
const article = /^[AEIOU]/u.test(name) ? "an" : "a";
|
|
2489
|
-
exports
|
|
2557
|
+
exports[name] = (value, options = {}) => {
|
|
2490
2558
|
if (!ArrayBuffer.isView(value) || typedArrayNameGetter.call(value) !== name) {
|
|
2491
2559
|
throw makeException(TypeError, `is not ${article} ${name} object`, options);
|
|
2492
2560
|
}
|
|
@@ -2502,7 +2570,7 @@ function requireLib () {
|
|
|
2502
2570
|
|
|
2503
2571
|
// Common definitions
|
|
2504
2572
|
|
|
2505
|
-
exports
|
|
2573
|
+
exports.ArrayBufferView = (value, options = {}) => {
|
|
2506
2574
|
if (!ArrayBuffer.isView(value)) {
|
|
2507
2575
|
throw makeException(TypeError, "is not a view on an ArrayBuffer or SharedArrayBuffer", options);
|
|
2508
2576
|
}
|
|
@@ -2514,7 +2582,7 @@ function requireLib () {
|
|
|
2514
2582
|
}
|
|
2515
2583
|
return value;
|
|
2516
2584
|
};
|
|
2517
|
-
exports
|
|
2585
|
+
exports.BufferSource = (value, options = {}) => {
|
|
2518
2586
|
if (ArrayBuffer.isView(value)) {
|
|
2519
2587
|
if (!options.allowShared && isSharedArrayBuffer(value.buffer)) {
|
|
2520
2588
|
throw makeException(TypeError, "is a view on a SharedArrayBuffer, which is not allowed", options);
|
|
@@ -2535,7 +2603,7 @@ function requireLib () {
|
|
|
2535
2603
|
}
|
|
2536
2604
|
return value;
|
|
2537
2605
|
};
|
|
2538
|
-
exports
|
|
2606
|
+
exports.DOMTimeStamp = exports["unsigned long long"];
|
|
2539
2607
|
} (lib));
|
|
2540
2608
|
return lib;
|
|
2541
2609
|
}
|
|
@@ -2547,7 +2615,7 @@ var hasRequiredUtils$1;
|
|
|
2547
2615
|
function requireUtils$1 () {
|
|
2548
2616
|
if (hasRequiredUtils$1) return utils$1.exports;
|
|
2549
2617
|
hasRequiredUtils$1 = 1;
|
|
2550
|
-
(function (module, exports
|
|
2618
|
+
(function (module, exports) {
|
|
2551
2619
|
|
|
2552
2620
|
// Returns "Type(value) is Object" in ES terminology.
|
|
2553
2621
|
function isObject(value) {
|
|
@@ -53686,7 +53754,7 @@ var hasRequiredURLSearchParams;
|
|
|
53686
53754
|
function requireURLSearchParams () {
|
|
53687
53755
|
if (hasRequiredURLSearchParams) return URLSearchParams;
|
|
53688
53756
|
hasRequiredURLSearchParams = 1;
|
|
53689
|
-
(function (exports
|
|
53757
|
+
(function (exports) {
|
|
53690
53758
|
|
|
53691
53759
|
const conversions = requireLib();
|
|
53692
53760
|
const utils = requireUtils$1();
|
|
@@ -53695,21 +53763,21 @@ function requireURLSearchParams () {
|
|
|
53695
53763
|
const implSymbol = utils.implSymbol;
|
|
53696
53764
|
const ctorRegistrySymbol = utils.ctorRegistrySymbol;
|
|
53697
53765
|
const interfaceName = "URLSearchParams";
|
|
53698
|
-
exports
|
|
53766
|
+
exports.is = value => {
|
|
53699
53767
|
return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation;
|
|
53700
53768
|
};
|
|
53701
|
-
exports
|
|
53769
|
+
exports.isImpl = value => {
|
|
53702
53770
|
return utils.isObject(value) && value instanceof Impl.implementation;
|
|
53703
53771
|
};
|
|
53704
|
-
exports
|
|
53772
|
+
exports.convert = (globalObject, value, {
|
|
53705
53773
|
context = "The provided value"
|
|
53706
53774
|
} = {}) => {
|
|
53707
|
-
if (exports
|
|
53775
|
+
if (exports.is(value)) {
|
|
53708
53776
|
return utils.implForWrapper(value);
|
|
53709
53777
|
}
|
|
53710
53778
|
throw new globalObject.TypeError(`${context} is not of type 'URLSearchParams'.`);
|
|
53711
53779
|
};
|
|
53712
|
-
exports
|
|
53780
|
+
exports.createDefaultIterator = (globalObject, target, kind) => {
|
|
53713
53781
|
const ctorRegistry = globalObject[ctorRegistrySymbol];
|
|
53714
53782
|
const iteratorPrototype = ctorRegistry["URLSearchParams Iterator"];
|
|
53715
53783
|
const iterator = Object.create(iteratorPrototype);
|
|
@@ -53733,18 +53801,18 @@ function requireURLSearchParams () {
|
|
|
53733
53801
|
}
|
|
53734
53802
|
return Object.create(proto);
|
|
53735
53803
|
}
|
|
53736
|
-
exports
|
|
53804
|
+
exports.create = (globalObject, constructorArgs, privateData) => {
|
|
53737
53805
|
const wrapper = makeWrapper(globalObject);
|
|
53738
|
-
return exports
|
|
53806
|
+
return exports.setup(wrapper, globalObject, constructorArgs, privateData);
|
|
53739
53807
|
};
|
|
53740
|
-
exports
|
|
53741
|
-
const wrapper = exports
|
|
53808
|
+
exports.createImpl = (globalObject, constructorArgs, privateData) => {
|
|
53809
|
+
const wrapper = exports.create(globalObject, constructorArgs, privateData);
|
|
53742
53810
|
return utils.implForWrapper(wrapper);
|
|
53743
53811
|
};
|
|
53744
|
-
exports
|
|
53745
|
-
exports
|
|
53812
|
+
exports._internalSetup = (wrapper, globalObject) => {};
|
|
53813
|
+
exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => {
|
|
53746
53814
|
privateData.wrapper = wrapper;
|
|
53747
|
-
exports
|
|
53815
|
+
exports._internalSetup(wrapper, globalObject);
|
|
53748
53816
|
Object.defineProperty(wrapper, implSymbol, {
|
|
53749
53817
|
value: new Impl.implementation(globalObject, constructorArgs, privateData),
|
|
53750
53818
|
configurable: true
|
|
@@ -53755,9 +53823,9 @@ function requireURLSearchParams () {
|
|
|
53755
53823
|
}
|
|
53756
53824
|
return wrapper;
|
|
53757
53825
|
};
|
|
53758
|
-
exports
|
|
53826
|
+
exports.new = (globalObject, newTarget) => {
|
|
53759
53827
|
const wrapper = makeWrapper(globalObject, newTarget);
|
|
53760
|
-
exports
|
|
53828
|
+
exports._internalSetup(wrapper, globalObject);
|
|
53761
53829
|
Object.defineProperty(wrapper, implSymbol, {
|
|
53762
53830
|
value: Object.create(Impl.implementation.prototype),
|
|
53763
53831
|
configurable: true
|
|
@@ -53769,7 +53837,7 @@ function requireURLSearchParams () {
|
|
|
53769
53837
|
return wrapper[implSymbol];
|
|
53770
53838
|
};
|
|
53771
53839
|
const exposed = new Set(["Window", "Worker"]);
|
|
53772
|
-
exports
|
|
53840
|
+
exports.install = (globalObject, globalNames) => {
|
|
53773
53841
|
if (!globalNames.some(globalName => exposed.has(globalName))) {
|
|
53774
53842
|
return;
|
|
53775
53843
|
}
|
|
@@ -53841,11 +53909,11 @@ function requireURLSearchParams () {
|
|
|
53841
53909
|
}
|
|
53842
53910
|
args.push(curArg);
|
|
53843
53911
|
}
|
|
53844
|
-
return exports
|
|
53912
|
+
return exports.setup(Object.create(new.target.prototype), globalObject, args);
|
|
53845
53913
|
}
|
|
53846
53914
|
append(name, value) {
|
|
53847
53915
|
const esValue = this !== null && this !== undefined ? this : globalObject;
|
|
53848
|
-
if (!exports
|
|
53916
|
+
if (!exports.is(esValue)) {
|
|
53849
53917
|
throw new globalObject.TypeError("'append' called on an object that is not a valid instance of URLSearchParams.");
|
|
53850
53918
|
}
|
|
53851
53919
|
if (arguments.length < 2) {
|
|
@@ -53872,7 +53940,7 @@ function requireURLSearchParams () {
|
|
|
53872
53940
|
}
|
|
53873
53941
|
delete(name) {
|
|
53874
53942
|
const esValue = this !== null && this !== undefined ? this : globalObject;
|
|
53875
|
-
if (!exports
|
|
53943
|
+
if (!exports.is(esValue)) {
|
|
53876
53944
|
throw new globalObject.TypeError("'delete' called on an object that is not a valid instance of URLSearchParams.");
|
|
53877
53945
|
}
|
|
53878
53946
|
if (arguments.length < 1) {
|
|
@@ -53901,7 +53969,7 @@ function requireURLSearchParams () {
|
|
|
53901
53969
|
}
|
|
53902
53970
|
get(name) {
|
|
53903
53971
|
const esValue = this !== null && this !== undefined ? this : globalObject;
|
|
53904
|
-
if (!exports
|
|
53972
|
+
if (!exports.is(esValue)) {
|
|
53905
53973
|
throw new globalObject.TypeError("'get' called on an object that is not a valid instance of URLSearchParams.");
|
|
53906
53974
|
}
|
|
53907
53975
|
if (arguments.length < 1) {
|
|
@@ -53920,7 +53988,7 @@ function requireURLSearchParams () {
|
|
|
53920
53988
|
}
|
|
53921
53989
|
getAll(name) {
|
|
53922
53990
|
const esValue = this !== null && this !== undefined ? this : globalObject;
|
|
53923
|
-
if (!exports
|
|
53991
|
+
if (!exports.is(esValue)) {
|
|
53924
53992
|
throw new globalObject.TypeError("'getAll' called on an object that is not a valid instance of URLSearchParams.");
|
|
53925
53993
|
}
|
|
53926
53994
|
if (arguments.length < 1) {
|
|
@@ -53939,7 +54007,7 @@ function requireURLSearchParams () {
|
|
|
53939
54007
|
}
|
|
53940
54008
|
has(name) {
|
|
53941
54009
|
const esValue = this !== null && this !== undefined ? this : globalObject;
|
|
53942
|
-
if (!exports
|
|
54010
|
+
if (!exports.is(esValue)) {
|
|
53943
54011
|
throw new globalObject.TypeError("'has' called on an object that is not a valid instance of URLSearchParams.");
|
|
53944
54012
|
}
|
|
53945
54013
|
if (arguments.length < 1) {
|
|
@@ -53968,7 +54036,7 @@ function requireURLSearchParams () {
|
|
|
53968
54036
|
}
|
|
53969
54037
|
set(name, value) {
|
|
53970
54038
|
const esValue = this !== null && this !== undefined ? this : globalObject;
|
|
53971
|
-
if (!exports
|
|
54039
|
+
if (!exports.is(esValue)) {
|
|
53972
54040
|
throw new globalObject.TypeError("'set' called on an object that is not a valid instance of URLSearchParams.");
|
|
53973
54041
|
}
|
|
53974
54042
|
if (arguments.length < 2) {
|
|
@@ -53995,38 +54063,38 @@ function requireURLSearchParams () {
|
|
|
53995
54063
|
}
|
|
53996
54064
|
sort() {
|
|
53997
54065
|
const esValue = this !== null && this !== undefined ? this : globalObject;
|
|
53998
|
-
if (!exports
|
|
54066
|
+
if (!exports.is(esValue)) {
|
|
53999
54067
|
throw new globalObject.TypeError("'sort' called on an object that is not a valid instance of URLSearchParams.");
|
|
54000
54068
|
}
|
|
54001
54069
|
return utils.tryWrapperForImpl(esValue[implSymbol].sort());
|
|
54002
54070
|
}
|
|
54003
54071
|
toString() {
|
|
54004
54072
|
const esValue = this !== null && this !== undefined ? this : globalObject;
|
|
54005
|
-
if (!exports
|
|
54073
|
+
if (!exports.is(esValue)) {
|
|
54006
54074
|
throw new globalObject.TypeError("'toString' called on an object that is not a valid instance of URLSearchParams.");
|
|
54007
54075
|
}
|
|
54008
54076
|
return esValue[implSymbol].toString();
|
|
54009
54077
|
}
|
|
54010
54078
|
keys() {
|
|
54011
|
-
if (!exports
|
|
54079
|
+
if (!exports.is(this)) {
|
|
54012
54080
|
throw new globalObject.TypeError("'keys' called on an object that is not a valid instance of URLSearchParams.");
|
|
54013
54081
|
}
|
|
54014
|
-
return exports
|
|
54082
|
+
return exports.createDefaultIterator(globalObject, this, "key");
|
|
54015
54083
|
}
|
|
54016
54084
|
values() {
|
|
54017
|
-
if (!exports
|
|
54085
|
+
if (!exports.is(this)) {
|
|
54018
54086
|
throw new globalObject.TypeError("'values' called on an object that is not a valid instance of URLSearchParams.");
|
|
54019
54087
|
}
|
|
54020
|
-
return exports
|
|
54088
|
+
return exports.createDefaultIterator(globalObject, this, "value");
|
|
54021
54089
|
}
|
|
54022
54090
|
entries() {
|
|
54023
|
-
if (!exports
|
|
54091
|
+
if (!exports.is(this)) {
|
|
54024
54092
|
throw new globalObject.TypeError("'entries' called on an object that is not a valid instance of URLSearchParams.");
|
|
54025
54093
|
}
|
|
54026
|
-
return exports
|
|
54094
|
+
return exports.createDefaultIterator(globalObject, this, "key+value");
|
|
54027
54095
|
}
|
|
54028
54096
|
forEach(callback) {
|
|
54029
|
-
if (!exports
|
|
54097
|
+
if (!exports.is(this)) {
|
|
54030
54098
|
throw new globalObject.TypeError("'forEach' called on an object that is not a valid instance of URLSearchParams.");
|
|
54031
54099
|
}
|
|
54032
54100
|
if (arguments.length < 1) {
|
|
@@ -54047,7 +54115,7 @@ function requireURLSearchParams () {
|
|
|
54047
54115
|
}
|
|
54048
54116
|
get size() {
|
|
54049
54117
|
const esValue = this !== null && this !== undefined ? this : globalObject;
|
|
54050
|
-
if (!exports
|
|
54118
|
+
if (!exports.is(esValue)) {
|
|
54051
54119
|
throw new globalObject.TypeError("'get size' called on an object that is not a valid instance of URLSearchParams.");
|
|
54052
54120
|
}
|
|
54053
54121
|
return esValue[implSymbol]["size"];
|
|
@@ -54371,23 +54439,23 @@ var hasRequiredURL;
|
|
|
54371
54439
|
function requireURL () {
|
|
54372
54440
|
if (hasRequiredURL) return URL$2;
|
|
54373
54441
|
hasRequiredURL = 1;
|
|
54374
|
-
(function (exports
|
|
54442
|
+
(function (exports) {
|
|
54375
54443
|
|
|
54376
54444
|
const conversions = requireLib();
|
|
54377
54445
|
const utils = requireUtils$1();
|
|
54378
54446
|
const implSymbol = utils.implSymbol;
|
|
54379
54447
|
const ctorRegistrySymbol = utils.ctorRegistrySymbol;
|
|
54380
54448
|
const interfaceName = "URL";
|
|
54381
|
-
exports
|
|
54449
|
+
exports.is = value => {
|
|
54382
54450
|
return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation;
|
|
54383
54451
|
};
|
|
54384
|
-
exports
|
|
54452
|
+
exports.isImpl = value => {
|
|
54385
54453
|
return utils.isObject(value) && value instanceof Impl.implementation;
|
|
54386
54454
|
};
|
|
54387
|
-
exports
|
|
54455
|
+
exports.convert = (globalObject, value, {
|
|
54388
54456
|
context = "The provided value"
|
|
54389
54457
|
} = {}) => {
|
|
54390
|
-
if (exports
|
|
54458
|
+
if (exports.is(value)) {
|
|
54391
54459
|
return utils.implForWrapper(value);
|
|
54392
54460
|
}
|
|
54393
54461
|
throw new globalObject.TypeError(`${context} is not of type 'URL'.`);
|
|
@@ -54402,18 +54470,18 @@ function requireURL () {
|
|
|
54402
54470
|
}
|
|
54403
54471
|
return Object.create(proto);
|
|
54404
54472
|
}
|
|
54405
|
-
exports
|
|
54473
|
+
exports.create = (globalObject, constructorArgs, privateData) => {
|
|
54406
54474
|
const wrapper = makeWrapper(globalObject);
|
|
54407
|
-
return exports
|
|
54475
|
+
return exports.setup(wrapper, globalObject, constructorArgs, privateData);
|
|
54408
54476
|
};
|
|
54409
|
-
exports
|
|
54410
|
-
const wrapper = exports
|
|
54477
|
+
exports.createImpl = (globalObject, constructorArgs, privateData) => {
|
|
54478
|
+
const wrapper = exports.create(globalObject, constructorArgs, privateData);
|
|
54411
54479
|
return utils.implForWrapper(wrapper);
|
|
54412
54480
|
};
|
|
54413
|
-
exports
|
|
54414
|
-
exports
|
|
54481
|
+
exports._internalSetup = (wrapper, globalObject) => {};
|
|
54482
|
+
exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => {
|
|
54415
54483
|
privateData.wrapper = wrapper;
|
|
54416
|
-
exports
|
|
54484
|
+
exports._internalSetup(wrapper, globalObject);
|
|
54417
54485
|
Object.defineProperty(wrapper, implSymbol, {
|
|
54418
54486
|
value: new Impl.implementation(globalObject, constructorArgs, privateData),
|
|
54419
54487
|
configurable: true
|
|
@@ -54424,9 +54492,9 @@ function requireURL () {
|
|
|
54424
54492
|
}
|
|
54425
54493
|
return wrapper;
|
|
54426
54494
|
};
|
|
54427
|
-
exports
|
|
54495
|
+
exports.new = (globalObject, newTarget) => {
|
|
54428
54496
|
const wrapper = makeWrapper(globalObject, newTarget);
|
|
54429
|
-
exports
|
|
54497
|
+
exports._internalSetup(wrapper, globalObject);
|
|
54430
54498
|
Object.defineProperty(wrapper, implSymbol, {
|
|
54431
54499
|
value: Object.create(Impl.implementation.prototype),
|
|
54432
54500
|
configurable: true
|
|
@@ -54438,7 +54506,7 @@ function requireURL () {
|
|
|
54438
54506
|
return wrapper[implSymbol];
|
|
54439
54507
|
};
|
|
54440
54508
|
const exposed = new Set(["Window", "Worker"]);
|
|
54441
|
-
exports
|
|
54509
|
+
exports.install = (globalObject, globalNames) => {
|
|
54442
54510
|
if (!globalNames.some(globalName => exposed.has(globalName))) {
|
|
54443
54511
|
return;
|
|
54444
54512
|
}
|
|
@@ -54467,25 +54535,25 @@ function requireURL () {
|
|
|
54467
54535
|
}
|
|
54468
54536
|
args.push(curArg);
|
|
54469
54537
|
}
|
|
54470
|
-
return exports
|
|
54538
|
+
return exports.setup(Object.create(new.target.prototype), globalObject, args);
|
|
54471
54539
|
}
|
|
54472
54540
|
toJSON() {
|
|
54473
54541
|
const esValue = this !== null && this !== undefined ? this : globalObject;
|
|
54474
|
-
if (!exports
|
|
54542
|
+
if (!exports.is(esValue)) {
|
|
54475
54543
|
throw new globalObject.TypeError("'toJSON' called on an object that is not a valid instance of URL.");
|
|
54476
54544
|
}
|
|
54477
54545
|
return esValue[implSymbol].toJSON();
|
|
54478
54546
|
}
|
|
54479
54547
|
get href() {
|
|
54480
54548
|
const esValue = this !== null && this !== undefined ? this : globalObject;
|
|
54481
|
-
if (!exports
|
|
54549
|
+
if (!exports.is(esValue)) {
|
|
54482
54550
|
throw new globalObject.TypeError("'get href' called on an object that is not a valid instance of URL.");
|
|
54483
54551
|
}
|
|
54484
54552
|
return esValue[implSymbol]["href"];
|
|
54485
54553
|
}
|
|
54486
54554
|
set href(V) {
|
|
54487
54555
|
const esValue = this !== null && this !== undefined ? this : globalObject;
|
|
54488
|
-
if (!exports
|
|
54556
|
+
if (!exports.is(esValue)) {
|
|
54489
54557
|
throw new globalObject.TypeError("'set href' called on an object that is not a valid instance of URL.");
|
|
54490
54558
|
}
|
|
54491
54559
|
V = conversions["USVString"](V, {
|
|
@@ -54496,28 +54564,28 @@ function requireURL () {
|
|
|
54496
54564
|
}
|
|
54497
54565
|
toString() {
|
|
54498
54566
|
const esValue = this;
|
|
54499
|
-
if (!exports
|
|
54567
|
+
if (!exports.is(esValue)) {
|
|
54500
54568
|
throw new globalObject.TypeError("'toString' called on an object that is not a valid instance of URL.");
|
|
54501
54569
|
}
|
|
54502
54570
|
return esValue[implSymbol]["href"];
|
|
54503
54571
|
}
|
|
54504
54572
|
get origin() {
|
|
54505
54573
|
const esValue = this !== null && this !== undefined ? this : globalObject;
|
|
54506
|
-
if (!exports
|
|
54574
|
+
if (!exports.is(esValue)) {
|
|
54507
54575
|
throw new globalObject.TypeError("'get origin' called on an object that is not a valid instance of URL.");
|
|
54508
54576
|
}
|
|
54509
54577
|
return esValue[implSymbol]["origin"];
|
|
54510
54578
|
}
|
|
54511
54579
|
get protocol() {
|
|
54512
54580
|
const esValue = this !== null && this !== undefined ? this : globalObject;
|
|
54513
|
-
if (!exports
|
|
54581
|
+
if (!exports.is(esValue)) {
|
|
54514
54582
|
throw new globalObject.TypeError("'get protocol' called on an object that is not a valid instance of URL.");
|
|
54515
54583
|
}
|
|
54516
54584
|
return esValue[implSymbol]["protocol"];
|
|
54517
54585
|
}
|
|
54518
54586
|
set protocol(V) {
|
|
54519
54587
|
const esValue = this !== null && this !== undefined ? this : globalObject;
|
|
54520
|
-
if (!exports
|
|
54588
|
+
if (!exports.is(esValue)) {
|
|
54521
54589
|
throw new globalObject.TypeError("'set protocol' called on an object that is not a valid instance of URL.");
|
|
54522
54590
|
}
|
|
54523
54591
|
V = conversions["USVString"](V, {
|
|
@@ -54528,14 +54596,14 @@ function requireURL () {
|
|
|
54528
54596
|
}
|
|
54529
54597
|
get username() {
|
|
54530
54598
|
const esValue = this !== null && this !== undefined ? this : globalObject;
|
|
54531
|
-
if (!exports
|
|
54599
|
+
if (!exports.is(esValue)) {
|
|
54532
54600
|
throw new globalObject.TypeError("'get username' called on an object that is not a valid instance of URL.");
|
|
54533
54601
|
}
|
|
54534
54602
|
return esValue[implSymbol]["username"];
|
|
54535
54603
|
}
|
|
54536
54604
|
set username(V) {
|
|
54537
54605
|
const esValue = this !== null && this !== undefined ? this : globalObject;
|
|
54538
|
-
if (!exports
|
|
54606
|
+
if (!exports.is(esValue)) {
|
|
54539
54607
|
throw new globalObject.TypeError("'set username' called on an object that is not a valid instance of URL.");
|
|
54540
54608
|
}
|
|
54541
54609
|
V = conversions["USVString"](V, {
|
|
@@ -54546,14 +54614,14 @@ function requireURL () {
|
|
|
54546
54614
|
}
|
|
54547
54615
|
get password() {
|
|
54548
54616
|
const esValue = this !== null && this !== undefined ? this : globalObject;
|
|
54549
|
-
if (!exports
|
|
54617
|
+
if (!exports.is(esValue)) {
|
|
54550
54618
|
throw new globalObject.TypeError("'get password' called on an object that is not a valid instance of URL.");
|
|
54551
54619
|
}
|
|
54552
54620
|
return esValue[implSymbol]["password"];
|
|
54553
54621
|
}
|
|
54554
54622
|
set password(V) {
|
|
54555
54623
|
const esValue = this !== null && this !== undefined ? this : globalObject;
|
|
54556
|
-
if (!exports
|
|
54624
|
+
if (!exports.is(esValue)) {
|
|
54557
54625
|
throw new globalObject.TypeError("'set password' called on an object that is not a valid instance of URL.");
|
|
54558
54626
|
}
|
|
54559
54627
|
V = conversions["USVString"](V, {
|
|
@@ -54564,14 +54632,14 @@ function requireURL () {
|
|
|
54564
54632
|
}
|
|
54565
54633
|
get host() {
|
|
54566
54634
|
const esValue = this !== null && this !== undefined ? this : globalObject;
|
|
54567
|
-
if (!exports
|
|
54635
|
+
if (!exports.is(esValue)) {
|
|
54568
54636
|
throw new globalObject.TypeError("'get host' called on an object that is not a valid instance of URL.");
|
|
54569
54637
|
}
|
|
54570
54638
|
return esValue[implSymbol]["host"];
|
|
54571
54639
|
}
|
|
54572
54640
|
set host(V) {
|
|
54573
54641
|
const esValue = this !== null && this !== undefined ? this : globalObject;
|
|
54574
|
-
if (!exports
|
|
54642
|
+
if (!exports.is(esValue)) {
|
|
54575
54643
|
throw new globalObject.TypeError("'set host' called on an object that is not a valid instance of URL.");
|
|
54576
54644
|
}
|
|
54577
54645
|
V = conversions["USVString"](V, {
|
|
@@ -54582,14 +54650,14 @@ function requireURL () {
|
|
|
54582
54650
|
}
|
|
54583
54651
|
get hostname() {
|
|
54584
54652
|
const esValue = this !== null && this !== undefined ? this : globalObject;
|
|
54585
|
-
if (!exports
|
|
54653
|
+
if (!exports.is(esValue)) {
|
|
54586
54654
|
throw new globalObject.TypeError("'get hostname' called on an object that is not a valid instance of URL.");
|
|
54587
54655
|
}
|
|
54588
54656
|
return esValue[implSymbol]["hostname"];
|
|
54589
54657
|
}
|
|
54590
54658
|
set hostname(V) {
|
|
54591
54659
|
const esValue = this !== null && this !== undefined ? this : globalObject;
|
|
54592
|
-
if (!exports
|
|
54660
|
+
if (!exports.is(esValue)) {
|
|
54593
54661
|
throw new globalObject.TypeError("'set hostname' called on an object that is not a valid instance of URL.");
|
|
54594
54662
|
}
|
|
54595
54663
|
V = conversions["USVString"](V, {
|
|
@@ -54600,14 +54668,14 @@ function requireURL () {
|
|
|
54600
54668
|
}
|
|
54601
54669
|
get port() {
|
|
54602
54670
|
const esValue = this !== null && this !== undefined ? this : globalObject;
|
|
54603
|
-
if (!exports
|
|
54671
|
+
if (!exports.is(esValue)) {
|
|
54604
54672
|
throw new globalObject.TypeError("'get port' called on an object that is not a valid instance of URL.");
|
|
54605
54673
|
}
|
|
54606
54674
|
return esValue[implSymbol]["port"];
|
|
54607
54675
|
}
|
|
54608
54676
|
set port(V) {
|
|
54609
54677
|
const esValue = this !== null && this !== undefined ? this : globalObject;
|
|
54610
|
-
if (!exports
|
|
54678
|
+
if (!exports.is(esValue)) {
|
|
54611
54679
|
throw new globalObject.TypeError("'set port' called on an object that is not a valid instance of URL.");
|
|
54612
54680
|
}
|
|
54613
54681
|
V = conversions["USVString"](V, {
|
|
@@ -54618,14 +54686,14 @@ function requireURL () {
|
|
|
54618
54686
|
}
|
|
54619
54687
|
get pathname() {
|
|
54620
54688
|
const esValue = this !== null && this !== undefined ? this : globalObject;
|
|
54621
|
-
if (!exports
|
|
54689
|
+
if (!exports.is(esValue)) {
|
|
54622
54690
|
throw new globalObject.TypeError("'get pathname' called on an object that is not a valid instance of URL.");
|
|
54623
54691
|
}
|
|
54624
54692
|
return esValue[implSymbol]["pathname"];
|
|
54625
54693
|
}
|
|
54626
54694
|
set pathname(V) {
|
|
54627
54695
|
const esValue = this !== null && this !== undefined ? this : globalObject;
|
|
54628
|
-
if (!exports
|
|
54696
|
+
if (!exports.is(esValue)) {
|
|
54629
54697
|
throw new globalObject.TypeError("'set pathname' called on an object that is not a valid instance of URL.");
|
|
54630
54698
|
}
|
|
54631
54699
|
V = conversions["USVString"](V, {
|
|
@@ -54636,14 +54704,14 @@ function requireURL () {
|
|
|
54636
54704
|
}
|
|
54637
54705
|
get search() {
|
|
54638
54706
|
const esValue = this !== null && this !== undefined ? this : globalObject;
|
|
54639
|
-
if (!exports
|
|
54707
|
+
if (!exports.is(esValue)) {
|
|
54640
54708
|
throw new globalObject.TypeError("'get search' called on an object that is not a valid instance of URL.");
|
|
54641
54709
|
}
|
|
54642
54710
|
return esValue[implSymbol]["search"];
|
|
54643
54711
|
}
|
|
54644
54712
|
set search(V) {
|
|
54645
54713
|
const esValue = this !== null && this !== undefined ? this : globalObject;
|
|
54646
|
-
if (!exports
|
|
54714
|
+
if (!exports.is(esValue)) {
|
|
54647
54715
|
throw new globalObject.TypeError("'set search' called on an object that is not a valid instance of URL.");
|
|
54648
54716
|
}
|
|
54649
54717
|
V = conversions["USVString"](V, {
|
|
@@ -54654,7 +54722,7 @@ function requireURL () {
|
|
|
54654
54722
|
}
|
|
54655
54723
|
get searchParams() {
|
|
54656
54724
|
const esValue = this !== null && this !== undefined ? this : globalObject;
|
|
54657
|
-
if (!exports
|
|
54725
|
+
if (!exports.is(esValue)) {
|
|
54658
54726
|
throw new globalObject.TypeError("'get searchParams' called on an object that is not a valid instance of URL.");
|
|
54659
54727
|
}
|
|
54660
54728
|
return utils.getSameObject(this, "searchParams", () => {
|
|
@@ -54663,14 +54731,14 @@ function requireURL () {
|
|
|
54663
54731
|
}
|
|
54664
54732
|
get hash() {
|
|
54665
54733
|
const esValue = this !== null && this !== undefined ? this : globalObject;
|
|
54666
|
-
if (!exports
|
|
54734
|
+
if (!exports.is(esValue)) {
|
|
54667
54735
|
throw new globalObject.TypeError("'get hash' called on an object that is not a valid instance of URL.");
|
|
54668
54736
|
}
|
|
54669
54737
|
return esValue[implSymbol]["hash"];
|
|
54670
54738
|
}
|
|
54671
54739
|
set hash(V) {
|
|
54672
54740
|
const esValue = this !== null && this !== undefined ? this : globalObject;
|
|
54673
|
-
if (!exports
|
|
54741
|
+
if (!exports.is(esValue)) {
|
|
54674
54742
|
throw new globalObject.TypeError("'set hash' called on an object that is not a valid instance of URL.");
|
|
54675
54743
|
}
|
|
54676
54744
|
V = conversions["USVString"](V, {
|
|
@@ -89829,12 +89897,16 @@ const createLocalStorage = () => {
|
|
|
89829
89897
|
return localStorage;
|
|
89830
89898
|
};
|
|
89831
89899
|
|
|
89832
|
-
|
|
89900
|
+
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
|
|
89901
|
+
|
|
89902
|
+
const getGlobals = (window, width, height, devicePixelRatio = 1) => {
|
|
89833
89903
|
const localStorage = createLocalStorage();
|
|
89904
|
+
const getComputedStyle = window.getComputedStyle.bind(window);
|
|
89834
89905
|
return {
|
|
89835
89906
|
globalGlobals: {
|
|
89836
89907
|
alert: alert,
|
|
89837
89908
|
devicePixelRatio,
|
|
89909
|
+
getComputedStyle,
|
|
89838
89910
|
innerHeight: height,
|
|
89839
89911
|
innerWidth: width,
|
|
89840
89912
|
localStorage
|
|
@@ -89842,6 +89914,7 @@ const getGlobals = (width, height, devicePixelRatio = 1) => {
|
|
|
89842
89914
|
windowGlobals: {
|
|
89843
89915
|
alert: alert,
|
|
89844
89916
|
devicePixelRatio,
|
|
89917
|
+
getComputedStyle,
|
|
89845
89918
|
innerHeight: height,
|
|
89846
89919
|
innerWidth: width
|
|
89847
89920
|
}
|
|
@@ -89938,6 +90011,10 @@ const getTopLevelFunctionNames = script => {
|
|
|
89938
90011
|
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
|
|
89939
90012
|
|
|
89940
90013
|
const setGlobals = (window, globalGlobals, windowGlobals) => {
|
|
90014
|
+
const globalScope = globalThis;
|
|
90015
|
+
globalScope.addEventListener = window.addEventListener.bind(window);
|
|
90016
|
+
globalScope.removeEventListener = window.removeEventListener.bind(window);
|
|
90017
|
+
globalScope.dispatchEvent = window.dispatchEvent.bind(window);
|
|
89941
90018
|
for (const [key, value] of Object.entries(globalGlobals)) {
|
|
89942
90019
|
// @ts-ignore
|
|
89943
90020
|
globalThis[key] = value;
|
|
@@ -89956,7 +90033,7 @@ const executeScripts = (window, document, scripts, width = 0, height = 0, device
|
|
|
89956
90033
|
const {
|
|
89957
90034
|
globalGlobals,
|
|
89958
90035
|
windowGlobals
|
|
89959
|
-
} = getGlobals(width, height, devicePixelRatio);
|
|
90036
|
+
} = getGlobals(window, width, height, devicePixelRatio);
|
|
89960
90037
|
setGlobals(window, globalGlobals, windowGlobals);
|
|
89961
90038
|
let firstError = null;
|
|
89962
90039
|
let firstCodeFrame = '';
|
|
@@ -90011,6 +90088,9 @@ const getParsedNodesChildNodeCount = parsedDom => {
|
|
|
90011
90088
|
/* eslint-disable @typescript-eslint/no-floating-promises */
|
|
90012
90089
|
|
|
90013
90090
|
const observers = new Map();
|
|
90091
|
+
const isInternalMutation = records => {
|
|
90092
|
+
return records.length > 0 && records.every(record => record.type === 'attributes' && record.attributeName === 'data-id');
|
|
90093
|
+
};
|
|
90014
90094
|
const handleMutations = async uid => {
|
|
90015
90095
|
const happyDomInstance = get(uid);
|
|
90016
90096
|
if (!happyDomInstance) {
|
|
@@ -90036,7 +90116,10 @@ const observe = (uid, document, window) => {
|
|
|
90036
90116
|
if (existingObserver) {
|
|
90037
90117
|
existingObserver.disconnect();
|
|
90038
90118
|
}
|
|
90039
|
-
const observer = new window.MutationObserver(
|
|
90119
|
+
const observer = new window.MutationObserver(records => {
|
|
90120
|
+
if (isInternalMutation(records)) {
|
|
90121
|
+
return;
|
|
90122
|
+
}
|
|
90040
90123
|
handleMutations(uid);
|
|
90041
90124
|
});
|
|
90042
90125
|
observer.observe(document.documentElement, {
|
|
@@ -90068,6 +90151,12 @@ const toNumber = value => {
|
|
|
90068
90151
|
|
|
90069
90152
|
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
|
|
90070
90153
|
|
|
90154
|
+
const toCanvasRect = rect => {
|
|
90155
|
+
return {
|
|
90156
|
+
...rect,
|
|
90157
|
+
toJSON: () => rect
|
|
90158
|
+
};
|
|
90159
|
+
};
|
|
90071
90160
|
const reflectCanvasDimensionAttribute = (element, name, value) => {
|
|
90072
90161
|
element.setAttribute(name, String(value));
|
|
90073
90162
|
};
|
|
@@ -90160,28 +90249,20 @@ const patchCanvasElements = async (document, uid) => {
|
|
|
90160
90249
|
|
|
90161
90250
|
// @ts-ignore
|
|
90162
90251
|
element.getBoundingClientRect = () => {
|
|
90163
|
-
|
|
90252
|
+
const rect = getRect(uid, dataId);
|
|
90253
|
+
if (rect) {
|
|
90254
|
+
return toCanvasRect(rect);
|
|
90255
|
+
}
|
|
90256
|
+
return toCanvasRect({
|
|
90164
90257
|
bottom: heightValue,
|
|
90165
90258
|
height: heightValue,
|
|
90166
90259
|
left: 0,
|
|
90167
90260
|
right: widthValue,
|
|
90168
|
-
toJSON: () => {
|
|
90169
|
-
return {
|
|
90170
|
-
bottom: heightValue,
|
|
90171
|
-
height: heightValue,
|
|
90172
|
-
left: 0,
|
|
90173
|
-
right: widthValue,
|
|
90174
|
-
top: 0,
|
|
90175
|
-
width: widthValue,
|
|
90176
|
-
x: 0,
|
|
90177
|
-
y: 0
|
|
90178
|
-
};
|
|
90179
|
-
},
|
|
90180
90261
|
top: 0,
|
|
90181
90262
|
width: widthValue,
|
|
90182
90263
|
x: 0,
|
|
90183
90264
|
y: 0
|
|
90184
|
-
};
|
|
90265
|
+
});
|
|
90185
90266
|
};
|
|
90186
90267
|
instances.push({
|
|
90187
90268
|
dataId,
|
|
@@ -90196,6 +90277,85 @@ const patchCanvasElements = async (document, uid) => {
|
|
|
90196
90277
|
});
|
|
90197
90278
|
};
|
|
90198
90279
|
|
|
90280
|
+
const toRect = rect => {
|
|
90281
|
+
return {
|
|
90282
|
+
...rect,
|
|
90283
|
+
toJSON: () => rect
|
|
90284
|
+
};
|
|
90285
|
+
};
|
|
90286
|
+
const getCanvasDimension = (element, name) => {
|
|
90287
|
+
const value = Number(element[name]);
|
|
90288
|
+
if (Number.isFinite(value)) {
|
|
90289
|
+
return value;
|
|
90290
|
+
}
|
|
90291
|
+
const attributeValue = Number(element.getAttribute?.(name) || 0);
|
|
90292
|
+
if (Number.isFinite(attributeValue)) {
|
|
90293
|
+
return attributeValue;
|
|
90294
|
+
}
|
|
90295
|
+
return 0;
|
|
90296
|
+
};
|
|
90297
|
+
const getDirectCanvasChildRect = element => {
|
|
90298
|
+
const {
|
|
90299
|
+
children
|
|
90300
|
+
} = element;
|
|
90301
|
+
if (!children) {
|
|
90302
|
+
return undefined;
|
|
90303
|
+
}
|
|
90304
|
+
for (let i = 0; i < children.length; i++) {
|
|
90305
|
+
const child = children[i];
|
|
90306
|
+
const tagName = (child?.tagName || '').toLowerCase();
|
|
90307
|
+
if (tagName === 'canvas' && typeof child.getBoundingClientRect === 'function') {
|
|
90308
|
+
return toRect(child.getBoundingClientRect());
|
|
90309
|
+
}
|
|
90310
|
+
}
|
|
90311
|
+
return undefined;
|
|
90312
|
+
};
|
|
90313
|
+
const getFallbackRect = element => {
|
|
90314
|
+
const tagName = (element.tagName || '').toLowerCase();
|
|
90315
|
+
if (tagName === 'canvas') {
|
|
90316
|
+
const width = getCanvasDimension(element, 'width');
|
|
90317
|
+
const height = getCanvasDimension(element, 'height');
|
|
90318
|
+
return toRect({
|
|
90319
|
+
bottom: height,
|
|
90320
|
+
height,
|
|
90321
|
+
left: 0,
|
|
90322
|
+
right: width,
|
|
90323
|
+
top: 0,
|
|
90324
|
+
width,
|
|
90325
|
+
x: 0,
|
|
90326
|
+
y: 0
|
|
90327
|
+
});
|
|
90328
|
+
}
|
|
90329
|
+
const directCanvasChildRect = getDirectCanvasChildRect(element);
|
|
90330
|
+
if (directCanvasChildRect) {
|
|
90331
|
+
return directCanvasChildRect;
|
|
90332
|
+
}
|
|
90333
|
+
return toRect({
|
|
90334
|
+
bottom: 0,
|
|
90335
|
+
height: 0,
|
|
90336
|
+
left: 0,
|
|
90337
|
+
right: 0,
|
|
90338
|
+
top: 0,
|
|
90339
|
+
width: 0,
|
|
90340
|
+
x: 0,
|
|
90341
|
+
y: 0
|
|
90342
|
+
});
|
|
90343
|
+
};
|
|
90344
|
+
const patchElement = (uid, hdId, element) => {
|
|
90345
|
+
element.getBoundingClientRect = () => {
|
|
90346
|
+
const rect = getRect(uid, hdId);
|
|
90347
|
+
if (rect) {
|
|
90348
|
+
return toRect(rect);
|
|
90349
|
+
}
|
|
90350
|
+
return getFallbackRect(element);
|
|
90351
|
+
};
|
|
90352
|
+
};
|
|
90353
|
+
const patchElementGeometry = (uid, elementMap) => {
|
|
90354
|
+
for (const [hdId, element] of Object.entries(elementMap)) {
|
|
90355
|
+
patchElement(uid, hdId, element);
|
|
90356
|
+
}
|
|
90357
|
+
};
|
|
90358
|
+
|
|
90199
90359
|
const updateContent = async (uid, width, height, content, scripts) => {
|
|
90200
90360
|
try {
|
|
90201
90361
|
const {
|
|
@@ -90203,12 +90363,16 @@ const updateContent = async (uid, width, height, content, scripts) => {
|
|
|
90203
90363
|
window: happyDomWindow
|
|
90204
90364
|
} = createWindow(content);
|
|
90205
90365
|
await patchCanvasElements(happyDomDocument, uid);
|
|
90366
|
+
const initialElementMap = Object.create(null);
|
|
90367
|
+
serialize(happyDomDocument, initialElementMap);
|
|
90368
|
+
patchElementGeometry(uid, initialElementMap);
|
|
90206
90369
|
const {
|
|
90207
90370
|
codeFrame,
|
|
90208
90371
|
error
|
|
90209
90372
|
} = executeScripts(happyDomWindow, happyDomDocument, scripts, width, height);
|
|
90210
90373
|
const elementMap = Object.create(null);
|
|
90211
90374
|
serialize(happyDomDocument, elementMap);
|
|
90375
|
+
patchElementGeometry(uid, elementMap);
|
|
90212
90376
|
set$1(uid, {
|
|
90213
90377
|
document: happyDomDocument,
|
|
90214
90378
|
elementMap,
|
|
@@ -90279,6 +90443,7 @@ const commandMap = {
|
|
|
90279
90443
|
'SandBox.handlePointerup': handlePointerup,
|
|
90280
90444
|
'SandBox.loadContent': loadContent,
|
|
90281
90445
|
'SandBox.resize': resize,
|
|
90446
|
+
'SandBox.setGeometryBuffer': setGeometryBuffer,
|
|
90282
90447
|
'SandBox.terminate': terminate
|
|
90283
90448
|
};
|
|
90284
90449
|
|