@cesium/engine 18.3.1-ion.0 → 19.0.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.
Files changed (171) hide show
  1. package/Build/ThirdParty/Workers/z-worker-pako.js +75 -91
  2. package/Build/Workers/{chunk-VOGSSU24.js → chunk-23FRF5ZP.js} +9 -9
  3. package/Build/Workers/{chunk-AZK5KSZ4.js → chunk-25USKS4R.js} +6 -6
  4. package/Build/Workers/{chunk-4B4HLHFO.js → chunk-34DFERFC.js} +12 -12
  5. package/Build/Workers/{chunk-HTB5PIYZ.js → chunk-37IYBZDZ.js} +9 -9
  6. package/Build/Workers/{chunk-NZVPOOOT.js → chunk-4NRFVAG2.js} +5 -5
  7. package/Build/Workers/{chunk-QXOWDZYZ.js → chunk-4QWLEG4L.js} +14 -14
  8. package/Build/Workers/{chunk-XW6DEZZE.js → chunk-5VPO47LB.js} +8 -8
  9. package/Build/Workers/{chunk-FKO2XRXZ.js → chunk-5YCDPN3O.js} +1 -1
  10. package/Build/Workers/{chunk-HRF2GFMF.js → chunk-6T2PQKYP.js} +4 -4
  11. package/Build/Workers/{chunk-IDHHSZTD.js → chunk-AABNX23Q.js} +5 -5
  12. package/Build/Workers/{chunk-6FY4D6KD.js → chunk-AZPKFL5X.js} +5 -5
  13. package/Build/Workers/{chunk-HQCLIHYE.js → chunk-C36VNKTH.js} +4 -4
  14. package/Build/Workers/{chunk-AX3B4SGH.js → chunk-DAHXCIOX.js} +8 -8
  15. package/Build/Workers/{chunk-QKYGO6XL.js → chunk-DNCRKMCI.js} +6 -6
  16. package/Build/Workers/{chunk-S2BFGC4W.js → chunk-DPFAUGBE.js} +2 -2
  17. package/Build/Workers/{chunk-ADA7OX2I.js → chunk-DXYAD4ED.js} +1 -1
  18. package/Build/Workers/{chunk-Z2GDV3MT.js → chunk-E6NMEKSS.js} +4 -4
  19. package/Build/Workers/{chunk-52DTHTKR.js → chunk-ECWQXDZY.js} +16 -16
  20. package/Build/Workers/{chunk-NGFYQUAX.js → chunk-ESDVZ4QL.js} +10 -10
  21. package/Build/Workers/{chunk-BF2HFWMG.js → chunk-ETCPCGKC.js} +2 -2
  22. package/Build/Workers/{chunk-SKVVOFGK.js → chunk-EV4PBU7O.js} +1 -1
  23. package/Build/Workers/{chunk-XLDLCV2F.js → chunk-FQNSMOZT.js} +4 -4
  24. package/Build/Workers/{chunk-76WKZOUK.js → chunk-GO3IRH6U.js} +6 -6
  25. package/Build/Workers/{chunk-UXCG22U4.js → chunk-GVO3YIU2.js} +4 -4
  26. package/Build/Workers/{chunk-SMLHKQNB.js → chunk-HHHBRTSW.js} +9 -9
  27. package/Build/Workers/{chunk-UHLWUS37.js → chunk-HJ6KFRM7.js} +16 -16
  28. package/Build/Workers/{chunk-JUYK3CDA.js → chunk-IE2BEHLE.js} +12 -12
  29. package/Build/Workers/{chunk-IYXAFSJX.js → chunk-JZVUMRYA.js} +13 -13
  30. package/Build/Workers/{chunk-E7KSST7M.js → chunk-K5VGMGFM.js} +7 -7
  31. package/Build/Workers/{chunk-DILVD7VK.js → chunk-KTDHOEXR.js} +1 -1
  32. package/Build/Workers/{chunk-TLR6NX6R.js → chunk-MBDKO456.js} +5 -5
  33. package/Build/Workers/{chunk-WMSBRWGI.js → chunk-MUL374P3.js} +2 -2
  34. package/Build/Workers/{chunk-QREBKKN5.js → chunk-NKM2EV46.js} +1 -1
  35. package/Build/Workers/{chunk-2XJLU3UN.js → chunk-NMAT4IJ6.js} +7 -7
  36. package/Build/Workers/{chunk-7G2O6QH3.js → chunk-PAH73ETP.js} +5 -5
  37. package/Build/Workers/{chunk-G2VBRELF.js → chunk-Q2QXUN33.js} +2 -2
  38. package/Build/Workers/{chunk-B3LHDD7Q.js → chunk-RIQM3XY5.js} +4 -4
  39. package/Build/Workers/{chunk-ILTPHRDS.js → chunk-RZJA77TX.js} +6 -6
  40. package/Build/Workers/{chunk-MIUZNGES.js → chunk-SO2Z6H6F.js} +2 -2
  41. package/Build/Workers/{chunk-UX2S2KIQ.js → chunk-SOYVF5RC.js} +2 -2
  42. package/Build/Workers/{chunk-VFEUHPSM.js → chunk-SVGHDIZG.js} +5 -5
  43. package/Build/Workers/{chunk-NL2YZDVI.js → chunk-SXMHGVZ7.js} +12 -12
  44. package/Build/Workers/{chunk-S2JHBHWB.js → chunk-T7C73J6H.js} +4 -4
  45. package/Build/Workers/{chunk-KGB6H3RI.js → chunk-UPU755HO.js} +12 -12
  46. package/Build/Workers/{chunk-IHRAESIS.js → chunk-VCCR35R6.js} +11 -11
  47. package/Build/Workers/{chunk-QMKOMHVM.js → chunk-W32QSECR.js} +6 -6
  48. package/Build/Workers/{chunk-3UEVA4NO.js → chunk-WUMTX3FI.js} +6 -6
  49. package/Build/Workers/{chunk-2Y2IF6ZP.js → chunk-XUYCCEG6.js} +5 -5
  50. package/Build/Workers/{chunk-Q6SJKTTQ.js → chunk-Y3PM6G2V.js} +3 -3
  51. package/Build/Workers/{chunk-FBPIDRZN.js → chunk-Y6LLFNXN.js} +10 -10
  52. package/Build/Workers/{chunk-ERTHACXD.js → chunk-YPNIIVIF.js} +6 -6
  53. package/Build/Workers/{chunk-EZUKH7KU.js → chunk-ZNEIUXBK.js} +7 -7
  54. package/Build/Workers/combineGeometry.js +21 -21
  55. package/Build/Workers/createBoxGeometry.js +15 -15
  56. package/Build/Workers/createBoxOutlineGeometry.js +13 -13
  57. package/Build/Workers/createCircleGeometry.js +23 -23
  58. package/Build/Workers/createCircleOutlineGeometry.js +16 -16
  59. package/Build/Workers/createCoplanarPolygonGeometry.js +30 -30
  60. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +28 -28
  61. package/Build/Workers/createCorridorGeometry.js +26 -26
  62. package/Build/Workers/createCorridorOutlineGeometry.js +25 -25
  63. package/Build/Workers/createCylinderGeometry.js +17 -17
  64. package/Build/Workers/createCylinderOutlineGeometry.js +15 -15
  65. package/Build/Workers/createEllipseGeometry.js +23 -23
  66. package/Build/Workers/createEllipseOutlineGeometry.js +16 -16
  67. package/Build/Workers/createEllipsoidGeometry.js +16 -16
  68. package/Build/Workers/createEllipsoidOutlineGeometry.js +15 -15
  69. package/Build/Workers/createFrustumGeometry.js +15 -15
  70. package/Build/Workers/createFrustumOutlineGeometry.js +15 -15
  71. package/Build/Workers/createGeometry.js +21 -21
  72. package/Build/Workers/createGroundPolylineGeometry.js +19 -19
  73. package/Build/Workers/createPlaneGeometry.js +13 -13
  74. package/Build/Workers/createPlaneOutlineGeometry.js +12 -12
  75. package/Build/Workers/createPolygonGeometry.js +29 -29
  76. package/Build/Workers/createPolygonOutlineGeometry.js +27 -27
  77. package/Build/Workers/createPolylineGeometry.js +22 -22
  78. package/Build/Workers/createPolylineVolumeGeometry.js +28 -28
  79. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +24 -24
  80. package/Build/Workers/createRectangleGeometry.js +24 -24
  81. package/Build/Workers/createRectangleOutlineGeometry.js +17 -17
  82. package/Build/Workers/createSimplePolylineGeometry.js +20 -20
  83. package/Build/Workers/createSphereGeometry.js +16 -16
  84. package/Build/Workers/createSphereOutlineGeometry.js +15 -15
  85. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  86. package/Build/Workers/createVectorTileClampedPolylines.js +12 -12
  87. package/Build/Workers/createVectorTileGeometries.js +21 -21
  88. package/Build/Workers/createVectorTilePoints.js +11 -11
  89. package/Build/Workers/createVectorTilePolygons.js +19 -19
  90. package/Build/Workers/createVectorTilePolylines.js +12 -12
  91. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +19 -19
  92. package/Build/Workers/createVerticesFromHeightmap.js +19 -19
  93. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +16 -16
  94. package/Build/Workers/createWallGeometry.js +21 -21
  95. package/Build/Workers/createWallOutlineGeometry.js +20 -20
  96. package/Build/Workers/decodeDraco.js +10 -10
  97. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  98. package/Build/Workers/decodeI3S.js +9 -9
  99. package/Build/Workers/gaussianSplatSorter.js +4 -4
  100. package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
  101. package/Build/Workers/transcodeKTX2.js +6 -6
  102. package/Build/Workers/transferTypedArrayTest.js +1 -1
  103. package/Build/Workers/upsampleQuantizedTerrainMesh.js +19 -19
  104. package/LICENSE.md +32 -25
  105. package/Source/Core/ITwinPlatform.js +8 -1
  106. package/Source/Core/Ion.js +1 -1
  107. package/Source/Core/ScreenSpaceEventHandler.js +3 -3
  108. package/Source/Core/addAllToArray.js +40 -0
  109. package/Source/DataSources/StaticGroundGeometryPerMaterialBatch.js +54 -26
  110. package/Source/Renderer/Context.js +8 -4
  111. package/Source/Renderer/Renderbuffer.js +4 -2
  112. package/Source/Renderer/Sampler.js +13 -0
  113. package/Source/Renderer/ShaderBuilder.js +7 -6
  114. package/Source/Renderer/SharedContext.js +186 -0
  115. package/Source/Renderer/Texture.js +4 -5
  116. package/Source/Renderer/Texture3D.js +17 -7
  117. package/Source/Scene/ArcGisMapService.js +1 -1
  118. package/Source/Scene/BillboardCollection.js +1 -1
  119. package/Source/Scene/Cesium3DTileBatchTable.js +6 -4
  120. package/Source/Scene/Cesium3DTileStyle.js +4 -3
  121. package/Source/Scene/Cesium3DTileset.js +1 -1
  122. package/Source/Scene/ConditionsExpression.js +3 -2
  123. package/Source/Scene/GaussianSplatPrimitive.js +1 -1
  124. package/Source/Scene/GltfLoader.js +3 -2
  125. package/Source/Scene/GltfPipeline/ForEach.js +7 -7
  126. package/Source/Scene/GltfPipeline/addDefaults.js +1 -2
  127. package/Source/Scene/GltfPipeline/addToArray.js +2 -0
  128. package/Source/Scene/GltfPipeline/findAccessorMinMax.js +1 -1
  129. package/Source/Scene/GltfPipeline/getComponentReader.js +16 -16
  130. package/Source/Scene/GltfPipeline/moveTechniqueRenderStates.js +1 -1
  131. package/Source/Scene/GltfPipeline/moveTechniquesToExtension.js +3 -3
  132. package/Source/Scene/GltfPipeline/parseGlb.js +1 -1
  133. package/Source/Scene/GltfPipeline/readAccessorPacked.js +2 -2
  134. package/Source/Scene/GltfPipeline/removeUnusedElements.js +5 -6
  135. package/Source/Scene/GltfPipeline/updateAccessorComponentTypes.js +1 -1
  136. package/Source/Scene/GltfPipeline/updateVersion.js +13 -13
  137. package/Source/Scene/GltfSpzLoader.js +3 -1
  138. package/Source/Scene/HeightReference.js +1 -1
  139. package/Source/Scene/ITwinData.js +97 -34
  140. package/Source/Scene/ImageBasedLighting.js +6 -2
  141. package/Source/Scene/ImageryLayer.js +10 -10
  142. package/Source/Scene/MetadataTableProperty.js +2 -1
  143. package/Source/Scene/Model/ClassificationModelDrawCommand.js +7 -6
  144. package/Source/Scene/Model/GeoJsonLoader.js +3 -1
  145. package/Source/Scene/Model/ImageryConfiguration.js +1 -0
  146. package/Source/Scene/Model/ImageryPipelineStage.js +8 -2
  147. package/Source/Scene/Model/InstancingPipelineStage.js +3 -8
  148. package/Source/Scene/Model/MaterialPipelineStage.js +10 -1
  149. package/Source/Scene/Model/ModelImagery.js +3 -0
  150. package/Source/Scene/Model/ModelSceneGraph.js +2 -1
  151. package/Source/Scene/Picking.js +41 -1
  152. package/Source/Scene/Primitive.js +0 -1
  153. package/Source/Scene/PrimitiveCollection.js +32 -6
  154. package/Source/Scene/PrimitiveLoadPlan.js +0 -36
  155. package/Source/Scene/PropertyTable.js +7 -12
  156. package/Source/Scene/Scene.js +41 -32
  157. package/Source/Scene/ScreenSpaceCameraController.js +2 -0
  158. package/Source/Shaders/Builtin/Functions/modelToWindowCoordinates.glsl +2 -1
  159. package/Source/Shaders/Builtin/Functions/modelToWindowCoordinates.js +2 -1
  160. package/Source/Shaders/EllipsoidVS.glsl +4 -4
  161. package/Source/Shaders/EllipsoidVS.js +4 -4
  162. package/Source/Shaders/FXAA3_11.glsl +2 -0
  163. package/Source/Shaders/FXAA3_11.js +2 -0
  164. package/Source/Shaders/GlobeVS.glsl +2 -1
  165. package/Source/Shaders/GlobeVS.js +2 -1
  166. package/Source/Shaders/SkyAtmosphereVS.glsl +2 -1
  167. package/Source/Shaders/SkyAtmosphereVS.js +2 -1
  168. package/Source/ThirdParty/Workers/z-worker-pako.js +1 -1
  169. package/index.d.ts +82 -53
  170. package/index.js +244 -242
  171. package/package.json +3 -3
