@kitware/vtk.js 19.2.13 → 19.3.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 (717) hide show
  1. package/Common/Core/Base64.js +1 -1
  2. package/Common/Core/CellArray.js +2 -3
  3. package/Common/Core/ClassHierarchy.js +1 -1
  4. package/Common/Core/DataArray/Constants.js +1 -2
  5. package/Common/Core/DataArray.js +3 -4
  6. package/Common/Core/Endian.js +1 -2
  7. package/Common/Core/ImageHelper.js +1 -1
  8. package/Common/Core/LookupTable.js +1 -2
  9. package/Common/Core/MatrixBuilder.js +1 -1
  10. package/Common/Core/Points.js +1 -2
  11. package/Common/Core/PriorityQueue.js +1 -2
  12. package/Common/Core/ProgressHandler.js +1 -2
  13. package/Common/Core/ScalarsToColors/Constants.js +1 -2
  14. package/Common/Core/ScalarsToColors.js +2 -3
  15. package/Common/Core/StringArray.js +1 -2
  16. package/Common/Core/URLExtract.js +1 -1
  17. package/Common/Core/VariantArray.js +1 -2
  18. package/Common/Core.js +1 -1
  19. package/Common/DataModel/BoundingBox.js +2 -3
  20. package/Common/DataModel/Box.js +2 -3
  21. package/Common/DataModel/CardinalSpline1D.js +1 -2
  22. package/Common/DataModel/Cell.js +1 -2
  23. package/Common/DataModel/CellLinks.js +26 -27
  24. package/Common/DataModel/CellTypes/Constants.js +1 -2
  25. package/Common/DataModel/CellTypes.js +2 -3
  26. package/Common/DataModel/Cone.js +1 -2
  27. package/Common/DataModel/Cylinder.js +2 -3
  28. package/Common/DataModel/DataSet/Constants.js +1 -2
  29. package/Common/DataModel/DataSet.js +2 -3
  30. package/Common/DataModel/DataSetAttributes/Constants.js +1 -2
  31. package/Common/DataModel/DataSetAttributes/FieldData.js +1 -2
  32. package/Common/DataModel/DataSetAttributes.js +2 -3
  33. package/Common/DataModel/ITKHelper.js +1 -1
  34. package/Common/DataModel/ImageData.js +1 -2
  35. package/Common/DataModel/ImplicitBoolean/Constants.js +1 -2
  36. package/Common/DataModel/ImplicitBoolean.js +2 -3
  37. package/Common/DataModel/KochanekSpline1D.js +1 -2
  38. package/Common/DataModel/Line/Constants.js +1 -2
  39. package/Common/DataModel/Line.js +2 -3
  40. package/Common/DataModel/Molecule.js +1 -2
  41. package/Common/DataModel/PiecewiseFunction.js +1 -2
  42. package/Common/DataModel/Plane.js +2 -3
  43. package/Common/DataModel/PointSet.js +1 -2
  44. package/Common/DataModel/PolyData/Constants.js +1 -2
  45. package/Common/DataModel/PolyData.js +1 -2
  46. package/Common/DataModel/Polygon.js +1 -2
  47. package/Common/DataModel/SelectionNode/Constants.js +1 -2
  48. package/Common/DataModel/SelectionNode.js +2 -3
  49. package/Common/DataModel/Sphere.js +2 -3
  50. package/Common/DataModel/Spline1D.js +1 -2
  51. package/Common/DataModel/Spline3D/Constants.js +1 -2
  52. package/Common/DataModel/Spline3D.js +1 -2
  53. package/Common/DataModel/StructuredData/Constants.js +1 -2
  54. package/Common/DataModel/StructuredData.js +2 -3
  55. package/Common/DataModel/Triangle.js +2 -3
  56. package/Common/DataModel.js +1 -1
  57. package/Common/System/MobileVR/headsets.js +1 -1
  58. package/Common/System/MobileVR.js +1 -1
  59. package/Common/System/TimerLog.js +1 -2
  60. package/Common/System.js +1 -1
  61. package/Common/Transform/LandmarkTransform/Constants.js +1 -2
  62. package/Common/Transform/LandmarkTransform.js +2 -3
  63. package/Common/Transform.js +1 -1
  64. package/Common/index.js +1 -1
  65. package/Filters/Core/Cutter.js +3 -4
  66. package/Filters/Core.js +1 -1
  67. package/Filters/Cornerstone/ImageDataToCornerstoneImage.js +1 -2
  68. package/Filters/Cornerstone.js +1 -1
  69. package/Filters/General/AppendPolyData.js +1 -2
  70. package/Filters/General/Calculator.js +2 -3
  71. package/Filters/General/ClosedPolyLineToSurfaceFilter.js +1 -2
  72. package/Filters/General/ImageCropFilter.js +1 -2
  73. package/Filters/General/ImageMarchingCubes/caseTable.js +1 -1
  74. package/Filters/General/ImageMarchingCubes.js +1 -2
  75. package/Filters/General/ImageMarchingSquares/caseTable.js +1 -1
  76. package/Filters/General/ImageMarchingSquares.js +1 -2
  77. package/Filters/General/ImageOutlineFilter.js +1 -2
  78. package/Filters/General/ImageSliceFilter.js +1 -2
  79. package/Filters/General/ImageStreamline.js +1 -2
  80. package/Filters/General/LineFilter.js +1 -2
  81. package/Filters/General/MoleculeToRepresentation.js +1 -2
  82. package/Filters/General/OutlineFilter.js +1 -2
  83. package/Filters/General/PaintFilter/PaintFilter.worker.js +3 -3
  84. package/Filters/General/PaintFilter.js +3 -4
  85. package/Filters/General/ScalarToRGBA.js +1 -2
  86. package/Filters/General/TriangleFilter.js +1 -2
  87. package/Filters/General/TubeFilter/Constants.js +1 -2
  88. package/Filters/General/TubeFilter.js +1 -2
  89. package/Filters/General/WarpScalar.js +1 -2
  90. package/Filters/General/WindowedSincPolyDataFilter.js +43 -44
  91. package/Filters/General.js +1 -1
  92. package/Filters/Sources/Arrow2DSource/Constants.js +1 -2
  93. package/Filters/Sources/Arrow2DSource.js +2 -3
  94. package/Filters/Sources/ArrowSource.js +1 -2
  95. package/Filters/Sources/CircleSource.js +2 -3
  96. package/Filters/Sources/ConcentricCylinderSource.js +1 -2
  97. package/Filters/Sources/ConeSource.js +1 -2
  98. package/Filters/Sources/CubeSource.js +1 -2
  99. package/Filters/Sources/Cursor3D.js +12 -13
  100. package/Filters/Sources/CylinderSource.js +1 -2
  101. package/Filters/Sources/ImageGridSource.js +1 -2
  102. package/Filters/Sources/LineSource.js +1 -2
  103. package/Filters/Sources/PlaneSource.js +1 -2
  104. package/Filters/Sources/PointSource.js +1 -2
  105. package/Filters/Sources/RTAnalyticSource.js +1 -2
  106. package/Filters/Sources/SLICSource.js +1 -2
  107. package/Filters/Sources/SphereSource.js +1 -2
  108. package/Filters/Sources/ViewFinderSource.js +1 -2
  109. package/Filters/Sources.js +1 -1
  110. package/Filters/Texture/TextureMapToPlane.js +1 -2
  111. package/Filters/Texture/TextureMapToSphere.js +1 -2
  112. package/Filters/Texture.js +1 -1
  113. package/Filters/index.js +1 -1
  114. package/IO/Core/BinaryHelper.js +1 -1
  115. package/IO/Core/DataAccessHelper/HtmlDataAccessHelper.js +1 -1
  116. package/IO/Core/DataAccessHelper/HttpDataAccessHelper.js +1 -1
  117. package/IO/Core/DataAccessHelper/JSZipDataAccessHelper.js +3 -3
  118. package/IO/Core/DataAccessHelper/LiteHttpDataAccessHelper.js +1 -1
  119. package/IO/Core/DataAccessHelper.js +1 -2
  120. package/IO/Core/HttpDataSetReader.js +1 -2
  121. package/IO/Core/HttpDataSetSeriesReader.js +1 -2
  122. package/IO/Core/HttpSceneLoader.js +2 -3
  123. package/IO/Core/ImageStream/DefaultProtocol.js +1 -1
  124. package/IO/Core/ImageStream/ViewStream.js +1 -2
  125. package/IO/Core/ImageStream.js +1 -2
  126. package/IO/Core/ResourceLoader.js +1 -2
  127. package/IO/Core/Serializer/ArraySerializer.js +1 -2
  128. package/IO/Core/Serializer/FieldDataSerializer.js +1 -1
  129. package/IO/Core/Serializer/ImageDataSerializer.js +1 -1
  130. package/IO/Core/Serializer/PolyDataSerializer.js +1 -1
  131. package/IO/Core/Serializer.js +1 -1
  132. package/IO/Core/WSLinkClient.js +1 -2
  133. package/IO/Core/ZipMultiDataSetReader.js +3 -4
  134. package/IO/Core/ZipMultiDataSetWriter.js +3 -4
  135. package/IO/Core.js +1 -1
  136. package/IO/Geometry/DracoReader.js +1 -2
  137. package/IO/Geometry/PLYReader.js +1 -2
  138. package/IO/Geometry/STLReader.js +1 -2
  139. package/IO/Geometry/STLWriter/Constants.js +1 -2
  140. package/IO/Geometry/STLWriter.js +2 -3
  141. package/IO/Geometry.js +1 -1
  142. package/IO/Legacy/LegacyAsciiParser.js +1 -1
  143. package/IO/Legacy/PolyDataReader.js +1 -2
  144. package/IO/Legacy.js +1 -1
  145. package/IO/Misc/ElevationReader.js +1 -2
  146. package/IO/Misc/HttpDataSetLODsLoader.js +1 -2
  147. package/IO/Misc/ITKImageReader.js +1 -2
  148. package/IO/Misc/ITKPolyDataReader.js +1 -2
  149. package/IO/Misc/JSONNucleoReader.js +1 -2
  150. package/IO/Misc/JSONReader.js +1 -2
  151. package/IO/Misc/MTLReader.js +2 -3
  152. package/IO/Misc/OBJReader.js +1 -2
  153. package/IO/Misc/PDBReader.js +1 -2
  154. package/IO/Misc/SkyboxReader.js +3 -4
  155. package/IO/Misc.js +1 -1
  156. package/IO/XML/XMLImageDataReader.js +1 -2
  157. package/IO/XML/XMLImageDataWriter.js +2 -3
  158. package/IO/XML/XMLPolyDataReader.js +1 -2
  159. package/IO/XML/XMLPolyDataWriter.js +2 -3
  160. package/IO/XML/XMLReader.js +1 -2
  161. package/IO/XML/XMLWriter/Constants.js +1 -2
  162. package/IO/XML/XMLWriter.js +4 -4
  163. package/IO/XML.js +1 -1
  164. package/IO/index.js +1 -1
  165. package/Imaging/Core/AbstractImageInterpolator/Constants.js +1 -2
  166. package/Imaging/Core/AbstractImageInterpolator/InterpolationInfo.js +2 -3
  167. package/Imaging/Core/AbstractImageInterpolator.js +2 -3
  168. package/Imaging/Core/ImageInterpolator.js +2 -3
  169. package/Imaging/Core/ImagePointDataIterator.js +1 -2
  170. package/Imaging/Core/ImageReslice/Constants.js +1 -2
  171. package/Imaging/Core/ImageReslice.js +2 -3
  172. package/Imaging/Core.js +1 -1
  173. package/Imaging/Hybrid/SampleFunction.js +2 -3
  174. package/Imaging/Hybrid.js +1 -1
  175. package/Imaging/index.js +1 -1
  176. package/Interaction/Animations/TimeStepBasedAnimationHandler.js +2 -3
  177. package/Interaction/Manipulators/CompositeCameraManipulator.js +1 -2
  178. package/Interaction/Manipulators/CompositeGestureManipulator.js +1 -2
  179. package/Interaction/Manipulators/CompositeKeyboardManipulator.js +1 -2
  180. package/Interaction/Manipulators/CompositeMouseManipulator.js +1 -2
  181. package/Interaction/Manipulators/CompositeVRManipulator.js +1 -2
  182. package/Interaction/Manipulators/GestureCameraManipulator.js +1 -2
  183. package/Interaction/Manipulators/KeyboardCameraManipulator.js +1 -2
  184. package/Interaction/Manipulators/MouseBoxSelectorManipulator.js +3 -4
  185. package/Interaction/Manipulators/MouseCameraAxisRotateManipulator.js +1 -2
  186. package/Interaction/Manipulators/MouseCameraSliceManipulator.js +1 -2
  187. package/Interaction/Manipulators/MouseCameraTrackballFirstPersonManipulator.js +1 -2
  188. package/Interaction/Manipulators/MouseCameraTrackballMultiRotateManipulator.js +1 -2
  189. package/Interaction/Manipulators/MouseCameraTrackballPanManipulator.js +1 -2
  190. package/Interaction/Manipulators/MouseCameraTrackballRollManipulator.js +1 -2
  191. package/Interaction/Manipulators/MouseCameraTrackballRotateManipulator.js +1 -2
  192. package/Interaction/Manipulators/MouseCameraTrackballZoomManipulator.js +1 -2
  193. package/Interaction/Manipulators/MouseCameraTrackballZoomToMouseManipulator.js +1 -2
  194. package/Interaction/Manipulators/MouseCameraUnicamManipulator.js +1 -2
  195. package/Interaction/Manipulators/MouseCameraUnicamRotateManipulator.js +1 -2
  196. package/Interaction/Manipulators/MouseRangeManipulator.js +1 -2
  197. package/Interaction/Manipulators/VRButtonPanManipulator.js +1 -2
  198. package/Interaction/Manipulators.js +1 -1
  199. package/Interaction/Misc/DeviceOrientationToCamera.js +1 -1
  200. package/Interaction/Misc.js +1 -1
  201. package/Interaction/Style/InteractorStyleImage.js +1 -2
  202. package/Interaction/Style/InteractorStyleMPRSlice.js +1 -2
  203. package/Interaction/Style/InteractorStyleManipulator/Presets.js +1 -1
  204. package/Interaction/Style/InteractorStyleManipulator.js +2 -3
  205. package/Interaction/Style/InteractorStyleRemoteMouse.js +2 -3
  206. package/Interaction/Style/InteractorStyleTrackballCamera.js +1 -2
  207. package/Interaction/Style/InteractorStyleUnicam.js +1 -2
  208. package/Interaction/Style.js +1 -1
  209. package/Interaction/UI/CornerAnnotation.js +1 -2
  210. package/Interaction/UI/FPSMonitor.js +2 -3
  211. package/Interaction/UI/Icons.js +1 -1
  212. package/Interaction/UI/Slider/Constants.js +1 -2
  213. package/Interaction/UI/Slider.js +2 -3
  214. package/Interaction/UI/VolumeController.js +1 -2
  215. package/Interaction/UI.js +1 -1
  216. package/Interaction/Widgets/AbstractWidget.js +2 -3
  217. package/Interaction/Widgets/DistanceRepresentation.js +2 -3
  218. package/Interaction/Widgets/DistanceWidget.js +2 -3
  219. package/Interaction/Widgets/HandleRepresentation/Constants.js +1 -2
  220. package/Interaction/Widgets/HandleRepresentation.js +2 -3
  221. package/Interaction/Widgets/HandleWidget/Constants.js +1 -2
  222. package/Interaction/Widgets/HandleWidget.js +2 -3
  223. package/Interaction/Widgets/ImageCroppingRegionsRepresentation.js +1 -2
  224. package/Interaction/Widgets/ImageCroppingRegionsWidget/Constants.js +1 -1
  225. package/Interaction/Widgets/ImageCroppingRegionsWidget.js +2 -3
  226. package/Interaction/Widgets/LabelRepresentation/Constants.js +1 -2
  227. package/Interaction/Widgets/LabelRepresentation.js +3 -4
  228. package/Interaction/Widgets/LabelWidget.js +2 -3
  229. package/Interaction/Widgets/LineRepresentation/Constants.js +1 -2
  230. package/Interaction/Widgets/LineRepresentation.js +2 -3
  231. package/Interaction/Widgets/LineWidget/Constants.js +1 -2
  232. package/Interaction/Widgets/LineWidget.js +2 -3
  233. package/Interaction/Widgets/OrientationMarkerWidget/Constants.js +1 -1
  234. package/Interaction/Widgets/OrientationMarkerWidget.js +2 -3
  235. package/Interaction/Widgets/PiecewiseGaussianWidget/ComputeHistogram.worker.js +3 -3
  236. package/Interaction/Widgets/PiecewiseGaussianWidget.js +15 -16
  237. package/Interaction/Widgets/PointPlacer.js +1 -2
  238. package/Interaction/Widgets/ResliceCursor/ResliceCursor/Constants.js +1 -2
  239. package/Interaction/Widgets/ResliceCursor/ResliceCursor.js +2 -3
  240. package/Interaction/Widgets/ResliceCursor/ResliceCursorActor/Constants.js +1 -2
  241. package/Interaction/Widgets/ResliceCursor/ResliceCursorActor.js +2 -3
  242. package/Interaction/Widgets/ResliceCursor/ResliceCursorLineRepresentation.js +1 -2
  243. package/Interaction/Widgets/ResliceCursor/ResliceCursorPolyDataAlgorithm.js +2 -3
  244. package/Interaction/Widgets/ResliceCursor/ResliceCursorRepresentation.js +1 -2
  245. package/Interaction/Widgets/ResliceCursor/ResliceCursorWidget/Constants.js +1 -2
  246. package/Interaction/Widgets/ResliceCursor/ResliceCursorWidget.js +2 -3
  247. package/Interaction/Widgets/SphereHandleRepresentation.js +2 -3
  248. package/Interaction/Widgets/WidgetRepresentation.js +1 -2
  249. package/Interaction/Widgets.js +1 -1
  250. package/Interaction/index.js +1 -1
  251. package/Proxy/Animation/AbstractAnimationProxy.js +1 -2
  252. package/Proxy/Animation/AnimationProxyManager.js +1 -2
  253. package/Proxy/Animation/TimeStepBasedAnimationHandlerProxy.js +1 -2
  254. package/Proxy/Core/AbstractRepresentationProxy.js +1 -1
  255. package/Proxy/Core/LookupTableProxy/Constants.js +1 -1
  256. package/Proxy/Core/LookupTableProxy.js +1 -2
  257. package/Proxy/Core/PiecewiseFunctionProxy/Constants.js +1 -1
  258. package/Proxy/Core/PiecewiseFunctionProxy.js +2 -3
  259. package/Proxy/Core/ProxyManager/core.js +2 -2
  260. package/Proxy/Core/ProxyManager/properties.js +2 -2
  261. package/Proxy/Core/ProxyManager/state.js +2 -2
  262. package/Proxy/Core/ProxyManager/view.js +1 -1
  263. package/Proxy/Core/ProxyManager.js +1 -2
  264. package/Proxy/Core/SourceProxy.js +1 -2
  265. package/Proxy/Core/View2DProxy.js +1 -2
  266. package/Proxy/Core/ViewProxy.js +4 -4
  267. package/Proxy/Core.js +1 -1
  268. package/Proxy/Representations/GeometryRepresentationProxy.js +1 -2
  269. package/Proxy/Representations/GlyphRepresentationProxy.js +1 -2
  270. package/Proxy/Representations/MoleculeRepresentationProxy.js +1 -2
  271. package/Proxy/Representations/SkyboxRepresentationProxy.js +1 -2
  272. package/Proxy/Representations/SliceRepresentationProxy.js +2 -3
  273. package/Proxy/Representations/SlicedGeometryRepresentationProxy.js +1 -2
  274. package/Proxy/Representations/VolumeRepresentationProxy.js +1 -2
  275. package/Proxy/Representations.js +1 -1
  276. package/Proxy/index.js +1 -1
  277. package/Rendering/Core/AbstractMapper.js +1 -2
  278. package/Rendering/Core/AbstractMapper3D.js +1 -2
  279. package/Rendering/Core/AbstractPicker.js +1 -2
  280. package/Rendering/Core/Actor.js +2 -3
  281. package/Rendering/Core/Actor2D.js +1 -2
  282. package/Rendering/Core/AnnotatedCubeActor/Presets.js +1 -1
  283. package/Rendering/Core/AnnotatedCubeActor.js +2 -3
  284. package/Rendering/Core/AxesActor.js +2 -3
  285. package/Rendering/Core/Camera.js +1 -2
  286. package/Rendering/Core/CellPicker.js +2 -3
  287. package/Rendering/Core/ColorTransferFunction/ColorMaps.js +1 -1
  288. package/Rendering/Core/ColorTransferFunction/ColorMapsLite.js +1 -1
  289. package/Rendering/Core/ColorTransferFunction/Constants.js +1 -2
  290. package/Rendering/Core/ColorTransferFunction.js +2 -3
  291. package/Rendering/Core/Coordinate/Constants.js +1 -2
  292. package/Rendering/Core/Coordinate.js +2 -3
  293. package/Rendering/Core/CubeAxesActor.js +2 -3
  294. package/Rendering/Core/Follower.js +2 -3
  295. package/Rendering/Core/Glyph3DMapper/Constants.js +1 -2
  296. package/Rendering/Core/Glyph3DMapper.js +2 -3
  297. package/Rendering/Core/HardwareSelector.js +1 -2
  298. package/Rendering/Core/ImageMapper/Constants.js +1 -2
  299. package/Rendering/Core/ImageMapper.js +2 -3
  300. package/Rendering/Core/ImageProperty/Constants.js +1 -2
  301. package/Rendering/Core/ImageProperty.js +1 -2
  302. package/Rendering/Core/ImageSlice.js +1 -2
  303. package/Rendering/Core/InteractorObserver.js +2 -3
  304. package/Rendering/Core/InteractorStyle/Constants.js +1 -2
  305. package/Rendering/Core/InteractorStyle.js +2 -3
  306. package/Rendering/Core/Light.js +1 -2
  307. package/Rendering/Core/Mapper/CoincidentTopologyHelper.js +1 -2
  308. package/Rendering/Core/Mapper/Constants.js +1 -2
  309. package/Rendering/Core/Mapper/Static.js +1 -2
  310. package/Rendering/Core/Mapper.js +2 -3
  311. package/Rendering/Core/Picker.js +2 -3
  312. package/Rendering/Core/PixelSpaceCallbackMapper.js +1 -2
  313. package/Rendering/Core/PointPicker.js +1 -9
  314. package/Rendering/Core/Prop.js +1 -2
  315. package/Rendering/Core/Prop3D.js +1 -2
  316. package/Rendering/Core/Property/Constants.js +1 -2
  317. package/Rendering/Core/Property.js +2 -3
  318. package/Rendering/Core/Property2D.js +1 -2
  319. package/Rendering/Core/RenderWindow.js +1 -2
  320. package/Rendering/Core/RenderWindowInteractor/Constants.js +1 -2
  321. package/Rendering/Core/RenderWindowInteractor.js +2 -3
  322. package/Rendering/Core/Renderer.js +2 -3
  323. package/Rendering/Core/ScalarBarActor.js +2 -3
  324. package/Rendering/Core/Skybox.js +1 -2
  325. package/Rendering/Core/SphereMapper.js +1 -2
  326. package/Rendering/Core/StickMapper.js +1 -2
  327. package/Rendering/Core/SurfaceLICInterface/Constants.js +1 -2
  328. package/Rendering/Core/SurfaceLICInterface.js +1 -2
  329. package/Rendering/Core/SurfaceLICMapper.js +1 -2
  330. package/Rendering/Core/Texture.js +1 -2
  331. package/Rendering/Core/Viewport.js +1 -2
  332. package/Rendering/Core/Volume.js +1 -2
  333. package/Rendering/Core/VolumeMapper/Constants.js +1 -2
  334. package/Rendering/Core/VolumeMapper.js +1 -2
  335. package/Rendering/Core/VolumeProperty/Constants.js +1 -2
  336. package/Rendering/Core/VolumeProperty.js +2 -3
  337. package/Rendering/Core.js +2 -2
  338. package/Rendering/Misc/CanvasView.js +1 -2
  339. package/Rendering/Misc/FullScreenRenderWindow.js +1 -2
  340. package/Rendering/Misc/GenericRenderWindow.js +1 -2
  341. package/Rendering/Misc/RemoteView.js +1 -2
  342. package/Rendering/Misc/RenderWindowWithControlBar.js +2 -3
  343. package/Rendering/Misc/SynchronizableRenderWindow/vtkObjectManager.js +2 -2
  344. package/Rendering/Misc/SynchronizableRenderWindow.js +3 -4
  345. package/Rendering/Misc/TextureLODsDownloader.js +1 -2
  346. package/Rendering/Misc.js +1 -1
  347. package/Rendering/OpenGL/Actor.js +2 -3
  348. package/Rendering/OpenGL/Actor2D.js +2 -3
  349. package/Rendering/OpenGL/BufferObject/Constants.js +1 -2
  350. package/Rendering/OpenGL/BufferObject.js +2 -3
  351. package/Rendering/OpenGL/Camera.js +2 -3
  352. package/Rendering/OpenGL/CellArrayBufferObject.js +2 -4
  353. package/Rendering/OpenGL/Convolution2DPass.js +1 -2
  354. package/Rendering/OpenGL/ForwardPass.js +1 -2
  355. package/Rendering/OpenGL/Framebuffer.js +2 -3
  356. package/Rendering/OpenGL/Glyph3DMapper.js +3 -4
  357. package/Rendering/OpenGL/HardwareSelector/Constants.js +1 -2
  358. package/Rendering/OpenGL/HardwareSelector.js +2 -3
  359. package/Rendering/OpenGL/Helper.js +1 -2
  360. package/Rendering/OpenGL/ImageMapper.js +2 -3
  361. package/Rendering/OpenGL/ImageSlice.js +2 -3
  362. package/Rendering/OpenGL/PixelSpaceCallbackMapper.js +1 -2
  363. package/Rendering/OpenGL/PolyDataMapper.js +2 -3
  364. package/Rendering/OpenGL/RadialDistortionPass.js +1 -2
  365. package/Rendering/OpenGL/RenderWindow.js +1 -2
  366. package/Rendering/OpenGL/Renderer.js +2 -3
  367. package/Rendering/OpenGL/ReplacementShaderMapper.js +1 -1
  368. package/Rendering/OpenGL/Shader.js +1 -2
  369. package/Rendering/OpenGL/ShaderCache.js +1 -2
  370. package/Rendering/OpenGL/ShaderProgram.js +1 -1
  371. package/Rendering/OpenGL/Skybox.js +2 -3
  372. package/Rendering/OpenGL/SphereMapper.js +2 -3
  373. package/Rendering/OpenGL/StickMapper.js +2 -3
  374. package/Rendering/OpenGL/SurfaceLIC/LineIntegralConvolution2D/pingpong.js +1 -2
  375. package/Rendering/OpenGL/SurfaceLIC/LineIntegralConvolution2D.js +1 -2
  376. package/Rendering/OpenGL/SurfaceLIC/SurfaceLICInterface.js +1 -2
  377. package/Rendering/OpenGL/SurfaceLIC/SurfaceLICMapper.js +3 -4
  378. package/Rendering/OpenGL/SurfaceLIC.js +1 -1
  379. package/Rendering/OpenGL/Texture/Constants.js +1 -2
  380. package/Rendering/OpenGL/Texture.js +3 -4
  381. package/Rendering/OpenGL/TextureUnitManager.js +1 -2
  382. package/Rendering/OpenGL/VertexArrayObject.js +1 -2
  383. package/Rendering/OpenGL/ViewNodeFactory.js +1 -2
  384. package/Rendering/OpenGL/Volume.js +2 -3
  385. package/Rendering/OpenGL/VolumeMapper.js +3 -4
  386. package/Rendering/OpenGL.js +1 -1
  387. package/Rendering/SceneGraph/RenderPass.js +1 -2
  388. package/Rendering/SceneGraph/RenderWindowViewNode.js +1 -2
  389. package/Rendering/SceneGraph/ViewNode.js +1 -1
  390. package/Rendering/SceneGraph/ViewNodeFactory.js +1 -2
  391. package/Rendering/SceneGraph.js +1 -1
  392. package/Rendering/WebGPU/Actor.js +1 -2
  393. package/Rendering/WebGPU/BindGroup.js +1 -2
  394. package/Rendering/WebGPU/Buffer.js +2 -3
  395. package/Rendering/WebGPU/BufferManager/Constants.js +1 -2
  396. package/Rendering/WebGPU/BufferManager.js +3 -4
  397. package/Rendering/WebGPU/Camera.js +1 -2
  398. package/Rendering/WebGPU/Device.js +2 -3
  399. package/Rendering/WebGPU/ForwardPass.js +1 -2
  400. package/Rendering/WebGPU/FullScreenQuad.js +1 -2
  401. package/Rendering/WebGPU/Glyph3DMapper.js +3 -4
  402. package/Rendering/WebGPU/HardwareSelectionPass.js +1 -2
  403. package/Rendering/WebGPU/HardwareSelector.js +1 -2
  404. package/Rendering/WebGPU/MapperHelper.js +1 -2
  405. package/Rendering/WebGPU/OpaquePass.js +2 -4
  406. package/Rendering/WebGPU/OrderIndependentTranslucentPass.js +1 -2
  407. package/Rendering/WebGPU/Pipeline.js +2 -3
  408. package/Rendering/WebGPU/PixelSpaceCallbackMapper.js +1 -2
  409. package/Rendering/WebGPU/PolyDataMapper.js +3 -4
  410. package/Rendering/WebGPU/RenderEncoder.js +2 -3
  411. package/Rendering/WebGPU/RenderWindow.js +11 -3
  412. package/Rendering/WebGPU/Renderer.js +2 -3
  413. package/Rendering/WebGPU/Sampler.js +1 -2
  414. package/Rendering/WebGPU/ShaderCache.js +1 -2
  415. package/Rendering/WebGPU/ShaderDescription.js +1 -2
  416. package/Rendering/WebGPU/ShaderModule.js +1 -1
  417. package/Rendering/WebGPU/SphereMapper.js +1 -2
  418. package/Rendering/WebGPU/StickMapper.js +1 -2
  419. package/Rendering/WebGPU/StorageBuffer.js +1 -2
  420. package/Rendering/WebGPU/Texture.js +2 -3
  421. package/Rendering/WebGPU/TextureManager.js +24 -7
  422. package/Rendering/WebGPU/TextureView.js +19 -4
  423. package/Rendering/WebGPU/Types.js +83 -42
  424. package/Rendering/WebGPU/UniformBuffer.js +1 -2
  425. package/Rendering/WebGPU/VertexInput.js +2 -3
  426. package/Rendering/WebGPU/ViewNodeFactory.js +1 -2
  427. package/Rendering/WebGPU/Volume.js +1 -2
  428. package/Rendering/WebGPU/VolumePass.js +2 -3
  429. package/Rendering/WebGPU/VolumePassFSQ.js +4 -4
  430. package/Rendering/WebGPU.js +1 -1
  431. package/Rendering/index.js +1 -1
  432. package/ThirdParty/index.js +2 -2
  433. package/Utilities/DataGenerator/convert-cli.js +10 -8
  434. package/Utilities/ExampleRunner/example-runner-cli.js +2 -1
  435. package/Utilities/ExampleRunner/template-config.js +8 -6
  436. package/Utilities/TestResults/TESTS-Chrome_Headless_93.0.4577.63_(Linux_x86_64).xml +1058 -1058
  437. package/Utilities/XMLConverter/xml2json-cli.js +5 -4
  438. package/Widgets/Core/AbstractWidget/Constants.js +1 -2
  439. package/Widgets/Core/AbstractWidget.js +1 -2
  440. package/Widgets/Core/AbstractWidgetFactory.js +2 -3
  441. package/Widgets/Core/StateBuilder/boundsMixin.js +1 -2
  442. package/Widgets/Core/StateBuilder/colorMixin.js +1 -2
  443. package/Widgets/Core/StateBuilder/cornerMixin.js +1 -2
  444. package/Widgets/Core/StateBuilder/directionMixin.js +1 -2
  445. package/Widgets/Core/StateBuilder/manipulatorMixin.js +1 -2
  446. package/Widgets/Core/StateBuilder/nameMixin.js +1 -2
  447. package/Widgets/Core/StateBuilder/orientationMixin.js +1 -2
  448. package/Widgets/Core/StateBuilder/originMixin.js +1 -2
  449. package/Widgets/Core/StateBuilder/scale1Mixin.js +1 -2
  450. package/Widgets/Core/StateBuilder/scale3Mixin.js +1 -2
  451. package/Widgets/Core/StateBuilder/shapeMixin.js +1 -2
  452. package/Widgets/Core/StateBuilder/textMixin.js +1 -2
  453. package/Widgets/Core/StateBuilder/visibleMixin.js +1 -2
  454. package/Widgets/Core/StateBuilder.js +1 -2
  455. package/Widgets/Core/WidgetManager/Constants.js +1 -2
  456. package/Widgets/Core/WidgetManager.js +1 -2
  457. package/Widgets/Core/WidgetState.js +1 -2
  458. package/Widgets/Core.js +1 -1
  459. package/Widgets/Manipulators/LineManipulator.js +1 -2
  460. package/Widgets/Manipulators/PlaneManipulator.js +1 -2
  461. package/Widgets/Manipulators/TrackballManipulator.js +1 -2
  462. package/Widgets/Manipulators.js +1 -1
  463. package/Widgets/Representations/ArrowHandleRepresentation.js +2 -3
  464. package/Widgets/Representations/CircleContextRepresentation.js +1 -2
  465. package/Widgets/Representations/ContextRepresentation.js +2 -3
  466. package/Widgets/Representations/ConvexFaceContextRepresentation.js +1 -2
  467. package/Widgets/Representations/CroppingOutlineRepresentation.js +1 -2
  468. package/Widgets/Representations/CubeHandleRepresentation.js +1 -2
  469. package/Widgets/Representations/HandleRepresentation.js +2 -3
  470. package/Widgets/Representations/ImplicitPlaneRepresentation.js +1 -2
  471. package/Widgets/Representations/OutlineContextRepresentation.js +1 -2
  472. package/Widgets/Representations/PolyLineRepresentation.js +2 -3
  473. package/Widgets/Representations/RectangleContextRepresentation.js +1 -2
  474. package/Widgets/Representations/ResliceCursorContextRepresentation.js +2 -3
  475. package/Widgets/Representations/SphereHandleRepresentation.js +1 -2
  476. package/Widgets/Representations/SplineContextRepresentation.js +1 -2
  477. package/Widgets/Representations/WidgetRepresentation/Constants.js +1 -2
  478. package/Widgets/Representations/WidgetRepresentation.js +1 -2
  479. package/Widgets/Representations.js +1 -1
  480. package/Widgets/SVG/SVGLandmarkRepresentation.js +2 -3
  481. package/Widgets/SVG/SVGRepresentation.js +3 -2
  482. package/Widgets/Widgets3D/AngleWidget/behavior.js +1 -1
  483. package/Widgets/Widgets3D/AngleWidget/state.js +1 -1
  484. package/Widgets/Widgets3D/AngleWidget.js +1 -2
  485. package/Widgets/Widgets3D/DistanceWidget/behavior.js +1 -1
  486. package/Widgets/Widgets3D/DistanceWidget/state.js +1 -1
  487. package/Widgets/Widgets3D/DistanceWidget.js +1 -2
  488. package/Widgets/Widgets3D/EllipseWidget/behavior.js +2 -2
  489. package/Widgets/Widgets3D/EllipseWidget/state.js +1 -1
  490. package/Widgets/Widgets3D/EllipseWidget.js +2 -3
  491. package/Widgets/Widgets3D/ImageCroppingWidget/behavior.js +1 -1
  492. package/Widgets/Widgets3D/ImageCroppingWidget/state.js +1 -1
  493. package/Widgets/Widgets3D/ImageCroppingWidget.js +1 -2
  494. package/Widgets/Widgets3D/ImplicitPlaneWidget.js +1 -2
  495. package/Widgets/Widgets3D/InteractiveOrientationWidget/behavior.js +2 -2
  496. package/Widgets/Widgets3D/InteractiveOrientationWidget/state.js +1 -2
  497. package/Widgets/Widgets3D/InteractiveOrientationWidget.js +1 -2
  498. package/Widgets/Widgets3D/LineWidget/Constants.js +1 -2
  499. package/Widgets/Widgets3D/LineWidget/behavior.js +2 -2
  500. package/Widgets/Widgets3D/LineWidget/state.js +1 -1
  501. package/Widgets/Widgets3D/LineWidget.js +1 -2
  502. package/Widgets/Widgets3D/PaintWidget.js +1 -2
  503. package/Widgets/Widgets3D/PolyLineWidget/behavior.js +1 -1
  504. package/Widgets/Widgets3D/PolyLineWidget/state.js +1 -1
  505. package/Widgets/Widgets3D/PolyLineWidget.js +1 -2
  506. package/Widgets/Widgets3D/RectangleWidget/behavior.js +2 -2
  507. package/Widgets/Widgets3D/RectangleWidget/state.js +1 -1
  508. package/Widgets/Widgets3D/RectangleWidget.js +2 -3
  509. package/Widgets/Widgets3D/ResliceCursorWidget/Constants.js +1 -2
  510. package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +1 -1
  511. package/Widgets/Widgets3D/ResliceCursorWidget/state.js +1 -1
  512. package/Widgets/Widgets3D/ResliceCursorWidget.js +1 -2
  513. package/Widgets/Widgets3D/ShapeWidget/Constants.js +1 -2
  514. package/Widgets/Widgets3D/ShapeWidget/behavior.js +2 -2
  515. package/Widgets/Widgets3D/ShapeWidget.js +1 -2
  516. package/Widgets/Widgets3D/SplineWidget/behavior.js +1 -1
  517. package/Widgets/Widgets3D/SplineWidget/state.js +1 -1
  518. package/Widgets/Widgets3D/SplineWidget.js +1 -2
  519. package/Widgets/Widgets3D.js +1 -1
  520. package/Widgets/index.js +1 -1
  521. package/_vendor/base64-js/index.js_commonjs-exports +1 -0
  522. package/_vendor/blueimp-md5/js/md5.js_commonjs-module +3 -0
  523. package/_vendor/define-properties/index.js_commonjs-proxy +1 -1
  524. package/_vendor/globalthis/implementation.browser.js_commonjs-module +3 -0
  525. package/_vendor/globalthis/implementation.browser.js_commonjs-proxy +1 -1
  526. package/_vendor/globalthis/polyfill.js_commonjs-proxy +1 -1
  527. package/_vendor/globalthis/shim.js_commonjs-proxy +2 -1
  528. package/_vendor/jszip/dist/jszip.min.js_commonjs-module +3 -0
  529. package/_vendor/object-keys/implementation.js_commonjs-proxy +1 -1
  530. package/_vendor/object-keys/index.js_commonjs-proxy +1 -1
  531. package/_vendor/object-keys/isArguments.js_commonjs-proxy +1 -1
  532. package/_vendor/seedrandom/lib/alea.js_commonjs-module +3 -0
  533. package/_vendor/seedrandom/lib/alea.js_commonjs-proxy +1 -1
  534. package/_vendor/seedrandom/lib/tychei.js_commonjs-module +3 -0
  535. package/_vendor/seedrandom/lib/tychei.js_commonjs-proxy +1 -1
  536. package/_vendor/seedrandom/lib/xor128.js_commonjs-module +3 -0
  537. package/_vendor/seedrandom/lib/xor128.js_commonjs-proxy +1 -1
  538. package/_vendor/seedrandom/lib/xor4096.js_commonjs-module +3 -0
  539. package/_vendor/seedrandom/lib/xor4096.js_commonjs-proxy +1 -1
  540. package/_vendor/seedrandom/lib/xorshift7.js_commonjs-module +3 -0
  541. package/_vendor/seedrandom/lib/xorshift7.js_commonjs-proxy +1 -1
  542. package/_vendor/seedrandom/lib/xorwow.js_commonjs-module +3 -0
  543. package/_vendor/seedrandom/lib/xorwow.js_commonjs-proxy +1 -1
  544. package/_vendor/seedrandom/seedrandom.js_commonjs-module +3 -0
  545. package/_vendor/seedrandom/seedrandom.js_commonjs-proxy +1 -1
  546. package/_vendor/webworker-promise/lib/register.js_commonjs-module +3 -0
  547. package/_vendor/webworker-promise/lib/tiny-emitter.js_commonjs-proxy +1 -1
  548. package/_vendor/webworker-promise/src/tiny-emitter.js_commonjs-proxy +1 -0
  549. package/_vendor/xmlbuilder2/lib/xmlbuilder2.min.js_commonjs-module +3 -0
  550. package/_virtual/commonjsHelpers.js +3 -4
  551. package/_virtual/{polyfill-node_buffer.js → polyfill-node.buffer.js} +1 -1
  552. package/_virtual/{polyfill-node_global.js → polyfill-node.global.js} +0 -0
  553. package/_virtual/rollup-plugin-worker-loader__module_Sources/Filters/General/PaintFilter/PaintFilter.worker.js +1 -1
  554. package/_virtual/rollup-plugin-worker-loader__module_Sources/Interaction/Widgets/PiecewiseGaussianWidget/ComputeHistogram.worker.js +1 -1
  555. package/macros.js +4 -5
  556. package/package.json +54 -55
  557. package/vendor/base64-js/index.js +1 -87
  558. package/vendor/blueimp-md5/js/md5.js +6 -3
  559. package/vendor/d3-array/src/ascending.js +1 -1
  560. package/vendor/d3-array/src/bisect.js +2 -1
  561. package/vendor/d3-array/src/bisector.js +21 -23
  562. package/vendor/d3-array/src/mode.js +1 -0
  563. package/vendor/d3-scale/src/continuous.js +2 -2
  564. package/vendor/d3-time/src/ticks.js +1 -0
  565. package/vendor/define-properties/index.js +2 -1
  566. package/vendor/globalthis/implementation.browser.js +4 -9
  567. package/vendor/globalthis/index.js +13 -6
  568. package/vendor/globalthis/polyfill.js +6 -3
  569. package/vendor/globalthis/shim.js +12 -9
  570. package/vendor/jszip/dist/jszip.min.js +11 -0
  571. package/vendor/object-keys/index.js +2 -2
  572. package/vendor/pako/dist/pako.esm.mjs +397 -388
  573. package/vendor/seedrandom/index.js +28 -21
  574. package/vendor/seedrandom/lib/alea.js +4 -5
  575. package/vendor/seedrandom/lib/tychei.js +4 -5
  576. package/vendor/seedrandom/lib/xor128.js +4 -5
  577. package/vendor/seedrandom/lib/xor4096.js +4 -5
  578. package/vendor/seedrandom/lib/xorshift7.js +4 -5
  579. package/vendor/seedrandom/lib/xorwow.js +4 -5
  580. package/vendor/seedrandom/seedrandom.js +4 -5
  581. package/vendor/webworker-promise/lib/register.js +14 -8
  582. package/vendor/webworker-promise/src/index.js +110 -0
  583. package/vendor/webworker-promise/src/tiny-emitter.js +51 -0
  584. package/vendor/xmlbuilder2/lib/xmlbuilder2.min.js +6 -7
  585. package/vtk.js +2 -3
  586. package/_vendor/base64-js/index.js_commonjs-proxy +0 -1
  587. package/_vendor/buffer/index.js_commonjs-proxy +0 -1
  588. package/_vendor/ieee754/index.js_commonjs-proxy +0 -1
  589. package/_vendor/immediate/lib/browser.js_commonjs-proxy +0 -1
  590. package/_vendor/inherits/inherits_browser.js_commonjs-proxy +0 -1
  591. package/_vendor/jszip/lib/base64.js_commonjs-proxy +0 -1
  592. package/_vendor/jszip/lib/compressedObject.js_commonjs-proxy +0 -1
  593. package/_vendor/jszip/lib/compressions.js_commonjs-proxy +0 -1
  594. package/_vendor/jszip/lib/crc32.js_commonjs-proxy +0 -1
  595. package/_vendor/jszip/lib/defaults.js_commonjs-proxy +0 -1
  596. package/_vendor/jszip/lib/external.js_commonjs-proxy +0 -1
  597. package/_vendor/jszip/lib/flate.js_commonjs-proxy +0 -1
  598. package/_vendor/jszip/lib/generate/ZipFileWorker.js_commonjs-proxy +0 -1
  599. package/_vendor/jszip/lib/generate/index.js_commonjs-proxy +0 -1
  600. package/_vendor/jszip/lib/load.js_commonjs-proxy +0 -1
  601. package/_vendor/jszip/lib/nodejs/NodejsStreamInputAdapter.js_commonjs-proxy +0 -1
  602. package/_vendor/jszip/lib/nodejs/NodejsStreamOutputAdapter.js_commonjs-proxy +0 -1
  603. package/_vendor/jszip/lib/nodejsUtils.js_commonjs-proxy +0 -1
  604. package/_vendor/jszip/lib/object.js_commonjs-proxy +0 -1
  605. package/_vendor/jszip/lib/readable-stream-browser.js_commonjs-proxy +0 -1
  606. package/_vendor/jszip/lib/reader/ArrayReader.js_commonjs-proxy +0 -1
  607. package/_vendor/jszip/lib/reader/DataReader.js_commonjs-proxy +0 -1
  608. package/_vendor/jszip/lib/reader/NodeBufferReader.js_commonjs-proxy +0 -1
  609. package/_vendor/jszip/lib/reader/StringReader.js_commonjs-proxy +0 -1
  610. package/_vendor/jszip/lib/reader/Uint8ArrayReader.js_commonjs-proxy +0 -1
  611. package/_vendor/jszip/lib/reader/readerFor.js_commonjs-proxy +0 -1
  612. package/_vendor/jszip/lib/signature.js_commonjs-proxy +0 -1
  613. package/_vendor/jszip/lib/stream/ConvertWorker.js_commonjs-proxy +0 -1
  614. package/_vendor/jszip/lib/stream/Crc32Probe.js_commonjs-proxy +0 -1
  615. package/_vendor/jszip/lib/stream/DataLengthProbe.js_commonjs-proxy +0 -1
  616. package/_vendor/jszip/lib/stream/DataWorker.js_commonjs-proxy +0 -1
  617. package/_vendor/jszip/lib/stream/GenericWorker.js_commonjs-proxy +0 -1
  618. package/_vendor/jszip/lib/stream/StreamHelper.js_commonjs-proxy +0 -1
  619. package/_vendor/jszip/lib/support.js_commonjs-proxy +0 -1
  620. package/_vendor/jszip/lib/utf8.js_commonjs-proxy +0 -1
  621. package/_vendor/jszip/lib/utils.js_commonjs-proxy +0 -1
  622. package/_vendor/jszip/lib/zipEntries.js_commonjs-proxy +0 -1
  623. package/_vendor/jszip/lib/zipEntry.js_commonjs-proxy +0 -1
  624. package/_vendor/jszip/lib/zipObject.js_commonjs-proxy +0 -1
  625. package/_vendor/jszip/node_modules/pako/index.js_commonjs-proxy +0 -1
  626. package/_vendor/jszip/node_modules/pako/lib/deflate.js_commonjs-proxy +0 -1
  627. package/_vendor/jszip/node_modules/pako/lib/inflate.js_commonjs-proxy +0 -1
  628. package/_vendor/jszip/node_modules/pako/lib/utils/common.js_commonjs-proxy +0 -1
  629. package/_vendor/jszip/node_modules/pako/lib/utils/strings.js_commonjs-proxy +0 -1
  630. package/_vendor/jszip/node_modules/pako/lib/zlib/adler32.js_commonjs-proxy +0 -1
  631. package/_vendor/jszip/node_modules/pako/lib/zlib/constants.js_commonjs-proxy +0 -1
  632. package/_vendor/jszip/node_modules/pako/lib/zlib/crc32.js_commonjs-proxy +0 -1
  633. package/_vendor/jszip/node_modules/pako/lib/zlib/deflate.js_commonjs-proxy +0 -1
  634. package/_vendor/jszip/node_modules/pako/lib/zlib/gzheader.js_commonjs-proxy +0 -1
  635. package/_vendor/jszip/node_modules/pako/lib/zlib/inffast.js_commonjs-proxy +0 -1
  636. package/_vendor/jszip/node_modules/pako/lib/zlib/inflate.js_commonjs-proxy +0 -1
  637. package/_vendor/jszip/node_modules/pako/lib/zlib/inftrees.js_commonjs-proxy +0 -1
  638. package/_vendor/jszip/node_modules/pako/lib/zlib/messages.js_commonjs-proxy +0 -1
  639. package/_vendor/jszip/node_modules/pako/lib/zlib/trees.js_commonjs-proxy +0 -1
  640. package/_vendor/jszip/node_modules/pako/lib/zlib/zstream.js_commonjs-proxy +0 -1
  641. package/_vendor/lie/lib/browser.js_commonjs-proxy +0 -1
  642. package/_vendor/safe-buffer/index.js_commonjs-proxy +0 -1
  643. package/_vendor/set-immediate-shim/index.js_commonjs-proxy +0 -1
  644. package/_vendor/util/support/isBufferBrowser.js_commonjs-proxy +0 -1
  645. package/_virtual/_polyfill-node_stream.js_commonjs-proxy.js +0 -6
  646. package/_virtual/polyfill-node__buffer_list.js +0 -59
  647. package/_virtual/polyfill-node__stream_duplex.js +0 -44
  648. package/_virtual/polyfill-node__stream_passthrough.js +0 -15
  649. package/_virtual/polyfill-node__stream_readable.js +0 -896
  650. package/_virtual/polyfill-node__stream_transform.js +0 -132
  651. package/_virtual/polyfill-node__stream_writable.js +0 -480
  652. package/_virtual/polyfill-node_process.js +0 -225
  653. package/_virtual/polyfill-node_stream.js +0 -120
  654. package/vendor/buffer/index.js +0 -2112
  655. package/vendor/events/events.js +0 -457
  656. package/vendor/ieee754/index.js +0 -92
  657. package/vendor/immediate/lib/browser.js +0 -72
  658. package/vendor/inherits/inherits_browser.js +0 -29
  659. package/vendor/jszip/lib/base64.js +0 -113
  660. package/vendor/jszip/lib/compressedObject.js +0 -74
  661. package/vendor/jszip/lib/compressions.js +0 -20
  662. package/vendor/jszip/lib/crc32.js +0 -77
  663. package/vendor/jszip/lib/defaults.js +0 -25
  664. package/vendor/jszip/lib/external.js +0 -22
  665. package/vendor/jszip/lib/flate.js +0 -96
  666. package/vendor/jszip/lib/generate/ZipFileWorker.js +0 -540
  667. package/vendor/jszip/lib/generate/index.js +0 -61
  668. package/vendor/jszip/lib/index.js +0 -58
  669. package/vendor/jszip/lib/load.js +0 -82
  670. package/vendor/jszip/lib/nodejs/NodejsStreamInputAdapter.js +0 -74
  671. package/vendor/jszip/lib/nodejs/NodejsStreamOutputAdapter.js +0 -45
  672. package/vendor/jszip/lib/nodejsUtils.js +0 -59
  673. package/vendor/jszip/lib/object.js +0 -389
  674. package/vendor/jszip/lib/readable-stream-browser.js +0 -14
  675. package/vendor/jszip/lib/reader/ArrayReader.js +0 -58
  676. package/vendor/jszip/lib/reader/DataReader.js +0 -117
  677. package/vendor/jszip/lib/reader/NodeBufferReader.js +0 -20
  678. package/vendor/jszip/lib/reader/StringReader.js +0 -39
  679. package/vendor/jszip/lib/reader/Uint8ArrayReader.js +0 -23
  680. package/vendor/jszip/lib/reader/readerFor.js +0 -28
  681. package/vendor/jszip/lib/signature.js +0 -17
  682. package/vendor/jszip/lib/stream/ConvertWorker.js +0 -26
  683. package/vendor/jszip/lib/stream/Crc32Probe.js +0 -24
  684. package/vendor/jszip/lib/stream/DataLengthProbe.js +0 -28
  685. package/vendor/jszip/lib/stream/DataWorker.js +0 -116
  686. package/vendor/jszip/lib/stream/GenericWorker.js +0 -263
  687. package/vendor/jszip/lib/stream/StreamHelper.js +0 -214
  688. package/vendor/jszip/lib/support.js +0 -45
  689. package/vendor/jszip/lib/utf8.js +0 -284
  690. package/vendor/jszip/lib/utils.js +0 -486
  691. package/vendor/jszip/lib/zipEntries.js +0 -257
  692. package/vendor/jszip/lib/zipEntry.js +0 -293
  693. package/vendor/jszip/lib/zipObject.js +0 -133
  694. package/vendor/jszip/node_modules/pako/index.js +0 -18
  695. package/vendor/jszip/node_modules/pako/lib/deflate.js +0 -406
  696. package/vendor/jszip/node_modules/pako/lib/inflate.js +0 -429
  697. package/vendor/jszip/node_modules/pako/lib/utils/common.js +0 -110
  698. package/vendor/jszip/node_modules/pako/lib/utils/strings.js +0 -192
  699. package/vendor/jszip/node_modules/pako/lib/zlib/adler32.js +0 -51
  700. package/vendor/jszip/node_modules/pako/lib/zlib/constants.js +0 -68
  701. package/vendor/jszip/node_modules/pako/lib/zlib/crc32.js +0 -59
  702. package/vendor/jszip/node_modules/pako/lib/zlib/deflate.js +0 -1892
  703. package/vendor/jszip/node_modules/pako/lib/zlib/gzheader.js +0 -58
  704. package/vendor/jszip/node_modules/pako/lib/zlib/inffast.js +0 -345
  705. package/vendor/jszip/node_modules/pako/lib/zlib/inflate.js +0 -1572
  706. package/vendor/jszip/node_modules/pako/lib/zlib/inftrees.js +0 -345
  707. package/vendor/jszip/node_modules/pako/lib/zlib/messages.js +0 -32
  708. package/vendor/jszip/node_modules/pako/lib/zlib/trees.js +0 -1232
  709. package/vendor/jszip/node_modules/pako/lib/zlib/zstream.js +0 -47
  710. package/vendor/lie/lib/browser.js +0 -274
  711. package/vendor/process/browser.js +0 -190
  712. package/vendor/safe-buffer/index.js +0 -69
  713. package/vendor/set-immediate-shim/index.js +0 -8
  714. package/vendor/string_decoder/lib/string_decoder.js +0 -276
  715. package/vendor/util/support/isBufferBrowser.js +0 -8
  716. package/vendor/util/util.js +0 -706
  717. package/vendor/webworker-promise/lib/index.js +0 -172
