volview 4.0.0 → 4.0.1

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 (404) hide show
  1. package/dist/css/app.925b979f.css +1 -0
  2. package/dist/css/chunk-vendors.43a6a19a.css +5 -0
  3. package/{public → dist}/favicon.ico +0 -0
  4. package/{public → dist}/global.css +0 -0
  5. package/{src/assets/KitwareHeadAndNeck.jpg → dist/img/KitwareHeadAndNeck.11db5ffb.jpg} +0 -0
  6. package/dist/index.html +1 -0
  7. package/dist/itk/image-io/BMPImageIOReadImage.js +1 -0
  8. package/dist/itk/image-io/BMPImageIOReadImage.umd.js +1 -0
  9. package/dist/itk/image-io/BMPImageIOReadImage.wasm +0 -0
  10. package/dist/itk/image-io/BMPImageIOWriteImage.js +1 -0
  11. package/dist/itk/image-io/BMPImageIOWriteImage.umd.js +1 -0
  12. package/dist/itk/image-io/BMPImageIOWriteImage.wasm +0 -0
  13. package/dist/itk/image-io/GDCMImageIOReadImage.js +1 -0
  14. package/dist/itk/image-io/GDCMImageIOReadImage.umd.js +1 -0
  15. package/dist/itk/image-io/GDCMImageIOReadImage.wasm +0 -0
  16. package/dist/itk/image-io/GDCMImageIOWriteImage.js +1 -0
  17. package/dist/itk/image-io/GDCMImageIOWriteImage.umd.js +1 -0
  18. package/dist/itk/image-io/GDCMImageIOWriteImage.wasm +0 -0
  19. package/dist/itk/image-io/JPEGImageIOReadImage.js +1 -0
  20. package/dist/itk/image-io/JPEGImageIOReadImage.umd.js +1 -0
  21. package/dist/itk/image-io/JPEGImageIOReadImage.wasm +0 -0
  22. package/dist/itk/image-io/JPEGImageIOWriteImage.js +1 -0
  23. package/dist/itk/image-io/JPEGImageIOWriteImage.umd.js +1 -0
  24. package/dist/itk/image-io/JPEGImageIOWriteImage.wasm +0 -0
  25. package/dist/itk/image-io/MetaImageIOReadImage.js +1 -0
  26. package/dist/itk/image-io/MetaImageIOReadImage.umd.js +1 -0
  27. package/dist/itk/image-io/MetaImageIOReadImage.wasm +0 -0
  28. package/dist/itk/image-io/MetaImageIOWriteImage.js +1 -0
  29. package/dist/itk/image-io/MetaImageIOWriteImage.umd.js +1 -0
  30. package/dist/itk/image-io/MetaImageIOWriteImage.wasm +0 -0
  31. package/dist/itk/image-io/NiftiImageIOReadImage.js +1 -0
  32. package/dist/itk/image-io/NiftiImageIOReadImage.umd.js +1 -0
  33. package/dist/itk/image-io/NiftiImageIOReadImage.wasm +0 -0
  34. package/dist/itk/image-io/NiftiImageIOWriteImage.js +1 -0
  35. package/dist/itk/image-io/NiftiImageIOWriteImage.umd.js +1 -0
  36. package/dist/itk/image-io/NiftiImageIOWriteImage.wasm +0 -0
  37. package/dist/itk/image-io/NrrdImageIOReadImage.js +1 -0
  38. package/dist/itk/image-io/NrrdImageIOReadImage.umd.js +1 -0
  39. package/dist/itk/image-io/NrrdImageIOReadImage.wasm +0 -0
  40. package/dist/itk/image-io/NrrdImageIOWriteImage.js +1 -0
  41. package/dist/itk/image-io/NrrdImageIOWriteImage.umd.js +1 -0
  42. package/dist/itk/image-io/NrrdImageIOWriteImage.wasm +0 -0
  43. package/dist/itk/image-io/PNGImageIOReadImage.js +1 -0
  44. package/dist/itk/image-io/PNGImageIOReadImage.umd.js +1 -0
  45. package/dist/itk/image-io/PNGImageIOReadImage.wasm +0 -0
  46. package/dist/itk/image-io/PNGImageIOWriteImage.js +1 -0
  47. package/dist/itk/image-io/PNGImageIOWriteImage.umd.js +1 -0
  48. package/dist/itk/image-io/PNGImageIOWriteImage.wasm +0 -0
  49. package/dist/itk/image-io/ReadDICOMTags.js +1 -0
  50. package/dist/itk/image-io/ReadDICOMTags.umd.js +1 -0
  51. package/dist/itk/image-io/ReadDICOMTags.wasm +0 -0
  52. package/dist/itk/image-io/ReadImageDICOMFileSeries.js +1 -0
  53. package/dist/itk/image-io/ReadImageDICOMFileSeries.umd.js +1 -0
  54. package/dist/itk/image-io/ReadImageDICOMFileSeries.wasm +0 -0
  55. package/dist/itk/image-io/VTKImageIOReadImage.js +1 -0
  56. package/dist/itk/image-io/VTKImageIOReadImage.umd.js +1 -0
  57. package/dist/itk/image-io/VTKImageIOReadImage.wasm +0 -0
  58. package/dist/itk/image-io/VTKImageIOWriteImage.js +1 -0
  59. package/dist/itk/image-io/VTKImageIOWriteImage.umd.js +1 -0
  60. package/dist/itk/image-io/VTKImageIOWriteImage.wasm +0 -0
  61. package/dist/itk/pipelines/dicom.js +1 -0
  62. package/dist/itk/pipelines/dicom.umd.js +1 -0
  63. package/{src/io/itk-dicom/web-build → dist/itk/pipelines}/dicom.umd.wasm +0 -0
  64. package/{src/io/itk-dicom/web-build → dist/itk/pipelines}/dicom.wasm +0 -0
  65. package/dist/itk/web-workers/IOInput.d.ts +6 -0
  66. package/dist/itk/web-workers/IOInput.js +1 -0
  67. package/dist/itk/web-workers/ITKConfig.d.ts +8 -0
  68. package/dist/itk/web-workers/ITKConfig.js +1 -0
  69. package/dist/itk/web-workers/RunPipelineInput.d.ts +10 -0
  70. package/dist/itk/web-workers/RunPipelineInput.js +1 -0
  71. package/dist/itk/web-workers/WebWorkerInput.d.ts +6 -0
  72. package/dist/itk/web-workers/WebWorkerInput.js +1 -0
  73. package/dist/itk/web-workers/bundles/pipeline.worker.js +1 -0
  74. package/dist/itk/web-workers/loadImageIOPipelineModule.d.ts +4 -0
  75. package/dist/itk/web-workers/loadImageIOPipelineModule.js +1 -0
  76. package/dist/itk/web-workers/loadMeshIOPipelineModule.d.ts +4 -0
  77. package/dist/itk/web-workers/loadMeshIOPipelineModule.js +1 -0
  78. package/dist/itk/web-workers/loadPipelineModule.d.ts +3 -0
  79. package/dist/itk/web-workers/loadPipelineModule.js +1 -0
  80. package/dist/itk/web-workers/min-bundles/pipeline.worker.js +3 -0
  81. package/dist/itk/web-workers/pipeline.worker.d.ts +1 -0
  82. package/dist/itk/web-workers/pipeline.worker.js +1 -0
  83. package/dist/itk/web-workers/runPipeline.d.ts +5 -0
  84. package/dist/itk/web-workers/runPipeline.js +1 -0
  85. package/dist/js/23.be4d694e.js +21 -0
  86. package/dist/js/23.be4d694e.js.map +1 -0
  87. package/dist/js/385.51ca48a2.js +2 -0
  88. package/dist/js/385.51ca48a2.js.map +1 -0
  89. package/dist/js/422.c64a6aa7.js +2 -0
  90. package/dist/js/422.c64a6aa7.js.map +1 -0
  91. package/dist/js/979.c4823352.js +2 -0
  92. package/dist/js/979.c4823352.js.map +1 -0
  93. package/dist/js/app.81e49d9a.js +2 -0
  94. package/dist/js/app.81e49d9a.js.map +1 -0
  95. package/dist/js/chunk-vendors.0ab48f8d.js +33 -0
  96. package/dist/js/chunk-vendors.0ab48f8d.js.map +1 -0
  97. package/{public → dist}/pvm-sample.png +0 -0
  98. package/package.json +3 -2
  99. package/.browserslistrc +0 -4
  100. package/.editorconfig +0 -6
  101. package/.env +0 -6
  102. package/.eslintrc.js +0 -109
  103. package/.gitattributes +0 -1
  104. package/.github/workflows/checks.yml +0 -16
  105. package/.github/workflows/publish.yml +0 -52
  106. package/.prettierignore +0 -5
  107. package/CONTRIBUTING.md +0 -29
  108. package/babel.config.js +0 -3
  109. package/documentation/config.js +0 -15
  110. package/documentation/content/KWVolViewLogo.png +0 -0
  111. package/documentation/content/KWVolViewLogo.svg +0 -35
  112. package/documentation/content/VolViewLogo.png +0 -0
  113. package/documentation/content/VolViewLogo.svg +0 -22
  114. package/documentation/content/doc/index.md +0 -64
  115. package/documentation/content/doc/loading_data.md +0 -30
  116. package/documentation/content/doc/mouse_controls.md +0 -34
  117. package/documentation/content/doc/quick_start_guide.md +0 -75
  118. package/documentation/content/doc/rendering.md +0 -27
  119. package/documentation/content/doc/state_files.md +0 -18
  120. package/documentation/content/doc/toolbar.md +0 -20
  121. package/documentation/content/doc/welcome_screen.md +0 -23
  122. package/documentation/content/gallery/01-volview-welcome-notes.jpg +0 -0
  123. package/documentation/content/gallery/01-volview-welcome.jpg +0 -0
  124. package/documentation/content/gallery/02-volview-about.jpg +0 -0
  125. package/documentation/content/gallery/02-volview-notifications.jpg +0 -0
  126. package/documentation/content/gallery/02-volview-settings.jpg +0 -0
  127. package/documentation/content/gallery/03-volview-sample-datasets.jpg +0 -0
  128. package/documentation/content/gallery/04-volview-active-data.jpg +0 -0
  129. package/documentation/content/gallery/05-volview-select-data-to-delete.jpg +0 -0
  130. package/documentation/content/gallery/06-volview-corner-annotation.jpg +0 -0
  131. package/documentation/content/gallery/07-volview-layout-notes.jpg +0 -0
  132. package/documentation/content/gallery/07-volview-layout.jpg +0 -0
  133. package/documentation/content/gallery/09-volview-layout-3DPrimary.jpg +0 -0
  134. package/documentation/content/gallery/10-volview-wl-pan-zoom-notes.jpg +0 -0
  135. package/documentation/content/gallery/10-volview-wl-pan-zoom.jpg +0 -0
  136. package/documentation/content/gallery/11-volview-paint-notes.jpg +0 -0
  137. package/documentation/content/gallery/11-volview-paint.jpg +0 -0
  138. package/documentation/content/gallery/12-volview-paint-options.jpg +0 -0
  139. package/documentation/content/gallery/13-volview-crop-notes.jpg +0 -0
  140. package/documentation/content/gallery/13-volview-crop.jpg +0 -0
  141. package/documentation/content/gallery/14-volview-ruler.jpg +0 -0
  142. package/documentation/content/gallery/15-volview-crosshairs.jpg +0 -0
  143. package/documentation/content/gallery/16-volview-rendering.jpg +0 -0
  144. package/documentation/content/gallery/17-volview-colormap-notes.jpg +0 -0
  145. package/documentation/content/gallery/17-volview-colormap.jpg +0 -0
  146. package/documentation/content/gallery/17-volview-opacity-notes.jpg +0 -0
  147. package/documentation/content/gallery/17-volview-opacity.jpg +0 -0
  148. package/documentation/content/gallery/17-volview-opacity2.jpg +0 -0
  149. package/documentation/content/gallery/18-volview-presets.jpg +0 -0
  150. package/documentation/content/gallery/19-volview-color.jpg +0 -0
  151. package/documentation/content/gallery/19-volview-color2.jpg +0 -0
  152. package/documentation/content/gallery/20-volview-lightfollowcamera0.jpg +0 -0
  153. package/documentation/content/gallery/20-volview-lightfollowcamera1.jpg +0 -0
  154. package/documentation/content/gallery/20-volview-lightfollowcamera2.jpg +0 -0
  155. package/documentation/content/gallery/20-volview-lightfollowcamera3.jpg +0 -0
  156. package/documentation/content/gallery/21-volview-hybrid-final.jpg +0 -0
  157. package/documentation/content/gallery/21-volview-hybrid0.0.jpg +0 -0
  158. package/documentation/content/gallery/21-volview-hybrid0.5.jpg +0 -0
  159. package/documentation/content/gallery/21-volview-hybrid1.0.jpg +0 -0
  160. package/documentation/content/gallery/LocalAmbientOcclusion.jpg +0 -0
  161. package/documentation/content/gallery/Notes.pptx +0 -0
  162. package/documentation/content/gallery/VolView-Overview.jpg +0 -0
  163. package/documentation/content/gallery/index.md +0 -53
  164. package/documentation/content/icon/favicon-16x16.png +0 -0
  165. package/documentation/content/icon/favicon-196x196.png +0 -0
  166. package/documentation/content/icon/favicon-32x32.png +0 -0
  167. package/documentation/content/icon/favicon-96x96.png +0 -0
  168. package/documentation/content/index.pug +0 -43
  169. package/documentation/content/logo.png +0 -0
  170. package/documentation/content/logo.svg +0 -20
  171. package/documentation/data/menu.yml +0 -3
  172. package/documentation/themes/navy/layout/partial/footer.swig +0 -22
  173. package/documentation/tpl/__en__ +0 -31
  174. package/documentation/tpl/__sidebar__ +0 -11
  175. package/patches/jsdom-global+3.0.2.patch +0 -12
  176. package/patches/vue-toastification+1.7.14.patch +0 -41
  177. package/patches/vuetify+2.6.10.patch +0 -13
  178. package/prettier.config.js +0 -9
  179. package/public/index.html +0 -28
  180. package/server/helper.py +0 -147
  181. package/server/host.js +0 -134
  182. package/server/serialize.js +0 -111
  183. package/server/serialize.py +0 -203
  184. package/server/server.py +0 -84
  185. package/server/test.py +0 -17
  186. package/src/assets/logo.png +0 -0
  187. package/src/assets/logo.svg +0 -20
  188. package/src/assets/samples/3DUS-Fetus.jpg +0 -0
  189. package/src/assets/samples/CTA-Head_and_Neck.jpg +0 -0
  190. package/src/assets/samples/MRA-Head_and_Neck.jpg +0 -0
  191. package/src/assets/samples/MRI-Cardiac.jpg +0 -0
  192. package/src/assets/samples/MRI-PROSTATEx.jpg +0 -0
  193. package/src/components/AboutBox.vue +0 -157
  194. package/src/components/AiModule.vue +0 -60
  195. package/src/components/AnnotationsModule.vue +0 -37
  196. package/src/components/App.vue +0 -539
  197. package/src/components/ColorFunctionSlider.vue +0 -181
  198. package/src/components/DataBrowser.vue +0 -173
  199. package/src/components/DragAndDrop.vue +0 -107
  200. package/src/components/GroupableItem.vue +0 -30
  201. package/src/components/ImageDataBrowser.vue +0 -186
  202. package/src/components/ImageListCard.vue +0 -114
  203. package/src/components/ItemGroup.vue +0 -74
  204. package/src/components/LabelmapList.vue +0 -36
  205. package/src/components/LayoutGrid.vue +0 -96
  206. package/src/components/MeasurementsList.vue +0 -134
  207. package/src/components/MessageCenter.vue +0 -189
  208. package/src/components/MessageItem.vue +0 -83
  209. package/src/components/MessageNotificationContent.vue +0 -20
  210. package/src/components/MessageNotifications.vue +0 -84
  211. package/src/components/ModelBrowser.vue +0 -83
  212. package/src/components/ModulePanel.vue +0 -137
  213. package/src/components/PaintControls.vue +0 -174
  214. package/src/components/PatientBrowser.vue +0 -280
  215. package/src/components/PatientStudyVolumeBrowser.vue +0 -325
  216. package/src/components/RenderingModule.vue +0 -49
  217. package/src/components/ResizableNavDrawer.vue +0 -158
  218. package/src/components/SampleDataBrowser.vue +0 -198
  219. package/src/components/SaveSession.vue +0 -57
  220. package/src/components/Settings.vue +0 -35
  221. package/src/components/SliceSlider.vue +0 -182
  222. package/src/components/SpleenModule.vue +0 -101
  223. package/src/components/ToolButton.vue +0 -58
  224. package/src/components/ToolStrip.vue +0 -186
  225. package/src/components/ViewOverlayGrid.vue +0 -84
  226. package/src/components/VolumePresets.vue +0 -165
  227. package/src/components/VolumeProperties.vue +0 -171
  228. package/src/components/VolumeRendering.vue +0 -365
  229. package/src/components/VtkThreeView.vue +0 -512
  230. package/src/components/VtkTwoView.vue +0 -665
  231. package/src/components/__tests__/ResizableNavDrawer.spec.js +0 -32
  232. package/src/components/__tests__/ToolButton.spec.js +0 -46
  233. package/src/components/icons/KitwareLogoIcon.vue +0 -54
  234. package/src/components/icons/VolViewFullLogo.vue +0 -139
  235. package/src/components/icons/VolViewLogo.vue +0 -78
  236. package/src/components/styles/utils.css +0 -16
  237. package/src/components/styles/vtk-view.css +0 -116
  238. package/src/components/tools/CropTool.vue +0 -61
  239. package/src/components/tools/CrosshairsTool.vue +0 -93
  240. package/src/components/tools/MouseManipulatorTool.vue +0 -108
  241. package/src/components/tools/PaintTool.vue +0 -54
  242. package/src/components/tools/PanTool.vue +0 -35
  243. package/src/components/tools/RulerTool.vue +0 -202
  244. package/src/components/tools/SliceScrollTool.vue +0 -123
  245. package/src/components/tools/WindowLevelTool.vue +0 -191
  246. package/src/components/tools/ZoomTool.vue +0 -35
  247. package/src/components/tools/crop/Crop2D.vue +0 -367
  248. package/src/components/tools/crop/Crop2DLineHandle.vue +0 -103
  249. package/src/components/tools/crop/Crop3D.vue +0 -192
  250. package/src/components/tools/crop/CropControls.vue +0 -38
  251. package/src/components/tools/crop/types.ts +0 -12
  252. package/src/components/tools/crosshairs/CrosshairSVG2D.vue +0 -125
  253. package/src/components/tools/crosshairs/CrosshairsWidget2D.vue +0 -100
  254. package/src/components/tools/paint/PaintWidget2D.vue +0 -192
  255. package/src/components/tools/ruler/RulerSVG2D.vue +0 -181
  256. package/src/components/tools/ruler/RulerWidget2D.vue +0 -154
  257. package/src/composables/__tests__/useDoubleRecord.spec.ts +0 -57
  258. package/src/composables/__tests__/useOrientationLabels.spec.ts +0 -29
  259. package/src/composables/isViewAnimating.ts +0 -25
  260. package/src/composables/manageVTKSubscription.ts +0 -6
  261. package/src/composables/onProxyManagerEvent.ts +0 -50
  262. package/src/composables/proxyManager.ts +0 -13
  263. package/src/composables/sync/__tests__/createPrimitiveSyncContext.spec.ts +0 -41
  264. package/src/composables/sync/__tests__/useWindowingSync.spec.ts +0 -51
  265. package/src/composables/sync/createPrimitiveSyncContext.ts +0 -83
  266. package/src/composables/sync/useWindowingSync.ts +0 -48
  267. package/src/composables/useAppLoadingNotifications.ts +0 -73
  268. package/src/composables/useCameraOrientation.ts +0 -34
  269. package/src/composables/useCurrentImage.ts +0 -74
  270. package/src/composables/useCurrentSlice.ts +0 -43
  271. package/src/composables/useDoubleRecord.ts +0 -77
  272. package/src/composables/useEventListener.ts +0 -26
  273. package/src/composables/useGlobalErrorHook.ts +0 -18
  274. package/src/composables/useMultiSelection.ts +0 -29
  275. package/src/composables/useOrientationLabels.ts +0 -62
  276. package/src/composables/usePanels.ts +0 -42
  277. package/src/composables/usePersistCameraConfig.ts +0 -138
  278. package/src/composables/useResizeObserver.ts +0 -37
  279. package/src/composables/useResizeToFit.ts +0 -50
  280. package/src/composables/useSceneBuilder.ts +0 -96
  281. package/src/composables/useToast.js +0 -11
  282. package/src/composables/useVTKCallback.ts +0 -33
  283. package/src/composables/useVTKWorldToDisplay.ts +0 -141
  284. package/src/composables/useViewProxy.ts +0 -87
  285. package/src/composables/useVolumeThumbnailing.ts +0 -173
  286. package/src/composables/useWebGLWatchdog.ts +0 -32
  287. package/src/composables/useWidgetManager.ts +0 -41
  288. package/src/config.ts +0 -182
  289. package/src/constants.ts +0 -38
  290. package/src/core/id.ts +0 -18
  291. package/src/core/provider.ts +0 -31
  292. package/src/core/proxies.ts +0 -90
  293. package/src/core/thumbnailers/__tests__/vtk-image.spec.ts +0 -58
  294. package/src/core/thumbnailers/index.ts +0 -5
  295. package/src/core/thumbnailers/volume-thumbnailer.ts +0 -130
  296. package/src/core/thumbnailers/vtk-image.ts +0 -142
  297. package/src/core/tools/__tests__/paint.spec.ts +0 -101
  298. package/src/core/tools/__tests__/ruler.spec.ts +0 -73
  299. package/src/core/tools/paint/brush.ts +0 -20
  300. package/src/core/tools/paint/ellipse-brush.ts +0 -96
  301. package/src/core/tools/paint/index.ts +0 -141
  302. package/src/core/tools/ruler.ts +0 -149
  303. package/src/global.d.ts +0 -24
  304. package/src/io/__tests__/io.spec.ts +0 -26
  305. package/src/io/dicom.ts +0 -187
  306. package/src/io/index.ts +0 -11
  307. package/src/io/io.ts +0 -157
  308. package/src/io/itk/itkConfig.js +0 -8
  309. package/src/io/itk-dicom/dicom.cpp +0 -327
  310. package/src/io/itk-dicom/web-build/dicom.js +0 -16
  311. package/src/io/itk-dicom/web-build/dicom.umd.js +0 -21
  312. package/src/io/manifest.ts +0 -30
  313. package/src/io/readers.ts +0 -36
  314. package/src/io/state-file/index.ts +0 -170
  315. package/src/io/state-file/schema.ts +0 -277
  316. package/src/io/state-file/utils.ts +0 -33
  317. package/src/io/types.ts +0 -4
  318. package/src/io/vtk/async.reader.worker.ts +0 -50
  319. package/src/io/vtk/async.ts +0 -58
  320. package/src/io/vtk/async.writer.worker.ts +0 -46
  321. package/src/io/vtk/common.ts +0 -30
  322. package/src/io/zip.ts +0 -31
  323. package/src/main.js +0 -66
  324. package/src/main.ts +0 -1
  325. package/src/plugins/vuetify.js +0 -25
  326. package/src/shims-itk.d.ts +0 -67
  327. package/src/shims-misc.d.ts +0 -4
  328. package/src/shims-tsx.d.ts +0 -13
  329. package/src/shims-vtk.d.ts +0 -1042
  330. package/src/shims-vue.d.ts +0 -5
  331. package/src/store/__tests__/datasets.spec.ts +0 -75
  332. package/src/store/__tests__/messages.spec.ts +0 -74
  333. package/src/store/__tests__/rulers.spec.ts +0 -77
  334. package/src/store/__tests__/view-configs.spec.ts +0 -37
  335. package/src/store/datasets-dicom.ts +0 -398
  336. package/src/store/datasets-files.ts +0 -35
  337. package/src/store/datasets-images.ts +0 -118
  338. package/src/store/datasets-labelmaps.ts +0 -136
  339. package/src/store/datasets-models.ts +0 -25
  340. package/src/store/datasets.ts +0 -341
  341. package/src/store/messages.ts +0 -144
  342. package/src/store/tools/crop.ts +0 -136
  343. package/src/store/tools/crosshairs.ts +0 -131
  344. package/src/store/tools/index.ts +0 -95
  345. package/src/store/tools/paint.ts +0 -191
  346. package/src/store/tools/rulers.ts +0 -305
  347. package/src/store/tools/types.ts +0 -54
  348. package/src/store/view-configs/camera.ts +0 -51
  349. package/src/store/view-configs/common.ts +0 -61
  350. package/src/store/view-configs/slicing.ts +0 -86
  351. package/src/store/view-configs/types.ts +0 -39
  352. package/src/store/view-configs/volume-coloring.ts +0 -193
  353. package/src/store/view-configs/windowing.ts +0 -69
  354. package/src/store/view-configs.ts +0 -78
  355. package/src/store/views.ts +0 -130
  356. package/src/types/index.ts +0 -16
  357. package/src/types/layout.ts +0 -10
  358. package/src/types/lps.ts +0 -40
  359. package/src/types/views.ts +0 -65
  360. package/src/types/vtk-types.ts +0 -29
  361. package/src/utils/__tests__/lps.spec.ts +0 -102
  362. package/src/utils/color.ts +0 -23
  363. package/src/utils/errors.js +0 -3
  364. package/src/utils/fetch.ts +0 -101
  365. package/src/utils/hacks.ts +0 -14
  366. package/src/utils/index.ts +0 -83
  367. package/src/utils/lps.ts +0 -129
  368. package/src/utils/manipulators.ts +0 -35
  369. package/src/utils/promise-worker.ts +0 -45
  370. package/src/utils/vtk-helpers.ts +0 -215
  371. package/src/utils/workerHandler.js +0 -42
  372. package/src/vtk/ColorMaps.ts +0 -72
  373. package/src/vtk/CrosshairsWidget/behavior.ts +0 -112
  374. package/src/vtk/CrosshairsWidget/index.d.ts +0 -22
  375. package/src/vtk/CrosshairsWidget/index.js +0 -73
  376. package/src/vtk/CrosshairsWidget/state.ts +0 -51
  377. package/src/vtk/IJKSliceRepresentationProxy/index.d.ts +0 -9
  378. package/src/vtk/IJKSliceRepresentationProxy/index.js +0 -59
  379. package/src/vtk/LPSView2DProxy/index.d.ts +0 -18
  380. package/src/vtk/LPSView2DProxy/index.js +0 -89
  381. package/src/vtk/LPSView3DProxy/index.d.ts +0 -16
  382. package/src/vtk/LPSView3DProxy/index.js +0 -78
  383. package/src/vtk/LabelMap/index.d.ts +0 -16
  384. package/src/vtk/LabelMap/index.js +0 -49
  385. package/src/vtk/LabelMapSliceRepProxy/index.d.ts +0 -6
  386. package/src/vtk/LabelMapSliceRepProxy/index.js +0 -104
  387. package/src/vtk/MedicalColorPresets.json +0 -1448
  388. package/src/vtk/PaintBrushContextRepresentation/index.js +0 -191
  389. package/src/vtk/PaintWidget/behavior.ts +0 -101
  390. package/src/vtk/PaintWidget/index.d.ts +0 -28
  391. package/src/vtk/PaintWidget/index.js +0 -56
  392. package/src/vtk/PaintWidget/state.ts +0 -41
  393. package/src/vtk/PiecewiseWidget/index.js +0 -203
  394. package/src/vtk/RulerWidget/behavior.ts +0 -185
  395. package/src/vtk/RulerWidget/index.d.ts +0 -25
  396. package/src/vtk/RulerWidget/index.js +0 -79
  397. package/src/vtk/RulerWidget/state.ts +0 -63
  398. package/src/vtk/TreJsonConverter/index.js +0 -150
  399. package/src/vtk/proxy.js +0 -66
  400. package/src/vtk/proxyUtils.js +0 -16
  401. package/src/vtk/webvr-empty.js +0 -1
  402. package/tests/testUtils.js +0 -12
  403. package/tsconfig.json +0 -46
  404. package/vue.config.js +0 -86
