libpag 4.5.1 → 4.5.3
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/LICENSE.txt +1589 -0
- package/README.md +172 -10
- package/README.zh_CN.md +114 -15
- package/lib/libpag.cjs.js +389 -887
- package/lib/libpag.cjs.js.map +1 -1
- package/lib/libpag.esm.js +389 -887
- package/lib/libpag.esm.js.map +1 -1
- package/lib/libpag.min.js +1 -1
- package/lib/libpag.min.js.map +1 -1
- package/lib/libpag.umd.js +389 -887
- package/lib/libpag.umd.js.map +1 -1
- package/lib/libpag.wasm +0 -0
- package/package.json +24 -12
- package/src/.pag.wasm-mt.md5 +1 -0
- package/src/.pag.wasm.md5 +1 -1
- package/src/core/matrix.ts +1 -2
- package/src/core/video-reader.ts +73 -94
- package/src/interfaces.ts +8 -17
- package/src/pag-composition.ts +12 -5
- package/src/pag-file.ts +146 -129
- package/src/pag-font.ts +1 -3
- package/src/pag-image-layer.ts +1 -2
- package/src/pag-image.ts +1 -3
- package/src/pag-layer.ts +2 -3
- package/src/pag-player.ts +7 -6
- package/src/pag-solid-layer.ts +1 -2
- package/src/pag-surface.ts +1 -2
- package/src/pag-text-layer.ts +1 -2
- package/src/pag-view.ts +3 -14
- package/src/pag.ts +0 -6
- package/src/types.ts +46 -3
- package/src/utils/decorators.ts +0 -42
- package/src/utils/type-utils.ts +1 -9
- package/src/utils/ua.ts +0 -1
- package/src/wasm/libpag.js +1 -1
- package/src/wasm/libpag.wasm +0 -0
- package/src/wasm-mt/libpag.js +5 -5
- package/src/wasm-mt/libpag.wasm +0 -0
- package/src/wechat/pag-file.ts +1 -2
- package/src/wechat/pag-image.ts +0 -2
- package/src/wechat/pag-view.ts +1 -2
- package/types/third_party/tgfx/web/src/core/path-rasterizer.d.ts +4 -0
- package/types/third_party/tgfx/web/src/core/scaler-context.d.ts +9 -2
- package/types/third_party/tgfx/web/src/utils/decorators.d.ts +0 -2
- package/types/web/src/core/video-reader.d.ts +4 -3
- package/types/web/src/interfaces.d.ts +8 -15
- package/types/web/src/pag-composition.d.ts +4 -4
- package/types/web/src/pag-file.d.ts +4 -4
- package/types/web/src/pag-layer.d.ts +1 -1
- package/types/web/src/pag-player.d.ts +2 -2
- package/types/web/src/pag-view.d.ts +1 -1
- package/types/web/src/types.d.ts +13 -4
- package/types/web/src/utils/decorators.d.ts +0 -2
- package/types/web/src/utils/ua.d.ts +0 -1
- package/types/web/tsconfig.json +19 -0
- package/lib/libpag.worker.cjs.js +0 -798
- package/lib/libpag.worker.cjs.js.map +0 -1
- package/lib/libpag.worker.esm.js +0 -793
- package/lib/libpag.worker.esm.js.map +0 -1
- package/lib/libpag.worker.js +0 -804
- package/lib/libpag.worker.js.map +0 -1
- package/lib/libpag.worker.min.js +0 -2
- package/lib/libpag.worker.min.js.map +0 -1
- package/src/worker/client.ts +0 -80
- package/src/worker/events.ts +0 -41
- package/src/worker/pag-file.ts +0 -90
- package/src/worker/pag-image.ts +0 -43
- package/src/worker/pag-view.ts +0 -171
- package/src/worker/utils.ts +0 -29
- package/src/worker/video-reader.ts +0 -62
- package/src/worker/worker.ts +0 -169
- package/types/third_party/tgfx/web/src/core/web-mask.d.ts +0 -26
- package/types/web/src/utils/canvas.d.ts +0 -4
- package/types/web/src/worker/client.d.ts +0 -16
- package/types/web/src/worker/events.d.ts +0 -32
- package/types/web/src/worker/pag-file.d.ts +0 -33
- package/types/web/src/worker/pag-image.d.ts +0 -8
- package/types/web/src/worker/pag-view.d.ts +0 -67
- package/types/web/src/worker/utils.d.ts +0 -7
- package/types/web/src/worker/video-reader.d.ts +0 -16
- package/types/web/src/worker/worker.d.ts +0 -13
package/lib/libpag.cjs.js
CHANGED
|
@@ -49,43 +49,6 @@ const setPAGModule = (module) => {
|
|
|
49
49
|
PAGModule = module;
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
-
function wasmAwaitRewind$1(constructor) {
|
|
53
|
-
const ignoreStaticFunctions = ["length", "name", "prototype", "wasmAsyncMethods"];
|
|
54
|
-
let staticFunctions = Object.getOwnPropertyNames(constructor).filter(
|
|
55
|
-
(name) => ignoreStaticFunctions.indexOf(name) === -1
|
|
56
|
-
);
|
|
57
|
-
if (constructor.wasmAsyncMethods && constructor.wasmAsyncMethods.length > 0) {
|
|
58
|
-
staticFunctions = staticFunctions.filter((name) => constructor.wasmAsyncMethods.indexOf(name) === -1);
|
|
59
|
-
}
|
|
60
|
-
let functions = Object.getOwnPropertyNames(constructor.prototype).filter(
|
|
61
|
-
(name) => name !== "constructor" && typeof constructor.prototype[name] === "function"
|
|
62
|
-
);
|
|
63
|
-
if (constructor.prototype.wasmAsyncMethods && constructor.prototype.wasmAsyncMethods.length > 0) {
|
|
64
|
-
functions = functions.filter((name) => constructor.prototype.wasmAsyncMethods.indexOf(name) === -1);
|
|
65
|
-
}
|
|
66
|
-
const proxyFn = (target, methodName) => {
|
|
67
|
-
const fn = target[methodName];
|
|
68
|
-
target[methodName] = function(...args) {
|
|
69
|
-
if (PAGModule.Asyncify.currData !== null) {
|
|
70
|
-
const currData = PAGModule.Asyncify.currData;
|
|
71
|
-
PAGModule.Asyncify.currData = null;
|
|
72
|
-
const ret = fn.call(this, ...args);
|
|
73
|
-
PAGModule.Asyncify.currData = currData;
|
|
74
|
-
return ret;
|
|
75
|
-
} else {
|
|
76
|
-
return fn.call(this, ...args);
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
};
|
|
80
|
-
staticFunctions.forEach((name) => proxyFn(constructor, name));
|
|
81
|
-
functions.forEach((name) => proxyFn(constructor.prototype, name));
|
|
82
|
-
}
|
|
83
|
-
function wasmAsyncMethod(target, propertyKey, descriptor) {
|
|
84
|
-
if (!target.wasmAsyncMethods) {
|
|
85
|
-
target.wasmAsyncMethods = [];
|
|
86
|
-
}
|
|
87
|
-
target.wasmAsyncMethods.push(propertyKey);
|
|
88
|
-
}
|
|
89
52
|
function destroyVerify$1(constructor) {
|
|
90
53
|
let functions = Object.getOwnPropertyNames(constructor.prototype).filter(
|
|
91
54
|
(name) => name !== "constructor" && typeof constructor.prototype[name] === "function"
|
|
@@ -183,6 +146,41 @@ var AlphaType = /* @__PURE__ */ ((AlphaType2) => {
|
|
|
183
146
|
AlphaType2[AlphaType2["Unpremultiplied"] = 3] = "Unpremultiplied";
|
|
184
147
|
return AlphaType2;
|
|
185
148
|
})(AlphaType || {});
|
|
149
|
+
class VecArray extends Array {
|
|
150
|
+
constructor(...items) {
|
|
151
|
+
super(...items);
|
|
152
|
+
this.isDeleted = false;
|
|
153
|
+
Object.setPrototypeOf(this, VecArray.prototype);
|
|
154
|
+
}
|
|
155
|
+
static create() {
|
|
156
|
+
return new VecArray();
|
|
157
|
+
}
|
|
158
|
+
get(index) {
|
|
159
|
+
this.ensureNotDeleted();
|
|
160
|
+
if (index < 0 || index >= this.length) {
|
|
161
|
+
throw new RangeError("Index out of bounds");
|
|
162
|
+
}
|
|
163
|
+
return this[index];
|
|
164
|
+
}
|
|
165
|
+
push_back(value) {
|
|
166
|
+
this.ensureNotDeleted();
|
|
167
|
+
this.push(value);
|
|
168
|
+
}
|
|
169
|
+
size() {
|
|
170
|
+
this.ensureNotDeleted();
|
|
171
|
+
return this.length;
|
|
172
|
+
}
|
|
173
|
+
delete() {
|
|
174
|
+
this.ensureNotDeleted();
|
|
175
|
+
this.length = 0;
|
|
176
|
+
this.isDeleted = true;
|
|
177
|
+
}
|
|
178
|
+
ensureNotDeleted() {
|
|
179
|
+
if (this.isDeleted) {
|
|
180
|
+
throw new Error("This VecArray instance has been deleted.");
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
186
184
|
|
|
187
185
|
var types = /*#__PURE__*/Object.freeze({
|
|
188
186
|
__proto__: null,
|
|
@@ -195,7 +193,8 @@ var types = /*#__PURE__*/Object.freeze({
|
|
|
195
193
|
MatrixIndex: MatrixIndex$1,
|
|
196
194
|
DecoderResult: DecoderResult,
|
|
197
195
|
ColorType: ColorType,
|
|
198
|
-
AlphaType: AlphaType
|
|
196
|
+
AlphaType: AlphaType,
|
|
197
|
+
VecArray: VecArray
|
|
199
198
|
});
|
|
200
199
|
|
|
201
200
|
var __defProp$d = Object.defineProperty;
|
|
@@ -341,20 +340,11 @@ let Matrix$1 = class {
|
|
|
341
340
|
}
|
|
342
341
|
};
|
|
343
342
|
Matrix$1 = __decorateClass$c([
|
|
344
|
-
destroyVerify$1
|
|
345
|
-
wasmAwaitRewind$1
|
|
343
|
+
destroyVerify$1
|
|
346
344
|
], Matrix$1);
|
|
347
345
|
|
|
348
346
|
const rewindData = (fn, scope, ...args) => {
|
|
349
|
-
|
|
350
|
-
const currData = PAGModule.Asyncify.currData;
|
|
351
|
-
PAGModule.Asyncify.currData = null;
|
|
352
|
-
const ret = fn.call(scope, ...args);
|
|
353
|
-
PAGModule.Asyncify.currData = currData;
|
|
354
|
-
return ret;
|
|
355
|
-
} else {
|
|
356
|
-
return fn.call(scope, ...args);
|
|
357
|
-
}
|
|
347
|
+
return fn.call(scope, ...args);
|
|
358
348
|
};
|
|
359
349
|
const proxyVector = (vector, process) => {
|
|
360
350
|
const proxy = new Proxy(vector, {
|
|
@@ -542,7 +532,7 @@ let PAGLayer = class {
|
|
|
542
532
|
return this.wasmIns._isPAGFile();
|
|
543
533
|
}
|
|
544
534
|
asTypeLayer() {
|
|
545
|
-
return layer2typeLayer(this);
|
|
535
|
+
return layer2typeLayer(this.wasmIns);
|
|
546
536
|
}
|
|
547
537
|
isDelete() {
|
|
548
538
|
return this.wasmIns.isDelete();
|
|
@@ -553,8 +543,7 @@ let PAGLayer = class {
|
|
|
553
543
|
}
|
|
554
544
|
};
|
|
555
545
|
PAGLayer = __decorateClass$b([
|
|
556
|
-
destroyVerify$1
|
|
557
|
-
wasmAwaitRewind$1
|
|
546
|
+
destroyVerify$1
|
|
558
547
|
], PAGLayer);
|
|
559
548
|
|
|
560
549
|
var __defProp$b = Object.defineProperty;
|
|
@@ -645,18 +634,25 @@ let PAGComposition = class extends PAGLayer {
|
|
|
645
634
|
const wasmIns = this.wasmIns._getLayersByName(layerName);
|
|
646
635
|
if (!wasmIns)
|
|
647
636
|
throw new Error(`Get layers by ${layerName} fail!`);
|
|
648
|
-
|
|
637
|
+
const layerArray = VecArray.create();
|
|
638
|
+
for (const wasmIn of wasmIns) {
|
|
639
|
+
layerArray.push(layer2typeLayer(wasmIn));
|
|
640
|
+
}
|
|
641
|
+
return layerArray;
|
|
649
642
|
}
|
|
650
643
|
getLayersUnderPoint(localX, localY) {
|
|
651
644
|
const wasmIns = this.wasmIns._getLayersUnderPoint(localX, localY);
|
|
652
645
|
if (!wasmIns)
|
|
653
646
|
throw new Error(`Get layers under point ${localX},${localY} fail!`);
|
|
654
|
-
|
|
647
|
+
const layerArray = VecArray.create();
|
|
648
|
+
for (const wasmIn of wasmIns) {
|
|
649
|
+
layerArray.push(layer2typeLayer(wasmIn));
|
|
650
|
+
}
|
|
651
|
+
return layerArray;
|
|
655
652
|
}
|
|
656
653
|
};
|
|
657
654
|
PAGComposition = __decorateClass$a([
|
|
658
|
-
destroyVerify$1
|
|
659
|
-
wasmAwaitRewind$1
|
|
655
|
+
destroyVerify$1
|
|
660
656
|
], PAGComposition);
|
|
661
657
|
|
|
662
658
|
const readFile = (file) => new Promise((resolve) => {
|
|
@@ -738,7 +734,11 @@ let PAGFile = class extends PAGComposition {
|
|
|
738
734
|
const wasmIns = this.wasmIns._getLayersByEditableIndex(editableIndex, layerType);
|
|
739
735
|
if (!wasmIns)
|
|
740
736
|
throw new Error(`Get ${getLayerTypeName(layerType)} layers by ${editableIndex} fail!`);
|
|
741
|
-
|
|
737
|
+
const layerArray = VecArray.create();
|
|
738
|
+
for (const wasmIn of wasmIns) {
|
|
739
|
+
layerArray.push(layer2typeLayer(wasmIn));
|
|
740
|
+
}
|
|
741
|
+
return layerArray;
|
|
742
742
|
}
|
|
743
743
|
getEditableIndices(layerType) {
|
|
744
744
|
return this.wasmIns._getEditableIndices(layerType);
|
|
@@ -759,12 +759,8 @@ let PAGFile = class extends PAGComposition {
|
|
|
759
759
|
return new PAGFile(wasmIns);
|
|
760
760
|
}
|
|
761
761
|
};
|
|
762
|
-
__decorateClass$9([
|
|
763
|
-
wasmAsyncMethod
|
|
764
|
-
], PAGFile, "load", 1);
|
|
765
762
|
PAGFile = __decorateClass$9([
|
|
766
|
-
destroyVerify$1
|
|
767
|
-
wasmAwaitRewind$1
|
|
763
|
+
destroyVerify$1
|
|
768
764
|
], PAGFile);
|
|
769
765
|
|
|
770
766
|
var __defProp$9 = Object.defineProperty;
|
|
@@ -828,8 +824,7 @@ let PAGSurface = class {
|
|
|
828
824
|
}
|
|
829
825
|
};
|
|
830
826
|
PAGSurface = __decorateClass$8([
|
|
831
|
-
destroyVerify$1
|
|
832
|
-
wasmAwaitRewind$1
|
|
827
|
+
destroyVerify$1
|
|
833
828
|
], PAGSurface);
|
|
834
829
|
|
|
835
830
|
var __defProp$8 = Object.defineProperty;
|
|
@@ -965,7 +960,11 @@ let PAGPlayer = class {
|
|
|
965
960
|
const wasmIns = this.wasmIns._getLayersUnderPoint(localX, localY);
|
|
966
961
|
if (!wasmIns)
|
|
967
962
|
throw new Error(`Get layers under point, x: ${localX} y:${localY} fail!`);
|
|
968
|
-
|
|
963
|
+
const layerArray = VecArray.create();
|
|
964
|
+
for (const wasmIn of wasmIns) {
|
|
965
|
+
layerArray.push(layer2typeLayer(wasmIn));
|
|
966
|
+
}
|
|
967
|
+
return layerArray;
|
|
969
968
|
}
|
|
970
969
|
hitTestPoint(pagLayer, surfaceX, surfaceY, pixelHitTest = false) {
|
|
971
970
|
return this.wasmIns._hitTestPoint(pagLayer.wasmIns, surfaceX, surfaceY, pixelHitTest);
|
|
@@ -1003,15 +1002,8 @@ let PAGPlayer = class {
|
|
|
1003
1002
|
}
|
|
1004
1003
|
}
|
|
1005
1004
|
};
|
|
1006
|
-
__decorateClass$7([
|
|
1007
|
-
wasmAsyncMethod
|
|
1008
|
-
], PAGPlayer.prototype, "flush", 1);
|
|
1009
|
-
__decorateClass$7([
|
|
1010
|
-
wasmAsyncMethod
|
|
1011
|
-
], PAGPlayer.prototype, "flushInternal", 1);
|
|
1012
1005
|
PAGPlayer = __decorateClass$7([
|
|
1013
|
-
destroyVerify$1
|
|
1014
|
-
wasmAwaitRewind$1
|
|
1006
|
+
destroyVerify$1
|
|
1015
1007
|
], PAGPlayer);
|
|
1016
1008
|
|
|
1017
1009
|
var __defProp$7 = Object.defineProperty;
|
|
@@ -1087,12 +1079,8 @@ let PAGImage = class {
|
|
|
1087
1079
|
this.isDestroyed = true;
|
|
1088
1080
|
}
|
|
1089
1081
|
};
|
|
1090
|
-
__decorateClass$6([
|
|
1091
|
-
wasmAsyncMethod
|
|
1092
|
-
], PAGImage, "fromFile", 1);
|
|
1093
1082
|
PAGImage = __decorateClass$6([
|
|
1094
|
-
destroyVerify$1
|
|
1095
|
-
wasmAwaitRewind$1
|
|
1083
|
+
destroyVerify$1
|
|
1096
1084
|
], PAGImage);
|
|
1097
1085
|
|
|
1098
1086
|
class EventManager {
|
|
@@ -1320,26 +1308,17 @@ class Clock {
|
|
|
1320
1308
|
}
|
|
1321
1309
|
}
|
|
1322
1310
|
|
|
1311
|
+
const CANVAS_POOL_MAX_SIZE = 10;
|
|
1312
|
+
|
|
1313
|
+
const isInstanceOf = (value, type) => typeof type !== "undefined" && value instanceof type;
|
|
1314
|
+
|
|
1323
1315
|
const nav$1 = navigator?.userAgent || "";
|
|
1324
1316
|
const ANDROID$1 = /android|adr/i.test(nav$1);
|
|
1325
1317
|
const MOBILE$1 = /(mobile)/i.test(nav$1) && ANDROID$1;
|
|
1326
1318
|
!(/(mobile)/i.test(nav$1) || MOBILE$1) && /Mac OS X/i.test(nav$1);
|
|
1327
1319
|
const IPHONE$1 = /(iphone|ipad|ipod)/i.test(nav$1);
|
|
1328
|
-
|
|
1320
|
+
/MicroMessenger/i.test(nav$1);
|
|
1329
1321
|
const SAFARI_OR_IOS_WEBVIEW$1 = /^((?!chrome|android).)*safari/i.test(nav$1) || IPHONE$1;
|
|
1330
|
-
const WORKER$1 = typeof globalThis.importScripts === "function";
|
|
1331
|
-
|
|
1332
|
-
const CANVAS_POOL_MAX_SIZE = 10;
|
|
1333
|
-
|
|
1334
|
-
const isInstanceOf = (value, type) => typeof type !== "undefined" && value instanceof type;
|
|
1335
|
-
|
|
1336
|
-
const nav = navigator?.userAgent || "";
|
|
1337
|
-
const ANDROID = /android|adr/i.test(nav);
|
|
1338
|
-
const MOBILE = /(mobile)/i.test(nav) && ANDROID;
|
|
1339
|
-
!(/(mobile)/i.test(nav) || MOBILE) && /Mac OS X/i.test(nav);
|
|
1340
|
-
const IPHONE = /(iphone|ipad|ipod)/i.test(nav);
|
|
1341
|
-
/MicroMessenger/i.test(nav);
|
|
1342
|
-
const SAFARI_OR_IOS_WEBVIEW = /^((?!chrome|android).)*safari/i.test(nav) || IPHONE;
|
|
1343
1322
|
const WORKER = typeof globalThis.importScripts === "function";
|
|
1344
1323
|
|
|
1345
1324
|
const canvasPool = new Array();
|
|
@@ -1359,7 +1338,7 @@ const releaseCanvas2D = (canvas) => {
|
|
|
1359
1338
|
}
|
|
1360
1339
|
};
|
|
1361
1340
|
const createCanvas2D = () => {
|
|
1362
|
-
if (SAFARI_OR_IOS_WEBVIEW && !WORKER) {
|
|
1341
|
+
if (SAFARI_OR_IOS_WEBVIEW$1 && !WORKER) {
|
|
1363
1342
|
return document.createElement("canvas");
|
|
1364
1343
|
}
|
|
1365
1344
|
try {
|
|
@@ -1642,8 +1621,8 @@ let PAGView = class {
|
|
|
1642
1621
|
prepare() {
|
|
1643
1622
|
return this.player.prepare();
|
|
1644
1623
|
}
|
|
1645
|
-
makeSnapshot() {
|
|
1646
|
-
return createImageBitmap(this.canvasElement);
|
|
1624
|
+
async makeSnapshot() {
|
|
1625
|
+
return await createImageBitmap(this.canvasElement);
|
|
1647
1626
|
}
|
|
1648
1627
|
destroy() {
|
|
1649
1628
|
this.clearTimer();
|
|
@@ -1723,23 +1702,13 @@ let PAGView = class {
|
|
|
1723
1702
|
}
|
|
1724
1703
|
}
|
|
1725
1704
|
setTimer() {
|
|
1726
|
-
|
|
1727
|
-
this.
|
|
1728
|
-
|
|
1729
|
-
}, 1 / this.frameRate * 1e3);
|
|
1730
|
-
} else {
|
|
1731
|
-
this.timer = globalThis.requestAnimationFrame(() => {
|
|
1732
|
-
this.flushLoop();
|
|
1733
|
-
});
|
|
1734
|
-
}
|
|
1705
|
+
this.timer = globalThis.requestAnimationFrame(() => {
|
|
1706
|
+
this.flushLoop();
|
|
1707
|
+
});
|
|
1735
1708
|
}
|
|
1736
1709
|
clearTimer() {
|
|
1737
1710
|
if (this.timer) {
|
|
1738
|
-
|
|
1739
|
-
self.clearTimeout(this.timer);
|
|
1740
|
-
} else {
|
|
1741
|
-
globalThis.cancelAnimationFrame(this.timer);
|
|
1742
|
-
}
|
|
1711
|
+
globalThis.cancelAnimationFrame(this.timer);
|
|
1743
1712
|
this.timer = null;
|
|
1744
1713
|
}
|
|
1745
1714
|
}
|
|
@@ -1862,12 +1831,8 @@ let PAGFont = class {
|
|
|
1862
1831
|
this.isDestroyed = true;
|
|
1863
1832
|
}
|
|
1864
1833
|
};
|
|
1865
|
-
__decorateClass$4([
|
|
1866
|
-
wasmAsyncMethod
|
|
1867
|
-
], PAGFont, "registerFont", 1);
|
|
1868
1834
|
PAGFont = __decorateClass$4([
|
|
1869
|
-
destroyVerify$1
|
|
1870
|
-
wasmAwaitRewind$1
|
|
1835
|
+
destroyVerify$1
|
|
1871
1836
|
], PAGFont);
|
|
1872
1837
|
|
|
1873
1838
|
let eventHandlers = {};
|
|
@@ -1890,117 +1855,13 @@ const removeAllListeners = (targetNode, event) => {
|
|
|
1890
1855
|
eventHandlers[event] = eventHandlers[event]?.filter(({ node }) => node !== targetNode);
|
|
1891
1856
|
};
|
|
1892
1857
|
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
WorkerMessageType2["PAGView_setRepeatCount"] = "PAGView.setRepeatCount";
|
|
1901
|
-
WorkerMessageType2["PAGView_getProgress"] = "PAGView.getProgress";
|
|
1902
|
-
WorkerMessageType2["PAGView_currentFrame"] = "PAGView.currentFrame";
|
|
1903
|
-
WorkerMessageType2["PAGView_setProgress"] = "PAGView.setProgress";
|
|
1904
|
-
WorkerMessageType2["PAGView_scaleMode"] = "PAGView.scaleMode";
|
|
1905
|
-
WorkerMessageType2["PAGView_setScaleMode"] = "PAGView.setScaleMode";
|
|
1906
|
-
WorkerMessageType2["PAGView_flush"] = "PAGView.flush";
|
|
1907
|
-
WorkerMessageType2["PAGView_getDebugData"] = "PAGView.getDebugData";
|
|
1908
|
-
WorkerMessageType2["PAGView_destroy"] = "PAGView.destroy";
|
|
1909
|
-
WorkerMessageType2["PAGFile_load"] = "PAGFile.load";
|
|
1910
|
-
WorkerMessageType2["PAGFile_getTextData"] = "PAGFile.getTextData";
|
|
1911
|
-
WorkerMessageType2["PAGFile_replaceText"] = "PAGFile.replaceText";
|
|
1912
|
-
WorkerMessageType2["PAGFile_replaceImage"] = "PAGFile.replaceImage";
|
|
1913
|
-
WorkerMessageType2["PAGFile_destroy"] = "PAGFile.destroy";
|
|
1914
|
-
WorkerMessageType2["PAGImage_fromSource"] = "PAGImage.fromSource";
|
|
1915
|
-
WorkerMessageType2["PAGImage_destroy"] = "PAGImage.destroy";
|
|
1916
|
-
WorkerMessageType2["VideoReader_constructor"] = "VideoReader.constructor";
|
|
1917
|
-
WorkerMessageType2["VideoReader_prepare"] = "VideoReader.prepare";
|
|
1918
|
-
WorkerMessageType2["VideoReader_play"] = "VideoReader.play";
|
|
1919
|
-
WorkerMessageType2["VideoReader_pause"] = "VideoReader.pause";
|
|
1920
|
-
WorkerMessageType2["VideoReader_stop"] = "VideoReader.stop";
|
|
1921
|
-
WorkerMessageType2["VideoReader_getError"] = "VideoReader.getError";
|
|
1922
|
-
WorkerMessageType2["PAGModule_linkVideoReader"] = "PAGModule.linkVideoReader";
|
|
1923
|
-
WorkerMessageType2["TextDocument_delete"] = "TextDocument.delete";
|
|
1924
|
-
return WorkerMessageType2;
|
|
1925
|
-
})(WorkerMessageType || {});
|
|
1926
|
-
|
|
1927
|
-
let messageCount = 0;
|
|
1928
|
-
const generateMessageName = (name) => `${name}_${messageCount++}`;
|
|
1929
|
-
const postMessage = (worker, message, callback, transfer = []) => {
|
|
1930
|
-
return new Promise((resolve) => {
|
|
1931
|
-
const name = generateMessageName(message.name);
|
|
1932
|
-
const handle = (event) => {
|
|
1933
|
-
if (event.data.name === name) {
|
|
1934
|
-
worker.removeEventListener("message", handle);
|
|
1935
|
-
resolve(callback(...event.data.args));
|
|
1936
|
-
}
|
|
1937
|
-
};
|
|
1938
|
-
worker.addEventListener("message", handle);
|
|
1939
|
-
worker.postMessage({ name, args: message.args }, transfer);
|
|
1940
|
-
});
|
|
1941
|
-
};
|
|
1942
|
-
|
|
1943
|
-
class BitmapImage {
|
|
1944
|
-
constructor(bitmap) {
|
|
1945
|
-
this.bitmap = bitmap;
|
|
1946
|
-
}
|
|
1947
|
-
setBitmap(bitmap) {
|
|
1948
|
-
if (this.bitmap) {
|
|
1949
|
-
this.bitmap.close();
|
|
1950
|
-
}
|
|
1951
|
-
this.bitmap = bitmap;
|
|
1952
|
-
}
|
|
1953
|
-
}
|
|
1954
|
-
|
|
1955
|
-
class WorkerVideoReader {
|
|
1956
|
-
constructor(proxyId) {
|
|
1957
|
-
this.bitmap = null;
|
|
1958
|
-
this.isSought = false;
|
|
1959
|
-
this.isPlaying = false;
|
|
1960
|
-
this.bitmapImage = new BitmapImage(null);
|
|
1961
|
-
this.proxyId = proxyId;
|
|
1962
|
-
}
|
|
1963
|
-
prepare(targetFrame, playbackRate) {
|
|
1964
|
-
return new Promise((resolve) => {
|
|
1965
|
-
postMessage(
|
|
1966
|
-
self,
|
|
1967
|
-
{ name: WorkerMessageType.VideoReader_prepare, args: [this.proxyId, targetFrame, playbackRate] },
|
|
1968
|
-
(res) => {
|
|
1969
|
-
this.bitmapImage.setBitmap(res);
|
|
1970
|
-
resolve();
|
|
1971
|
-
}
|
|
1972
|
-
);
|
|
1973
|
-
});
|
|
1974
|
-
}
|
|
1975
|
-
getVideo() {
|
|
1976
|
-
return this.bitmapImage;
|
|
1977
|
-
}
|
|
1978
|
-
onDestroy() {
|
|
1979
|
-
self.postMessage({ name: "VideoReader.onDestroy", args: [this.proxyId] });
|
|
1980
|
-
}
|
|
1981
|
-
play() {
|
|
1982
|
-
return new Promise((resolve) => {
|
|
1983
|
-
postMessage(self, { name: WorkerMessageType.VideoReader_play, args: [this.proxyId] }, () => {
|
|
1984
|
-
resolve();
|
|
1985
|
-
});
|
|
1986
|
-
});
|
|
1987
|
-
}
|
|
1988
|
-
pause() {
|
|
1989
|
-
postMessage(self, { name: WorkerMessageType.VideoReader_pause, args: [this.proxyId] }, () => {
|
|
1990
|
-
});
|
|
1991
|
-
}
|
|
1992
|
-
stop() {
|
|
1993
|
-
postMessage(self, { name: WorkerMessageType.VideoReader_stop, args: [this.proxyId] }, () => {
|
|
1994
|
-
});
|
|
1995
|
-
}
|
|
1996
|
-
getError() {
|
|
1997
|
-
return new Promise((resolve) => {
|
|
1998
|
-
postMessage(self, { name: WorkerMessageType.VideoReader_getError, args: [this.proxyId] }, (res) => {
|
|
1999
|
-
resolve(res);
|
|
2000
|
-
});
|
|
2001
|
-
});
|
|
2002
|
-
}
|
|
2003
|
-
}
|
|
1858
|
+
const nav = navigator?.userAgent || "";
|
|
1859
|
+
const ANDROID = /android|adr/i.test(nav);
|
|
1860
|
+
const MOBILE = /(mobile)/i.test(nav) && ANDROID;
|
|
1861
|
+
!(/(mobile)/i.test(nav) || MOBILE) && /Mac OS X/i.test(nav);
|
|
1862
|
+
const IPHONE = /(iphone|ipad|ipod)/i.test(nav);
|
|
1863
|
+
const WECHAT = /MicroMessenger/i.test(nav);
|
|
1864
|
+
const SAFARI_OR_IOS_WEBVIEW = /^((?!chrome|android).)*safari/i.test(nav) || IPHONE;
|
|
2004
1865
|
|
|
2005
1866
|
const UHD_RESOLUTION = 3840;
|
|
2006
1867
|
const getWechatNetwork = () => {
|
|
@@ -2032,7 +1893,7 @@ const waitVideoCanPlay = (videoElement) => {
|
|
|
2032
1893
|
});
|
|
2033
1894
|
};
|
|
2034
1895
|
class VideoReader {
|
|
2035
|
-
constructor(source, width, height, frameRate, staticTimeRanges
|
|
1896
|
+
constructor(source, width, height, frameRate, staticTimeRanges) {
|
|
2036
1897
|
this.isSought = false;
|
|
2037
1898
|
this.isPlaying = false;
|
|
2038
1899
|
this.bitmap = null;
|
|
@@ -2047,6 +1908,7 @@ class VideoReader {
|
|
|
2047
1908
|
this.height = 0;
|
|
2048
1909
|
this.bitmapCanvas = null;
|
|
2049
1910
|
this.bitmapCtx = null;
|
|
1911
|
+
this.currentFrame = 0;
|
|
2050
1912
|
if (isInstanceOf$1(source, globalThis.HTMLVideoElement)) {
|
|
2051
1913
|
this.videoEl = source;
|
|
2052
1914
|
this.canplay = true;
|
|
@@ -2061,9 +1923,10 @@ class VideoReader {
|
|
|
2061
1923
|
waitVideoCanPlay(this.videoEl).then(() => {
|
|
2062
1924
|
this.canplay = true;
|
|
2063
1925
|
});
|
|
2064
|
-
const
|
|
1926
|
+
const buffer = source.slice();
|
|
1927
|
+
const blob = new Blob([buffer], { type: "video/mp4" });
|
|
2065
1928
|
this.videoEl.src = URL.createObjectURL(blob);
|
|
2066
|
-
if (IPHONE
|
|
1929
|
+
if (IPHONE) {
|
|
2067
1930
|
this.videoEl.load();
|
|
2068
1931
|
}
|
|
2069
1932
|
}
|
|
@@ -2074,91 +1937,74 @@ class VideoReader {
|
|
|
2074
1937
|
if (UHD_RESOLUTION < width || UHD_RESOLUTION < height) {
|
|
2075
1938
|
this.disablePlaybackRate = true;
|
|
2076
1939
|
}
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
}
|
|
2080
|
-
}
|
|
2081
|
-
static async create(source, width, height, frameRate, staticTimeRanges) {
|
|
2082
|
-
if (WORKER$1) {
|
|
2083
|
-
const proxyId = await new Promise((resolve) => {
|
|
2084
|
-
const uint8Array = source;
|
|
2085
|
-
const buffer = uint8Array.buffer.slice(uint8Array.byteOffset, uint8Array.byteOffset + uint8Array.byteLength);
|
|
2086
|
-
postMessage(
|
|
2087
|
-
self,
|
|
2088
|
-
{
|
|
2089
|
-
name: WorkerMessageType.VideoReader_constructor,
|
|
2090
|
-
args: [buffer, width, height, frameRate, staticTimeRanges, true]
|
|
2091
|
-
},
|
|
2092
|
-
(res) => {
|
|
2093
|
-
resolve(res);
|
|
2094
|
-
},
|
|
2095
|
-
[buffer]
|
|
2096
|
-
);
|
|
2097
|
-
});
|
|
2098
|
-
const videoReader = new WorkerVideoReader(proxyId);
|
|
2099
|
-
PAGModule.currentPlayer?.linkVideoReader(videoReader);
|
|
2100
|
-
return videoReader;
|
|
2101
|
-
}
|
|
1940
|
+
}
|
|
1941
|
+
static create(source, width, height, frameRate, staticTimeRanges) {
|
|
2102
1942
|
return new VideoReader(source, width, height, frameRate, staticTimeRanges);
|
|
2103
1943
|
}
|
|
2104
1944
|
async prepare(targetFrame, playbackRate) {
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
if (
|
|
2111
|
-
|
|
1945
|
+
const promise = new Promise(async (resolve, reject) => {
|
|
1946
|
+
this.setError(null);
|
|
1947
|
+
this.isSought = false;
|
|
1948
|
+
const { currentTime } = this.videoEl;
|
|
1949
|
+
const targetTime = targetFrame / this.frameRate;
|
|
1950
|
+
if (currentTime === 0 && targetTime === 0) {
|
|
1951
|
+
if (!this.canplay && !SAFARI_OR_IOS_WEBVIEW) {
|
|
1952
|
+
await waitVideoCanPlay(this.videoEl);
|
|
1953
|
+
} else {
|
|
1954
|
+
try {
|
|
1955
|
+
await this.play();
|
|
1956
|
+
} catch (e) {
|
|
1957
|
+
this.setError(e);
|
|
1958
|
+
this.currentFrame = targetFrame;
|
|
1959
|
+
reject(e);
|
|
1960
|
+
return;
|
|
1961
|
+
}
|
|
1962
|
+
await new Promise((resolveInner) => {
|
|
1963
|
+
requestAnimationFrame(() => {
|
|
1964
|
+
this.pause();
|
|
1965
|
+
resolveInner();
|
|
1966
|
+
});
|
|
1967
|
+
});
|
|
1968
|
+
}
|
|
2112
1969
|
} else {
|
|
1970
|
+
if (Math.round(targetTime * this.frameRate) === Math.round(currentTime * this.frameRate)) ; else if (this.staticTimeRanges?.contains(targetFrame)) {
|
|
1971
|
+
await this.seek(targetTime, false);
|
|
1972
|
+
this.currentFrame = targetFrame;
|
|
1973
|
+
resolve();
|
|
1974
|
+
return;
|
|
1975
|
+
} else if (Math.abs(currentTime - targetTime) < 1 / this.frameRate * VIDEO_DECODE_WAIT_FRAME) ; else {
|
|
1976
|
+
this.isSought = true;
|
|
1977
|
+
await this.seek(targetTime);
|
|
1978
|
+
this.currentFrame = targetFrame;
|
|
1979
|
+
resolve();
|
|
1980
|
+
return;
|
|
1981
|
+
}
|
|
1982
|
+
}
|
|
1983
|
+
const targetPlaybackRate = Math.min(Math.max(playbackRate, VIDEO_PLAYBACK_RATE_MIN), VIDEO_PLAYBACK_RATE_MAX);
|
|
1984
|
+
if (!this.disablePlaybackRate && this.videoEl.playbackRate !== targetPlaybackRate) {
|
|
1985
|
+
this.videoEl.playbackRate = targetPlaybackRate;
|
|
1986
|
+
}
|
|
1987
|
+
if (this.isPlaying && this.videoEl.paused) {
|
|
2113
1988
|
try {
|
|
2114
1989
|
await this.play();
|
|
2115
1990
|
} catch (e) {
|
|
2116
1991
|
this.setError(e);
|
|
1992
|
+
this.currentFrame = targetFrame;
|
|
1993
|
+
reject(e);
|
|
1994
|
+
return;
|
|
2117
1995
|
}
|
|
2118
|
-
await new Promise((resolve) => {
|
|
2119
|
-
requestAnimationFrame(() => {
|
|
2120
|
-
this.pause();
|
|
2121
|
-
resolve();
|
|
2122
|
-
});
|
|
2123
|
-
});
|
|
2124
|
-
}
|
|
2125
|
-
} else {
|
|
2126
|
-
if (Math.round(targetTime * this.frameRate) === Math.round(currentTime * this.frameRate)) ; else if (this.staticTimeRanges?.contains(targetFrame)) {
|
|
2127
|
-
await this.seek(targetTime, false);
|
|
2128
|
-
return;
|
|
2129
|
-
} else if (Math.abs(currentTime - targetTime) < 1 / this.frameRate * VIDEO_DECODE_WAIT_FRAME) ; else {
|
|
2130
|
-
this.isSought = true;
|
|
2131
|
-
await this.seek(targetTime);
|
|
2132
|
-
return;
|
|
2133
1996
|
}
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
await this.play();
|
|
2142
|
-
} catch (e) {
|
|
2143
|
-
this.setError(e);
|
|
2144
|
-
}
|
|
2145
|
-
}
|
|
1997
|
+
this.currentFrame = targetFrame;
|
|
1998
|
+
resolve();
|
|
1999
|
+
});
|
|
2000
|
+
await promise;
|
|
2001
|
+
}
|
|
2002
|
+
getCurrentFrame() {
|
|
2003
|
+
return this.currentFrame;
|
|
2146
2004
|
}
|
|
2147
2005
|
getVideo() {
|
|
2148
2006
|
return this.videoEl;
|
|
2149
2007
|
}
|
|
2150
|
-
async generateBitmap() {
|
|
2151
|
-
if (!this.bitmapCanvas) {
|
|
2152
|
-
this.bitmapCanvas = new OffscreenCanvas(this.width, this.height);
|
|
2153
|
-
this.bitmapCanvas.width = this.width;
|
|
2154
|
-
this.bitmapCanvas.height = this.height;
|
|
2155
|
-
this.bitmapCtx = this.bitmapCanvas.getContext("2d");
|
|
2156
|
-
}
|
|
2157
|
-
this.bitmapCtx?.fillRect(0, 0, this.width, this.height);
|
|
2158
|
-
this.bitmapCtx?.drawImage(this.videoEl, 0, 0, this.width, this.height);
|
|
2159
|
-
this.bitmap = await createImageBitmap(this.bitmapCanvas);
|
|
2160
|
-
return this.bitmap;
|
|
2161
|
-
}
|
|
2162
2008
|
async play() {
|
|
2163
2009
|
if (!this.videoEl.paused)
|
|
2164
2010
|
return;
|
|
@@ -2370,8 +2216,7 @@ let PAGTextLayer = class extends PAGLayer {
|
|
|
2370
2216
|
}
|
|
2371
2217
|
};
|
|
2372
2218
|
PAGTextLayer = __decorateClass$3([
|
|
2373
|
-
destroyVerify$1
|
|
2374
|
-
wasmAwaitRewind$1
|
|
2219
|
+
destroyVerify$1
|
|
2375
2220
|
], PAGTextLayer);
|
|
2376
2221
|
|
|
2377
2222
|
var __defProp$3 = Object.defineProperty;
|
|
@@ -2415,8 +2260,7 @@ let PAGImageLayer = class extends PAGLayer {
|
|
|
2415
2260
|
}
|
|
2416
2261
|
};
|
|
2417
2262
|
PAGImageLayer = __decorateClass$2([
|
|
2418
|
-
destroyVerify$1
|
|
2419
|
-
wasmAwaitRewind$1
|
|
2263
|
+
destroyVerify$1
|
|
2420
2264
|
], PAGImageLayer);
|
|
2421
2265
|
|
|
2422
2266
|
var __defProp$2 = Object.defineProperty;
|
|
@@ -2445,8 +2289,7 @@ let PAGSolidLayer = class extends PAGLayer {
|
|
|
2445
2289
|
}
|
|
2446
2290
|
};
|
|
2447
2291
|
PAGSolidLayer = __decorateClass$1([
|
|
2448
|
-
destroyVerify$1
|
|
2449
|
-
wasmAwaitRewind$1
|
|
2292
|
+
destroyVerify$1
|
|
2450
2293
|
], PAGSolidLayer);
|
|
2451
2294
|
|
|
2452
2295
|
const setMixin = (module) => {
|
|
@@ -2465,7 +2308,7 @@ const setMixin = (module) => {
|
|
|
2465
2308
|
module.SDKVersion = function() {
|
|
2466
2309
|
return module._SDKVersion();
|
|
2467
2310
|
};
|
|
2468
|
-
module.isIPhone = () => IPHONE
|
|
2311
|
+
module.isIPhone = () => IPHONE;
|
|
2469
2312
|
};
|
|
2470
2313
|
|
|
2471
2314
|
let TGFXModule;
|
|
@@ -2473,6 +2316,18 @@ const setTGFXModule = (module) => {
|
|
|
2473
2316
|
TGFXModule = module;
|
|
2474
2317
|
};
|
|
2475
2318
|
|
|
2319
|
+
class BitmapImage {
|
|
2320
|
+
constructor(bitmap) {
|
|
2321
|
+
this.bitmap = bitmap;
|
|
2322
|
+
}
|
|
2323
|
+
setBitmap(bitmap) {
|
|
2324
|
+
if (this.bitmap) {
|
|
2325
|
+
this.bitmap.close();
|
|
2326
|
+
}
|
|
2327
|
+
this.bitmap = bitmap;
|
|
2328
|
+
}
|
|
2329
|
+
}
|
|
2330
|
+
|
|
2476
2331
|
const createImage = (source) => {
|
|
2477
2332
|
return new Promise((resolve) => {
|
|
2478
2333
|
const image = new Image();
|
|
@@ -2496,7 +2351,7 @@ const readImagePixels = (module, image, width, height) => {
|
|
|
2496
2351
|
return null;
|
|
2497
2352
|
}
|
|
2498
2353
|
const canvas = getCanvas2D(width, height);
|
|
2499
|
-
const ctx = canvas.getContext("2d");
|
|
2354
|
+
const ctx = canvas.getContext("2d", { willReadFrequently: true });
|
|
2500
2355
|
if (!ctx) {
|
|
2501
2356
|
return null;
|
|
2502
2357
|
}
|
|
@@ -2571,37 +2426,6 @@ var tgfx = /*#__PURE__*/Object.freeze({
|
|
|
2571
2426
|
createCanvas2D: getCanvas2D
|
|
2572
2427
|
});
|
|
2573
2428
|
|
|
2574
|
-
function wasmAwaitRewind(constructor) {
|
|
2575
|
-
const ignoreStaticFunctions = ["length", "name", "prototype", "wasmAsyncMethods"];
|
|
2576
|
-
let staticFunctions = Object.getOwnPropertyNames(constructor).filter(
|
|
2577
|
-
(name) => ignoreStaticFunctions.indexOf(name) === -1
|
|
2578
|
-
);
|
|
2579
|
-
if (constructor.wasmAsyncMethods && constructor.wasmAsyncMethods.length > 0) {
|
|
2580
|
-
staticFunctions = staticFunctions.filter((name) => constructor.wasmAsyncMethods.indexOf(name) === -1);
|
|
2581
|
-
}
|
|
2582
|
-
let functions = Object.getOwnPropertyNames(constructor.prototype).filter(
|
|
2583
|
-
(name) => name !== "constructor" && typeof constructor.prototype[name] === "function"
|
|
2584
|
-
);
|
|
2585
|
-
if (constructor.prototype.wasmAsyncMethods && constructor.prototype.wasmAsyncMethods.length > 0) {
|
|
2586
|
-
functions = functions.filter((name) => constructor.prototype.wasmAsyncMethods.indexOf(name) === -1);
|
|
2587
|
-
}
|
|
2588
|
-
const proxyFn = (target, methodName) => {
|
|
2589
|
-
const fn = target[methodName];
|
|
2590
|
-
target[methodName] = function(...args) {
|
|
2591
|
-
if (TGFXModule.Asyncify.currData !== null) {
|
|
2592
|
-
const currData = TGFXModule.Asyncify.currData;
|
|
2593
|
-
TGFXModule.Asyncify.currData = null;
|
|
2594
|
-
const ret = fn.call(this, ...args);
|
|
2595
|
-
TGFXModule.Asyncify.currData = currData;
|
|
2596
|
-
return ret;
|
|
2597
|
-
} else {
|
|
2598
|
-
return fn.call(this, ...args);
|
|
2599
|
-
}
|
|
2600
|
-
};
|
|
2601
|
-
};
|
|
2602
|
-
staticFunctions.forEach((name) => proxyFn(constructor, name));
|
|
2603
|
-
functions.forEach((name) => proxyFn(constructor.prototype, name));
|
|
2604
|
-
}
|
|
2605
2429
|
function destroyVerify(constructor) {
|
|
2606
2430
|
let functions = Object.getOwnPropertyNames(constructor.prototype).filter(
|
|
2607
2431
|
(name) => name !== "constructor" && typeof constructor.prototype[name] === "function"
|
|
@@ -2692,8 +2516,7 @@ let Matrix = class {
|
|
|
2692
2516
|
}
|
|
2693
2517
|
};
|
|
2694
2518
|
Matrix = __decorateClass([
|
|
2695
|
-
destroyVerify
|
|
2696
|
-
wasmAwaitRewind
|
|
2519
|
+
destroyVerify
|
|
2697
2520
|
], Matrix);
|
|
2698
2521
|
|
|
2699
2522
|
const measureText = (imageData) => {
|
|
@@ -2763,6 +2586,26 @@ const _ScalerContext = class {
|
|
|
2763
2586
|
this.size = size;
|
|
2764
2587
|
this.loadCanvas();
|
|
2765
2588
|
}
|
|
2589
|
+
static getLineCap(cap) {
|
|
2590
|
+
switch (cap) {
|
|
2591
|
+
case TGFXModule.TGFXLineCap.Round:
|
|
2592
|
+
return "round";
|
|
2593
|
+
case TGFXModule.TGFXLineCap.Square:
|
|
2594
|
+
return "square";
|
|
2595
|
+
default:
|
|
2596
|
+
return "butt";
|
|
2597
|
+
}
|
|
2598
|
+
}
|
|
2599
|
+
static getLineJoin(join) {
|
|
2600
|
+
switch (join) {
|
|
2601
|
+
case TGFXModule.TGFXLineJoin.Round:
|
|
2602
|
+
return "round";
|
|
2603
|
+
case TGFXModule.TGFXLineJoin.Bevel:
|
|
2604
|
+
return "bevel";
|
|
2605
|
+
default:
|
|
2606
|
+
return "miter";
|
|
2607
|
+
}
|
|
2608
|
+
}
|
|
2766
2609
|
static setCanvas(canvas) {
|
|
2767
2610
|
_ScalerContext.canvas = canvas;
|
|
2768
2611
|
}
|
|
@@ -2848,12 +2691,28 @@ const _ScalerContext = class {
|
|
|
2848
2691
|
context.font = this.fontString(false, false);
|
|
2849
2692
|
return context.measureText(text).width;
|
|
2850
2693
|
}
|
|
2851
|
-
|
|
2852
|
-
const
|
|
2853
|
-
const
|
|
2854
|
-
|
|
2855
|
-
context.
|
|
2856
|
-
|
|
2694
|
+
readPixels(text, bounds, fauxBold, stroke) {
|
|
2695
|
+
const width = bounds.right - bounds.left;
|
|
2696
|
+
const height = bounds.bottom - bounds.top;
|
|
2697
|
+
const canvas = getCanvas2D(width, height);
|
|
2698
|
+
const context = canvas.getContext("2d", { willReadFrequently: true });
|
|
2699
|
+
context.clearRect(0, 0, width, height);
|
|
2700
|
+
context.font = this.fontString(fauxBold, false);
|
|
2701
|
+
if (stroke) {
|
|
2702
|
+
context.lineJoin = _ScalerContext.getLineJoin(stroke.join);
|
|
2703
|
+
context.miterLimit = stroke.miterLimit;
|
|
2704
|
+
context.lineCap = _ScalerContext.getLineCap(stroke.cap);
|
|
2705
|
+
context.lineWidth = stroke.width;
|
|
2706
|
+
context.strokeText(text, -bounds.left, -bounds.top);
|
|
2707
|
+
} else {
|
|
2708
|
+
context.fillText(text, -bounds.left, -bounds.top);
|
|
2709
|
+
}
|
|
2710
|
+
const { data } = context.getImageData(0, 0, width, height);
|
|
2711
|
+
releaseCanvas2D(canvas);
|
|
2712
|
+
if (data.length === 0) {
|
|
2713
|
+
return null;
|
|
2714
|
+
}
|
|
2715
|
+
return new Uint8Array(data);
|
|
2857
2716
|
}
|
|
2858
2717
|
loadCanvas() {
|
|
2859
2718
|
if (!_ScalerContext.canvas) {
|
|
@@ -2900,75 +2759,26 @@ const _ScalerContext = class {
|
|
|
2900
2759
|
let ScalerContext = _ScalerContext;
|
|
2901
2760
|
ScalerContext.hasMeasureBoundsAPI = void 0;
|
|
2902
2761
|
|
|
2903
|
-
class
|
|
2904
|
-
static
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
switch (cap) {
|
|
2909
|
-
case TGFXModule.TGFXLineCap.Round:
|
|
2910
|
-
return "round";
|
|
2911
|
-
case TGFXModule.TGFXLineCap.Square:
|
|
2912
|
-
return "square";
|
|
2913
|
-
default:
|
|
2914
|
-
return "butt";
|
|
2915
|
-
}
|
|
2916
|
-
}
|
|
2917
|
-
static getLineJoin(join) {
|
|
2918
|
-
switch (join) {
|
|
2919
|
-
case TGFXModule.TGFXLineJoin.Round:
|
|
2920
|
-
return "round";
|
|
2921
|
-
case TGFXModule.TGFXLineJoin.Bevel:
|
|
2922
|
-
return "bevel";
|
|
2923
|
-
default:
|
|
2924
|
-
return "miter";
|
|
2762
|
+
class PathRasterizer {
|
|
2763
|
+
static readPixels(width, height, path, fillType) {
|
|
2764
|
+
let canvas = getCanvas2D(width, height);
|
|
2765
|
+
if (canvas == null) {
|
|
2766
|
+
return null;
|
|
2925
2767
|
}
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
this.canvas = canvas;
|
|
2929
|
-
this.context = this.canvas.getContext("2d");
|
|
2930
|
-
}
|
|
2931
|
-
updateCanvas(canvas) {
|
|
2932
|
-
this.canvas = canvas;
|
|
2933
|
-
}
|
|
2934
|
-
fillPath(path, fillType) {
|
|
2935
|
-
this.context.setTransform(1, 0, 0, 1, 0, 0);
|
|
2768
|
+
let context = canvas.getContext("2d", { willReadFrequently: true });
|
|
2769
|
+
context.setTransform(1, 0, 0, 1, 0, 0);
|
|
2936
2770
|
if (fillType === TGFXModule.TGFXPathFillType.InverseWinding || fillType === TGFXModule.TGFXPathFillType.InverseEvenOdd) {
|
|
2937
|
-
|
|
2938
|
-
|
|
2771
|
+
context.clip(path, fillType === TGFXModule.TGFXPathFillType.InverseEvenOdd ? "evenodd" : "nonzero");
|
|
2772
|
+
context.fillRect(0, 0, width, height);
|
|
2939
2773
|
} else {
|
|
2940
|
-
|
|
2941
|
-
}
|
|
2942
|
-
}
|
|
2943
|
-
fillText(webFont, texts, positions, matrixWasmIns) {
|
|
2944
|
-
const scalerContext = new ScalerContext(webFont.name, webFont.style, webFont.size);
|
|
2945
|
-
const matrix = new Matrix(matrixWasmIns);
|
|
2946
|
-
this.context.setTransform(matrix.a, matrix.b, matrix.c, matrix.d, matrix.tx, matrix.ty);
|
|
2947
|
-
this.context.font = scalerContext.fontString(webFont.bold, webFont.italic);
|
|
2948
|
-
for (let i = 0; i < texts.size(); i++) {
|
|
2949
|
-
const position = positions.get(i);
|
|
2950
|
-
this.context.fillText(texts.get(i), position.x, position.y);
|
|
2951
|
-
}
|
|
2952
|
-
}
|
|
2953
|
-
strokeText(webFont, stroke, texts, positions, matrixWasmIns) {
|
|
2954
|
-
if (stroke.width < 0.5) {
|
|
2955
|
-
return;
|
|
2774
|
+
context.fill(path, fillType === TGFXModule.TGFXPathFillType.EvenOdd ? "evenodd" : "nonzero");
|
|
2956
2775
|
}
|
|
2957
|
-
const
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
this.context.lineJoin = WebMask.getLineJoin(stroke.join);
|
|
2962
|
-
this.context.miterLimit = stroke.miterLimit;
|
|
2963
|
-
this.context.lineCap = WebMask.getLineCap(stroke.cap);
|
|
2964
|
-
this.context.lineWidth = stroke.width;
|
|
2965
|
-
for (let i = 0; i < texts.size(); i++) {
|
|
2966
|
-
const position = positions.get(i);
|
|
2967
|
-
this.context.strokeText(texts.get(i), position.x, position.y);
|
|
2776
|
+
const { data } = context.getImageData(0, 0, width, height);
|
|
2777
|
+
releaseCanvas2D(canvas);
|
|
2778
|
+
if (data.length === 0) {
|
|
2779
|
+
return null;
|
|
2968
2780
|
}
|
|
2969
|
-
|
|
2970
|
-
clear() {
|
|
2971
|
-
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
|
2781
|
+
return new Uint8Array(data);
|
|
2972
2782
|
}
|
|
2973
2783
|
}
|
|
2974
2784
|
|
|
@@ -2976,7 +2786,7 @@ const TGFXBind = (module) => {
|
|
|
2976
2786
|
setTGFXModule(module);
|
|
2977
2787
|
module.module = module;
|
|
2978
2788
|
module.ScalerContext = ScalerContext;
|
|
2979
|
-
module.WebMask =
|
|
2789
|
+
module.WebMask = PathRasterizer;
|
|
2980
2790
|
module.Matrix = Matrix;
|
|
2981
2791
|
module.tgfx = { ...tgfx };
|
|
2982
2792
|
};
|
|
@@ -3024,9 +2834,6 @@ var PAGInit$1 = (() => {
|
|
|
3024
2834
|
var ENVIRONMENT_IS_WORKER = typeof WorkerGlobalScope != "undefined";
|
|
3025
2835
|
typeof process == "object" && typeof process.versions == "object" && typeof process.versions.node == "string" && process.type != "renderer";
|
|
3026
2836
|
var moduleOverrides = Object.assign({}, Module);
|
|
3027
|
-
var quit_ = (status, toThrow) => {
|
|
3028
|
-
throw toThrow;
|
|
3029
|
-
};
|
|
3030
2837
|
var scriptDirectory = "";
|
|
3031
2838
|
function locateFile(path) {
|
|
3032
2839
|
if (Module["locateFile"]) {
|
|
@@ -3079,7 +2886,6 @@ var PAGInit$1 = (() => {
|
|
|
3079
2886
|
var wasmBinary = Module["wasmBinary"];
|
|
3080
2887
|
var wasmMemory;
|
|
3081
2888
|
var ABORT = false;
|
|
3082
|
-
var EXITSTATUS;
|
|
3083
2889
|
var HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAP64, HEAPU64, HEAPF64;
|
|
3084
2890
|
var dataURIPrefix = "data:application/octet-stream;base64,";
|
|
3085
2891
|
var isDataURI = (filename) => filename.startsWith(dataURIPrefix);
|
|
@@ -3220,11 +3026,10 @@ var PAGInit$1 = (() => {
|
|
|
3220
3026
|
async function createWasm() {
|
|
3221
3027
|
function receiveInstance(instance, module) {
|
|
3222
3028
|
wasmExports = instance.exports;
|
|
3223
|
-
|
|
3224
|
-
wasmMemory = wasmExports["hc"];
|
|
3029
|
+
wasmMemory = wasmExports["Cc"];
|
|
3225
3030
|
updateMemoryViews();
|
|
3226
|
-
wasmExports["
|
|
3227
|
-
addOnInit(wasmExports["
|
|
3031
|
+
wasmTable = wasmExports["Fc"];
|
|
3032
|
+
addOnInit(wasmExports["Dc"]);
|
|
3228
3033
|
removeRunDependency();
|
|
3229
3034
|
return wasmExports;
|
|
3230
3035
|
}
|
|
@@ -3251,19 +3056,12 @@ var PAGInit$1 = (() => {
|
|
|
3251
3056
|
return Promise.reject(e);
|
|
3252
3057
|
}
|
|
3253
3058
|
}
|
|
3254
|
-
class ExitStatus {
|
|
3255
|
-
constructor(status) {
|
|
3256
|
-
__publicField(this, "name", "ExitStatus");
|
|
3257
|
-
this.message = `Program terminated with exit(${status})`;
|
|
3258
|
-
this.status = status;
|
|
3259
|
-
}
|
|
3260
|
-
}
|
|
3261
3059
|
var callRuntimeCallbacks = (callbacks) => {
|
|
3262
3060
|
while (callbacks.length > 0) {
|
|
3263
3061
|
callbacks.shift()(Module);
|
|
3264
3062
|
}
|
|
3265
3063
|
};
|
|
3266
|
-
|
|
3064
|
+
Module["noExitRuntime"] || true;
|
|
3267
3065
|
class ExceptionInfo {
|
|
3268
3066
|
constructor(excPtr) {
|
|
3269
3067
|
this.excPtr = excPtr;
|
|
@@ -3860,7 +3658,6 @@ var PAGInit$1 = (() => {
|
|
|
3860
3658
|
var arrayBuffer = await readAsync(url);
|
|
3861
3659
|
return new Uint8Array(arrayBuffer);
|
|
3862
3660
|
};
|
|
3863
|
-
asyncLoad.isAsync = true;
|
|
3864
3661
|
var FS_createDataFile = (parent, name, fileData, canRead, canWrite, canOwn) => {
|
|
3865
3662
|
FS.createDataFile(parent, name, fileData, canRead, canWrite, canOwn);
|
|
3866
3663
|
};
|
|
@@ -6105,20 +5902,12 @@ var PAGInit$1 = (() => {
|
|
|
6105
5902
|
Module[name].argCount = numArguments;
|
|
6106
5903
|
}
|
|
6107
5904
|
};
|
|
6108
|
-
var
|
|
6109
|
-
|
|
6110
|
-
var f = Module["dynCall_" + sig];
|
|
6111
|
-
return f(ptr, ...args);
|
|
6112
|
-
};
|
|
6113
|
-
var dynCall = (sig, ptr, args = []) => {
|
|
6114
|
-
var rtn = dynCallLegacy(sig, ptr, args);
|
|
6115
|
-
return rtn;
|
|
6116
|
-
};
|
|
6117
|
-
var getDynCaller = (sig, ptr) => (...args) => dynCall(sig, ptr, args);
|
|
5905
|
+
var wasmTable;
|
|
5906
|
+
var getWasmTableEntry = (funcPtr) => wasmTable.get(funcPtr);
|
|
6118
5907
|
var embind__requireFunction = (signature, rawFunction) => {
|
|
6119
5908
|
signature = readLatin1String(signature);
|
|
6120
5909
|
function makeDynCaller() {
|
|
6121
|
-
return
|
|
5910
|
+
return getWasmTableEntry(rawFunction);
|
|
6122
5911
|
}
|
|
6123
5912
|
var fp = makeDynCaller();
|
|
6124
5913
|
if (typeof fp != "function") {
|
|
@@ -6272,10 +6061,6 @@ var PAGInit$1 = (() => {
|
|
|
6272
6061
|
args1.push(`argType${i2}`);
|
|
6273
6062
|
}
|
|
6274
6063
|
invokerFnBody += (returns || isAsync ? "var rv = " : "") + `invoker(${argsListWired});
|
|
6275
|
-
`;
|
|
6276
|
-
var returnVal = returns ? "rv" : "";
|
|
6277
|
-
args1.push("Asyncify");
|
|
6278
|
-
invokerFnBody += `function onDone(${returnVal}) {
|
|
6279
6064
|
`;
|
|
6280
6065
|
if (needsDestructorStack) {
|
|
6281
6066
|
invokerFnBody += "runDestructors(destructors);\n";
|
|
@@ -6292,193 +6077,9 @@ var PAGInit$1 = (() => {
|
|
|
6292
6077
|
if (returns) {
|
|
6293
6078
|
invokerFnBody += "var ret = retType['fromWireType'](rv);\nreturn ret;\n";
|
|
6294
6079
|
}
|
|
6295
|
-
invokerFnBody += "}\n";
|
|
6296
|
-
invokerFnBody += `return Asyncify.currData ? Asyncify.whenDone().then(onDone) : onDone(${returnVal});
|
|
6297
|
-
`;
|
|
6298
6080
|
invokerFnBody += "}\n";
|
|
6299
6081
|
return [args1, invokerFnBody];
|
|
6300
6082
|
}
|
|
6301
|
-
var runAndAbortIfError = (func) => {
|
|
6302
|
-
try {
|
|
6303
|
-
return func();
|
|
6304
|
-
} catch (e) {
|
|
6305
|
-
abort(e);
|
|
6306
|
-
}
|
|
6307
|
-
};
|
|
6308
|
-
var handleException = (e) => {
|
|
6309
|
-
if (e instanceof ExitStatus || e == "unwind") {
|
|
6310
|
-
return EXITSTATUS;
|
|
6311
|
-
}
|
|
6312
|
-
quit_(1, e);
|
|
6313
|
-
};
|
|
6314
|
-
var runtimeKeepaliveCounter = 0;
|
|
6315
|
-
var keepRuntimeAlive = () => noExitRuntime || runtimeKeepaliveCounter > 0;
|
|
6316
|
-
var _proc_exit = (code) => {
|
|
6317
|
-
EXITSTATUS = code;
|
|
6318
|
-
if (!keepRuntimeAlive()) {
|
|
6319
|
-
Module["onExit"]?.(code);
|
|
6320
|
-
ABORT = true;
|
|
6321
|
-
}
|
|
6322
|
-
quit_(code, new ExitStatus(code));
|
|
6323
|
-
};
|
|
6324
|
-
var exitJS = (status, implicit) => {
|
|
6325
|
-
EXITSTATUS = status;
|
|
6326
|
-
_proc_exit(status);
|
|
6327
|
-
};
|
|
6328
|
-
var _exit = exitJS;
|
|
6329
|
-
var maybeExit = () => {
|
|
6330
|
-
if (!keepRuntimeAlive()) {
|
|
6331
|
-
try {
|
|
6332
|
-
_exit(EXITSTATUS);
|
|
6333
|
-
} catch (e) {
|
|
6334
|
-
handleException(e);
|
|
6335
|
-
}
|
|
6336
|
-
}
|
|
6337
|
-
};
|
|
6338
|
-
var callUserCallback = (func) => {
|
|
6339
|
-
if (ABORT) {
|
|
6340
|
-
return;
|
|
6341
|
-
}
|
|
6342
|
-
try {
|
|
6343
|
-
func();
|
|
6344
|
-
maybeExit();
|
|
6345
|
-
} catch (e) {
|
|
6346
|
-
handleException(e);
|
|
6347
|
-
}
|
|
6348
|
-
};
|
|
6349
|
-
var Asyncify = { instrumentWasmImports(imports) {
|
|
6350
|
-
var importPattern = /^(invoke_.*|__asyncjs__.*)$/;
|
|
6351
|
-
for (let [x, original] of Object.entries(imports)) {
|
|
6352
|
-
if (typeof original == "function") {
|
|
6353
|
-
original.isAsync || importPattern.test(x);
|
|
6354
|
-
}
|
|
6355
|
-
}
|
|
6356
|
-
}, instrumentWasmExports(exports) {
|
|
6357
|
-
var ret = {};
|
|
6358
|
-
for (let [x, original] of Object.entries(exports)) {
|
|
6359
|
-
if (typeof original == "function") {
|
|
6360
|
-
ret[x] = (...args) => {
|
|
6361
|
-
Asyncify.exportCallStack.push(x);
|
|
6362
|
-
try {
|
|
6363
|
-
return original(...args);
|
|
6364
|
-
} finally {
|
|
6365
|
-
if (!ABORT) {
|
|
6366
|
-
Asyncify.exportCallStack.pop();
|
|
6367
|
-
Asyncify.maybeStopUnwind();
|
|
6368
|
-
}
|
|
6369
|
-
}
|
|
6370
|
-
};
|
|
6371
|
-
} else {
|
|
6372
|
-
ret[x] = original;
|
|
6373
|
-
}
|
|
6374
|
-
}
|
|
6375
|
-
return ret;
|
|
6376
|
-
}, State: { Normal: 0, Unwinding: 1, Rewinding: 2, Disabled: 3 }, state: 0, StackSize: 4096, currData: null, handleSleepReturnValue: 0, exportCallStack: [], callStackNameToId: {}, callStackIdToName: {}, callStackId: 0, asyncPromiseHandlers: null, sleepCallbacks: [], getCallStackId(funcName) {
|
|
6377
|
-
var id = Asyncify.callStackNameToId[funcName];
|
|
6378
|
-
if (id === void 0) {
|
|
6379
|
-
id = Asyncify.callStackId++;
|
|
6380
|
-
Asyncify.callStackNameToId[funcName] = id;
|
|
6381
|
-
Asyncify.callStackIdToName[id] = funcName;
|
|
6382
|
-
}
|
|
6383
|
-
return id;
|
|
6384
|
-
}, maybeStopUnwind() {
|
|
6385
|
-
if (Asyncify.currData && Asyncify.state === Asyncify.State.Unwinding && Asyncify.exportCallStack.length === 0) {
|
|
6386
|
-
Asyncify.state = Asyncify.State.Normal;
|
|
6387
|
-
runAndAbortIfError(_asyncify_stop_unwind);
|
|
6388
|
-
if (typeof Fibers != "undefined") {
|
|
6389
|
-
Fibers.trampoline();
|
|
6390
|
-
}
|
|
6391
|
-
}
|
|
6392
|
-
}, whenDone() {
|
|
6393
|
-
return new Promise((resolve, reject) => {
|
|
6394
|
-
Asyncify.asyncPromiseHandlers = { resolve, reject };
|
|
6395
|
-
});
|
|
6396
|
-
}, allocateData() {
|
|
6397
|
-
var ptr = _malloc(12 + Asyncify.StackSize);
|
|
6398
|
-
Asyncify.setDataHeader(ptr, ptr + 12, Asyncify.StackSize);
|
|
6399
|
-
Asyncify.setDataRewindFunc(ptr);
|
|
6400
|
-
return ptr;
|
|
6401
|
-
}, setDataHeader(ptr, stack, stackSize) {
|
|
6402
|
-
HEAPU32[ptr >> 2] = stack;
|
|
6403
|
-
HEAPU32[ptr + 4 >> 2] = stack + stackSize;
|
|
6404
|
-
}, setDataRewindFunc(ptr) {
|
|
6405
|
-
var bottomOfCallStack = Asyncify.exportCallStack[0];
|
|
6406
|
-
var rewindId = Asyncify.getCallStackId(bottomOfCallStack);
|
|
6407
|
-
HEAP32[ptr + 8 >> 2] = rewindId;
|
|
6408
|
-
}, getDataRewindFuncName(ptr) {
|
|
6409
|
-
var id = HEAP32[ptr + 8 >> 2];
|
|
6410
|
-
var name = Asyncify.callStackIdToName[id];
|
|
6411
|
-
return name;
|
|
6412
|
-
}, getDataRewindFunc(name) {
|
|
6413
|
-
var func = wasmExports[name];
|
|
6414
|
-
return func;
|
|
6415
|
-
}, doRewind(ptr) {
|
|
6416
|
-
var name = Asyncify.getDataRewindFuncName(ptr);
|
|
6417
|
-
var func = Asyncify.getDataRewindFunc(name);
|
|
6418
|
-
return func();
|
|
6419
|
-
}, handleSleep(startAsync) {
|
|
6420
|
-
if (ABORT)
|
|
6421
|
-
return;
|
|
6422
|
-
if (Asyncify.state === Asyncify.State.Normal) {
|
|
6423
|
-
var reachedCallback = false;
|
|
6424
|
-
var reachedAfterCallback = false;
|
|
6425
|
-
startAsync((handleSleepReturnValue = 0) => {
|
|
6426
|
-
if (ABORT)
|
|
6427
|
-
return;
|
|
6428
|
-
Asyncify.handleSleepReturnValue = handleSleepReturnValue;
|
|
6429
|
-
reachedCallback = true;
|
|
6430
|
-
if (!reachedAfterCallback) {
|
|
6431
|
-
return;
|
|
6432
|
-
}
|
|
6433
|
-
Asyncify.state = Asyncify.State.Rewinding;
|
|
6434
|
-
runAndAbortIfError(() => _asyncify_start_rewind(Asyncify.currData));
|
|
6435
|
-
if (typeof MainLoop != "undefined" && MainLoop.func) {
|
|
6436
|
-
MainLoop.resume();
|
|
6437
|
-
}
|
|
6438
|
-
var asyncWasmReturnValue, isError = false;
|
|
6439
|
-
try {
|
|
6440
|
-
asyncWasmReturnValue = Asyncify.doRewind(Asyncify.currData);
|
|
6441
|
-
} catch (err2) {
|
|
6442
|
-
asyncWasmReturnValue = err2;
|
|
6443
|
-
isError = true;
|
|
6444
|
-
}
|
|
6445
|
-
var handled = false;
|
|
6446
|
-
if (!Asyncify.currData) {
|
|
6447
|
-
var asyncPromiseHandlers = Asyncify.asyncPromiseHandlers;
|
|
6448
|
-
if (asyncPromiseHandlers) {
|
|
6449
|
-
Asyncify.asyncPromiseHandlers = null;
|
|
6450
|
-
(isError ? asyncPromiseHandlers.reject : asyncPromiseHandlers.resolve)(asyncWasmReturnValue);
|
|
6451
|
-
handled = true;
|
|
6452
|
-
}
|
|
6453
|
-
}
|
|
6454
|
-
if (isError && !handled) {
|
|
6455
|
-
throw asyncWasmReturnValue;
|
|
6456
|
-
}
|
|
6457
|
-
});
|
|
6458
|
-
reachedAfterCallback = true;
|
|
6459
|
-
if (!reachedCallback) {
|
|
6460
|
-
Asyncify.state = Asyncify.State.Unwinding;
|
|
6461
|
-
Asyncify.currData = Asyncify.allocateData();
|
|
6462
|
-
if (typeof MainLoop != "undefined" && MainLoop.func) {
|
|
6463
|
-
MainLoop.pause();
|
|
6464
|
-
}
|
|
6465
|
-
runAndAbortIfError(() => _asyncify_start_unwind(Asyncify.currData));
|
|
6466
|
-
}
|
|
6467
|
-
} else if (Asyncify.state === Asyncify.State.Rewinding) {
|
|
6468
|
-
Asyncify.state = Asyncify.State.Normal;
|
|
6469
|
-
runAndAbortIfError(_asyncify_stop_rewind);
|
|
6470
|
-
_free(Asyncify.currData);
|
|
6471
|
-
Asyncify.currData = null;
|
|
6472
|
-
Asyncify.sleepCallbacks.forEach(callUserCallback);
|
|
6473
|
-
} else {
|
|
6474
|
-
abort(`invalid state: ${Asyncify.state}`);
|
|
6475
|
-
}
|
|
6476
|
-
return Asyncify.handleSleepReturnValue;
|
|
6477
|
-
}, handleAsync(startAsync) {
|
|
6478
|
-
return Asyncify.handleSleep((wakeUp) => {
|
|
6479
|
-
startAsync().then(wakeUp);
|
|
6480
|
-
});
|
|
6481
|
-
} };
|
|
6482
6083
|
function craftInvokerFunction(humanName, argTypes, classType, cppInvokerFunc, cppTargetFunc, isAsync) {
|
|
6483
6084
|
var argCount = argTypes.length;
|
|
6484
6085
|
if (argCount < 2) {
|
|
@@ -6491,7 +6092,6 @@ var PAGInit$1 = (() => {
|
|
|
6491
6092
|
for (var i2 = 0; i2 < argCount - 2; ++i2) {
|
|
6492
6093
|
closureArgs.push(argTypes[i2 + 2]);
|
|
6493
6094
|
}
|
|
6494
|
-
closureArgs.push(Asyncify);
|
|
6495
6095
|
if (!needsDestructorStack) {
|
|
6496
6096
|
for (var i2 = isClassMethodFunc ? 1 : 2; i2 < argTypes.length; ++i2) {
|
|
6497
6097
|
if (argTypes[i2].destructorFunction !== null) {
|
|
@@ -7073,11 +6673,6 @@ var PAGInit$1 = (() => {
|
|
|
7073
6673
|
returnType = requireRegisteredType(returnType, "emval::as");
|
|
7074
6674
|
return emval_returnValue(returnType, destructorsRef, handle);
|
|
7075
6675
|
};
|
|
7076
|
-
var __emval_await = (promise) => Asyncify.handleAsync(async () => {
|
|
7077
|
-
var value = await Emval.toValue(promise);
|
|
7078
|
-
return Emval.toHandle(value);
|
|
7079
|
-
});
|
|
7080
|
-
__emval_await.isAsync = true;
|
|
7081
6676
|
var emval_methodCallers = [];
|
|
7082
6677
|
var __emval_call = (caller, handle, destructorsRef, args) => {
|
|
7083
6678
|
caller = emval_methodCallers[caller];
|
|
@@ -7474,6 +7069,10 @@ var PAGInit$1 = (() => {
|
|
|
7474
7069
|
GLctx.bindBuffer(target, GL.buffers[buffer]);
|
|
7475
7070
|
};
|
|
7476
7071
|
var _emscripten_glBindBuffer = _glBindBuffer;
|
|
7072
|
+
var _glBindBufferBase = (target, index, buffer) => {
|
|
7073
|
+
GLctx.bindBufferBase(target, index, GL.buffers[buffer]);
|
|
7074
|
+
};
|
|
7075
|
+
var _emscripten_glBindBufferBase = _glBindBufferBase;
|
|
7477
7076
|
var _glBindFramebuffer = (target, framebuffer) => {
|
|
7478
7077
|
GLctx.bindFramebuffer(target, GL.framebuffers[framebuffer]);
|
|
7479
7078
|
};
|
|
@@ -7500,6 +7099,8 @@ var PAGInit$1 = (() => {
|
|
|
7500
7099
|
var _emscripten_glBlendEquationSeparate = _glBlendEquationSeparate;
|
|
7501
7100
|
var _glBlendFunc = (x0, x1) => GLctx.blendFunc(x0, x1);
|
|
7502
7101
|
var _emscripten_glBlendFunc = _glBlendFunc;
|
|
7102
|
+
var _glBlendFuncSeparate = (x0, x1, x2, x3) => GLctx.blendFuncSeparate(x0, x1, x2, x3);
|
|
7103
|
+
var _emscripten_glBlendFuncSeparate = _glBlendFuncSeparate;
|
|
7503
7104
|
var _glBlitFramebuffer = (x0, x1, x2, x3, x4, x5, x6, x7, x8, x9) => GLctx.blitFramebuffer(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9);
|
|
7504
7105
|
var _emscripten_glBlitFramebuffer = _glBlitFramebuffer;
|
|
7505
7106
|
var _glBufferData = (target, size, data, usage) => {
|
|
@@ -7514,12 +7115,22 @@ var PAGInit$1 = (() => {
|
|
|
7514
7115
|
GLctx.bufferData(target, data ? HEAPU8.subarray(data, data + size) : size, usage);
|
|
7515
7116
|
};
|
|
7516
7117
|
var _emscripten_glBufferData = _glBufferData;
|
|
7118
|
+
var _glBufferSubData = (target, offset, size, data) => {
|
|
7119
|
+
if (GL.currentContext.version >= 2) {
|
|
7120
|
+
size && GLctx.bufferSubData(target, offset, HEAPU8, data, size);
|
|
7121
|
+
return;
|
|
7122
|
+
}
|
|
7123
|
+
GLctx.bufferSubData(target, offset, HEAPU8.subarray(data, data + size));
|
|
7124
|
+
};
|
|
7125
|
+
var _emscripten_glBufferSubData = _glBufferSubData;
|
|
7517
7126
|
var _glCheckFramebufferStatus = (x0) => GLctx.checkFramebufferStatus(x0);
|
|
7518
7127
|
var _emscripten_glCheckFramebufferStatus = _glCheckFramebufferStatus;
|
|
7519
7128
|
var _glClear = (x0) => GLctx.clear(x0);
|
|
7520
7129
|
var _emscripten_glClear = _glClear;
|
|
7521
7130
|
var _glClearColor = (x0, x1, x2, x3) => GLctx.clearColor(x0, x1, x2, x3);
|
|
7522
7131
|
var _emscripten_glClearColor = _glClearColor;
|
|
7132
|
+
var _glClearDepthf = (x0) => GLctx.clearDepth(x0);
|
|
7133
|
+
var _emscripten_glClearDepthf = _glClearDepthf;
|
|
7523
7134
|
var _glClearStencil = (x0) => GLctx.clearStencil(x0);
|
|
7524
7135
|
var _emscripten_glClearStencil = _glClearStencil;
|
|
7525
7136
|
var _glColorMask = (red, green, blue, alpha) => {
|
|
@@ -7530,6 +7141,30 @@ var PAGInit$1 = (() => {
|
|
|
7530
7141
|
GLctx.compileShader(GL.shaders[shader]);
|
|
7531
7142
|
};
|
|
7532
7143
|
var _emscripten_glCompileShader = _glCompileShader;
|
|
7144
|
+
var _glCompressedTexImage2D = (target, level, internalFormat, width, height, border, imageSize, data) => {
|
|
7145
|
+
if (GL.currentContext.version >= 2) {
|
|
7146
|
+
if (GLctx.currentPixelUnpackBufferBinding || !imageSize) {
|
|
7147
|
+
GLctx.compressedTexImage2D(target, level, internalFormat, width, height, border, imageSize, data);
|
|
7148
|
+
return;
|
|
7149
|
+
}
|
|
7150
|
+
GLctx.compressedTexImage2D(target, level, internalFormat, width, height, border, HEAPU8, data, imageSize);
|
|
7151
|
+
return;
|
|
7152
|
+
}
|
|
7153
|
+
GLctx.compressedTexImage2D(target, level, internalFormat, width, height, border, HEAPU8.subarray(data, data + imageSize));
|
|
7154
|
+
};
|
|
7155
|
+
var _emscripten_glCompressedTexImage2D = _glCompressedTexImage2D;
|
|
7156
|
+
var _glCompressedTexSubImage2D = (target, level, xoffset, yoffset, width, height, format, imageSize, data) => {
|
|
7157
|
+
if (GL.currentContext.version >= 2) {
|
|
7158
|
+
if (GLctx.currentPixelUnpackBufferBinding || !imageSize) {
|
|
7159
|
+
GLctx.compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
|
|
7160
|
+
return;
|
|
7161
|
+
}
|
|
7162
|
+
GLctx.compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, HEAPU8, data, imageSize);
|
|
7163
|
+
return;
|
|
7164
|
+
}
|
|
7165
|
+
GLctx.compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, HEAPU8.subarray(data, data + imageSize));
|
|
7166
|
+
};
|
|
7167
|
+
var _emscripten_glCompressedTexSubImage2D = _glCompressedTexSubImage2D;
|
|
7533
7168
|
var _glCopyTexSubImage2D = (x0, x1, x2, x3, x4, x5, x6, x7) => GLctx.copyTexSubImage2D(x0, x1, x2, x3, x4, x5, x6, x7);
|
|
7534
7169
|
var _emscripten_glCopyTexSubImage2D = _glCopyTexSubImage2D;
|
|
7535
7170
|
var _glCreateProgram = () => {
|
|
@@ -7548,6 +7183,8 @@ var PAGInit$1 = (() => {
|
|
|
7548
7183
|
return id;
|
|
7549
7184
|
};
|
|
7550
7185
|
var _emscripten_glCreateShader = _glCreateShader;
|
|
7186
|
+
var _glCullFace = (x0) => GLctx.cullFace(x0);
|
|
7187
|
+
var _emscripten_glCullFace = _glCullFace;
|
|
7551
7188
|
var _glDeleteBuffers = (n, buffers) => {
|
|
7552
7189
|
for (var i2 = 0; i2 < n; i2++) {
|
|
7553
7190
|
var id = HEAP32[buffers + i2 * 4 >> 2];
|
|
@@ -7648,6 +7285,8 @@ var PAGInit$1 = (() => {
|
|
|
7648
7285
|
var _emscripten_glDeleteVertexArrays = _glDeleteVertexArrays;
|
|
7649
7286
|
var _glDeleteVertexArraysOES = _glDeleteVertexArrays;
|
|
7650
7287
|
var _emscripten_glDeleteVertexArraysOES = _glDeleteVertexArraysOES;
|
|
7288
|
+
var _glDepthFunc = (x0) => GLctx.depthFunc(x0);
|
|
7289
|
+
var _emscripten_glDepthFunc = _glDepthFunc;
|
|
7651
7290
|
var _glDepthMask = (flag) => {
|
|
7652
7291
|
GLctx.depthMask(!!flag);
|
|
7653
7292
|
};
|
|
@@ -7695,6 +7334,8 @@ var PAGInit$1 = (() => {
|
|
|
7695
7334
|
GLctx.framebufferTexture2D(target, attachment, textarget, GL.textures[texture], level);
|
|
7696
7335
|
};
|
|
7697
7336
|
var _emscripten_glFramebufferTexture2D = _glFramebufferTexture2D;
|
|
7337
|
+
var _glFrontFace = (x0) => GLctx.frontFace(x0);
|
|
7338
|
+
var _emscripten_glFrontFace = _glFrontFace;
|
|
7698
7339
|
var _glGenBuffers = (n, buffers) => {
|
|
7699
7340
|
GL.genObject(n, buffers, "createBuffer", GL.buffers);
|
|
7700
7341
|
};
|
|
@@ -7717,30 +7358,10 @@ var PAGInit$1 = (() => {
|
|
|
7717
7358
|
var _emscripten_glGenVertexArrays = _glGenVertexArrays;
|
|
7718
7359
|
var _glGenVertexArraysOES = _glGenVertexArrays;
|
|
7719
7360
|
var _emscripten_glGenVertexArraysOES = _glGenVertexArraysOES;
|
|
7361
|
+
var _glGenerateMipmap = (x0) => GLctx.generateMipmap(x0);
|
|
7362
|
+
var _emscripten_glGenerateMipmap = _glGenerateMipmap;
|
|
7720
7363
|
var _glGetAttribLocation = (program, name) => GLctx.getAttribLocation(GL.programs[program], UTF8ToString(name));
|
|
7721
7364
|
var _emscripten_glGetAttribLocation = _glGetAttribLocation;
|
|
7722
|
-
var _glGetBufferParameteriv = (target, value, data) => {
|
|
7723
|
-
if (!data) {
|
|
7724
|
-
GL.recordError(1281);
|
|
7725
|
-
return;
|
|
7726
|
-
}
|
|
7727
|
-
HEAP32[data >> 2] = GLctx.getBufferParameter(target, value);
|
|
7728
|
-
};
|
|
7729
|
-
var _emscripten_glGetBufferParameteriv = _glGetBufferParameteriv;
|
|
7730
|
-
var _glGetError = () => {
|
|
7731
|
-
var error = GLctx.getError() || GL.lastError;
|
|
7732
|
-
GL.lastError = 0;
|
|
7733
|
-
return error;
|
|
7734
|
-
};
|
|
7735
|
-
var _emscripten_glGetError = _glGetError;
|
|
7736
|
-
var _glGetFramebufferAttachmentParameteriv = (target, attachment, pname, params) => {
|
|
7737
|
-
var result = GLctx.getFramebufferAttachmentParameter(target, attachment, pname);
|
|
7738
|
-
if (result instanceof WebGLRenderbuffer || result instanceof WebGLTexture) {
|
|
7739
|
-
result = result.name | 0;
|
|
7740
|
-
}
|
|
7741
|
-
HEAP32[params >> 2] = result;
|
|
7742
|
-
};
|
|
7743
|
-
var _emscripten_glGetFramebufferAttachmentParameteriv = _glGetFramebufferAttachmentParameteriv;
|
|
7744
7365
|
var writeI53ToI64 = (ptr, num) => {
|
|
7745
7366
|
HEAPU32[ptr >> 2] = num;
|
|
7746
7367
|
var lower = HEAPU32[ptr >> 2];
|
|
@@ -7878,8 +7499,49 @@ var PAGInit$1 = (() => {
|
|
|
7878
7499
|
break;
|
|
7879
7500
|
}
|
|
7880
7501
|
};
|
|
7502
|
+
var _glGetBooleanv = (name_, p) => emscriptenWebGLGet(name_, p, 4);
|
|
7503
|
+
var _emscripten_glGetBooleanv = _glGetBooleanv;
|
|
7504
|
+
var _glGetBufferParameteriv = (target, value, data) => {
|
|
7505
|
+
if (!data) {
|
|
7506
|
+
GL.recordError(1281);
|
|
7507
|
+
return;
|
|
7508
|
+
}
|
|
7509
|
+
HEAP32[data >> 2] = GLctx.getBufferParameter(target, value);
|
|
7510
|
+
};
|
|
7511
|
+
var _emscripten_glGetBufferParameteriv = _glGetBufferParameteriv;
|
|
7512
|
+
var _glGetError = () => {
|
|
7513
|
+
var error = GLctx.getError() || GL.lastError;
|
|
7514
|
+
GL.lastError = 0;
|
|
7515
|
+
return error;
|
|
7516
|
+
};
|
|
7517
|
+
var _emscripten_glGetError = _glGetError;
|
|
7518
|
+
var _glGetFramebufferAttachmentParameteriv = (target, attachment, pname, params) => {
|
|
7519
|
+
var result = GLctx.getFramebufferAttachmentParameter(target, attachment, pname);
|
|
7520
|
+
if (result instanceof WebGLRenderbuffer || result instanceof WebGLTexture) {
|
|
7521
|
+
result = result.name | 0;
|
|
7522
|
+
}
|
|
7523
|
+
HEAP32[params >> 2] = result;
|
|
7524
|
+
};
|
|
7525
|
+
var _emscripten_glGetFramebufferAttachmentParameteriv = _glGetFramebufferAttachmentParameteriv;
|
|
7881
7526
|
var _glGetIntegerv = (name_, p) => emscriptenWebGLGet(name_, p, 0);
|
|
7882
7527
|
var _emscripten_glGetIntegerv = _glGetIntegerv;
|
|
7528
|
+
var _glGetInternalformativ = (target, internalformat, pname, bufSize, params) => {
|
|
7529
|
+
if (bufSize < 0) {
|
|
7530
|
+
GL.recordError(1281);
|
|
7531
|
+
return;
|
|
7532
|
+
}
|
|
7533
|
+
if (!params) {
|
|
7534
|
+
GL.recordError(1281);
|
|
7535
|
+
return;
|
|
7536
|
+
}
|
|
7537
|
+
var ret = GLctx.getInternalformatParameter(target, internalformat, pname);
|
|
7538
|
+
if (ret === null)
|
|
7539
|
+
return;
|
|
7540
|
+
for (var i2 = 0; i2 < ret.length && i2 < bufSize; ++i2) {
|
|
7541
|
+
HEAP32[params + i2 * 4 >> 2] = ret[i2];
|
|
7542
|
+
}
|
|
7543
|
+
};
|
|
7544
|
+
var _emscripten_glGetInternalformativ = _glGetInternalformativ;
|
|
7883
7545
|
var _glGetProgramInfoLog = (program, maxLength, length, infoLog) => {
|
|
7884
7546
|
var log = GLctx.getProgramInfoLog(GL.programs[program]);
|
|
7885
7547
|
if (log === null)
|
|
@@ -8055,6 +7717,8 @@ var PAGInit$1 = (() => {
|
|
|
8055
7717
|
}
|
|
8056
7718
|
};
|
|
8057
7719
|
var _emscripten_glGetStringi = _glGetStringi;
|
|
7720
|
+
var _glGetUniformBlockIndex = (program, uniformBlockName) => GLctx.getUniformBlockIndex(GL.programs[program], UTF8ToString(uniformBlockName));
|
|
7721
|
+
var _emscripten_glGetUniformBlockIndex = _glGetUniformBlockIndex;
|
|
8058
7722
|
var jstoi_q = (str) => parseInt(str);
|
|
8059
7723
|
var webglGetLeftBracePos = (name) => name.slice(-1) == "]" && name.lastIndexOf("[");
|
|
8060
7724
|
var webglPrepareUniformLocationsBeforeFirstUse = (program) => {
|
|
@@ -8104,6 +7768,54 @@ var PAGInit$1 = (() => {
|
|
|
8104
7768
|
return -1;
|
|
8105
7769
|
};
|
|
8106
7770
|
var _emscripten_glGetUniformLocation = _glGetUniformLocation;
|
|
7771
|
+
var _glGetVertexAttribPointerv = (index, pname, pointer) => {
|
|
7772
|
+
if (!pointer) {
|
|
7773
|
+
GL.recordError(1281);
|
|
7774
|
+
return;
|
|
7775
|
+
}
|
|
7776
|
+
HEAP32[pointer >> 2] = GLctx.getVertexAttribOffset(index, pname);
|
|
7777
|
+
};
|
|
7778
|
+
var _emscripten_glGetVertexAttribPointerv = _glGetVertexAttribPointerv;
|
|
7779
|
+
var emscriptenWebGLGetVertexAttrib = (index, pname, params, type) => {
|
|
7780
|
+
if (!params) {
|
|
7781
|
+
GL.recordError(1281);
|
|
7782
|
+
return;
|
|
7783
|
+
}
|
|
7784
|
+
var data = GLctx.getVertexAttrib(index, pname);
|
|
7785
|
+
if (pname == 34975) {
|
|
7786
|
+
HEAP32[params >> 2] = data && data["name"];
|
|
7787
|
+
} else if (typeof data == "number" || typeof data == "boolean") {
|
|
7788
|
+
switch (type) {
|
|
7789
|
+
case 0:
|
|
7790
|
+
HEAP32[params >> 2] = data;
|
|
7791
|
+
break;
|
|
7792
|
+
case 2:
|
|
7793
|
+
HEAPF32[params >> 2] = data;
|
|
7794
|
+
break;
|
|
7795
|
+
case 5:
|
|
7796
|
+
HEAP32[params >> 2] = Math.fround(data);
|
|
7797
|
+
break;
|
|
7798
|
+
}
|
|
7799
|
+
} else {
|
|
7800
|
+
for (var i2 = 0; i2 < data.length; i2++) {
|
|
7801
|
+
switch (type) {
|
|
7802
|
+
case 0:
|
|
7803
|
+
HEAP32[params + i2 * 4 >> 2] = data[i2];
|
|
7804
|
+
break;
|
|
7805
|
+
case 2:
|
|
7806
|
+
HEAPF32[params + i2 * 4 >> 2] = data[i2];
|
|
7807
|
+
break;
|
|
7808
|
+
case 5:
|
|
7809
|
+
HEAP32[params + i2 * 4 >> 2] = Math.fround(data[i2]);
|
|
7810
|
+
break;
|
|
7811
|
+
}
|
|
7812
|
+
}
|
|
7813
|
+
}
|
|
7814
|
+
};
|
|
7815
|
+
var _glGetVertexAttribiv = (index, pname, params) => {
|
|
7816
|
+
emscriptenWebGLGetVertexAttrib(index, pname, params, 5);
|
|
7817
|
+
};
|
|
7818
|
+
var _emscripten_glGetVertexAttribiv = _glGetVertexAttribiv;
|
|
8107
7819
|
var _glIsEnabled = (x0) => GLctx.isEnabled(x0);
|
|
8108
7820
|
var _emscripten_glIsEnabled = _glIsEnabled;
|
|
8109
7821
|
var _glIsTexture = (id) => {
|
|
@@ -8196,6 +7908,18 @@ var PAGInit$1 = (() => {
|
|
|
8196
7908
|
GLctx.shaderSource(GL.shaders[shader], source);
|
|
8197
7909
|
};
|
|
8198
7910
|
var _emscripten_glShaderSource = _glShaderSource;
|
|
7911
|
+
var _glStencilFunc = (x0, x1, x2) => GLctx.stencilFunc(x0, x1, x2);
|
|
7912
|
+
var _emscripten_glStencilFunc = _glStencilFunc;
|
|
7913
|
+
var _glStencilFuncSeparate = (x0, x1, x2, x3) => GLctx.stencilFuncSeparate(x0, x1, x2, x3);
|
|
7914
|
+
var _emscripten_glStencilFuncSeparate = _glStencilFuncSeparate;
|
|
7915
|
+
var _glStencilMask = (x0) => GLctx.stencilMask(x0);
|
|
7916
|
+
var _emscripten_glStencilMask = _glStencilMask;
|
|
7917
|
+
var _glStencilMaskSeparate = (x0, x1) => GLctx.stencilMaskSeparate(x0, x1);
|
|
7918
|
+
var _emscripten_glStencilMaskSeparate = _glStencilMaskSeparate;
|
|
7919
|
+
var _glStencilOp = (x0, x1, x2) => GLctx.stencilOp(x0, x1, x2);
|
|
7920
|
+
var _emscripten_glStencilOp = _glStencilOp;
|
|
7921
|
+
var _glStencilOpSeparate = (x0, x1, x2, x3) => GLctx.stencilOpSeparate(x0, x1, x2, x3);
|
|
7922
|
+
var _emscripten_glStencilOpSeparate = _glStencilOpSeparate;
|
|
8199
7923
|
var _glTexImage2D = (target, level, internalFormat, width, height, border, format, type, pixels) => {
|
|
8200
7924
|
if (GL.currentContext.version >= 2) {
|
|
8201
7925
|
if (GLctx.currentPixelUnpackBufferBinding) {
|
|
@@ -8438,6 +8162,11 @@ var PAGInit$1 = (() => {
|
|
|
8438
8162
|
GLctx.uniform4iv(webglGetUniformLocation(location), view);
|
|
8439
8163
|
};
|
|
8440
8164
|
var _emscripten_glUniform4iv = _glUniform4iv;
|
|
8165
|
+
var _glUniformBlockBinding = (program, uniformBlockIndex, uniformBlockBinding) => {
|
|
8166
|
+
program = GL.programs[program];
|
|
8167
|
+
GLctx.uniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
|
|
8168
|
+
};
|
|
8169
|
+
var _emscripten_glUniformBlockBinding = _glUniformBlockBinding;
|
|
8441
8170
|
var _glUniformMatrix2fv = (location, count, transpose, value) => {
|
|
8442
8171
|
if (GL.currentContext.version >= 2) {
|
|
8443
8172
|
count && GLctx.uniformMatrix2fv(webglGetUniformLocation(location), !!transpose, HEAPF32, value >> 2, count * 4);
|
|
@@ -8723,92 +8452,13 @@ var PAGInit$1 = (() => {
|
|
|
8723
8452
|
for (var i = 0; i <= 288; ++i) {
|
|
8724
8453
|
miniTempWebGLIntBuffers[i] = miniTempWebGLIntBuffersStorage.subarray(0, i);
|
|
8725
8454
|
}
|
|
8726
|
-
var wasmImports = {
|
|
8455
|
+
var wasmImports = { z: ___cxa_throw, N: ___syscall_fcntl64, hb: ___syscall_getdents64, ob: ___syscall_ioctl, fb: ___syscall_mkdirat, O: ___syscall_openat, kb: ___syscall_rmdir, gb: ___syscall_stat64, lb: ___syscall_unlinkat, pb: __abort_js, w: __embind_finalize_value_object, L: __embind_register_bigint, db: __embind_register_bool, i: __embind_register_class, h: __embind_register_class_class_function, y: __embind_register_class_constructor, a: __embind_register_class_function, f: __embind_register_class_property, bb: __embind_register_emval, E: __embind_register_enum, r: __embind_register_enum_value, K: __embind_register_float, J: __embind_register_function, s: __embind_register_integer, j: __embind_register_memory_view, A: __embind_register_optional, p: __embind_register_smart_ptr, cb: __embind_register_std_string, G: __embind_register_std_wstring, v: __embind_register_value_object, n: __embind_register_value_object_field, eb: __embind_register_void, k: __emval_as, q: __emval_call, e: __emval_call_method, b: __emval_decref, I: __emval_equals, B: __emval_get_global, c: __emval_get_method_caller, m: __emval_get_module_property, t: __emval_get_property, g: __emval_incref, _a: __emval_instanceof, ab: __emval_new_array, u: __emval_new_cstring, $a: __emval_new_object, d: __emval_run_destructors, F: __emval_set_property, l: __emval_take_value, ib: _clock_time_get, P: _emscripten_get_canvas_element_size, Za: _emscripten_glActiveTexture, Ya: _emscripten_glAttachShader, Wa: _emscripten_glBindAttribLocation, Va: _emscripten_glBindBuffer, uc: _emscripten_glBindBufferBase, Ua: _emscripten_glBindFramebuffer, Ta: _emscripten_glBindRenderbuffer, Sa: _emscripten_glBindTexture, zb: _emscripten_glBindVertexArray, xb: _emscripten_glBindVertexArrayOES, Ra: _emscripten_glBlendColor, Qa: _emscripten_glBlendEquation, Ab: _emscripten_glBlendEquationSeparate, Pa: _emscripten_glBlendFunc, Oa: _emscripten_glBlendFuncSeparate, sb: _emscripten_glBlitFramebuffer, Na: _emscripten_glBufferData, Ma: _emscripten_glBufferSubData, La: _emscripten_glCheckFramebufferStatus, Ka: _emscripten_glClear, Ja: _emscripten_glClearColor, Ia: _emscripten_glClearDepthf, Ha: _emscripten_glClearStencil, Ga: _emscripten_glColorMask, Fa: _emscripten_glCompileShader, Ea: _emscripten_glCompressedTexImage2D, Da: _emscripten_glCompressedTexSubImage2D, Ca: _emscripten_glCopyTexSubImage2D, Ba: _emscripten_glCreateProgram, Aa: _emscripten_glCreateShader, za: _emscripten_glCullFace, ya: _emscripten_glDeleteBuffers, xa: _emscripten_glDeleteFramebuffers, wa: _emscripten_glDeleteProgram, va: _emscripten_glDeleteRenderbuffers, ua: _emscripten_glDeleteShader, tb: _emscripten_glDeleteSync, ta: _emscripten_glDeleteTextures, sa: _emscripten_glDeleteVertexArrays, wb: _emscripten_glDeleteVertexArraysOES, ra: _emscripten_glDepthFunc, qa: _emscripten_glDepthMask, pa: _emscripten_glDisable, oa: _emscripten_glDisableVertexAttribArray, na: _emscripten_glDrawArrays, ma: _emscripten_glDrawElements, la: _emscripten_glEnable, ka: _emscripten_glEnableVertexAttribArray, ub: _emscripten_glFenceSync, ja: _emscripten_glFinish, ia: _emscripten_glFlush, ha: _emscripten_glFramebufferRenderbuffer, ga: _emscripten_glFramebufferTexture2D, fa: _emscripten_glFrontFace, ea: _emscripten_glGenBuffers, da: _emscripten_glGenFramebuffers, ba: _emscripten_glGenRenderbuffers, aa: _emscripten_glGenTextures, yb: _emscripten_glGenVertexArrays, vb: _emscripten_glGenVertexArraysOES, ca: _emscripten_glGenerateMipmap, Bb: _emscripten_glGetAttribLocation, W: _emscripten_glGetBooleanv, $: _emscripten_glGetBufferParameteriv, _: _emscripten_glGetError, Z: _emscripten_glGetFramebufferAttachmentParameteriv, Y: _emscripten_glGetIntegerv, X: _emscripten_glGetInternalformativ, V: _emscripten_glGetProgramInfoLog, U: _emscripten_glGetProgramiv, T: _emscripten_glGetRenderbufferParameteriv, S: _emscripten_glGetShaderInfoLog, R: _emscripten_glGetShaderPrecisionFormat, Q: _emscripten_glGetShaderiv, Bc: _emscripten_glGetString, Ac: _emscripten_glGetStringi, wc: _emscripten_glGetUniformBlockIndex, xc: _emscripten_glGetUniformLocation, yc: _emscripten_glGetVertexAttribPointerv, zc: _emscripten_glGetVertexAttribiv, Xa: _emscripten_glIsEnabled, tc: _emscripten_glIsTexture, sc: _emscripten_glLineWidth, rc: _emscripten_glLinkProgram, qc: _emscripten_glPixelStorei, pc: _emscripten_glReadPixels, oc: _emscripten_glRenderbufferStorage, rb: _emscripten_glRenderbufferStorageMultisample, nc: _emscripten_glScissor, mc: _emscripten_glShaderSource, lc: _emscripten_glStencilFunc, kc: _emscripten_glStencilFuncSeparate, jc: _emscripten_glStencilMask, ic: _emscripten_glStencilMaskSeparate, hc: _emscripten_glStencilOp, gc: _emscripten_glStencilOpSeparate, fc: _emscripten_glTexImage2D, ec: _emscripten_glTexParameterf, dc: _emscripten_glTexParameterfv, cc: _emscripten_glTexParameteri, bc: _emscripten_glTexParameteriv, ac: _emscripten_glTexSubImage2D, $b: _emscripten_glUniform1f, _b: _emscripten_glUniform1fv, Zb: _emscripten_glUniform1i, Yb: _emscripten_glUniform1iv, Xb: _emscripten_glUniform2f, Wb: _emscripten_glUniform2fv, Vb: _emscripten_glUniform2i, Ub: _emscripten_glUniform2iv, Tb: _emscripten_glUniform3f, Sb: _emscripten_glUniform3fv, Rb: _emscripten_glUniform3i, Qb: _emscripten_glUniform3iv, Pb: _emscripten_glUniform4f, Ob: _emscripten_glUniform4fv, Nb: _emscripten_glUniform4i, Mb: _emscripten_glUniform4iv, vc: _emscripten_glUniformBlockBinding, Lb: _emscripten_glUniformMatrix2fv, Kb: _emscripten_glUniformMatrix3fv, Jb: _emscripten_glUniformMatrix4fv, Ib: _emscripten_glUseProgram, Hb: _emscripten_glVertexAttrib1f, Gb: _emscripten_glVertexAttrib2fv, Fb: _emscripten_glVertexAttrib3fv, Eb: _emscripten_glVertexAttrib4fv, Db: _emscripten_glVertexAttribPointer, Cb: _emscripten_glViewport, qb: _emscripten_glWaitSync, jb: _emscripten_resize_heap, H: _emscripten_webgl_create_context, D: _emscripten_webgl_destroy_context, x: _emscripten_webgl_get_current_context, o: _emscripten_webgl_make_context_current, C: _fd_close, nb: _fd_read, mb: _fd_seek, M: _fd_write };
|
|
8727
8456
|
var wasmExports = await createWasm();
|
|
8728
|
-
wasmExports["
|
|
8729
|
-
var ___getTypeName = wasmExports["
|
|
8730
|
-
var _malloc = wasmExports["
|
|
8731
|
-
var _free = wasmExports["
|
|
8732
|
-
Module["dynCall_ii"] = wasmExports["nc"];
|
|
8733
|
-
Module["dynCall_vi"] = wasmExports["oc"];
|
|
8734
|
-
Module["dynCall_ji"] = wasmExports["pc"];
|
|
8735
|
-
Module["dynCall_iii"] = wasmExports["qc"];
|
|
8736
|
-
Module["dynCall_vii"] = wasmExports["rc"];
|
|
8737
|
-
Module["dynCall_v"] = wasmExports["sc"];
|
|
8738
|
-
Module["dynCall_viij"] = wasmExports["tc"];
|
|
8739
|
-
Module["dynCall_fij"] = wasmExports["uc"];
|
|
8740
|
-
Module["dynCall_iij"] = wasmExports["vc"];
|
|
8741
|
-
Module["dynCall_viiij"] = wasmExports["wc"];
|
|
8742
|
-
Module["dynCall_viii"] = wasmExports["xc"];
|
|
8743
|
-
Module["dynCall_fif"] = wasmExports["yc"];
|
|
8744
|
-
Module["dynCall_viiii"] = wasmExports["zc"];
|
|
8745
|
-
Module["dynCall_fii"] = wasmExports["Ac"];
|
|
8746
|
-
Module["dynCall_iiii"] = wasmExports["Bc"];
|
|
8747
|
-
Module["dynCall_jii"] = wasmExports["Cc"];
|
|
8748
|
-
Module["dynCall_jij"] = wasmExports["Dc"];
|
|
8749
|
-
Module["dynCall_vij"] = wasmExports["Ec"];
|
|
8750
|
-
Module["dynCall_iiiiii"] = wasmExports["Fc"];
|
|
8751
|
-
Module["dynCall_viiiii"] = wasmExports["Gc"];
|
|
8752
|
-
Module["dynCall_iiiff"] = wasmExports["Hc"];
|
|
8753
|
-
Module["dynCall_vijii"] = wasmExports["Ic"];
|
|
8754
|
-
Module["dynCall_iiifi"] = wasmExports["Jc"];
|
|
8755
|
-
Module["dynCall_fi"] = wasmExports["Kc"];
|
|
8756
|
-
Module["dynCall_jijf"] = wasmExports["Lc"];
|
|
8757
|
-
Module["dynCall_fiii"] = wasmExports["Mc"];
|
|
8758
|
-
Module["dynCall_viiiji"] = wasmExports["Nc"];
|
|
8759
|
-
Module["dynCall_iijj"] = wasmExports["Oc"];
|
|
8760
|
-
Module["dynCall_iiiij"] = wasmExports["Pc"];
|
|
8761
|
-
Module["dynCall_diiii"] = wasmExports["Qc"];
|
|
8762
|
-
Module["dynCall_i"] = wasmExports["Rc"];
|
|
8763
|
-
Module["dynCall_vif"] = wasmExports["Sc"];
|
|
8764
|
-
Module["dynCall_di"] = wasmExports["Tc"];
|
|
8765
|
-
Module["dynCall_vid"] = wasmExports["Uc"];
|
|
8766
|
-
Module["dynCall_iiiiiii"] = wasmExports["Vc"];
|
|
8767
|
-
Module["dynCall_viiiiii"] = wasmExports["Wc"];
|
|
8768
|
-
Module["dynCall_iiiii"] = wasmExports["Xc"];
|
|
8769
|
-
Module["dynCall_iiiifii"] = wasmExports["Yc"];
|
|
8770
|
-
Module["dynCall_viiifii"] = wasmExports["Zc"];
|
|
8771
|
-
Module["dynCall_viiff"] = wasmExports["_c"];
|
|
8772
|
-
Module["dynCall_iiiiiiii"] = wasmExports["$c"];
|
|
8773
|
-
Module["dynCall_viiiiiii"] = wasmExports["ad"];
|
|
8774
|
-
Module["dynCall_iiiffi"] = wasmExports["bd"];
|
|
8775
|
-
Module["dynCall_iifffffffff"] = wasmExports["cd"];
|
|
8776
|
-
Module["dynCall_vifffffffff"] = wasmExports["dd"];
|
|
8777
|
-
Module["dynCall_iiff"] = wasmExports["ed"];
|
|
8778
|
-
Module["dynCall_viff"] = wasmExports["fd"];
|
|
8779
|
-
Module["dynCall_iif"] = wasmExports["gd"];
|
|
8780
|
-
Module["dynCall_viif"] = wasmExports["hd"];
|
|
8781
|
-
Module["dynCall_viffffff"] = wasmExports["id"];
|
|
8782
|
-
Module["dynCall_viffff"] = wasmExports["jd"];
|
|
8783
|
-
Module["dynCall_vifff"] = wasmExports["kd"];
|
|
8784
|
-
Module["dynCall_dii"] = wasmExports["ld"];
|
|
8785
|
-
Module["dynCall_viid"] = wasmExports["md"];
|
|
8786
|
-
Module["dynCall_iiiiffi"] = wasmExports["nd"];
|
|
8787
|
-
Module["dynCall_viiif"] = wasmExports["od"];
|
|
8788
|
-
Module["dynCall_viifffffffff"] = wasmExports["pd"];
|
|
8789
|
-
Module["dynCall_viiffffff"] = wasmExports["qd"];
|
|
8790
|
-
Module["dynCall_viiffff"] = wasmExports["rd"];
|
|
8791
|
-
Module["dynCall_viifff"] = wasmExports["sd"];
|
|
8792
|
-
Module["dynCall_viifi"] = wasmExports["td"];
|
|
8793
|
-
Module["dynCall_viddi"] = wasmExports["ud"];
|
|
8794
|
-
Module["dynCall_vifii"] = wasmExports["vd"];
|
|
8795
|
-
Module["dynCall_viifd"] = wasmExports["wd"];
|
|
8796
|
-
Module["dynCall_iiffi"] = wasmExports["xd"];
|
|
8797
|
-
Module["dynCall_viiiiiffii"] = wasmExports["yd"];
|
|
8798
|
-
Module["dynCall_iifii"] = wasmExports["zd"];
|
|
8799
|
-
Module["dynCall_vffff"] = wasmExports["Ad"];
|
|
8800
|
-
Module["dynCall_viiiiiiii"] = wasmExports["Bd"];
|
|
8801
|
-
Module["dynCall_vf"] = wasmExports["Cd"];
|
|
8802
|
-
Module["dynCall_viiiiiiiii"] = wasmExports["Dd"];
|
|
8803
|
-
Module["dynCall_viiiiiiiiii"] = wasmExports["Ed"];
|
|
8804
|
-
Module["dynCall_jiji"] = wasmExports["Fd"];
|
|
8805
|
-
Module["dynCall_iidiiii"] = wasmExports["Gd"];
|
|
8806
|
-
var _asyncify_start_unwind = wasmExports["Hd"];
|
|
8807
|
-
var _asyncify_stop_unwind = wasmExports["Id"];
|
|
8808
|
-
var _asyncify_start_rewind = wasmExports["Jd"];
|
|
8809
|
-
var _asyncify_stop_rewind = wasmExports["Kd"];
|
|
8457
|
+
wasmExports["Dc"];
|
|
8458
|
+
var ___getTypeName = wasmExports["Ec"];
|
|
8459
|
+
var _malloc = wasmExports["Gc"];
|
|
8460
|
+
var _free = wasmExports["Hc"];
|
|
8810
8461
|
Module["GL"] = GL;
|
|
8811
|
-
Module["Asyncify"] = Asyncify;
|
|
8812
8462
|
function run() {
|
|
8813
8463
|
if (runDependencies > 0) {
|
|
8814
8464
|
dependenciesFulfilled = run;
|
|
@@ -8891,151 +8541,6 @@ class WebAssemblyQueue {
|
|
|
8891
8541
|
}
|
|
8892
8542
|
}
|
|
8893
8543
|
|
|
8894
|
-
const pagFiles = [];
|
|
8895
|
-
const registerPAGFile = (pagFile) => {
|
|
8896
|
-
pagFiles.push(pagFile);
|
|
8897
|
-
return pagFiles.length - 1;
|
|
8898
|
-
};
|
|
8899
|
-
const deletePAGFile = (key) => {
|
|
8900
|
-
pagFiles[key] = null;
|
|
8901
|
-
};
|
|
8902
|
-
const pagViews = [];
|
|
8903
|
-
const registerPAGView = (pagView) => {
|
|
8904
|
-
pagViews.push(pagView);
|
|
8905
|
-
return pagViews.length - 1;
|
|
8906
|
-
};
|
|
8907
|
-
const deletePAGView = (key) => {
|
|
8908
|
-
pagViews[key] = null;
|
|
8909
|
-
};
|
|
8910
|
-
const pagImages = [];
|
|
8911
|
-
const registerPAGImage = (pagImage) => {
|
|
8912
|
-
pagImages.push(pagImage);
|
|
8913
|
-
return pagImages.length - 1;
|
|
8914
|
-
};
|
|
8915
|
-
const deletePAGImage = (key) => {
|
|
8916
|
-
pagImages[key] = null;
|
|
8917
|
-
};
|
|
8918
|
-
const textDataMap = [];
|
|
8919
|
-
const registerTextData = (textData) => {
|
|
8920
|
-
textDataMap.push(textData);
|
|
8921
|
-
return textDataMap.length - 1;
|
|
8922
|
-
};
|
|
8923
|
-
const deleteTextData = (key) => {
|
|
8924
|
-
textDataMap[key] = null;
|
|
8925
|
-
};
|
|
8926
|
-
const workerInit = (init) => {
|
|
8927
|
-
onmessage = async (event) => {
|
|
8928
|
-
const messageHandles = {
|
|
8929
|
-
[WorkerMessageType.PAGInit]: (event2) => {
|
|
8930
|
-
const option = {};
|
|
8931
|
-
if (event2.data.args[0]) {
|
|
8932
|
-
option.locateFile = () => event2.data.args[0].fileUrl;
|
|
8933
|
-
}
|
|
8934
|
-
init(option).then((module) => {
|
|
8935
|
-
self.PAG = module;
|
|
8936
|
-
self.postMessage({ name: event2.data.name, args: [] });
|
|
8937
|
-
});
|
|
8938
|
-
},
|
|
8939
|
-
[WorkerMessageType.PAGFile_load]: async (event2) => {
|
|
8940
|
-
const key2 = registerPAGFile(await self.PAG.PAGFile.load(event2.data.args[0]));
|
|
8941
|
-
self.postMessage({ name: event2.data.name, args: [key2] });
|
|
8942
|
-
},
|
|
8943
|
-
[WorkerMessageType.PAGView_init]: async (event2) => {
|
|
8944
|
-
const [pagFileKey, canvas, option] = event2.data.args;
|
|
8945
|
-
const key2 = registerPAGView(await self.PAG.PAGView.init(pagFiles[pagFileKey], canvas, option));
|
|
8946
|
-
self.postMessage({ name: event2.data.name, args: [key2] });
|
|
8947
|
-
},
|
|
8948
|
-
[WorkerMessageType.PAGView_destroy]: async (event2) => {
|
|
8949
|
-
const [pagViewKey] = event2.data.args;
|
|
8950
|
-
pagViews[pagViewKey].destroy();
|
|
8951
|
-
deletePAGView(pagViewKey);
|
|
8952
|
-
self.postMessage({ name: event2.data.name, args: [] });
|
|
8953
|
-
},
|
|
8954
|
-
[WorkerMessageType.PAGFile_getTextData]: async (event2) => {
|
|
8955
|
-
const [pagFileKey, editableTextIndex] = event2.data.args;
|
|
8956
|
-
const textData = pagFiles[pagFileKey].getTextData(editableTextIndex);
|
|
8957
|
-
let virtualTextData = {};
|
|
8958
|
-
for (const key2 in textData) {
|
|
8959
|
-
if (typeof textData[key2] !== "function") {
|
|
8960
|
-
virtualTextData[key2] = textData[key2];
|
|
8961
|
-
}
|
|
8962
|
-
}
|
|
8963
|
-
virtualTextData.key = registerTextData(textData);
|
|
8964
|
-
self.postMessage({ name: event2.data.name, args: [virtualTextData] });
|
|
8965
|
-
},
|
|
8966
|
-
[WorkerMessageType.PAGFile_replaceText]: async (event2) => {
|
|
8967
|
-
const [pagFileKey, editableTextIndex, virtualTextData] = event2.data.args;
|
|
8968
|
-
const textData = textDataMap[virtualTextData.key];
|
|
8969
|
-
for (const key2 in virtualTextData) {
|
|
8970
|
-
if (key2 !== "key") {
|
|
8971
|
-
textData[key2] = virtualTextData[key2];
|
|
8972
|
-
}
|
|
8973
|
-
}
|
|
8974
|
-
pagFiles[pagFileKey].replaceText(editableTextIndex, textData);
|
|
8975
|
-
self.postMessage({ name: event2.data.name, args: [] });
|
|
8976
|
-
},
|
|
8977
|
-
[WorkerMessageType.PAGFile_replaceImage]: async (event2) => {
|
|
8978
|
-
const [pagFileKey, editableImageIndex, pagImageKey] = event2.data.args;
|
|
8979
|
-
const pagImage = pagImages[pagImageKey];
|
|
8980
|
-
pagFiles[pagFileKey].replaceImage(editableImageIndex, pagImage);
|
|
8981
|
-
self.postMessage({ name: event2.data.name, args: [] });
|
|
8982
|
-
},
|
|
8983
|
-
[WorkerMessageType.PAGFile_destroy]: async (event2) => {
|
|
8984
|
-
const [pagFileKey] = event2.data.args;
|
|
8985
|
-
pagFiles[pagFileKey].destroy();
|
|
8986
|
-
deletePAGFile(pagFileKey);
|
|
8987
|
-
self.postMessage({ name: event2.data.name, args: [] });
|
|
8988
|
-
},
|
|
8989
|
-
[WorkerMessageType.PAGImage_fromSource]: async (event2) => {
|
|
8990
|
-
const [bitmap] = event2.data.args;
|
|
8991
|
-
const key2 = registerPAGImage(self.PAG.PAGImage.fromSource(bitmap));
|
|
8992
|
-
self.postMessage({ name: event2.data.name, args: [key2] });
|
|
8993
|
-
},
|
|
8994
|
-
[WorkerMessageType.PAGImage_destroy]: async (event2) => {
|
|
8995
|
-
const [pagImageKey] = event2.data.args;
|
|
8996
|
-
pagImages[pagImageKey].destroy();
|
|
8997
|
-
deletePAGImage(pagImageKey);
|
|
8998
|
-
self.postMessage({ name: event2.data.name, args: [] });
|
|
8999
|
-
},
|
|
9000
|
-
[WorkerMessageType.TextDocument_delete]: async (event2) => {
|
|
9001
|
-
const [textDataKey] = event2.data.args;
|
|
9002
|
-
textDataMap[textDataKey].delete();
|
|
9003
|
-
deleteTextData(textDataKey);
|
|
9004
|
-
self.postMessage({ name: event2.data.name, args: [] });
|
|
9005
|
-
}
|
|
9006
|
-
};
|
|
9007
|
-
const name = event.data.name.split("_")[0];
|
|
9008
|
-
if (messageHandles[name]) {
|
|
9009
|
-
messageHandles[name](event);
|
|
9010
|
-
return;
|
|
9011
|
-
}
|
|
9012
|
-
const [type, fnName] = name.split(".");
|
|
9013
|
-
const key = event.data.args[0];
|
|
9014
|
-
if (type === "PAGFile") {
|
|
9015
|
-
const pagFile = pagFiles[key];
|
|
9016
|
-
if (!pagFile)
|
|
9017
|
-
throw new Error("pagFile doesn't exist");
|
|
9018
|
-
const fn = pagFile[fnName];
|
|
9019
|
-
if (!fn)
|
|
9020
|
-
throw new Error(`PAGFile.${fnName} doesn't exist`);
|
|
9021
|
-
const res = await fn.call(pagFile, ...event.data.args.slice(1));
|
|
9022
|
-
self.postMessage({ name: event.data.name, args: [res] });
|
|
9023
|
-
return;
|
|
9024
|
-
}
|
|
9025
|
-
if (type === "PAGView") {
|
|
9026
|
-
const pagView = pagViews[key];
|
|
9027
|
-
if (!pagView)
|
|
9028
|
-
throw new Error("pagView doesn't exist");
|
|
9029
|
-
const fn = pagView[fnName];
|
|
9030
|
-
if (!fn)
|
|
9031
|
-
throw new Error(`PAGView.${fnName} doesn't exist`);
|
|
9032
|
-
const res = await fn.call(pagView, ...event.data.args.slice(1));
|
|
9033
|
-
self.postMessage({ name: event.data.name, args: [res] });
|
|
9034
|
-
return;
|
|
9035
|
-
}
|
|
9036
|
-
};
|
|
9037
|
-
};
|
|
9038
|
-
|
|
9039
8544
|
const PAGInit = (moduleOption = {}) => PAGInit$1(moduleOption).then((module) => {
|
|
9040
8545
|
PAGBind(module);
|
|
9041
8546
|
module.webAssemblyQueue = new WebAssemblyQueue();
|
|
@@ -9046,9 +8551,6 @@ const PAGInit = (moduleOption = {}) => PAGInit$1(moduleOption).then((module) =>
|
|
|
9046
8551
|
console.error(error);
|
|
9047
8552
|
throw new Error("PAGInit fail! Please check .wasm file path valid.");
|
|
9048
8553
|
});
|
|
9049
|
-
if (WORKER$1) {
|
|
9050
|
-
workerInit(PAGInit);
|
|
9051
|
-
}
|
|
9052
8554
|
|
|
9053
8555
|
exports.PAGInit = PAGInit;
|
|
9054
8556
|
exports.types = types;
|