@@ -7,8 +7,6 @@ import BufferUsage from "../Renderer/BufferUsage.js";
7
7
  import AttributeType from "./AttributeType.js";
8
8
  import ModelComponents from "./ModelComponents.js";
9
9
  import PrimitiveOutlineGenerator from "./Model/PrimitiveOutlineGenerator.js";
10
- import VertexAttributeSemantic from "./VertexAttributeSemantic.js";
11
- import ModelUtility from "./Model/ModelUtility.js";
12
10
 
13
11
  /**
14
12
  * Simple struct for tracking whether an attribute will be loaded as a buffer
@@ -187,7 +185,6 @@ PrimitiveLoadPlan.prototype.postProcess = function (context) {
187
185
  }
188
186
 
189
187
  if (this.needsGaussianSplats) {
190
- prepareSpzData(this, context);
191
188
  setupGaussianSplatBuffers(this, context);
192
189
  }
193
190
  };
@@ -242,39 +239,6 @@ function makeOutlineCoordinatesAttribute(outlineCoordinatesTypedArray) {
242
239
  return attribute;
243
240
  }
244
241
 
245
- function prepareSpzData(loadPlan, context) {
246
- const position = ModelUtility.getAttributeBySemantic(
247
- loadPlan.primitive,
248
- VertexAttributeSemantic.POSITION,
249
- );
250
-
251
- for (let i = 0; i < position.typedArray.length; i += 3) {
252
- position.typedArray[i + 1] = -position.typedArray[i + 1];
253
- position.typedArray[i + 2] = -position.typedArray[i + 2];
254
- }
255
-
256
- const rotations = ModelUtility.getAttributeBySemantic(
257
- loadPlan.primitive,
258
- VertexAttributeSemantic.ROTATION,
259
- );
260
-
261
- //180* rotation around X.
262
- //Temporary until we can get SPZ supporting Z-up assets natively
263
- const rots = rotations.typedArray;
264
- for (let q = 0; q < rots.length; q += 4) {
265
- const w = rots[q];
266
- const x = -rots[q + 3];
267
- const y = rots[q + 2];
268
- const z = -rots[q + 1];
269
-
270
- rots[q] = y;
271
- rots[q + 1] = -x;
272
- rots[q + 2] = w;
273
- rots[q + 3] = -z;
274
- }
275
- rotations.typedArray = rots;
276
- }
277
-
278
242
  function setupGaussianSplatBuffers(loadPlan, context) {
279
243
  const attributePlans = loadPlan.attributePlans;
280
244
  const attrLen = attributePlans.length;
@@ -3,6 +3,7 @@ import Frozen from "../Core/Frozen.js";
3
3
  import DeveloperError from "../Core/DeveloperError.js";
4
4
  import defined from "../Core/defined.js";
5
5
  import JsonMetadataTable from "./JsonMetadataTable.js";
6
+ import addAllToArray from "../Core/addAllToArray.js";
6
7
 
7
8
  /**
8
9
  * A property table for use with the <code>EXT_structural_metadata</code> extension or
@@ -296,24 +297,18 @@ PropertyTable.prototype.getPropertyIds = function (index, results) {
296
297
 
297
298
  if (defined(this._metadataTable)) {
298
299
  // concat in place to avoid unnecessary array allocation
299
- results.push.apply(
300
- results,
301
- this._metadataTable.getPropertyIds(scratchResults),
302
- );
300
+ const ids = this._metadataTable.getPropertyIds(scratchResults);
301
+ addAllToArray(results, ids);
303
302
  }
304
303
 
305
304
  if (defined(this._batchTableHierarchy)) {
306
- results.push.apply(
307
- results,
308
- this._batchTableHierarchy.getPropertyIds(index, scratchResults),
309
- );
305
+ const ids = this._batchTableHierarchy.getPropertyIds(index, scratchResults);
306
+ addAllToArray(results, ids);
310
307
  }
311
308
 
312
309
  if (defined(this._jsonMetadataTable)) {
313
- results.push.apply(
314
- results,
315
- this._jsonMetadataTable.getPropertyIds(scratchResults),
316
- );
310
+ const ids = this._jsonMetadataTable.getPropertyIds(scratchResults);
311
+ addAllToArray(results, ids);
317
312
  }
318
313
 
319
314
  return results;
@@ -68,6 +68,7 @@ import SceneTransforms from "./SceneTransforms.js";
68
68
  import SceneTransitioner from "./SceneTransitioner.js";
69
69
  import ScreenSpaceCameraController from "./ScreenSpaceCameraController.js";
70
70
  import ShadowMap from "./ShadowMap.js";
71
+ import SharedContext from "../Renderer/SharedContext.js";
71
72
  import SpecularEnvironmentCubeMap from "./SpecularEnvironmentCubeMap.js";
72
73
  import StencilConstants from "./StencilConstants.js";
73
74
  import SunLight from "./SunLight.js";
@@ -132,15 +133,22 @@ function Scene(options) {
132
133
  let creditContainer = options.creditContainer;
133
134
  let creditViewport = options.creditViewport;
134
135
 
135
- const contextOptions = clone(options.contextOptions);
136
-
137
136
  //>>includeStart('debug', pragmas.debug);
138
137
  if (!defined(canvas)) {
139
138
  throw new DeveloperError("options and options.canvas are required.");
140
139
  }
141
140
  //>>includeEnd('debug');
141
+
142
+ const countReferences = options.contextOptions instanceof SharedContext;
143
+ if (countReferences) {
144
+ this._context = options.contextOptions.createSceneContext(canvas);
145
+ } else {
146
+ const contextOptions = clone(options.contextOptions);
147
+ this._context = new Context(canvas, contextOptions);
148
+ }
149
+ const context = this._context;
150
+
142
151
  const hasCreditContainer = defined(creditContainer);
143
- const context = new Context(canvas, contextOptions);
144
152
  if (!hasCreditContainer) {
145
153
  creditContainer = document.createElement("div");
146
154
  creditContainer.style.position = "absolute";
@@ -167,14 +175,13 @@ function Scene(options) {
167
175
  this._creditContainer = creditContainer;
168
176
 
169
177
  this._canvas = canvas;
170
- this._context = context;
171
178
  this._computeEngine = new ComputeEngine(context);
172
179
 
173
180
  this._ellipsoid = options.ellipsoid ?? Ellipsoid.default;
174
181
  this._globe = undefined;
175
182
  this._globeTranslucencyState = new GlobeTranslucencyState();
176
- this._primitives = new PrimitiveCollection();
177
- this._groundPrimitives = new PrimitiveCollection();
183
+ this._primitives = new PrimitiveCollection({ countReferences });
184
+ this._groundPrimitives = new PrimitiveCollection({ countReferences });
178
185
 
179
186
  this._globeHeight = undefined;
180
187
  this._globeHeightDirty = true;
@@ -276,7 +283,7 @@ function Scene(options) {
276
283
  /**
277
284
  * The {@link SkyBox} used to draw the stars.
278
285
  *
279
- * @type {SkyBox}
286
+ * @type {SkyBox | undefined}
280
287
  * @default undefined
281
288
  *
282
289
  * @see Scene#backgroundColor
@@ -286,7 +293,7 @@ function Scene(options) {
286
293
  /**
287
294
  * The sky atmosphere drawn around the globe.
288
295
  *
289
- * @type {SkyAtmosphere}
296
+ * @type {SkyAtmosphere | undefined}
290
297
  * @default undefined
291
298
  */
292
299
  this.skyAtmosphere = undefined;