@@ -0,0 +1 @@
1
+ {"version":3,"file":"js/422.c64a6aa7.js","mappings":"qFAAA,IAAIA,EAAmB,CACrBC,UAAW,EACXC,WAAY,EACZC,kBAAmB,EACnBC,WAAY,EACZC,YAAa,EACbC,WAAY,EACZC,YAAa,EACbC,aAAc,EACdC,aAAc,GAEZC,EAAe,CACjBC,KAAM,GAENC,KAAM,YACNC,YAAa,YACbC,cAAe,aACfC,MAAO,aACPC,eAAgB,cAChBC,IAAK,aACLC,aAAc,cACdC,MAAO,eACPC,OAAQ,gBAENC,EAAkBX,EAAaS,MAC/BG,EAAY,CACdD,gBAAiBA,EACjBrB,iBAAkBA,EAClBU,aAAcA,E,8PCtBZa,G,QAAgB,oBACE,qBActB,SAASC,EAAeC,GACtB,OAAO,WACL,OAAOF,EAAc,YAAYG,OAAOD,EAAQ,sBAClD,CACF,CA+CYE,KAAKC,MACLD,KAAKE,MACNF,KAAKG,KACNH,KAAKI,IACLJ,KAAKK,IA6CAR,EAAe,YACdA,EAAe,aAoEhBA,EAAe,YAE9B,SAASS,EAAIC,EAAGC,EAAGC,GAIjB,OAHAA,EAAI,GAAKF,EAAE,GAAKC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S,EAAEgV,EAAa9C,KACrCD,EAAoB5U,EAAE6U,GAAY8C,EAAY9C,IAG7C+C,GAASA,EAAQhD,GACpB,MAAMe,EAASja,OACd+b,EAAgB9B,EAASkC,OAAS,EACnCC,EAA2BnO,EAC5B,EACAiL,EAAoB5R,EAAEjH,EAAI,SAASwa,EAASI,GAEvCc,EAAgBlB,IAElBwB,cAAcnD,EAAoBzS,EAAIyS,EAAoBgC,EAAEL,GAG/D,EAEA,IAAIyB,EAAqBC,KAAK,uBAAyBA,KAAK,wBAA0B,GAClFH,EAA6BE,EAAmBjV,KAAKmV,KAAKF,GAC9DA,EAAmBjV,KAAO2U,C,eClC1B,IAAIS,EAAOvD,EAAoB3Z,EAC/B2Z,EAAoB3Z,EAAI,WACvB,OAAO2Z,EAAoBvS,EAAE,IAAI+V,KAAKD,EACvC,C,ICF0BvD,EAAoB3Z,G","sources":["webpack://VolView/./node_modules/@kitware/vtk.js/Common/Core/DataArray/Constants.js","webpack://VolView/./node_modules/@kitware/vtk.js/Common/Core/Math/index.js","webpack://VolView/./node_modules/gl-matrix/esm/common.js","webpack://VolView/./node_modules/gl-matrix/esm/mat4.js","webpack://VolView/./node_modules/gl-matrix/esm/vec3.js","webpack://VolView/./node_modules/fflate/esm/browser.js","webpack://VolView/./node_modules/@kitware/vtk.js/Common/Core/Base64.js","webpack://VolView/./node_modules/@kitware/vtk.js/IO/XML/XMLWriter/Constants.js","webpack://VolView/./node_modules/@kitware/vtk.js/IO/XML/XMLWriter.js","webpack://VolView/./node_modules/@kitware/vtk.js/IO/XML/XMLImageDataWriter.js","webpack://VolView/./node_modules/@kitware/vtk.js/macro.js","webpack://VolView/./src/vtk/LabelMap/index.js","webpack://VolView/./src/io/io.ts","webpack://VolView/./src/io/index.ts","webpack://VolView/./src/io/vtk/common.ts","webpack://VolView/./src/io/vtk/async.writer.worker.ts","webpack://VolView/webpack/bootstrap","webpack://VolView/webpack/runtime/amd define","webpack://VolView/webpack/runtime/amd options","webpack://VolView/webpack/runtime/chunk loaded","webpack://VolView/webpack/runtime/compat get default export","webpack://VolView/webpack/runtime/define property getters","webpack://VolView/webpack/runtime/ensure chunk","webpack://VolView/webpack/runtime/get javascript chunk filename","webpack://VolView/webpack/runtime/get mini-css chunk filename","webpack://VolView/webpack/runtime/global","webpack://VolView/webpack/runtime/hasOwnProperty shorthand","webpack://VolView/webpack/runtime/node module decorator","webpack://VolView/webpack/runtime/publicPath","webpack://VolView/webpack/runtime/importScripts chunk loading","webpack://VolView/webpack/runtime/startup chunk dependencies","webpack://VolView/webpack/startup"],"sourcesContent":["var DataTypeByteSize = {\n Int8Array: 1,\n Uint8Array: 1,\n Uint8ClampedArray: 1,\n Int16Array: 2,\n Uint16Array: 2,\n Int32Array: 4,\n Uint32Array: 4,\n Float32Array: 4,\n Float64Array: 8\n};\nvar VtkDataTypes = {\n VOID: '',\n // not sure to know what that should be\n CHAR: 'Int8Array',\n SIGNED_CHAR: 'Int8Array',\n UNSIGNED_CHAR: 'Uint8Array',\n SHORT: 'Int16Array',\n UNSIGNED_SHORT: 'Uint16Array',\n INT: 'Int32Array',\n UNSIGNED_INT: 'Uint32Array',\n FLOAT: 'Float32Array',\n DOUBLE: 'Float64Array'\n};\nvar DefaultDataType = VtkDataTypes.FLOAT;\nvar Constants = {\n DefaultDataType: DefaultDataType,\n DataTypeByteSize: DataTypeByteSize,\n VtkDataTypes: VtkDataTypes\n};\n\nexport { DataTypeByteSize, DefaultDataType, VtkDataTypes, Constants as default };\n","import _slicedToArray from '@babel/runtime/helpers/slicedToArray';\nimport _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';\nimport seedrandom from 'seedrandom';\nimport macro from '../../../macros.js';\nimport { IDENTITY, IDENTITY_3X3, VTK_SMALL_NUMBER, EPSILON } from './Constants.js';\n\nvar vtkErrorMacro = macro.vtkErrorMacro,\n vtkWarningMacro = macro.vtkWarningMacro; // ----------------------------------------------------------------------------\n\n/* eslint-disable camelcase */\n\n/* eslint-disable no-cond-assign */\n\n/* eslint-disable no-bitwise */\n\n/* eslint-disable no-multi-assign */\n// ----------------------------------------------------------------------------\n\nvar randomSeedValue = 0;\nvar VTK_MAX_ROTATIONS = 20;\n\nfunction notImplemented(method) {\n return function () {\n return vtkErrorMacro(\"vtkMath::\".concat(method, \" - NOT IMPLEMENTED\"));\n };\n} // Swap rows for n by n matrix\n\n\nfunction swapRowsMatrix_nxn(matrix, n, row1, row2) {\n var tmp;\n\n for (var i = 0; i < n; i++) {\n tmp = matrix[row1 * n + i];\n matrix[row1 * n + i] = matrix[row2 * n + i];\n matrix[row2 * n + i] = tmp;\n }\n} // Swap columns for n by n matrix\n\n\nfunction swapColumnsMatrix_nxn(matrix, n, column1, column2) {\n var tmp;\n\n for (var i = 0; i < n; i++) {\n tmp = matrix[i * n + column1];\n matrix[i * n + column1] = matrix[i * n + column2];\n matrix[i * n + column2] = tmp;\n }\n} // ----------------------------------------------------------------------------\n// Global methods\n// ----------------------------------------------------------------------------\n\n\nfunction createArray() {\n var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 3;\n // faster than Array.from and/or while loop\n var res = Array(size);\n\n for (var i = 0; i < size; ++i) {\n res[i] = 0;\n }\n\n return res;\n}\nvar Pi = function Pi() {\n return Math.PI;\n};\nfunction radiansFromDegrees(deg) {\n return deg / 180 * Math.PI;\n}\nfunction degreesFromRadians(rad) {\n return rad * 180 / Math.PI;\n}\nvar round = Math.round,\n floor = Math.floor,\n ceil = Math.ceil,\n min = Math.min,\n max = Math.max;\nfunction arrayMin(arr) {\n var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var stride = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n var minValue = Infinity;\n\n for (var i = offset, len = arr.length; i < len; i += stride) {\n if (arr[i] < minValue) {\n minValue = arr[i];\n }\n }\n\n return minValue;\n}\nfunction arrayMax(arr) {\n var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var stride = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n var maxValue = -Infinity;\n\n for (var i = offset, len = arr.length; i < len; i += stride) {\n if (maxValue < arr[i]) {\n maxValue = arr[i];\n }\n }\n\n return maxValue;\n}\nfunction arrayRange(arr) {\n var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var stride = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n var minValue = Infinity;\n var maxValue = -Infinity;\n\n for (var i = offset, len = arr.length; i < len; i += stride) {\n if (arr[i] < minValue) {\n minValue = arr[i];\n }\n\n if (maxValue < arr[i]) {\n maxValue = arr[i];\n }\n }\n\n return [minValue, maxValue];\n}\nvar ceilLog2 = notImplemented('ceilLog2');\nvar factorial = notImplemented('factorial');\nfunction nearestPowerOfTwo(xi) {\n var v = 1;\n\n while (v < xi) {\n v *= 2;\n }\n\n return v;\n}\nfunction isPowerOfTwo(x) {\n return x === nearestPowerOfTwo(x);\n}\nfunction binomial(m, n) {\n var r = 1;\n\n for (var i = 1; i <= n; ++i) {\n r *= (m - i + 1) / i;\n }\n\n return Math.floor(r);\n}\nfunction beginCombination(m, n) {\n if (m < n) {\n return 0;\n }\n\n var r = createArray(n);\n\n for (var i = 0; i < n; ++i) {\n r[i] = i;\n }\n\n return r;\n}\nfunction nextCombination(m, n, r) {\n var status = 0;\n\n for (var i = n - 1; i >= 0; --i) {\n if (r[i] < m - n + i) {\n var j = r[i] + 1;\n\n while (i < n) {\n r[i++] = j++;\n }\n\n status = 1;\n break;\n }\n }\n\n return status;\n}\nfunction randomSeed(seed) {\n seedrandom(\"\".concat(seed), {\n global: true\n });\n randomSeedValue = seed;\n}\nfunction getSeed() {\n return randomSeedValue;\n}\nfunction random() {\n var minValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var maxValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n var delta = maxValue - minValue;\n return minValue + delta * Math.random();\n}\nvar gaussian = notImplemented('gaussian'); // Vect3 operations\n\nfunction add(a, b, out) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n return out;\n}\nfunction subtract(a, b, out) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n return out;\n}\nfunction multiplyScalar(vec, scalar) {\n vec[0] *= scalar;\n vec[1] *= scalar;\n vec[2] *= scalar;\n return vec;\n}\nfunction multiplyScalar2D(vec, scalar) {\n vec[0] *= scalar;\n vec[1] *= scalar;\n return vec;\n}\nfunction multiplyAccumulate(a, b, scalar, out) {\n out[0] = a[0] + b[0] * scalar;\n out[1] = a[1] + b[1] * scalar;\n out[2] = a[2] + b[2] * scalar;\n return out;\n}\nfunction multiplyAccumulate2D(a, b, scalar, out) {\n out[0] = a[0] + b[0] * scalar;\n out[1] = a[1] + b[1] * scalar;\n return out;\n}\nfunction dot(x, y) {\n return x[0] * y[0] + x[1] * y[1] + x[2] * y[2];\n}\nfunction outer(x, y, out_3x3) {\n out_3x3[0] = x[0] * y[0];\n out_3x3[1] = x[0] * y[1];\n out_3x3[2] = x[0] * y[2];\n out_3x3[3] = x[1] * y[0];\n out_3x3[4] = x[1] * y[1];\n out_3x3[5] = x[1] * y[2];\n out_3x3[6] = x[2] * y[0];\n out_3x3[7] = x[2] * y[1];\n out_3x3[8] = x[2] * y[2];\n}\nfunction cross(x, y, out) {\n var Zx = x[1] * y[2] - x[2] * y[1];\n var Zy = x[2] * y[0] - x[0] * y[2];\n var Zz = x[0] * y[1] - x[1] * y[0];\n out[0] = Zx;\n out[1] = Zy;\n out[2] = Zz;\n return out;\n}\nfunction norm(x) {\n var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;\n\n switch (n) {\n case 1:\n return Math.abs(x);\n\n case 2:\n return Math.sqrt(x[0] * x[0] + x[1] * x[1]);\n\n case 3:\n return Math.sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]);\n\n default:\n {\n var sum = 0;\n\n for (var i = 0; i < n; i++) {\n sum += x[i] * x[i];\n }\n\n return Math.sqrt(sum);\n }\n }\n}\nfunction normalize(x) {\n var den = norm(x);\n\n if (den !== 0.0) {\n x[0] /= den;\n x[1] /= den;\n x[2] /= den;\n }\n\n return den;\n}\nfunction perpendiculars(x, y, z, theta) {\n var x2 = x[0] * x[0];\n var y2 = x[1] * x[1];\n var z2 = x[2] * x[2];\n var r = Math.sqrt(x2 + y2 + z2);\n var dx;\n var dy;\n var dz; // transpose the vector to avoid divide-by-zero error\n\n if (x2 > y2 && x2 > z2) {\n dx = 0;\n dy = 1;\n dz = 2;\n } else if (y2 > z2) {\n dx = 1;\n dy = 2;\n dz = 0;\n } else {\n dx = 2;\n dy = 0;\n dz = 1;\n }\n\n var a = x[dx] / r;\n var b = x[dy] / r;\n var c = x[dz] / r;\n var tmp = Math.sqrt(a * a + c * c);\n\n if (theta !== 0) {\n var sintheta = Math.sin(theta);\n var costheta = Math.cos(theta);\n\n if (y) {\n y[dx] = (c * costheta - a * b * sintheta) / tmp;\n y[dy] = sintheta * tmp;\n y[dz] = (-(a * costheta) - b * c * sintheta) / tmp;\n }\n\n if (z) {\n z[dx] = (-(c * sintheta) - a * b * costheta) / tmp;\n z[dy] = costheta * tmp;\n z[dz] = (a * sintheta - b * c * costheta) / tmp;\n }\n } else {\n if (y) {\n y[dx] = c / tmp;\n y[dy] = 0;\n y[dz] = -a / tmp;\n }\n\n if (z) {\n z[dx] = -a * b / tmp;\n z[dy] = tmp;\n z[dz] = -b * c / tmp;\n }\n }\n}\nfunction projectVector(a, b, projection) {\n var bSquared = dot(b, b);\n\n if (bSquared === 0) {\n projection[0] = 0;\n projection[1] = 0;\n projection[2] = 0;\n return false;\n }\n\n var scale = dot(a, b) / bSquared;\n\n for (var i = 0; i < 3; i++) {\n projection[i] = b[i];\n }\n\n multiplyScalar(projection, scale);\n return true;\n}\nfunction dot2D(x, y) {\n return x[0] * y[0] + x[1] * y[1];\n}\nfunction projectVector2D(a, b, projection) {\n var bSquared = dot2D(b, b);\n\n if (bSquared === 0) {\n projection[0] = 0;\n projection[1] = 0;\n return false;\n }\n\n var scale = dot2D(a, b) / bSquared;\n\n for (var i = 0; i < 2; i++) {\n projection[i] = b[i];\n }\n\n multiplyScalar2D(projection, scale);\n return true;\n}\nfunction distance2BetweenPoints(x, y) {\n return (x[0] - y[0]) * (x[0] - y[0]) + (x[1] - y[1]) * (x[1] - y[1]) + (x[2] - y[2]) * (x[2] - y[2]);\n}\nfunction angleBetweenVectors(v1, v2) {\n var crossVect = [0, 0, 0];\n cross(v1, v2, crossVect);\n return Math.atan2(norm(crossVect), dot(v1, v2));\n}\nfunction signedAngleBetweenVectors(v1, v2, vN) {\n var crossVect = [0, 0, 0];\n cross(v1, v2, crossVect);\n var angle = Math.atan2(norm(crossVect), dot(v1, v2));\n return dot(crossVect, vN) >= 0 ? angle : -angle;\n}\nfunction gaussianAmplitude(mean, variance, position) {\n var distanceFromMean = Math.abs(mean - position);\n return 1 / Math.sqrt(2 * Math.PI * variance) * Math.exp(-Math.pow(distanceFromMean, 2) / (2 * variance));\n}\nfunction gaussianWeight(mean, variance, position) {\n var distanceFromMean = Math.abs(mean - position);\n return Math.exp(-Math.pow(distanceFromMean, 2) / (2 * variance));\n}\nfunction outer2D(x, y, out_2x2) {\n out_2x2[0] = x[0] * y[0];\n out_2x2[1] = x[0] * y[1];\n out_2x2[2] = x[1] * y[0];\n out_2x2[3] = x[1] * y[1];\n}\nfunction norm2D(x2D) {\n return Math.sqrt(x2D[0] * x2D[0] + x2D[1] * x2D[1]);\n}\nfunction normalize2D(x) {\n var den = norm2D(x);\n\n if (den !== 0.0) {\n x[0] /= den;\n x[1] /= den;\n }\n\n return den;\n}\nfunction rowsToMat4(row0, row1, row2, row3, mat) {\n for (var i = 0; i < 4; i++) {\n mat[i] = row0[i];\n mat[4 + i] = row1[i];\n mat[8 + i] = row2[i];\n mat[12 + i] = row3[i];\n }\n\n return mat;\n}\nfunction columnsToMat4(column0, column1, column2, column3, mat) {\n for (var i = 0; i < 4; i++) {\n mat[4 * i] = column0[i];\n mat[4 * i + 1] = column1[i];\n mat[4 * i + 2] = column2[i];\n mat[4 * i + 3] = column3[i];\n }\n\n return mat;\n}\nfunction rowsToMat3(row0, row1, row2, mat) {\n for (var i = 0; i < 3; i++) {\n mat[i] = row0[i];\n mat[3 + i] = row1[i];\n mat[6 + i] = row2[i];\n }\n\n return mat;\n}\nfunction columnsToMat3(column0, column1, column2, mat) {\n for (var i = 0; i < 3; i++) {\n mat[3 * i] = column0[i];\n mat[3 * i + 1] = column1[i];\n mat[3 * i + 2] = column2[i];\n }\n\n return mat;\n}\nfunction determinant2x2() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n if (args.length === 2) {\n return args[0][0] * args[1][1] - args[1][0] * args[0][1];\n }\n\n if (args.length === 4) {\n return args[0] * args[3] - args[1] * args[2];\n }\n\n return Number.NaN;\n}\nfunction LUFactor3x3(mat_3x3, index_3) {\n var maxI;\n var tmp;\n var largest;\n var scale = [0, 0, 0]; // Loop over rows to get implicit scaling information\n\n for (var i = 0; i < 3; i++) {\n largest = Math.abs(mat_3x3[i * 3]);\n\n if ((tmp = Math.abs(mat_3x3[i * 3 + 1])) > largest) {\n largest = tmp;\n }\n\n if ((tmp = Math.abs(mat_3x3[i * 3 + 2])) > largest) {\n largest = tmp;\n }\n\n scale[i] = 1 / largest;\n } // Loop over all columns using Crout's method\n // first column\n\n\n largest = scale[0] * Math.abs(mat_3x3[0]);\n maxI = 0;\n\n if ((tmp = scale[1] * Math.abs(mat_3x3[3])) >= largest) {\n largest = tmp;\n maxI = 1;\n }\n\n if ((tmp = scale[2] * Math.abs(mat_3x3[6])) >= largest) {\n maxI = 2;\n }\n\n if (maxI !== 0) {\n swapRowsMatrix_nxn(mat_3x3, 3, maxI, 0);\n scale[maxI] = scale[0];\n }\n\n index_3[0] = maxI;\n mat_3x3[3] /= mat_3x3[0];\n mat_3x3[6] /= mat_3x3[0]; // second column\n\n mat_3x3[4] -= mat_3x3[3] * mat_3x3[1];\n mat_3x3[7] -= mat_3x3[6] * mat_3x3[1];\n largest = scale[1] * Math.abs(mat_3x3[4]);\n maxI = 1;\n\n if ((tmp = scale[2] * Math.abs(mat_3x3[7])) >= largest) {\n maxI = 2;\n swapRowsMatrix_nxn(mat_3x3, 3, 1, 2);\n scale[2] = scale[1];\n }\n\n index_3[1] = maxI;\n mat_3x3[7] /= mat_3x3[4]; // third column\n\n mat_3x3[5] -= mat_3x3[3] * mat_3x3[2];\n mat_3x3[8] -= mat_3x3[6] * mat_3x3[2] + mat_3x3[7] * mat_3x3[5];\n index_3[2] = 2;\n}\nfunction LUSolve3x3(mat_3x3, index_3, x_3) {\n // forward substitution\n var sum = x_3[index_3[0]];\n x_3[index_3[0]] = x_3[0];\n x_3[0] = sum;\n sum = x_3[index_3[1]];\n x_3[index_3[1]] = x_3[1];\n x_3[1] = sum - mat_3x3[3] * x_3[0];\n sum = x_3[index_3[2]];\n x_3[index_3[2]] = x_3[2];\n x_3[2] = sum - mat_3x3[6] * x_3[0] - mat_3x3[7] * x_3[1]; // back substitution\n\n x_3[2] /= mat_3x3[8];\n x_3[1] = (x_3[1] - mat_3x3[5] * x_3[2]) / mat_3x3[4];\n x_3[0] = (x_3[0] - mat_3x3[1] * x_3[1] - mat_3x3[2] * x_3[2]) / mat_3x3[0];\n}\nfunction linearSolve3x3(mat_3x3, x_3, y_3) {\n var a1 = mat_3x3[0];\n var b1 = mat_3x3[1];\n var c1 = mat_3x3[2];\n var a2 = mat_3x3[3];\n var b2 = mat_3x3[4];\n var c2 = mat_3x3[5];\n var a3 = mat_3x3[6];\n var b3 = mat_3x3[7];\n var c3 = mat_3x3[8]; // Compute the adjoint\n\n var d1 = +determinant2x2(b2, b3, c2, c3);\n var d2 = -determinant2x2(a2, a3, c2, c3);\n var d3 = +determinant2x2(a2, a3, b2, b3);\n var e1 = -determinant2x2(b1, b3, c1, c3);\n var e2 = +determinant2x2(a1, a3, c1, c3);\n var e3 = -determinant2x2(a1, a3, b1, b3);\n var f1 = +determinant2x2(b1, b2, c1, c2);\n var f2 = -determinant2x2(a1, a2, c1, c2);\n var f3 = +determinant2x2(a1, a2, b1, b2); // Compute the determinant\n\n var det = a1 * d1 + b1 * d2 + c1 * d3; // Multiply by the adjoint\n\n var v1 = d1 * x_3[0] + e1 * x_3[1] + f1 * x_3[2];\n var v2 = d2 * x_3[0] + e2 * x_3[1] + f2 * x_3[2];\n var v3 = d3 * x_3[0] + e3 * x_3[1] + f3 * x_3[2]; // Divide by the determinant\n\n y_3[0] = v1 / det;\n y_3[1] = v2 / det;\n y_3[2] = v3 / det;\n}\nfunction multiply3x3_vect3(mat_3x3, in_3, out_3) {\n var x = mat_3x3[0] * in_3[0] + mat_3x3[1] * in_3[1] + mat_3x3[2] * in_3[2];\n var y = mat_3x3[3] * in_3[0] + mat_3x3[4] * in_3[1] + mat_3x3[5] * in_3[2];\n var z = mat_3x3[6] * in_3[0] + mat_3x3[7] * in_3[1] + mat_3x3[8] * in_3[2];\n out_3[0] = x;\n out_3[1] = y;\n out_3[2] = z;\n}\nfunction multiply3x3_mat3(a_3x3, b_3x3, out_3x3) {\n var copyA = _toConsumableArray(a_3x3);\n\n var copyB = _toConsumableArray(b_3x3);\n\n for (var i = 0; i < 3; i++) {\n out_3x3[i] = copyA[0] * copyB[i] + copyA[1] * copyB[i + 3] + copyA[2] * copyB[i + 6];\n out_3x3[i + 3] = copyA[3] * copyB[i] + copyA[4] * copyB[i + 3] + copyA[5] * copyB[i + 6];\n out_3x3[i + 6] = copyA[6] * copyB[i] + copyA[7] * copyB[i + 3] + copyA[8] * copyB[i + 6];\n }\n}\nfunction multiplyMatrix(a, b, rowA, colA, rowB, colB, out_rowXcol) {\n // we need colA == rowB\n if (colA !== rowB) {\n vtkErrorMacro('Number of columns of A must match number of rows of B.');\n } // If a or b is used to store the result, copying them is required\n\n\n var copyA = _toConsumableArray(a);\n\n var copyB = _toConsumableArray(b); // output matrix is rowA*colB\n // output row\n\n\n for (var i = 0; i < rowA; i++) {\n // output col\n for (var j = 0; j < colB; j++) {\n out_rowXcol[i * colB + j] = 0; // sum for this point\n\n for (var k = 0; k < colA; k++) {\n out_rowXcol[i * colB + j] += copyA[i * colA + k] * copyB[j + colB * k];\n }\n }\n }\n}\nfunction transpose3x3(in_3x3, outT_3x3) {\n var tmp; // off-diagonal elements\n\n tmp = in_3x3[3];\n outT_3x3[3] = in_3x3[1];\n outT_3x3[1] = tmp;\n tmp = in_3x3[6];\n outT_3x3[6] = in_3x3[2];\n outT_3x3[2] = tmp;\n tmp = in_3x3[7];\n outT_3x3[7] = in_3x3[5];\n outT_3x3[5] = tmp; // on-diagonal elements\n\n outT_3x3[0] = in_3x3[0];\n outT_3x3[4] = in_3x3[4];\n outT_3x3[8] = in_3x3[8];\n}\nfunction invert3x3(in_3x3, outI_3x3) {\n var a1 = in_3x3[0];\n var b1 = in_3x3[1];\n var c1 = in_3x3[2];\n var a2 = in_3x3[3];\n var b2 = in_3x3[4];\n var c2 = in_3x3[5];\n var a3 = in_3x3[6];\n var b3 = in_3x3[7];\n var c3 = in_3x3[8]; // Compute the adjoint\n\n var d1 = +determinant2x2(b2, b3, c2, c3);\n var d2 = -determinant2x2(a2, a3, c2, c3);\n var d3 = +determinant2x2(a2, a3, b2, b3);\n var e1 = -determinant2x2(b1, b3, c1, c3);\n var e2 = +determinant2x2(a1, a3, c1, c3);\n var e3 = -determinant2x2(a1, a3, b1, b3);\n var f1 = +determinant2x2(b1, b2, c1, c2);\n var f2 = -determinant2x2(a1, a2, c1, c2);\n var f3 = +determinant2x2(a1, a2, b1, b2); // Divide by the determinant\n\n var det = a1 * d1 + b1 * d2 + c1 * d3;\n\n if (det === 0) {\n vtkWarningMacro('Matrix has 0 determinant');\n }\n\n outI_3x3[0] = d1 / det;\n outI_3x3[3] = d2 / det;\n outI_3x3[6] = d3 / det;\n outI_3x3[1] = e1 / det;\n outI_3x3[4] = e2 / det;\n outI_3x3[7] = e3 / det;\n outI_3x3[2] = f1 / det;\n outI_3x3[5] = f2 / det;\n outI_3x3[8] = f3 / det;\n}\nfunction determinant3x3(mat_3x3) {\n return mat_3x3[0] * mat_3x3[4] * mat_3x3[8] + mat_3x3[3] * mat_3x3[7] * mat_3x3[2] + mat_3x3[6] * mat_3x3[1] * mat_3x3[5] - mat_3x3[0] * mat_3x3[7] * mat_3x3[5] - mat_3x3[3] * mat_3x3[1] * mat_3x3[8] - mat_3x3[6] * mat_3x3[4] * mat_3x3[2];\n}\n/**\n * Returns true if elements of both arrays are equals.\n * @param {Array} a an array of numbers (vector, point, matrix...)\n * @param {Array} b an array of numbers (vector, point, matrix...)\n * @param {Number} eps tolerance\n */\n\nfunction areEquals(a, b) {\n var eps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : EPSILON;\n\n if (a.length !== b.length) {\n return false;\n }\n\n function isEqual(element, index) {\n return Math.abs(element - b[index]) <= eps;\n }\n\n return a.every(isEqual);\n}\nvar areMatricesEqual = areEquals;\nfunction identity3x3(mat_3x3) {\n for (var i = 0; i < 3; i++) {\n /* eslint-disable-next-line no-multi-assign */\n mat_3x3[i * 3] = mat_3x3[i * 3 + 1] = mat_3x3[i * 3 + 2] = 0;\n mat_3x3[i * 3 + i] = 1;\n }\n}\nfunction identity(n, mat) {\n for (var i = 0; i < n; i++) {\n for (var j = 0; j < n; j++) {\n mat[i * n + j] = 0;\n }\n\n mat[i * n + i] = 1;\n }\n\n return mat;\n}\nfunction isIdentity(mat) {\n var eps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : EPSILON;\n return areMatricesEqual(mat, IDENTITY, eps);\n}\nfunction isIdentity3x3(mat) {\n var eps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : EPSILON;\n return areMatricesEqual(mat, IDENTITY_3X3, eps);\n}\nfunction quaternionToMatrix3x3(quat_4, mat_3x3) {\n var ww = quat_4[0] * quat_4[0];\n var wx = quat_4[0] * quat_4[1];\n var wy = quat_4[0] * quat_4[2];\n var wz = quat_4[0] * quat_4[3];\n var xx = quat_4[1] * quat_4[1];\n var yy = quat_4[2] * quat_4[2];\n var zz = quat_4[3] * quat_4[3];\n var xy = quat_4[1] * quat_4[2];\n var xz = quat_4[1] * quat_4[3];\n var yz = quat_4[2] * quat_4[3];\n var rr = xx + yy + zz; // normalization factor, just in case quaternion was not normalized\n\n var f = 1 / (ww + rr);\n var s = (ww - rr) * f;\n f *= 2;\n mat_3x3[0] = xx * f + s;\n mat_3x3[3] = (xy + wz) * f;\n mat_3x3[6] = (xz - wy) * f;\n mat_3x3[1] = (xy - wz) * f;\n mat_3x3[4] = yy * f + s;\n mat_3x3[7] = (yz + wx) * f;\n mat_3x3[2] = (xz + wy) * f;\n mat_3x3[5] = (yz - wx) * f;\n mat_3x3[8] = zz * f + s;\n}\nfunction roundNumber(num) {\n var digits = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n\n if (!\"\".concat(num).includes('e')) {\n return +\"\".concat(Math.round(\"\".concat(num, \"e+\").concat(digits)), \"e-\").concat(digits);\n }\n\n var arr = \"\".concat(num).split('e');\n var sig = '';\n\n if (+arr[1] + digits > 0) {\n sig = '+';\n }\n\n return +\"\".concat(Math.round(\"\".concat(+arr[0], \"e\").concat(sig).concat(+arr[1] + digits)), \"e-\").concat(digits);\n}\nfunction roundVector(vector) {\n var out = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0];\n var digits = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n out[0] = roundNumber(vector[0], digits);\n out[1] = roundNumber(vector[1], digits);\n out[2] = roundNumber(vector[2], digits);\n return out;\n}\nfunction jacobiN(a, n, w, v) {\n var i;\n var j;\n var k;\n var iq;\n var ip;\n var numPos;\n var tresh;\n var theta;\n var t;\n var tau;\n var sm;\n var s;\n var h;\n var g;\n var c;\n var tmp;\n var b = createArray(n);\n var z = createArray(n);\n\n var vtkROTATE = function vtkROTATE(aa, ii, jj) {\n g = aa[ii];\n h = aa[jj];\n aa[ii] = g - s * (h + g * tau);\n aa[jj] = h + s * (g - h * tau);\n }; // initialize\n\n\n identity(n, v);\n\n for (ip = 0; ip < n; ip++) {\n b[ip] = w[ip] = a[ip + ip * n];\n z[ip] = 0.0;\n } // begin rotation sequence\n\n\n for (i = 0; i < VTK_MAX_ROTATIONS; i++) {\n sm = 0.0;\n\n for (ip = 0; ip < n - 1; ip++) {\n for (iq = ip + 1; iq < n; iq++) {\n sm += Math.abs(a[ip * n + iq]);\n }\n }\n\n if (sm === 0.0) {\n break;\n } // first 3 sweeps\n\n\n if (i < 3) {\n tresh = 0.2 * sm / (n * n);\n } else {\n tresh = 0.0;\n }\n\n for (ip = 0; ip < n - 1; ip++) {\n for (iq = ip + 1; iq < n; iq++) {\n g = 100.0 * Math.abs(a[ip * n + iq]); // after 4 sweeps\n\n if (i > 3 && Math.abs(w[ip]) + g === Math.abs(w[ip]) && Math.abs(w[iq]) + g === Math.abs(w[iq])) {\n a[ip * n + iq] = 0.0;\n } else if (Math.abs(a[ip * n + iq]) > tresh) {\n h = w[iq] - w[ip];\n\n if (Math.abs(h) + g === Math.abs(h)) {\n t = a[ip * n + iq] / h;\n } else {\n theta = 0.5 * h / a[ip * n + iq];\n t = 1.0 / (Math.abs(theta) + Math.sqrt(1.0 + theta * theta));\n\n if (theta < 0.0) {\n t = -t;\n }\n }\n\n c = 1.0 / Math.sqrt(1 + t * t);\n s = t * c;\n tau = s / (1.0 + c);\n h = t * a[ip * n + iq];\n z[ip] -= h;\n z[iq] += h;\n w[ip] -= h;\n w[iq] += h;\n a[ip * n + iq] = 0.0; // ip already shifted left by 1 unit\n\n for (j = 0; j <= ip - 1; j++) {\n vtkROTATE(a, j * n + ip, j * n + iq);\n } // ip and iq already shifted left by 1 unit\n\n\n for (j = ip + 1; j <= iq - 1; j++) {\n vtkROTATE(a, ip * n + j, j * n + iq);\n } // iq already shifted left by 1 unit\n\n\n for (j = iq + 1; j < n; j++) {\n vtkROTATE(a, ip * n + j, iq * n + j);\n }\n\n for (j = 0; j < n; j++) {\n vtkROTATE(v, j * n + ip, j * n + iq);\n }\n }\n }\n }\n\n for (ip = 0; ip < n; ip++) {\n b[ip] += z[ip];\n w[ip] = b[ip];\n z[ip] = 0.0;\n }\n } // this is NEVER called\n\n\n if (i >= VTK_MAX_ROTATIONS) {\n vtkWarningMacro('vtkMath::Jacobi: Error extracting eigenfunctions');\n return 0;\n } // sort eigenfunctions: these changes do not affect accuracy\n\n\n for (j = 0; j < n - 1; j++) {\n // boundary incorrect\n k = j;\n tmp = w[k];\n\n for (i = j + 1; i < n; i++) {\n // boundary incorrect, shifted already\n if (w[i] >= tmp || Math.abs(w[i] - tmp) < VTK_SMALL_NUMBER) {\n // why exchange if same?\n k = i;\n tmp = w[k];\n }\n }\n\n if (k !== j) {\n w[k] = w[j];\n w[j] = tmp;\n swapColumnsMatrix_nxn(v, n, j, k);\n }\n } // ensure eigenvector consistency (i.e., Jacobi can compute vectors that\n // are negative of one another (.707,.707,0) and (-.707,-.707,0). This can\n // reek havoc in hyperstreamline/other stuff. We will select the most\n // positive eigenvector.\n\n\n var ceil_half_n = (n >> 1) + (n & 1);\n\n for (numPos = 0, i = 0; i < n * n; i++) {\n if (v[i] >= 0.0) {\n numPos++;\n }\n } // if ( numPos < ceil(double(n)/double(2.0)) )\n\n\n if (numPos < ceil_half_n) {\n for (i = 0; i < n; i++) {\n v[i * n + j] *= -1.0;\n }\n }\n\n return 1;\n}\nfunction matrix3x3ToQuaternion(mat_3x3, quat_4) {\n var tmp = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; // on-diagonal elements\n\n tmp[0] = mat_3x3[0] + mat_3x3[4] + mat_3x3[8];\n tmp[5] = mat_3x3[0] - mat_3x3[4] - mat_3x3[8];\n tmp[10] = -mat_3x3[0] + mat_3x3[4] - mat_3x3[8];\n tmp[15] = -mat_3x3[0] - mat_3x3[4] + mat_3x3[8]; // off-diagonal elements\n\n tmp[1] = tmp[4] = mat_3x3[7] - mat_3x3[5];\n tmp[2] = tmp[8] = mat_3x3[2] - mat_3x3[6];\n tmp[3] = tmp[12] = mat_3x3[3] - mat_3x3[1];\n tmp[6] = tmp[9] = mat_3x3[3] + mat_3x3[1];\n tmp[7] = tmp[13] = mat_3x3[2] + mat_3x3[6];\n tmp[11] = tmp[14] = mat_3x3[7] + mat_3x3[5];\n var eigenvectors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n var eigenvalues = [0, 0, 0, 0]; // convert into format that JacobiN can use,\n // then use Jacobi to find eigenvalues and eigenvectors\n // tmp is copied because jacobiN may modify it\n\n var NTemp = [].concat(tmp);\n jacobiN(NTemp, 4, eigenvalues, eigenvectors); // the first eigenvector is the one we want\n\n quat_4[0] = eigenvectors[0];\n quat_4[1] = eigenvectors[4];\n quat_4[2] = eigenvectors[8];\n quat_4[3] = eigenvectors[12];\n}\nfunction multiplyQuaternion(quat_1, quat_2, quat_out) {\n var ww = quat_1[0] * quat_2[0];\n var wx = quat_1[0] * quat_2[1];\n var wy = quat_1[0] * quat_2[2];\n var wz = quat_1[0] * quat_2[3];\n var xw = quat_1[1] * quat_2[0];\n var xx = quat_1[1] * quat_2[1];\n var xy = quat_1[1] * quat_2[2];\n var xz = quat_1[1] * quat_2[3];\n var yw = quat_1[2] * quat_2[0];\n var yx = quat_1[2] * quat_2[1];\n var yy = quat_1[2] * quat_2[2];\n var yz = quat_1[2] * quat_2[3];\n var zw = quat_1[3] * quat_2[0];\n var zx = quat_1[3] * quat_2[1];\n var zy = quat_1[3] * quat_2[2];\n var zz = quat_1[3] * quat_2[3];\n quat_out[0] = ww - xx - yy - zz;\n quat_out[1] = wx + xw + yz - zy;\n quat_out[2] = wy - xz + yw + zx;\n quat_out[3] = wz + xy - yx + zw;\n}\nfunction orthogonalize3x3(a_3x3, out_3x3) {\n // copy the matrix\n for (var i = 0; i < 9; i++) {\n out_3x3[i] = a_3x3[i];\n } // Pivot the matrix to improve accuracy\n\n\n var scale = createArray(3);\n var index = createArray(3);\n var largest; // Loop over rows to get implicit scaling information\n\n for (var _i = 0; _i < 3; _i++) {\n var _x = Math.abs(out_3x3[_i * 3]);\n\n var _x2 = Math.abs(out_3x3[_i * 3 + 1]);\n\n var _x3 = Math.abs(out_3x3[_i * 3 + 2]);\n\n largest = _x2 > _x ? _x2 : _x;\n largest = _x3 > largest ? _x3 : largest;\n scale[_i] = 1;\n\n if (largest !== 0) {\n scale[_i] /= largest;\n }\n } // first column\n\n\n var x1 = Math.abs(out_3x3[0]) * scale[0];\n var x2 = Math.abs(out_3x3[3]) * scale[1];\n var x3 = Math.abs(out_3x3[6]) * scale[2];\n index[0] = 0;\n largest = x1;\n\n if (x2 >= largest) {\n largest = x2;\n index[0] = 1;\n }\n\n if (x3 >= largest) {\n index[0] = 2;\n }\n\n if (index[0] !== 0) {\n // swap vectors\n swapColumnsMatrix_nxn(out_3x3, 3, index[0], 0);\n scale[index[0]] = scale[0];\n } // second column\n\n\n var y2 = Math.abs(out_3x3[4]) * scale[1];\n var y3 = Math.abs(out_3x3[7]) * scale[2];\n index[1] = 1;\n largest = y2;\n\n if (y3 >= largest) {\n index[1] = 2; // swap vectors\n\n swapColumnsMatrix_nxn(out_3x3, 3, 1, 2);\n } // third column\n\n\n index[2] = 2; // A quaternion can only describe a pure rotation, not\n // a rotation with a flip, therefore the flip must be\n // removed before the matrix is converted to a quaternion.\n\n var flip = 0;\n\n if (determinant3x3(out_3x3) < 0) {\n flip = 1;\n\n for (var _i2 = 0; _i2 < 9; _i2++) {\n out_3x3[_i2] = -out_3x3[_i2];\n }\n } // Do orthogonalization using a quaternion intermediate\n // (this, essentially, does the orthogonalization via\n // diagonalization of an appropriately constructed symmetric\n // 4x4 matrix rather than by doing SVD of the 3x3 matrix)\n\n\n var quat = createArray(4);\n matrix3x3ToQuaternion(out_3x3, quat);\n quaternionToMatrix3x3(quat, out_3x3); // Put the flip back into the orthogonalized matrix.\n\n if (flip) {\n for (var _i3 = 0; _i3 < 9; _i3++) {\n out_3x3[_i3] = -out_3x3[_i3];\n }\n } // Undo the pivoting\n\n\n if (index[1] !== 1) {\n swapColumnsMatrix_nxn(out_3x3, 3, index[1], 1);\n }\n\n if (index[0] !== 0) {\n swapColumnsMatrix_nxn(out_3x3, 3, index[0], 0);\n }\n}\nfunction diagonalize3x3(a_3x3, w_3, v_3x3) {\n var i;\n var j;\n var k;\n var maxI;\n var tmp;\n var maxVal; // a is copied because jacobiN may modify it\n\n var copyA = _toConsumableArray(a_3x3); // diagonalize using Jacobi\n\n\n jacobiN(copyA, 3, w_3, v_3x3); // if all the eigenvalues are the same, return identity matrix\n\n if (w_3[0] === w_3[1] && w_3[0] === w_3[2]) {\n identity3x3(v_3x3);\n return;\n } // transpose temporarily, it makes it easier to sort the eigenvectors\n\n\n transpose3x3(v_3x3, v_3x3); // if two eigenvalues are the same, re-orthogonalize to optimally line\n // up the eigenvectors with the x, y, and z axes\n\n for (i = 0; i < 3; i++) {\n // two eigenvalues are the same\n if (w_3[(i + 1) % 3] === w_3[(i + 2) % 3]) {\n // find maximum element of the independent eigenvector\n maxVal = Math.abs(v_3x3[i * 3]);\n maxI = 0;\n\n for (j = 1; j < 3; j++) {\n if (maxVal < (tmp = Math.abs(v_3x3[i * 3 + j]))) {\n maxVal = tmp;\n maxI = j;\n }\n } // swap the eigenvector into its proper position\n\n\n if (maxI !== i) {\n tmp = w_3[maxI];\n w_3[maxI] = w_3[i];\n w_3[i] = tmp;\n swapRowsMatrix_nxn(v_3x3, 3, i, maxI);\n } // maximum element of eigenvector should be positive\n\n\n if (v_3x3[maxI * 3 + maxI] < 0) {\n v_3x3[maxI * 3] = -v_3x3[maxI * 3];\n v_3x3[maxI * 3 + 1] = -v_3x3[maxI * 3 + 1];\n v_3x3[maxI * 3 + 2] = -v_3x3[maxI * 3 + 2];\n } // re-orthogonalize the other two eigenvectors\n\n\n j = (maxI + 1) % 3;\n k = (maxI + 2) % 3;\n v_3x3[j * 3] = 0.0;\n v_3x3[j * 3 + 1] = 0.0;\n v_3x3[j * 3 + 2] = 0.0;\n v_3x3[j * 3 + j] = 1.0;\n var vectTmp1 = cross([v_3x3[maxI * 3], v_3x3[maxI * 3 + 1], v_3x3[maxI * 3 + 2]], [v_3x3[j * 3], v_3x3[j * 3 + 1], v_3x3[j * 3 + 2]], []);\n normalize(vectTmp1);\n var vectTmp2 = cross(vectTmp1, [v_3x3[maxI * 3], v_3x3[maxI * 3 + 1], v_3x3[maxI * 3 + 2]], []);\n\n for (var t = 0; t < 3; t++) {\n v_3x3[k * 3 + t] = vectTmp1[t];\n v_3x3[j * 3 + t] = vectTmp2[t];\n } // transpose vectors back to columns\n\n\n transpose3x3(v_3x3, v_3x3);\n return;\n }\n } // the three eigenvalues are different, just sort the eigenvectors\n // to align them with the x, y, and z axes\n // find the vector with the largest x element, make that vector\n // the first vector\n\n\n maxVal = Math.abs(v_3x3[0]);\n maxI = 0;\n\n for (i = 1; i < 3; i++) {\n if (maxVal < (tmp = Math.abs(v_3x3[i * 3]))) {\n maxVal = tmp;\n maxI = i;\n }\n } // swap eigenvalue and eigenvector\n\n\n if (maxI !== 0) {\n var eigenValTmp = w_3[maxI];\n w_3[maxI] = w_3[0];\n w_3[0] = eigenValTmp;\n swapRowsMatrix_nxn(v_3x3, 3, maxI, 0);\n } // do the same for the y element\n\n\n if (Math.abs(v_3x3[4]) < Math.abs(v_3x3[7])) {\n var _eigenValTmp = w_3[2];\n w_3[2] = w_3[1];\n w_3[1] = _eigenValTmp;\n swapRowsMatrix_nxn(v_3x3, 3, 1, 2);\n } // ensure that the sign of the eigenvectors is correct\n\n\n for (i = 0; i < 2; i++) {\n if (v_3x3[i * 3 + i] < 0) {\n v_3x3[i * 3] = -v_3x3[i * 3];\n v_3x3[i * 3 + 1] = -v_3x3[i * 3 + 1];\n v_3x3[i * 3 + 2] = -v_3x3[i * 3 + 2];\n }\n } // set sign of final eigenvector to ensure that determinant is positive\n\n\n if (determinant3x3(v_3x3) < 0) {\n v_3x3[6] = -v_3x3[6];\n v_3x3[7] = -v_3x3[7];\n v_3x3[8] = -v_3x3[8];\n } // transpose the eigenvectors back again\n\n\n transpose3x3(v_3x3, v_3x3);\n}\nfunction singularValueDecomposition3x3(a_3x3, u_3x3, w_3, vT_3x3) {\n var i; // copy so that A can be used for U or VT without risk\n\n var B = _toConsumableArray(a_3x3); // temporarily flip if determinant is negative\n\n\n var d = determinant3x3(B);\n\n if (d < 0) {\n for (i = 0; i < 9; i++) {\n B[i] = -B[i];\n }\n } // orthogonalize, diagonalize, etc.\n\n\n orthogonalize3x3(B, u_3x3);\n transpose3x3(B, B);\n multiply3x3_mat3(B, u_3x3, vT_3x3);\n diagonalize3x3(vT_3x3, w_3, vT_3x3);\n multiply3x3_mat3(u_3x3, vT_3x3, u_3x3);\n transpose3x3(vT_3x3, vT_3x3); // re-create the flip\n\n if (d < 0) {\n w_3[0] = -w_3[0];\n w_3[1] = -w_3[1];\n w_3[2] = -w_3[2];\n }\n}\n/**\n * Factor linear equations Ax = b using LU decomposition A = LU. Output factorization LU is in matrix A.\n * @param {Matrix} A square matrix\n * @param {Number} index integer array of pivot indices index[0->n-1]\n * @param {Number} size matrix size\n */\n\nfunction luFactorLinearSystem(A, index, size) {\n var i;\n var j;\n var k;\n var largest;\n var maxI = 0;\n var sum;\n var temp1;\n var temp2;\n var scale = createArray(size); //\n // Loop over rows to get implicit scaling information\n //\n\n for (i = 0; i < size; i++) {\n for (largest = 0.0, j = 0; j < size; j++) {\n if ((temp2 = Math.abs(A[i * size + j])) > largest) {\n largest = temp2;\n }\n }\n\n if (largest === 0.0) {\n vtkWarningMacro('Unable to factor linear system');\n return 0;\n }\n\n scale[i] = 1.0 / largest;\n } //\n // Loop over all columns using Crout's method\n //\n\n\n for (j = 0; j < size; j++) {\n for (i = 0; i < j; i++) {\n sum = A[i * size + j];\n\n for (k = 0; k < i; k++) {\n sum -= A[i * size + k] * A[k * size + j];\n }\n\n A[i * size + j] = sum;\n } //\n // Begin search for largest pivot element\n //\n\n\n for (largest = 0.0, i = j; i < size; i++) {\n sum = A[i * size + j];\n\n for (k = 0; k < j; k++) {\n sum -= A[i * size + k] * A[k * size + j];\n }\n\n A[i * size + j] = sum;\n\n if ((temp1 = scale[i] * Math.abs(sum)) >= largest) {\n largest = temp1;\n maxI = i;\n }\n } //\n // Check for row interchange\n //\n\n\n if (j !== maxI) {\n for (k = 0; k < size; k++) {\n temp1 = A[maxI * size + k];\n A[maxI * size + k] = A[j * size + k];\n A[j * size + k] = temp1;\n }\n\n scale[maxI] = scale[j];\n } //\n // Divide by pivot element and perform elimination\n //\n\n\n index[j] = maxI;\n\n if (Math.abs(A[j * size + j]) <= VTK_SMALL_NUMBER) {\n vtkWarningMacro('Unable to factor linear system');\n return 0;\n }\n\n if (j !== size - 1) {\n temp1 = 1.0 / A[j * size + j];\n\n for (i = j + 1; i < size; i++) {\n A[i * size + j] *= temp1;\n }\n }\n }\n\n return 1;\n}\nfunction luSolveLinearSystem(A, index, x, size) {\n var i;\n var j;\n var ii;\n var idx;\n var sum; //\n // Proceed with forward and backsubstitution for L and U\n // matrices. First, forward substitution.\n //\n\n for (ii = -1, i = 0; i < size; i++) {\n idx = index[i];\n sum = x[idx];\n x[idx] = x[i];\n\n if (ii >= 0) {\n for (j = ii; j <= i - 1; j++) {\n sum -= A[i * size + j] * x[j];\n }\n } else if (sum !== 0.0) {\n ii = i;\n }\n\n x[i] = sum;\n } //\n // Now, back substitution\n //\n\n\n for (i = size - 1; i >= 0; i--) {\n sum = x[i];\n\n for (j = i + 1; j < size; j++) {\n sum -= A[i * size + j] * x[j];\n }\n\n x[i] = sum / A[i * size + i];\n }\n}\nfunction solveLinearSystem(A, x, size) {\n // if we solving something simple, just solve it\n if (size === 2) {\n var y = createArray(2);\n var det = determinant2x2(A[0], A[1], A[2], A[3]);\n\n if (det === 0.0) {\n // Unable to solve linear system\n return 0;\n }\n\n y[0] = (A[3] * x[0] - A[1] * x[1]) / det;\n y[1] = (-(A[2] * x[0]) + A[0] * x[1]) / det;\n x[0] = y[0];\n x[1] = y[1];\n return 1;\n }\n\n if (size === 1) {\n if (A[0] === 0.0) {\n // Unable to solve linear system\n return 0;\n }\n\n x[0] /= A[0];\n return 1;\n } //\n // System of equations is not trivial, use Crout's method\n //\n // Check on allocation of working vectors\n\n\n var index = createArray(size); // Factor and solve matrix\n\n if (luFactorLinearSystem(A, index, size) === 0) {\n return 0;\n }\n\n luSolveLinearSystem(A, index, x, size);\n return 1;\n} // Note that A is modified during the inversion !\n\nfunction invertMatrix(A, AI, size) {\n var index = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;\n var column = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;\n var tmp1Size = index || createArray(size);\n var tmp2Size = column || createArray(size); // Factor matrix; then begin solving for inverse one column at a time.\n // Note: tmp1Size returned value is used later, tmp2Size is just working\n // memory whose values are not used in LUSolveLinearSystem\n\n if (luFactorLinearSystem(A, tmp1Size, size) === 0) {\n return null;\n }\n\n for (var j = 0; j < size; j++) {\n for (var i = 0; i < size; i++) {\n tmp2Size[i] = 0.0;\n }\n\n tmp2Size[j] = 1.0;\n luSolveLinearSystem(A, tmp1Size, tmp2Size, size);\n\n for (var _i4 = 0; _i4 < size; _i4++) {\n AI[_i4 * size + j] = tmp2Size[_i4];\n }\n }\n\n return AI;\n}\nfunction estimateMatrixCondition(A, size) {\n var minValue = +Number.MAX_VALUE;\n var maxValue = -Number.MAX_VALUE; // find the maximum value\n\n for (var i = 0; i < size; i++) {\n for (var j = i; j < size; j++) {\n if (Math.abs(A[i * size + j]) > maxValue) {\n maxValue = Math.abs(A[i * size + j]);\n }\n }\n } // find the minimum diagonal value\n\n\n for (var _i5 = 0; _i5 < size; _i5++) {\n if (Math.abs(A[_i5 * size + _i5]) < minValue) {\n minValue = Math.abs(A[_i5 * size + _i5]);\n }\n }\n\n if (minValue === 0.0) {\n return Number.MAX_VALUE;\n }\n\n return maxValue / minValue;\n}\nfunction jacobi(a_3x3, w, v) {\n return jacobiN(a_3x3, 3, w, v);\n}\nfunction solveHomogeneousLeastSquares(numberOfSamples, xt, xOrder, mt) {\n // check dimensional consistency\n if (numberOfSamples < xOrder) {\n vtkWarningMacro('Insufficient number of samples. Underdetermined.');\n return 0;\n }\n\n var i;\n var j;\n var k; // set up intermediate variables\n // Allocate matrix to hold X times transpose of X\n\n var XXt = createArray(xOrder * xOrder); // size x by x\n // Allocate the array of eigenvalues and eigenvectors\n\n var eigenvals = createArray(xOrder);\n var eigenvecs = createArray(xOrder * xOrder); // Calculate XXt upper half only, due to symmetry\n\n for (k = 0; k < numberOfSamples; k++) {\n for (i = 0; i < xOrder; i++) {\n for (j = i; j < xOrder; j++) {\n XXt[i * xOrder + j] += xt[k * xOrder + i] * xt[k * xOrder + j];\n }\n }\n } // now fill in the lower half of the XXt matrix\n\n\n for (i = 0; i < xOrder; i++) {\n for (j = 0; j < i; j++) {\n XXt[i * xOrder + j] = XXt[j * xOrder + i];\n }\n } // Compute the eigenvectors and eigenvalues\n\n\n jacobiN(XXt, xOrder, eigenvals, eigenvecs); // Smallest eigenval is at the end of the list (xOrder-1), and solution is\n // corresponding eigenvec.\n\n for (i = 0; i < xOrder; i++) {\n mt[i] = eigenvecs[i * xOrder + xOrder - 1];\n }\n\n return 1;\n}\nfunction solveLeastSquares(numberOfSamples, xt, xOrder, yt, yOrder, mt) {\n var checkHomogeneous = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : true;\n\n // check dimensional consistency\n if (numberOfSamples < xOrder || numberOfSamples < yOrder) {\n vtkWarningMacro('Insufficient number of samples. Underdetermined.');\n return 0;\n }\n\n var homogenFlags = createArray(yOrder);\n var allHomogeneous = 1;\n var hmt;\n var homogRC = 0;\n var i;\n var j;\n var k;\n var someHomogeneous = 0; // Ok, first init some flags check and see if all the systems are homogeneous\n\n if (checkHomogeneous) {\n // If Y' is zero, it's a homogeneous system and can't be solved via\n // the pseudoinverse method. Detect this case, warn the user, and\n // invoke SolveHomogeneousLeastSquares instead. Note that it doesn't\n // really make much sense for yOrder to be greater than one in this case,\n // since that's just yOrder occurrences of a 0 vector on the RHS, but\n // we allow it anyway. N\n // Initialize homogeneous flags on a per-right-hand-side basis\n for (j = 0; j < yOrder; j++) {\n homogenFlags[j] = 1;\n }\n\n for (i = 0; i < numberOfSamples; i++) {\n for (j = 0; j < yOrder; j++) {\n if (Math.abs(yt[i * yOrder + j]) > VTK_SMALL_NUMBER) {\n allHomogeneous = 0;\n homogenFlags[j] = 0;\n }\n }\n } // If we've got one system, and it's homogeneous, do it and bail out quickly.\n\n\n if (allHomogeneous && yOrder === 1) {\n vtkWarningMacro('Detected homogeneous system (Y=0), calling SolveHomogeneousLeastSquares()');\n return solveHomogeneousLeastSquares(numberOfSamples, xt, xOrder, mt);\n } // Ok, we've got more than one system of equations.\n // Figure out if we need to calculate the homogeneous equation solution for\n // any of them.\n\n\n if (allHomogeneous) {\n someHomogeneous = 1;\n } else {\n for (j = 0; j < yOrder; j++) {\n if (homogenFlags[j]) {\n someHomogeneous = 1;\n }\n }\n }\n } // If necessary, solve the homogeneous problem\n\n\n if (someHomogeneous) {\n // hmt is the homogeneous equation version of mt, the general solution.\n // hmt should be xOrder x yOrder, but since we are solving only the homogeneous part, here it is xOrder x 1\n hmt = createArray(xOrder); // Ok, solve the homogeneous problem\n\n homogRC = solveHomogeneousLeastSquares(numberOfSamples, xt, xOrder, hmt);\n } // set up intermediate variables\n\n\n var XXt = createArray(xOrder * xOrder); // size x by x\n\n var XXtI = createArray(xOrder * xOrder); // size x by x\n\n var XYt = createArray(xOrder * yOrder); // size x by y\n // first find the pseudoinverse matrix\n\n for (k = 0; k < numberOfSamples; k++) {\n for (i = 0; i < xOrder; i++) {\n // first calculate the XXt matrix, only do the upper half (symmetrical)\n for (j = i; j < xOrder; j++) {\n XXt[i * xOrder + j] += xt[k * xOrder + i] * xt[k * xOrder + j];\n } // now calculate the XYt matrix\n\n\n for (j = 0; j < yOrder; j++) {\n XYt[i * yOrder + j] += xt[k * xOrder + i] * yt[k * yOrder + j];\n }\n }\n } // now fill in the lower half of the XXt matrix\n\n\n for (i = 0; i < xOrder; i++) {\n for (j = 0; j < i; j++) {\n XXt[i * xOrder + j] = XXt[j * xOrder + i];\n }\n }\n\n var successFlag = invertMatrix(XXt, XXtI, xOrder); // next get the inverse of XXt\n\n if (successFlag) {\n for (i = 0; i < xOrder; i++) {\n for (j = 0; j < yOrder; j++) {\n mt[i * yOrder + j] = 0.0;\n\n for (k = 0; k < xOrder; k++) {\n mt[i * yOrder + j] += XXtI[i * xOrder + k] * XYt[k * yOrder + j];\n }\n }\n }\n } // Fix up any of the solutions that correspond to the homogeneous equation\n // problem.\n\n\n if (someHomogeneous) {\n for (j = 0; j < yOrder; j++) {\n if (homogenFlags[j]) {\n // Fix this one\n for (i = 0; i < xOrder; i++) {\n mt[i * yOrder + j] = hmt[i * yOrder];\n }\n }\n }\n }\n\n if (someHomogeneous) {\n return homogRC && successFlag;\n }\n\n return successFlag;\n}\nfunction hex2float(hexStr) {\n var outFloatArray = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0.5, 1];\n\n switch (hexStr.length) {\n case 3:\n // abc => #aabbcc\n outFloatArray[0] = parseInt(hexStr[0], 16) * 17 / 255;\n outFloatArray[1] = parseInt(hexStr[1], 16) * 17 / 255;\n outFloatArray[2] = parseInt(hexStr[2], 16) * 17 / 255;\n return outFloatArray;\n\n case 4:\n // #abc => #aabbcc\n outFloatArray[0] = parseInt(hexStr[1], 16) * 17 / 255;\n outFloatArray[1] = parseInt(hexStr[2], 16) * 17 / 255;\n outFloatArray[2] = parseInt(hexStr[3], 16) * 17 / 255;\n return outFloatArray;\n\n case 6:\n // ab01df => #ab01df\n outFloatArray[0] = parseInt(hexStr.substr(0, 2), 16) / 255;\n outFloatArray[1] = parseInt(hexStr.substr(2, 2), 16) / 255;\n outFloatArray[2] = parseInt(hexStr.substr(4, 2), 16) / 255;\n return outFloatArray;\n\n case 7:\n // #ab01df\n outFloatArray[0] = parseInt(hexStr.substr(1, 2), 16) / 255;\n outFloatArray[1] = parseInt(hexStr.substr(3, 2), 16) / 255;\n outFloatArray[2] = parseInt(hexStr.substr(5, 2), 16) / 255;\n return outFloatArray;\n\n case 9:\n // #ab01df00\n outFloatArray[0] = parseInt(hexStr.substr(1, 2), 16) / 255;\n outFloatArray[1] = parseInt(hexStr.substr(3, 2), 16) / 255;\n outFloatArray[2] = parseInt(hexStr.substr(5, 2), 16) / 255;\n outFloatArray[3] = parseInt(hexStr.substr(7, 2), 16) / 255;\n return outFloatArray;\n\n default:\n return outFloatArray;\n }\n}\nfunction rgb2hsv(rgb, hsv) {\n var h;\n var s;\n\n var _rgb = _slicedToArray(rgb, 3),\n r = _rgb[0],\n g = _rgb[1],\n b = _rgb[2];\n\n var onethird = 1.0 / 3.0;\n var onesixth = 1.0 / 6.0;\n var twothird = 2.0 / 3.0;\n var cmax = r;\n var cmin = r;\n\n if (g > cmax) {\n cmax = g;\n } else if (g < cmin) {\n cmin = g;\n }\n\n if (b > cmax) {\n cmax = b;\n } else if (b < cmin) {\n cmin = b;\n }\n\n var v = cmax;\n\n if (v > 0.0) {\n s = (cmax - cmin) / cmax;\n } else {\n s = 0.0;\n }\n\n if (s > 0) {\n if (r === cmax) {\n h = onesixth * (g - b) / (cmax - cmin);\n } else if (g === cmax) {\n h = onethird + onesixth * (b - r) / (cmax - cmin);\n } else {\n h = twothird + onesixth * (r - g) / (cmax - cmin);\n }\n\n if (h < 0.0) {\n h += 1.0;\n }\n } else {\n h = 0.0;\n } // Set the values back to the array\n\n\n hsv[0] = h;\n hsv[1] = s;\n hsv[2] = v;\n}\nfunction hsv2rgb(hsv, rgb) {\n var _hsv = _slicedToArray(hsv, 3),\n h = _hsv[0],\n s = _hsv[1],\n v = _hsv[2];\n\n var onethird = 1.0 / 3.0;\n var onesixth = 1.0 / 6.0;\n var twothird = 2.0 / 3.0;\n var fivesixth = 5.0 / 6.0;\n var r;\n var g;\n var b; // compute RGB from HSV\n\n if (h > onesixth && h <= onethird) {\n // green/red\n g = 1.0;\n r = (onethird - h) / onesixth;\n b = 0.0;\n } else if (h > onethird && h <= 0.5) {\n // green/blue\n g = 1.0;\n b = (h - onethird) / onesixth;\n r = 0.0;\n } else if (h > 0.5 && h <= twothird) {\n // blue/green\n b = 1.0;\n g = (twothird - h) / onesixth;\n r = 0.0;\n } else if (h > twothird && h <= fivesixth) {\n // blue/red\n b = 1.0;\n r = (h - twothird) / onesixth;\n g = 0.0;\n } else if (h > fivesixth && h <= 1.0) {\n // red/blue\n r = 1.0;\n b = (1.0 - h) / onesixth;\n g = 0.0;\n } else {\n // red/green\n r = 1.0;\n g = h / onesixth;\n b = 0.0;\n } // add Saturation to the equation.\n\n\n r = s * r + (1.0 - s);\n g = s * g + (1.0 - s);\n b = s * b + (1.0 - s);\n r *= v;\n g *= v;\n b *= v; // Assign back to the array\n\n rgb[0] = r;\n rgb[1] = g;\n rgb[2] = b;\n}\nfunction lab2xyz(lab, xyz) {\n // LAB to XYZ\n var _lab = _slicedToArray(lab, 3),\n L = _lab[0],\n a = _lab[1],\n b = _lab[2];\n\n var var_Y = (L + 16) / 116;\n var var_X = a / 500 + var_Y;\n var var_Z = var_Y - b / 200;\n\n if (Math.pow(var_Y, 3) > 0.008856) {\n var_Y = Math.pow(var_Y, 3);\n } else {\n var_Y = (var_Y - 16.0 / 116.0) / 7.787;\n }\n\n if (Math.pow(var_X, 3) > 0.008856) {\n var_X = Math.pow(var_X, 3);\n } else {\n var_X = (var_X - 16.0 / 116.0) / 7.787;\n }\n\n if (Math.pow(var_Z, 3) > 0.008856) {\n var_Z = Math.pow(var_Z, 3);\n } else {\n var_Z = (var_Z - 16.0 / 116.0) / 7.787;\n }\n\n var ref_X = 0.9505;\n var ref_Y = 1.0;\n var ref_Z = 1.089;\n xyz[0] = ref_X * var_X; // ref_X = 0.9505 Observer= 2 deg Illuminant= D65\n\n xyz[1] = ref_Y * var_Y; // ref_Y = 1.000\n\n xyz[2] = ref_Z * var_Z; // ref_Z = 1.089\n}\nfunction xyz2lab(xyz, lab) {\n var _xyz = _slicedToArray(xyz, 3),\n x = _xyz[0],\n y = _xyz[1],\n z = _xyz[2];\n\n var ref_X = 0.9505;\n var ref_Y = 1.0;\n var ref_Z = 1.089;\n var var_X = x / ref_X; // ref_X = 0.9505 Observer= 2 deg, Illuminant= D65\n\n var var_Y = y / ref_Y; // ref_Y = 1.000\n\n var var_Z = z / ref_Z; // ref_Z = 1.089\n\n if (var_X > 0.008856) var_X = Math.pow(var_X, 1.0 / 3.0);else var_X = 7.787 * var_X + 16.0 / 116.0;\n if (var_Y > 0.008856) var_Y = Math.pow(var_Y, 1.0 / 3.0);else var_Y = 7.787 * var_Y + 16.0 / 116.0;\n if (var_Z > 0.008856) var_Z = Math.pow(var_Z, 1.0 / 3.0);else var_Z = 7.787 * var_Z + 16.0 / 116.0;\n lab[0] = 116 * var_Y - 16;\n lab[1] = 500 * (var_X - var_Y);\n lab[2] = 200 * (var_Y - var_Z);\n}\nfunction xyz2rgb(xyz, rgb) {\n var _xyz2 = _slicedToArray(xyz, 3),\n x = _xyz2[0],\n y = _xyz2[1],\n z = _xyz2[2];\n\n var r = x * 3.2406 + y * -1.5372 + z * -0.4986;\n var g = x * -0.9689 + y * 1.8758 + z * 0.0415;\n var b = x * 0.0557 + y * -0.204 + z * 1.057; // The following performs a \"gamma correction\" specified by the sRGB color\n // space. sRGB is defined by a canonical definition of a display monitor and\n // has been standardized by the International Electrotechnical Commission (IEC\n // 61966-2-1). The nonlinearity of the correction is designed to make the\n // colors more perceptually uniform. This color space has been adopted by\n // several applications including Adobe Photoshop and Microsoft Windows color\n // management. OpenGL is agnostic on its RGB color space, but it is reasonable\n // to assume it is close to this one.\n\n if (r > 0.0031308) r = 1.055 * Math.pow(r, 1 / 2.4) - 0.055;else r *= 12.92;\n if (g > 0.0031308) g = 1.055 * Math.pow(g, 1 / 2.4) - 0.055;else g *= 12.92;\n if (b > 0.0031308) b = 1.055 * Math.pow(b, 1 / 2.4) - 0.055;else b *= 12.92; // Clip colors. ideally we would do something that is perceptually closest\n // (since we can see colors outside of the display gamut), but this seems to\n // work well enough.\n\n var maxVal = r;\n if (maxVal < g) maxVal = g;\n if (maxVal < b) maxVal = b;\n\n if (maxVal > 1.0) {\n r /= maxVal;\n g /= maxVal;\n b /= maxVal;\n }\n\n if (r < 0) r = 0;\n if (g < 0) g = 0;\n if (b < 0) b = 0; // Push values back to array\n\n rgb[0] = r;\n rgb[1] = g;\n rgb[2] = b;\n}\nfunction rgb2xyz(rgb, xyz) {\n var _rgb2 = _slicedToArray(rgb, 3),\n r = _rgb2[0],\n g = _rgb2[1],\n b = _rgb2[2]; // The following performs a \"gamma correction\" specified by the sRGB color\n // space. sRGB is defined by a canonical definition of a display monitor and\n // has been standardized by the International Electrotechnical Commission (IEC\n // 61966-2-1). The nonlinearity of the correction is designed to make the\n // colors more perceptually uniform. This color space has been adopted by\n // several applications including Adobe Photoshop and Microsoft Windows color\n // management. OpenGL is agnostic on its RGB color space, but it is reasonable\n // to assume it is close to this one.\n\n\n if (r > 0.04045) r = Math.pow((r + 0.055) / 1.055, 2.4);else r /= 12.92;\n if (g > 0.04045) g = Math.pow((g + 0.055) / 1.055, 2.4);else g /= 12.92;\n if (b > 0.04045) b = Math.pow((b + 0.055) / 1.055, 2.4);else b /= 12.92; // Observer. = 2 deg, Illuminant = D65\n\n xyz[0] = r * 0.4124 + g * 0.3576 + b * 0.1805;\n xyz[1] = r * 0.2126 + g * 0.7152 + b * 0.0722;\n xyz[2] = r * 0.0193 + g * 0.1192 + b * 0.9505;\n}\nfunction rgb2lab(rgb, lab) {\n var xyz = [0, 0, 0];\n rgb2xyz(rgb, xyz);\n xyz2lab(xyz, lab);\n}\nfunction lab2rgb(lab, rgb) {\n var xyz = [0, 0, 0];\n lab2xyz(lab, xyz);\n xyz2rgb(xyz, rgb);\n}\nfunction uninitializeBounds(bounds) {\n bounds[0] = 1.0;\n bounds[1] = -1.0;\n bounds[2] = 1.0;\n bounds[3] = -1.0;\n bounds[4] = 1.0;\n bounds[5] = -1.0;\n return bounds;\n}\nfunction areBoundsInitialized(bounds) {\n return !(bounds[1] - bounds[0] < 0.0);\n}\nfunction computeBoundsFromPoints(point1, point2, bounds) {\n bounds[0] = Math.min(point1[0], point2[0]);\n bounds[1] = Math.max(point1[0], point2[0]);\n bounds[2] = Math.min(point1[1], point2[1]);\n bounds[3] = Math.max(point1[1], point2[1]);\n bounds[4] = Math.min(point1[2], point2[2]);\n bounds[5] = Math.max(point1[2], point2[2]);\n return bounds;\n}\nfunction clampValue(value, minValue, maxValue) {\n if (value < minValue) {\n return minValue;\n }\n\n if (value > maxValue) {\n return maxValue;\n }\n\n return value;\n}\nfunction clampVector(vector, minVector, maxVector) {\n var out = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [0, 0, 0];\n out[0] = clampValue(vector[0], minVector[0], maxVector[0]);\n out[1] = clampValue(vector[1], minVector[1], maxVector[1]);\n out[2] = clampValue(vector[2], minVector[2], maxVector[2]);\n return out;\n}\nfunction clampAndNormalizeValue(value, range) {\n var result = 0;\n\n if (range[0] !== range[1]) {\n // clamp\n if (value < range[0]) {\n result = range[0];\n } else if (value > range[1]) {\n result = range[1];\n } else {\n result = value;\n } // normalize\n\n\n result = (result - range[0]) / (range[1] - range[0]);\n }\n\n return result;\n}\nvar getScalarTypeFittingRange = notImplemented('GetScalarTypeFittingRange');\nvar getAdjustedScalarRange = notImplemented('GetAdjustedScalarRange');\nfunction extentIsWithinOtherExtent(extent1, extent2) {\n if (!extent1 || !extent2) {\n return 0;\n }\n\n for (var i = 0; i < 6; i += 2) {\n if (extent1[i] < extent2[i] || extent1[i] > extent2[i + 1] || extent1[i + 1] < extent2[i] || extent1[i + 1] > extent2[i + 1]) {\n return 0;\n }\n }\n\n return 1;\n}\nfunction boundsIsWithinOtherBounds(bounds1_6, bounds2_6, delta_3) {\n if (!bounds1_6 || !bounds2_6) {\n return 0;\n }\n\n for (var i = 0; i < 6; i += 2) {\n if (bounds1_6[i] + delta_3[i / 2] < bounds2_6[i] || bounds1_6[i] - delta_3[i / 2] > bounds2_6[i + 1] || bounds1_6[i + 1] + delta_3[i / 2] < bounds2_6[i] || bounds1_6[i + 1] - delta_3[i / 2] > bounds2_6[i + 1]) {\n return 0;\n }\n }\n\n return 1;\n}\nfunction pointIsWithinBounds(point_3, bounds_6, delta_3) {\n if (!point_3 || !bounds_6 || !delta_3) {\n return 0;\n }\n\n for (var i = 0; i < 3; i++) {\n if (point_3[i] + delta_3[i] < bounds_6[2 * i] || point_3[i] - delta_3[i] > bounds_6[2 * i + 1]) {\n return 0;\n }\n }\n\n return 1;\n}\nfunction solve3PointCircle(p1, p2, p3, center) {\n var v21 = createArray(3);\n var v32 = createArray(3);\n var v13 = createArray(3);\n var v12 = createArray(3);\n var v23 = createArray(3);\n var v31 = createArray(3);\n\n for (var i = 0; i < 3; ++i) {\n v21[i] = p1[i] - p2[i];\n v32[i] = p2[i] - p3[i];\n v13[i] = p3[i] - p1[i];\n v12[i] = -v21[i];\n v23[i] = -v32[i];\n v31[i] = -v13[i];\n }\n\n var norm12 = norm(v12);\n var norm23 = norm(v23);\n var norm13 = norm(v13);\n var crossv21v32 = createArray(3);\n cross(v21, v32, crossv21v32);\n var normCross = norm(crossv21v32);\n var radius = norm12 * norm23 * norm13 / (2 * normCross);\n var normCross22 = 2 * normCross * normCross;\n var alpha = norm23 * norm23 * dot(v21, v31) / normCross22;\n var beta = norm13 * norm13 * dot(v12, v32) / normCross22;\n var gamma = norm12 * norm12 * dot(v13, v23) / normCross22;\n\n for (var _i6 = 0; _i6 < 3; ++_i6) {\n center[_i6] = alpha * p1[_i6] + beta * p2[_i6] + gamma * p3[_i6];\n }\n\n return radius;\n}\nvar inf = Infinity;\nvar negInf = -Infinity;\nvar isInf = function isInf(value) {\n return !Number.isFinite(value);\n};\nvar isFinite = Number.isFinite,\n isNaN = Number.isNaN;\nvar isNan = isNaN; // JavaScript - add-on ----------------------\n\nfunction createUninitializedBounds() {\n return [].concat([Number.MAX_VALUE, -Number.MAX_VALUE, // X\n Number.MAX_VALUE, -Number.MAX_VALUE, // Y\n Number.MAX_VALUE, -Number.MAX_VALUE // Z\n ]);\n}\nfunction getMajorAxisIndex(vector) {\n var maxValue = -1;\n var axisIndex = -1;\n\n for (var i = 0; i < vector.length; i++) {\n var value = Math.abs(vector[i]);\n\n if (value > maxValue) {\n axisIndex = i;\n maxValue = value;\n }\n }\n\n return axisIndex;\n}\nfunction floatToHex2(value) {\n var integer = Math.floor(value * 255);\n\n if (integer > 15) {\n return integer.toString(16);\n }\n\n return \"0\".concat(integer.toString(16));\n}\nfunction floatRGB2HexCode(rgbArray) {\n var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '#';\n return \"\".concat(prefix).concat(rgbArray.map(floatToHex2).join(''));\n}\n\nfunction floatToChar(f) {\n return Math.round(f * 255);\n}\n\nfunction float2CssRGBA(rgbArray) {\n if (rgbArray.length === 3) {\n return \"rgb(\".concat(rgbArray.map(floatToChar).join(', '), \")\");\n }\n\n return \"rgba(\".concat(floatToChar(rgbArray[0] || 0), \", \").concat(floatToChar(rgbArray[1] || 0), \", \").concat(floatToChar(rgbArray[2] || 0), \", \").concat(rgbArray[3] || 0, \")\");\n} // ----------------------------------------------------------------------------\n// Only Static API\n// ----------------------------------------------------------------------------\n\nvar vtkMath = {\n Pi: Pi,\n radiansFromDegrees: radiansFromDegrees,\n degreesFromRadians: degreesFromRadians,\n round: round,\n floor: floor,\n ceil: ceil,\n ceilLog2: ceilLog2,\n min: min,\n max: max,\n arrayMin: arrayMin,\n arrayMax: arrayMax,\n arrayRange: arrayRange,\n isPowerOfTwo: isPowerOfTwo,\n nearestPowerOfTwo: nearestPowerOfTwo,\n factorial: factorial,\n binomial: binomial,\n beginCombination: beginCombination,\n nextCombination: nextCombination,\n randomSeed: randomSeed,\n getSeed: getSeed,\n random: random,\n gaussian: gaussian,\n add: add,\n subtract: subtract,\n multiplyScalar: multiplyScalar,\n multiplyScalar2D: multiplyScalar2D,\n multiplyAccumulate: multiplyAccumulate,\n multiplyAccumulate2D: multiplyAccumulate2D,\n dot: dot,\n outer: outer,\n cross: cross,\n norm: norm,\n normalize: normalize,\n perpendiculars: perpendiculars,\n projectVector: projectVector,\n projectVector2D: projectVector2D,\n distance2BetweenPoints: distance2BetweenPoints,\n angleBetweenVectors: angleBetweenVectors,\n gaussianAmplitude: gaussianAmplitude,\n gaussianWeight: gaussianWeight,\n dot2D: dot2D,\n outer2D: outer2D,\n norm2D: norm2D,\n normalize2D: normalize2D,\n determinant2x2: determinant2x2,\n LUFactor3x3: LUFactor3x3,\n LUSolve3x3: LUSolve3x3,\n linearSolve3x3: linearSolve3x3,\n multiply3x3_vect3: multiply3x3_vect3,\n multiply3x3_mat3: multiply3x3_mat3,\n multiplyMatrix: multiplyMatrix,\n transpose3x3: transpose3x3,\n invert3x3: invert3x3,\n identity3x3: identity3x3,\n identity: identity,\n isIdentity: isIdentity,\n isIdentity3x3: isIdentity3x3,\n determinant3x3: determinant3x3,\n quaternionToMatrix3x3: quaternionToMatrix3x3,\n areEquals: areEquals,\n areMatricesEqual: areMatricesEqual,\n roundNumber: roundNumber,\n roundVector: roundVector,\n matrix3x3ToQuaternion: matrix3x3ToQuaternion,\n multiplyQuaternion: multiplyQuaternion,\n orthogonalize3x3: orthogonalize3x3,\n diagonalize3x3: diagonalize3x3,\n singularValueDecomposition3x3: singularValueDecomposition3x3,\n solveLinearSystem: solveLinearSystem,\n invertMatrix: invertMatrix,\n luFactorLinearSystem: luFactorLinearSystem,\n luSolveLinearSystem: luSolveLinearSystem,\n estimateMatrixCondition: estimateMatrixCondition,\n jacobi: jacobi,\n jacobiN: jacobiN,\n solveHomogeneousLeastSquares: solveHomogeneousLeastSquares,\n solveLeastSquares: solveLeastSquares,\n hex2float: hex2float,\n rgb2hsv: rgb2hsv,\n hsv2rgb: hsv2rgb,\n lab2xyz: lab2xyz,\n xyz2lab: xyz2lab,\n xyz2rgb: xyz2rgb,\n rgb2xyz: rgb2xyz,\n rgb2lab: rgb2lab,\n lab2rgb: lab2rgb,\n uninitializeBounds: uninitializeBounds,\n areBoundsInitialized: areBoundsInitialized,\n computeBoundsFromPoints: computeBoundsFromPoints,\n clampValue: clampValue,\n clampVector: clampVector,\n clampAndNormalizeValue: clampAndNormalizeValue,\n getScalarTypeFittingRange: getScalarTypeFittingRange,\n getAdjustedScalarRange: getAdjustedScalarRange,\n extentIsWithinOtherExtent: extentIsWithinOtherExtent,\n boundsIsWithinOtherBounds: boundsIsWithinOtherBounds,\n pointIsWithinBounds: pointIsWithinBounds,\n solve3PointCircle: solve3PointCircle,\n inf: inf,\n negInf: negInf,\n isInf: isInf,\n isNan: isNaN,\n isNaN: isNaN,\n isFinite: isFinite,\n // JS add-on\n createUninitializedBounds: createUninitializedBounds,\n getMajorAxisIndex: getMajorAxisIndex,\n floatToHex2: floatToHex2,\n floatRGB2HexCode: floatRGB2HexCode,\n float2CssRGBA: float2CssRGBA\n};\n\nvar vtkMath$1 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n createArray: createArray,\n Pi: Pi,\n radiansFromDegrees: radiansFromDegrees,\n degreesFromRadians: degreesFromRadians,\n round: round,\n floor: floor,\n ceil: ceil,\n min: min,\n max: max,\n arrayMin: arrayMin,\n arrayMax: arrayMax,\n arrayRange: arrayRange,\n ceilLog2: ceilLog2,\n factorial: factorial,\n nearestPowerOfTwo: nearestPowerOfTwo,\n isPowerOfTwo: isPowerOfTwo,\n binomial: binomial,\n beginCombination: beginCombination,\n nextCombination: nextCombination,\n randomSeed: randomSeed,\n getSeed: getSeed,\n random: random,\n gaussian: gaussian,\n add: add,\n subtract: subtract,\n multiplyScalar: multiplyScalar,\n multiplyScalar2D: multiplyScalar2D,\n multiplyAccumulate: multiplyAccumulate,\n multiplyAccumulate2D: multiplyAccumulate2D,\n dot: dot,\n outer: outer,\n cross: cross,\n norm: norm,\n normalize: normalize,\n perpendiculars: perpendiculars,\n projectVector: projectVector,\n dot2D: dot2D,\n projectVector2D: projectVector2D,\n distance2BetweenPoints: distance2BetweenPoints,\n angleBetweenVectors: angleBetweenVectors,\n signedAngleBetweenVectors: signedAngleBetweenVectors,\n gaussianAmplitude: gaussianAmplitude,\n gaussianWeight: gaussianWeight,\n outer2D: outer2D,\n norm2D: norm2D,\n normalize2D: normalize2D,\n rowsToMat4: rowsToMat4,\n columnsToMat4: columnsToMat4,\n rowsToMat3: rowsToMat3,\n columnsToMat3: columnsToMat3,\n determinant2x2: determinant2x2,\n LUFactor3x3: LUFactor3x3,\n LUSolve3x3: LUSolve3x3,\n linearSolve3x3: linearSolve3x3,\n multiply3x3_vect3: multiply3x3_vect3,\n multiply3x3_mat3: multiply3x3_mat3,\n multiplyMatrix: multiplyMatrix,\n transpose3x3: transpose3x3,\n invert3x3: invert3x3,\n determinant3x3: determinant3x3,\n areEquals: areEquals,\n areMatricesEqual: areMatricesEqual,\n identity3x3: identity3x3,\n identity: identity,\n isIdentity: isIdentity,\n isIdentity3x3: isIdentity3x3,\n quaternionToMatrix3x3: quaternionToMatrix3x3,\n roundNumber: roundNumber,\n roundVector: roundVector,\n jacobiN: jacobiN,\n matrix3x3ToQuaternion: matrix3x3ToQuaternion,\n multiplyQuaternion: multiplyQuaternion,\n orthogonalize3x3: orthogonalize3x3,\n diagonalize3x3: diagonalize3x3,\n singularValueDecomposition3x3: singularValueDecomposition3x3,\n luFactorLinearSystem: luFactorLinearSystem,\n luSolveLinearSystem: luSolveLinearSystem,\n solveLinearSystem: solveLinearSystem,\n invertMatrix: invertMatrix,\n estimateMatrixCondition: estimateMatrixCondition,\n jacobi: jacobi,\n solveHomogeneousLeastSquares: solveHomogeneousLeastSquares,\n solveLeastSquares: solveLeastSquares,\n hex2float: hex2float,\n rgb2hsv: rgb2hsv,\n hsv2rgb: hsv2rgb,\n lab2xyz: lab2xyz,\n xyz2lab: xyz2lab,\n xyz2rgb: xyz2rgb,\n rgb2xyz: rgb2xyz,\n rgb2lab: rgb2lab,\n lab2rgb: lab2rgb,\n uninitializeBounds: uninitializeBounds,\n areBoundsInitialized: areBoundsInitialized,\n computeBoundsFromPoints: computeBoundsFromPoints,\n clampValue: clampValue,\n clampVector: clampVector,\n clampAndNormalizeValue: clampAndNormalizeValue,\n getScalarTypeFittingRange: getScalarTypeFittingRange,\n getAdjustedScalarRange: getAdjustedScalarRange,\n extentIsWithinOtherExtent: extentIsWithinOtherExtent,\n boundsIsWithinOtherBounds: boundsIsWithinOtherBounds,\n pointIsWithinBounds: pointIsWithinBounds,\n solve3PointCircle: solve3PointCircle,\n inf: inf,\n negInf: negInf,\n isInf: isInf,\n isFinite: isFinite,\n isNaN: isNaN,\n isNan: isNan,\n createUninitializedBounds: createUninitializedBounds,\n getMajorAxisIndex: getMajorAxisIndex,\n floatToHex2: floatToHex2,\n floatRGB2HexCode: floatRGB2HexCode,\n float2CssRGBA: float2CssRGBA,\n 'default': vtkMath\n});\n\nexport { ceilLog2 as $, rowsToMat3 as A, degreesFromRadians as B, areEquals as C, clampValue as D, arrayRange as E, getMajorAxisIndex as F, isInf as G, rgb2hsv as H, rgb2lab as I, lab2rgb as J, floor as K, round as L, normalize2D as M, nearestPowerOfTwo as N, createUninitializedBounds as O, multiply3x3_vect3 as P, areBoundsInitialized as Q, isPowerOfTwo as R, angleBetweenVectors as S, signedAngleBetweenVectors as T, createArray as U, Pi as V, ceil as W, min as X, max as Y, arrayMin as Z, arrayMax as _, areMatricesEqual as a, factorial as a0, binomial as a1, beginCombination as a2, nextCombination as a3, randomSeed as a4, getSeed as a5, gaussian as a6, multiplyScalar2D as a7, multiplyAccumulate2D as a8, outer as a9, diagonalize3x3 as aA, singularValueDecomposition3x3 as aB, luFactorLinearSystem as aC, luSolveLinearSystem as aD, invertMatrix as aE, estimateMatrixCondition as aF, solveHomogeneousLeastSquares as aG, solveLeastSquares as aH, hex2float as aI, lab2xyz as aJ, xyz2lab as aK, xyz2rgb as aL, rgb2xyz as aM, clampAndNormalizeValue as aN, getScalarTypeFittingRange as aO, getAdjustedScalarRange as aP, extentIsWithinOtherExtent as aQ, boundsIsWithinOtherBounds as aR, pointIsWithinBounds as aS, solve3PointCircle as aT, inf as aU, negInf as aV, isFinite as aW, isNaN as aX, floatToHex2 as aY, floatRGB2HexCode as aZ, float2CssRGBA as a_, projectVector as aa, dot2D as ab, projectVector2D as ac, gaussianAmplitude as ad, gaussianWeight as ae, outer2D as af, norm2D as ag, rowsToMat4 as ah, columnsToMat4 as ai, columnsToMat3 as aj, LUFactor3x3 as ak, LUSolve3x3 as al, linearSolve3x3 as am, multiply3x3_mat3 as an, multiplyMatrix as ao, transpose3x3 as ap, invert3x3 as aq, identity3x3 as ar, identity as as, isIdentity as at, isIdentity3x3 as au, quaternionToMatrix3x3 as av, roundNumber as aw, matrix3x3ToQuaternion as ax, multiplyQuaternion as ay, orthogonalize3x3 as az, roundVector as b, computeBoundsFromPoints as c, dot as d, clampVector as e, distance2BetweenPoints as f, vtkMath as g, hsv2rgb as h, isNan as i, solveLinearSystem as j, cross as k, add as l, normalize as m, norm as n, multiplyAccumulate as o, determinant2x2 as p, jacobiN as q, radiansFromDegrees as r, subtract as s, perpendiculars as t, uninitializeBounds as u, vtkMath$1 as v, jacobi as w, multiplyScalar as x, random as y, determinant3x3 as z };\n","/**\n * Common utilities\n * @module glMatrix\n */\n// Configuration Constants\nexport var EPSILON = 0.000001;\nexport var ARRAY_TYPE = typeof Float32Array !== 'undefined' ? Float32Array : Array;\nexport var RANDOM = Math.random;\n/**\n * Sets the type of array used when creating new vectors and matrices\n *\n * @param {Float32ArrayConstructor | ArrayConstructor} type Array type, such as Float32Array or Array\n */\n\nexport function setMatrixArrayType(type) {\n ARRAY_TYPE = type;\n}\nvar degree = Math.PI / 180;\n/**\n * Convert Degree To Radian\n *\n * @param {Number} a Angle in Degrees\n */\n\nexport function toRadian(a) {\n return a * degree;\n}\n/**\n * Tests whether or not the arguments have approximately the same value, within an absolute\n * or relative tolerance of glMatrix.EPSILON (an absolute tolerance is used for values less\n * than or equal to 1.0, and a relative tolerance is used for larger values)\n *\n * @param {Number} a The first number to test.\n * @param {Number} b The second number to test.\n * @returns {Boolean} True if the numbers are approximately equal, false otherwise.\n */\n\nexport function equals(a, b) {\n return Math.abs(a - b) <= EPSILON * Math.max(1.0, Math.abs(a), Math.abs(b));\n}\nif (!Math.hypot) Math.hypot = function () {\n var y = 0,\n i = arguments.length;\n\n while (i--) {\n y += arguments[i] * arguments[i];\n }\n\n return Math.sqrt(y);\n};","import * as glMatrix from \"./common.js\";\n/**\n * 4x4 Matrix<br>Format: column-major, when typed out it looks like row-major<br>The matrices are being post multiplied.\n * @module mat4\n */\n\n/**\n * Creates a new identity mat4\n *\n * @returns {mat4} a new 4x4 matrix\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(16);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n }\n\n out[0] = 1;\n out[5] = 1;\n out[10] = 1;\n out[15] = 1;\n return out;\n}\n/**\n * Creates a new mat4 initialized with values from an existing matrix\n *\n * @param {ReadonlyMat4} a matrix to clone\n * @returns {mat4} a new 4x4 matrix\n */\n\nexport function clone(a) {\n var out = new glMatrix.ARRAY_TYPE(16);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n/**\n * Copy the values from one mat4 to another\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the source matrix\n * @returns {mat4} out\n */\n\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n/**\n * Create a new mat4 with the given values\n *\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\n * @param {Number} m03 Component in column 0, row 3 position (index 3)\n * @param {Number} m10 Component in column 1, row 0 position (index 4)\n * @param {Number} m11 Component in column 1, row 1 position (index 5)\n * @param {Number} m12 Component in column 1, row 2 position (index 6)\n * @param {Number} m13 Component in column 1, row 3 position (index 7)\n * @param {Number} m20 Component in column 2, row 0 position (index 8)\n * @param {Number} m21 Component in column 2, row 1 position (index 9)\n * @param {Number} m22 Component in column 2, row 2 position (index 10)\n * @param {Number} m23 Component in column 2, row 3 position (index 11)\n * @param {Number} m30 Component in column 3, row 0 position (index 12)\n * @param {Number} m31 Component in column 3, row 1 position (index 13)\n * @param {Number} m32 Component in column 3, row 2 position (index 14)\n * @param {Number} m33 Component in column 3, row 3 position (index 15)\n * @returns {mat4} A new mat4\n */\n\nexport function fromValues(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {\n var out = new glMatrix.ARRAY_TYPE(16);\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m03;\n out[4] = m10;\n out[5] = m11;\n out[6] = m12;\n out[7] = m13;\n out[8] = m20;\n out[9] = m21;\n out[10] = m22;\n out[11] = m23;\n out[12] = m30;\n out[13] = m31;\n out[14] = m32;\n out[15] = m33;\n return out;\n}\n/**\n * Set the components of a mat4 to the given values\n *\n * @param {mat4} out the receiving matrix\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\n * @param {Number} m03 Component in column 0, row 3 position (index 3)\n * @param {Number} m10 Component in column 1, row 0 position (index 4)\n * @param {Number} m11 Component in column 1, row 1 position (index 5)\n * @param {Number} m12 Component in column 1, row 2 position (index 6)\n * @param {Number} m13 Component in column 1, row 3 position (index 7)\n * @param {Number} m20 Component in column 2, row 0 position (index 8)\n * @param {Number} m21 Component in column 2, row 1 position (index 9)\n * @param {Number} m22 Component in column 2, row 2 position (index 10)\n * @param {Number} m23 Component in column 2, row 3 position (index 11)\n * @param {Number} m30 Component in column 3, row 0 position (index 12)\n * @param {Number} m31 Component in column 3, row 1 position (index 13)\n * @param {Number} m32 Component in column 3, row 2 position (index 14)\n * @param {Number} m33 Component in column 3, row 3 position (index 15)\n * @returns {mat4} out\n */\n\nexport function set(out, m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m03;\n out[4] = m10;\n out[5] = m11;\n out[6] = m12;\n out[7] = m13;\n out[8] = m20;\n out[9] = m21;\n out[10] = m22;\n out[11] = m23;\n out[12] = m30;\n out[13] = m31;\n out[14] = m32;\n out[15] = m33;\n return out;\n}\n/**\n * Set a mat4 to the identity matrix\n *\n * @param {mat4} out the receiving matrix\n * @returns {mat4} out\n */\n\nexport function identity(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\n * Transpose the values of a mat4\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the source matrix\n * @returns {mat4} out\n */\n\nexport function transpose(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n var a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a12 = a[6],\n a13 = a[7];\n var a23 = a[11];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a01;\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a02;\n out[9] = a12;\n out[11] = a[14];\n out[12] = a03;\n out[13] = a13;\n out[14] = a23;\n } else {\n out[0] = a[0];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a[1];\n out[5] = a[5];\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a[2];\n out[9] = a[6];\n out[10] = a[10];\n out[11] = a[14];\n out[12] = a[3];\n out[13] = a[7];\n out[14] = a[11];\n out[15] = a[15];\n }\n\n return out;\n}\n/**\n * Inverts a mat4\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the source matrix\n * @returns {mat4} out\n */\n\nexport function invert(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n var b00 = a00 * a11 - a01 * a10;\n var b01 = a00 * a12 - a02 * a10;\n var b02 = a00 * a13 - a03 * a10;\n var b03 = a01 * a12 - a02 * a11;\n var b04 = a01 * a13 - a03 * a11;\n var b05 = a02 * a13 - a03 * a12;\n var b06 = a20 * a31 - a21 * a30;\n var b07 = a20 * a32 - a22 * a30;\n var b08 = a20 * a33 - a23 * a30;\n var b09 = a21 * a32 - a22 * a31;\n var b10 = a21 * a33 - a23 * a31;\n var b11 = a22 * a33 - a23 * a32; // Calculate the determinant\n\n var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n if (!det) {\n return null;\n }\n\n det = 1.0 / det;\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\n return out;\n}\n/**\n * Calculates the adjugate of a mat4\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the source matrix\n * @returns {mat4} out\n */\n\nexport function adjoint(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n out[0] = a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22);\n out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22));\n out[2] = a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12);\n out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12));\n out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22));\n out[5] = a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22);\n out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12));\n out[7] = a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12);\n out[8] = a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21);\n out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21));\n out[10] = a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11);\n out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11));\n out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21));\n out[13] = a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21);\n out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11));\n out[15] = a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11);\n return out;\n}\n/**\n * Calculates the determinant of a mat4\n *\n * @param {ReadonlyMat4} a the source matrix\n * @returns {Number} determinant of a\n */\n\nexport function determinant(a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n var b00 = a00 * a11 - a01 * a10;\n var b01 = a00 * a12 - a02 * a10;\n var b02 = a00 * a13 - a03 * a10;\n var b03 = a01 * a12 - a02 * a11;\n var b04 = a01 * a13 - a03 * a11;\n var b05 = a02 * a13 - a03 * a12;\n var b06 = a20 * a31 - a21 * a30;\n var b07 = a20 * a32 - a22 * a30;\n var b08 = a20 * a33 - a23 * a30;\n var b09 = a21 * a32 - a22 * a31;\n var b10 = a21 * a33 - a23 * a31;\n var b11 = a22 * a33 - a23 * a32; // Calculate the determinant\n\n return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n}\n/**\n * Multiplies two mat4s\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the first operand\n * @param {ReadonlyMat4} b the second operand\n * @returns {mat4} out\n */\n\nexport function multiply(out, a, b) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15]; // Cache only the current line of the second matrix\n\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3];\n out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[4];\n b1 = b[5];\n b2 = b[6];\n b3 = b[7];\n out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[8];\n b1 = b[9];\n b2 = b[10];\n b3 = b[11];\n out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[12];\n b1 = b[13];\n b2 = b[14];\n b3 = b[15];\n out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n return out;\n}\n/**\n * Translate a mat4 by the given vector\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to translate\n * @param {ReadonlyVec3} v vector to translate by\n * @returns {mat4} out\n */\n\nexport function translate(out, a, v) {\n var x = v[0],\n y = v[1],\n z = v[2];\n var a00, a01, a02, a03;\n var a10, a11, a12, a13;\n var a20, a21, a22, a23;\n\n if (a === out) {\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\n } else {\n a00 = a[0];\n a01 = a[1];\n a02 = a[2];\n a03 = a[3];\n a10 = a[4];\n a11 = a[5];\n a12 = a[6];\n a13 = a[7];\n a20 = a[8];\n a21 = a[9];\n a22 = a[10];\n a23 = a[11];\n out[0] = a00;\n out[1] = a01;\n out[2] = a02;\n out[3] = a03;\n out[4] = a10;\n out[5] = a11;\n out[6] = a12;\n out[7] = a13;\n out[8] = a20;\n out[9] = a21;\n out[10] = a22;\n out[11] = a23;\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\n }\n\n return out;\n}\n/**\n * Scales the mat4 by the dimensions in the given vec3 not using vectorization\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to scale\n * @param {ReadonlyVec3} v the vec3 to scale the matrix by\n * @returns {mat4} out\n **/\n\nexport function scale(out, a, v) {\n var x = v[0],\n y = v[1],\n z = v[2];\n out[0] = a[0] * x;\n out[1] = a[1] * x;\n out[2] = a[2] * x;\n out[3] = a[3] * x;\n out[4] = a[4] * y;\n out[5] = a[5] * y;\n out[6] = a[6] * y;\n out[7] = a[7] * y;\n out[8] = a[8] * z;\n out[9] = a[9] * z;\n out[10] = a[10] * z;\n out[11] = a[11] * z;\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n/**\n * Rotates a mat4 by the given angle around the given axis\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @param {ReadonlyVec3} axis the axis to rotate around\n * @returns {mat4} out\n */\n\nexport function rotate(out, a, rad, axis) {\n var x = axis[0],\n y = axis[1],\n z = axis[2];\n var len = Math.hypot(x, y, z);\n var s, c, t;\n var a00, a01, a02, a03;\n var a10, a11, a12, a13;\n var a20, a21, a22, a23;\n var b00, b01, b02;\n var b10, b11, b12;\n var b20, b21, b22;\n\n if (len < glMatrix.EPSILON) {\n return null;\n }\n\n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n s = Math.sin(rad);\n c = Math.cos(rad);\n t = 1 - c;\n a00 = a[0];\n a01 = a[1];\n a02 = a[2];\n a03 = a[3];\n a10 = a[4];\n a11 = a[5];\n a12 = a[6];\n a13 = a[7];\n a20 = a[8];\n a21 = a[9];\n a22 = a[10];\n a23 = a[11]; // Construct the elements of the rotation matrix\n\n b00 = x * x * t + c;\n b01 = y * x * t + z * s;\n b02 = z * x * t - y * s;\n b10 = x * y * t - z * s;\n b11 = y * y * t + c;\n b12 = z * y * t + x * s;\n b20 = x * z * t + y * s;\n b21 = y * z * t - x * s;\n b22 = z * z * t + c; // Perform rotation-specific matrix multiplication\n\n out[0] = a00 * b00 + a10 * b01 + a20 * b02;\n out[1] = a01 * b00 + a11 * b01 + a21 * b02;\n out[2] = a02 * b00 + a12 * b01 + a22 * b02;\n out[3] = a03 * b00 + a13 * b01 + a23 * b02;\n out[4] = a00 * b10 + a10 * b11 + a20 * b12;\n out[5] = a01 * b10 + a11 * b11 + a21 * b12;\n out[6] = a02 * b10 + a12 * b11 + a22 * b12;\n out[7] = a03 * b10 + a13 * b11 + a23 * b12;\n out[8] = a00 * b20 + a10 * b21 + a20 * b22;\n out[9] = a01 * b20 + a11 * b21 + a21 * b22;\n out[10] = a02 * b20 + a12 * b21 + a22 * b22;\n out[11] = a03 * b20 + a13 * b21 + a23 * b22;\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged last row\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n\n return out;\n}\n/**\n * Rotates a matrix by the given angle around the X axis\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\n\nexport function rotateX(out, a, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n var a10 = a[4];\n var a11 = a[5];\n var a12 = a[6];\n var a13 = a[7];\n var a20 = a[8];\n var a21 = a[9];\n var a22 = a[10];\n var a23 = a[11];\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged rows\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n } // Perform axis-specific matrix multiplication\n\n\n out[4] = a10 * c + a20 * s;\n out[5] = a11 * c + a21 * s;\n out[6] = a12 * c + a22 * s;\n out[7] = a13 * c + a23 * s;\n out[8] = a20 * c - a10 * s;\n out[9] = a21 * c - a11 * s;\n out[10] = a22 * c - a12 * s;\n out[11] = a23 * c - a13 * s;\n return out;\n}\n/**\n * Rotates a matrix by the given angle around the Y axis\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\n\nexport function rotateY(out, a, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n var a00 = a[0];\n var a01 = a[1];\n var a02 = a[2];\n var a03 = a[3];\n var a20 = a[8];\n var a21 = a[9];\n var a22 = a[10];\n var a23 = a[11];\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged rows\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n } // Perform axis-specific matrix multiplication\n\n\n out[0] = a00 * c - a20 * s;\n out[1] = a01 * c - a21 * s;\n out[2] = a02 * c - a22 * s;\n out[3] = a03 * c - a23 * s;\n out[8] = a00 * s + a20 * c;\n out[9] = a01 * s + a21 * c;\n out[10] = a02 * s + a22 * c;\n out[11] = a03 * s + a23 * c;\n return out;\n}\n/**\n * Rotates a matrix by the given angle around the Z axis\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\n\nexport function rotateZ(out, a, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n var a00 = a[0];\n var a01 = a[1];\n var a02 = a[2];\n var a03 = a[3];\n var a10 = a[4];\n var a11 = a[5];\n var a12 = a[6];\n var a13 = a[7];\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged last row\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n } // Perform axis-specific matrix multiplication\n\n\n out[0] = a00 * c + a10 * s;\n out[1] = a01 * c + a11 * s;\n out[2] = a02 * c + a12 * s;\n out[3] = a03 * c + a13 * s;\n out[4] = a10 * c - a00 * s;\n out[5] = a11 * c - a01 * s;\n out[6] = a12 * c - a02 * s;\n out[7] = a13 * c - a03 * s;\n return out;\n}\n/**\n * Creates a matrix from a vector translation\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, dest, vec);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {ReadonlyVec3} v Translation vector\n * @returns {mat4} out\n */\n\nexport function fromTranslation(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n/**\n * Creates a matrix from a vector scaling\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.scale(dest, dest, vec);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {ReadonlyVec3} v Scaling vector\n * @returns {mat4} out\n */\n\nexport function fromScaling(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = v[1];\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = v[2];\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\n * Creates a matrix from a given angle around a given axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotate(dest, dest, rad, axis);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @param {ReadonlyVec3} axis the axis to rotate around\n * @returns {mat4} out\n */\n\nexport function fromRotation(out, rad, axis) {\n var x = axis[0],\n y = axis[1],\n z = axis[2];\n var len = Math.hypot(x, y, z);\n var s, c, t;\n\n if (len < glMatrix.EPSILON) {\n return null;\n }\n\n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n s = Math.sin(rad);\n c = Math.cos(rad);\n t = 1 - c; // Perform rotation-specific matrix multiplication\n\n out[0] = x * x * t + c;\n out[1] = y * x * t + z * s;\n out[2] = z * x * t - y * s;\n out[3] = 0;\n out[4] = x * y * t - z * s;\n out[5] = y * y * t + c;\n out[6] = z * y * t + x * s;\n out[7] = 0;\n out[8] = x * z * t + y * s;\n out[9] = y * z * t - x * s;\n out[10] = z * z * t + c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\n * Creates a matrix from the given angle around the X axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotateX(dest, dest, rad);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\n\nexport function fromXRotation(out, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad); // Perform axis-specific matrix multiplication\n\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = c;\n out[6] = s;\n out[7] = 0;\n out[8] = 0;\n out[9] = -s;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\n * Creates a matrix from the given angle around the Y axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotateY(dest, dest, rad);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\n\nexport function fromYRotation(out, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad); // Perform axis-specific matrix multiplication\n\n out[0] = c;\n out[1] = 0;\n out[2] = -s;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = s;\n out[9] = 0;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\n * Creates a matrix from the given angle around the Z axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotateZ(dest, dest, rad);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\n\nexport function fromZRotation(out, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad); // Perform axis-specific matrix multiplication\n\n out[0] = c;\n out[1] = s;\n out[2] = 0;\n out[3] = 0;\n out[4] = -s;\n out[5] = c;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\n * Creates a matrix from a quaternion rotation and vector translation\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, vec);\n * let quatMat = mat4.create();\n * quat4.toMat4(quat, quatMat);\n * mat4.multiply(dest, quatMat);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {quat4} q Rotation quaternion\n * @param {ReadonlyVec3} v Translation vector\n * @returns {mat4} out\n */\n\nexport function fromRotationTranslation(out, q, v) {\n // Quaternion math\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var xy = x * y2;\n var xz = x * z2;\n var yy = y * y2;\n var yz = y * z2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n out[0] = 1 - (yy + zz);\n out[1] = xy + wz;\n out[2] = xz - wy;\n out[3] = 0;\n out[4] = xy - wz;\n out[5] = 1 - (xx + zz);\n out[6] = yz + wx;\n out[7] = 0;\n out[8] = xz + wy;\n out[9] = yz - wx;\n out[10] = 1 - (xx + yy);\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n/**\n * Creates a new mat4 from a dual quat.\n *\n * @param {mat4} out Matrix\n * @param {ReadonlyQuat2} a Dual Quaternion\n * @returns {mat4} mat4 receiving operation result\n */\n\nexport function fromQuat2(out, a) {\n var translation = new glMatrix.ARRAY_TYPE(3);\n var bx = -a[0],\n by = -a[1],\n bz = -a[2],\n bw = a[3],\n ax = a[4],\n ay = a[5],\n az = a[6],\n aw = a[7];\n var magnitude = bx * bx + by * by + bz * bz + bw * bw; //Only scale if it makes sense\n\n if (magnitude > 0) {\n translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2 / magnitude;\n translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2 / magnitude;\n translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2 / magnitude;\n } else {\n translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\n translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\n translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\n }\n\n fromRotationTranslation(out, a, translation);\n return out;\n}\n/**\n * Returns the translation vector component of a transformation\n * matrix. If a matrix is built with fromRotationTranslation,\n * the returned vector will be the same as the translation vector\n * originally supplied.\n * @param {vec3} out Vector to receive translation component\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\n * @return {vec3} out\n */\n\nexport function getTranslation(out, mat) {\n out[0] = mat[12];\n out[1] = mat[13];\n out[2] = mat[14];\n return out;\n}\n/**\n * Returns the scaling factor component of a transformation\n * matrix. If a matrix is built with fromRotationTranslationScale\n * with a normalized Quaternion paramter, the returned vector will be\n * the same as the scaling vector\n * originally supplied.\n * @param {vec3} out Vector to receive scaling factor component\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\n * @return {vec3} out\n */\n\nexport function getScaling(out, mat) {\n var m11 = mat[0];\n var m12 = mat[1];\n var m13 = mat[2];\n var m21 = mat[4];\n var m22 = mat[5];\n var m23 = mat[6];\n var m31 = mat[8];\n var m32 = mat[9];\n var m33 = mat[10];\n out[0] = Math.hypot(m11, m12, m13);\n out[1] = Math.hypot(m21, m22, m23);\n out[2] = Math.hypot(m31, m32, m33);\n return out;\n}\n/**\n * Returns a quaternion representing the rotational component\n * of a transformation matrix. If a matrix is built with\n * fromRotationTranslation, the returned quaternion will be the\n * same as the quaternion originally supplied.\n * @param {quat} out Quaternion to receive the rotation component\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\n * @return {quat} out\n */\n\nexport function getRotation(out, mat) {\n var scaling = new glMatrix.ARRAY_TYPE(3);\n getScaling(scaling, mat);\n var is1 = 1 / scaling[0];\n var is2 = 1 / scaling[1];\n var is3 = 1 / scaling[2];\n var sm11 = mat[0] * is1;\n var sm12 = mat[1] * is2;\n var sm13 = mat[2] * is3;\n var sm21 = mat[4] * is1;\n var sm22 = mat[5] * is2;\n var sm23 = mat[6] * is3;\n var sm31 = mat[8] * is1;\n var sm32 = mat[9] * is2;\n var sm33 = mat[10] * is3;\n var trace = sm11 + sm22 + sm33;\n var S = 0;\n\n if (trace > 0) {\n S = Math.sqrt(trace + 1.0) * 2;\n out[3] = 0.25 * S;\n out[0] = (sm23 - sm32) / S;\n out[1] = (sm31 - sm13) / S;\n out[2] = (sm12 - sm21) / S;\n } else if (sm11 > sm22 && sm11 > sm33) {\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\n out[3] = (sm23 - sm32) / S;\n out[0] = 0.25 * S;\n out[1] = (sm12 + sm21) / S;\n out[2] = (sm31 + sm13) / S;\n } else if (sm22 > sm33) {\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\n out[3] = (sm31 - sm13) / S;\n out[0] = (sm12 + sm21) / S;\n out[1] = 0.25 * S;\n out[2] = (sm23 + sm32) / S;\n } else {\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\n out[3] = (sm12 - sm21) / S;\n out[0] = (sm31 + sm13) / S;\n out[1] = (sm23 + sm32) / S;\n out[2] = 0.25 * S;\n }\n\n return out;\n}\n/**\n * Creates a matrix from a quaternion rotation, vector translation and vector scale\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, vec);\n * let quatMat = mat4.create();\n * quat4.toMat4(quat, quatMat);\n * mat4.multiply(dest, quatMat);\n * mat4.scale(dest, scale)\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {quat4} q Rotation quaternion\n * @param {ReadonlyVec3} v Translation vector\n * @param {ReadonlyVec3} s Scaling vector\n * @returns {mat4} out\n */\n\nexport function fromRotationTranslationScale(out, q, v, s) {\n // Quaternion math\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var xy = x * y2;\n var xz = x * z2;\n var yy = y * y2;\n var yz = y * z2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n var sx = s[0];\n var sy = s[1];\n var sz = s[2];\n out[0] = (1 - (yy + zz)) * sx;\n out[1] = (xy + wz) * sx;\n out[2] = (xz - wy) * sx;\n out[3] = 0;\n out[4] = (xy - wz) * sy;\n out[5] = (1 - (xx + zz)) * sy;\n out[6] = (yz + wx) * sy;\n out[7] = 0;\n out[8] = (xz + wy) * sz;\n out[9] = (yz - wx) * sz;\n out[10] = (1 - (xx + yy)) * sz;\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n/**\n * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, vec);\n * mat4.translate(dest, origin);\n * let quatMat = mat4.create();\n * quat4.toMat4(quat, quatMat);\n * mat4.multiply(dest, quatMat);\n * mat4.scale(dest, scale)\n * mat4.translate(dest, negativeOrigin);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {quat4} q Rotation quaternion\n * @param {ReadonlyVec3} v Translation vector\n * @param {ReadonlyVec3} s Scaling vector\n * @param {ReadonlyVec3} o The origin vector around which to scale and rotate\n * @returns {mat4} out\n */\n\nexport function fromRotationTranslationScaleOrigin(out, q, v, s, o) {\n // Quaternion math\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var xy = x * y2;\n var xz = x * z2;\n var yy = y * y2;\n var yz = y * z2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n var sx = s[0];\n var sy = s[1];\n var sz = s[2];\n var ox = o[0];\n var oy = o[1];\n var oz = o[2];\n var out0 = (1 - (yy + zz)) * sx;\n var out1 = (xy + wz) * sx;\n var out2 = (xz - wy) * sx;\n var out4 = (xy - wz) * sy;\n var out5 = (1 - (xx + zz)) * sy;\n var out6 = (yz + wx) * sy;\n var out8 = (xz + wy) * sz;\n var out9 = (yz - wx) * sz;\n var out10 = (1 - (xx + yy)) * sz;\n out[0] = out0;\n out[1] = out1;\n out[2] = out2;\n out[3] = 0;\n out[4] = out4;\n out[5] = out5;\n out[6] = out6;\n out[7] = 0;\n out[8] = out8;\n out[9] = out9;\n out[10] = out10;\n out[11] = 0;\n out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz);\n out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz);\n out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz);\n out[15] = 1;\n return out;\n}\n/**\n * Calculates a 4x4 matrix from the given quaternion\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {ReadonlyQuat} q Quaternion to create matrix from\n *\n * @returns {mat4} out\n */\n\nexport function fromQuat(out, q) {\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var yx = y * x2;\n var yy = y * y2;\n var zx = z * x2;\n var zy = z * y2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n out[0] = 1 - yy - zz;\n out[1] = yx + wz;\n out[2] = zx - wy;\n out[3] = 0;\n out[4] = yx - wz;\n out[5] = 1 - xx - zz;\n out[6] = zy + wx;\n out[7] = 0;\n out[8] = zx + wy;\n out[9] = zy - wx;\n out[10] = 1 - xx - yy;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\n * Generates a frustum matrix with the given bounds\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {Number} left Left bound of the frustum\n * @param {Number} right Right bound of the frustum\n * @param {Number} bottom Bottom bound of the frustum\n * @param {Number} top Top bound of the frustum\n * @param {Number} near Near bound of the frustum\n * @param {Number} far Far bound of the frustum\n * @returns {mat4} out\n */\n\nexport function frustum(out, left, right, bottom, top, near, far) {\n var rl = 1 / (right - left);\n var tb = 1 / (top - bottom);\n var nf = 1 / (near - far);\n out[0] = near * 2 * rl;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = near * 2 * tb;\n out[6] = 0;\n out[7] = 0;\n out[8] = (right + left) * rl;\n out[9] = (top + bottom) * tb;\n out[10] = (far + near) * nf;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[14] = far * near * 2 * nf;\n out[15] = 0;\n return out;\n}\n/**\n * Generates a perspective projection matrix with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\n * which matches WebGL/OpenGL's clip volume.\n * Passing null/undefined/no value for far will generate infinite projection matrix.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} fovy Vertical field of view in radians\n * @param {number} aspect Aspect ratio. typically viewport width/height\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum, can be null or Infinity\n * @returns {mat4} out\n */\n\nexport function perspectiveNO(out, fovy, aspect, near, far) {\n var f = 1.0 / Math.tan(fovy / 2),\n nf;\n out[0] = f / aspect;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = f;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[15] = 0;\n\n if (far != null && far !== Infinity) {\n nf = 1 / (near - far);\n out[10] = (far + near) * nf;\n out[14] = 2 * far * near * nf;\n } else {\n out[10] = -1;\n out[14] = -2 * near;\n }\n\n return out;\n}\n/**\n * Alias for {@link mat4.perspectiveNO}\n * @function\n */\n\nexport var perspective = perspectiveNO;\n/**\n * Generates a perspective projection matrix suitable for WebGPU with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\n * Passing null/undefined/no value for far will generate infinite projection matrix.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} fovy Vertical field of view in radians\n * @param {number} aspect Aspect ratio. typically viewport width/height\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum, can be null or Infinity\n * @returns {mat4} out\n */\n\nexport function perspectiveZO(out, fovy, aspect, near, far) {\n var f = 1.0 / Math.tan(fovy / 2),\n nf;\n out[0] = f / aspect;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = f;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[15] = 0;\n\n if (far != null && far !== Infinity) {\n nf = 1 / (near - far);\n out[10] = far * nf;\n out[14] = far * near * nf;\n } else {\n out[10] = -1;\n out[14] = -near;\n }\n\n return out;\n}\n/**\n * Generates a perspective projection matrix with the given field of view.\n * This is primarily useful for generating projection matrices to be used\n * with the still experiemental WebVR API.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {Object} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum\n * @returns {mat4} out\n */\n\nexport function perspectiveFromFieldOfView(out, fov, near, far) {\n var upTan = Math.tan(fov.upDegrees * Math.PI / 180.0);\n var downTan = Math.tan(fov.downDegrees * Math.PI / 180.0);\n var leftTan = Math.tan(fov.leftDegrees * Math.PI / 180.0);\n var rightTan = Math.tan(fov.rightDegrees * Math.PI / 180.0);\n var xScale = 2.0 / (leftTan + rightTan);\n var yScale = 2.0 / (upTan + downTan);\n out[0] = xScale;\n out[1] = 0.0;\n out[2] = 0.0;\n out[3] = 0.0;\n out[4] = 0.0;\n out[5] = yScale;\n out[6] = 0.0;\n out[7] = 0.0;\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\n out[9] = (upTan - downTan) * yScale * 0.5;\n out[10] = far / (near - far);\n out[11] = -1.0;\n out[12] = 0.0;\n out[13] = 0.0;\n out[14] = far * near / (near - far);\n out[15] = 0.0;\n return out;\n}\n/**\n * Generates a orthogonal projection matrix with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\n * which matches WebGL/OpenGL's clip volume.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} left Left bound of the frustum\n * @param {number} right Right bound of the frustum\n * @param {number} bottom Bottom bound of the frustum\n * @param {number} top Top bound of the frustum\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum\n * @returns {mat4} out\n */\n\nexport function orthoNO(out, left, right, bottom, top, near, far) {\n var lr = 1 / (left - right);\n var bt = 1 / (bottom - top);\n var nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 2 * nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = (far + near) * nf;\n out[15] = 1;\n return out;\n}\n/**\n * Alias for {@link mat4.orthoNO}\n * @function\n */\n\nexport var ortho = orthoNO;\n/**\n * Generates a orthogonal projection matrix with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} left Left bound of the frustum\n * @param {number} right Right bound of the frustum\n * @param {number} bottom Bottom bound of the frustum\n * @param {number} top Top bound of the frustum\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum\n * @returns {mat4} out\n */\n\nexport function orthoZO(out, left, right, bottom, top, near, far) {\n var lr = 1 / (left - right);\n var bt = 1 / (bottom - top);\n var nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = near * nf;\n out[15] = 1;\n return out;\n}\n/**\n * Generates a look-at matrix with the given eye position, focal point, and up axis.\n * If you want a matrix that actually makes an object look at another object, you should use targetTo instead.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {ReadonlyVec3} eye Position of the viewer\n * @param {ReadonlyVec3} center Point the viewer is looking at\n * @param {ReadonlyVec3} up vec3 pointing up\n * @returns {mat4} out\n */\n\nexport function lookAt(out, eye, center, up) {\n var x0, x1, x2, y0, y1, y2, z0, z1, z2, len;\n var eyex = eye[0];\n var eyey = eye[1];\n var eyez = eye[2];\n var upx = up[0];\n var upy = up[1];\n var upz = up[2];\n var centerx = center[0];\n var centery = center[1];\n var centerz = center[2];\n\n if (Math.abs(eyex - centerx) < glMatrix.EPSILON && Math.abs(eyey - centery) < glMatrix.EPSILON && Math.abs(eyez - centerz) < glMatrix.EPSILON) {\n return identity(out);\n }\n\n z0 = eyex - centerx;\n z1 = eyey - centery;\n z2 = eyez - centerz;\n len = 1 / Math.hypot(z0, z1, z2);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n x0 = upy * z2 - upz * z1;\n x1 = upz * z0 - upx * z2;\n x2 = upx * z1 - upy * z0;\n len = Math.hypot(x0, x1, x2);\n\n if (!len) {\n x0 = 0;\n x1 = 0;\n x2 = 0;\n } else {\n len = 1 / len;\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n\n y0 = z1 * x2 - z2 * x1;\n y1 = z2 * x0 - z0 * x2;\n y2 = z0 * x1 - z1 * x0;\n len = Math.hypot(y0, y1, y2);\n\n if (!len) {\n y0 = 0;\n y1 = 0;\n y2 = 0;\n } else {\n len = 1 / len;\n y0 *= len;\n y1 *= len;\n y2 *= len;\n }\n\n out[0] = x0;\n out[1] = y0;\n out[2] = z0;\n out[3] = 0;\n out[4] = x1;\n out[5] = y1;\n out[6] = z1;\n out[7] = 0;\n out[8] = x2;\n out[9] = y2;\n out[10] = z2;\n out[11] = 0;\n out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\n out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\n out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\n out[15] = 1;\n return out;\n}\n/**\n * Generates a matrix that makes something look at something else.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {ReadonlyVec3} eye Position of the viewer\n * @param {ReadonlyVec3} center Point the viewer is looking at\n * @param {ReadonlyVec3} up vec3 pointing up\n * @returns {mat4} out\n */\n\nexport function targetTo(out, eye, target, up) {\n var eyex = eye[0],\n eyey = eye[1],\n eyez = eye[2],\n upx = up[0],\n upy = up[1],\n upz = up[2];\n var z0 = eyex - target[0],\n z1 = eyey - target[1],\n z2 = eyez - target[2];\n var len = z0 * z0 + z1 * z1 + z2 * z2;\n\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n }\n\n var x0 = upy * z2 - upz * z1,\n x1 = upz * z0 - upx * z2,\n x2 = upx * z1 - upy * z0;\n len = x0 * x0 + x1 * x1 + x2 * x2;\n\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n\n out[0] = x0;\n out[1] = x1;\n out[2] = x2;\n out[3] = 0;\n out[4] = z1 * x2 - z2 * x1;\n out[5] = z2 * x0 - z0 * x2;\n out[6] = z0 * x1 - z1 * x0;\n out[7] = 0;\n out[8] = z0;\n out[9] = z1;\n out[10] = z2;\n out[11] = 0;\n out[12] = eyex;\n out[13] = eyey;\n out[14] = eyez;\n out[15] = 1;\n return out;\n}\n/**\n * Returns a string representation of a mat4\n *\n * @param {ReadonlyMat4} a matrix to represent as a string\n * @returns {String} string representation of the matrix\n */\n\nexport function str(a) {\n return \"mat4(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \", \" + a[3] + \", \" + a[4] + \", \" + a[5] + \", \" + a[6] + \", \" + a[7] + \", \" + a[8] + \", \" + a[9] + \", \" + a[10] + \", \" + a[11] + \", \" + a[12] + \", \" + a[13] + \", \" + a[14] + \", \" + a[15] + \")\";\n}\n/**\n * Returns Frobenius norm of a mat4\n *\n * @param {ReadonlyMat4} a the matrix to calculate Frobenius norm of\n * @returns {Number} Frobenius norm\n */\n\nexport function frob(a) {\n return Math.hypot(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15]);\n}\n/**\n * Adds two mat4's\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the first operand\n * @param {ReadonlyMat4} b the second operand\n * @returns {mat4} out\n */\n\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n out[6] = a[6] + b[6];\n out[7] = a[7] + b[7];\n out[8] = a[8] + b[8];\n out[9] = a[9] + b[9];\n out[10] = a[10] + b[10];\n out[11] = a[11] + b[11];\n out[12] = a[12] + b[12];\n out[13] = a[13] + b[13];\n out[14] = a[14] + b[14];\n out[15] = a[15] + b[15];\n return out;\n}\n/**\n * Subtracts matrix b from matrix a\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the first operand\n * @param {ReadonlyMat4} b the second operand\n * @returns {mat4} out\n */\n\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n out[4] = a[4] - b[4];\n out[5] = a[5] - b[5];\n out[6] = a[6] - b[6];\n out[7] = a[7] - b[7];\n out[8] = a[8] - b[8];\n out[9] = a[9] - b[9];\n out[10] = a[10] - b[10];\n out[11] = a[11] - b[11];\n out[12] = a[12] - b[12];\n out[13] = a[13] - b[13];\n out[14] = a[14] - b[14];\n out[15] = a[15] - b[15];\n return out;\n}\n/**\n * Multiply each element of the matrix by a scalar.\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to scale\n * @param {Number} b amount to scale the matrix's elements by\n * @returns {mat4} out\n */\n\nexport function multiplyScalar(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n out[6] = a[6] * b;\n out[7] = a[7] * b;\n out[8] = a[8] * b;\n out[9] = a[9] * b;\n out[10] = a[10] * b;\n out[11] = a[11] * b;\n out[12] = a[12] * b;\n out[13] = a[13] * b;\n out[14] = a[14] * b;\n out[15] = a[15] * b;\n return out;\n}\n/**\n * Adds two mat4's after multiplying each element of the second operand by a scalar value.\n *\n * @param {mat4} out the receiving vector\n * @param {ReadonlyMat4} a the first operand\n * @param {ReadonlyMat4} b the second operand\n * @param {Number} scale the amount to scale b's elements by before adding\n * @returns {mat4} out\n */\n\nexport function multiplyScalarAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n out[4] = a[4] + b[4] * scale;\n out[5] = a[5] + b[5] * scale;\n out[6] = a[6] + b[6] * scale;\n out[7] = a[7] + b[7] * scale;\n out[8] = a[8] + b[8] * scale;\n out[9] = a[9] + b[9] * scale;\n out[10] = a[10] + b[10] * scale;\n out[11] = a[11] + b[11] * scale;\n out[12] = a[12] + b[12] * scale;\n out[13] = a[13] + b[13] * scale;\n out[14] = a[14] + b[14] * scale;\n out[15] = a[15] + b[15] * scale;\n return out;\n}\n/**\n * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)\n *\n * @param {ReadonlyMat4} a The first matrix.\n * @param {ReadonlyMat4} b The second matrix.\n * @returns {Boolean} True if the matrices are equal, false otherwise.\n */\n\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8] && a[9] === b[9] && a[10] === b[10] && a[11] === b[11] && a[12] === b[12] && a[13] === b[13] && a[14] === b[14] && a[15] === b[15];\n}\n/**\n * Returns whether or not the matrices have approximately the same elements in the same position.\n *\n * @param {ReadonlyMat4} a The first matrix.\n * @param {ReadonlyMat4} b The second matrix.\n * @returns {Boolean} True if the matrices are equal, false otherwise.\n */\n\nexport function equals(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var a4 = a[4],\n a5 = a[5],\n a6 = a[6],\n a7 = a[7];\n var a8 = a[8],\n a9 = a[9],\n a10 = a[10],\n a11 = a[11];\n var a12 = a[12],\n a13 = a[13],\n a14 = a[14],\n a15 = a[15];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3];\n var b4 = b[4],\n b5 = b[5],\n b6 = b[6],\n b7 = b[7];\n var b8 = b[8],\n b9 = b[9],\n b10 = b[10],\n b11 = b[11];\n var b12 = b[12],\n b13 = b[13],\n b14 = b[14],\n b15 = b[15];\n return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a8), Math.abs(b8)) && Math.abs(a9 - b9) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a9), Math.abs(b9)) && Math.abs(a10 - b10) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a10), Math.abs(b10)) && Math.abs(a11 - b11) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a11), Math.abs(b11)) && Math.abs(a12 - b12) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a12), Math.abs(b12)) && Math.abs(a13 - b13) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a13), Math.abs(b13)) && Math.abs(a14 - b14) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a14), Math.abs(b14)) && Math.abs(a15 - b15) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a15), Math.abs(b15));\n}\n/**\n * Alias for {@link mat4.multiply}\n * @function\n */\n\nexport var mul = multiply;\n/**\n * Alias for {@link mat4.subtract}\n * @function\n */\n\nexport var sub = subtract;","import * as glMatrix from \"./common.js\";\n/**\n * 3 Dimensional Vector\n * @module vec3\n */\n\n/**\n * Creates a new, empty vec3\n *\n * @returns {vec3} a new 3D vector\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(3);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n }\n\n return out;\n}\n/**\n * Creates a new vec3 initialized with values from an existing vector\n *\n * @param {ReadonlyVec3} a vector to clone\n * @returns {vec3} a new 3D vector\n */\n\nexport function clone(a) {\n var out = new glMatrix.ARRAY_TYPE(3);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n}\n/**\n * Calculates the length of a vec3\n *\n * @param {ReadonlyVec3} a vector to calculate length of\n * @returns {Number} length of a\n */\n\nexport function length(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n return Math.hypot(x, y, z);\n}\n/**\n * Creates a new vec3 initialized with the given values\n *\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @returns {vec3} a new 3D vector\n */\n\nexport function fromValues(x, y, z) {\n var out = new glMatrix.ARRAY_TYPE(3);\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n}\n/**\n * Copy the values from one vec3 to another\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the source vector\n * @returns {vec3} out\n */\n\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n}\n/**\n * Set the components of a vec3 to the given values\n *\n * @param {vec3} out the receiving vector\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @returns {vec3} out\n */\n\nexport function set(out, x, y, z) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n}\n/**\n * Adds two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\n\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n return out;\n}\n/**\n * Subtracts vector b from vector a\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\n\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n return out;\n}\n/**\n * Multiplies two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\n\nexport function multiply(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n return out;\n}\n/**\n * Divides two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\n\nexport function divide(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n return out;\n}\n/**\n * Math.ceil the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a vector to ceil\n * @returns {vec3} out\n */\n\nexport function ceil(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n out[2] = Math.ceil(a[2]);\n return out;\n}\n/**\n * Math.floor the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a vector to floor\n * @returns {vec3} out\n */\n\nexport function floor(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n out[2] = Math.floor(a[2]);\n return out;\n}\n/**\n * Returns the minimum of two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\n\nexport function min(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n return out;\n}\n/**\n * Returns the maximum of two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\n\nexport function max(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n return out;\n}\n/**\n * Math.round the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a vector to round\n * @returns {vec3} out\n */\n\nexport function round(out, a) {\n out[0] = Math.round(a[0]);\n out[1] = Math.round(a[1]);\n out[2] = Math.round(a[2]);\n return out;\n}\n/**\n * Scales a vec3 by a scalar number\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the vector to scale\n * @param {Number} b amount to scale the vector by\n * @returns {vec3} out\n */\n\nexport function scale(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n return out;\n}\n/**\n * Adds two vec3's after scaling the second operand by a scalar value\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @param {Number} scale the amount to scale b by before adding\n * @returns {vec3} out\n */\n\nexport function scaleAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n return out;\n}\n/**\n * Calculates the euclidian distance between two vec3's\n *\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {Number} distance between a and b\n */\n\nexport function distance(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n return Math.hypot(x, y, z);\n}\n/**\n * Calculates the squared euclidian distance between two vec3's\n *\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {Number} squared distance between a and b\n */\n\nexport function squaredDistance(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n return x * x + y * y + z * z;\n}\n/**\n * Calculates the squared length of a vec3\n *\n * @param {ReadonlyVec3} a vector to calculate squared length of\n * @returns {Number} squared length of a\n */\n\nexport function squaredLength(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n return x * x + y * y + z * z;\n}\n/**\n * Negates the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a vector to negate\n * @returns {vec3} out\n */\n\nexport function negate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n return out;\n}\n/**\n * Returns the inverse of the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a vector to invert\n * @returns {vec3} out\n */\n\nexport function inverse(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n out[2] = 1.0 / a[2];\n return out;\n}\n/**\n * Normalize a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a vector to normalize\n * @returns {vec3} out\n */\n\nexport function normalize(out, a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var len = x * x + y * y + z * z;\n\n if (len > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len = 1 / Math.sqrt(len);\n }\n\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n out[2] = a[2] * len;\n return out;\n}\n/**\n * Calculates the dot product of two vec3's\n *\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {Number} dot product of a and b\n */\n\nexport function dot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n}\n/**\n * Computes the cross product of two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\n\nexport function cross(out, a, b) {\n var ax = a[0],\n ay = a[1],\n az = a[2];\n var bx = b[0],\n by = b[1],\n bz = b[2];\n out[0] = ay * bz - az * by;\n out[1] = az * bx - ax * bz;\n out[2] = ax * by - ay * bx;\n return out;\n}\n/**\n * Performs a linear interpolation between two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {vec3} out\n */\n\nexport function lerp(out, a, b, t) {\n var ax = a[0];\n var ay = a[1];\n var az = a[2];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n return out;\n}\n/**\n * Performs a hermite interpolation with two control points\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @param {ReadonlyVec3} c the third operand\n * @param {ReadonlyVec3} d the fourth operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {vec3} out\n */\n\nexport function hermite(out, a, b, c, d, t) {\n var factorTimes2 = t * t;\n var factor1 = factorTimes2 * (2 * t - 3) + 1;\n var factor2 = factorTimes2 * (t - 2) + t;\n var factor3 = factorTimes2 * (t - 1);\n var factor4 = factorTimes2 * (3 - 2 * t);\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n return out;\n}\n/**\n * Performs a bezier interpolation with two control points\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @param {ReadonlyVec3} c the third operand\n * @param {ReadonlyVec3} d the fourth operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {vec3} out\n */\n\nexport function bezier(out, a, b, c, d, t) {\n var inverseFactor = 1 - t;\n var inverseFactorTimesTwo = inverseFactor * inverseFactor;\n var factorTimes2 = t * t;\n var factor1 = inverseFactorTimesTwo * inverseFactor;\n var factor2 = 3 * t * inverseFactorTimesTwo;\n var factor3 = 3 * factorTimes2 * inverseFactor;\n var factor4 = factorTimes2 * t;\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n return out;\n}\n/**\n * Generates a random vector with the given scale\n *\n * @param {vec3} out the receiving vector\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\n * @returns {vec3} out\n */\n\nexport function random(out, scale) {\n scale = scale || 1.0;\n var r = glMatrix.RANDOM() * 2.0 * Math.PI;\n var z = glMatrix.RANDOM() * 2.0 - 1.0;\n var zScale = Math.sqrt(1.0 - z * z) * scale;\n out[0] = Math.cos(r) * zScale;\n out[1] = Math.sin(r) * zScale;\n out[2] = z * scale;\n return out;\n}\n/**\n * Transforms the vec3 with a mat4.\n * 4th vector component is implicitly '1'\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the vector to transform\n * @param {ReadonlyMat4} m matrix to transform with\n * @returns {vec3} out\n */\n\nexport function transformMat4(out, a, m) {\n var x = a[0],\n y = a[1],\n z = a[2];\n var w = m[3] * x + m[7] * y + m[11] * z + m[15];\n w = w || 1.0;\n out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n return out;\n}\n/**\n * Transforms the vec3 with a mat3.\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the vector to transform\n * @param {ReadonlyMat3} m the 3x3 matrix to transform with\n * @returns {vec3} out\n */\n\nexport function transformMat3(out, a, m) {\n var x = a[0],\n y = a[1],\n z = a[2];\n out[0] = x * m[0] + y * m[3] + z * m[6];\n out[1] = x * m[1] + y * m[4] + z * m[7];\n out[2] = x * m[2] + y * m[5] + z * m[8];\n return out;\n}\n/**\n * Transforms the vec3 with a quat\n * Can also be used for dual quaternions. (Multiply it with the real part)\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the vector to transform\n * @param {ReadonlyQuat} q quaternion to transform with\n * @returns {vec3} out\n */\n\nexport function transformQuat(out, a, q) {\n // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed\n var qx = q[0],\n qy = q[1],\n qz = q[2],\n qw = q[3];\n var x = a[0],\n y = a[1],\n z = a[2]; // var qvec = [qx, qy, qz];\n // var uv = vec3.cross([], qvec, a);\n\n var uvx = qy * z - qz * y,\n uvy = qz * x - qx * z,\n uvz = qx * y - qy * x; // var uuv = vec3.cross([], qvec, uv);\n\n var uuvx = qy * uvz - qz * uvy,\n uuvy = qz * uvx - qx * uvz,\n uuvz = qx * uvy - qy * uvx; // vec3.scale(uv, uv, 2 * w);\n\n var w2 = qw * 2;\n uvx *= w2;\n uvy *= w2;\n uvz *= w2; // vec3.scale(uuv, uuv, 2);\n\n uuvx *= 2;\n uuvy *= 2;\n uuvz *= 2; // return vec3.add(out, a, vec3.add(out, uv, uuv));\n\n out[0] = x + uvx + uuvx;\n out[1] = y + uvy + uuvy;\n out[2] = z + uvz + uuvz;\n return out;\n}\n/**\n * Rotate a 3D vector around the x-axis\n * @param {vec3} out The receiving vec3\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @returns {vec3} out\n */\n\nexport function rotateX(out, a, b, rad) {\n var p = [],\n r = []; //Translate point to the origin\n\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2]; //perform rotation\n\n r[0] = p[0];\n r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad);\n r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad); //translate to correct position\n\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n return out;\n}\n/**\n * Rotate a 3D vector around the y-axis\n * @param {vec3} out The receiving vec3\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @returns {vec3} out\n */\n\nexport function rotateY(out, a, b, rad) {\n var p = [],\n r = []; //Translate point to the origin\n\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2]; //perform rotation\n\n r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad);\n r[1] = p[1];\n r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad); //translate to correct position\n\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n return out;\n}\n/**\n * Rotate a 3D vector around the z-axis\n * @param {vec3} out The receiving vec3\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @returns {vec3} out\n */\n\nexport function rotateZ(out, a, b, rad) {\n var p = [],\n r = []; //Translate point to the origin\n\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2]; //perform rotation\n\n r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad);\n r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad);\n r[2] = p[2]; //translate to correct position\n\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n return out;\n}\n/**\n * Get the angle between two 3D vectors\n * @param {ReadonlyVec3} a The first operand\n * @param {ReadonlyVec3} b The second operand\n * @returns {Number} The angle in radians\n */\n\nexport function angle(a, b) {\n var ax = a[0],\n ay = a[1],\n az = a[2],\n bx = b[0],\n by = b[1],\n bz = b[2],\n mag1 = Math.sqrt(ax * ax + ay * ay + az * az),\n mag2 = Math.sqrt(bx * bx + by * by + bz * bz),\n mag = mag1 * mag2,\n cosine = mag && dot(a, b) / mag;\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\n}\n/**\n * Set the components of a vec3 to zero\n *\n * @param {vec3} out the receiving vector\n * @returns {vec3} out\n */\n\nexport function zero(out) {\n out[0] = 0.0;\n out[1] = 0.0;\n out[2] = 0.0;\n return out;\n}\n/**\n * Returns a string representation of a vector\n *\n * @param {ReadonlyVec3} a vector to represent as a string\n * @returns {String} string representation of the vector\n */\n\nexport function str(a) {\n return \"vec3(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \")\";\n}\n/**\n * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)\n *\n * @param {ReadonlyVec3} a The first vector.\n * @param {ReadonlyVec3} b The second vector.\n * @returns {Boolean} True if the vectors are equal, false otherwise.\n */\n\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\n}\n/**\n * Returns whether or not the vectors have approximately the same elements in the same position.\n *\n * @param {ReadonlyVec3} a The first vector.\n * @param {ReadonlyVec3} b The second vector.\n * @returns {Boolean} True if the vectors are equal, false otherwise.\n */\n\nexport function equals(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2];\n return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2));\n}\n/**\n * Alias for {@link vec3.subtract}\n * @function\n */\n\nexport var sub = subtract;\n/**\n * Alias for {@link vec3.multiply}\n * @function\n */\n\nexport var mul = multiply;\n/**\n * Alias for {@link vec3.divide}\n * @function\n */\n\nexport var div = divide;\n/**\n * Alias for {@link vec3.distance}\n * @function\n */\n\nexport var dist = distance;\n/**\n * Alias for {@link vec3.squaredDistance}\n * @function\n */\n\nexport var sqrDist = squaredDistance;\n/**\n * Alias for {@link vec3.length}\n * @function\n */\n\nexport var len = length;\n/**\n * Alias for {@link vec3.squaredLength}\n * @function\n */\n\nexport var sqrLen = squaredLength;\n/**\n * Perform some operation over an array of vec3s.\n *\n * @param {Array} a the array of vectors to iterate over\n * @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed\n * @param {Number} offset Number of elements to skip at the beginning of the array\n * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array\n * @param {Function} fn Function to call for each vector in the array\n * @param {Object} [arg] additional argument to pass to fn\n * @returns {Array} a\n * @function\n */\n\nexport var forEach = function () {\n var vec = create();\n return function (a, stride, offset, count, fn, arg) {\n var i, l;\n\n if (!stride) {\n stride = 3;\n }\n\n if (!offset) {\n offset = 0;\n }\n\n if (count) {\n l = Math.min(count * stride + offset, a.length);\n } else {\n l = a.length;\n }\n\n for (i = offset; i < l; i += stride) {\n vec[0] = a[i];\n vec[1] = a[i + 1];\n vec[2] = a[i + 2];\n fn(vec, vec, arg);\n a[i] = vec[0];\n a[i + 1] = vec[1];\n a[i + 2] = vec[2];\n }\n\n return a;\n };\n}();","// DEFLATE is a complex format; to read this code, you should probably check the RFC first:\n// https://tools.ietf.org/html/rfc1951\n// You may also wish to take a look at the guide I made about this program:\n// https://gist.github.com/101arrowz/253f31eb5abc3d9275ab943003ffecad\n// Some of the following code is similar to that of UZIP.js:\n// https://github.com/photopea/UZIP.js\n// However, the vast majority of the codebase has diverged from UZIP.js to increase performance and reduce bundle size.\n// Sometimes 0 will appear where -1 would be more appropriate. This is because using a uint\n// is better for memory in most engines (I *think*).\nvar ch2 = {};\nvar wk = (function (c, id, msg, transfer, cb) {\n var w = new Worker(ch2[id] || (ch2[id] = URL.createObjectURL(new Blob([\n c + ';addEventListener(\"error\",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'\n ], { type: 'text/javascript' }))));\n w.onmessage = function (e) {\n var d = e.data, ed = d.$e$;\n if (ed) {\n var err = new Error(ed[0]);\n err['code'] = ed[1];\n err.stack = ed[2];\n cb(err, null);\n }\n else\n cb(null, d);\n };\n w.postMessage(msg, transfer);\n return w;\n});\n\n// aliases for shorter compressed code (most minifers don't do this)\nvar u8 = Uint8Array, u16 = Uint16Array, u32 = Uint32Array;\n// fixed length extra bits\nvar fleb = new u8([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, /* unused */ 0, 0, /* impossible */ 0]);\n// fixed distance extra bits\n// see fleb note\nvar fdeb = new u8([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, /* unused */ 0, 0]);\n// code length index map\nvar clim = new u8([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);\n// get base, reverse index map from extra bits\nvar freb = function (eb, start) {\n var b = new u16(31);\n for (var i = 0; i < 31; ++i) {\n b[i] = start += 1 << eb[i - 1];\n }\n // numbers here are at max 18 bits\n var r = new u32(b[30]);\n for (var i = 1; i < 30; ++i) {\n for (var j = b[i]; j < b[i + 1]; ++j) {\n r[j] = ((j - b[i]) << 5) | i;\n }\n }\n return [b, r];\n};\nvar _a = freb(fleb, 2), fl = _a[0], revfl = _a[1];\n// we can ignore the fact that the other numbers are wrong; they never happen anyway\nfl[28] = 258, revfl[258] = 28;\nvar _b = freb(fdeb, 0), fd = _b[0], revfd = _b[1];\n// map of value to reverse (assuming 16 bits)\nvar rev = new u16(32768);\nfor (var i = 0; i < 32768; ++i) {\n // reverse table algorithm from SO\n var x = ((i & 0xAAAA) >>> 1) | ((i & 0x5555) << 1);\n x = ((x & 0xCCCC) >>> 2) | ((x & 0x3333) << 2);\n x = ((x & 0xF0F0) >>> 4) | ((x & 0x0F0F) << 4);\n rev[i] = (((x & 0xFF00) >>> 8) | ((x & 0x00FF) << 8)) >>> 1;\n}\n// create huffman tree from u8 \"map\": index -> code length for code index\n// mb (max bits) must be at most 15\n// TODO: optimize/split up?\nvar hMap = (function (cd, mb, r) {\n var s = cd.length;\n // index\n var i = 0;\n // u16 \"map\": index -> # of codes with bit length = index\n var l = new u16(mb);\n // length of cd must be 288 (total # of codes)\n for (; i < s; ++i) {\n if (cd[i])\n ++l[cd[i] - 1];\n }\n // u16 \"map\": index -> minimum code for bit length = index\n var le = new u16(mb);\n for (i = 0; i < mb; ++i) {\n le[i] = (le[i - 1] + l[i - 1]) << 1;\n }\n var co;\n if (r) {\n // u16 \"map\": index -> number of actual bits, symbol for code\n co = new u16(1 << mb);\n // bits to remove for reverser\n var rvb = 15 - mb;\n for (i = 0; i < s; ++i) {\n // ignore 0 lengths\n if (cd[i]) {\n // num encoding both symbol and bits read\n var sv = (i << 4) | cd[i];\n // free bits\n var r_1 = mb - cd[i];\n // start value\n var v = le[cd[i] - 1]++ << r_1;\n // m is end value\n for (var m = v | ((1 << r_1) - 1); v <= m; ++v) {\n // every 16 bit value starting with the code yields the same result\n co[rev[v] >>> rvb] = sv;\n }\n }\n }\n }\n else {\n co = new u16(s);\n for (i = 0; i < s; ++i) {\n if (cd[i]) {\n co[i] = rev[le[cd[i] - 1]++] >>> (15 - cd[i]);\n }\n }\n }\n return co;\n});\n// fixed length tree\nvar flt = new u8(288);\nfor (var i = 0; i < 144; ++i)\n flt[i] = 8;\nfor (var i = 144; i < 256; ++i)\n flt[i] = 9;\nfor (var i = 256; i < 280; ++i)\n flt[i] = 7;\nfor (var i = 280; i < 288; ++i)\n flt[i] = 8;\n// fixed distance tree\nvar fdt = new u8(32);\nfor (var i = 0; i < 32; ++i)\n fdt[i] = 5;\n// fixed length map\nvar flm = /*#__PURE__*/ hMap(flt, 9, 0), flrm = /*#__PURE__*/ hMap(flt, 9, 1);\n// fixed distance map\nvar fdm = /*#__PURE__*/ hMap(fdt, 5, 0), fdrm = /*#__PURE__*/ hMap(fdt, 5, 1);\n// find max of array\nvar max = function (a) {\n var m = a[0];\n for (var i = 1; i < a.length; ++i) {\n if (a[i] > m)\n m = a[i];\n }\n return m;\n};\n// read d, starting at bit p and mask with m\nvar bits = function (d, p, m) {\n var o = (p / 8) | 0;\n return ((d[o] | (d[o + 1] << 8)) >> (p & 7)) & m;\n};\n// read d, starting at bit p continuing for at least 16 bits\nvar bits16 = function (d, p) {\n var o = (p / 8) | 0;\n return ((d[o] | (d[o + 1] << 8) | (d[o + 2] << 16)) >> (p & 7));\n};\n// get end of byte\nvar shft = function (p) { return ((p + 7) / 8) | 0; };\n// typed array slice - allows garbage collector to free original reference,\n// while being more compatible than .slice\nvar slc = function (v, s, e) {\n if (s == null || s < 0)\n s = 0;\n if (e == null || e > v.length)\n e = v.length;\n // can't use .constructor in case user-supplied\n var n = new (v.BYTES_PER_ELEMENT == 2 ? u16 : v.BYTES_PER_ELEMENT == 4 ? u32 : u8)(e - s);\n n.set(v.subarray(s, e));\n return n;\n};\n/**\n * Codes for errors generated within this library\n */\nexport var FlateErrorCode = {\n UnexpectedEOF: 0,\n InvalidBlockType: 1,\n InvalidLengthLiteral: 2,\n InvalidDistance: 3,\n StreamFinished: 4,\n NoStreamHandler: 5,\n InvalidHeader: 6,\n NoCallback: 7,\n InvalidUTF8: 8,\n ExtraFieldTooLong: 9,\n InvalidDate: 10,\n FilenameTooLong: 11,\n StreamFinishing: 12,\n InvalidZipData: 13,\n UnknownCompressionMethod: 14\n};\n// error codes\nvar ec = [\n 'unexpected EOF',\n 'invalid block type',\n 'invalid length/literal',\n 'invalid distance',\n 'stream finished',\n 'no stream handler',\n ,\n 'no callback',\n 'invalid UTF-8 data',\n 'extra field too long',\n 'date not in range 1980-2099',\n 'filename too long',\n 'stream finishing',\n 'invalid zip data'\n // determined by unknown compression method\n];\n;\nvar err = function (ind, msg, nt) {\n var e = new Error(msg || ec[ind]);\n e.code = ind;\n if (Error.captureStackTrace)\n Error.captureStackTrace(e, err);\n if (!nt)\n throw e;\n return e;\n};\n// expands raw DEFLATE data\nvar inflt = function (dat, buf, st) {\n // source length\n var sl = dat.length;\n if (!sl || (st && st.f && !st.l))\n return buf || new u8(0);\n // have to estimate size\n var noBuf = !buf || st;\n // no state\n var noSt = !st || st.i;\n if (!st)\n st = {};\n // Assumes roughly 33% compression ratio average\n if (!buf)\n buf = new u8(sl * 3);\n // ensure buffer can fit at least l elements\n var cbuf = function (l) {\n var bl = buf.length;\n // need to increase size to fit\n if (l > bl) {\n // Double or set to necessary, whichever is greater\n var nbuf = new u8(Math.max(bl * 2, l));\n nbuf.set(buf);\n buf = nbuf;\n }\n };\n // last chunk bitpos bytes\n var final = st.f || 0, pos = st.p || 0, bt = st.b || 0, lm = st.l, dm = st.d, lbt = st.m, dbt = st.n;\n // total bits\n var tbts = sl * 8;\n do {\n if (!lm) {\n // BFINAL - this is only 1 when last chunk is next\n final = bits(dat, pos, 1);\n // type: 0 = no compression, 1 = fixed huffman, 2 = dynamic huffman\n var type = bits(dat, pos + 1, 3);\n pos += 3;\n if (!type) {\n // go to end of byte boundary\n var s = shft(pos) + 4, l = dat[s - 4] | (dat[s - 3] << 8), t = s + l;\n if (t > sl) {\n if (noSt)\n err(0);\n break;\n }\n // ensure size\n if (noBuf)\n cbuf(bt + l);\n // Copy over uncompressed data\n buf.set(dat.subarray(s, t), bt);\n // Get new bitpos, update byte count\n st.b = bt += l, st.p = pos = t * 8, st.f = final;\n continue;\n }\n else if (type == 1)\n lm = flrm, dm = fdrm, lbt = 9, dbt = 5;\n else if (type == 2) {\n // literal lengths\n var hLit = bits(dat, pos, 31) + 257, hcLen = bits(dat, pos + 10, 15) + 4;\n var tl = hLit + bits(dat, pos + 5, 31) + 1;\n pos += 14;\n // length+distance tree\n var ldt = new u8(tl);\n // code length tree\n var clt = new u8(19);\n for (var i = 0; i < hcLen; ++i) {\n // use index map to get real code\n clt[clim[i]] = bits(dat, pos + i * 3, 7);\n }\n pos += hcLen * 3;\n // code lengths bits\n var clb = max(clt), clbmsk = (1 << clb) - 1;\n // code lengths map\n var clm = hMap(clt, clb, 1);\n for (var i = 0; i < tl;) {\n var r = clm[bits(dat, pos, clbmsk)];\n // bits read\n pos += r & 15;\n // symbol\n var s = r >>> 4;\n // code length to copy\n if (s < 16) {\n ldt[i++] = s;\n }\n else {\n // copy count\n var c = 0, n = 0;\n if (s == 16)\n n = 3 + bits(dat, pos, 3), pos += 2, c = ldt[i - 1];\n else if (s == 17)\n n = 3 + bits(dat, pos, 7), pos += 3;\n else if (s == 18)\n n = 11 + bits(dat, pos, 127), pos += 7;\n while (n--)\n ldt[i++] = c;\n }\n }\n // length tree distance tree\n var lt = ldt.subarray(0, hLit), dt = ldt.subarray(hLit);\n // max length bits\n lbt = max(lt);\n // max dist bits\n dbt = max(dt);\n lm = hMap(lt, lbt, 1);\n dm = hMap(dt, dbt, 1);\n }\n else\n err(1);\n if (pos > tbts) {\n if (noSt)\n err(0);\n break;\n }\n }\n // Make sure the buffer can hold this + the largest possible addition\n // Maximum chunk size (practically, theoretically infinite) is 2^17;\n if (noBuf)\n cbuf(bt + 131072);\n var lms = (1 << lbt) - 1, dms = (1 << dbt) - 1;\n var lpos = pos;\n for (;; lpos = pos) {\n // bits read, code\n var c = lm[bits16(dat, pos) & lms], sym = c >>> 4;\n pos += c & 15;\n if (pos > tbts) {\n if (noSt)\n err(0);\n break;\n }\n if (!c)\n err(2);\n if (sym < 256)\n buf[bt++] = sym;\n else if (sym == 256) {\n lpos = pos, lm = null;\n break;\n }\n else {\n var add = sym - 254;\n // no extra bits needed if less\n if (sym > 264) {\n // index\n var i = sym - 257, b = fleb[i];\n add = bits(dat, pos, (1 << b) - 1) + fl[i];\n pos += b;\n }\n // dist\n var d = dm[bits16(dat, pos) & dms], dsym = d >>> 4;\n if (!d)\n err(3);\n pos += d & 15;\n var dt = fd[dsym];\n if (dsym > 3) {\n var b = fdeb[dsym];\n dt += bits16(dat, pos) & ((1 << b) - 1), pos += b;\n }\n if (pos > tbts) {\n if (noSt)\n err(0);\n break;\n }\n if (noBuf)\n cbuf(bt + 131072);\n var end = bt + add;\n for (; bt < end; bt += 4) {\n buf[bt] = buf[bt - dt];\n buf[bt + 1] = buf[bt + 1 - dt];\n buf[bt + 2] = buf[bt + 2 - dt];\n buf[bt + 3] = buf[bt + 3 - dt];\n }\n bt = end;\n }\n }\n st.l = lm, st.p = lpos, st.b = bt, st.f = final;\n if (lm)\n final = 1, st.m = lbt, st.d = dm, st.n = dbt;\n } while (!final);\n return bt == buf.length ? buf : slc(buf, 0, bt);\n};\n// starting at p, write the minimum number of bits that can hold v to d\nvar wbits = function (d, p, v) {\n v <<= p & 7;\n var o = (p / 8) | 0;\n d[o] |= v;\n d[o + 1] |= v >>> 8;\n};\n// starting at p, write the minimum number of bits (>8) that can hold v to d\nvar wbits16 = function (d, p, v) {\n v <<= p & 7;\n var o = (p / 8) | 0;\n d[o] |= v;\n d[o + 1] |= v >>> 8;\n d[o + 2] |= v >>> 16;\n};\n// creates code lengths from a frequency table\nvar hTree = function (d, mb) {\n // Need extra info to make a tree\n var t = [];\n for (var i = 0; i < d.length; ++i) {\n if (d[i])\n t.push({ s: i, f: d[i] });\n }\n var s = t.length;\n var t2 = t.slice();\n if (!s)\n return [et, 0];\n if (s == 1) {\n var v = new u8(t[0].s + 1);\n v[t[0].s] = 1;\n return [v, 1];\n }\n t.sort(function (a, b) { return a.f - b.f; });\n // after i2 reaches last ind, will be stopped\n // freq must be greater than largest possible number of symbols\n t.push({ s: -1, f: 25001 });\n var l = t[0], r = t[1], i0 = 0, i1 = 1, i2 = 2;\n t[0] = { s: -1, f: l.f + r.f, l: l, r: r };\n // efficient algorithm from UZIP.js\n // i0 is lookbehind, i2 is lookahead - after processing two low-freq\n // symbols that combined have high freq, will start processing i2 (high-freq,\n // non-composite) symbols instead\n // see https://reddit.com/r/photopea/comments/ikekht/uzipjs_questions/\n while (i1 != s - 1) {\n l = t[t[i0].f < t[i2].f ? i0++ : i2++];\n r = t[i0 != i1 && t[i0].f < t[i2].f ? i0++ : i2++];\n t[i1++] = { s: -1, f: l.f + r.f, l: l, r: r };\n }\n var maxSym = t2[0].s;\n for (var i = 1; i < s; ++i) {\n if (t2[i].s > maxSym)\n maxSym = t2[i].s;\n }\n // code lengths\n var tr = new u16(maxSym + 1);\n // max bits in tree\n var mbt = ln(t[i1 - 1], tr, 0);\n if (mbt > mb) {\n // more algorithms from UZIP.js\n // TODO: find out how this code works (debt)\n // ind debt\n var i = 0, dt = 0;\n // left cost\n var lft = mbt - mb, cst = 1 << lft;\n t2.sort(function (a, b) { return tr[b.s] - tr[a.s] || a.f - b.f; });\n for (; i < s; ++i) {\n var i2_1 = t2[i].s;\n if (tr[i2_1] > mb) {\n dt += cst - (1 << (mbt - tr[i2_1]));\n tr[i2_1] = mb;\n }\n else\n break;\n }\n dt >>>= lft;\n while (dt > 0) {\n var i2_2 = t2[i].s;\n if (tr[i2_2] < mb)\n dt -= 1 << (mb - tr[i2_2]++ - 1);\n else\n ++i;\n }\n for (; i >= 0 && dt; --i) {\n var i2_3 = t2[i].s;\n if (tr[i2_3] == mb) {\n --tr[i2_3];\n ++dt;\n }\n }\n mbt = mb;\n }\n return [new u8(tr), mbt];\n};\n// get the max length and assign length codes\nvar ln = function (n, l, d) {\n return n.s == -1\n ? Math.max(ln(n.l, l, d + 1), ln(n.r, l, d + 1))\n : (l[n.s] = d);\n};\n// length codes generation\nvar lc = function (c) {\n var s = c.length;\n // Note that the semicolon was intentional\n while (s && !c[--s])\n ;\n var cl = new u16(++s);\n // ind num streak\n var cli = 0, cln = c[0], cls = 1;\n var w = function (v) { cl[cli++] = v; };\n for (var i = 1; i <= s; ++i) {\n if (c[i] == cln && i != s)\n ++cls;\n else {\n if (!cln && cls > 2) {\n for (; cls > 138; cls -= 138)\n w(32754);\n if (cls > 2) {\n w(cls > 10 ? ((cls - 11) << 5) | 28690 : ((cls - 3) << 5) | 12305);\n cls = 0;\n }\n }\n else if (cls > 3) {\n w(cln), --cls;\n for (; cls > 6; cls -= 6)\n w(8304);\n if (cls > 2)\n w(((cls - 3) << 5) | 8208), cls = 0;\n }\n while (cls--)\n w(cln);\n cls = 1;\n cln = c[i];\n }\n }\n return [cl.subarray(0, cli), s];\n};\n// calculate the length of output from tree, code lengths\nvar clen = function (cf, cl) {\n var l = 0;\n for (var i = 0; i < cl.length; ++i)\n l += cf[i] * cl[i];\n return l;\n};\n// writes a fixed block\n// returns the new bit pos\nvar wfblk = function (out, pos, dat) {\n // no need to write 00 as type: TypedArray defaults to 0\n var s = dat.length;\n var o = shft(pos + 2);\n out[o] = s & 255;\n out[o + 1] = s >>> 8;\n out[o + 2] = out[o] ^ 255;\n out[o + 3] = out[o + 1] ^ 255;\n for (var i = 0; i < s; ++i)\n out[o + i + 4] = dat[i];\n return (o + 4 + s) * 8;\n};\n// writes a block\nvar wblk = function (dat, out, final, syms, lf, df, eb, li, bs, bl, p) {\n wbits(out, p++, final);\n ++lf[256];\n var _a = hTree(lf, 15), dlt = _a[0], mlb = _a[1];\n var _b = hTree(df, 15), ddt = _b[0], mdb = _b[1];\n var _c = lc(dlt), lclt = _c[0], nlc = _c[1];\n var _d = lc(ddt), lcdt = _d[0], ndc = _d[1];\n var lcfreq = new u16(19);\n for (var i = 0; i < lclt.length; ++i)\n lcfreq[lclt[i] & 31]++;\n for (var i = 0; i < lcdt.length; ++i)\n lcfreq[lcdt[i] & 31]++;\n var _e = hTree(lcfreq, 7), lct = _e[0], mlcb = _e[1];\n var nlcc = 19;\n for (; nlcc > 4 && !lct[clim[nlcc - 1]]; --nlcc)\n ;\n var flen = (bl + 5) << 3;\n var ftlen = clen(lf, flt) + clen(df, fdt) + eb;\n var dtlen = clen(lf, dlt) + clen(df, ddt) + eb + 14 + 3 * nlcc + clen(lcfreq, lct) + (2 * lcfreq[16] + 3 * lcfreq[17] + 7 * lcfreq[18]);\n if (flen <= ftlen && flen <= dtlen)\n return wfblk(out, p, dat.subarray(bs, bs + bl));\n var lm, ll, dm, dl;\n wbits(out, p, 1 + (dtlen < ftlen)), p += 2;\n if (dtlen < ftlen) {\n lm = hMap(dlt, mlb, 0), ll = dlt, dm = hMap(ddt, mdb, 0), dl = ddt;\n var llm = hMap(lct, mlcb, 0);\n wbits(out, p, nlc - 257);\n wbits(out, p + 5, ndc - 1);\n wbits(out, p + 10, nlcc - 4);\n p += 14;\n for (var i = 0; i < nlcc; ++i)\n wbits(out, p + 3 * i, lct[clim[i]]);\n p += 3 * nlcc;\n var lcts = [lclt, lcdt];\n for (var it = 0; it < 2; ++it) {\n var clct = lcts[it];\n for (var i = 0; i < clct.length; ++i) {\n var len = clct[i] & 31;\n wbits(out, p, llm[len]), p += lct[len];\n if (len > 15)\n wbits(out, p, (clct[i] >>> 5) & 127), p += clct[i] >>> 12;\n }\n }\n }\n else {\n lm = flm, ll = flt, dm = fdm, dl = fdt;\n }\n for (var i = 0; i < li; ++i) {\n if (syms[i] > 255) {\n var len = (syms[i] >>> 18) & 31;\n wbits16(out, p, lm[len + 257]), p += ll[len + 257];\n if (len > 7)\n wbits(out, p, (syms[i] >>> 23) & 31), p += fleb[len];\n var dst = syms[i] & 31;\n wbits16(out, p, dm[dst]), p += dl[dst];\n if (dst > 3)\n wbits16(out, p, (syms[i] >>> 5) & 8191), p += fdeb[dst];\n }\n else {\n wbits16(out, p, lm[syms[i]]), p += ll[syms[i]];\n }\n }\n wbits16(out, p, lm[256]);\n return p + ll[256];\n};\n// deflate options (nice << 13) | chain\nvar deo = /*#__PURE__*/ new u32([65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632]);\n// empty\nvar et = /*#__PURE__*/ new u8(0);\n// compresses data into a raw DEFLATE buffer\nvar dflt = function (dat, lvl, plvl, pre, post, lst) {\n var s = dat.length;\n var o = new u8(pre + s + 5 * (1 + Math.ceil(s / 7000)) + post);\n // writing to this writes to the output buffer\n var w = o.subarray(pre, o.length - post);\n var pos = 0;\n if (!lvl || s < 8) {\n for (var i = 0; i <= s; i += 65535) {\n // end\n var e = i + 65535;\n if (e >= s) {\n // write final block\n w[pos >> 3] = lst;\n }\n pos = wfblk(w, pos + 1, dat.subarray(i, e));\n }\n }\n else {\n var opt = deo[lvl - 1];\n var n = opt >>> 13, c = opt & 8191;\n var msk_1 = (1 << plvl) - 1;\n // prev 2-byte val map curr 2-byte val map\n var prev = new u16(32768), head = new u16(msk_1 + 1);\n var bs1_1 = Math.ceil(plvl / 3), bs2_1 = 2 * bs1_1;\n var hsh = function (i) { return (dat[i] ^ (dat[i + 1] << bs1_1) ^ (dat[i + 2] << bs2_1)) & msk_1; };\n // 24576 is an arbitrary number of maximum symbols per block\n // 424 buffer for last block\n var syms = new u32(25000);\n // length/literal freq distance freq\n var lf = new u16(288), df = new u16(32);\n // l/lcnt exbits index l/lind waitdx bitpos\n var lc_1 = 0, eb = 0, i = 0, li = 0, wi = 0, bs = 0;\n for (; i < s; ++i) {\n // hash value\n // deopt when i > s - 3 - at end, deopt acceptable\n var hv = hsh(i);\n // index mod 32768 previous index mod\n var imod = i & 32767, pimod = head[hv];\n prev[imod] = pimod;\n head[hv] = imod;\n // We always should modify head and prev, but only add symbols if\n // this data is not yet processed (\"wait\" for wait index)\n if (wi <= i) {\n // bytes remaining\n var rem = s - i;\n if ((lc_1 > 7000 || li > 24576) && rem > 423) {\n pos = wblk(dat, w, 0, syms, lf, df, eb, li, bs, i - bs, pos);\n li = lc_1 = eb = 0, bs = i;\n for (var j = 0; j < 286; ++j)\n lf[j] = 0;\n for (var j = 0; j < 30; ++j)\n df[j] = 0;\n }\n // len dist chain\n var l = 2, d = 0, ch_1 = c, dif = (imod - pimod) & 32767;\n if (rem > 2 && hv == hsh(i - dif)) {\n var maxn = Math.min(n, rem) - 1;\n var maxd = Math.min(32767, i);\n // max possible length\n // not capped at dif because decompressors implement \"rolling\" index population\n var ml = Math.min(258, rem);\n while (dif <= maxd && --ch_1 && imod != pimod) {\n if (dat[i + l] == dat[i + l - dif]) {\n var nl = 0;\n for (; nl < ml && dat[i + nl] == dat[i + nl - dif]; ++nl)\n ;\n if (nl > l) {\n l = nl, d = dif;\n // break out early when we reach \"nice\" (we are satisfied enough)\n if (nl > maxn)\n break;\n // now, find the rarest 2-byte sequence within this\n // length of literals and search for that instead.\n // Much faster than just using the start\n var mmd = Math.min(dif, nl - 2);\n var md = 0;\n for (var j = 0; j < mmd; ++j) {\n var ti = (i - dif + j + 32768) & 32767;\n var pti = prev[ti];\n var cd = (ti - pti + 32768) & 32767;\n if (cd > md)\n md = cd, pimod = ti;\n }\n }\n }\n // check the previous match\n imod = pimod, pimod = prev[imod];\n dif += (imod - pimod + 32768) & 32767;\n }\n }\n // d will be nonzero only when a match was found\n if (d) {\n // store both dist and len data in one Uint32\n // Make sure this is recognized as a len/dist with 28th bit (2^28)\n syms[li++] = 268435456 | (revfl[l] << 18) | revfd[d];\n var lin = revfl[l] & 31, din = revfd[d] & 31;\n eb += fleb[lin] + fdeb[din];\n ++lf[257 + lin];\n ++df[din];\n wi = i + l;\n ++lc_1;\n }\n else {\n syms[li++] = dat[i];\n ++lf[dat[i]];\n }\n }\n }\n pos = wblk(dat, w, lst, syms, lf, df, eb, li, bs, i - bs, pos);\n // this is the easiest way to avoid needing to maintain state\n if (!lst && pos & 7)\n pos = wfblk(w, pos + 1, et);\n }\n return slc(o, 0, pre + shft(pos) + post);\n};\n// CRC32 table\nvar crct = /*#__PURE__*/ (function () {\n var t = new Int32Array(256);\n for (var i = 0; i < 256; ++i) {\n var c = i, k = 9;\n while (--k)\n c = ((c & 1) && -306674912) ^ (c >>> 1);\n t[i] = c;\n }\n return t;\n})();\n// CRC32\nvar crc = function () {\n var c = -1;\n return {\n p: function (d) {\n // closures have awful performance\n var cr = c;\n for (var i = 0; i < d.length; ++i)\n cr = crct[(cr & 255) ^ d[i]] ^ (cr >>> 8);\n c = cr;\n },\n d: function () { return ~c; }\n };\n};\n// Alder32\nvar adler = function () {\n var a = 1, b = 0;\n return {\n p: function (d) {\n // closures have awful performance\n var n = a, m = b;\n var l = d.length | 0;\n for (var i = 0; i != l;) {\n var e = Math.min(i + 2655, l);\n for (; i < e; ++i)\n m += n += d[i];\n n = (n & 65535) + 15 * (n >> 16), m = (m & 65535) + 15 * (m >> 16);\n }\n a = n, b = m;\n },\n d: function () {\n a %= 65521, b %= 65521;\n return (a & 255) << 24 | (a >>> 8) << 16 | (b & 255) << 8 | (b >>> 8);\n }\n };\n};\n;\n// deflate with opts\nvar dopt = function (dat, opt, pre, post, st) {\n return dflt(dat, opt.level == null ? 6 : opt.level, opt.mem == null ? Math.ceil(Math.max(8, Math.min(13, Math.log(dat.length))) * 1.5) : (12 + opt.mem), pre, post, !st);\n};\n// Walmart object spread\nvar mrg = function (a, b) {\n var o = {};\n for (var k in a)\n o[k] = a[k];\n for (var k in b)\n o[k] = b[k];\n return o;\n};\n// worker clone\n// This is possibly the craziest part of the entire codebase, despite how simple it may seem.\n// The only parameter to this function is a closure that returns an array of variables outside of the function scope.\n// We're going to try to figure out the variable names used in the closure as strings because that is crucial for workerization.\n// We will return an object mapping of true variable name to value (basically, the current scope as a JS object).\n// The reason we can't just use the original variable names is minifiers mangling the toplevel scope.\n// This took me three weeks to figure out how to do.\nvar wcln = function (fn, fnStr, td) {\n var dt = fn();\n var st = fn.toString();\n var ks = st.slice(st.indexOf('[') + 1, st.lastIndexOf(']')).replace(/\\s+/g, '').split(',');\n for (var i = 0; i < dt.length; ++i) {\n var v = dt[i], k = ks[i];\n if (typeof v == 'function') {\n fnStr += ';' + k + '=';\n var st_1 = v.toString();\n if (v.prototype) {\n // for global objects\n if (st_1.indexOf('[native code]') != -1) {\n var spInd = st_1.indexOf(' ', 8) + 1;\n fnStr += st_1.slice(spInd, st_1.indexOf('(', spInd));\n }\n else {\n fnStr += st_1;\n for (var t in v.prototype)\n fnStr += ';' + k + '.prototype.' + t + '=' + v.prototype[t].toString();\n }\n }\n else\n fnStr += st_1;\n }\n else\n td[k] = v;\n }\n return [fnStr, td];\n};\nvar ch = [];\n// clone bufs\nvar cbfs = function (v) {\n var tl = [];\n for (var k in v) {\n if (v[k].buffer) {\n tl.push((v[k] = new v[k].constructor(v[k])).buffer);\n }\n }\n return tl;\n};\n// use a worker to execute code\nvar wrkr = function (fns, init, id, cb) {\n var _a;\n if (!ch[id]) {\n var fnStr = '', td_1 = {}, m = fns.length - 1;\n for (var i = 0; i < m; ++i)\n _a = wcln(fns[i], fnStr, td_1), fnStr = _a[0], td_1 = _a[1];\n ch[id] = wcln(fns[m], fnStr, td_1);\n }\n var td = mrg({}, ch[id][1]);\n return wk(ch[id][0] + ';onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=' + init.toString() + '}', id, td, cbfs(td), cb);\n};\n// base async inflate fn\nvar bInflt = function () { return [u8, u16, u32, fleb, fdeb, clim, fl, fd, flrm, fdrm, rev, ec, hMap, max, bits, bits16, shft, slc, err, inflt, inflateSync, pbf, gu8]; };\nvar bDflt = function () { return [u8, u16, u32, fleb, fdeb, clim, revfl, revfd, flm, flt, fdm, fdt, rev, deo, et, hMap, wbits, wbits16, hTree, ln, lc, clen, wfblk, wblk, shft, slc, dflt, dopt, deflateSync, pbf]; };\n// gzip extra\nvar gze = function () { return [gzh, gzhl, wbytes, crc, crct]; };\n// gunzip extra\nvar guze = function () { return [gzs, gzl]; };\n// zlib extra\nvar zle = function () { return [zlh, wbytes, adler]; };\n// unzlib extra\nvar zule = function () { return [zlv]; };\n// post buf\nvar pbf = function (msg) { return postMessage(msg, [msg.buffer]); };\n// get u8\nvar gu8 = function (o) { return o && o.size && new u8(o.size); };\n// async helper\nvar cbify = function (dat, opts, fns, init, id, cb) {\n var w = wrkr(fns, init, id, function (err, dat) {\n w.terminate();\n cb(err, dat);\n });\n w.postMessage([dat, opts], opts.consume ? [dat.buffer] : []);\n return function () { w.terminate(); };\n};\n// auto stream\nvar astrm = function (strm) {\n strm.ondata = function (dat, final) { return postMessage([dat, final], [dat.buffer]); };\n return function (ev) { return strm.push(ev.data[0], ev.data[1]); };\n};\n// async stream attach\nvar astrmify = function (fns, strm, opts, init, id) {\n var t;\n var w = wrkr(fns, init, id, function (err, dat) {\n if (err)\n w.terminate(), strm.ondata.call(strm, err);\n else {\n if (dat[1])\n w.terminate();\n strm.ondata.call(strm, err, dat[0], dat[1]);\n }\n });\n w.postMessage(opts);\n strm.push = function (d, f) {\n if (!strm.ondata)\n err(5);\n if (t)\n strm.ondata(err(4, 0, 1), null, !!f);\n w.postMessage([d, t = f], [d.buffer]);\n };\n strm.terminate = function () { w.terminate(); };\n};\n// read 2 bytes\nvar b2 = function (d, b) { return d[b] | (d[b + 1] << 8); };\n// read 4 bytes\nvar b4 = function (d, b) { return (d[b] | (d[b + 1] << 8) | (d[b + 2] << 16) | (d[b + 3] << 24)) >>> 0; };\nvar b8 = function (d, b) { return b4(d, b) + (b4(d, b + 4) * 4294967296); };\n// write bytes\nvar wbytes = function (d, b, v) {\n for (; v; ++b)\n d[b] = v, v >>>= 8;\n};\n// gzip header\nvar gzh = function (c, o) {\n var fn = o.filename;\n c[0] = 31, c[1] = 139, c[2] = 8, c[8] = o.level < 2 ? 4 : o.level == 9 ? 2 : 0, c[9] = 3; // assume Unix\n if (o.mtime != 0)\n wbytes(c, 4, Math.floor(new Date(o.mtime || Date.now()) / 1000));\n if (fn) {\n c[3] = 8;\n for (var i = 0; i <= fn.length; ++i)\n c[i + 10] = fn.charCodeAt(i);\n }\n};\n// gzip footer: -8 to -4 = CRC, -4 to -0 is length\n// gzip start\nvar gzs = function (d) {\n if (d[0] != 31 || d[1] != 139 || d[2] != 8)\n err(6, 'invalid gzip data');\n var flg = d[3];\n var st = 10;\n if (flg & 4)\n st += d[10] | (d[11] << 8) + 2;\n for (var zs = (flg >> 3 & 1) + (flg >> 4 & 1); zs > 0; zs -= !d[st++])\n ;\n return st + (flg & 2);\n};\n// gzip length\nvar gzl = function (d) {\n var l = d.length;\n return ((d[l - 4] | d[l - 3] << 8 | d[l - 2] << 16) | (d[l - 1] << 24)) >>> 0;\n};\n// gzip header length\nvar gzhl = function (o) { return 10 + ((o.filename && (o.filename.length + 1)) || 0); };\n// zlib header\nvar zlh = function (c, o) {\n var lv = o.level, fl = lv == 0 ? 0 : lv < 6 ? 1 : lv == 9 ? 3 : 2;\n c[0] = 120, c[1] = (fl << 6) | (fl ? (32 - 2 * fl) : 1);\n};\n// zlib valid\nvar zlv = function (d) {\n if ((d[0] & 15) != 8 || (d[0] >>> 4) > 7 || ((d[0] << 8 | d[1]) % 31))\n err(6, 'invalid zlib data');\n if (d[1] & 32)\n err(6, 'invalid zlib data: preset dictionaries not supported');\n};\nfunction AsyncCmpStrm(opts, cb) {\n if (!cb && typeof opts == 'function')\n cb = opts, opts = {};\n this.ondata = cb;\n return opts;\n}\n// zlib footer: -4 to -0 is Adler32\n/**\n * Streaming DEFLATE compression\n */\nvar Deflate = /*#__PURE__*/ (function () {\n function Deflate(opts, cb) {\n if (!cb && typeof opts == 'function')\n cb = opts, opts = {};\n this.ondata = cb;\n this.o = opts || {};\n }\n Deflate.prototype.p = function (c, f) {\n this.ondata(dopt(c, this.o, 0, 0, !f), f);\n };\n /**\n * Pushes a chunk to be deflated\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Deflate.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n if (this.d)\n err(4);\n this.d = final;\n this.p(chunk, final || false);\n };\n return Deflate;\n}());\nexport { Deflate };\n/**\n * Asynchronous streaming DEFLATE compression\n */\nvar AsyncDeflate = /*#__PURE__*/ (function () {\n function AsyncDeflate(opts, cb) {\n astrmify([\n bDflt,\n function () { return [astrm, Deflate]; }\n ], this, AsyncCmpStrm.call(this, opts, cb), function (ev) {\n var strm = new Deflate(ev.data);\n onmessage = astrm(strm);\n }, 6);\n }\n return AsyncDeflate;\n}());\nexport { AsyncDeflate };\nexport function deflate(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bDflt,\n ], function (ev) { return pbf(deflateSync(ev.data[0], ev.data[1])); }, 0, cb);\n}\n/**\n * Compresses data with DEFLATE without any wrapper\n * @param data The data to compress\n * @param opts The compression options\n * @returns The deflated version of the data\n */\nexport function deflateSync(data, opts) {\n return dopt(data, opts || {}, 0, 0);\n}\n/**\n * Streaming DEFLATE decompression\n */\nvar Inflate = /*#__PURE__*/ (function () {\n /**\n * Creates an inflation stream\n * @param cb The callback to call whenever data is inflated\n */\n function Inflate(cb) {\n this.s = {};\n this.p = new u8(0);\n this.ondata = cb;\n }\n Inflate.prototype.e = function (c) {\n if (!this.ondata)\n err(5);\n if (this.d)\n err(4);\n var l = this.p.length;\n var n = new u8(l + c.length);\n n.set(this.p), n.set(c, l), this.p = n;\n };\n Inflate.prototype.c = function (final) {\n this.d = this.s.i = final || false;\n var bts = this.s.b;\n var dt = inflt(this.p, this.o, this.s);\n this.ondata(slc(dt, bts, this.s.b), this.d);\n this.o = slc(dt, this.s.b - 32768), this.s.b = this.o.length;\n this.p = slc(this.p, (this.s.p / 8) | 0), this.s.p &= 7;\n };\n /**\n * Pushes a chunk to be inflated\n * @param chunk The chunk to push\n * @param final Whether this is the final chunk\n */\n Inflate.prototype.push = function (chunk, final) {\n this.e(chunk), this.c(final);\n };\n return Inflate;\n}());\nexport { Inflate };\n/**\n * Asynchronous streaming DEFLATE decompression\n */\nvar AsyncInflate = /*#__PURE__*/ (function () {\n /**\n * Creates an asynchronous inflation stream\n * @param cb The callback to call whenever data is deflated\n */\n function AsyncInflate(cb) {\n this.ondata = cb;\n astrmify([\n bInflt,\n function () { return [astrm, Inflate]; }\n ], this, 0, function () {\n var strm = new Inflate();\n onmessage = astrm(strm);\n }, 7);\n }\n return AsyncInflate;\n}());\nexport { AsyncInflate };\nexport function inflate(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bInflt\n ], function (ev) { return pbf(inflateSync(ev.data[0], gu8(ev.data[1]))); }, 1, cb);\n}\n/**\n * Expands DEFLATE data with no wrapper\n * @param data The data to decompress\n * @param out Where to write the data. Saves memory if you know the decompressed size and provide an output buffer of that length.\n * @returns The decompressed version of the data\n */\nexport function inflateSync(data, out) {\n return inflt(data, out);\n}\n// before you yell at me for not just using extends, my reason is that TS inheritance is hard to workerize.\n/**\n * Streaming GZIP compression\n */\nvar Gzip = /*#__PURE__*/ (function () {\n function Gzip(opts, cb) {\n this.c = crc();\n this.l = 0;\n this.v = 1;\n Deflate.call(this, opts, cb);\n }\n /**\n * Pushes a chunk to be GZIPped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Gzip.prototype.push = function (chunk, final) {\n Deflate.prototype.push.call(this, chunk, final);\n };\n Gzip.prototype.p = function (c, f) {\n this.c.p(c);\n this.l += c.length;\n var raw = dopt(c, this.o, this.v && gzhl(this.o), f && 8, !f);\n if (this.v)\n gzh(raw, this.o), this.v = 0;\n if (f)\n wbytes(raw, raw.length - 8, this.c.d()), wbytes(raw, raw.length - 4, this.l);\n this.ondata(raw, f);\n };\n return Gzip;\n}());\nexport { Gzip };\n/**\n * Asynchronous streaming GZIP compression\n */\nvar AsyncGzip = /*#__PURE__*/ (function () {\n function AsyncGzip(opts, cb) {\n astrmify([\n bDflt,\n gze,\n function () { return [astrm, Deflate, Gzip]; }\n ], this, AsyncCmpStrm.call(this, opts, cb), function (ev) {\n var strm = new Gzip(ev.data);\n onmessage = astrm(strm);\n }, 8);\n }\n return AsyncGzip;\n}());\nexport { AsyncGzip };\nexport function gzip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bDflt,\n gze,\n function () { return [gzipSync]; }\n ], function (ev) { return pbf(gzipSync(ev.data[0], ev.data[1])); }, 2, cb);\n}\n/**\n * Compresses data with GZIP\n * @param data The data to compress\n * @param opts The compression options\n * @returns The gzipped version of the data\n */\nexport function gzipSync(data, opts) {\n if (!opts)\n opts = {};\n var c = crc(), l = data.length;\n c.p(data);\n var d = dopt(data, opts, gzhl(opts), 8), s = d.length;\n return gzh(d, opts), wbytes(d, s - 8, c.d()), wbytes(d, s - 4, l), d;\n}\n/**\n * Streaming GZIP decompression\n */\nvar Gunzip = /*#__PURE__*/ (function () {\n /**\n * Creates a GUNZIP stream\n * @param cb The callback to call whenever data is inflated\n */\n function Gunzip(cb) {\n this.v = 1;\n Inflate.call(this, cb);\n }\n /**\n * Pushes a chunk to be GUNZIPped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Gunzip.prototype.push = function (chunk, final) {\n Inflate.prototype.e.call(this, chunk);\n if (this.v) {\n var s = this.p.length > 3 ? gzs(this.p) : 4;\n if (s >= this.p.length && !final)\n return;\n this.p = this.p.subarray(s), this.v = 0;\n }\n if (final) {\n if (this.p.length < 8)\n err(6, 'invalid gzip data');\n this.p = this.p.subarray(0, -8);\n }\n // necessary to prevent TS from using the closure value\n // This allows for workerization to function correctly\n Inflate.prototype.c.call(this, final);\n };\n return Gunzip;\n}());\nexport { Gunzip };\n/**\n * Asynchronous streaming GZIP decompression\n */\nvar AsyncGunzip = /*#__PURE__*/ (function () {\n /**\n * Creates an asynchronous GUNZIP stream\n * @param cb The callback to call whenever data is deflated\n */\n function AsyncGunzip(cb) {\n this.ondata = cb;\n astrmify([\n bInflt,\n guze,\n function () { return [astrm, Inflate, Gunzip]; }\n ], this, 0, function () {\n var strm = new Gunzip();\n onmessage = astrm(strm);\n }, 9);\n }\n return AsyncGunzip;\n}());\nexport { AsyncGunzip };\nexport function gunzip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bInflt,\n guze,\n function () { return [gunzipSync]; }\n ], function (ev) { return pbf(gunzipSync(ev.data[0])); }, 3, cb);\n}\n/**\n * Expands GZIP data\n * @param data The data to decompress\n * @param out Where to write the data. GZIP already encodes the output size, so providing this doesn't save memory.\n * @returns The decompressed version of the data\n */\nexport function gunzipSync(data, out) {\n return inflt(data.subarray(gzs(data), -8), out || new u8(gzl(data)));\n}\n/**\n * Streaming Zlib compression\n */\nvar Zlib = /*#__PURE__*/ (function () {\n function Zlib(opts, cb) {\n this.c = adler();\n this.v = 1;\n Deflate.call(this, opts, cb);\n }\n /**\n * Pushes a chunk to be zlibbed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Zlib.prototype.push = function (chunk, final) {\n Deflate.prototype.push.call(this, chunk, final);\n };\n Zlib.prototype.p = function (c, f) {\n this.c.p(c);\n var raw = dopt(c, this.o, this.v && 2, f && 4, !f);\n if (this.v)\n zlh(raw, this.o), this.v = 0;\n if (f)\n wbytes(raw, raw.length - 4, this.c.d());\n this.ondata(raw, f);\n };\n return Zlib;\n}());\nexport { Zlib };\n/**\n * Asynchronous streaming Zlib compression\n */\nvar AsyncZlib = /*#__PURE__*/ (function () {\n function AsyncZlib(opts, cb) {\n astrmify([\n bDflt,\n zle,\n function () { return [astrm, Deflate, Zlib]; }\n ], this, AsyncCmpStrm.call(this, opts, cb), function (ev) {\n var strm = new Zlib(ev.data);\n onmessage = astrm(strm);\n }, 10);\n }\n return AsyncZlib;\n}());\nexport { AsyncZlib };\nexport function zlib(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bDflt,\n zle,\n function () { return [zlibSync]; }\n ], function (ev) { return pbf(zlibSync(ev.data[0], ev.data[1])); }, 4, cb);\n}\n/**\n * Compress data with Zlib\n * @param data The data to compress\n * @param opts The compression options\n * @returns The zlib-compressed version of the data\n */\nexport function zlibSync(data, opts) {\n if (!opts)\n opts = {};\n var a = adler();\n a.p(data);\n var d = dopt(data, opts, 2, 4);\n return zlh(d, opts), wbytes(d, d.length - 4, a.d()), d;\n}\n/**\n * Streaming Zlib decompression\n */\nvar Unzlib = /*#__PURE__*/ (function () {\n /**\n * Creates a Zlib decompression stream\n * @param cb The callback to call whenever data is inflated\n */\n function Unzlib(cb) {\n this.v = 1;\n Inflate.call(this, cb);\n }\n /**\n * Pushes a chunk to be unzlibbed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Unzlib.prototype.push = function (chunk, final) {\n Inflate.prototype.e.call(this, chunk);\n if (this.v) {\n if (this.p.length < 2 && !final)\n return;\n this.p = this.p.subarray(2), this.v = 0;\n }\n if (final) {\n if (this.p.length < 4)\n err(6, 'invalid zlib data');\n this.p = this.p.subarray(0, -4);\n }\n // necessary to prevent TS from using the closure value\n // This allows for workerization to function correctly\n Inflate.prototype.c.call(this, final);\n };\n return Unzlib;\n}());\nexport { Unzlib };\n/**\n * Asynchronous streaming Zlib decompression\n */\nvar AsyncUnzlib = /*#__PURE__*/ (function () {\n /**\n * Creates an asynchronous Zlib decompression stream\n * @param cb The callback to call whenever data is deflated\n */\n function AsyncUnzlib(cb) {\n this.ondata = cb;\n astrmify([\n bInflt,\n zule,\n function () { return [astrm, Inflate, Unzlib]; }\n ], this, 0, function () {\n var strm = new Unzlib();\n onmessage = astrm(strm);\n }, 11);\n }\n return AsyncUnzlib;\n}());\nexport { AsyncUnzlib };\nexport function unzlib(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bInflt,\n zule,\n function () { return [unzlibSync]; }\n ], function (ev) { return pbf(unzlibSync(ev.data[0], gu8(ev.data[1]))); }, 5, cb);\n}\n/**\n * Expands Zlib data\n * @param data The data to decompress\n * @param out Where to write the data. Saves memory if you know the decompressed size and provide an output buffer of that length.\n * @returns The decompressed version of the data\n */\nexport function unzlibSync(data, out) {\n return inflt((zlv(data), data.subarray(2, -4)), out);\n}\n// Default algorithm for compression (used because having a known output size allows faster decompression)\nexport { gzip as compress, AsyncGzip as AsyncCompress };\n// Default algorithm for compression (used because having a known output size allows faster decompression)\nexport { gzipSync as compressSync, Gzip as Compress };\n/**\n * Streaming GZIP, Zlib, or raw DEFLATE decompression\n */\nvar Decompress = /*#__PURE__*/ (function () {\n /**\n * Creates a decompression stream\n * @param cb The callback to call whenever data is decompressed\n */\n function Decompress(cb) {\n this.G = Gunzip;\n this.I = Inflate;\n this.Z = Unzlib;\n this.ondata = cb;\n }\n /**\n * Pushes a chunk to be decompressed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Decompress.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n if (!this.s) {\n if (this.p && this.p.length) {\n var n = new u8(this.p.length + chunk.length);\n n.set(this.p), n.set(chunk, this.p.length);\n }\n else\n this.p = chunk;\n if (this.p.length > 2) {\n var _this_1 = this;\n var cb = function () { _this_1.ondata.apply(_this_1, arguments); };\n this.s = (this.p[0] == 31 && this.p[1] == 139 && this.p[2] == 8)\n ? new this.G(cb)\n : ((this.p[0] & 15) != 8 || (this.p[0] >> 4) > 7 || ((this.p[0] << 8 | this.p[1]) % 31))\n ? new this.I(cb)\n : new this.Z(cb);\n this.s.push(this.p, final);\n this.p = null;\n }\n }\n else\n this.s.push(chunk, final);\n };\n return Decompress;\n}());\nexport { Decompress };\n/**\n * Asynchronous streaming GZIP, Zlib, or raw DEFLATE decompression\n */\nvar AsyncDecompress = /*#__PURE__*/ (function () {\n /**\n * Creates an asynchronous decompression stream\n * @param cb The callback to call whenever data is decompressed\n */\n function AsyncDecompress(cb) {\n this.G = AsyncGunzip;\n this.I = AsyncInflate;\n this.Z = AsyncUnzlib;\n this.ondata = cb;\n }\n /**\n * Pushes a chunk to be decompressed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n AsyncDecompress.prototype.push = function (chunk, final) {\n Decompress.prototype.push.call(this, chunk, final);\n };\n return AsyncDecompress;\n}());\nexport { AsyncDecompress };\nexport function decompress(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return (data[0] == 31 && data[1] == 139 && data[2] == 8)\n ? gunzip(data, opts, cb)\n : ((data[0] & 15) != 8 || (data[0] >> 4) > 7 || ((data[0] << 8 | data[1]) % 31))\n ? inflate(data, opts, cb)\n : unzlib(data, opts, cb);\n}\n/**\n * Expands compressed GZIP, Zlib, or raw DEFLATE data, automatically detecting the format\n * @param data The data to decompress\n * @param out Where to write the data. Saves memory if you know the decompressed size and provide an output buffer of that length.\n * @returns The decompressed version of the data\n */\nexport function decompressSync(data, out) {\n return (data[0] == 31 && data[1] == 139 && data[2] == 8)\n ? gunzipSync(data, out)\n : ((data[0] & 15) != 8 || (data[0] >> 4) > 7 || ((data[0] << 8 | data[1]) % 31))\n ? inflateSync(data, out)\n : unzlibSync(data, out);\n}\n// flatten a directory structure\nvar fltn = function (d, p, t, o) {\n for (var k in d) {\n var val = d[k], n = p + k, op = o;\n if (Array.isArray(val))\n op = mrg(o, val[1]), val = val[0];\n if (val instanceof u8)\n t[n] = [val, op];\n else {\n t[n += '/'] = [new u8(0), op];\n fltn(val, n, t, o);\n }\n }\n};\n// text encoder\nvar te = typeof TextEncoder != 'undefined' && /*#__PURE__*/ new TextEncoder();\n// text decoder\nvar td = typeof TextDecoder != 'undefined' && /*#__PURE__*/ new TextDecoder();\n// text decoder stream\nvar tds = 0;\ntry {\n td.decode(et, { stream: true });\n tds = 1;\n}\ncatch (e) { }\n// decode UTF8\nvar dutf8 = function (d) {\n for (var r = '', i = 0;;) {\n var c = d[i++];\n var eb = (c > 127) + (c > 223) + (c > 239);\n if (i + eb > d.length)\n return [r, slc(d, i - 1)];\n if (!eb)\n r += String.fromCharCode(c);\n else if (eb == 3) {\n c = ((c & 15) << 18 | (d[i++] & 63) << 12 | (d[i++] & 63) << 6 | (d[i++] & 63)) - 65536,\n r += String.fromCharCode(55296 | (c >> 10), 56320 | (c & 1023));\n }\n else if (eb & 1)\n r += String.fromCharCode((c & 31) << 6 | (d[i++] & 63));\n else\n r += String.fromCharCode((c & 15) << 12 | (d[i++] & 63) << 6 | (d[i++] & 63));\n }\n};\n/**\n * Streaming UTF-8 decoding\n */\nvar DecodeUTF8 = /*#__PURE__*/ (function () {\n /**\n * Creates a UTF-8 decoding stream\n * @param cb The callback to call whenever data is decoded\n */\n function DecodeUTF8(cb) {\n this.ondata = cb;\n if (tds)\n this.t = new TextDecoder();\n else\n this.p = et;\n }\n /**\n * Pushes a chunk to be decoded from UTF-8 binary\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n DecodeUTF8.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n final = !!final;\n if (this.t) {\n this.ondata(this.t.decode(chunk, { stream: true }), final);\n if (final) {\n if (this.t.decode().length)\n err(8);\n this.t = null;\n }\n return;\n }\n if (!this.p)\n err(4);\n var dat = new u8(this.p.length + chunk.length);\n dat.set(this.p);\n dat.set(chunk, this.p.length);\n var _a = dutf8(dat), ch = _a[0], np = _a[1];\n if (final) {\n if (np.length)\n err(8);\n this.p = null;\n }\n else\n this.p = np;\n this.ondata(ch, final);\n };\n return DecodeUTF8;\n}());\nexport { DecodeUTF8 };\n/**\n * Streaming UTF-8 encoding\n */\nvar EncodeUTF8 = /*#__PURE__*/ (function () {\n /**\n * Creates a UTF-8 decoding stream\n * @param cb The callback to call whenever data is encoded\n */\n function EncodeUTF8(cb) {\n this.ondata = cb;\n }\n /**\n * Pushes a chunk to be encoded to UTF-8\n * @param chunk The string data to push\n * @param final Whether this is the last chunk\n */\n EncodeUTF8.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n if (this.d)\n err(4);\n this.ondata(strToU8(chunk), this.d = final || false);\n };\n return EncodeUTF8;\n}());\nexport { EncodeUTF8 };\n/**\n * Converts a string into a Uint8Array for use with compression/decompression methods\n * @param str The string to encode\n * @param latin1 Whether or not to interpret the data as Latin-1. This should\n * not need to be true unless decoding a binary string.\n * @returns The string encoded in UTF-8/Latin-1 binary\n */\nexport function strToU8(str, latin1) {\n if (latin1) {\n var ar_1 = new u8(str.length);\n for (var i = 0; i < str.length; ++i)\n ar_1[i] = str.charCodeAt(i);\n return ar_1;\n }\n if (te)\n return te.encode(str);\n var l = str.length;\n var ar = new u8(str.length + (str.length >> 1));\n var ai = 0;\n var w = function (v) { ar[ai++] = v; };\n for (var i = 0; i < l; ++i) {\n if (ai + 5 > ar.length) {\n var n = new u8(ai + 8 + ((l - i) << 1));\n n.set(ar);\n ar = n;\n }\n var c = str.charCodeAt(i);\n if (c < 128 || latin1)\n w(c);\n else if (c < 2048)\n w(192 | (c >> 6)), w(128 | (c & 63));\n else if (c > 55295 && c < 57344)\n c = 65536 + (c & 1023 << 10) | (str.charCodeAt(++i) & 1023),\n w(240 | (c >> 18)), w(128 | ((c >> 12) & 63)), w(128 | ((c >> 6) & 63)), w(128 | (c & 63));\n else\n w(224 | (c >> 12)), w(128 | ((c >> 6) & 63)), w(128 | (c & 63));\n }\n return slc(ar, 0, ai);\n}\n/**\n * Converts a Uint8Array to a string\n * @param dat The data to decode to string\n * @param latin1 Whether or not to interpret the data as Latin-1. This should\n * not need to be true unless encoding to binary string.\n * @returns The original UTF-8/Latin-1 string\n */\nexport function strFromU8(dat, latin1) {\n if (latin1) {\n var r = '';\n for (var i = 0; i < dat.length; i += 16384)\n r += String.fromCharCode.apply(null, dat.subarray(i, i + 16384));\n return r;\n }\n else if (td)\n return td.decode(dat);\n else {\n var _a = dutf8(dat), out = _a[0], ext = _a[1];\n if (ext.length)\n err(8);\n return out;\n }\n}\n;\n// deflate bit flag\nvar dbf = function (l) { return l == 1 ? 3 : l < 6 ? 2 : l == 9 ? 1 : 0; };\n// skip local zip header\nvar slzh = function (d, b) { return b + 30 + b2(d, b + 26) + b2(d, b + 28); };\n// read zip header\nvar zh = function (d, b, z) {\n var fnl = b2(d, b + 28), fn = strFromU8(d.subarray(b + 46, b + 46 + fnl), !(b2(d, b + 8) & 2048)), es = b + 46 + fnl, bs = b4(d, b + 20);\n var _a = z && bs == 4294967295 ? z64e(d, es) : [bs, b4(d, b + 24), b4(d, b + 42)], sc = _a[0], su = _a[1], off = _a[2];\n return [b2(d, b + 10), sc, su, fn, es + b2(d, b + 30) + b2(d, b + 32), off];\n};\n// read zip64 extra field\nvar z64e = function (d, b) {\n for (; b2(d, b) != 1; b += 4 + b2(d, b + 2))\n ;\n return [b8(d, b + 12), b8(d, b + 4), b8(d, b + 20)];\n};\n// extra field length\nvar exfl = function (ex) {\n var le = 0;\n if (ex) {\n for (var k in ex) {\n var l = ex[k].length;\n if (l > 65535)\n err(9);\n le += l + 4;\n }\n }\n return le;\n};\n// write zip header\nvar wzh = function (d, b, f, fn, u, c, ce, co) {\n var fl = fn.length, ex = f.extra, col = co && co.length;\n var exl = exfl(ex);\n wbytes(d, b, ce != null ? 0x2014B50 : 0x4034B50), b += 4;\n if (ce != null)\n d[b++] = 20, d[b++] = f.os;\n d[b] = 20, b += 2; // spec compliance? what's that?\n d[b++] = (f.flag << 1) | (c == null && 8), d[b++] = u && 8;\n d[b++] = f.compression & 255, d[b++] = f.compression >> 8;\n var dt = new Date(f.mtime == null ? Date.now() : f.mtime), y = dt.getFullYear() - 1980;\n if (y < 0 || y > 119)\n err(10);\n wbytes(d, b, (y << 25) | ((dt.getMonth() + 1) << 21) | (dt.getDate() << 16) | (dt.getHours() << 11) | (dt.getMinutes() << 5) | (dt.getSeconds() >>> 1)), b += 4;\n if (c != null) {\n wbytes(d, b, f.crc);\n wbytes(d, b + 4, c);\n wbytes(d, b + 8, f.size);\n }\n wbytes(d, b + 12, fl);\n wbytes(d, b + 14, exl), b += 16;\n if (ce != null) {\n wbytes(d, b, col);\n wbytes(d, b + 6, f.attrs);\n wbytes(d, b + 10, ce), b += 14;\n }\n d.set(fn, b);\n b += fl;\n if (exl) {\n for (var k in ex) {\n var exf = ex[k], l = exf.length;\n wbytes(d, b, +k);\n wbytes(d, b + 2, l);\n d.set(exf, b + 4), b += 4 + l;\n }\n }\n if (col)\n d.set(co, b), b += col;\n return b;\n};\n// write zip footer (end of central directory)\nvar wzf = function (o, b, c, d, e) {\n wbytes(o, b, 0x6054B50); // skip disk\n wbytes(o, b + 8, c);\n wbytes(o, b + 10, c);\n wbytes(o, b + 12, d);\n wbytes(o, b + 16, e);\n};\n/**\n * A pass-through stream to keep data uncompressed in a ZIP archive.\n */\nvar ZipPassThrough = /*#__PURE__*/ (function () {\n /**\n * Creates a pass-through stream that can be added to ZIP archives\n * @param filename The filename to associate with this data stream\n */\n function ZipPassThrough(filename) {\n this.filename = filename;\n this.c = crc();\n this.size = 0;\n this.compression = 0;\n }\n /**\n * Processes a chunk and pushes to the output stream. You can override this\n * method in a subclass for custom behavior, but by default this passes\n * the data through. You must call this.ondata(err, chunk, final) at some\n * point in this method.\n * @param chunk The chunk to process\n * @param final Whether this is the last chunk\n */\n ZipPassThrough.prototype.process = function (chunk, final) {\n this.ondata(null, chunk, final);\n };\n /**\n * Pushes a chunk to be added. If you are subclassing this with a custom\n * compression algorithm, note that you must push data from the source\n * file only, pre-compression.\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n ZipPassThrough.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n this.c.p(chunk);\n this.size += chunk.length;\n if (final)\n this.crc = this.c.d();\n this.process(chunk, final || false);\n };\n return ZipPassThrough;\n}());\nexport { ZipPassThrough };\n// I don't extend because TypeScript extension adds 1kB of runtime bloat\n/**\n * Streaming DEFLATE compression for ZIP archives. Prefer using AsyncZipDeflate\n * for better performance\n */\nvar ZipDeflate = /*#__PURE__*/ (function () {\n /**\n * Creates a DEFLATE stream that can be added to ZIP archives\n * @param filename The filename to associate with this data stream\n * @param opts The compression options\n */\n function ZipDeflate(filename, opts) {\n var _this_1 = this;\n if (!opts)\n opts = {};\n ZipPassThrough.call(this, filename);\n this.d = new Deflate(opts, function (dat, final) {\n _this_1.ondata(null, dat, final);\n });\n this.compression = 8;\n this.flag = dbf(opts.level);\n }\n ZipDeflate.prototype.process = function (chunk, final) {\n try {\n this.d.push(chunk, final);\n }\n catch (e) {\n this.ondata(e, null, final);\n }\n };\n /**\n * Pushes a chunk to be deflated\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n ZipDeflate.prototype.push = function (chunk, final) {\n ZipPassThrough.prototype.push.call(this, chunk, final);\n };\n return ZipDeflate;\n}());\nexport { ZipDeflate };\n/**\n * Asynchronous streaming DEFLATE compression for ZIP archives\n */\nvar AsyncZipDeflate = /*#__PURE__*/ (function () {\n /**\n * Creates a DEFLATE stream that can be added to ZIP archives\n * @param filename The filename to associate with this data stream\n * @param opts The compression options\n */\n function AsyncZipDeflate(filename, opts) {\n var _this_1 = this;\n if (!opts)\n opts = {};\n ZipPassThrough.call(this, filename);\n this.d = new AsyncDeflate(opts, function (err, dat, final) {\n _this_1.ondata(err, dat, final);\n });\n this.compression = 8;\n this.flag = dbf(opts.level);\n this.terminate = this.d.terminate;\n }\n AsyncZipDeflate.prototype.process = function (chunk, final) {\n this.d.push(chunk, final);\n };\n /**\n * Pushes a chunk to be deflated\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n AsyncZipDeflate.prototype.push = function (chunk, final) {\n ZipPassThrough.prototype.push.call(this, chunk, final);\n };\n return AsyncZipDeflate;\n}());\nexport { AsyncZipDeflate };\n// TODO: Better tree shaking\n/**\n * A zippable archive to which files can incrementally be added\n */\nvar Zip = /*#__PURE__*/ (function () {\n /**\n * Creates an empty ZIP archive to which files can be added\n * @param cb The callback to call whenever data for the generated ZIP archive\n * is available\n */\n function Zip(cb) {\n this.ondata = cb;\n this.u = [];\n this.d = 1;\n }\n /**\n * Adds a file to the ZIP archive\n * @param file The file stream to add\n */\n Zip.prototype.add = function (file) {\n var _this_1 = this;\n if (!this.ondata)\n err(5);\n // finishing or finished\n if (this.d & 2)\n this.ondata(err(4 + (this.d & 1) * 8, 0, 1), null, false);\n else {\n var f = strToU8(file.filename), fl_1 = f.length;\n var com = file.comment, o = com && strToU8(com);\n var u = fl_1 != file.filename.length || (o && (com.length != o.length));\n var hl_1 = fl_1 + exfl(file.extra) + 30;\n if (fl_1 > 65535)\n this.ondata(err(11, 0, 1), null, false);\n var header = new u8(hl_1);\n wzh(header, 0, file, f, u);\n var chks_1 = [header];\n var pAll_1 = function () {\n for (var _i = 0, chks_2 = chks_1; _i < chks_2.length; _i++) {\n var chk = chks_2[_i];\n _this_1.ondata(null, chk, false);\n }\n chks_1 = [];\n };\n var tr_1 = this.d;\n this.d = 0;\n var ind_1 = this.u.length;\n var uf_1 = mrg(file, {\n f: f,\n u: u,\n o: o,\n t: function () {\n if (file.terminate)\n file.terminate();\n },\n r: function () {\n pAll_1();\n if (tr_1) {\n var nxt = _this_1.u[ind_1 + 1];\n if (nxt)\n nxt.r();\n else\n _this_1.d = 1;\n }\n tr_1 = 1;\n }\n });\n var cl_1 = 0;\n file.ondata = function (err, dat, final) {\n if (err) {\n _this_1.ondata(err, dat, final);\n _this_1.terminate();\n }\n else {\n cl_1 += dat.length;\n chks_1.push(dat);\n if (final) {\n var dd = new u8(16);\n wbytes(dd, 0, 0x8074B50);\n wbytes(dd, 4, file.crc);\n wbytes(dd, 8, cl_1);\n wbytes(dd, 12, file.size);\n chks_1.push(dd);\n uf_1.c = cl_1, uf_1.b = hl_1 + cl_1 + 16, uf_1.crc = file.crc, uf_1.size = file.size;\n if (tr_1)\n uf_1.r();\n tr_1 = 1;\n }\n else if (tr_1)\n pAll_1();\n }\n };\n this.u.push(uf_1);\n }\n };\n /**\n * Ends the process of adding files and prepares to emit the final chunks.\n * This *must* be called after adding all desired files for the resulting\n * ZIP file to work properly.\n */\n Zip.prototype.end = function () {\n var _this_1 = this;\n if (this.d & 2) {\n this.ondata(err(4 + (this.d & 1) * 8, 0, 1), null, true);\n return;\n }\n if (this.d)\n this.e();\n else\n this.u.push({\n r: function () {\n if (!(_this_1.d & 1))\n return;\n _this_1.u.splice(-1, 1);\n _this_1.e();\n },\n t: function () { }\n });\n this.d = 3;\n };\n Zip.prototype.e = function () {\n var bt = 0, l = 0, tl = 0;\n for (var _i = 0, _a = this.u; _i < _a.length; _i++) {\n var f = _a[_i];\n tl += 46 + f.f.length + exfl(f.extra) + (f.o ? f.o.length : 0);\n }\n var out = new u8(tl + 22);\n for (var _b = 0, _c = this.u; _b < _c.length; _b++) {\n var f = _c[_b];\n wzh(out, bt, f, f.f, f.u, f.c, l, f.o);\n bt += 46 + f.f.length + exfl(f.extra) + (f.o ? f.o.length : 0), l += f.b;\n }\n wzf(out, bt, this.u.length, tl, l);\n this.ondata(null, out, true);\n this.d = 2;\n };\n /**\n * A method to terminate any internal workers used by the stream. Subsequent\n * calls to add() will fail.\n */\n Zip.prototype.terminate = function () {\n for (var _i = 0, _a = this.u; _i < _a.length; _i++) {\n var f = _a[_i];\n f.t();\n }\n this.d = 2;\n };\n return Zip;\n}());\nexport { Zip };\nexport function zip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n var r = {};\n fltn(data, '', r, opts);\n var k = Object.keys(r);\n var lft = k.length, o = 0, tot = 0;\n var slft = lft, files = new Array(lft);\n var term = [];\n var tAll = function () {\n for (var i = 0; i < term.length; ++i)\n term[i]();\n };\n var cbd = function (a, b) {\n mt(function () { cb(a, b); });\n };\n mt(function () { cbd = cb; });\n var cbf = function () {\n var out = new u8(tot + 22), oe = o, cdl = tot - o;\n tot = 0;\n for (var i = 0; i < slft; ++i) {\n var f = files[i];\n try {\n var l = f.c.length;\n wzh(out, tot, f, f.f, f.u, l);\n var badd = 30 + f.f.length + exfl(f.extra);\n var loc = tot + badd;\n out.set(f.c, loc);\n wzh(out, o, f, f.f, f.u, l, tot, f.m), o += 16 + badd + (f.m ? f.m.length : 0), tot = loc + l;\n }\n catch (e) {\n return cbd(e, null);\n }\n }\n wzf(out, o, files.length, cdl, oe);\n cbd(null, out);\n };\n if (!lft)\n cbf();\n var _loop_1 = function (i) {\n var fn = k[i];\n var _a = r[fn], file = _a[0], p = _a[1];\n var c = crc(), size = file.length;\n c.p(file);\n var f = strToU8(fn), s = f.length;\n var com = p.comment, m = com && strToU8(com), ms = m && m.length;\n var exl = exfl(p.extra);\n var compression = p.level == 0 ? 0 : 8;\n var cbl = function (e, d) {\n if (e) {\n tAll();\n cbd(e, null);\n }\n else {\n var l = d.length;\n files[i] = mrg(p, {\n size: size,\n crc: c.d(),\n c: d,\n f: f,\n m: m,\n u: s != fn.length || (m && (com.length != ms)),\n compression: compression\n });\n o += 30 + s + exl + l;\n tot += 76 + 2 * (s + exl) + (ms || 0) + l;\n if (!--lft)\n cbf();\n }\n };\n if (s > 65535)\n cbl(err(11, 0, 1), null);\n if (!compression)\n cbl(null, file);\n else if (size < 160000) {\n try {\n cbl(null, deflateSync(file, p));\n }\n catch (e) {\n cbl(e, null);\n }\n }\n else\n term.push(deflate(file, p, cbl));\n };\n // Cannot use lft because it can decrease\n for (var i = 0; i < slft; ++i) {\n _loop_1(i);\n }\n return tAll;\n}\n/**\n * Synchronously creates a ZIP file. Prefer using `zip` for better performance\n * with more than one file.\n * @param data The directory structure for the ZIP archive\n * @param opts The main options, merged with per-file options\n * @returns The generated ZIP archive\n */\nexport function zipSync(data, opts) {\n if (!opts)\n opts = {};\n var r = {};\n var files = [];\n fltn(data, '', r, opts);\n var o = 0;\n var tot = 0;\n for (var fn in r) {\n var _a = r[fn], file = _a[0], p = _a[1];\n var compression = p.level == 0 ? 0 : 8;\n var f = strToU8(fn), s = f.length;\n var com = p.comment, m = com && strToU8(com), ms = m && m.length;\n var exl = exfl(p.extra);\n if (s > 65535)\n err(11);\n var d = compression ? deflateSync(file, p) : file, l = d.length;\n var c = crc();\n c.p(file);\n files.push(mrg(p, {\n size: file.length,\n crc: c.d(),\n c: d,\n f: f,\n m: m,\n u: s != fn.length || (m && (com.length != ms)),\n o: o,\n compression: compression\n }));\n o += 30 + s + exl + l;\n tot += 76 + 2 * (s + exl) + (ms || 0) + l;\n }\n var out = new u8(tot + 22), oe = o, cdl = tot - o;\n for (var i = 0; i < files.length; ++i) {\n var f = files[i];\n wzh(out, f.o, f, f.f, f.u, f.c.length);\n var badd = 30 + f.f.length + exfl(f.extra);\n out.set(f.c, f.o + badd);\n wzh(out, o, f, f.f, f.u, f.c.length, f.o, f.m), o += 16 + badd + (f.m ? f.m.length : 0);\n }\n wzf(out, o, files.length, cdl, oe);\n return out;\n}\n/**\n * Streaming pass-through decompression for ZIP archives\n */\nvar UnzipPassThrough = /*#__PURE__*/ (function () {\n function UnzipPassThrough() {\n }\n UnzipPassThrough.prototype.push = function (data, final) {\n this.ondata(null, data, final);\n };\n UnzipPassThrough.compression = 0;\n return UnzipPassThrough;\n}());\nexport { UnzipPassThrough };\n/**\n * Streaming DEFLATE decompression for ZIP archives. Prefer AsyncZipInflate for\n * better performance.\n */\nvar UnzipInflate = /*#__PURE__*/ (function () {\n /**\n * Creates a DEFLATE decompression that can be used in ZIP archives\n */\n function UnzipInflate() {\n var _this_1 = this;\n this.i = new Inflate(function (dat, final) {\n _this_1.ondata(null, dat, final);\n });\n }\n UnzipInflate.prototype.push = function (data, final) {\n try {\n this.i.push(data, final);\n }\n catch (e) {\n this.ondata(e, null, final);\n }\n };\n UnzipInflate.compression = 8;\n return UnzipInflate;\n}());\nexport { UnzipInflate };\n/**\n * Asynchronous streaming DEFLATE decompression for ZIP archives\n */\nvar AsyncUnzipInflate = /*#__PURE__*/ (function () {\n /**\n * Creates a DEFLATE decompression that can be used in ZIP archives\n */\n function AsyncUnzipInflate(_, sz) {\n var _this_1 = this;\n if (sz < 320000) {\n this.i = new Inflate(function (dat, final) {\n _this_1.ondata(null, dat, final);\n });\n }\n else {\n this.i = new AsyncInflate(function (err, dat, final) {\n _this_1.ondata(err, dat, final);\n });\n this.terminate = this.i.terminate;\n }\n }\n AsyncUnzipInflate.prototype.push = function (data, final) {\n if (this.i.terminate)\n data = slc(data, 0);\n this.i.push(data, final);\n };\n AsyncUnzipInflate.compression = 8;\n return AsyncUnzipInflate;\n}());\nexport { AsyncUnzipInflate };\n/**\n * A ZIP archive decompression stream that emits files as they are discovered\n */\nvar Unzip = /*#__PURE__*/ (function () {\n /**\n * Creates a ZIP decompression stream\n * @param cb The callback to call whenever a file in the ZIP archive is found\n */\n function Unzip(cb) {\n this.onfile = cb;\n this.k = [];\n this.o = {\n 0: UnzipPassThrough\n };\n this.p = et;\n }\n /**\n * Pushes a chunk to be unzipped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Unzip.prototype.push = function (chunk, final) {\n var _this_1 = this;\n if (!this.onfile)\n err(5);\n if (!this.p)\n err(4);\n if (this.c > 0) {\n var len = Math.min(this.c, chunk.length);\n var toAdd = chunk.subarray(0, len);\n this.c -= len;\n if (this.d)\n this.d.push(toAdd, !this.c);\n else\n this.k[0].push(toAdd);\n chunk = chunk.subarray(len);\n if (chunk.length)\n return this.push(chunk, final);\n }\n else {\n var f = 0, i = 0, is = void 0, buf = void 0;\n if (!this.p.length)\n buf = chunk;\n else if (!chunk.length)\n buf = this.p;\n else {\n buf = new u8(this.p.length + chunk.length);\n buf.set(this.p), buf.set(chunk, this.p.length);\n }\n var l = buf.length, oc = this.c, add = oc && this.d;\n var _loop_2 = function () {\n var _a;\n var sig = b4(buf, i);\n if (sig == 0x4034B50) {\n f = 1, is = i;\n this_1.d = null;\n this_1.c = 0;\n var bf = b2(buf, i + 6), cmp_1 = b2(buf, i + 8), u = bf & 2048, dd = bf & 8, fnl = b2(buf, i + 26), es = b2(buf, i + 28);\n if (l > i + 30 + fnl + es) {\n var chks_3 = [];\n this_1.k.unshift(chks_3);\n f = 2;\n var sc_1 = b4(buf, i + 18), su_1 = b4(buf, i + 22);\n var fn_1 = strFromU8(buf.subarray(i + 30, i += 30 + fnl), !u);\n if (sc_1 == 4294967295) {\n _a = dd ? [-2] : z64e(buf, i), sc_1 = _a[0], su_1 = _a[1];\n }\n else if (dd)\n sc_1 = -1;\n i += es;\n this_1.c = sc_1;\n var d_1;\n var file_1 = {\n name: fn_1,\n compression: cmp_1,\n start: function () {\n if (!file_1.ondata)\n err(5);\n if (!sc_1)\n file_1.ondata(null, et, true);\n else {\n var ctr = _this_1.o[cmp_1];\n if (!ctr)\n file_1.ondata(err(14, 'unknown compression type ' + cmp_1, 1), null, false);\n d_1 = sc_1 < 0 ? new ctr(fn_1) : new ctr(fn_1, sc_1, su_1);\n d_1.ondata = function (err, dat, final) { file_1.ondata(err, dat, final); };\n for (var _i = 0, chks_4 = chks_3; _i < chks_4.length; _i++) {\n var dat = chks_4[_i];\n d_1.push(dat, false);\n }\n if (_this_1.k[0] == chks_3 && _this_1.c)\n _this_1.d = d_1;\n else\n d_1.push(et, true);\n }\n },\n terminate: function () {\n if (d_1 && d_1.terminate)\n d_1.terminate();\n }\n };\n if (sc_1 >= 0)\n file_1.size = sc_1, file_1.originalSize = su_1;\n this_1.onfile(file_1);\n }\n return \"break\";\n }\n else if (oc) {\n if (sig == 0x8074B50) {\n is = i += 12 + (oc == -2 && 8), f = 3, this_1.c = 0;\n return \"break\";\n }\n else if (sig == 0x2014B50) {\n is = i -= 4, f = 3, this_1.c = 0;\n return \"break\";\n }\n }\n };\n var this_1 = this;\n for (; i < l - 4; ++i) {\n var state_1 = _loop_2();\n if (state_1 === \"break\")\n break;\n }\n this.p = et;\n if (oc < 0) {\n var dat = f ? buf.subarray(0, is - 12 - (oc == -2 && 8) - (b4(buf, is - 16) == 0x8074B50 && 4)) : buf.subarray(0, i);\n if (add)\n add.push(dat, !!f);\n else\n this.k[+(f == 2)].push(dat);\n }\n if (f & 2)\n return this.push(buf.subarray(i), final);\n this.p = buf.subarray(i);\n }\n if (final) {\n if (this.c)\n err(13);\n this.p = null;\n }\n };\n /**\n * Registers a decoder with the stream, allowing for files compressed with\n * the compression type provided to be expanded correctly\n * @param decoder The decoder constructor\n */\n Unzip.prototype.register = function (decoder) {\n this.o[decoder.compression] = decoder;\n };\n return Unzip;\n}());\nexport { Unzip };\nvar mt = typeof queueMicrotask == 'function' ? queueMicrotask : typeof setTimeout == 'function' ? setTimeout : function (fn) { fn(); };\nexport function unzip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n var term = [];\n var tAll = function () {\n for (var i = 0; i < term.length; ++i)\n term[i]();\n };\n var files = {};\n var cbd = function (a, b) {\n mt(function () { cb(a, b); });\n };\n mt(function () { cbd = cb; });\n var e = data.length - 22;\n for (; b4(data, e) != 0x6054B50; --e) {\n if (!e || data.length - e > 65558) {\n cbd(err(13, 0, 1), null);\n return tAll;\n }\n }\n ;\n var lft = b2(data, e + 8);\n if (lft) {\n var c = lft;\n var o = b4(data, e + 16);\n var z = o == 4294967295;\n if (z) {\n e = b4(data, e - 12);\n if (b4(data, e) != 0x6064B50) {\n cbd(err(13, 0, 1), null);\n return tAll;\n }\n c = lft = b4(data, e + 32);\n o = b4(data, e + 48);\n }\n var fltr = opts && opts.filter;\n var _loop_3 = function (i) {\n var _a = zh(data, o, z), c_1 = _a[0], sc = _a[1], su = _a[2], fn = _a[3], no = _a[4], off = _a[5], b = slzh(data, off);\n o = no;\n var cbl = function (e, d) {\n if (e) {\n tAll();\n cbd(e, null);\n }\n else {\n if (d)\n files[fn] = d;\n if (!--lft)\n cbd(null, files);\n }\n };\n if (!fltr || fltr({\n name: fn,\n size: sc,\n originalSize: su,\n compression: c_1\n })) {\n if (!c_1)\n cbl(null, slc(data, b, b + sc));\n else if (c_1 == 8) {\n var infl = data.subarray(b, b + sc);\n if (sc < 320000) {\n try {\n cbl(null, inflateSync(infl, new u8(su)));\n }\n catch (e) {\n cbl(e, null);\n }\n }\n else\n term.push(inflate(infl, { size: su }, cbl));\n }\n else\n cbl(err(14, 'unknown compression type ' + c_1, 1), null);\n }\n else\n cbl(null, null);\n };\n for (var i = 0; i < c; ++i) {\n _loop_3(i);\n }\n }\n else\n cbd(null, {});\n return tAll;\n}\n/**\n * Synchronously decompresses a ZIP archive. Prefer using `unzip` for better\n * performance with more than one file.\n * @param data The raw compressed ZIP file\n * @param opts The ZIP extraction options\n * @returns The decompressed files\n */\nexport function unzipSync(data, opts) {\n var files = {};\n var e = data.length - 22;\n for (; b4(data, e) != 0x6054B50; --e) {\n if (!e || data.length - e > 65558)\n err(13);\n }\n ;\n var c = b2(data, e + 8);\n if (!c)\n return {};\n var o = b4(data, e + 16);\n var z = o == 4294967295;\n if (z) {\n e = b4(data, e - 12);\n if (b4(data, e) != 0x6064B50)\n err(13);\n c = b4(data, e + 32);\n o = b4(data, e + 48);\n }\n var fltr = opts && opts.filter;\n for (var i = 0; i < c; ++i) {\n var _a = zh(data, o, z), c_2 = _a[0], sc = _a[1], su = _a[2], fn = _a[3], no = _a[4], off = _a[5], b = slzh(data, off);\n o = no;\n if (!fltr || fltr({\n name: fn,\n size: sc,\n originalSize: su,\n compression: c_2\n })) {\n if (!c_2)\n files[fn] = slc(data, b, b + sc);\n else if (c_2 == 8)\n files[fn] = inflateSync(data.subarray(b, b + sc), new u8(su));\n else\n err(14, 'unknown compression type ' + c_2);\n }\n }\n return files;\n}\n","/* eslint-disable no-bitwise */\n// ----------------------------------------------------------------------------\n// Decoding infrastructure\n// ----------------------------------------------------------------------------\nvar REVERSE_LOOKUP = [];\nREVERSE_LOOKUP['-'.charCodeAt(0)] = 62;\nREVERSE_LOOKUP['_'.charCodeAt(0)] = 63;\nvar BASE64_CODE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n\nfor (var i = 0; i < BASE64_CODE.length; i++) {\n REVERSE_LOOKUP[BASE64_CODE.charCodeAt(i)] = i;\n} // ----------------------------------------------------------------------------\n// Base64 analysis\n// ----------------------------------------------------------------------------\n\n\nfunction isValidChar(c) {\n return REVERSE_LOOKUP[c.charCodeAt(0)] !== undefined;\n}\n\nfunction extractChunks(b64Str) {\n var strSize = b64Str.length;\n var chunks = [];\n var currentChunk = null;\n\n for (var _i = 0; _i < strSize; _i++) {\n if (isValidChar(b64Str[_i])) {\n if (!currentChunk) {\n currentChunk = {\n start: _i,\n count: 0\n };\n }\n\n currentChunk.count++;\n currentChunk.end = _i;\n } else if (b64Str[_i] === '=' && currentChunk) {\n // End of chunk (found padding char)\n chunks.push(currentChunk);\n currentChunk = null;\n }\n }\n\n if (currentChunk) {\n chunks.push(currentChunk);\n }\n\n return chunks;\n}\n\nfunction writeChunk(b64Str, chunk, dstOffset, uint8) {\n var start = chunk.start,\n count = chunk.count;\n var remain = count % 4;\n var fourCharProcessCount = Math.floor(count / 4);\n var charIdx = start;\n var tmp = null;\n var offset = dstOffset; // Handle 4=>3\n\n for (var _i2 = 0; _i2 < fourCharProcessCount; _i2++) {\n while (!isValidChar(b64Str[charIdx])) {\n charIdx++;\n }\n\n tmp = REVERSE_LOOKUP[b64Str.charCodeAt(charIdx++)] << 18;\n\n while (!isValidChar(b64Str[charIdx])) {\n charIdx++;\n }\n\n tmp |= REVERSE_LOOKUP[b64Str.charCodeAt(charIdx++)] << 12;\n\n while (!isValidChar(b64Str[charIdx])) {\n charIdx++;\n }\n\n tmp |= REVERSE_LOOKUP[b64Str.charCodeAt(charIdx++)] << 6;\n\n while (!isValidChar(b64Str[charIdx])) {\n charIdx++;\n }\n\n tmp |= REVERSE_LOOKUP[b64Str.charCodeAt(charIdx++)];\n uint8[offset++] = tmp >> 16 & 0xff;\n uint8[offset++] = tmp >> 8 & 0xff;\n uint8[offset++] = tmp & 0xff;\n } // Handle remain\n\n\n switch (remain) {\n case 3:\n while (!isValidChar(b64Str[charIdx])) {\n charIdx++;\n }\n\n tmp = REVERSE_LOOKUP[b64Str.charCodeAt(charIdx++)] << 10;\n\n while (!isValidChar(b64Str[charIdx])) {\n charIdx++;\n }\n\n tmp |= REVERSE_LOOKUP[b64Str.charCodeAt(charIdx++)] << 4;\n\n while (!isValidChar(b64Str[charIdx])) {\n charIdx++;\n }\n\n tmp |= REVERSE_LOOKUP[b64Str.charCodeAt(charIdx++)] >> 2;\n uint8[offset++] = tmp >> 8 & 0xff;\n uint8[offset++] = tmp & 0xff;\n break;\n\n case 2:\n while (!isValidChar(b64Str[charIdx])) {\n charIdx++;\n }\n\n tmp = REVERSE_LOOKUP[b64Str.charCodeAt(charIdx++)] << 2;\n\n while (!isValidChar(b64Str[charIdx])) {\n charIdx++;\n }\n\n tmp |= REVERSE_LOOKUP[b64Str.charCodeAt(charIdx++)] >> 4;\n uint8[offset++] = tmp & 0xff;\n break;\n\n case 1:\n throw new Error('BASE64: remain 1 should not happen');\n }\n\n return offset;\n}\n\nfunction toArrayBuffer(b64Str) {\n var chunks = extractChunks(b64Str);\n var totalEncodedLength = chunks[chunks.length - 1].end + 1;\n var padding = (4 - totalEncodedLength % 4) % 4; // -length mod 4\n // Any padding chars in the middle of b64Str is to be interpreted as \\x00,\n // whereas the terminating padding chars are to be interpreted as literal padding.\n\n var totalSize = (totalEncodedLength + padding) * 3 / 4 - padding;\n var arrayBuffer = new ArrayBuffer(totalSize);\n var view = new Uint8Array(arrayBuffer);\n var dstOffset = 0;\n\n for (var _i3 = 0; _i3 < chunks.length; _i3++) {\n dstOffset += writeChunk(b64Str, chunks[_i3], dstOffset, view);\n dstOffset += (4 - chunks[_i3].count % 4) % 4;\n }\n\n return arrayBuffer;\n}\n\nfunction encodeTriplet(v1, v2, v3) {\n var triplet = (v1 << 16) + (v2 << 8) + v3;\n return BASE64_CODE[triplet >> 18] + BASE64_CODE[triplet >> 12 & 0x3f] + BASE64_CODE[triplet >> 6 & 0x3f] + BASE64_CODE[triplet & 0x3f];\n}\n\nfunction fromArrayBuffer(ab) {\n var uint8 = new Uint8Array(ab);\n var leftoverLength = ab.byteLength % 3;\n var maxTripletIndex = ab.byteLength - leftoverLength;\n var segments = Array(maxTripletIndex / 3);\n\n for (var _i4 = 0; _i4 < segments.length; _i4++) {\n var bufOffset = _i4 * 3;\n segments[_i4] = encodeTriplet(uint8[bufOffset], uint8[bufOffset + 1], uint8[bufOffset + 2]);\n }\n\n if (leftoverLength > 0) {\n var segment = encodeTriplet(uint8[maxTripletIndex], uint8[maxTripletIndex + 1] || 0, uint8[maxTripletIndex + 2] || 0);\n\n if (leftoverLength === 1) {\n segments.push(\"\".concat(segment.substr(0, 2), \"==\"));\n } else if (leftoverLength === 2) {\n segments.push(\"\".concat(segment.substr(0, 3), \"=\"));\n }\n }\n\n return segments.join('');\n}\nvar Base64 = {\n toArrayBuffer: toArrayBuffer,\n fromArrayBuffer: fromArrayBuffer\n};\n\nexport { Base64 as default, fromArrayBuffer, toArrayBuffer };\n","var FormatTypes = {\n ASCII: 'ascii',\n BINARY: 'binary',\n APPENDED: 'appended'\n};\nvar TYPED_ARRAY = {\n Int8Array: 'Int8',\n Uint8Array: 'UInt8',\n Int16Array: 'Int16',\n Uint16Array: 'UInt16',\n Int32Array: 'Int32',\n Uint32Array: 'UInt32',\n Float32Array: 'Float32',\n Float64Array: 'Float64'\n};\nvar Constants = {\n FormatTypes: FormatTypes\n};\n\nexport { FormatTypes, TYPED_ARRAY, Constants as default };\n","import { create } from 'xmlbuilder2';\nimport { zlibSync } from 'fflate';\nimport macro from '../../macros.js';\nimport { fromArrayBuffer } from '../../Common/Core/Base64.js';\nimport { FormatTypes, TYPED_ARRAY } from './XMLWriter/Constants.js';\n\n// Global methods\n// ----------------------------------------------------------------------------\n\nfunction compressBlock(uncompressed) {\n return zlibSync(uncompressed);\n}\n\nfunction processDataArray(dataArray, format, blockSize) {\n var compressor = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'vtkZLibDataCompressor';\n\n if (format === FormatTypes.ASCII) {\n return dataArray.getData().join(' ');\n }\n\n if (format === FormatTypes.BINARY) {\n if (compressor === 'vtkZLibDataCompressor') {\n // ----------------------------------------------------------------------\n // Layout of the data\n // header[N, s1, s1, blockSize1, ..., blockSizeN], [padding???], block[compressedData], ..., block[compressedData]\n // [header] N, s1 and s2 are uint 32 or 64 (defined by header_type=\"UInt64\" attribute on the root node)\n // [header] s1: uncompress size of each block except the last one\n // [header] s2: uncompress size of the last blocks\n // [header] blockSize: size of the block in compressed space that represent to bloc to inflate in zlib. (This also give the offset to the next block)\n // ----------------------------------------------------------------------\n var componentUint8Size = dataArray.getElementComponentSize();\n var uncompressedUint8Size = dataArray.getNumberOfValues() * componentUint8Size;\n var blockUint8Size = blockSize;\n var nbFullBlocks = Math.trunc(uncompressedUint8Size / blockUint8Size);\n var lastBlockUint8Size = uncompressedUint8Size % blockUint8Size;\n var nbBlocks = nbFullBlocks + (lastBlockUint8Size ? 1 : 0);\n var header = new Uint32Array(3 + nbBlocks);\n header[0] = nbBlocks; // N\n\n header[1] = blockUint8Size; // s1\n\n header[2] = lastBlockUint8Size; // s2\n\n var totalUint8Length = 0;\n var blocks = [];\n var dataOffset = 0;\n var lastBlockId = nbBlocks - 1;\n\n for (var blockId = 0; blockId < nbBlocks; ++blockId) {\n var currentBlockUint8Size = lastBlockUint8Size === 0 || blockId < lastBlockId ? blockUint8Size : header[2];\n var uncompressedBlock = new Uint8Array(dataArray.getData().buffer, dataOffset, currentBlockUint8Size);\n dataOffset += blockUint8Size;\n var compressedUint8Block = compressBlock(uncompressedBlock);\n blocks.push(compressedUint8Block);\n header[3 + blockId] = compressedUint8Block.length;\n totalUint8Length += compressedUint8Block.length;\n }\n\n var uint8 = new Uint8Array(totalUint8Length);\n var uint8Offset = 0;\n var headerUint8 = new Uint8Array(header.buffer);\n\n for (var _blockId = 0; _blockId < nbBlocks; ++_blockId) {\n uint8.set(blocks[_blockId], uint8Offset);\n uint8Offset += header[3 + _blockId];\n }\n\n return fromArrayBuffer(headerUint8.buffer) + fromArrayBuffer(uint8.buffer);\n }\n\n throw new Error('Only vtkZLibDataCompressor is supported');\n }\n\n if (format === FormatTypes.APPENDED) {\n throw new Error('Appended format is not supported');\n }\n\n throw new Error('Format is not supported');\n} // ----------------------------------------------------------------------------\n// vtkXMLWriter methods\n// ----------------------------------------------------------------------------\n\n\nfunction vtkXMLWriter(publicAPI, model) {\n // Set our className\n model.classHierarchy.push('vtkXMLWriter'); // Can be overridden in subclass\n\n publicAPI.create = function (dataObject) {\n return create().ele('VTKFile').att('type', model.dataType).att('version', '0.1').att('byte_order', 'LittleEndian').att('header_type', 'UInt32').att('compressor', model.format === FormatTypes.ASCII ? '' : 'vtkZLibDataCompressor');\n };\n\n publicAPI.write = function (object) {\n return publicAPI.create(object).end({\n pretty: true\n });\n };\n\n publicAPI.processDataSetAttributes = function (parentElement, name, datasetAttributes) {\n var activeAttributes = {};\n var attrTypes = ['Scalars', 'Vectors', 'Normals', 'TCoords', 'Tensors', 'GlobalIds', 'PedigreeIds'];\n attrTypes.forEach(function (attrType) {\n var activeAttribute = datasetAttributes.getActiveAttribute(attrType);\n\n if (activeAttribute) {\n activeAttributes[attrType] = activeAttribute.getName();\n }\n });\n var datasetAttributesEle = parentElement.ele(name, activeAttributes);\n\n for (var i = 0; i < datasetAttributes.getNumberOfArrays(); ++i) {\n publicAPI.processDataArray(datasetAttributesEle, datasetAttributes.getArrayByIndex(i));\n }\n\n return datasetAttributesEle;\n };\n\n publicAPI.processDataArray = function (parentEle, scalars) {\n return parentEle.ele('DataArray', {\n type: TYPED_ARRAY[scalars.getDataType()],\n Name: scalars.getName(),\n format: publicAPI.getFormat(),\n RangeMin: scalars.getRange()[0],\n RangeMax: scalars.getRange()[1],\n NumberOfComponents: scalars.getNumberOfComponents()\n }).txt(processDataArray(scalars, publicAPI.getFormat(), publicAPI.getBlockSize()));\n };\n\n publicAPI.requestData = function (inData, outData) {\n model.file = publicAPI.write(inData);\n };\n} // ----------------------------------------------------------------------------\n// Object factory\n// ----------------------------------------------------------------------------\n\n\nvar DEFAULT_VALUES = {\n blockSize: 1024,\n // file: null,\n format: FormatTypes.BINARY\n}; // ----------------------------------------------------------------------------\n\nfunction extend(publicAPI, model) {\n var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n Object.assign(model, DEFAULT_VALUES, initialValues); // Build VTK API\n\n macro.obj(publicAPI, model);\n macro.setGet(publicAPI, model, ['blockSize', 'format']);\n macro.get(publicAPI, model, ['file']);\n macro.algo(publicAPI, model, 1, 0); // vtkXMLWriter methods\n\n vtkXMLWriter(publicAPI, model);\n} // ----------------------------------------------------------------------------\n\nvar vtkXMLWriter$1 = {\n extend: extend,\n compressBlock: compressBlock,\n processDataArray: processDataArray,\n FormatTypes: FormatTypes\n};\n\nexport { vtkXMLWriter$1 as default, extend };\n","import _defineProperty from '@babel/runtime/helpers/defineProperty';\nimport macro from '../../macros.js';\nimport vtkXMLWriter from './XMLWriter.js';\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\n// Global methods\n// ----------------------------------------------------------------------------\n// ----------------------------------------------------------------------------\n// vtkXMLImageDataWriter methods\n// ----------------------------------------------------------------------------\n\nfunction vtkXMLImageDataWriter(publicAPI, model) {\n // Set our className\n model.classHierarchy.push('vtkXMLImageDataWriter'); // Capture \"parentClass\" api for internal use\n\n var superClass = _objectSpread({}, publicAPI);\n\n publicAPI.create = function (dataObject) {\n var parent = superClass.create(dataObject);\n var imageData = parent.ele('ImageData', {\n WholeExtent: dataObject.getExtent().join(' '),\n Origin: dataObject.getOrigin().join(' '),\n Spacing: dataObject.getSpacing().join(' '),\n Direction: dataObject.getDirection().join(' ')\n });\n var piece = imageData.ele('Piece', {\n Extent: dataObject.getExtent().join(' ')\n });\n publicAPI.processDataSetAttributes(piece, 'PointData', dataObject.getPointData());\n publicAPI.processDataSetAttributes(piece, 'CellData', dataObject.getCellData());\n return parent;\n };\n} // ----------------------------------------------------------------------------\n// Object factory\n// ----------------------------------------------------------------------------\n\n\nvar DEFAULT_VALUES = {\n dataType: 'ImageData'\n}; // ----------------------------------------------------------------------------\n\nfunction extend(publicAPI, model) {\n var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n Object.assign(model, DEFAULT_VALUES, initialValues);\n vtkXMLWriter.extend(publicAPI, model, initialValues);\n vtkXMLImageDataWriter(publicAPI, model);\n} // ----------------------------------------------------------------------------\n\nvar newInstance = macro.newInstance(extend, 'vtkXMLImageDataWriter'); // ----------------------------------------------------------------------------\n\nvar vtkXMLImageDataWriter$1 = {\n newInstance: newInstance,\n extend: extend\n};\n\nexport { vtkXMLImageDataWriter$1 as default, extend, newInstance };\n","/**\n * Macro shim to provide backwards compat with\n * projects that still import from 'macro.js'\n */\nimport macro from './macros.js';\n\nexport * from './macros.js';\nexport default macro;\n","import macro from '@kitware/vtk.js/macro';\nimport vtkImageData from '@kitware/vtk.js/Common/DataModel/ImageData';\n\n// ----------------------------------------------------------------------------\n// vtkLabelMap methods\n// ----------------------------------------------------------------------------\n\nfunction vtkLabelMap(publicAPI, model) {\n // Set our className\n model.classHierarchy.push('vtkLabelMap');\n\n if (model.colorMap === null) {\n // default colormap\n model.colorMap = {\n 0: [0, 0, 0, 0],\n 1: [0, 0, 0, 255],\n };\n }\n}\n\n// ----------------------------------------------------------------------------\n// Object factory\n// ----------------------------------------------------------------------------\n\nconst DEFAULT_VALUES = {\n // default opacity map uses 0 as the transparent pixel\n colorMap: null,\n};\n\n// ----------------------------------------------------------------------------\n\nexport function extend(publicAPI, model, initialValues = {}) {\n Object.assign(model, DEFAULT_VALUES, initialValues);\n\n vtkImageData.extend(publicAPI, model, initialValues);\n\n macro.setGet(publicAPI, model, ['colorMap']);\n\n // Object specific methods\n vtkLabelMap(publicAPI, model);\n}\n\n// ----------------------------------------------------------------------------\n\nexport const newInstance = macro.newInstance(extend, 'vtkLabelMap');\n\n// ----------------------------------------------------------------------------\n\nexport default { newInstance, extend };\n","import { extensionToImageIO } from 'itk-wasm';\nimport { extractFilesFromZip } from './zip';\nimport { FileEntry } from './types';\n\nexport const ARCHIVE_FILE_TYPES = new Set(['zip', 'application/zip']);\n\nexport const ITK_IMAGE_EXTENSIONS = Array.from(\n new Set(Array.from(extensionToImageIO.keys()).map((ext) => ext.toLowerCase()))\n);\n\n// remove duplicates\nexport const FILE_TYPES = Array.from(\n new Set(['vti', 'vtp', 'stl', 'dcm', 'zip', 'json', ...ITK_IMAGE_EXTENSIONS])\n);\n\n/**\n * file magic database\n * Used to handle certain cases where files have no extension\n */\nconst FILE_MAGIC_DB = [\n {\n type: 'dcm',\n skip: 128,\n header: Array.from('DICM').map((c) => c.charCodeAt(0)),\n },\n];\n\n// How much data to read when extracting file magic.\n// This should be generous enough for most files.\nconst HEAD_CHUNK = 512;\n\nfunction prefixEquals(target: Uint8Array, prefix: number[] | Uint8Array) {\n if (prefix.length > target.length) {\n return false;\n }\n for (let i = 0; i < prefix.length; i += 1) {\n if (prefix[i] !== target[i]) {\n return false;\n }\n }\n return true;\n}\n\nasync function getFileTypeFromMagic(file: File): Promise<string | null> {\n return new Promise((resolve) => {\n const head = file.slice(0, HEAD_CHUNK);\n const reader = new FileReader();\n reader.onload = () => {\n const chunk = new Uint8Array(reader.result! as ArrayBuffer);\n for (let i = 0; i < FILE_MAGIC_DB.length; i += 1) {\n const { type, header, skip = 0 } = FILE_MAGIC_DB[i];\n if (prefixEquals(chunk.slice(skip), header)) {\n resolve(type);\n return;\n }\n }\n resolve(null);\n };\n reader.readAsArrayBuffer(head);\n });\n}\n\n/**\n * Retypes a given File.\n *\n * Handy for when a file object has no type given.\n * Type is inferred from extension or magic.\n *\n * If type is not supported, file.type will be \"\".\n * @param file\n */\nexport async function retypeFile(file: File): Promise<File> {\n let type: string | null;\n\n type =\n FILE_TYPES.find((ext) => file.name.toLowerCase().endsWith(`.${ext}`)) ??\n null;\n\n if (!type) {\n type = await getFileTypeFromMagic(file);\n }\n\n if (!type) {\n type = '';\n }\n\n const retypedFile = new File([file], file.name, { type: type.toLowerCase() });\n return retypedFile;\n}\n\nexport async function extractArchivesRecursively(\n files: File[]\n): Promise<FileEntry[]> {\n const results = await Promise.all(\n files.map(async (file) => {\n if (ARCHIVE_FILE_TYPES.has(file.type)) {\n return extractFilesFromZip(file);\n }\n\n return [{ file, path: '' }];\n })\n );\n\n const archivedEntries = await Promise.all(\n results.flat().map(async (entry) => {\n return { file: await retypeFile(entry.file), path: entry.path };\n })\n );\n\n const archives = archivedEntries\n .filter(({ file }) => ARCHIVE_FILE_TYPES.has(file.type))\n .map(({ file }) => file);\n\n if (archives.length > 0) {\n const moreEntries = await extractArchivesRecursively(archives);\n return [...archivedEntries, ...moreEntries];\n }\n\n return archivedEntries;\n}\n\nexport type ReadAsType = 'ArrayBuffer' | 'Text';\n\nasync function readFileAs<T extends ArrayBuffer | string>(\n file: File,\n type: ReadAsType\n): Promise<T> {\n return new Promise((resolve) => {\n const fio = new globalThis.FileReader();\n fio.onload = () => resolve(fio.result as T);\n if (type === 'ArrayBuffer') {\n fio.readAsArrayBuffer(file);\n } else if (type === 'Text') {\n fio.readAsText(file);\n } else {\n throw new TypeError(`readAs${type} is not a function`);\n }\n });\n}\n\n/**\n * Reads a file and returns an ArrayBuffer\n * @async\n * @param {File} file\n */\nexport async function readFileAsArrayBuffer(file: File) {\n return readFileAs<ArrayBuffer>(file, 'ArrayBuffer');\n}\n\n/**\n * Reads a file and returns UTF-8 text\n * @async\n * @param {File} file\n */\nexport async function readFileAsUTF8Text(file: File) {\n return readFileAs<string>(file, 'Text');\n}\n","import { vtkObject } from '@kitware/vtk.js/interfaces';\n\nexport * from './io';\n\nexport type ReaderType = (file: File) => vtkObject | Promise<vtkObject>;\nexport type FileReaderMap = Map<string, ReaderType>;\n\n/**\n * A map of the currently registered file readers.\n */\nexport const FILE_READERS: FileReaderMap = new Map();\n","import { vtkReader, vtkWriter, vtkClass } from '@/src/types/vtk-types';\nimport { readFileAsArrayBuffer, readFileAsUTF8Text } from '@/src/io';\nimport vtkDataSet from '@kitware/vtk.js/Common/DataModel/DataSet';\n\nexport async function readFile(\n file: File,\n vtkReaderClass: vtkClass,\n asBinary = true\n) {\n const reader: vtkReader = vtkReaderClass.newInstance() as vtkReader;\n if (asBinary) {\n const buffer = await readFileAsArrayBuffer(file);\n reader.parseAsArrayBuffer(buffer);\n } else {\n const buffer = await readFileAsUTF8Text(file);\n reader.parseAsText(buffer);\n }\n return reader.getOutputData();\n}\n\nexport async function writeData(vtkWriterClass: vtkClass, data: vtkDataSet) {\n const writer: vtkWriter = vtkWriterClass.newInstance() as vtkWriter;\n\n return writer.write(data);\n}\n\nexport interface StateObject {\n vtkClass: string;\n [attrName: string]: unknown;\n}\n","import vtkXMLImageDataWriter from '@kitware/vtk.js/IO/XML/XMLImageDataWriter';\nimport vtkDataSet from '@kitware/vtk.js/Common/DataModel/DataSet';\n\nimport workerHandler from '@/src/utils/workerHandler';\nimport vtkLabelMap from '@/src/vtk/LabelMap';\nimport vtk from '@kitware/vtk.js/vtk';\n\nimport { writeData, StateObject } from './common';\n\nconst Writers = {\n vti: {\n writerClass: vtkXMLImageDataWriter,\n },\n};\n\nexport interface WorkerInput {\n obj: StateObject;\n writerName: keyof typeof Writers;\n}\n\nvtk.register('vtkLabelMap', vtkLabelMap.newInstance);\n\nworkerHandler.registerHandler(async (inputData: WorkerInput) => {\n try {\n const { obj, writerName } = inputData;\n if (!obj) {\n throw new Error('No data provided');\n }\n if (!(writerName in Writers)) {\n throw new Error(`No writer found for ${writerName}`);\n }\n\n const { writerClass } = Writers[writerName];\n\n const serialized = await writeData(writerClass, vtk(obj) as vtkDataSet);\n return {\n status: 'success',\n data: serialized,\n };\n } catch (error) {\n return {\n status: 'fail',\n error: error as Error,\n };\n }\n});\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\tid: moduleId,\n\t\tloaded: false,\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Flag the module as loaded\n\tmodule.loaded = true;\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n// the startup function\n__webpack_require__.x = function() {\n\t// Load entry module and return exports\n\t// This entry module depends on other loaded chunks and execution need to be delayed\n\tvar __webpack_exports__ = __webpack_require__.O(undefined, [23], function() { return __webpack_require__(2917); })\n\t__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n\treturn __webpack_exports__;\n};\n\n","__webpack_require__.amdD = function () {\n\tthrow new Error('define cannot be used indirect');\n};","__webpack_require__.amdO = {};","var deferred = [];\n__webpack_require__.O = function(result, chunkIds, fn, priority) {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar chunkIds = deferred[i][0];\n\t\tvar fn = deferred[i][1];\n\t\tvar priority = deferred[i][2];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every(function(key) { return __webpack_require__.O[key](chunkIds[j]); })) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.f = {};\n// This file contains only the entry chunk.\n// The chunk loading function for additional chunks\n__webpack_require__.e = function(chunkId) {\n\treturn Promise.all(Object.keys(__webpack_require__.f).reduce(function(promises, key) {\n\t\t__webpack_require__.f[key](chunkId, promises);\n\t\treturn promises;\n\t}, []));\n};","// This function allow to reference async chunks and sibling chunks for the entrypoint\n__webpack_require__.u = function(chunkId) {\n\t// return url for filenames based on template\n\treturn \"js/\" + chunkId + \".\" + \"be4d694e\" + \".js\";\n};","// This function allow to reference async chunks and sibling chunks for the entrypoint\n__webpack_require__.miniCssF = function(chunkId) {\n\t// return url for filenames based on template\n\treturn undefined;\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","__webpack_require__.nmd = function(module) {\n\tmodule.paths = [];\n\tif (!module.children) module.children = [];\n\treturn module;\n};","__webpack_require__.p = \"/\";","// no baseURI\n\n// object to store loaded chunks\n// \"1\" means \"already loaded\"\nvar installedChunks = {\n\t422: 1\n};\n\n// importScripts chunk loading\nvar installChunk = function(data) {\n\tvar chunkIds = data[0];\n\tvar moreModules = data[1];\n\tvar runtime = data[2];\n\tfor(var moduleId in moreModules) {\n\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t}\n\t}\n\tif(runtime) runtime(__webpack_require__);\n\twhile(chunkIds.length)\n\t\tinstalledChunks[chunkIds.pop()] = 1;\n\tparentChunkLoadingFunction(data);\n};\n__webpack_require__.f.i = function(chunkId, promises) {\n\t// \"1\" is the signal for \"already loaded\"\n\tif(!installedChunks[chunkId]) {\n\t\tif(true) { // all chunks have JS\n\t\t\timportScripts(__webpack_require__.p + __webpack_require__.u(chunkId));\n\t\t}\n\t}\n};\n\nvar chunkLoadingGlobal = self[\"webpackChunkVolView\"] = self[\"webpackChunkVolView\"] || [];\nvar parentChunkLoadingFunction = chunkLoadingGlobal.push.bind(chunkLoadingGlobal);\nchunkLoadingGlobal.push = installChunk;\n\n// no HMR\n\n// no HMR manifest","var next = __webpack_require__.x;\n__webpack_require__.x = function() {\n\treturn __webpack_require__.e(23).then(next);\n};","// run startup\nvar __webpack_exports__ = __webpack_require__.x();\n"],"names":["DataTypeByteSize","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","VtkDataTypes","VOID","CHAR","SIGNED_CHAR","UNSIGNED_CHAR","SHORT","UNSIGNED_SHORT","INT","UNSIGNED_INT","FLOAT","DOUBLE","DefaultDataType","Constants","vtkErrorMacro","notImplemented","method","concat","Math","round","floor","ceil","min","max","add","a","b","out","subtract","dot","x","y","cross","Zx","Zy","Zz","norm","n","arguments","length","undefined","abs","sqrt","sum","i","roundNumber","num","digits","includes","arr","split","sig","roundVector","vector","computeBoundsFromPoints","point1","point2","bounds","clampValue","value","minValue","maxValue","clampVector","minVector","maxVector","Number","isFinite","isNaN","ARRAY_TYPE","Array","random","PI","hypot","invert","a00","a01","a02","a03","a10","a11","a12","a13","a20","a21","a22","a23","a30","a31","a32","a33","b00","b01","b02","b03","b04","b05","b06","b07","b08","b09","b10","b11","det","scale","v","z","fromTranslation","create","transformMat4","m","w","vec","u8","u16","u32","fleb","fdeb","clim","freb","eb","start","r","j","_a","fl","revfl","_b","revfd","rev","hMap","cd","mb","s","l","co","le","rvb","sv","r_1","flt","fdt","flm","fdm","shft","p","slc","e","BYTES_PER_ELEMENT","set","subarray","wbits","d","o","wbits16","hTree","t","push","f","t2","slice","et","sort","i0","i1","i2","maxSym","tr","mbt","ln","dt","lft","cst","i2_1","i2_2","i2_3","lc","c","cl","cli","cln","cls","clen","cf","wfblk","pos","dat","wblk","final","syms","lf","df","li","bs","bl","dlt","mlb","ddt","mdb","_c","lclt","nlc","_d","lcdt","ndc","lcfreq","_e","lct","mlcb","nlcc","lm","ll","dm","dl","flen","ftlen","dtlen","llm","lcts","it","clct","len","dst","deo","dflt","lvl","plvl","pre","post","lst","opt","msk_1","prev","head","bs1_1","bs2_1","hsh","lc_1","wi","hv","imod","pimod","rem","ch_1","dif","maxn","maxd","ml","nl","mmd","md","ti","pti","lin","din","adler","dopt","st","level","mem","log","wbytes","zlh","lv","zlibSync","data","opts","td","TextDecoder","decode","stream","queueMicrotask","setTimeout","REVERSE_LOOKUP","charCodeAt","BASE64_CODE","encodeTriplet","v1","v2","v3","triplet","fromArrayBuffer","ab","uint8","leftoverLength","byteLength","maxTripletIndex","segments","_i4","bufOffset","segment","substr","join","FormatTypes","ASCII","BINARY","APPENDED","TYPED_ARRAY","compressBlock","uncompressed","processDataArray","dataArray","format","blockSize","compressor","getData","componentUint8Size","getElementComponentSize","uncompressedUint8Size","getNumberOfValues","blockUint8Size","nbFullBlocks","trunc","lastBlockUint8Size","nbBlocks","header","totalUint8Length","blocks","dataOffset","lastBlockId","blockId","currentBlockUint8Size","uncompressedBlock","buffer","compressedUint8Block","uint8Offset","headerUint8","_blockId","Error","vtkXMLWriter","publicAPI","model","classHierarchy","dataObject","ele","att","dataType","write","object","end","pretty","processDataSetAttributes","parentElement","name","datasetAttributes","activeAttributes","attrTypes","forEach","attrType","activeAttribute","getActiveAttribute","getName","datasetAttributesEle","getNumberOfArrays","getArrayByIndex","parentEle","scalars","type","getDataType","Name","getFormat","RangeMin","getRange","RangeMax","NumberOfComponents","getNumberOfComponents","txt","getBlockSize","requestData","inData","outData","file","DEFAULT_VALUES","extend","initialValues","Object","assign","vtkXMLWriter$1","ownKeys","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","apply","_objectSpread","target","source","key","getOwnPropertyDescriptors","defineProperties","defineProperty","vtkXMLImageDataWriter","superClass","parent","imageData","WholeExtent","getExtent","Origin","getOrigin","Spacing","getSpacing","Direction","getDirection","piece","Extent","getPointData","getCellData","newInstance","vtkXMLImageDataWriter$1","vtkLabelMap","colorMap","vtkImageData","macro","setGet","Set","ITK_IMAGE_EXTENSIONS","from","extensionToImageIO","map","ext","toLowerCase","Map","async","writeData","vtkWriterClass","writer","Writers","vti","writerClass","vtk","workerHandler","obj","writerName","inputData","serialized","status","error","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","exports","module","id","loaded","__webpack_modules__","call","__webpack_exports__","O","amdD","amdO","deferred","result","chunkIds","fn","priority","notFulfilled","Infinity","fulfilled","every","splice","getter","__esModule","definition","get","chunkId","Promise","all","reduce","promises","u","miniCssF","g","globalThis","this","Function","window","prop","prototype","hasOwnProperty","nmd","paths","children","installedChunks","installChunk","moreModules","runtime","pop","parentChunkLoadingFunction","importScripts","chunkLoadingGlobal","self","bind","next","then"],"sourceRoot":""}