@@ -1,1892 +0,0 @@
1
- import { c as common } from '../utils/common.js';
2
- import { t as trees } from './trees.js';
3
- import { a as adler32_1 } from './adler32.js';
4
- import { c as crc32_1 } from './crc32.js';
5
- import { m as messages } from './messages.js';
6
-
7
- // (C) 1995-2013 Jean-loup Gailly and Mark Adler
8
- // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
9
- //
10
- // This software is provided 'as-is', without any express or implied
11
- // warranty. In no event will the authors be held liable for any damages
12
- // arising from the use of this software.
13
- //
14
- // Permission is granted to anyone to use this software for any purpose,
15
- // including commercial applications, and to alter it and redistribute it
16
- // freely, subject to the following restrictions:
17
- //
18
- // 1. The origin of this software must not be misrepresented; you must not
19
- // claim that you wrote the original software. If you use this software
20
- // in a product, an acknowledgment in the product documentation would be
21
- // appreciated but is not required.
22
- // 2. Altered source versions must be plainly marked as such, and must not be
23
- // misrepresented as being the original software.
24
- // 3. This notice may not be removed or altered from any source distribution.
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
- /* Public constants ==========================================================*/
33
- /* ===========================================================================*/
34
-
35
-
36
- /* Allowed flush values; see deflate() and inflate() below for details */
37
- var Z_NO_FLUSH = 0;
38
- var Z_PARTIAL_FLUSH = 1;
39
- //var Z_SYNC_FLUSH = 2;
40
- var Z_FULL_FLUSH = 3;
41
- var Z_FINISH = 4;
42
- var Z_BLOCK = 5;
43
- //var Z_TREES = 6;
44
-
45
-
46
- /* Return codes for the compression/decompression functions. Negative values
47
- * are errors, positive values are used for special but normal events.
48
- */
49
- var Z_OK = 0;
50
- var Z_STREAM_END = 1;
51
- //var Z_NEED_DICT = 2;
52
- //var Z_ERRNO = -1;
53
- var Z_STREAM_ERROR = -2;
54
- var Z_DATA_ERROR = -3;
55
- //var Z_MEM_ERROR = -4;
56
- var Z_BUF_ERROR = -5;
57
- //var Z_VERSION_ERROR = -6;
58
-
59
-
60
- /* compression levels */
61
- //var Z_NO_COMPRESSION = 0;
62
- //var Z_BEST_SPEED = 1;
63
- //var Z_BEST_COMPRESSION = 9;
64
- var Z_DEFAULT_COMPRESSION = -1;
65
-
66
-
67
- var Z_FILTERED = 1;
68
- var Z_HUFFMAN_ONLY = 2;
69
- var Z_RLE = 3;
70
- var Z_FIXED = 4;
71
- var Z_DEFAULT_STRATEGY = 0;
72
-
73
- /* Possible values of the data_type field (though see inflate()) */
74
- //var Z_BINARY = 0;
75
- //var Z_TEXT = 1;
76
- //var Z_ASCII = 1; // = Z_TEXT
77
- var Z_UNKNOWN = 2;
78
-
79
-
80
- /* The deflate compression method */
81
- var Z_DEFLATED = 8;
82
-
83
- /*============================================================================*/
84
-
85
-
86
- var MAX_MEM_LEVEL = 9;
87
- /* Maximum value for memLevel in deflateInit2 */
88
- var MAX_WBITS = 15;
89
- /* 32K LZ77 window */
90
- var DEF_MEM_LEVEL = 8;
91
-
92
-
93
- var LENGTH_CODES = 29;
94
- /* number of length codes, not counting the special END_BLOCK code */
95
- var LITERALS = 256;
96
- /* number of literal bytes 0..255 */
97
- var L_CODES = LITERALS + 1 + LENGTH_CODES;
98
- /* number of Literal or Length codes, including the END_BLOCK code */
99
- var D_CODES = 30;
100
- /* number of distance codes */
101
- var BL_CODES = 19;
102
- /* number of codes used to transfer the bit lengths */
103
- var HEAP_SIZE = 2 * L_CODES + 1;
104
- /* maximum heap size */
105
- var MAX_BITS = 15;
106
- /* All codes must not exceed MAX_BITS bits */
107
-
108
- var MIN_MATCH = 3;
109
- var MAX_MATCH = 258;
110
- var MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1);
111
-
112
- var PRESET_DICT = 0x20;
113
-
114
- var INIT_STATE = 42;
115
- var EXTRA_STATE = 69;
116
- var NAME_STATE = 73;
117
- var COMMENT_STATE = 91;
118
- var HCRC_STATE = 103;
119
- var BUSY_STATE = 113;
120
- var FINISH_STATE = 666;
121
-
122
- var BS_NEED_MORE = 1; /* block not completed, need more input or more output */
123
- var BS_BLOCK_DONE = 2; /* block flush performed */
124
- var BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */
125
- var BS_FINISH_DONE = 4; /* finish done, accept no more input or output */
126
-
127
- var OS_CODE = 0x03; // Unix :) . Don't detect, use this default.
128
-
129
- function err(strm, errorCode) {
130
- strm.msg = messages[errorCode];
131
- return errorCode;
132
- }
133
-
134
- function rank(f) {
135
- return ((f) << 1) - ((f) > 4 ? 9 : 0);
136
- }
137
-
138
- function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }
139
-
140
-
141
- /* =========================================================================
142
- * Flush as much pending output as possible. All deflate() output goes
143
- * through this function so some applications may wish to modify it
144
- * to avoid allocating a large strm->output buffer and copying into it.
145
- * (See also read_buf()).
146
- */
147
- function flush_pending(strm) {
148
- var s = strm.state;
149
-
150
- //_tr_flush_bits(s);
151
- var len = s.pending;
152
- if (len > strm.avail_out) {
153
- len = strm.avail_out;
154
- }
155
- if (len === 0) { return; }
156
-
157
- common.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out);
158
- strm.next_out += len;
159
- s.pending_out += len;
160
- strm.total_out += len;
161
- strm.avail_out -= len;
162
- s.pending -= len;
163
- if (s.pending === 0) {
164
- s.pending_out = 0;
165
- }
166
- }
167
-
168
-
169
- function flush_block_only(s, last) {
170
- trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last);
171
- s.block_start = s.strstart;
172
- flush_pending(s.strm);
173
- }
174
-
175
-
176
- function put_byte(s, b) {
177
- s.pending_buf[s.pending++] = b;
178
- }
179
-
180
-
181
- /* =========================================================================
182
- * Put a short in the pending buffer. The 16-bit value is put in MSB order.
183
- * IN assertion: the stream state is correct and there is enough room in
184
- * pending_buf.
185
- */
186
- function putShortMSB(s, b) {
187
- // put_byte(s, (Byte)(b >> 8));
188
- // put_byte(s, (Byte)(b & 0xff));
189
- s.pending_buf[s.pending++] = (b >>> 8) & 0xff;
190
- s.pending_buf[s.pending++] = b & 0xff;
191
- }
192
-
193
-
194
- /* ===========================================================================
195
- * Read a new buffer from the current input stream, update the adler32
196
- * and total number of bytes read. All deflate() input goes through
197
- * this function so some applications may wish to modify it to avoid
198
- * allocating a large strm->input buffer and copying from it.
199
- * (See also flush_pending()).
200
- */
201
- function read_buf(strm, buf, start, size) {
202
- var len = strm.avail_in;
203
-
204
- if (len > size) { len = size; }
205
- if (len === 0) { return 0; }
206
-
207
- strm.avail_in -= len;
208
-
209
- // zmemcpy(buf, strm->next_in, len);
210
- common.arraySet(buf, strm.input, strm.next_in, len, start);
211
- if (strm.state.wrap === 1) {
212
- strm.adler = adler32_1(strm.adler, buf, len, start);
213
- }
214
-
215
- else if (strm.state.wrap === 2) {
216
- strm.adler = crc32_1(strm.adler, buf, len, start);
217
- }
218
-
219
- strm.next_in += len;
220
- strm.total_in += len;
221
-
222
- return len;
223
- }
224
-
225
-
226
- /* ===========================================================================
227
- * Set match_start to the longest match starting at the given string and
228
- * return its length. Matches shorter or equal to prev_length are discarded,
229
- * in which case the result is equal to prev_length and match_start is
230
- * garbage.
231
- * IN assertions: cur_match is the head of the hash chain for the current
232
- * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
233
- * OUT assertion: the match length is not greater than s->lookahead.
234
- */
235
- function longest_match(s, cur_match) {
236
- var chain_length = s.max_chain_length; /* max hash chain length */
237
- var scan = s.strstart; /* current string */
238
- var match; /* matched string */
239
- var len; /* length of current match */
240
- var best_len = s.prev_length; /* best match length so far */
241
- var nice_match = s.nice_match; /* stop if match long enough */
242
- var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ?
243
- s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/;
244
-
245
- var _win = s.window; // shortcut
246
-
247
- var wmask = s.w_mask;
248
- var prev = s.prev;
249
-
250
- /* Stop when cur_match becomes <= limit. To simplify the code,
251
- * we prevent matches with the string of window index 0.
252
- */
253
-
254
- var strend = s.strstart + MAX_MATCH;
255
- var scan_end1 = _win[scan + best_len - 1];
256
- var scan_end = _win[scan + best_len];
257
-
258
- /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
259
- * It is easy to get rid of this optimization if necessary.
260
- */
261
- // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
262
-
263
- /* Do not waste too much time if we already have a good match: */
264
- if (s.prev_length >= s.good_match) {
265
- chain_length >>= 2;
266
- }
267
- /* Do not look for matches beyond the end of the input. This is necessary
268
- * to make deflate deterministic.
269
- */
270
- if (nice_match > s.lookahead) { nice_match = s.lookahead; }
271
-
272
- // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
273
-
274
- do {
275
- // Assert(cur_match < s->strstart, "no future");
276
- match = cur_match;
277
-
278
- /* Skip to next match if the match length cannot increase
279
- * or if the match length is less than 2. Note that the checks below
280
- * for insufficient lookahead only occur occasionally for performance
281
- * reasons. Therefore uninitialized memory will be accessed, and
282
- * conditional jumps will be made that depend on those values.
283
- * However the length of the match is limited to the lookahead, so
284
- * the output of deflate is not affected by the uninitialized values.
285
- */
286
-
287
- if (_win[match + best_len] !== scan_end ||
288
- _win[match + best_len - 1] !== scan_end1 ||
289
- _win[match] !== _win[scan] ||
290
- _win[++match] !== _win[scan + 1]) {
291
- continue;
292
- }
293
-
294
- /* The check at best_len-1 can be removed because it will be made
295
- * again later. (This heuristic is not always a win.)
296
- * It is not necessary to compare scan[2] and match[2] since they
297
- * are always equal when the other bytes match, given that
298
- * the hash keys are equal and that HASH_BITS >= 8.
299
- */
300
- scan += 2;
301
- match++;
302
- // Assert(*scan == *match, "match[2]?");
303
-
304
- /* We check for insufficient lookahead only every 8th comparison;
305
- * the 256th check will be made at strstart+258.
306
- */
307
- do {
308
- /*jshint noempty:false*/
309
- } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&
310
- _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&
311
- _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&
312
- _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&
313
- scan < strend);
314
-
315
- // Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
316
-
317
- len = MAX_MATCH - (strend - scan);
318
- scan = strend - MAX_MATCH;
319
-
320
- if (len > best_len) {
321
- s.match_start = cur_match;
322
- best_len = len;
323
- if (len >= nice_match) {
324
- break;
325
- }
326
- scan_end1 = _win[scan + best_len - 1];
327
- scan_end = _win[scan + best_len];
328
- }
329
- } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0);
330
-
331
- if (best_len <= s.lookahead) {
332
- return best_len;
333
- }
334
- return s.lookahead;
335
- }
336
-
337
-
338
- /* ===========================================================================
339
- * Fill the window when the lookahead becomes insufficient.
340
- * Updates strstart and lookahead.
341
- *
342
- * IN assertion: lookahead < MIN_LOOKAHEAD
343
- * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD
344
- * At least one byte has been read, or avail_in == 0; reads are
345
- * performed for at least two bytes (required for the zip translate_eol
346
- * option -- not supported here).
347
- */
348
- function fill_window(s) {
349
- var _w_size = s.w_size;
350
- var p, n, m, more, str;
351
-
352
- //Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead");
353
-
354
- do {
355
- more = s.window_size - s.lookahead - s.strstart;
356
-
357
- // JS ints have 32 bit, block below not needed
358
- /* Deal with !@#$% 64K limit: */
359
- //if (sizeof(int) <= 2) {
360
- // if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
361
- // more = wsize;
362
- //
363
- // } else if (more == (unsigned)(-1)) {
364
- // /* Very unlikely, but possible on 16 bit machine if
365
- // * strstart == 0 && lookahead == 1 (input done a byte at time)
366
- // */
367
- // more--;
368
- // }
369
- //}
370
-
371
-
372
- /* If the window is almost full and there is insufficient lookahead,
373
- * move the upper half to the lower one to make room in the upper half.
374
- */
375
- if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {
376
-
377
- common.arraySet(s.window, s.window, _w_size, _w_size, 0);
378
- s.match_start -= _w_size;
379
- s.strstart -= _w_size;
380
- /* we now have strstart >= MAX_DIST */
381
- s.block_start -= _w_size;
382
-
383
- /* Slide the hash table (could be avoided with 32 bit values
384
- at the expense of memory usage). We slide even when level == 0
385
- to keep the hash table consistent if we switch back to level > 0
386
- later. (Using level 0 permanently is not an optimal usage of
387
- zlib, so we don't care about this pathological case.)
388
- */
389
-
390
- n = s.hash_size;
391
- p = n;
392
- do {
393
- m = s.head[--p];
394
- s.head[p] = (m >= _w_size ? m - _w_size : 0);
395
- } while (--n);
396
-
397
- n = _w_size;
398
- p = n;
399
- do {
400
- m = s.prev[--p];
401
- s.prev[p] = (m >= _w_size ? m - _w_size : 0);
402
- /* If n is not on any hash chain, prev[n] is garbage but
403
- * its value will never be used.
404
- */
405
- } while (--n);
406
-
407
- more += _w_size;
408
- }
409
- if (s.strm.avail_in === 0) {
410
- break;
411
- }
412
-
413
- /* If there was no sliding:
414
- * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
415
- * more == window_size - lookahead - strstart
416
- * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
417
- * => more >= window_size - 2*WSIZE + 2
418
- * In the BIG_MEM or MMAP case (not yet supported),
419
- * window_size == input_size + MIN_LOOKAHEAD &&
420
- * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
421
- * Otherwise, window_size == 2*WSIZE so more >= 2.
422
- * If there was sliding, more >= WSIZE. So in all cases, more >= 2.
423
- */
424
- //Assert(more >= 2, "more < 2");
425
- n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more);
426
- s.lookahead += n;
427
-
428
- /* Initialize the hash value now that we have some input: */
429
- if (s.lookahead + s.insert >= MIN_MATCH) {
430
- str = s.strstart - s.insert;
431
- s.ins_h = s.window[str];
432
-
433
- /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */
434
- s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask;
435
- //#if MIN_MATCH != 3
436
- // Call update_hash() MIN_MATCH-3 more times
437
- //#endif
438
- while (s.insert) {
439
- /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */
440
- s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;
441
-
442
- s.prev[str & s.w_mask] = s.head[s.ins_h];
443
- s.head[s.ins_h] = str;
444
- str++;
445
- s.insert--;
446
- if (s.lookahead + s.insert < MIN_MATCH) {
447
- break;
448
- }
449
- }
450
- }
451
- /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
452
- * but this is not important since only literal bytes will be emitted.
453
- */
454
-
455
- } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0);
456
-
457
- /* If the WIN_INIT bytes after the end of the current data have never been
458
- * written, then zero those bytes in order to avoid memory check reports of
459
- * the use of uninitialized (or uninitialised as Julian writes) bytes by
460
- * the longest match routines. Update the high water mark for the next
461
- * time through here. WIN_INIT is set to MAX_MATCH since the longest match
462
- * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.
463
- */
464
- // if (s.high_water < s.window_size) {
465
- // var curr = s.strstart + s.lookahead;
466
- // var init = 0;
467
- //
468
- // if (s.high_water < curr) {
469
- // /* Previous high water mark below current data -- zero WIN_INIT
470
- // * bytes or up to end of window, whichever is less.
471
- // */
472
- // init = s.window_size - curr;
473
- // if (init > WIN_INIT)
474
- // init = WIN_INIT;
475
- // zmemzero(s->window + curr, (unsigned)init);
476
- // s->high_water = curr + init;
477
- // }
478
- // else if (s->high_water < (ulg)curr + WIN_INIT) {
479
- // /* High water mark at or above current data, but below current data
480
- // * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up
481
- // * to end of window, whichever is less.
482
- // */
483
- // init = (ulg)curr + WIN_INIT - s->high_water;
484
- // if (init > s->window_size - s->high_water)
485
- // init = s->window_size - s->high_water;
486
- // zmemzero(s->window + s->high_water, (unsigned)init);
487
- // s->high_water += init;
488
- // }
489
- // }
490
- //
491
- // Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,
492
- // "not enough room for search");
493
- }
494
-
495
- /* ===========================================================================
496
- * Copy without compression as much as possible from the input stream, return
497
- * the current block state.
498
- * This function does not insert new strings in the dictionary since
499
- * uncompressible data is probably not useful. This function is used
500
- * only for the level=0 compression option.
501
- * NOTE: this function should be optimized to avoid extra copying from
502
- * window to pending_buf.
503
- */
504
- function deflate_stored(s, flush) {
505
- /* Stored blocks are limited to 0xffff bytes, pending_buf is limited
506
- * to pending_buf_size, and each stored block has a 5 byte header:
507
- */
508
- var max_block_size = 0xffff;
509
-
510
- if (max_block_size > s.pending_buf_size - 5) {
511
- max_block_size = s.pending_buf_size - 5;
512
- }
513
-
514
- /* Copy as much as possible from input to output: */
515
- for (;;) {
516
- /* Fill the window as much as possible: */
517
- if (s.lookahead <= 1) {
518
-
519
- //Assert(s->strstart < s->w_size+MAX_DIST(s) ||
520
- // s->block_start >= (long)s->w_size, "slide too late");
521
- // if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) ||
522
- // s.block_start >= s.w_size)) {
523
- // throw new Error("slide too late");
524
- // }
525
-
526
- fill_window(s);
527
- if (s.lookahead === 0 && flush === Z_NO_FLUSH) {
528
- return BS_NEED_MORE;
529
- }
530
-
531
- if (s.lookahead === 0) {
532
- break;
533
- }
534
- /* flush the current block */
535
- }
536
- //Assert(s->block_start >= 0L, "block gone");
537
- // if (s.block_start < 0) throw new Error("block gone");
538
-
539
- s.strstart += s.lookahead;
540
- s.lookahead = 0;
541
-
542
- /* Emit a stored block if pending_buf will be full: */
543
- var max_start = s.block_start + max_block_size;
544
-
545
- if (s.strstart === 0 || s.strstart >= max_start) {
546
- /* strstart == 0 is possible when wraparound on 16-bit machine */
547
- s.lookahead = s.strstart - max_start;
548
- s.strstart = max_start;
549
- /*** FLUSH_BLOCK(s, 0); ***/
550
- flush_block_only(s, false);
551
- if (s.strm.avail_out === 0) {
552
- return BS_NEED_MORE;
553
- }
554
- /***/
555
-
556
-
557
- }
558
- /* Flush if we may have to slide, otherwise block_start may become
559
- * negative and the data will be gone:
560
- */
561
- if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) {
562
- /*** FLUSH_BLOCK(s, 0); ***/
563
- flush_block_only(s, false);
564
- if (s.strm.avail_out === 0) {
565
- return BS_NEED_MORE;
566
- }
567
- /***/
568
- }
569
- }
570
-
571
- s.insert = 0;
572
-
573
- if (flush === Z_FINISH) {
574
- /*** FLUSH_BLOCK(s, 1); ***/
575
- flush_block_only(s, true);
576
- if (s.strm.avail_out === 0) {
577
- return BS_FINISH_STARTED;
578
- }
579
- /***/
580
- return BS_FINISH_DONE;
581
- }
582
-
583
- if (s.strstart > s.block_start) {
584
- /*** FLUSH_BLOCK(s, 0); ***/
585
- flush_block_only(s, false);
586
- if (s.strm.avail_out === 0) {
587
- return BS_NEED_MORE;
588
- }
589
- /***/
590
- }
591
-
592
- return BS_NEED_MORE;
593
- }
594
-
595
- /* ===========================================================================
596
- * Compress as much as possible from the input stream, return the current
597
- * block state.
598
- * This function does not perform lazy evaluation of matches and inserts
599
- * new strings in the dictionary only for unmatched strings or for short
600
- * matches. It is used only for the fast compression options.
601
- */
602
- function deflate_fast(s, flush) {
603
- var hash_head; /* head of the hash chain */
604
- var bflush; /* set if current block must be flushed */
605
-
606
- for (;;) {
607
- /* Make sure that we always have enough lookahead, except
608
- * at the end of the input file. We need MAX_MATCH bytes
609
- * for the next match, plus MIN_MATCH bytes to insert the
610
- * string following the next match.
611
- */
612
- if (s.lookahead < MIN_LOOKAHEAD) {
613
- fill_window(s);
614
- if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {
615
- return BS_NEED_MORE;
616
- }
617
- if (s.lookahead === 0) {
618
- break; /* flush the current block */
619
- }
620
- }
621
-
622
- /* Insert the string window[strstart .. strstart+2] in the
623
- * dictionary, and set hash_head to the head of the hash chain:
624
- */
625
- hash_head = 0/*NIL*/;
626
- if (s.lookahead >= MIN_MATCH) {
627
- /*** INSERT_STRING(s, s.strstart, hash_head); ***/
628
- s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
629
- hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
630
- s.head[s.ins_h] = s.strstart;
631
- /***/
632
- }
633
-
634
- /* Find the longest match, discarding those <= prev_length.
635
- * At this point we have always match_length < MIN_MATCH
636
- */
637
- if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) {
638
- /* To simplify the code, we prevent matches with the string
639
- * of window index 0 (in particular we have to avoid a match
640
- * of the string with itself at the start of the input file).
641
- */
642
- s.match_length = longest_match(s, hash_head);
643
- /* longest_match() sets match_start */
644
- }
645
- if (s.match_length >= MIN_MATCH) {
646
- // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only
647
-
648
- /*** _tr_tally_dist(s, s.strstart - s.match_start,
649
- s.match_length - MIN_MATCH, bflush); ***/
650
- bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH);
651
-
652
- s.lookahead -= s.match_length;
653
-
654
- /* Insert new strings in the hash table only if the match length
655
- * is not too large. This saves time but degrades compression.
656
- */
657
- if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) {
658
- s.match_length--; /* string at strstart already in table */
659
- do {
660
- s.strstart++;
661
- /*** INSERT_STRING(s, s.strstart, hash_head); ***/
662
- s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
663
- hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
664
- s.head[s.ins_h] = s.strstart;
665
- /***/
666
- /* strstart never exceeds WSIZE-MAX_MATCH, so there are
667
- * always MIN_MATCH bytes ahead.
668
- */
669
- } while (--s.match_length !== 0);
670
- s.strstart++;
671
- } else
672
- {
673
- s.strstart += s.match_length;
674
- s.match_length = 0;
675
- s.ins_h = s.window[s.strstart];
676
- /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */
677
- s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask;
678
-
679
- //#if MIN_MATCH != 3
680
- // Call UPDATE_HASH() MIN_MATCH-3 more times
681
- //#endif
682
- /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not
683
- * matter since it will be recomputed at next deflate call.
684
- */
685
- }
686
- } else {
687
- /* No match, output a literal byte */
688
- //Tracevv((stderr,"%c", s.window[s.strstart]));
689
- /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/
690
- bflush = trees._tr_tally(s, 0, s.window[s.strstart]);
691
-
692
- s.lookahead--;
693
- s.strstart++;
694
- }
695
- if (bflush) {
696
- /*** FLUSH_BLOCK(s, 0); ***/
697
- flush_block_only(s, false);
698
- if (s.strm.avail_out === 0) {
699
- return BS_NEED_MORE;
700
- }
701
- /***/
702
- }
703
- }
704
- s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1);
705
- if (flush === Z_FINISH) {
706
- /*** FLUSH_BLOCK(s, 1); ***/
707
- flush_block_only(s, true);
708
- if (s.strm.avail_out === 0) {
709
- return BS_FINISH_STARTED;
710
- }
711
- /***/
712
- return BS_FINISH_DONE;
713
- }
714
- if (s.last_lit) {
715
- /*** FLUSH_BLOCK(s, 0); ***/
716
- flush_block_only(s, false);
717
- if (s.strm.avail_out === 0) {
718
- return BS_NEED_MORE;
719
- }
720
- /***/
721
- }
722
- return BS_BLOCK_DONE;
723
- }
724
-
725
- /* ===========================================================================
726
- * Same as above, but achieves better compression. We use a lazy
727
- * evaluation for matches: a match is finally adopted only if there is
728
- * no better match at the next window position.
729
- */
730
- function deflate_slow(s, flush) {
731
- var hash_head; /* head of hash chain */
732
- var bflush; /* set if current block must be flushed */
733
-
734
- var max_insert;
735
-
736
- /* Process the input block. */
737
- for (;;) {
738
- /* Make sure that we always have enough lookahead, except
739
- * at the end of the input file. We need MAX_MATCH bytes
740
- * for the next match, plus MIN_MATCH bytes to insert the
741
- * string following the next match.
742
- */
743
- if (s.lookahead < MIN_LOOKAHEAD) {
744
- fill_window(s);
745
- if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {
746
- return BS_NEED_MORE;
747
- }
748
- if (s.lookahead === 0) { break; } /* flush the current block */
749
- }
750
-
751
- /* Insert the string window[strstart .. strstart+2] in the
752
- * dictionary, and set hash_head to the head of the hash chain:
753
- */
754
- hash_head = 0/*NIL*/;
755
- if (s.lookahead >= MIN_MATCH) {
756
- /*** INSERT_STRING(s, s.strstart, hash_head); ***/
757
- s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
758
- hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
759
- s.head[s.ins_h] = s.strstart;
760
- /***/
761
- }
762
-
763
- /* Find the longest match, discarding those <= prev_length.
764
- */
765
- s.prev_length = s.match_length;
766
- s.prev_match = s.match_start;
767
- s.match_length = MIN_MATCH - 1;
768
-
769
- if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match &&
770
- s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) {
771
- /* To simplify the code, we prevent matches with the string
772
- * of window index 0 (in particular we have to avoid a match
773
- * of the string with itself at the start of the input file).
774
- */
775
- s.match_length = longest_match(s, hash_head);
776
- /* longest_match() sets match_start */
777
-
778
- if (s.match_length <= 5 &&
779
- (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) {
780
-
781
- /* If prev_match is also MIN_MATCH, match_start is garbage
782
- * but we will ignore the current match anyway.
783
- */
784
- s.match_length = MIN_MATCH - 1;
785
- }
786
- }
787
- /* If there was a match at the previous step and the current
788
- * match is not better, output the previous match:
789
- */
790
- if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) {
791
- max_insert = s.strstart + s.lookahead - MIN_MATCH;
792
- /* Do not insert strings in hash table beyond this. */
793
-
794
- //check_match(s, s.strstart-1, s.prev_match, s.prev_length);
795
-
796
- /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match,
797
- s.prev_length - MIN_MATCH, bflush);***/
798
- bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH);
799
- /* Insert in hash table all strings up to the end of the match.
800
- * strstart-1 and strstart are already inserted. If there is not
801
- * enough lookahead, the last two strings are not inserted in
802
- * the hash table.
803
- */
804
- s.lookahead -= s.prev_length - 1;
805
- s.prev_length -= 2;
806
- do {
807
- if (++s.strstart <= max_insert) {
808
- /*** INSERT_STRING(s, s.strstart, hash_head); ***/
809
- s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
810
- hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
811
- s.head[s.ins_h] = s.strstart;
812
- /***/
813
- }
814
- } while (--s.prev_length !== 0);
815
- s.match_available = 0;
816
- s.match_length = MIN_MATCH - 1;
817
- s.strstart++;
818
-
819
- if (bflush) {
820
- /*** FLUSH_BLOCK(s, 0); ***/
821
- flush_block_only(s, false);
822
- if (s.strm.avail_out === 0) {
823
- return BS_NEED_MORE;
824
- }
825
- /***/
826
- }
827
-
828
- } else if (s.match_available) {
829
- /* If there was no match at the previous position, output a
830
- * single literal. If there was a match but the current match
831
- * is longer, truncate the previous match to a single literal.
832
- */
833
- //Tracevv((stderr,"%c", s->window[s->strstart-1]));
834
- /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/
835
- bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);
836
-
837
- if (bflush) {
838
- /*** FLUSH_BLOCK_ONLY(s, 0) ***/
839
- flush_block_only(s, false);
840
- /***/
841
- }
842
- s.strstart++;
843
- s.lookahead--;
844
- if (s.strm.avail_out === 0) {
845
- return BS_NEED_MORE;
846
- }
847
- } else {
848
- /* There is no previous match to compare with, wait for
849
- * the next step to decide.
850
- */
851
- s.match_available = 1;
852
- s.strstart++;
853
- s.lookahead--;
854
- }
855
- }
856
- //Assert (flush != Z_NO_FLUSH, "no flush?");
857
- if (s.match_available) {
858
- //Tracevv((stderr,"%c", s->window[s->strstart-1]));
859
- /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/
860
- bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);
861
-
862
- s.match_available = 0;
863
- }
864
- s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1;
865
- if (flush === Z_FINISH) {
866
- /*** FLUSH_BLOCK(s, 1); ***/
867
- flush_block_only(s, true);
868
- if (s.strm.avail_out === 0) {
869
- return BS_FINISH_STARTED;
870
- }
871
- /***/
872
- return BS_FINISH_DONE;
873
- }
874
- if (s.last_lit) {
875
- /*** FLUSH_BLOCK(s, 0); ***/
876
- flush_block_only(s, false);
877
- if (s.strm.avail_out === 0) {
878
- return BS_NEED_MORE;
879
- }
880
- /***/
881
- }
882
-
883
- return BS_BLOCK_DONE;
884
- }
885
-
886
-
887
- /* ===========================================================================
888
- * For Z_RLE, simply look for runs of bytes, generate matches only of distance
889
- * one. Do not maintain a hash table. (It will be regenerated if this run of
890
- * deflate switches away from Z_RLE.)
891
- */
892
- function deflate_rle(s, flush) {
893
- var bflush; /* set if current block must be flushed */
894
- var prev; /* byte at distance one to match */
895
- var scan, strend; /* scan goes up to strend for length of run */
896
-
897
- var _win = s.window;
898
-
899
- for (;;) {
900
- /* Make sure that we always have enough lookahead, except
901
- * at the end of the input file. We need MAX_MATCH bytes
902
- * for the longest run, plus one for the unrolled loop.
903
- */
904
- if (s.lookahead <= MAX_MATCH) {
905
- fill_window(s);
906
- if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) {
907
- return BS_NEED_MORE;
908
- }
909
- if (s.lookahead === 0) { break; } /* flush the current block */
910
- }
911
-
912
- /* See how many times the previous byte repeats */
913
- s.match_length = 0;
914
- if (s.lookahead >= MIN_MATCH && s.strstart > 0) {
915
- scan = s.strstart - 1;
916
- prev = _win[scan];
917
- if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {
918
- strend = s.strstart + MAX_MATCH;
919
- do {
920
- /*jshint noempty:false*/
921
- } while (prev === _win[++scan] && prev === _win[++scan] &&
922
- prev === _win[++scan] && prev === _win[++scan] &&
923
- prev === _win[++scan] && prev === _win[++scan] &&
924
- prev === _win[++scan] && prev === _win[++scan] &&
925
- scan < strend);
926
- s.match_length = MAX_MATCH - (strend - scan);
927
- if (s.match_length > s.lookahead) {
928
- s.match_length = s.lookahead;
929
- }
930
- }
931
- //Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan");
932
- }
933
-
934
- /* Emit match if have run of MIN_MATCH or longer, else emit literal */
935
- if (s.match_length >= MIN_MATCH) {
936
- //check_match(s, s.strstart, s.strstart - 1, s.match_length);
937
-
938
- /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/
939
- bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH);
940
-
941
- s.lookahead -= s.match_length;
942
- s.strstart += s.match_length;
943
- s.match_length = 0;
944
- } else {
945
- /* No match, output a literal byte */
946
- //Tracevv((stderr,"%c", s->window[s->strstart]));
947
- /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/
948
- bflush = trees._tr_tally(s, 0, s.window[s.strstart]);
949
-
950
- s.lookahead--;
951
- s.strstart++;
952
- }
953
- if (bflush) {
954
- /*** FLUSH_BLOCK(s, 0); ***/
955
- flush_block_only(s, false);
956
- if (s.strm.avail_out === 0) {
957
- return BS_NEED_MORE;
958
- }
959
- /***/
960
- }
961
- }
962
- s.insert = 0;
963
- if (flush === Z_FINISH) {
964
- /*** FLUSH_BLOCK(s, 1); ***/
965
- flush_block_only(s, true);
966
- if (s.strm.avail_out === 0) {
967
- return BS_FINISH_STARTED;
968
- }
969
- /***/
970
- return BS_FINISH_DONE;
971
- }
972
- if (s.last_lit) {
973
- /*** FLUSH_BLOCK(s, 0); ***/
974
- flush_block_only(s, false);
975
- if (s.strm.avail_out === 0) {
976
- return BS_NEED_MORE;
977
- }
978
- /***/
979
- }
980
- return BS_BLOCK_DONE;
981
- }
982
-
983
- /* ===========================================================================
984
- * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table.
985
- * (It will be regenerated if this run of deflate switches away from Huffman.)
986
- */
987
- function deflate_huff(s, flush) {
988
- var bflush; /* set if current block must be flushed */
989
-
990
- for (;;) {
991
- /* Make sure that we have a literal to write. */
992
- if (s.lookahead === 0) {
993
- fill_window(s);
994
- if (s.lookahead === 0) {
995
- if (flush === Z_NO_FLUSH) {
996
- return BS_NEED_MORE;
997
- }
998
- break; /* flush the current block */
999
- }
1000
- }
1001
-
1002
- /* Output a literal byte */
1003
- s.match_length = 0;
1004
- //Tracevv((stderr,"%c", s->window[s->strstart]));
1005
- /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/
1006
- bflush = trees._tr_tally(s, 0, s.window[s.strstart]);
1007
- s.lookahead--;
1008
- s.strstart++;
1009
- if (bflush) {
1010
- /*** FLUSH_BLOCK(s, 0); ***/
1011
- flush_block_only(s, false);
1012
- if (s.strm.avail_out === 0) {
1013
- return BS_NEED_MORE;
1014
- }
1015
- /***/
1016
- }
1017
- }
1018
- s.insert = 0;
1019
- if (flush === Z_FINISH) {
1020
- /*** FLUSH_BLOCK(s, 1); ***/
1021
- flush_block_only(s, true);
1022
- if (s.strm.avail_out === 0) {
1023
- return BS_FINISH_STARTED;
1024
- }
1025
- /***/
1026
- return BS_FINISH_DONE;
1027
- }
1028
- if (s.last_lit) {
1029
- /*** FLUSH_BLOCK(s, 0); ***/
1030
- flush_block_only(s, false);
1031
- if (s.strm.avail_out === 0) {
1032
- return BS_NEED_MORE;
1033
- }
1034
- /***/
1035
- }
1036
- return BS_BLOCK_DONE;
1037
- }
1038
-
1039
- /* Values for max_lazy_match, good_match and max_chain_length, depending on
1040
- * the desired pack level (0..9). The values given below have been tuned to
1041
- * exclude worst case performance for pathological files. Better values may be
1042
- * found for specific files.
1043
- */
1044
- function Config(good_length, max_lazy, nice_length, max_chain, func) {
1045
- this.good_length = good_length;
1046
- this.max_lazy = max_lazy;
1047
- this.nice_length = nice_length;
1048
- this.max_chain = max_chain;
1049
- this.func = func;
1050
- }
1051
-
1052
- var configuration_table;
1053
-
1054
- configuration_table = [
1055
- /* good lazy nice chain */
1056
- new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */
1057
- new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */
1058
- new Config(4, 5, 16, 8, deflate_fast), /* 2 */
1059
- new Config(4, 6, 32, 32, deflate_fast), /* 3 */
1060
-
1061
- new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */
1062
- new Config(8, 16, 32, 32, deflate_slow), /* 5 */
1063
- new Config(8, 16, 128, 128, deflate_slow), /* 6 */
1064
- new Config(8, 32, 128, 256, deflate_slow), /* 7 */
1065
- new Config(32, 128, 258, 1024, deflate_slow), /* 8 */
1066
- new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */
1067
- ];
1068
-
1069
-
1070
- /* ===========================================================================
1071
- * Initialize the "longest match" routines for a new zlib stream
1072
- */
1073
- function lm_init(s) {
1074
- s.window_size = 2 * s.w_size;
1075
-
1076
- /*** CLEAR_HASH(s); ***/
1077
- zero(s.head); // Fill with NIL (= 0);
1078
-
1079
- /* Set the default configuration parameters:
1080
- */
1081
- s.max_lazy_match = configuration_table[s.level].max_lazy;
1082
- s.good_match = configuration_table[s.level].good_length;
1083
- s.nice_match = configuration_table[s.level].nice_length;
1084
- s.max_chain_length = configuration_table[s.level].max_chain;
1085
-
1086
- s.strstart = 0;
1087
- s.block_start = 0;
1088
- s.lookahead = 0;
1089
- s.insert = 0;
1090
- s.match_length = s.prev_length = MIN_MATCH - 1;
1091
- s.match_available = 0;
1092
- s.ins_h = 0;
1093
- }
1094
-
1095
-
1096
- function DeflateState() {
1097
- this.strm = null; /* pointer back to this zlib stream */
1098
- this.status = 0; /* as the name implies */
1099
- this.pending_buf = null; /* output still pending */
1100
- this.pending_buf_size = 0; /* size of pending_buf */
1101
- this.pending_out = 0; /* next pending byte to output to the stream */
1102
- this.pending = 0; /* nb of bytes in the pending buffer */
1103
- this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */
1104
- this.gzhead = null; /* gzip header information to write */
1105
- this.gzindex = 0; /* where in extra, name, or comment */
1106
- this.method = Z_DEFLATED; /* can only be DEFLATED */
1107
- this.last_flush = -1; /* value of flush param for previous deflate call */
1108
-
1109
- this.w_size = 0; /* LZ77 window size (32K by default) */
1110
- this.w_bits = 0; /* log2(w_size) (8..16) */
1111
- this.w_mask = 0; /* w_size - 1 */
1112
-
1113
- this.window = null;
1114
- /* Sliding window. Input bytes are read into the second half of the window,
1115
- * and move to the first half later to keep a dictionary of at least wSize
1116
- * bytes. With this organization, matches are limited to a distance of
1117
- * wSize-MAX_MATCH bytes, but this ensures that IO is always
1118
- * performed with a length multiple of the block size.
1119
- */
1120
-
1121
- this.window_size = 0;
1122
- /* Actual size of window: 2*wSize, except when the user input buffer
1123
- * is directly used as sliding window.
1124
- */
1125
-
1126
- this.prev = null;
1127
- /* Link to older string with same hash index. To limit the size of this
1128
- * array to 64K, this link is maintained only for the last 32K strings.
1129
- * An index in this array is thus a window index modulo 32K.
1130
- */
1131
-
1132
- this.head = null; /* Heads of the hash chains or NIL. */
1133
-
1134
- this.ins_h = 0; /* hash index of string to be inserted */
1135
- this.hash_size = 0; /* number of elements in hash table */
1136
- this.hash_bits = 0; /* log2(hash_size) */
1137
- this.hash_mask = 0; /* hash_size-1 */
1138
-
1139
- this.hash_shift = 0;
1140
- /* Number of bits by which ins_h must be shifted at each input
1141
- * step. It must be such that after MIN_MATCH steps, the oldest
1142
- * byte no longer takes part in the hash key, that is:
1143
- * hash_shift * MIN_MATCH >= hash_bits
1144
- */
1145
-
1146
- this.block_start = 0;
1147
- /* Window position at the beginning of the current output block. Gets
1148
- * negative when the window is moved backwards.
1149
- */
1150
-
1151
- this.match_length = 0; /* length of best match */
1152
- this.prev_match = 0; /* previous match */
1153
- this.match_available = 0; /* set if previous match exists */
1154
- this.strstart = 0; /* start of string to insert */
1155
- this.match_start = 0; /* start of matching string */
1156
- this.lookahead = 0; /* number of valid bytes ahead in window */
1157
-
1158
- this.prev_length = 0;
1159
- /* Length of the best match at previous step. Matches not greater than this
1160
- * are discarded. This is used in the lazy match evaluation.
1161
- */
1162
-
1163
- this.max_chain_length = 0;
1164
- /* To speed up deflation, hash chains are never searched beyond this
1165
- * length. A higher limit improves compression ratio but degrades the
1166
- * speed.
1167
- */
1168
-
1169
- this.max_lazy_match = 0;
1170
- /* Attempt to find a better match only when the current match is strictly
1171
- * smaller than this value. This mechanism is used only for compression
1172
- * levels >= 4.
1173
- */
1174
- // That's alias to max_lazy_match, don't use directly
1175
- //this.max_insert_length = 0;
1176
- /* Insert new strings in the hash table only if the match length is not
1177
- * greater than this length. This saves time but degrades compression.
1178
- * max_insert_length is used only for compression levels <= 3.
1179
- */
1180
-
1181
- this.level = 0; /* compression level (1..9) */
1182
- this.strategy = 0; /* favor or force Huffman coding*/
1183
-
1184
- this.good_match = 0;
1185
- /* Use a faster search when the previous match is longer than this */
1186
-
1187
- this.nice_match = 0; /* Stop searching when current match exceeds this */
1188
-
1189
- /* used by trees.c: */
1190
-
1191
- /* Didn't use ct_data typedef below to suppress compiler warning */
1192
-
1193
- // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */
1194
- // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
1195
- // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */
1196
-
1197
- // Use flat array of DOUBLE size, with interleaved fata,
1198
- // because JS does not support effective
1199
- this.dyn_ltree = new common.Buf16(HEAP_SIZE * 2);
1200
- this.dyn_dtree = new common.Buf16((2 * D_CODES + 1) * 2);
1201
- this.bl_tree = new common.Buf16((2 * BL_CODES + 1) * 2);
1202
- zero(this.dyn_ltree);
1203
- zero(this.dyn_dtree);
1204
- zero(this.bl_tree);
1205
-
1206
- this.l_desc = null; /* desc. for literal tree */
1207
- this.d_desc = null; /* desc. for distance tree */
1208
- this.bl_desc = null; /* desc. for bit length tree */
1209
-
1210
- //ush bl_count[MAX_BITS+1];
1211
- this.bl_count = new common.Buf16(MAX_BITS + 1);
1212
- /* number of codes at each bit length for an optimal tree */
1213
-
1214
- //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */
1215
- this.heap = new common.Buf16(2 * L_CODES + 1); /* heap used to build the Huffman trees */
1216
- zero(this.heap);
1217
-
1218
- this.heap_len = 0; /* number of elements in the heap */
1219
- this.heap_max = 0; /* element of largest frequency */
1220
- /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
1221
- * The same heap array is used to build all trees.
1222
- */
1223
-
1224
- this.depth = new common.Buf16(2 * L_CODES + 1); //uch depth[2*L_CODES+1];
1225
- zero(this.depth);
1226
- /* Depth of each subtree used as tie breaker for trees of equal frequency
1227
- */
1228
-
1229
- this.l_buf = 0; /* buffer index for literals or lengths */
1230
-
1231
- this.lit_bufsize = 0;
1232
- /* Size of match buffer for literals/lengths. There are 4 reasons for
1233
- * limiting lit_bufsize to 64K:
1234
- * - frequencies can be kept in 16 bit counters
1235
- * - if compression is not successful for the first block, all input
1236
- * data is still in the window so we can still emit a stored block even
1237
- * when input comes from standard input. (This can also be done for
1238
- * all blocks if lit_bufsize is not greater than 32K.)
1239
- * - if compression is not successful for a file smaller than 64K, we can
1240
- * even emit a stored file instead of a stored block (saving 5 bytes).
1241
- * This is applicable only for zip (not gzip or zlib).
1242
- * - creating new Huffman trees less frequently may not provide fast
1243
- * adaptation to changes in the input data statistics. (Take for
1244
- * example a binary file with poorly compressible code followed by
1245
- * a highly compressible string table.) Smaller buffer sizes give
1246
- * fast adaptation but have of course the overhead of transmitting
1247
- * trees more frequently.
1248
- * - I can't count above 4
1249
- */
1250
-
1251
- this.last_lit = 0; /* running index in l_buf */
1252
-
1253
- this.d_buf = 0;
1254
- /* Buffer index for distances. To simplify the code, d_buf and l_buf have
1255
- * the same number of elements. To use different lengths, an extra flag
1256
- * array would be necessary.
1257
- */
1258
-
1259
- this.opt_len = 0; /* bit length of current block with optimal trees */
1260
- this.static_len = 0; /* bit length of current block with static trees */
1261
- this.matches = 0; /* number of string matches in current block */
1262
- this.insert = 0; /* bytes at end of window left to insert */
1263
-
1264
-
1265
- this.bi_buf = 0;
1266
- /* Output buffer. bits are inserted starting at the bottom (least
1267
- * significant bits).
1268
- */
1269
- this.bi_valid = 0;
1270
- /* Number of valid bits in bi_buf. All bits above the last valid bit
1271
- * are always zero.
1272
- */
1273
-
1274
- // Used for window memory init. We safely ignore it for JS. That makes
1275
- // sense only for pointers and memory check tools.
1276
- //this.high_water = 0;
1277
- /* High water mark offset in window for initialized bytes -- bytes above
1278
- * this are set to zero in order to avoid memory check warnings when
1279
- * longest match routines access bytes past the input. This is then
1280
- * updated to the new high water mark.
1281
- */
1282
- }
1283
-
1284
-
1285
- function deflateResetKeep(strm) {
1286
- var s;
1287
-
1288
- if (!strm || !strm.state) {
1289
- return err(strm, Z_STREAM_ERROR);
1290
- }
1291
-
1292
- strm.total_in = strm.total_out = 0;
1293
- strm.data_type = Z_UNKNOWN;
1294
-
1295
- s = strm.state;
1296
- s.pending = 0;
1297
- s.pending_out = 0;
1298
-
1299
- if (s.wrap < 0) {
1300
- s.wrap = -s.wrap;
1301
- /* was made negative by deflate(..., Z_FINISH); */
1302
- }
1303
- s.status = (s.wrap ? INIT_STATE : BUSY_STATE);
1304
- strm.adler = (s.wrap === 2) ?
1305
- 0 // crc32(0, Z_NULL, 0)
1306
- :
1307
- 1; // adler32(0, Z_NULL, 0)
1308
- s.last_flush = Z_NO_FLUSH;
1309
- trees._tr_init(s);
1310
- return Z_OK;
1311
- }
1312
-
1313
-
1314
- function deflateReset(strm) {
1315
- var ret = deflateResetKeep(strm);
1316
- if (ret === Z_OK) {
1317
- lm_init(strm.state);
1318
- }
1319
- return ret;
1320
- }
1321
-
1322
-
1323
- function deflateSetHeader(strm, head) {
1324
- if (!strm || !strm.state) { return Z_STREAM_ERROR; }
1325
- if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; }
1326
- strm.state.gzhead = head;
1327
- return Z_OK;
1328
- }
1329
-
1330
-
1331
- function deflateInit2(strm, level, method, windowBits, memLevel, strategy) {
1332
- if (!strm) { // === Z_NULL
1333
- return Z_STREAM_ERROR;
1334
- }
1335
- var wrap = 1;
1336
-
1337
- if (level === Z_DEFAULT_COMPRESSION) {
1338
- level = 6;
1339
- }
1340
-
1341
- if (windowBits < 0) { /* suppress zlib wrapper */
1342
- wrap = 0;
1343
- windowBits = -windowBits;
1344
- }
1345
-
1346
- else if (windowBits > 15) {
1347
- wrap = 2; /* write gzip wrapper instead */
1348
- windowBits -= 16;
1349
- }
1350
-
1351
-
1352
- if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED ||
1353
- windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
1354
- strategy < 0 || strategy > Z_FIXED) {
1355
- return err(strm, Z_STREAM_ERROR);
1356
- }
1357
-
1358
-
1359
- if (windowBits === 8) {
1360
- windowBits = 9;
1361
- }
1362
- /* until 256-byte window bug fixed */
1363
-
1364
- var s = new DeflateState();
1365
-
1366
- strm.state = s;
1367
- s.strm = strm;
1368
-
1369
- s.wrap = wrap;
1370
- s.gzhead = null;
1371
- s.w_bits = windowBits;
1372
- s.w_size = 1 << s.w_bits;
1373
- s.w_mask = s.w_size - 1;
1374
-
1375
- s.hash_bits = memLevel + 7;
1376
- s.hash_size = 1 << s.hash_bits;
1377
- s.hash_mask = s.hash_size - 1;
1378
- s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH);
1379
-
1380
- s.window = new common.Buf8(s.w_size * 2);
1381
- s.head = new common.Buf16(s.hash_size);
1382
- s.prev = new common.Buf16(s.w_size);
1383
-
1384
- // Don't need mem init magic for JS.
1385
- //s.high_water = 0; /* nothing written to s->window yet */
1386
-
1387
- s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
1388
-
1389
- s.pending_buf_size = s.lit_bufsize * 4;
1390
-
1391
- //overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
1392
- //s->pending_buf = (uchf *) overlay;
1393
- s.pending_buf = new common.Buf8(s.pending_buf_size);
1394
-
1395
- // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`)
1396
- //s->d_buf = overlay + s->lit_bufsize/sizeof(ush);
1397
- s.d_buf = 1 * s.lit_bufsize;
1398
-
1399
- //s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;
1400
- s.l_buf = (1 + 2) * s.lit_bufsize;
1401
-
1402
- s.level = level;
1403
- s.strategy = strategy;
1404
- s.method = method;
1405
-
1406
- return deflateReset(strm);
1407
- }
1408
-
1409
- function deflateInit(strm, level) {
1410
- return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
1411
- }
1412
-
1413
-
1414
- function deflate(strm, flush) {
1415
- var old_flush, s;
1416
- var beg, val; // for gzip header write only
1417
-
1418
- if (!strm || !strm.state ||
1419
- flush > Z_BLOCK || flush < 0) {
1420
- return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR;
1421
- }
1422
-
1423
- s = strm.state;
1424
-
1425
- if (!strm.output ||
1426
- (!strm.input && strm.avail_in !== 0) ||
1427
- (s.status === FINISH_STATE && flush !== Z_FINISH)) {
1428
- return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR);
1429
- }
1430
-
1431
- s.strm = strm; /* just in case */
1432
- old_flush = s.last_flush;
1433
- s.last_flush = flush;
1434
-
1435
- /* Write the header */
1436
- if (s.status === INIT_STATE) {
1437
-
1438
- if (s.wrap === 2) { // GZIP header
1439
- strm.adler = 0; //crc32(0L, Z_NULL, 0);
1440
- put_byte(s, 31);
1441
- put_byte(s, 139);
1442
- put_byte(s, 8);
1443
- if (!s.gzhead) { // s->gzhead == Z_NULL
1444
- put_byte(s, 0);
1445
- put_byte(s, 0);
1446
- put_byte(s, 0);
1447
- put_byte(s, 0);
1448
- put_byte(s, 0);
1449
- put_byte(s, s.level === 9 ? 2 :
1450
- (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?
1451
- 4 : 0));
1452
- put_byte(s, OS_CODE);
1453
- s.status = BUSY_STATE;
1454
- }
1455
- else {
1456
- put_byte(s, (s.gzhead.text ? 1 : 0) +
1457
- (s.gzhead.hcrc ? 2 : 0) +
1458
- (!s.gzhead.extra ? 0 : 4) +
1459
- (!s.gzhead.name ? 0 : 8) +
1460
- (!s.gzhead.comment ? 0 : 16)
1461
- );
1462
- put_byte(s, s.gzhead.time & 0xff);
1463
- put_byte(s, (s.gzhead.time >> 8) & 0xff);
1464
- put_byte(s, (s.gzhead.time >> 16) & 0xff);
1465
- put_byte(s, (s.gzhead.time >> 24) & 0xff);
1466
- put_byte(s, s.level === 9 ? 2 :
1467
- (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?
1468
- 4 : 0));
1469
- put_byte(s, s.gzhead.os & 0xff);
1470
- if (s.gzhead.extra && s.gzhead.extra.length) {
1471
- put_byte(s, s.gzhead.extra.length & 0xff);
1472
- put_byte(s, (s.gzhead.extra.length >> 8) & 0xff);
1473
- }
1474
- if (s.gzhead.hcrc) {
1475
- strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending, 0);
1476
- }
1477
- s.gzindex = 0;
1478
- s.status = EXTRA_STATE;
1479
- }
1480
- }
1481
- else // DEFLATE header
1482
- {
1483
- var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8;
1484
- var level_flags = -1;
1485
-
1486
- if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) {
1487
- level_flags = 0;
1488
- } else if (s.level < 6) {
1489
- level_flags = 1;
1490
- } else if (s.level === 6) {
1491
- level_flags = 2;
1492
- } else {
1493
- level_flags = 3;
1494
- }
1495
- header |= (level_flags << 6);
1496
- if (s.strstart !== 0) { header |= PRESET_DICT; }
1497
- header += 31 - (header % 31);
1498
-
1499
- s.status = BUSY_STATE;
1500
- putShortMSB(s, header);
1501
-
1502
- /* Save the adler32 of the preset dictionary: */
1503
- if (s.strstart !== 0) {
1504
- putShortMSB(s, strm.adler >>> 16);
1505
- putShortMSB(s, strm.adler & 0xffff);
1506
- }
1507
- strm.adler = 1; // adler32(0L, Z_NULL, 0);
1508
- }
1509
- }
1510
-
1511
- //#ifdef GZIP
1512
- if (s.status === EXTRA_STATE) {
1513
- if (s.gzhead.extra/* != Z_NULL*/) {
1514
- beg = s.pending; /* start of bytes to update crc */
1515
-
1516
- while (s.gzindex < (s.gzhead.extra.length & 0xffff)) {
1517
- if (s.pending === s.pending_buf_size) {
1518
- if (s.gzhead.hcrc && s.pending > beg) {
1519
- strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);
1520
- }
1521
- flush_pending(strm);
1522
- beg = s.pending;
1523
- if (s.pending === s.pending_buf_size) {
1524
- break;
1525
- }
1526
- }
1527
- put_byte(s, s.gzhead.extra[s.gzindex] & 0xff);
1528
- s.gzindex++;
1529
- }
1530
- if (s.gzhead.hcrc && s.pending > beg) {
1531
- strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);
1532
- }
1533
- if (s.gzindex === s.gzhead.extra.length) {
1534
- s.gzindex = 0;
1535
- s.status = NAME_STATE;
1536
- }
1537
- }
1538
- else {
1539
- s.status = NAME_STATE;
1540
- }
1541
- }
1542
- if (s.status === NAME_STATE) {
1543
- if (s.gzhead.name/* != Z_NULL*/) {
1544
- beg = s.pending; /* start of bytes to update crc */
1545
- //int val;
1546
-
1547
- do {
1548
- if (s.pending === s.pending_buf_size) {
1549
- if (s.gzhead.hcrc && s.pending > beg) {
1550
- strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);
1551
- }
1552
- flush_pending(strm);
1553
- beg = s.pending;
1554
- if (s.pending === s.pending_buf_size) {
1555
- val = 1;
1556
- break;
1557
- }
1558
- }
1559
- // JS specific: little magic to add zero terminator to end of string
1560
- if (s.gzindex < s.gzhead.name.length) {
1561
- val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff;
1562
- } else {
1563
- val = 0;
1564
- }
1565
- put_byte(s, val);
1566
- } while (val !== 0);
1567
-
1568
- if (s.gzhead.hcrc && s.pending > beg) {
1569
- strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);
1570
- }
1571
- if (val === 0) {
1572
- s.gzindex = 0;
1573
- s.status = COMMENT_STATE;
1574
- }
1575
- }
1576
- else {
1577
- s.status = COMMENT_STATE;
1578
- }
1579
- }
1580
- if (s.status === COMMENT_STATE) {
1581
- if (s.gzhead.comment/* != Z_NULL*/) {
1582
- beg = s.pending; /* start of bytes to update crc */
1583
- //int val;
1584
-
1585
- do {
1586
- if (s.pending === s.pending_buf_size) {
1587
- if (s.gzhead.hcrc && s.pending > beg) {
1588
- strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);
1589
- }
1590
- flush_pending(strm);
1591
- beg = s.pending;
1592
- if (s.pending === s.pending_buf_size) {
1593
- val = 1;
1594
- break;
1595
- }
1596
- }
1597
- // JS specific: little magic to add zero terminator to end of string
1598
- if (s.gzindex < s.gzhead.comment.length) {
1599
- val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff;
1600
- } else {
1601
- val = 0;
1602
- }
1603
- put_byte(s, val);
1604
- } while (val !== 0);
1605
-
1606
- if (s.gzhead.hcrc && s.pending > beg) {
1607
- strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);
1608
- }
1609
- if (val === 0) {
1610
- s.status = HCRC_STATE;
1611
- }
1612
- }
1613
- else {
1614
- s.status = HCRC_STATE;
1615
- }
1616
- }
1617
- if (s.status === HCRC_STATE) {
1618
- if (s.gzhead.hcrc) {
1619
- if (s.pending + 2 > s.pending_buf_size) {
1620
- flush_pending(strm);
1621
- }
1622
- if (s.pending + 2 <= s.pending_buf_size) {
1623
- put_byte(s, strm.adler & 0xff);
1624
- put_byte(s, (strm.adler >> 8) & 0xff);
1625
- strm.adler = 0; //crc32(0L, Z_NULL, 0);
1626
- s.status = BUSY_STATE;
1627
- }
1628
- }
1629
- else {
1630
- s.status = BUSY_STATE;
1631
- }
1632
- }
1633
- //#endif
1634
-
1635
- /* Flush as much pending output as possible */
1636
- if (s.pending !== 0) {
1637
- flush_pending(strm);
1638
- if (strm.avail_out === 0) {
1639
- /* Since avail_out is 0, deflate will be called again with
1640
- * more output space, but possibly with both pending and
1641
- * avail_in equal to zero. There won't be anything to do,
1642
- * but this is not an error situation so make sure we
1643
- * return OK instead of BUF_ERROR at next call of deflate:
1644
- */
1645
- s.last_flush = -1;
1646
- return Z_OK;
1647
- }
1648
-
1649
- /* Make sure there is something to do and avoid duplicate consecutive
1650
- * flushes. For repeated and useless calls with Z_FINISH, we keep
1651
- * returning Z_STREAM_END instead of Z_BUF_ERROR.
1652
- */
1653
- } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) &&
1654
- flush !== Z_FINISH) {
1655
- return err(strm, Z_BUF_ERROR);
1656
- }
1657
-
1658
- /* User must not provide more input after the first FINISH: */
1659
- if (s.status === FINISH_STATE && strm.avail_in !== 0) {
1660
- return err(strm, Z_BUF_ERROR);
1661
- }
1662
-
1663
- /* Start a new block or continue the current one.
1664
- */
1665
- if (strm.avail_in !== 0 || s.lookahead !== 0 ||
1666
- (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) {
1667
- var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) :
1668
- (s.strategy === Z_RLE ? deflate_rle(s, flush) :
1669
- configuration_table[s.level].func(s, flush));
1670
-
1671
- if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) {
1672
- s.status = FINISH_STATE;
1673
- }
1674
- if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) {
1675
- if (strm.avail_out === 0) {
1676
- s.last_flush = -1;
1677
- /* avoid BUF_ERROR next call, see above */
1678
- }
1679
- return Z_OK;
1680
- /* If flush != Z_NO_FLUSH && avail_out == 0, the next call
1681
- * of deflate should use the same flush parameter to make sure
1682
- * that the flush is complete. So we don't have to output an
1683
- * empty block here, this will be done at next call. This also
1684
- * ensures that for a very small output buffer, we emit at most
1685
- * one empty block.
1686
- */
1687
- }
1688
- if (bstate === BS_BLOCK_DONE) {
1689
- if (flush === Z_PARTIAL_FLUSH) {
1690
- trees._tr_align(s);
1691
- }
1692
- else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */
1693
-
1694
- trees._tr_stored_block(s, 0, 0, false);
1695
- /* For a full flush, this empty block will be recognized
1696
- * as a special marker by inflate_sync().
1697
- */
1698
- if (flush === Z_FULL_FLUSH) {
1699
- /*** CLEAR_HASH(s); ***/ /* forget history */
1700
- zero(s.head); // Fill with NIL (= 0);
1701
-
1702
- if (s.lookahead === 0) {
1703
- s.strstart = 0;
1704
- s.block_start = 0;
1705
- s.insert = 0;
1706
- }
1707
- }
1708
- }
1709
- flush_pending(strm);
1710
- if (strm.avail_out === 0) {
1711
- s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */
1712
- return Z_OK;
1713
- }
1714
- }
1715
- }
1716
- //Assert(strm->avail_out > 0, "bug2");
1717
- //if (strm.avail_out <= 0) { throw new Error("bug2");}
1718
-
1719
- if (flush !== Z_FINISH) { return Z_OK; }
1720
- if (s.wrap <= 0) { return Z_STREAM_END; }
1721
-
1722
- /* Write the trailer */
1723
- if (s.wrap === 2) {
1724
- put_byte(s, strm.adler & 0xff);
1725
- put_byte(s, (strm.adler >> 8) & 0xff);
1726
- put_byte(s, (strm.adler >> 16) & 0xff);
1727
- put_byte(s, (strm.adler >> 24) & 0xff);
1728
- put_byte(s, strm.total_in & 0xff);
1729
- put_byte(s, (strm.total_in >> 8) & 0xff);
1730
- put_byte(s, (strm.total_in >> 16) & 0xff);
1731
- put_byte(s, (strm.total_in >> 24) & 0xff);
1732
- }
1733
- else
1734
- {
1735
- putShortMSB(s, strm.adler >>> 16);
1736
- putShortMSB(s, strm.adler & 0xffff);
1737
- }
1738
-
1739
- flush_pending(strm);
1740
- /* If avail_out is zero, the application will call deflate again
1741
- * to flush the rest.
1742
- */
1743
- if (s.wrap > 0) { s.wrap = -s.wrap; }
1744
- /* write the trailer only once! */
1745
- return s.pending !== 0 ? Z_OK : Z_STREAM_END;
1746
- }
1747
-
1748
- function deflateEnd(strm) {
1749
- var status;
1750
-
1751
- if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {
1752
- return Z_STREAM_ERROR;
1753
- }
1754
-
1755
- status = strm.state.status;
1756
- if (status !== INIT_STATE &&
1757
- status !== EXTRA_STATE &&
1758
- status !== NAME_STATE &&
1759
- status !== COMMENT_STATE &&
1760
- status !== HCRC_STATE &&
1761
- status !== BUSY_STATE &&
1762
- status !== FINISH_STATE
1763
- ) {
1764
- return err(strm, Z_STREAM_ERROR);
1765
- }
1766
-
1767
- strm.state = null;
1768
-
1769
- return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK;
1770
- }
1771
-
1772
-
1773
- /* =========================================================================
1774
- * Initializes the compression dictionary from the given byte
1775
- * sequence without producing any compressed output.
1776
- */
1777
- function deflateSetDictionary(strm, dictionary) {
1778
- var dictLength = dictionary.length;
1779
-
1780
- var s;
1781
- var str, n;
1782
- var wrap;
1783
- var avail;
1784
- var next;
1785
- var input;
1786
- var tmpDict;
1787
-
1788
- if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {
1789
- return Z_STREAM_ERROR;
1790
- }
1791
-
1792
- s = strm.state;
1793
- wrap = s.wrap;
1794
-
1795
- if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) {
1796
- return Z_STREAM_ERROR;
1797
- }
1798
-
1799
- /* when using zlib wrappers, compute Adler-32 for provided dictionary */
1800
- if (wrap === 1) {
1801
- /* adler32(strm->adler, dictionary, dictLength); */
1802
- strm.adler = adler32_1(strm.adler, dictionary, dictLength, 0);
1803
- }
1804
-
1805
- s.wrap = 0; /* avoid computing Adler-32 in read_buf */
1806
-
1807
- /* if dictionary would fill window, just replace the history */
1808
- if (dictLength >= s.w_size) {
1809
- if (wrap === 0) { /* already empty otherwise */
1810
- /*** CLEAR_HASH(s); ***/
1811
- zero(s.head); // Fill with NIL (= 0);
1812
- s.strstart = 0;
1813
- s.block_start = 0;
1814
- s.insert = 0;
1815
- }
1816
- /* use the tail */
1817
- // dictionary = dictionary.slice(dictLength - s.w_size);
1818
- tmpDict = new common.Buf8(s.w_size);
1819
- common.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0);
1820
- dictionary = tmpDict;
1821
- dictLength = s.w_size;
1822
- }
1823
- /* insert dictionary into window and hash */
1824
- avail = strm.avail_in;
1825
- next = strm.next_in;
1826
- input = strm.input;
1827
- strm.avail_in = dictLength;
1828
- strm.next_in = 0;
1829
- strm.input = dictionary;
1830
- fill_window(s);
1831
- while (s.lookahead >= MIN_MATCH) {
1832
- str = s.strstart;
1833
- n = s.lookahead - (MIN_MATCH - 1);
1834
- do {
1835
- /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */
1836
- s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;
1837
-
1838
- s.prev[str & s.w_mask] = s.head[s.ins_h];
1839
-
1840
- s.head[s.ins_h] = str;
1841
- str++;
1842
- } while (--n);
1843
- s.strstart = str;
1844
- s.lookahead = MIN_MATCH - 1;
1845
- fill_window(s);
1846
- }
1847
- s.strstart += s.lookahead;
1848
- s.block_start = s.strstart;
1849
- s.insert = s.lookahead;
1850
- s.lookahead = 0;
1851
- s.match_length = s.prev_length = MIN_MATCH - 1;
1852
- s.match_available = 0;
1853
- strm.next_in = next;
1854
- strm.input = input;
1855
- strm.avail_in = avail;
1856
- s.wrap = wrap;
1857
- return Z_OK;
1858
- }
1859
-
1860
-
1861
- var deflateInit_1 = deflateInit;
1862
- var deflateInit2_1 = deflateInit2;
1863
- var deflateReset_1 = deflateReset;
1864
- var deflateResetKeep_1 = deflateResetKeep;
1865
- var deflateSetHeader_1 = deflateSetHeader;
1866
- var deflate_2 = deflate;
1867
- var deflateEnd_1 = deflateEnd;
1868
- var deflateSetDictionary_1 = deflateSetDictionary;
1869
- var deflateInfo = 'pako deflate (from Nodeca project)';
1870
-
1871
- /* Not implemented
1872
- exports.deflateBound = deflateBound;
1873
- exports.deflateCopy = deflateCopy;
1874
- exports.deflateParams = deflateParams;
1875
- exports.deflatePending = deflatePending;
1876
- exports.deflatePrime = deflatePrime;
1877
- exports.deflateTune = deflateTune;
1878
- */
1879
-
1880
- var deflate_1 = {
1881
- deflateInit: deflateInit_1,
1882
- deflateInit2: deflateInit2_1,
1883
- deflateReset: deflateReset_1,
1884
- deflateResetKeep: deflateResetKeep_1,
1885
- deflateSetHeader: deflateSetHeader_1,
1886
- deflate: deflate_2,
1887
- deflateEnd: deflateEnd_1,
1888
- deflateSetDictionary: deflateSetDictionary_1,
1889
- deflateInfo: deflateInfo
1890
- };
1891
-
1892
- export { deflate_1 as d };