@@ -294,7 +301,7 @@ function Scene(options) {
294
301
  /**
295
302
  * The {@link Sun}.
296
303
  *
297
- * @type {Sun}
304
+ * @type {Sun | undefined}
298
305
  * @default undefined
299
306
  */
300
307
  this.sun = undefined;
@@ -311,13 +318,13 @@ function Scene(options) {
311
318
  /**
312
319
  * The {@link Moon}
313
320
  *
314
- * @type Moon
321
+ * @type {Moon | undefined}
315
322
  * @default undefined
316
323
  */
317
324
  this.moon = undefined;
318
325
 
319
326
  /**
320
- * The background color, which is only visible if there is no sky box, i.e., {@link Scene#skyBox} is undefined.
327
+ * The background color, which is only visible if there is no sky box, i.e., {@link Scene#skyBox} is <code>undefined</code>.
321
328
  *
322
329
  * @type {Color}
323
330
  * @default {@link Color.BLACK}
@@ -406,7 +413,7 @@ function Scene(options) {
406
413
  * The default is <code>undefined</code>, indicating that all commands are executed.
407
414
  * </p>
408
415
  *
409
- * @type Function
416
+ * @type {Function | undefined}
410
417
  *
411
418
  * @default undefined
412
419
  *
@@ -1306,11 +1313,11 @@ Object.defineProperties(Scene.prototype, {
1306
1313
  },
1307
1314
 
1308
1315
  /**
1309
- * Gets the simulation time when the scene was last rendered. Returns undefined if the scene has not yet been
1310
- * rendered.
1316
+ * Gets the simulation time when the scene was last rendered. Returns <code>undefined</code>
1317
+ * if the scene has not yet been rendered.
1311
1318
  * @memberof Scene.prototype
1312
1319
  *
1313
- * @type {JulianDate}
1320
+ * @type {JulianDate | undefined}
1314
1321
  * @readonly
1315
1322
  */
1316
1323
  lastRenderTime: {
@@ -1343,7 +1350,7 @@ Object.defineProperties(Scene.prototype, {
1343
1350
  *
1344
1351
  * @memberof Scene.prototype
1345
1352
  *
1346
- * @type {object}
1353
+ * @type {Object | undefined}
1347
1354
  * @readonly
1348
1355
  *
1349
1356
  * @default undefined
@@ -4202,6 +4209,8 @@ function render(scene) {
4202
4209
  passState.scissorTest = undefined;
4203
4210
  passState.viewport = BoundingRectangle.clone(viewport, passState.viewport);
4204
4211
 
4212
+ context.beginFrame();
4213
+
4205
4214
  if (defined(scene.globe)) {
4206
4215
  scene.globe.beginFrame(frameState);
4207
4216
  }
@@ -4371,8 +4380,8 @@ Scene.prototype.clampLineWidth = function (width) {
4371
4380
  };
4372
4381
 
4373
4382
  /**
4374
- * Returns an object with a `primitive` property that contains the first (top) primitive in the scene
4375
- * at a particular window coordinate or undefined if nothing is at the location. Other properties may
4383
+ * Returns an object with a <code>primitive</code> property that contains the first (top) primitive in the scene
4384
+ * at a particular window coordinate or <code>undefined</code> if nothing is at the location. Other properties may
4376
4385
  * potentially be set depending on the type of primitive and may be used to further identify the picked object.
4377
4386
  * <p>
4378
4387
  * When a feature of a 3D Tiles tileset is picked, <code>pick</code> returns a {@link Cesium3DTileFeature} object.
@@ -4390,7 +4399,7 @@ Scene.prototype.clampLineWidth = function (width) {
4390
4399
  * @param {Cartesian2} windowPosition Window coordinates to perform picking on.
4391
4400
  * @param {number} [width=3] Width of the pick rectangle.
4392
4401
  * @param {number} [height=3] Height of the pick rectangle.
4393
- * @returns {object} Object containing the picked primitive.
4402
+ * @returns {Object | undefined} Object containing the picked primitive or <code>undefined</code> if nothing is at the location.
4394
4403
  */
4395
4404
  Scene.prototype.pick = function (windowPosition, width, height) {
4396
4405
  return this._picking.pick(this, windowPosition, width, height);
@@ -4398,7 +4407,7 @@ Scene.prototype.pick = function (windowPosition, width, height) {
4398
4407
 
4399
4408
  /**
4400
4409
  * Returns a {@link VoxelCell} for the voxel sample rendered at a particular window coordinate,
4401
- * or undefined if no voxel is rendered at that position.
4410
+ * or <code>undefined</code> if no voxel is rendered at that position.
4402
4411
  *
4403
4412
  * @example
4404
4413
  * On left click, report the value of the "color" property at that voxel sample.
@@ -4412,7 +4421,7 @@ Scene.prototype.pick = function (windowPosition, width, height) {
4412
4421
  * @param {Cartesian2} windowPosition Window coordinates to perform picking on.
4413
4422
  * @param {number} [width=3] Width of the pick rectangle.
4414
4423
  * @param {number} [height=3] Height of the pick rectangle.
4415
- * @returns {VoxelCell|undefined} Information about the voxel cell rendered at the picked position.
4424
+ * @returns {VoxelCell|undefined} Information about the voxel cell rendered at the picked position or <code>undefined</code> if no voxel is rendered at that position.
4416
4425
  *
4417
4426
  * @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
4418
4427
  */
@@ -4454,13 +4463,13 @@ Scene.prototype.pickVoxel = function (windowPosition, width, height) {
4454
4463
  *
4455
4464
  * @param {Cartesian2} windowPosition Window coordinates to perform picking on.
4456
4465
  * @param {string|undefined} schemaId The ID of the metadata schema to pick values
4457
- * from. If this is `undefined`, then it will pick the values from the object
4466
+ * from. If this is <code>undefined</code>, then it will pick the values from the object
4458
4467
  * that match the given class- and property name, regardless of the schema ID.
4459
4468
  * @param {string} className The name of the metadata class to pick
4460
4469
  * values from
4461
4470
  * @param {string} propertyName The name of the metadata property to pick
4462
4471
  * values from
4463
- * @returns {MetadataValue|undefined} The metadata value, or `undefined` when
4472
+ * @returns {MetadataValue|undefined} The metadata value, or <code>undefined</code> when
4464
4473
  * no matching metadata was found at the given position
4465
4474
  *
4466
4475
  * @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
@@ -4529,7 +4538,7 @@ Scene.prototype.pickMetadata = function (
4529
4538
  * Pick the schema of the metadata of the object at the given position
4530
4539
  *
4531
4540
  * @param {Cartesian2} windowPosition Window coordinates to perform picking on.
4532
- * @returns {MetadataSchema} The metadata schema, or `undefined` if there is no object with
4541
+ * @returns {MetadataSchema | undefined} The metadata schema, or <code>undefined</code> if there is no object with
4533
4542
  * associated metadata at the given position.
4534
4543
  *
4535
4544
  * @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
@@ -4598,7 +4607,7 @@ Scene.prototype.pickPosition = function (windowPosition, result) {
4598
4607
  };
4599
4608
 
4600
4609
  /**
4601
- * Returns a list of objects, each containing a `primitive` property, for all primitives at
4610
+ * Returns a list of objects, each containing a <code>primitive</code> property, for all primitives at
4602
4611
  * a particular window coordinate position. Other properties may also be set depending on the
4603
4612
  * type of primitive and may be used to further identify the picked object. The primitives in
4604
4613
  * the list are ordered by their visual order in the scene (front to back).
@@ -4667,7 +4676,7 @@ function updateRequestRenderModeDeferCheckPass(scene) {
4667
4676
  * @param {Ray} ray The ray.
4668
4677
  * @param {Object[]} [objectsToExclude] A list of primitives, entities, or 3D Tiles features to exclude from the ray intersection.
4669
4678
  * @param {number} [width=0.1] Width of the intersection volume in meters.
4670
- * @returns {object} An object containing the object and position of the first intersection.
4679
+ * @returns {object | undefined} An object containing the object and position of the first intersection or <code>undefined</code> if there are no intersections.
4671
4680
  *
4672
4681
  * @exception {DeveloperError} Ray intersections are only supported in 3D mode.
4673
4682
  */
@@ -4778,7 +4787,7 @@ Scene.prototype.drillPickFromRayMostDetailed = function (
4778
4787
  * @param {Cartographic} position The cartographic position to sample height from.
4779
4788
  * @param {Object[]} [objectsToExclude] A list of primitives, entities, or 3D Tiles features to not sample height from.
4780
4789
  * @param {number} [width=0.1] Width of the intersection volume in meters.
4781
- * @returns {number} The height. This may be <code>undefined</code> if there was no scene geometry to sample height from.
4790
+ * @returns {number | undefined} The height. This may be <code>undefined</code> if there was no scene geometry to sample height from.
4782
4791
  *
4783
4792
  * @example
4784
4793
  * const position = new Cesium.Cartographic(-1.31968, 0.698874);
@@ -4809,7 +4818,7 @@ Scene.prototype.sampleHeight = function (position, objectsToExclude, width) {
4809
4818
  * @param {Object[]} [objectsToExclude] A list of primitives, entities, or 3D Tiles features to not clamp to.
4810
4819
  * @param {number} [width=0.1] Width of the intersection volume in meters.
4811
4820
  * @param {Cartesian3} [result] An optional object to return the clamped position.
4812
- * @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided. This may be <code>undefined</code> if there was no scene geometry to clamp to.
4821
+ * @returns {Cartesian3 | undefined} The modified result parameter or a new Cartesian3 instance if one was not provided. This may be <code>undefined</code> if there was no scene geometry to clamp to.
4813
4822
  *
4814
4823
  * @example
4815
4824
  * // Clamp an entity to the underlying scene geometry
@@ -4843,12 +4852,12 @@ Scene.prototype.clampToHeight = function (
4843
4852
  * using the maximum level of detail for 3D Tilesets in the scene. The height of the input positions is ignored.
4844
4853
  * Returns a promise that is resolved when the query completes. Each point height is modified in place.
4845
4854
  * If a height cannot be determined because no geometry can be sampled at that location, or another error occurs,
4846
- * the height is set to undefined.
4855
+ * the height is set to <code>undefined</code>.
4847
4856
  *
4848
4857
  * @param {Cartographic[]} positions The cartographic positions to update with sampled heights.
4849
4858
  * @param {Object[]} [objectsToExclude] A list of primitives, entities, or 3D Tiles features to not sample height from.
4850
4859
  * @param {number} [width=0.1] Width of the intersection volume in meters.
4851
- * @returns {Promise<Cartographic[]>} A promise that resolves to the provided list of positions when the query has completed.
4860
+ * @returns {Promise<Array<Cartographic | undefined>>} A promise that resolves to the provided list of positions when the query has completed. Positions may become <code>undefined</code> if the height cannot be determined.
4852
4861
  *
4853
4862
  * @example
4854
4863
  * const positions = [
@@ -4888,7 +4897,7 @@ Scene.prototype.sampleHeightMostDetailed = function (
4888
4897
  * @param {Cartesian3[]} cartesians The cartesian positions to update with clamped positions.
4889
4898
  * @param {Object[]} [objectsToExclude] A list of primitives, entities, or 3D Tiles features to not clamp to.
4890
4899
  * @param {number} [width=0.1] Width of the intersection volume in meters.
4891
- * @returns {Promise<Cartesian3[]>} A promise that resolves to the provided list of positions when the query has completed.
4900
+ * @returns {Promise<Array<Cartesian3 | undefined>>} A promise that resolves to the provided list of positions when the query has completed. Positions may become <code>undefined</code> if they cannot be clamped.
4892
4901
  *
4893
4902
  * @example
4894
4903
  * const cartesians = [
@@ -4925,7 +4934,7 @@ Scene.prototype.clampToHeightMostDetailed = function (
4925
4934
  *
4926
4935
  * @param {Cartesian3} position The position in cartesian coordinates.
4927
4936
  * @param {Cartesian2} [result] An optional object to return the input position transformed to canvas coordinates.
4928
- * @returns {Cartesian2} The modified result parameter or a new Cartesian2 instance if one was not provided. This may be <code>undefined</code> if the input position is near the center of the ellipsoid.
4937
+ * @returns {Cartesian2 | undefined} The modified result parameter or a new Cartesian2 instance if one was not provided. This may be <code>undefined</code> if the input position is near the center of the ellipsoid.
4929
4938
  *
4930
4939
  * @example
4931
4940
  * // Output the canvas position of longitude/latitude (0, 0) every time the mouse moves.
@@ -266,6 +266,8 @@ function ScreenSpaceCameraController(scene) {
266
266
  this._minimumTrackBallHeight = this.minimumTrackBallHeight;
267
267
  /**
268
268
  * When disabled, the values of <code>maximumZoomDistance</code> and <code>minimumZoomDistance</code> are ignored.
269
+ * Also used in conjunction with {@link Cesium3DTileset#enableCollision} to prevent the camera from moving through or below a 3D Tileset surface.
270
+ * This may also affect clamping behavior when using {@link HeightReference.CLAMP_TO_GROUND} on 3D Tiles.
269
271
  * @type {boolean}
270
272
  * @default true
271
273
  */
@@ -30,7 +30,8 @@
30
30
  */
31
31
  vec4 czm_modelToWindowCoordinates(vec4 position)
32
32
  {
33
- vec4 q = czm_modelViewProjection * position; // clip coordinates
33
+ vec4 positionEC = czm_modelView * position;
34
+ vec4 q = czm_projection * positionEC;
34
35
  q.xyz /= q.w; // normalized device coordinates
35
36
  q.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz; // window coordinates
36
37
  return q;
@@ -31,7 +31,8 @@ export default "/**\n\
31
31
  */\n\
32
32
  vec4 czm_modelToWindowCoordinates(vec4 position)\n\
33
33
  {\n\
34
- vec4 q = czm_modelViewProjection * position; // clip coordinates\n\
34
+ vec4 positionEC = czm_modelView * position;\n\
35
+ vec4 q = czm_projection * positionEC;\n\
35
36
  q.xyz /= q.w; // normalized device coordinates\n\
36
37
  q.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz; // window coordinates\n\
37
38
  return q;\n\
@@ -11,10 +11,10 @@ void main()
11
11
  // but doing it here allows us to change the radii without rewriting the vertex data, and
12
12
  // allows all ellipsoids to reuse the same vertex data.
13
13
  vec4 p = vec4(u_radii * position, 1.0);
14
-
15
- v_positionEC = (czm_modelView * p).xyz; // position in eye coordinates
16
- gl_Position = czm_modelViewProjection * p; // position in clip coordinates
17
-
14
+
15
+ vec4 pEC = czm_modelView * p;
16
+ v_positionEC = pEC.xyz; // position in eye coordinates
17
+ gl_Position = czm_projection * pEC;
18
18
  // With multi-frustum, when the ellipsoid primitive is positioned on the intersection of two frustums
19
19
  // and close to terrain, the terrain (writes depth) in the closest frustum can overwrite part of the
20
20
  // ellipsoid (does not write depth) that was rendered in the farther frustum.
@@ -12,10 +12,10 @@ void main()\n\
12
12
  // but doing it here allows us to change the radii without rewriting the vertex data, and\n\
13
13
  // allows all ellipsoids to reuse the same vertex data.\n\
14
14
  vec4 p = vec4(u_radii * position, 1.0);\n\
15
- \n\
16
- v_positionEC = (czm_modelView * p).xyz; // position in eye coordinates\n\
17
- gl_Position = czm_modelViewProjection * p; // position in clip coordinates\n\
18
- \n\
15
+ \n\
16
+ vec4 pEC = czm_modelView * p;\n\
17
+ v_positionEC = pEC.xyz; // position in eye coordinates\n\
18
+ gl_Position = czm_projection * pEC;\n\
19
19
  // With multi-frustum, when the ellipsoid primitive is positioned on the intersection of two frustums\n\
20
20
  // and close to terrain, the terrain (writes depth) in the closest frustum can overwrite part of the\n\
21
21
  // ellipsoid (does not write depth) that was rendered in the farther frustum.\n\
@@ -28,7 +28,9 @@
28
28
  */
29
29
 
30
30
  // NVIDIA GameWorks Graphics Samples GitHub link: https://github.com/NVIDIAGameWorks/GraphicsSamples
31
+ // Original source (archived): https://archive.org/details/nvidiagame-works-graphics-samples-master
31
32
  // Original FXAA 3.11 shader link: https://github.com/NVIDIAGameWorks/GraphicsSamples/blob/master/samples/es3-kepler/FXAA/FXAA3_11.h
33
+ // Shader link in fork: https://github.com/lyntel/GraphicsSamples/blob/3d30817ebeeade64fe6a4fc3aa1fe4265c29b6fd/samples/es3-kepler/FXAA/FXAA3_11.h
32
34
 
33
35
  // Steps used to integrate into Cesium:
34
36
  // * The following defines are set:
@@ -57,7 +57,9 @@ export default "/**\n\
57
57
  */\n\
58
58
  \n\
59
59
  // NVIDIA GameWorks Graphics Samples GitHub link: https://github.com/NVIDIAGameWorks/GraphicsSamples\n\
60
+ // Original source (archived): https://archive.org/details/nvidiagame-works-graphics-samples-master\n\
60
61
  // Original FXAA 3.11 shader link: https://github.com/NVIDIAGameWorks/GraphicsSamples/blob/master/samples/es3-kepler/FXAA/FXAA3_11.h\n\
62
+ // Shader link in fork: https://github.com/lyntel/GraphicsSamples/blob/3d30817ebeeade64fe6a4fc3aa1fe4265c29b6fd/samples/es3-kepler/FXAA/FXAA3_11.h\n\
61
63
  \n\
62
64
  // Steps used to integrate into Cesium:\n\
63
65
  // * The following defines are set:\n\
@@ -114,7 +114,8 @@ vec4 getPositionMorphingMode(vec3 position, float height, vec2 textureCoordinate
114
114
  float yPositionFraction = get2DYPositionFraction(textureCoordinates);
115
115
  vec4 position2DWC = vec4(height, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0);
116
116
  vec4 morphPosition = czm_columbusViewMorph(position2DWC, vec4(position3DWC, 1.0), czm_morphTime);
117
- return czm_modelViewProjection * morphPosition;
117
+ vec4 morphPositionEC = czm_modelView * morphPosition;
118
+ return czm_projection * morphPositionEC;
118
119
  }
119
120
 
120
121
  #ifdef QUANTIZATION_BITS12
@@ -115,7 +115,8 @@ vec4 getPositionMorphingMode(vec3 position, float height, vec2 textureCoordinate
115
115
  float yPositionFraction = get2DYPositionFraction(textureCoordinates);\n\
116
116
  vec4 position2DWC = vec4(height, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0);\n\
117
117
  vec4 morphPosition = czm_columbusViewMorph(position2DWC, vec4(position3DWC, 1.0), czm_morphTime);\n\
118
- return czm_modelViewProjection * morphPosition;\n\
118
+ vec4 morphPositionEC = czm_modelView * morphPosition;\n\
119
+ return czm_projection * morphPositionEC;\n\
119
120
  }\n\
120
121
  \n\
121
122
  #ifdef QUANTIZATION_BITS12\n\
@@ -27,5 +27,6 @@ void main(void)
27
27
  #endif
28
28
 
29
29
  v_outerPositionWC = positionWC.xyz;
30
- gl_Position = czm_modelViewProjection * position;
30
+ vec4 positionEC = czm_modelView * position;
31
+ gl_Position = czm_projection * positionEC;
31
32
  }
@@ -28,6 +28,7 @@ void main(void)\n\
28
28
  #endif\n\
29
29
  \n\
30
30
  v_outerPositionWC = positionWC.xyz;\n\
31
- gl_Position = czm_modelViewProjection * position;\n\
31
+ vec4 positionEC = czm_modelView * position;\n\
32
+ gl_Position = czm_projection * positionEC;\n\
32
33
  }\n\
33
34
  ";
@@ -1 +1 @@
1
- !function(){"use strict";const{Array:e,Object:t,Number:n,Math:s,Error:r,Uint8Array:a,Uint16Array:o,Uint32Array:i,Int32Array:c,Map:l,DataView:u,Promise:h,TextEncoder:f,crypto:p,postMessage:d,TransformStream:g,ReadableStream:w,WritableStream:y,CompressionStream:m,DecompressionStream:_}=self,b=void 0,S="undefined",v="function";class k{constructor(e){return class extends g{constructor(t,n){const s=new e(n);super({transform(e,t){t.enqueue(s.append(e))},flush(e){const t=s.flush();t&&e.enqueue(t)}})}}}}const z=[];for(let e=0;256>e;e++){let t=e;for(let e=0;8>e;e++)1&t?t=t>>>1^3988292384:t>>>=1;z[e]=t}class D{constructor(e){this.crc=e||-1}append(e){let t=0|this.crc;for(let n=0,s=0|e.length;s>n;n++)t=t>>>8^z[255&(t^e[n])];this.crc=t}get(){return~this.crc}}class C extends g{constructor(){let e;const t=new D;super({transform(e,n){t.append(e),n.enqueue(e)},flush(){const n=new a(4);new u(n.buffer).setUint32(0,t.get()),e.value=n}}),e=this}}const I={concat(e,t){if(0===e.length||0===t.length)return e.concat(t);const n=e[e.length-1],s=I.getPartial(n);return 32===s?e.concat(t):I._shiftRight(t,s,0|n,e.slice(0,e.length-1))},bitLength(e){const t=e.length;if(0===t)return 0;const n=e[t-1];return 32*(t-1)+I.getPartial(n)},clamp(e,t){if(32*e.length<t)return e;const n=(e=e.slice(0,s.ceil(t/32))).length;return t&=31,n>0&&t&&(e[n-1]=I.partial(t,e[n-1]&2147483648>>t-1,1)),e},partial:(e,t,n)=>32===e?t:(n?0|t:t<<32-e)+1099511627776*e,getPartial:e=>s.round(e/1099511627776)||32,_shiftRight(e,t,n,s){for(void 0===s&&(s=[]);t>=32;t-=32)s.push(n),n=0;if(0===t)return s.concat(e);for(let r=0;r<e.length;r++)s.push(n|e[r]>>>t),n=e[r]<<32-t;const r=e.length?e[e.length-1]:0,a=I.getPartial(r);return s.push(I.partial(t+a&31,t+a>32?n:s.pop(),1)),s}},A={bytes:{fromBits(e){const t=I.bitLength(e)/8,n=new a(t);let s;for(let r=0;t>r;r++)3&r||(s=e[r/4]),n[r]=s>>>24,s<<=8;return n},toBits(e){const t=[];let n,s=0;for(n=0;n<e.length;n++)s=s<<8|e[n],3&~n||(t.push(s),s=0);return 3&n&&t.push(I.partial(8*(3&n),s)),t}}},q=class{constructor(e){const t=this;t.blockSize=512,t._init=[1732584193,4023233417,2562383102,271733878,3285377520],t._key=[1518500249,1859775393,2400959708,3395469782],e?(t._h=e._h.slice(0),t._buffer=e._buffer.slice(0),t._length=e._length):t.reset()}reset(){const e=this;return e._h=e._init.slice(0),e._buffer=[],e._length=0,e}update(e){const t=this;"string"==typeof e&&(e=A.utf8String.toBits(e));const n=t._buffer=I.concat(t._buffer,e),s=t._length,a=t._length=s+I.bitLength(e);if(a>9007199254740991)throw new r("Cannot hash more than 2^53 - 1 bits");const o=new i(n);let c=0;for(let e=t.blockSize+s-(t.blockSize+s&t.blockSize-1);a>=e;e+=t.blockSize)t._block(o.subarray(16*c,16*(c+1))),c+=1;return n.splice(0,16*c),t}finalize(){const e=this;let t=e._buffer;const n=e._h;t=I.concat(t,[I.partial(1,1)]);for(let e=t.length+2;15&e;e++)t.push(0);for(t.push(s.floor(e._length/4294967296)),t.push(0|e._length);t.length;)e._block(t.splice(0,16));return e.reset(),n}_f(e,t,n,s){return e>19?e>39?e>59?e>79?void 0:t^n^s:t&n|t&s|n&s:t^n^s:t&n|~t&s}_S(e,t){return t<<e|t>>>32-e}_block(t){const n=this,r=n._h,a=e(80);for(let e=0;16>e;e++)a[e]=t[e];let o=r[0],i=r[1],c=r[2],l=r[3],u=r[4];for(let e=0;79>=e;e++){16>e||(a[e]=n._S(1,a[e-3]^a[e-8]^a[e-14]^a[e-16]));const t=n._S(5,o)+n._f(e,i,c,l)+u+a[e]+n._key[s.floor(e/20)]|0;u=l,l=c,c=n._S(30,i),i=o,o=t}r[0]=r[0]+o|0,r[1]=r[1]+i|0,r[2]=r[2]+c|0,r[3]=r[3]+l|0,r[4]=r[4]+u|0}},R={getRandomValues(e){const t=new i(e.buffer),n=e=>{let t=987654321;const n=4294967295;return()=>(t=36969*(65535&t)+(t>>16)&n,(((t<<16)+(e=18e3*(65535&e)+(e>>16)&n)&n)/4294967296+.5)*(s.random()>.5?1:-1))};for(let r,a=0;a<e.length;a+=4){const e=n(4294967296*(r||s.random()));r=987654071*e(),t[a/4]=4294967296*e()|0}return e}},H={importKey:e=>new H.hmacSha1(A.bytes.toBits(e)),pbkdf2(e,t,n,s){if(n=n||1e4,0>s||0>n)throw new r("invalid params to pbkdf2");const a=1+(s>>5)<<2;let o,i,c,l,h;const f=new ArrayBuffer(a),p=new u(f);let d=0;const g=I;for(t=A.bytes.toBits(t),h=1;(a||1)>d;h++){for(o=i=e.encrypt(g.concat(t,[h])),c=1;n>c;c++)for(i=e.encrypt(i),l=0;l<i.length;l++)o[l]^=i[l];for(c=0;(a||1)>d&&c<o.length;c++)p.setInt32(d,o[c]),d+=4}return f.slice(0,s/8)},hmacSha1:class{constructor(e){const t=this,n=t._hash=q,s=[[],[]];t._baseHash=[new n,new n];const r=t._baseHash[0].blockSize/32;e.length>r&&(e=(new n).update(e).finalize());for(let t=0;r>t;t++)s[0][t]=909522486^e[t],s[1][t]=1549556828^e[t];t._baseHash[0].update(s[0]),t._baseHash[1].update(s[1]),t._resultHash=new n(t._baseHash[0])}reset(){const e=this;e._resultHash=new e._hash(e._baseHash[0]),e._updated=!1}update(e){this._updated=!0,this._resultHash.update(e)}digest(){const e=this,t=e._resultHash.finalize(),n=new e._hash(e._baseHash[1]).update(t).finalize();return e.reset(),n}encrypt(e){if(this._updated)throw new r("encrypt on already updated hmac called!");return this.update(e),this.digest(e)}}},P=typeof p!=S&&typeof p.getRandomValues==v,B="Invalid password",K="Invalid signature",T="zipjs-abort-check-password";function V(e){return P?p.getRandomValues(e):R.getRandomValues(e)}const x=16,E={name:"PBKDF2"},U=t.assign({hash:{name:"HMAC"}},E),W=t.assign({iterations:1e3,hash:{name:"SHA-1"}},E),M=["deriveBits"],N=[8,12,16],O=[16,24,32],L=10,F=[0,0,0,0],j=typeof p!=S,G=j&&p.subtle,X=j&&typeof G!=S,J=A.bytes,Q=class{constructor(e){const t=this;t._tables=[[[],[],[],[],[]],[[],[],[],[],[]]],t._tables[0][0][0]||t._precompute();const n=t._tables[0][4],s=t._tables[1],a=e.length;let o,i,c,l=1;if(4!==a&&6!==a&&8!==a)throw new r("invalid aes key size");for(t._key=[i=e.slice(0),c=[]],o=a;4*a+28>o;o++){let e=i[o-1];(o%a===0||8===a&&o%a===4)&&(e=n[e>>>24]<<24^n[e>>16&255]<<16^n[e>>8&255]<<8^n[255&e],o%a===0&&(e=e<<8^e>>>24^l<<24,l=l<<1^283*(l>>7))),i[o]=i[o-a]^e}for(let e=0;o;e++,o--){const t=i[3&e?o:o-4];c[e]=4>=o||4>e?t:s[0][n[t>>>24]]^s[1][n[t>>16&255]]^s[2][n[t>>8&255]]^s[3][n[255&t]]}}encrypt(e){return this._crypt(e,0)}decrypt(e){return this._crypt(e,1)}_precompute(){const e=this._tables[0],t=this._tables[1],n=e[4],s=t[4],r=[],a=[];let o,i,c,l;for(let e=0;256>e;e++)a[(r[e]=e<<1^283*(e>>7))^e]=e;for(let u=o=0;!n[u];u^=i||1,o=a[o]||1){let a=o^o<<1^o<<2^o<<3^o<<4;a=a>>8^255&a^99,n[u]=a,s[a]=u,l=r[c=r[i=r[u]]];let h=16843009*l^65537*c^257*i^16843008*u,f=257*r[a]^16843008*a;for(let n=0;4>n;n++)e[n][u]=f=f<<24^f>>>8,t[n][a]=h=h<<24^h>>>8}for(let n=0;5>n;n++)e[n]=e[n].slice(0),t[n]=t[n].slice(0)}_crypt(e,t){if(4!==e.length)throw new r("invalid aes block size");const n=this._key[t],s=n.length/4-2,a=[0,0,0,0],o=this._tables[t],i=o[0],c=o[1],l=o[2],u=o[3],h=o[4];let f,p,d,g=e[0]^n[0],w=e[t?3:1]^n[1],y=e[2]^n[2],m=e[t?1:3]^n[3],_=4;for(let e=0;s>e;e++)f=i[g>>>24]^c[w>>16&255]^l[y>>8&255]^u[255&m]^n[_],p=i[w>>>24]^c[y>>16&255]^l[m>>8&255]^u[255&g]^n[_+1],d=i[y>>>24]^c[m>>16&255]^l[g>>8&255]^u[255&w]^n[_+2],m=i[m>>>24]^c[g>>16&255]^l[w>>8&255]^u[255&y]^n[_+3],_+=4,g=f,w=p,y=d;for(let e=0;4>e;e++)a[t?3&-e:e]=h[g>>>24]<<24^h[w>>16&255]<<16^h[y>>8&255]<<8^h[255&m]^n[_++],f=g,g=w,w=y,y=m,m=f;return a}},Y=class{constructor(e,t){this._prf=e,this._initIv=t,this._iv=t}reset(){this._iv=this._initIv}update(e){return this.calculate(this._prf,e,this._iv)}incWord(e){if(255&~(e>>24))e+=1<<24;else{let t=e>>16&255,n=e>>8&255,s=255&e;255===t?(t=0,255===n?(n=0,255===s?s=0:++s):++n):++t,e=0,e+=t<<16,e+=n<<8,e+=s}return e}incCounter(e){0===(e[0]=this.incWord(e[0]))&&(e[1]=this.incWord(e[1]))}calculate(e,t,n){let s;if(!(s=t.length))return[];const r=I.bitLength(t);for(let r=0;s>r;r+=4){this.incCounter(n);const s=e.encrypt(n);t[r]^=s[0],t[r+1]^=s[1],t[r+2]^=s[2],t[r+3]^=s[3]}return I.clamp(t,r)}},Z=H.hmacSha1;let $=j&&X&&typeof G.importKey==v,ee=j&&X&&typeof G.deriveBits==v;class te extends g{constructor({password:e,rawPassword:n,signed:s,encryptionStrength:o,checkPasswordOnly:i}){super({start(){t.assign(this,{ready:new h(e=>this.resolveReady=e),password:ae(e,n),signed:s,strength:o-1,pending:new a})},async transform(e,t){const n=this,{password:s,strength:o,resolveReady:c,ready:l}=n;s?(await(async(e,t,n,s)=>{const a=await re(e,t,n,ie(s,0,N[t])),o=ie(s,N[t]);if(a[0]!=o[0]||a[1]!=o[1])throw new r(B)})(n,o,s,ie(e,0,N[o]+2)),e=ie(e,N[o]+2),i?t.error(new r(T)):c()):await l;const u=new a(e.length-L-(e.length-L)%x);t.enqueue(se(n,e,u,0,L,!0))},async flush(e){const{signed:t,ctr:n,hmac:s,pending:o,ready:i}=this;if(s&&n){await i;const c=ie(o,0,o.length-L),l=ie(o,o.length-L);let u=new a;if(c.length){const e=le(J,c);s.update(e);const t=n.update(e);u=ce(J,t)}if(t){const e=ie(ce(J,s.digest()),0,L);for(let t=0;L>t;t++)if(e[t]!=l[t])throw new r(K)}e.enqueue(u)}}})}}class ne extends g{constructor({password:e,rawPassword:n,encryptionStrength:s}){let r;super({start(){t.assign(this,{ready:new h(e=>this.resolveReady=e),password:ae(e,n),strength:s-1,pending:new a})},async transform(e,t){const n=this,{password:s,strength:r,resolveReady:o,ready:i}=n;let c=new a;s?(c=await(async(e,t,n)=>{const s=V(new a(N[t]));return oe(s,await re(e,t,n,s))})(n,r,s),o()):await i;const l=new a(c.length+e.length-e.length%x);l.set(c,0),t.enqueue(se(n,e,l,c.length,0))},async flush(e){const{ctr:t,hmac:n,pending:s,ready:o}=this;if(n&&t){await o;let i=new a;if(s.length){const e=t.update(le(J,s));n.update(e),i=ce(J,e)}r.signature=ce(J,n.digest()).slice(0,L),e.enqueue(oe(i,r.signature))}}}),r=this}}function se(e,t,n,s,r,o){const{ctr:i,hmac:c,pending:l}=e,u=t.length-r;let h;for(l.length&&(t=oe(l,t),n=((e,t)=>{if(t&&t>e.length){const n=e;(e=new a(t)).set(n,0)}return e})(n,u-u%x)),h=0;u-x>=h;h+=x){const e=le(J,ie(t,h,h+x));o&&c.update(e);const r=i.update(e);o||c.update(r),n.set(ce(J,r),h+s)}return e.pending=ie(t,h),n}async function re(n,s,r,o){n.password=null;const i=await(async(e,t,n,s,r)=>{if(!$)return H.importKey(t);try{return await G.importKey("raw",t,n,!1,r)}catch(e){return $=!1,H.importKey(t)}})(0,r,U,0,M),c=await(async(e,t,n)=>{if(!ee)return H.pbkdf2(t,e.salt,W.iterations,n);try{return await G.deriveBits(e,t,n)}catch(s){return ee=!1,H.pbkdf2(t,e.salt,W.iterations,n)}})(t.assign({salt:o},W),i,8*(2*O[s]+2)),l=new a(c),u=le(J,ie(l,0,O[s])),h=le(J,ie(l,O[s],2*O[s])),f=ie(l,2*O[s]);return t.assign(n,{keys:{key:u,authentication:h,passwordVerification:f},ctr:new Y(new Q(u),e.from(F)),hmac:new Z(h)}),f}function ae(e,t){return t===b?(e=>{if(typeof f==S){const t=new a((e=unescape(encodeURIComponent(e))).length);for(let n=0;n<t.length;n++)t[n]=e.charCodeAt(n);return t}return(new f).encode(e)})(e):t}function oe(e,t){let n=e;return e.length+t.length&&(n=new a(e.length+t.length),n.set(e,0),n.set(t,e.length)),n}function ie(e,t,n){return e.subarray(t,n)}function ce(e,t){return e.fromBits(t)}function le(e,t){return e.toBits(t)}class ue extends g{constructor({password:e,passwordVerification:n,checkPasswordOnly:s}){super({start(){t.assign(this,{password:e,passwordVerification:n}),de(this,e)},transform(e,t){const n=this;if(n.password){const t=fe(n,e.subarray(0,12));if(n.password=null,t[11]!=n.passwordVerification)throw new r(B);e=e.subarray(12)}s?t.error(new r(T)):t.enqueue(fe(n,e))}})}}class he extends g{constructor({password:e,passwordVerification:n}){super({start(){t.assign(this,{password:e,passwordVerification:n}),de(this,e)},transform(e,t){const n=this;let s,r;if(n.password){n.password=null;const t=V(new a(12));t[11]=n.passwordVerification,s=new a(e.length+t.length),s.set(pe(n,t),0),r=12}else s=new a(e.length),r=0;s.set(pe(n,e),r),t.enqueue(s)}})}}function fe(e,t){const n=new a(t.length);for(let s=0;s<t.length;s++)n[s]=we(e)^t[s],ge(e,n[s]);return n}function pe(e,t){const n=new a(t.length);for(let s=0;s<t.length;s++)n[s]=we(e)^t[s],ge(e,t[s]);return n}function de(e,n){const s=[305419896,591751049,878082192];t.assign(e,{keys:s,crcKey0:new D(s[0]),crcKey2:new D(s[2])});for(let t=0;t<n.length;t++)ge(e,n.charCodeAt(t))}function ge(e,t){let[n,r,a]=e.keys;e.crcKey0.append([t]),n=~e.crcKey0.get(),r=me(s.imul(me(r+ye(n)),134775813)+1),e.crcKey2.append([r>>>24]),a=~e.crcKey2.get(),e.keys=[n,r,a]}function we(e){const t=2|e.keys[2];return ye(s.imul(t,1^t)>>>8)}function ye(e){return 255&e}function me(e){return 4294967295&e}const _e="deflate-raw";class be extends g{constructor(e,{chunkSize:t,CompressionStream:n,CompressionStreamNative:s}){super({});const{compressed:r,encrypted:a,useCompressionStream:o,zipCrypto:i,signed:c,level:l}=e,h=this;let f,p,d=ve(super.readable);a&&!i||!c||(f=new C,d=De(d,f)),r&&(d=ze(d,o,{level:l,chunkSize:t},s,n)),a&&(i?d=De(d,new he(e)):(p=new ne(e),d=De(d,p))),ke(h,d,()=>{let e;a&&!i&&(e=p.signature),a&&!i||!c||(e=new u(f.value.buffer).getUint32(0)),h.signature=e})}}class Se extends g{constructor(e,{chunkSize:t,DecompressionStream:n,DecompressionStreamNative:s}){super({});const{zipCrypto:a,encrypted:o,signed:i,signature:c,compressed:l,useCompressionStream:h}=e;let f,p,d=ve(super.readable);o&&(a?d=De(d,new ue(e)):(p=new te(e),d=De(d,p))),l&&(d=ze(d,h,{chunkSize:t},s,n)),o&&!a||!i||(f=new C,d=De(d,f)),ke(this,d,()=>{if((!o||a)&&i){const e=new u(f.value.buffer);if(c!=e.getUint32(0,!1))throw new r(K)}})}}function ve(e){return De(e,new g({transform(e,t){e&&e.length&&t.enqueue(e)}}))}function ke(e,n,s){n=De(n,new g({flush:s})),t.defineProperty(e,"readable",{get:()=>n})}function ze(e,t,n,s,r){try{e=De(e,new(t&&s?s:r)(_e,n))}catch(s){if(!t)return e;try{e=De(e,new r(_e,n))}catch(t){return e}}return e}function De(e,t){return e.pipeThrough(t)}const Ce="data",Ie="close";class Ae extends g{constructor(e,n){super({});const s=this,{codecType:r}=e;let a;r.startsWith("deflate")?a=be:r.startsWith("inflate")&&(a=Se);let o=0,i=0;const c=new a(e,n),l=super.readable,u=new g({transform(e,t){e&&e.length&&(i+=e.length,t.enqueue(e))},flush(){t.assign(s,{inputSize:i})}}),h=new g({transform(e,t){e&&e.length&&(o+=e.length,t.enqueue(e))},flush(){const{signature:e}=c;t.assign(s,{signature:e,outputSize:o,inputSize:i})}});t.defineProperty(s,"readable",{get:()=>l.pipeThrough(u).pipeThrough(c).pipeThrough(h)})}}class qe extends g{constructor(e){let t;super({transform:function n(s,r){if(t){const e=new a(t.length+s.length);e.set(t),e.set(s,t.length),s=e,t=null}s.length>e?(r.enqueue(s.slice(0,e)),n(s.slice(e),r)):t=s},flush(e){t&&t.length&&e.enqueue(t)}})}}const Re=new l,He=new l;let Pe,Be=0,Ke=!0;async function Te(e){try{const{options:t,scripts:s,config:r}=e;if(s&&s.length)try{Ke?importScripts.apply(b,s):await Ve(s)}catch(e){Ke=!1,await Ve(s)}self.initCodec&&self.initCodec(),r.CompressionStreamNative=self.CompressionStream,r.DecompressionStreamNative=self.DecompressionStream,self.Deflate&&(r.CompressionStream=new k(self.Deflate)),self.Inflate&&(r.DecompressionStream=new k(self.Inflate));const a={highWaterMark:1},o=e.readable||new w({async pull(e){const t=new h(e=>Re.set(Be,e));xe({type:"pull",messageId:Be}),Be=(Be+1)%n.MAX_SAFE_INTEGER;const{value:s,done:r}=await t;e.enqueue(s),r&&e.close()}},a),i=e.writable||new y({async write(e){let t;const s=new h(e=>t=e);He.set(Be,t),xe({type:Ce,value:e,messageId:Be}),Be=(Be+1)%n.MAX_SAFE_INTEGER,await s}},a),c=new Ae(t,r);Pe=new AbortController;const{signal:l}=Pe;await o.pipeThrough(c).pipeThrough(new qe(r.chunkSize)).pipeTo(i,{signal:l,preventClose:!0,preventAbort:!0}),await i.getWriter().close();const{signature:u,inputSize:f,outputSize:p}=c;xe({type:Ie,result:{signature:u,inputSize:f,outputSize:p}})}catch(e){Ee(e)}}async function Ve(e){for(const t of e)await import(t)}function xe(e){let{value:t}=e;if(t)if(t.length)try{t=new a(t),e.value=t.buffer,d(e,[e.value])}catch(t){d(e)}else d(e);else d(e)}function Ee(e=new r("Unknown error")){const{message:t,stack:n,code:s,name:a}=e;d({error:{message:t,stack:n,code:s,name:a}})}function Ue(e,n,s){return class{constructor(r){const o=this;var i,c;i=r,c="level",(typeof t.hasOwn===v?t.hasOwn(i,c):i.hasOwnProperty(c))&&r.level===b&&delete r.level,o.codec=new e(t.assign({},n,r)),s(o.codec,e=>{if(o.pendingData){const t=o.pendingData;o.pendingData=new a(t.length+e.length);const{pendingData:n}=o;n.set(t,0),n.set(e,t.length)}else o.pendingData=new a(e)})}append(e){return this.codec.push(e),r(this)}flush(){return this.codec.push(new a,!0),r(this)}};function r(e){if(e.pendingData){const t=e.pendingData;return e.pendingData=null,t}return new a}}addEventListener("message",({data:e})=>{const{type:t,messageId:n,value:s,done:r}=e;try{if("start"==t&&Te(e),t==Ce){const e=Re.get(n);Re.delete(n),e({value:new a(s),done:r})}if("ack"==t){const e=He.get(n);He.delete(n),e()}t==Ie&&Pe.abort()}catch(e){Ee(e)}}),self.initCodec=()=>{const{Deflate:e,Inflate:t}=((e,t={},n)=>({Deflate:Ue(e.Deflate,t.deflate,n),Inflate:Ue(e.Inflate,t.inflate,n)}))(pako,{deflate:{raw:!0},inflate:{raw:!0}},(e,t)=>e.onData=t);self.Deflate=e,self.Inflate=t}}();
1
+ !function(){"use strict";const{Array:e,Object:t,Number:n,Math:s,Error:r,Uint8Array:a,Uint16Array:o,Uint32Array:i,Int32Array:c,Map:l,DataView:u,Promise:h,TextEncoder:p,crypto:f,postMessage:d,TransformStream:g,ReadableStream:w,WritableStream:y,CompressionStream:m,DecompressionStream:_}=self,b=void 0,S="undefined",v="function";class k{constructor(e){return class extends g{constructor(t,n){const s=new e(n);super({transform(e,t){t.enqueue(s.append(e))},flush(e){const t=s.flush();t&&e.enqueue(t)}})}}}}const z=[];for(let e=0;256>e;e++){let t=e;for(let e=0;8>e;e++)1&t?t=t>>>1^3988292384:t>>>=1;z[e]=t}class D{constructor(e){this.crc=e||-1}append(e){let t=0|this.crc;for(let n=0,s=0|e.length;s>n;n++)t=t>>>8^z[255&(t^e[n])];this.crc=t}get(){return~this.crc}}class C extends g{constructor(){let e;const t=new D;super({transform(e,n){t.append(e),n.enqueue(e)},flush(){const n=new a(4);new u(n.buffer).setUint32(0,t.get()),e.value=n}}),e=this}}const I={concat(e,t){if(0===e.length||0===t.length)return e.concat(t);const n=e[e.length-1],s=I.getPartial(n);return 32===s?e.concat(t):I._shiftRight(t,s,0|n,e.slice(0,e.length-1))},bitLength(e){const t=e.length;if(0===t)return 0;const n=e[t-1];return 32*(t-1)+I.getPartial(n)},clamp(e,t){if(32*e.length<t)return e;const n=(e=e.slice(0,s.ceil(t/32))).length;return t&=31,n>0&&t&&(e[n-1]=I.partial(t,e[n-1]&2147483648>>t-1,1)),e},partial:(e,t,n)=>32===e?t:(n?0|t:t<<32-e)+1099511627776*e,getPartial:e=>s.round(e/1099511627776)||32,_shiftRight(e,t,n,s){for(void 0===s&&(s=[]);t>=32;t-=32)s.push(n),n=0;if(0===t)return s.concat(e);for(let r=0;r<e.length;r++)s.push(n|e[r]>>>t),n=e[r]<<32-t;const r=e.length?e[e.length-1]:0,a=I.getPartial(r);return s.push(I.partial(t+a&31,t+a>32?n:s.pop(),1)),s}},A={bytes:{fromBits(e){const t=I.bitLength(e)/8,n=new a(t);let s;for(let r=0;t>r;r++)3&r||(s=e[r/4]),n[r]=s>>>24,s<<=8;return n},toBits(e){const t=[];let n,s=0;for(n=0;n<e.length;n++)s=s<<8|e[n],3&~n||(t.push(s),s=0);return 3&n&&t.push(I.partial(8*(3&n),s)),t}}},q=class{constructor(e){const t=this;t.blockSize=512,t._init=[1732584193,4023233417,2562383102,271733878,3285377520],t._key=[1518500249,1859775393,2400959708,3395469782],e?(t._h=e._h.slice(0),t._buffer=e._buffer.slice(0),t._length=e._length):t.reset()}reset(){const e=this;return e._h=e._init.slice(0),e._buffer=[],e._length=0,e}update(e){const t=this;"string"==typeof e&&(e=A.utf8String.toBits(e));const n=t._buffer=I.concat(t._buffer,e),s=t._length,a=t._length=s+I.bitLength(e);if(a>9007199254740991)throw new r("Cannot hash more than 2^53 - 1 bits");const o=new i(n);let c=0;for(let e=t.blockSize+s-(t.blockSize+s&t.blockSize-1);a>=e;e+=t.blockSize)t._block(o.subarray(16*c,16*(c+1))),c+=1;return n.splice(0,16*c),t}finalize(){const e=this;let t=e._buffer;const n=e._h;t=I.concat(t,[I.partial(1,1)]);for(let e=t.length+2;15&e;e++)t.push(0);for(t.push(s.floor(e._length/4294967296)),t.push(0|e._length);t.length;)e._block(t.splice(0,16));return e.reset(),n}_f(e,t,n,s){return e>19?e>39?e>59?e>79?void 0:t^n^s:t&n|t&s|n&s:t^n^s:t&n|~t&s}_S(e,t){return t<<e|t>>>32-e}_block(t){const n=this,r=n._h,a=e(80);for(let e=0;16>e;e++)a[e]=t[e];let o=r[0],i=r[1],c=r[2],l=r[3],u=r[4];for(let e=0;79>=e;e++){16>e||(a[e]=n._S(1,a[e-3]^a[e-8]^a[e-14]^a[e-16]));const t=n._S(5,o)+n._f(e,i,c,l)+u+a[e]+n._key[s.floor(e/20)]|0;u=l,l=c,c=n._S(30,i),i=o,o=t}r[0]=r[0]+o|0,r[1]=r[1]+i|0,r[2]=r[2]+c|0,r[3]=r[3]+l|0,r[4]=r[4]+u|0}},R={getRandomValues(e){const t=new i(e.buffer),n=e=>{let t=987654321;const n=4294967295;return()=>(t=36969*(65535&t)+(t>>16)&n,(((t<<16)+(e=18e3*(65535&e)+(e>>16)&n)&n)/4294967296+.5)*(s.random()>.5?1:-1))};for(let r,a=0;a<e.length;a+=4){const e=n(4294967296*(r||s.random()));r=987654071*e(),t[a/4]=4294967296*e()|0}return e}},H={importKey:e=>new H.hmacSha1(A.bytes.toBits(e)),pbkdf2(e,t,n,s){if(n=n||1e4,0>s||0>n)throw new r("invalid params to pbkdf2");const a=1+(s>>5)<<2;let o,i,c,l,h;const p=new ArrayBuffer(a),f=new u(p);let d=0;const g=I;for(t=A.bytes.toBits(t),h=1;(a||1)>d;h++){for(o=i=e.encrypt(g.concat(t,[h])),c=1;n>c;c++)for(i=e.encrypt(i),l=0;l<i.length;l++)o[l]^=i[l];for(c=0;(a||1)>d&&c<o.length;c++)f.setInt32(d,o[c]),d+=4}return p.slice(0,s/8)},hmacSha1:class{constructor(e){const t=this,n=t._hash=q,s=[[],[]];t._baseHash=[new n,new n];const r=t._baseHash[0].blockSize/32;e.length>r&&(e=(new n).update(e).finalize());for(let t=0;r>t;t++)s[0][t]=909522486^e[t],s[1][t]=1549556828^e[t];t._baseHash[0].update(s[0]),t._baseHash[1].update(s[1]),t._resultHash=new n(t._baseHash[0])}reset(){const e=this;e._resultHash=new e._hash(e._baseHash[0]),e._updated=!1}update(e){this._updated=!0,this._resultHash.update(e)}digest(){const e=this,t=e._resultHash.finalize(),n=new e._hash(e._baseHash[1]).update(t).finalize();return e.reset(),n}encrypt(e){if(this._updated)throw new r("encrypt on already updated hmac called!");return this.update(e),this.digest(e)}}},P=typeof f!=S&&typeof f.getRandomValues==v,B="Invalid password",K="Invalid signature",T="zipjs-abort-check-password";function V(e){return P?f.getRandomValues(e):R.getRandomValues(e)}const x=16,E={name:"PBKDF2"},U=t.assign({hash:{name:"HMAC"}},E),W=t.assign({iterations:1e3,hash:{name:"SHA-1"}},E),M=["deriveBits"],N=[8,12,16],O=[16,24,32],L=10,F=[0,0,0,0],j=typeof f!=S,G=j&&f.subtle,X=j&&typeof G!=S,J=A.bytes,Q=class{constructor(e){const t=this;t._tables=[[[],[],[],[],[]],[[],[],[],[],[]]],t._tables[0][0][0]||t._precompute();const n=t._tables[0][4],s=t._tables[1],a=e.length;let o,i,c,l=1;if(4!==a&&6!==a&&8!==a)throw new r("invalid aes key size");for(t._key=[i=e.slice(0),c=[]],o=a;4*a+28>o;o++){let e=i[o-1];(o%a===0||8===a&&o%a===4)&&(e=n[e>>>24]<<24^n[e>>16&255]<<16^n[e>>8&255]<<8^n[255&e],o%a===0&&(e=e<<8^e>>>24^l<<24,l=l<<1^283*(l>>7))),i[o]=i[o-a]^e}for(let e=0;o;e++,o--){const t=i[3&e?o:o-4];c[e]=4>=o||4>e?t:s[0][n[t>>>24]]^s[1][n[t>>16&255]]^s[2][n[t>>8&255]]^s[3][n[255&t]]}}encrypt(e){return this._crypt(e,0)}decrypt(e){return this._crypt(e,1)}_precompute(){const e=this._tables[0],t=this._tables[1],n=e[4],s=t[4],r=[],a=[];let o,i,c,l;for(let e=0;256>e;e++)a[(r[e]=e<<1^283*(e>>7))^e]=e;for(let u=o=0;!n[u];u^=i||1,o=a[o]||1){let a=o^o<<1^o<<2^o<<3^o<<4;a=a>>8^255&a^99,n[u]=a,s[a]=u,l=r[c=r[i=r[u]]];let h=16843009*l^65537*c^257*i^16843008*u,p=257*r[a]^16843008*a;for(let n=0;4>n;n++)e[n][u]=p=p<<24^p>>>8,t[n][a]=h=h<<24^h>>>8}for(let n=0;5>n;n++)e[n]=e[n].slice(0),t[n]=t[n].slice(0)}_crypt(e,t){if(4!==e.length)throw new r("invalid aes block size");const n=this._key[t],s=n.length/4-2,a=[0,0,0,0],o=this._tables[t],i=o[0],c=o[1],l=o[2],u=o[3],h=o[4];let p,f,d,g=e[0]^n[0],w=e[t?3:1]^n[1],y=e[2]^n[2],m=e[t?1:3]^n[3],_=4;for(let e=0;s>e;e++)p=i[g>>>24]^c[w>>16&255]^l[y>>8&255]^u[255&m]^n[_],f=i[w>>>24]^c[y>>16&255]^l[m>>8&255]^u[255&g]^n[_+1],d=i[y>>>24]^c[m>>16&255]^l[g>>8&255]^u[255&w]^n[_+2],m=i[m>>>24]^c[g>>16&255]^l[w>>8&255]^u[255&y]^n[_+3],_+=4,g=p,w=f,y=d;for(let e=0;4>e;e++)a[t?3&-e:e]=h[g>>>24]<<24^h[w>>16&255]<<16^h[y>>8&255]<<8^h[255&m]^n[_++],p=g,g=w,w=y,y=m,m=p;return a}},Y=class{constructor(e,t){this._prf=e,this._initIv=t,this._iv=t}reset(){this._iv=this._initIv}update(e){return this.calculate(this._prf,e,this._iv)}incWord(e){if(255&~(e>>24))e+=1<<24;else{let t=e>>16&255,n=e>>8&255,s=255&e;255===t?(t=0,255===n?(n=0,255===s?s=0:++s):++n):++t,e=0,e+=t<<16,e+=n<<8,e+=s}return e}incCounter(e){0===(e[0]=this.incWord(e[0]))&&(e[1]=this.incWord(e[1]))}calculate(e,t,n){let s;if(!(s=t.length))return[];const r=I.bitLength(t);for(let r=0;s>r;r+=4){this.incCounter(n);const s=e.encrypt(n);t[r]^=s[0],t[r+1]^=s[1],t[r+2]^=s[2],t[r+3]^=s[3]}return I.clamp(t,r)}},Z=H.hmacSha1;let $=j&&X&&typeof G.importKey==v,ee=j&&X&&typeof G.deriveBits==v;class te extends g{constructor({password:e,rawPassword:n,signed:s,encryptionStrength:o,checkPasswordOnly:i}){super({start(){t.assign(this,{ready:new h(e=>this.resolveReady=e),password:ae(e,n),signed:s,strength:o-1,pending:new a})},async transform(e,t){const n=this,{password:s,strength:o,resolveReady:c,ready:l}=n;s?(await(async(e,t,n,s)=>{const a=await re(e,t,n,ie(s,0,N[t])),o=ie(s,N[t]);if(a[0]!=o[0]||a[1]!=o[1])throw new r(B)})(n,o,s,ie(e,0,N[o]+2)),e=ie(e,N[o]+2),i?t.error(new r(T)):c()):await l;const u=new a(e.length-L-(e.length-L)%x);t.enqueue(se(n,e,u,0,L,!0))},async flush(e){const{signed:t,ctr:n,hmac:s,pending:o,ready:i}=this;if(s&&n){await i;const c=ie(o,0,o.length-L),l=ie(o,o.length-L);let u=new a;if(c.length){const e=le(J,c);s.update(e);const t=n.update(e);u=ce(J,t)}if(t){const e=ie(ce(J,s.digest()),0,L);for(let t=0;L>t;t++)if(e[t]!=l[t])throw new r(K)}e.enqueue(u)}}})}}class ne extends g{constructor({password:e,rawPassword:n,encryptionStrength:s}){let r;super({start(){t.assign(this,{ready:new h(e=>this.resolveReady=e),password:ae(e,n),strength:s-1,pending:new a})},async transform(e,t){const n=this,{password:s,strength:r,resolveReady:o,ready:i}=n;let c=new a;s?(c=await(async(e,t,n)=>{const s=V(new a(N[t]));return oe(s,await re(e,t,n,s))})(n,r,s),o()):await i;const l=new a(c.length+e.length-e.length%x);l.set(c,0),t.enqueue(se(n,e,l,c.length,0))},async flush(e){const{ctr:t,hmac:n,pending:s,ready:o}=this;if(n&&t){await o;let i=new a;if(s.length){const e=t.update(le(J,s));n.update(e),i=ce(J,e)}r.signature=ce(J,n.digest()).slice(0,L),e.enqueue(oe(i,r.signature))}}}),r=this}}function se(e,t,n,s,r,o){const{ctr:i,hmac:c,pending:l}=e,u=t.length-r;let h;for(l.length&&(t=oe(l,t),n=((e,t)=>{if(t&&t>e.length){const n=e;(e=new a(t)).set(n,0)}return e})(n,u-u%x)),h=0;u-x>=h;h+=x){const e=le(J,ie(t,h,h+x));o&&c.update(e);const r=i.update(e);o||c.update(r),n.set(ce(J,r),h+s)}return e.pending=ie(t,h),n}async function re(n,s,r,o){n.password=null;const i=await(async(e,t,n,s,r)=>{if(!$)return H.importKey(t);try{return await G.importKey("raw",t,n,!1,r)}catch(e){return $=!1,H.importKey(t)}})(0,r,U,0,M),c=await(async(e,t,n)=>{if(!ee)return H.pbkdf2(t,e.salt,W.iterations,n);try{return await G.deriveBits(e,t,n)}catch(s){return ee=!1,H.pbkdf2(t,e.salt,W.iterations,n)}})(t.assign({salt:o},W),i,8*(2*O[s]+2)),l=new a(c),u=le(J,ie(l,0,O[s])),h=le(J,ie(l,O[s],2*O[s])),p=ie(l,2*O[s]);return t.assign(n,{keys:{key:u,authentication:h,passwordVerification:p},ctr:new Y(new Q(u),e.from(F)),hmac:new Z(h)}),p}function ae(e,t){return t===b?(e=>{if(typeof p==S){const t=new a((e=unescape(encodeURIComponent(e))).length);for(let n=0;n<t.length;n++)t[n]=e.charCodeAt(n);return t}return(new p).encode(e)})(e):t}function oe(e,t){let n=e;return e.length+t.length&&(n=new a(e.length+t.length),n.set(e,0),n.set(t,e.length)),n}function ie(e,t,n){return e.subarray(t,n)}function ce(e,t){return e.fromBits(t)}function le(e,t){return e.toBits(t)}class ue extends g{constructor({password:e,passwordVerification:n,checkPasswordOnly:s}){super({start(){t.assign(this,{password:e,passwordVerification:n}),de(this,e)},transform(e,t){const n=this;if(n.password){const t=pe(n,e.subarray(0,12));if(n.password=null,t[11]!=n.passwordVerification)throw new r(B);e=e.subarray(12)}s?t.error(new r(T)):t.enqueue(pe(n,e))}})}}class he extends g{constructor({password:e,passwordVerification:n}){super({start(){t.assign(this,{password:e,passwordVerification:n}),de(this,e)},transform(e,t){const n=this;let s,r;if(n.password){n.password=null;const t=V(new a(12));t[11]=n.passwordVerification,s=new a(e.length+t.length),s.set(fe(n,t),0),r=12}else s=new a(e.length),r=0;s.set(fe(n,e),r),t.enqueue(s)}})}}function pe(e,t){const n=new a(t.length);for(let s=0;s<t.length;s++)n[s]=we(e)^t[s],ge(e,n[s]);return n}function fe(e,t){const n=new a(t.length);for(let s=0;s<t.length;s++)n[s]=we(e)^t[s],ge(e,t[s]);return n}function de(e,n){const s=[305419896,591751049,878082192];t.assign(e,{keys:s,crcKey0:new D(s[0]),crcKey2:new D(s[2])});for(let t=0;t<n.length;t++)ge(e,n.charCodeAt(t))}function ge(e,t){let[n,r,a]=e.keys;e.crcKey0.append([t]),n=~e.crcKey0.get(),r=me(s.imul(me(r+ye(n)),134775813)+1),e.crcKey2.append([r>>>24]),a=~e.crcKey2.get(),e.keys=[n,r,a]}function we(e){const t=2|e.keys[2];return ye(s.imul(t,1^t)>>>8)}function ye(e){return 255&e}function me(e){return 4294967295&e}class _e extends g{constructor(e,{chunkSize:t,CompressionStream:n,CompressionStreamNative:s}){super({});const{compressed:r,encrypted:a,useCompressionStream:o,zipCrypto:i,signed:c,level:l}=e,h=this;let p,f,d=super.readable;a&&!i||!c||(p=new C,d=ke(d,p)),r&&(d=ve(d,o,{level:l,chunkSize:t},s,n)),a&&(i?d=ke(d,new he(e)):(f=new ne(e),d=ke(d,f))),Se(h,d,()=>{let e;a&&!i&&(e=f.signature),a&&!i||!c||(e=new u(p.value.buffer).getUint32(0)),h.signature=e})}}class be extends g{constructor(e,{chunkSize:t,DecompressionStream:n,DecompressionStreamNative:s}){super({});const{zipCrypto:a,encrypted:o,signed:i,signature:c,compressed:l,useCompressionStream:h}=e;let p,f,d=super.readable;o&&(a?d=ke(d,new ue(e)):(f=new te(e),d=ke(d,f))),l&&(d=ve(d,h,{chunkSize:t},s,n)),o&&!a||!i||(p=new C,d=ke(d,p)),Se(this,d,()=>{if((!o||a)&&i){const e=new u(p.value.buffer);if(c!=e.getUint32(0,!1))throw new r(K)}})}}function Se(e,n,s){n=ke(n,new g({flush:s})),t.defineProperty(e,"readable",{get:()=>n})}function ve(e,t,n,s,r){return ke(e,new(t&&s?s:r)("deflate-raw",n))}function ke(e,t){return e.pipeThrough(t)}const ze="data",De="close";class Ce extends g{constructor(e,n){super({});const s=this,{codecType:a}=e;let o;a.startsWith("deflate")?o=_e:a.startsWith("inflate")&&(o=be),s.outputSize=0;let i=0;const c=new o(e,n),l=super.readable,u=new g({transform(e,t){e&&e.length&&(i+=e.length,t.enqueue(e))},flush(){t.assign(s,{inputSize:i})}}),h=new g({transform(t,n){if(t&&t.length&&(n.enqueue(t),s.outputSize+=t.length,e.outputSize&&s.outputSize>e.outputSize))throw new r("Invalid uncompressed size")},flush(){const{signature:e}=c;t.assign(s,{signature:e,inputSize:i})}});t.defineProperty(s,"readable",{get:()=>l.pipeThrough(u).pipeThrough(c).pipeThrough(h)})}}class Ie extends g{constructor(e){let t;super({transform:function n(s,r){if(t){const e=new a(t.length+s.length);e.set(t),e.set(s,t.length),s=e,t=null}s.length>e?(r.enqueue(s.slice(0,e)),n(s.slice(e),r)):t=s},flush(e){t&&t.length&&e.enqueue(t)}})}}const Ae=new l,qe=new l;let Re,He=0,Pe=!0;async function Be(e){try{const{options:t,scripts:s,config:r}=e;if(s&&s.length)try{Pe?importScripts.apply(b,s):await Ke(s)}catch(e){Pe=!1,await Ke(s)}self.initCodec&&self.initCodec(),r.CompressionStreamNative=self.CompressionStream,r.DecompressionStreamNative=self.DecompressionStream,self.Deflate&&(r.CompressionStream=new k(self.Deflate)),self.Inflate&&(r.DecompressionStream=new k(self.Inflate));const a={highWaterMark:1},o=e.readable||new w({async pull(e){const t=new h(e=>Ae.set(He,e));Te({type:"pull",messageId:He}),He=(He+1)%n.MAX_SAFE_INTEGER;const{value:s,done:r}=await t;e.enqueue(s),r&&e.close()}},a),i=e.writable||new y({async write(e){let t;const s=new h(e=>t=e);qe.set(He,t),Te({type:ze,value:e,messageId:He}),He=(He+1)%n.MAX_SAFE_INTEGER,await s}},a),c=new Ce(t,r);Re=new AbortController;const{signal:l}=Re;await o.pipeThrough(c).pipeThrough(new Ie(r.chunkSize)).pipeTo(i,{signal:l,preventClose:!0,preventAbort:!0}),await i.getWriter().close();const{signature:u,inputSize:p,outputSize:f}=c;Te({type:De,result:{signature:u,inputSize:p,outputSize:f}})}catch(e){e.outputSize=0,Ve(e)}}async function Ke(e){for(const t of e)await import(t)}function Te(e){let{value:t}=e;if(t)if(t.length)try{t=new a(t),e.value=t.buffer,d(e,[e.value])}catch(t){d(e)}else d(e);else d(e)}function Ve(e=new r("Unknown error")){const{message:t,stack:n,code:s,name:a,outputSize:o}=e;d({error:{message:t,stack:n,code:s,name:a,outputSize:o}})}function xe(e,n,s){return class{constructor(r){const o=this;var i,c;i=r,c="level",(typeof t.hasOwn===v?t.hasOwn(i,c):i.hasOwnProperty(c))&&r.level===b&&delete r.level,o.codec=new e(t.assign({},n,r)),s(o.codec,e=>{if(o.pendingData){const t=o.pendingData;o.pendingData=new a(t.length+e.length);const{pendingData:n}=o;n.set(t,0),n.set(e,t.length)}else o.pendingData=new a(e)})}append(e){return this.codec.push(e),r(this)}flush(){return this.codec.push(new a,!0),r(this)}};function r(e){if(e.pendingData){const t=e.pendingData;return e.pendingData=null,t}return new a}}addEventListener("message",({data:e})=>{const{type:t,messageId:n,value:s,done:r}=e;try{if("start"==t&&Be(e),t==ze){const e=Ae.get(n);Ae.delete(n),e({value:new a(s),done:r})}if("ack"==t){const e=qe.get(n);qe.delete(n),e()}t==De&&Re.abort()}catch(e){Ve(e)}}),self.initCodec=()=>{const{Deflate:e,Inflate:t}=((e,t={},n)=>({Deflate:xe(e.Deflate,t.deflate,n),Inflate:xe(e.Inflate,t.inflate,n)}))(pako,{deflate:{raw:!0},inflate:{raw:!0}},(e,t)=>e.onData=t);self.Deflate=e,self.Inflate=t}}();